Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Object?(A.il&&a(document),a(A._A),a(n.prototype)):n.prototype.hasOwnProperty(i)&&(s(A._A),s(n.

prot
otype)),t.on("addEventListener-start",(function(e,t){var n=e[1];if(null!==n&&("function"==typeof
n||"object"==typeof n)){var i=(0,ie.X)(n,"nr@wrapped",(function(){var
e={object:function(){if("function"!=typeof n.handleEvent)return;return
n.handleEvent.apply(n,arguments)},function:n}[typeof n];return e?r(e,"fn-
",null,e.name||"anonymous"):n}));this.wrapped=e[1]=i}})),t.on("removeEventListener-
start",(function(e){e[1]=this.wrapped||e[1]})),t}const Fe={};function $e(e){var r=e||oe.ee;const
n=function(e){return(e||oe.ee).get("xhr")}(r);if(Fe[n.debugId])return n;Fe[n.debugId]=!0,Be(r);var
i=Ee(n),o=t.Yu.XHR,a=t.Yu.MO,s=t.Yu.PR,c=t.Yu.SI,u="readystatechange",d=["onload","onerror","onabor
t","onloadstart","onloadend","onprogress","ontimeout"],f=[],l=A._A.XMLHttpRequest.listeners,h=A._A.
XMLHttpRequest=function(e){var t=new o(e);function r(){try{n.emit("new-
xhr",[t],t),t.addEventListener(u,g,(0,C.m$)(!1))}catch(e){(0,m.Z)("An error occured while intercepting
XHR",e);try{n.emit("internal-error",[e])}catch(e){}}}return
this.listeners=l?[...l,r]:[r],this.listeners.forEach((e=>e())),t};function
p(e,t){i.inPlace(t,["onreadystatechange"],"fn-",E)}function g(){var
e=this,t=n.context(e);e.readyState>3&&!t.resolved&&(t.resolved=!0,n.emit("xhr-
resolved",[],e)),i.inPlace(e,d,"fn-",E)}if(function(e,t){for(var r in
e)t[r]=e[r]}(o,h),h.prototype=o.prototype,i.inPlace(h.prototype,["open","send"],"-xhr-",E),n.on("send-
xhr-start",(function(e,t){p(e,t),function(e){f.push(e),a&&(v?v.then(w):c?c(w):(b=-
b,y.data=b))}(t)})),n.on("open-xhr-start",p),a){var v=s&&s.resolve();if(!c&&!s){var
b=1,y=document.createTextNode(b);new a(w).observe(y,{characterData:!0})}}else r.on("fn-
end",(function(e){e[0]&&e[0].type===u||w()}));function w(){for(var
e=0;e<f.length;e++)p(0,f[e]);f.length&&(f=[])}function E(e,t){return t}return n}function Ue(e){return
Be(e)}function Ve(e){return me(e)}function Ge(e){return Re(e)}function qe(e){return Pe(e)}function
We(e){return Ne(e)}function Xe(e){return $e(e)}var
Ze,Ye={};try{Ze=localStorage.getItem("__nr_flags").split(","),console&&"function"==typeof
console.log&&(Ye.console=!0,-1!==Ze.indexOf("dev")&&(Ye.dev=!0),-
1!==Ze.indexOf("nr_dev")&&(Ye.nrDev=!0))}catch(e){}function
Je(e){try{Ye.console&&Je(e)}catch(e){}}Ye.nrDev&&oe.ee.on("internal-
error",(function(e){Je(e.stack)})),Ye.dev&&oe.ee.on("fn-
err",(function(e,t,r){Je(r.stack)})),Ye.dev&&(Je("NR AGENT IN DEVELOPMENT MODE"),Je("flags:
"+(0,u.D)(Ye,(function(e,t){return e})).join(", ")));var Qe=i(8322);class Ke extends _{constructor(r,n){var
i;let o=!(arguments.length>2&&void
0!==arguments[2])||arguments[2];super(r,n,Qe.t,o),i=this,this.skipNext=0,this.handleErrors=!1,this.orig
Onerror=A._A?.onerror;const a=this,s=(0,t.OP)(this.agentIdentifier);s.features.err=!0,a.ee.on("fn-
start",(function(e,t,r){a.handleErrors&&(a.skipNext+=1)})),a.ee.on("fn-
err",(function(e,t,r){a.handleErrors&&!r[Qe.A]&&((0,ie.X)(r,Qe.A,(function(){return!0})),this.thrown=!0,t
t(r,void 0,a.ee))})),a.ee.on("fn-
end",(function(){a.handleErrors&&!this.thrown&&a.skipNext>0&&(a.skipNext-=1)})),a.ee.on("internal-
error",(t=>{(0,b.p)("ierr",[t,(0,y.zO)(),!0],void 0,e.D.jserrors,a.ee)}));const
c=A._A?.onerror;A._A.onerror=function(){return
c&&c(...arguments),i.onerrorHandler(...arguments),!1};try{A._A?.addEventListener("unhandledrejection
",(t=>{const r=new Error(`${t.reason}`);(0,b.p)("err",[r,(0,y.zO)(),!1,{unhandledPromiseRejection:1}],void
0,e.D.jserrors,this.ee)}))}catch(e){}try{throw new Error}catch(e){"stack"in
e&&(We(this.ee),qe(this.ee),"addEventListener"in
A._A&&Ue(this.ee),s.xhrWrappable&&Xe(this.ee),a.handleErrors=!0)}this.importAggregator()}onerrorHa
ndler(t,r,n,i,o){try{this.skipNext?this.skipNext-=1:tt(o||new
et(t,r,n),!0,this.ee)}catch(t){try{(0,b.p)("ierr",[t,(0,y.zO)(),!0],void
0,e.D.jserrors,this.ee)}catch(e){}}return"function"==typeof
this.origOnerror&&this.origOnerror.apply(this,se()(arguments))}}function
et(e,t,r){this.message=e||"Uncaught error with no additional
information",this.sourceURL=t,this.line=r}function tt(t,r,n){var i=r?null:(0,y.zO)();(0,b.p)("err",[t,i],void
0,e.D.jserrors,n)}!function(e,t,r){t in
e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Ke,"featureNa
me",Qe.t);var rt=1;function nt(e){var t=typeof e;return!e||"object"!==t&&"function"!==t?-
1:e===A._A?0:(0,ie.X)(e,"nr@id",(function(){return rt++}))}var it=i(9071);function
ot(e){if("string"==typeof e&&e.length)return e.length;if("object"==typeof e){if("undefined"!=typeof
ArrayBuffer&&e instanceof ArrayBuffer&&e.byteLength)return e.byteLength;if("undefined"!=typeof
Blob&&e instanceof Blob&&e.size)return e.size;if(!("undefined"!=typeof FormData&&e instanceof
FormData))try{return JSON.stringify(e).length}catch(e){return}}}var at=i(6368);class
st{constructor(e){this.agentIdentifier=e,this.generateTracePayload=this.generateTracePayload.bind(this)
,this.shouldGenerateTrace=this.shouldGenerateTrace.bind(this)}generateTracePayload(e){if(!this.should
GenerateTrace(e))return null;var r=(0,t.DL)(this.agentIdentifier);if(!r)return null;var
n=(r.accountID||"").toString()||null,i=(r.agentID||"").toString()||null,o=(r.trustKey||"").toString()||null
;if(!n||!i)return null;var
a=(0,v.M)(),s=(0,v.Ht)(),c=Date.now(),u={spanId:a,traceId:s,timestamp:c};return(e.sameOrigin||this.isAll
owedOrigin(e)&&this.useTraceContextHeadersForCors())&&(u.traceContextParentHeader=this.generate
TraceContextParentHeader(a,s),u.traceContextStateHeader=this.generateTraceContextStateHeader(a,c,
n,i,o)),(e.sameOrigin&&!this.excludeNewrelicHeader()||!e.sameOrigin&&this.isAllowedOrigin(e)&&this.
useNewrelicHeaderForCors())&&(u.newrelicHeader=this.generateTraceHeader(a,s,c,n,i,o)),u}generateTr
aceContextParentHeader(e,t){return"00-"+t+"-"+e+"-
01"}generateTraceContextStateHeader(e,t,r,n,i){return i+"@nr=0-1-"+r+"-"+n+"-"+e+"----
"+t}generateTraceHeader(e,t,r,n,i,o){if(!("function"==typeof A._A?.btoa))return null;var
a={v:[0,1],d:{ty:"Browser",ac:n,ap:i,id:e,tr:t,ti:r}};return
o&&n!==o&&(a.d.tk=o),btoa(JSON.stringify(a))}shouldGenerateTrace(e){return
this.isDtEnabled()&&this.isAllowedOrigin(e)}isAllowedOrigin(e){var
r=!1,n={};if((0,t.Mt)(this.agentIdentifier,"distributed_tracing")&&(n=(0,t.P_)(this.agentIdentifier).distribu
ted_tracing),e.sameOrigin)r=!0;else if(n.allowed_origins instanceof Array)for(var
i=0;i<n.allowed_origins.length;i++){var
o=(0,at.e)(n.allowed_origins[i]);if(e.hostname===o.hostname&&e.protocol===o.protocol&&e.port===o.
port){r=!0;break}}return r}isDtEnabled(){var
e=(0,t.Mt)(this.agentIdentifier,"distributed_tracing");return!!e&&!!e.enabled}excludeNewrelicHeader(){
var
e=(0,t.Mt)(this.agentIdentifier,"distributed_tracing");return!!e&&!!e.exclude_newrelic_header}useNewr
elicHeaderForCors(){var
e=(0,t.Mt)(this.agentIdentifier,"distributed_tracing");return!!e&&!1!==e.cors_use_newrelic_header}use
TraceContextHeadersForCors(){var
e=(0,t.Mt)(this.agentIdentifier,"distributed_tracing");return!!e&&!!e.cors_use_tracecontext_headers}}v

You might also like