@sentry/browser
Version:
Official Sentry SDK for browsers
2 lines • 52.2 kB
JavaScript
/*! @sentry/browser 5.22.3 (b185bfa) | https://github.com/getsentry/sentry-javascript */
var Sentry=function(t){var e,n,r;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Debug=2]="Debug",t[t.Verbose=3]="Verbose"}(e||(e={})),(n=t.Severity||(t.Severity={})).Fatal="fatal",n.Error="error",n.Warning="warning",n.Log="log",n.Info="info",n.Debug="debug",n.Critical="critical",function(t){t.fromString=function(e){switch(e){case"debug":return t.Debug;case"info":return t.Info;case"warn":case"warning":return t.Warning;case"error":return t.Error;case"fatal":return t.Fatal;case"critical":return t.Critical;case"log":default:return t.Log}}}(t.Severity||(t.Severity={})),(r=t.Status||(t.Status={})).Unknown="unknown",r.Skipped="skipped",r.Success="success",r.RateLimit="rate_limit",r.Invalid="invalid",r.Failed="failed",function(t){t.fromHttpCode=function(e){return e>=200&&e<300?t.Success:429===e?t.RateLimit:e>=400&&e<500?t.Invalid:e>=500?t.Failed:t.Unknown}}(t.Status||(t.Status={}));const i=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(t,e){return t.__proto__=e,t}:function(t,e){for(const n in e)t.hasOwnProperty(n)||(t[n]=e[n]);return t});class s extends Error{constructor(t){super(t),this.message=t,this.name=new.target.prototype.constructor.name,i(this,new.target.prototype)}}function o(t){switch(Object.prototype.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return b(t,Error)}}function c(t){return"[object ErrorEvent]"===Object.prototype.toString.call(t)}function u(t){return"[object DOMError]"===Object.prototype.toString.call(t)}function a(t){return"[object String]"===Object.prototype.toString.call(t)}function h(t){return null===t||"object"!=typeof t&&"function"!=typeof t}function l(t){return"[object Object]"===Object.prototype.toString.call(t)}function f(t){return"undefined"!=typeof Event&&b(t,Event)}function d(t){return"undefined"!=typeof Element&&b(t,Element)}function p(t){return Boolean(t&&t.then&&"function"==typeof t.then)}function b(t,e){try{return t instanceof e}catch(t){return!1}}function y(t,e=0){return"string"!=typeof t||0===e?t:t.length<=e?t:`${t.substr(0,e)}...`}function m(t,e){if(!Array.isArray(t))return"";const n=[];for(let e=0;e<t.length;e++){const r=t[e];try{n.push(String(r))}catch(t){n.push("[value cannot be serialized]")}}return n.join(e)}function v(t,e){return!!a(t)&&(n=e,"[object RegExp]"===Object.prototype.toString.call(n)?e.test(t):"string"==typeof e&&-1!==t.indexOf(e));var n}function g(){return"[object process]"===Object.prototype.toString.call("undefined"!=typeof process?process:0)}const j={};function E(){return g()?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:j}function w(){const t=E(),e=t.crypto||t.msCrypto;if(void 0!==e&&e.getRandomValues){const t=new Uint16Array(8);e.getRandomValues(t),t[3]=4095&t[3]|16384,t[4]=16383&t[4]|32768;const n=t=>{let e=t.toString(16);for(;e.length<4;)e=`0${e}`;return e};return n(t[0])+n(t[1])+n(t[2])+n(t[3])+n(t[4])+n(t[5])+n(t[6])+n(t[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}function O(t){if(!t)return{};const e=t.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],relative:e[5]+n+r}}function $(t){if(t.message)return t.message;if(t.exception&&t.exception.values&&t.exception.values[0]){const e=t.exception.values[0];return e.type&&e.value?`${e.type}: ${e.value}`:e.type||e.value||t.event_id||"<unknown>"}return t.event_id||"<unknown>"}function _(t){const e=E();if(!("console"in e))return t();const n=e.console,r={};["debug","info","warn","error","log","assert"].forEach(t=>{t in e.console&&n[t].__sentry_original__&&(r[t]=n[t],n[t]=n[t].__sentry_original__)});const i=t();return Object.keys(r).forEach(t=>{n[t]=r[t]}),i}function x(t,e,n){t.exception=t.exception||{},t.exception.values=t.exception.values||[],t.exception.values[0]=t.exception.values[0]||{},t.exception.values[0].value=t.exception.values[0].value||e||"",t.exception.values[0].type=t.exception.values[0].type||n||"Error"}function S(t,e={}){try{t.exception.values[0].mechanism=t.exception.values[0].mechanism||{},Object.keys(e).forEach(n=>{t.exception.values[0].mechanism[n]=e[n]})}catch(t){}}function k(t){try{let e=t;const n=5,r=80,i=[];let s=0,o=0;const c=" > ",u=c.length;let a;for(;e&&s++<n&&!("html"===(a=T(e))||s>1&&o+i.length*u+a.length>=r);)i.push(a),o+=a.length,e=e.parentNode;return i.reverse().join(c)}catch(t){return"<unknown>"}}function T(t){const e=t,n=[];let r,i,s,o,c;if(!e||!e.tagName)return"";if(n.push(e.tagName.toLowerCase()),e.id&&n.push(`#${e.id}`),(r=e.className)&&a(r))for(i=r.split(/\s+/),c=0;c<i.length;c++)n.push(`.${i[c]}`);const u=["type","name","title","alt"];for(c=0;c<u.length;c++)s=u[c],(o=e.getAttribute(s))&&n.push(`[${s}="${o}"]`);return n.join("")}const D=Date.now();let R=0;const I={now(){let t=Date.now()-D;return t<R&&(t=R),R=t,t},timeOrigin:D},C=(()=>{if(g())try{return function(t,e){return t.require(e)}(module,"perf_hooks").performance}catch(t){return I}const{performance:t}=E();return t&&t.now?(void 0===t.timeOrigin&&(t.timeOrigin=t.timing&&t.timing.navigationStart||D),t):I})();function M(){return(C.timeOrigin+C.now())/1e3}const N=6e4;function A(t,e){if(!e)return N;const n=parseInt(`${e}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${e}`);return isNaN(r)?N:r-t}const U="<anonymous>";function L(t){try{return t&&"function"==typeof t&&t.name||U}catch(t){return U}}const F=E(),q="Sentry Logger ";F.__SENTRY__=F.__SENTRY__||{};const B=F.__SENTRY__.logger||(F.__SENTRY__.logger=new class{constructor(){this.t=!1}disable(){this.t=!1}enable(){this.t=!0}log(...t){this.t&&_(()=>{F.console.log(`${q}[Log]: ${t.join(" ")}`)})}warn(...t){this.t&&_(()=>{F.console.warn(`${q}[Warn]: ${t.join(" ")}`)})}error(...t){this.t&&_(()=>{F.console.error(`${q}[Error]: ${t.join(" ")}`)})}});class H{constructor(){this.i="function"==typeof WeakSet,this.s=this.i?new WeakSet:[]}memoize(t){if(this.i)return!!this.s.has(t)||(this.s.add(t),!1);for(let e=0;e<this.s.length;e++){if(this.s[e]===t)return!0}return this.s.push(t),!1}unmemoize(t){if(this.i)this.s.delete(t);else for(let e=0;e<this.s.length;e++)if(this.s[e]===t){this.s.splice(e,1);break}}}function P(t,e,n){if(!(e in t))return;const r=t[e],i=n(r);if("function"==typeof i)try{i.prototype=i.prototype||{},Object.defineProperties(i,{__sentry_original__:{enumerable:!1,value:r}})}catch(t){}t[e]=i}function W(t){if(o(t)){const e=t,n={message:e.message,name:e.name,stack:e.stack};for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e[t]);return n}if(f(t)){const e=t,n={};n.type=e.type;try{n.target=d(e.target)?k(e.target):Object.prototype.toString.call(e.target)}catch(t){n.target="<unknown>"}try{n.currentTarget=d(e.currentTarget)?k(e.currentTarget):Object.prototype.toString.call(e.currentTarget)}catch(t){n.currentTarget="<unknown>"}"undefined"!=typeof CustomEvent&&b(t,CustomEvent)&&(n.detail=e.detail);for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(n[t]=e);return n}return t}function X(t){return function(t){return~-encodeURI(t).split(/%..|./).length}(JSON.stringify(t))}function G(t,e=3,n=102400){const r=V(t,e);return X(r)>n?G(t,e-1,n):r}function z(t,e){return"domain"===e&&t&&"object"==typeof t&&t.o?"[Domain]":"domainEmitter"===e?"[DomainEmitter]":"undefined"!=typeof global&&t===global?"[Global]":"undefined"!=typeof window&&t===window?"[Window]":"undefined"!=typeof document&&t===document?"[Document]":l(n=t)&&"nativeEvent"in n&&"preventDefault"in n&&"stopPropagation"in n?"[SyntheticEvent]":"number"==typeof t&&t!=t?"[NaN]":void 0===t?"[undefined]":"function"==typeof t?`[Function: ${L(t)}]`:t;var n}function J(t,e,n=1/0,r=new H){if(0===n)return function(t){const e=Object.prototype.toString.call(t);if("string"==typeof t)return t;if("[object Object]"===e)return"[Object]";if("[object Array]"===e)return"[Array]";const n=z(t);return h(n)?n:e}(e);if(null!=e&&"function"==typeof e.toJSON)return e.toJSON();const i=z(e,t);if(h(i))return i;const s=W(e),o=Array.isArray(e)?[]:{};if(r.memoize(e))return"[Circular ~]";for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(o[t]=J(t,s[t],n-1,r));return r.unmemoize(e),o}function V(t,e){try{return JSON.parse(JSON.stringify(t,(t,n)=>J(t,n,e)))}catch(t){return"**non-serializable**"}}function K(t,e=40){const n=Object.keys(W(t));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=e)return y(n[0],e);for(let t=n.length;t>0;t--){const r=n.slice(0,t).join(", ");if(!(r.length>e))return t===n.length?r:y(r,e)}return""}var Q;!function(t){t.PENDING="PENDING",t.RESOLVED="RESOLVED",t.REJECTED="REJECTED"}(Q||(Q={}));class Y{constructor(t){this.u=Q.PENDING,this.h=[],this.l=(t=>{this.p(Q.RESOLVED,t)}),this.m=(t=>{this.p(Q.REJECTED,t)}),this.p=((t,e)=>{this.u===Q.PENDING&&(p(e)?e.then(this.l,this.m):(this.u=t,this.v=e,this.g()))}),this.j=(t=>{this.h=this.h.concat(t),this.g()}),this.g=(()=>{if(this.u===Q.PENDING)return;const t=this.h.slice();this.h=[],t.forEach(t=>{t.done||(this.u===Q.RESOLVED&&t.onfulfilled&&t.onfulfilled(this.v),this.u===Q.REJECTED&&t.onrejected&&t.onrejected(this.v),t.done=!0)})});try{t(this.l,this.m)}catch(t){this.m(t)}}static resolve(t){return new Y(e=>{e(t)})}static reject(t){return new Y((e,n)=>{n(t)})}static all(t){return new Y((e,n)=>{if(!Array.isArray(t))return void n(new TypeError("Promise.all requires an array as input."));if(0===t.length)return void e([]);let r=t.length;const i=[];t.forEach((t,s)=>{Y.resolve(t).then(t=>{i[s]=t,0===(r-=1)&&e(i)}).then(null,n)})})}then(t,e){return new Y((n,r)=>{this.j({done:!1,onfulfilled:e=>{if(t)try{return void n(t(e))}catch(t){return void r(t)}else n(e)},onrejected:t=>{if(e)try{return void n(e(t))}catch(t){return void r(t)}else r(t)}})})}catch(t){return this.then(t=>t,t)}finally(t){return new Y((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{i?n(r):e(r)})})}toString(){return"[object SyncPromise]"}}class Z{constructor(t){this.O=t,this.$=[]}isReady(){return void 0===this.O||this.length()<this.O}add(t){return this.isReady()?(-1===this.$.indexOf(t)&&this.$.push(t),t.then(()=>this.remove(t)).then(null,()=>this.remove(t).then(null,()=>{})),t):Y.reject(new s("Not adding Promise due to buffer limit reached."))}remove(t){return this.$.splice(this.$.indexOf(t),1)[0]}length(){return this.$.length}drain(t){return new Y(e=>{const n=setTimeout(()=>{t&&t>0&&e(!1)},t);Y.all(this.$).then(()=>{clearTimeout(n),e(!0)}).then(null,()=>{e(!0)})})}}function tt(){if(!("fetch"in E()))return!1;try{return new Headers,new Request(""),new Response,!0}catch(t){return!1}}function et(t){return t&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function nt(){if(!tt())return!1;try{return new Request("_",{referrerPolicy:"origin"}),!0}catch(t){return!1}}const rt=E(),it={},st={};function ot(t){if(!st[t])switch(st[t]=!0,t){case"console":!function(){if(!("console"in rt))return;["debug","info","warn","error","log","assert"].forEach(function(t){t in rt.console&&P(rt.console,t,function(e){return function(...n){ut("console",{args:n,level:t}),e&&Function.prototype.apply.call(e,rt.console,n)}})})}();break;case"dom":!function(){if(!("document"in rt))return;rt.document.addEventListener("click",yt("click",ut.bind(null,"dom")),!1),rt.document.addEventListener("keypress",mt(ut.bind(null,"dom")),!1),["EventTarget","Node"].forEach(t=>{const e=rt[t]&&rt[t].prototype;e&&e.hasOwnProperty&&e.hasOwnProperty("addEventListener")&&(P(e,"addEventListener",function(t){return function(e,n,r){return n&&n.handleEvent?("click"===e&&P(n,"handleEvent",function(t){return function(e){return yt("click",ut.bind(null,"dom"))(e),t.call(this,e)}}),"keypress"===e&&P(n,"handleEvent",function(t){return function(e){return mt(ut.bind(null,"dom"))(e),t.call(this,e)}})):("click"===e&&yt("click",ut.bind(null,"dom"),!0)(this),"keypress"===e&&mt(ut.bind(null,"dom"))(this)),t.call(this,e,n,r)}}),P(e,"removeEventListener",function(t){return function(e,n,r){try{t.call(this,e,n.__sentry_wrapped__,r)}catch(t){}return t.call(this,e,n,r)}}))})}();break;case"xhr":!function(){if(!("XMLHttpRequest"in rt))return;const t=XMLHttpRequest.prototype;P(t,"open",function(t){return function(...e){const n=this,r=e[1];n.__sentry_xhr__={method:a(e[0])?e[0].toUpperCase():e[0],url:e[1]},a(r)&&"POST"===n.__sentry_xhr__.method&&r.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const i=function(){if(4===n.readyState){try{n.__sentry_xhr__&&(n.__sentry_xhr__.status_code=n.status)}catch(t){}ut("xhr",{args:e,endTimestamp:Date.now(),startTimestamp:Date.now(),xhr:n})}};return"onreadystatechange"in n&&"function"==typeof n.onreadystatechange?P(n,"onreadystatechange",function(t){return function(...e){return i(),t.apply(n,e)}}):n.addEventListener("readystatechange",i),t.apply(n,e)}}),P(t,"send",function(t){return function(...e){return ut("xhr",{args:e,startTimestamp:Date.now(),xhr:this}),t.apply(this,e)}})}();break;case"fetch":!function(){if(!function(){if(!tt())return!1;const t=E();if(et(t.fetch))return!0;let e=!1;const n=t.document;if(n&&"function"==typeof n.createElement)try{const t=n.createElement("iframe");t.hidden=!0,n.head.appendChild(t),t.contentWindow&&t.contentWindow.fetch&&(e=et(t.contentWindow.fetch)),n.head.removeChild(t)}catch(t){B.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",t)}return e}())return;P(rt,"fetch",function(t){return function(...e){const n={args:e,fetchData:{method:at(e),url:ht(e)},startTimestamp:Date.now()};return ut("fetch",Object.assign({},n)),t.apply(rt,e).then(t=>(ut("fetch",Object.assign(Object.assign({},n),{endTimestamp:Date.now(),response:t})),t),t=>{throw ut("fetch",Object.assign(Object.assign({},n),{endTimestamp:Date.now(),error:t})),t})}})}();break;case"history":!function(){if(!function(){const t=E(),e=t.chrome,n=e&&e.app&&e.app.runtime,r="history"in t&&!!t.history.pushState&&!!t.history.replaceState;return!n&&r}())return;const t=rt.onpopstate;function e(t){return function(...e){const n=e.length>2?e[2]:void 0;if(n){const t=lt,e=String(n);lt=e,ut("history",{from:t,to:e})}return t.apply(this,e)}}rt.onpopstate=function(...e){const n=rt.location.href,r=lt;if(lt=n,ut("history",{from:r,to:n}),t)return t.apply(this,e)},P(rt.history,"pushState",e),P(rt.history,"replaceState",e)}();break;case"error":vt=rt.onerror,rt.onerror=function(t,e,n,r,i){return ut("error",{column:r,error:i,line:n,msg:t,url:e}),!!vt&&vt.apply(this,arguments)};break;case"unhandledrejection":gt=rt.onunhandledrejection,rt.onunhandledrejection=function(t){return ut("unhandledrejection",t),!gt||gt.apply(this,arguments)};break;default:B.warn("unknown instrumentation type:",t)}}function ct(t){t&&"string"==typeof t.type&&"function"==typeof t.callback&&(it[t.type]=it[t.type]||[],it[t.type].push(t.callback),ot(t.type))}function ut(t,e){if(t&&it[t])for(const n of it[t]||[])try{n(e)}catch(e){B.error(`Error while triggering instrumentation handler.\nType: ${t}\nName: ${L(n)}\nError: ${e}`)}}function at(t=[]){return"Request"in rt&&b(t[0],Request)&&t[0].method?String(t[0].method).toUpperCase():t[1]&&t[1].method?String(t[1].method).toUpperCase():"GET"}function ht(t=[]){return"string"==typeof t[0]?t[0]:"Request"in rt&&b(t[0],Request)?t[0].url:String(t[0])}let lt;const ft=1e3;let dt,pt,bt=0;function yt(t,e,n=!1){return r=>{dt=void 0,r&&pt!==r&&(pt=r,bt&&clearTimeout(bt),n?bt=setTimeout(()=>{e({event:r,name:t})}):e({event:r,name:t}))}}function mt(t){return e=>{let n;try{n=e.target}catch(t){return}const r=n&&n.tagName;r&&("INPUT"===r||"TEXTAREA"===r||n.isContentEditable)&&(dt||yt("input",t)(e),clearTimeout(dt),dt=setTimeout(()=>{dt=void 0},ft))}}let vt=null;let gt=null;const jt=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+))?@)([\w.-]+)(?::(\d+))?\/(.+)/,Et="Invalid Dsn";class wt{constructor(t){"string"==typeof t?this._(t):this.S(t),this.k()}toString(t=!1){const{host:e,path:n,pass:r,port:i,projectId:s,protocol:o,user:c}=this;return`${o}://${c}${t&&r?`:${r}`:""}`+`@${e}${i?`:${i}`:""}/${n?`${n}/`:n}${s}`}_(t){const e=jt.exec(t);if(!e)throw new s(Et);const[n,r,i="",o,c="",u]=e.slice(1);let a="",h=u;const l=h.split("/");if(l.length>1&&(a=l.slice(0,-1).join("/"),h=l.pop()),h){const t=h.match(/^\d+/);t&&(h=t[0])}this.S({host:o,pass:i,path:a,projectId:h,port:c,protocol:n,user:r})}S(t){this.protocol=t.protocol,this.user=t.user,this.pass=t.pass||"",this.host=t.host,this.port=t.port||"",this.path=t.path||"",this.projectId=t.projectId}k(){if(["protocol","user","host","projectId"].forEach(t=>{if(!this[t])throw new s(`${Et}: ${t} missing`)}),!this.projectId.match(/^\d+$/))throw new s(`${Et}: Invalid projectId ${this.projectId}`);if("http"!==this.protocol&&"https"!==this.protocol)throw new s(`${Et}: Invalid protocol ${this.protocol}`);if(this.port&&isNaN(parseInt(this.port,10)))throw new s(`${Et}: Invalid port ${this.port}`)}}class Ot{constructor(){this.T=!1,this.D=[],this.R=[],this.I=[],this.C={},this.M={},this.N={},this.A={}}static clone(t){const e=new Ot;return t&&(e.I=[...t.I],e.M=Object.assign({},t.M),e.N=Object.assign({},t.N),e.A=Object.assign({},t.A),e.C=t.C,e.U=t.U,e.L=t.L,e.F=t.F,e.q=t.q,e.R=[...t.R]),e}addScopeListener(t){this.D.push(t)}addEventProcessor(t){return this.R.push(t),this}setUser(t){return this.C=t||{},this.B(),this}setTags(t){return this.M=Object.assign(Object.assign({},this.M),t),this.B(),this}setTag(t,e){return this.M=Object.assign(Object.assign({},this.M),{[t]:e}),this.B(),this}setExtras(t){return this.N=Object.assign(Object.assign({},this.N),t),this.B(),this}setExtra(t,e){return this.N=Object.assign(Object.assign({},this.N),{[t]:e}),this.B(),this}setFingerprint(t){return this.q=t,this.B(),this}setLevel(t){return this.U=t,this.B(),this}setTransactionName(t){return this.F=t,this.B(),this}setTransaction(t){return this.setTransactionName(t)}setContext(t,e){return this.A=Object.assign(Object.assign({},this.A),{[t]:e}),this.B(),this}setSpan(t){return this.L=t,this.B(),this}getSpan(){return this.L}getTransaction(){const t=this.getSpan();if(t&&t.spanRecorder&&t.spanRecorder.spans[0])return t.spanRecorder.spans[0]}update(t){if(!t)return this;if("function"==typeof t){const e=t(this);return e instanceof Ot?e:this}return t instanceof Ot?(this.M=Object.assign(Object.assign({},this.M),t.M),this.N=Object.assign(Object.assign({},this.N),t.N),this.A=Object.assign(Object.assign({},this.A),t.A),t.C&&(this.C=t.C),t.U&&(this.U=t.U),t.q&&(this.q=t.q)):l(t)&&(t=t,this.M=Object.assign(Object.assign({},this.M),t.tags),this.N=Object.assign(Object.assign({},this.N),t.extra),this.A=Object.assign(Object.assign({},this.A),t.contexts),t.user&&(this.C=t.user),t.level&&(this.U=t.level),t.fingerprint&&(this.q=t.fingerprint)),this}clear(){return this.I=[],this.M={},this.N={},this.C={},this.A={},this.U=void 0,this.F=void 0,this.q=void 0,this.L=void 0,this.B(),this}addBreadcrumb(t,e){const n=Object.assign({timestamp:M()},t);return this.I=void 0!==e&&e>=0?[...this.I,n].slice(-e):[...this.I,n],this.B(),this}clearBreadcrumbs(){return this.I=[],this.B(),this}applyToEvent(t,e){return this.N&&Object.keys(this.N).length&&(t.extra=Object.assign(Object.assign({},this.N),t.extra)),this.M&&Object.keys(this.M).length&&(t.tags=Object.assign(Object.assign({},this.M),t.tags)),this.C&&Object.keys(this.C).length&&(t.user=Object.assign(Object.assign({},this.C),t.user)),this.A&&Object.keys(this.A).length&&(t.contexts=Object.assign(Object.assign({},this.A),t.contexts)),this.U&&(t.level=this.U),this.F&&(t.transaction=this.F),this.L&&(t.contexts=Object.assign({trace:this.L.getTraceContext()},t.contexts)),this.H(t),t.breadcrumbs=[...t.breadcrumbs||[],...this.I],t.breadcrumbs=t.breadcrumbs.length>0?t.breadcrumbs:void 0,this.P([...$t(),...this.R],t,e)}P(t,e,n,r=0){return new Y((i,s)=>{const o=t[r];if(null===e||"function"!=typeof o)i(e);else{const c=o(Object.assign({},e),n);p(c)?c.then(e=>this.P(t,e,n,r+1).then(i)).then(null,s):this.P(t,c,n,r+1).then(i).then(null,s)}})}B(){this.T||(this.T=!0,setTimeout(()=>{this.D.forEach(t=>{t(this)}),this.T=!1}))}H(t){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],this.q&&(t.fingerprint=t.fingerprint.concat(this.q)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}}function $t(){const t=E();return t.__SENTRY__=t.__SENTRY__||{},t.__SENTRY__.globalEventProcessors=t.__SENTRY__.globalEventProcessors||[],t.__SENTRY__.globalEventProcessors}function _t(t){$t().push(t)}const xt=3,St=100,kt=100;class Tt{constructor(t,e=new Ot,n=xt){this.W=n,this.X=[],this.X.push({client:t,scope:e}),this.bindClient(t)}isOlderThan(t){return this.W<t}bindClient(t){this.getStackTop().client=t,t&&t.setupIntegrations&&t.setupIntegrations()}pushScope(){const t=this.getStack(),e=t.length>0?t[t.length-1].scope:void 0,n=Ot.clone(e);return this.getStack().push({client:this.getClient(),scope:n}),n}popScope(){return void 0!==this.getStack().pop()}withScope(t){const e=this.pushScope();try{t(e)}finally{this.popScope()}}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getStack(){return this.X}getStackTop(){return this.X[this.X.length-1]}captureException(t,e){const n=this.G=w();let r=e;if(!e){let e;try{throw new Error("Sentry syntheticException")}catch(t){e=t}r={originalException:t,syntheticException:e}}return this.J("captureException",t,Object.assign(Object.assign({},r),{event_id:n})),n}captureMessage(t,e,n){const r=this.G=w();let i=n;if(!n){let e;try{throw new Error(t)}catch(t){e=t}i={originalException:t,syntheticException:e}}return this.J("captureMessage",t,e,Object.assign(Object.assign({},i),{event_id:r})),r}captureEvent(t,e){const n=this.G=w();return this.J("captureEvent",t,Object.assign(Object.assign({},e),{event_id:n})),n}lastEventId(){return this.G}addBreadcrumb(t,e){const n=this.getStackTop();if(!n.scope||!n.client)return;const{beforeBreadcrumb:r=null,maxBreadcrumbs:i=St}=n.client.getOptions&&n.client.getOptions()||{};if(i<=0)return;const s=M(),o=Object.assign({timestamp:s},t),c=r?_(()=>r(o,e)):o;null!==c&&n.scope.addBreadcrumb(c,Math.min(i,kt))}setUser(t){const e=this.getStackTop();e.scope&&e.scope.setUser(t)}setTags(t){const e=this.getStackTop();e.scope&&e.scope.setTags(t)}setExtras(t){const e=this.getStackTop();e.scope&&e.scope.setExtras(t)}setTag(t,e){const n=this.getStackTop();n.scope&&n.scope.setTag(t,e)}setExtra(t,e){const n=this.getStackTop();n.scope&&n.scope.setExtra(t,e)}setContext(t,e){const n=this.getStackTop();n.scope&&n.scope.setContext(t,e)}configureScope(t){const e=this.getStackTop();e.scope&&e.client&&t(e.scope)}run(t){const e=Rt(this);try{t(this)}finally{Rt(e)}}getIntegration(t){const e=this.getClient();if(!e)return null;try{return e.getIntegration(t)}catch(e){return B.warn(`Cannot retrieve integration ${t.id} from the current Hub`),null}}startSpan(t){return this.V("startSpan",t)}startTransaction(t){return this.V("startTransaction",t)}traceHeaders(){return this.V("traceHeaders")}J(t,...e){const n=this.getStackTop();n&&n.client&&n.client[t]&&n.client[t](...e,n.scope)}V(t,...e){const n=Dt().__SENTRY__;if(n&&n.extensions&&"function"==typeof n.extensions[t])return n.extensions[t].apply(this,e);B.warn(`Extension method ${t} couldn't be found, doing nothing.`)}}function Dt(){const t=E();return t.__SENTRY__=t.__SENTRY__||{extensions:{},hub:void 0},t}function Rt(t){const e=Dt(),n=Mt(e);return Nt(e,t),n}function It(){const t=Dt();return Ct(t)&&!Mt(t).isOlderThan(xt)||Nt(t,new Tt),g()?function(t){try{const e="domain",n=Dt(),r=n.__SENTRY__;if(!r||!r.extensions||!r.extensions[e])return Mt(t);const i=r.extensions[e],s=i.active;if(!s)return Mt(t);if(!Ct(s)||Mt(s).isOlderThan(xt)){const e=Mt(t).getStackTop();Nt(s,new Tt(e.client,Ot.clone(e.scope)))}return Mt(s)}catch(e){return Mt(t)}}(t):Mt(t)}function Ct(t){return!!(t&&t.__SENTRY__&&t.__SENTRY__.hub)}function Mt(t){return t&&t.__SENTRY__&&t.__SENTRY__.hub?t.__SENTRY__.hub:(t.__SENTRY__=t.__SENTRY__||{},t.__SENTRY__.hub=new Tt,t.__SENTRY__.hub)}function Nt(t,e){return!!t&&(t.__SENTRY__=t.__SENTRY__||{},t.__SENTRY__.hub=e,!0)}function At(t,...e){const n=It();if(n&&n[t])return n[t](...e);throw new Error(`No hub defined or ${t} was not found on the hub, please open a bug report.`)}function captureException(t,e){let n;try{throw new Error("Sentry syntheticException")}catch(t){n=t}return At("captureException",t,{captureContext:e,originalException:t,syntheticException:n})}function Ut(t){At("withScope",t)}const Lt="7";class Ft{constructor(t){this.dsn=t,this.K=new wt(t)}getDsn(){return this.K}getBaseApiEndpoint(){const t=this.K,e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}getStoreEndpoint(){return this.Y("store")}getStoreEndpointWithUrlEncodedAuth(){return`${this.getStoreEndpoint()}?${this.Z()}`}getEnvelopeEndpointWithUrlEncodedAuth(){return`${this.tt()}?${this.Z()}`}getStoreEndpointPath(){const t=this.K;return`${t.path?`/${t.path}`:""}/api/${t.projectId}/store/`}getRequestHeaders(t,e){const n=this.K,r=[`Sentry sentry_version=${Lt}`];return r.push(`sentry_client=${t}/${e}`),r.push(`sentry_key=${n.user}`),n.pass&&r.push(`sentry_secret=${n.pass}`),{"Content-Type":"application/json","X-Sentry-Auth":r.join(", ")}}getReportDialogEndpoint(t={}){const e=this.K,n=`${this.getBaseApiEndpoint()}embed/error-page/`,r=[];r.push(`dsn=${e.toString()}`);for(const e in t)if("user"===e){if(!t.user)continue;t.user.name&&r.push(`name=${encodeURIComponent(t.user.name)}`),t.user.email&&r.push(`email=${encodeURIComponent(t.user.email)}`)}else r.push(`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`);return r.length?`${n}?${r.join("&")}`:n}tt(){return this.Y("envelope")}Y(t){return`${this.getBaseApiEndpoint()}${this.K.projectId}/${t}/`}Z(){const t={sentry_key:this.K.user,sentry_version:Lt};return e=t,Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&");var e}}const qt=[];function Bt(t){const e={};return function(t){const e=t.defaultIntegrations&&[...t.defaultIntegrations]||[],n=t.integrations;let r=[];if(Array.isArray(n)){const t=n.map(t=>t.name),i=[];e.forEach(e=>{-1===t.indexOf(e.name)&&-1===i.indexOf(e.name)&&(r.push(e),i.push(e.name))}),n.forEach(t=>{-1===i.indexOf(t.name)&&(r.push(t),i.push(t.name))})}else"function"==typeof n?(r=n(e),r=Array.isArray(r)?r:[r]):r=[...e];const i=r.map(t=>t.name);return-1!==i.indexOf("Debug")&&r.push(...r.splice(i.indexOf("Debug"),1)),r}(t).forEach(t=>{e[t.name]=t,function(t){-1===qt.indexOf(t.name)&&(t.setupOnce(_t,It),qt.push(t.name),B.log(`Integration installed: ${t.name}`))}(t)}),e}class Ht{constructor(t,e){this.et={},this.nt=!1,this.rt=new t(e),this.it=e,e.dsn&&(this.st=new wt(e.dsn))}captureException(t,e,n){let r=e&&e.event_id;return this.nt=!0,this.ot().eventFromException(t,e).then(t=>{r=this.captureEvent(t,e,n)}),r}captureMessage(t,e,n,r){let i=n&&n.event_id;return this.nt=!0,(h(t)?this.ot().eventFromMessage(`${t}`,e,n):this.ot().eventFromException(t,n)).then(t=>{i=this.captureEvent(t,n,r)}),i}captureEvent(t,e,n){let r=e&&e.event_id;return this.nt=!0,this.ct(t,e,n).then(t=>{r=t&&t.event_id,this.nt=!1}).then(null,t=>{B.error(t),this.nt=!1}),r}getDsn(){return this.st}getOptions(){return this.it}flush(t){return this.ut(t).then(e=>(clearInterval(e.interval),this.ot().getTransport().close(t).then(t=>e.ready&&t)))}close(t){return this.flush(t).then(t=>(this.getOptions().enabled=!1,t))}setupIntegrations(){this.at()&&(this.et=Bt(this.it))}getIntegration(t){try{return this.et[t.id]||null}catch(e){return B.warn(`Cannot retrieve integration ${t.id} from the current Client`),null}}ut(t){return new Y(e=>{let n=0;let r=0;clearInterval(r),r=setInterval(()=>{this.nt?(n+=1,t&&n>=t&&e({interval:r,ready:!1})):e({interval:r,ready:!0})},1)})}ot(){return this.rt}at(){return!1!==this.getOptions().enabled&&void 0!==this.st}ht(t,e,n){const{normalizeDepth:r=3}=this.getOptions(),i=Object.assign(Object.assign({},t),{event_id:t.event_id||(n&&n.event_id?n.event_id:w()),timestamp:t.timestamp||M()});this.lt(i),this.ft(i);let s=e;n&&n.captureContext&&(s=Ot.clone(s).update(n.captureContext));let o=Y.resolve(i);return s&&(o=s.applyToEvent(i,n)),o.then(t=>"number"==typeof r&&r>0?this.dt(t,r):t)}dt(t,e){if(!t)return null;const n=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(t=>Object.assign(Object.assign({},t),t.data&&{data:V(t.data,e)}))}),t.user&&{user:V(t.user,e)}),t.contexts&&{contexts:V(t.contexts,e)}),t.extra&&{extra:V(t.extra,e)});return t.contexts&&t.contexts.trace&&(n.contexts.trace=t.contexts.trace),n}lt(t){const{environment:e,release:n,dist:r,maxValueLength:i=250}=this.getOptions();void 0===t.environment&&void 0!==e&&(t.environment=e),void 0===t.release&&void 0!==n&&(t.release=n),void 0===t.dist&&void 0!==r&&(t.dist=r),t.message&&(t.message=y(t.message,i));const s=t.exception&&t.exception.values&&t.exception.values[0];s&&s.value&&(s.value=y(s.value,i));const o=t.request;o&&o.url&&(o.url=y(o.url,i))}ft(t){const e=t.sdk,n=Object.keys(this.et);e&&n.length>0&&(e.integrations=n)}pt(t){this.ot().sendEvent(t)}ct(t,e,n){const{beforeSend:r,sampleRate:i}=this.getOptions();if(!this.at())return Y.reject("SDK not enabled, will not send event.");const s="transaction"===t.type;return!s&&"number"==typeof i&&Math.random()>i?Y.reject("This event has been sampled, will not send event."):new Y((i,o)=>{this.ht(t,n,e).then(t=>{if(null===t)return void o("An event processor returned null, will not send event.");let n=t;if(e&&e.data&&!0===e.data.__sentry__||!r||s)return this.pt(n),void i(n);const c=r(t,e);if(void 0===c)B.error("`beforeSend` method has to return `null` or a valid event.");else if(p(c))this.bt(c,i,o);else{if(null===(n=c))return B.log("`beforeSend` returned `null`, will not send event."),void i(null);this.pt(n),i(n)}}).then(null,t=>{this.captureException(t,{data:{__sentry__:!0},originalException:t}),o(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${t}`)})})}bt(t,e,n){t.then(t=>{null!==t?(this.pt(t),e(t)):n("`beforeSend` returned `null`, will not send event.")}).then(null,t=>{n(`beforeSend rejected with ${t}`)})}}class Pt{sendEvent(e){return Y.resolve({reason:"NoopTransport: Event has been skipped because no Dsn is configured.",status:t.Status.Skipped})}close(t){return Y.resolve(!0)}}class Wt{constructor(t){this.it=t,this.it.dsn||B.warn("No DSN provided, backend will not do anything."),this.yt=this.vt()}eventFromException(t,e){throw new s("Backend has to implement `eventFromException` method")}eventFromMessage(t,e,n){throw new s("Backend has to implement `eventFromMessage` method")}sendEvent(t){this.yt.sendEvent(t).then(null,t=>{B.error(`Error while sending event: ${t}`)})}getTransport(){return this.yt}vt(){return new Pt}}function Xt(t,e){const n="transaction"===t.type,r={body:JSON.stringify(t),url:n?e.getEnvelopeEndpointWithUrlEncodedAuth():e.getStoreEndpointWithUrlEncodedAuth()};if(n){const e=`${JSON.stringify({event_id:t.event_id,sent_at:new Date(1e3*M()).toISOString()})}\n${JSON.stringify({type:t.type})}\n${r.body}`;r.body=e}return r}let Gt;class zt{constructor(){this.name=zt.id}setupOnce(){Gt=Function.prototype.toString,Function.prototype.toString=function(...t){const e=this.__sentry_original__||this;return Gt.apply(e,t)}}}zt.id="FunctionToString";const Jt=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/];class Vt{constructor(t={}){this.it=t,this.name=Vt.id}setupOnce(){_t(t=>{const e=It();if(!e)return t;const n=e.getIntegration(Vt);if(n){const r=e.getClient(),i=r?r.getOptions():{},s=n.gt(i);if(n.jt(t,s))return null}return t})}jt(t,e){return this.Et(t,e)?(B.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${$(t)}`),!0):this.wt(t,e)?(B.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${$(t)}`),!0):this.Ot(t,e)?(B.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${$(t)}.\nUrl: ${this.$t(t)}`),!0):!this._t(t,e)&&(B.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${$(t)}.\nUrl: ${this.$t(t)}`),!0)}Et(t,e){if(!e.ignoreInternal)return!1;try{return t&&t.exception&&t.exception.values&&t.exception.values[0]&&"SentryError"===t.exception.values[0].type||!1}catch(t){return!1}}wt(t,e){return!(!e.ignoreErrors||!e.ignoreErrors.length)&&this.xt(t).some(t=>e.ignoreErrors.some(e=>v(t,e)))}Ot(t,e){if(!e.denyUrls||!e.denyUrls.length)return!1;const n=this.$t(t);return!!n&&e.denyUrls.some(t=>v(n,t))}_t(t,e){if(!e.allowUrls||!e.allowUrls.length)return!0;const n=this.$t(t);return!n||e.allowUrls.some(t=>v(n,t))}gt(t={}){return{allowUrls:[...this.it.whitelistUrls||[],...this.it.allowUrls||[],...t.whitelistUrls||[],...t.allowUrls||[]],denyUrls:[...this.it.blacklistUrls||[],...this.it.denyUrls||[],...t.blacklistUrls||[],...t.denyUrls||[]],ignoreErrors:[...this.it.ignoreErrors||[],...t.ignoreErrors||[],...Jt],ignoreInternal:void 0===this.it.ignoreInternal||this.it.ignoreInternal}}xt(t){if(t.message)return[t.message];if(t.exception)try{const{type:e="",value:n=""}=t.exception.values&&t.exception.values[0]||{};return[`${n}`,`${e}: ${n}`]}catch(e){return B.error(`Cannot extract message for event ${$(t)}`),[]}return[]}$t(t){try{if(t.stacktrace){const e=t.stacktrace.frames;return e&&e[e.length-1].filename||null}if(t.exception){const e=t.exception.values&&t.exception.values[0].stacktrace&&t.exception.values[0].stacktrace.frames;return e&&e[e.length-1].filename||null}return null}catch(e){return B.error(`Cannot extract url for event ${$(t)}`),null}}}Vt.id="InboundFilters";var Kt=Object.freeze({__proto__:null,FunctionToString:zt,InboundFilters:Vt});const Qt="?",Yt=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Zt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|capacitor).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js))(?::(\d+))?(?::(\d+))?\s*$/i,te=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,ee=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ne=/\((\S*)(?::(\d+))(?::(\d+))\)/,re=/Minified React error #\d+;/i;function ie(t){let e=null,n=0;t&&("number"==typeof t.framesToPop?n=t.framesToPop:re.test(t.message)&&(n=1));try{if(e=function(t){if(!t||!t.stacktrace)return null;const e=t.stacktrace,n=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,r=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\((.*)\))? in (.*):\s*$/i,i=e.split("\n"),s=[];let o;for(let t=0;t<i.length;t+=2){let e=null;(o=n.exec(i[t]))?e={url:o[2],func:o[3],args:[],line:+o[1],column:null}:(o=r.exec(i[t]))&&(e={url:o[6],func:o[3]||o[4],args:o[5]?o[5].split(","):[],line:+o[1],column:+o[2]}),e&&(!e.func&&e.line&&(e.func=Qt),s.push(e))}if(!s.length)return null;return{message:oe(t),name:t.name,stack:s}}(t))return se(e,n)}catch(t){}try{if(e=function(t){if(!t||!t.stack)return null;const e=[],n=t.stack.split("\n");let r,i,s,o;for(let c=0;c<n.length;++c){if(s=Yt.exec(n[c])){const t=s[2]&&0===s[2].indexOf("native");(r=s[2]&&0===s[2].indexOf("eval"))&&(i=ne.exec(s[2]))&&(s[2]=i[1],s[3]=i[2],s[4]=i[3]),o={url:s[2]&&0===s[2].indexOf("address at ")?s[2].substr("address at ".length):s[2],func:s[1]||Qt,args:t?[s[2]]:[],line:s[3]?+s[3]:null,column:s[4]?+s[4]:null}}else if(s=te.exec(n[c]))o={url:s[2],func:s[1]||Qt,args:[],line:+s[3],column:s[4]?+s[4]:null};else{if(!(s=Zt.exec(n[c])))continue;(r=s[3]&&s[3].indexOf(" > eval")>-1)&&(i=ee.exec(s[3]))?(s[1]=s[1]||"eval",s[3]=i[1],s[4]=i[2],s[5]=""):0!==c||s[5]||void 0===t.columnNumber||(e[0].column=t.columnNumber+1),o={url:s[3],func:s[1]||Qt,args:s[2]?s[2].split(","):[],line:s[4]?+s[4]:null,column:s[5]?+s[5]:null}}!o.func&&o.line&&(o.func=Qt),e.push(o)}if(!e.length)return null;return{message:oe(t),name:t.name,stack:e}}(t))return se(e,n)}catch(t){}return{message:oe(t),name:t&&t.name,stack:[],failed:!0}}function se(t,e){try{return Object.assign(Object.assign({},t),{stack:t.stack.slice(e)})}catch(e){return t}}function oe(t){const e=t&&t.message;return e?e.error&&"string"==typeof e.error.message?e.error.message:e:"No error message"}const ce=50;function ue(t){const e=he(t.stack),n={type:t.name,value:t.message};return e&&e.length&&(n.stacktrace={frames:e}),void 0===n.type&&""===n.value&&(n.value="Unrecoverable error caught"),n}function ae(t){return{exception:{values:[ue(t)]}}}function he(t){if(!t||!t.length)return[];let e=t;const n=e[0].func||"",r=e[e.length-1].func||"";return-1===n.indexOf("captureMessage")&&-1===n.indexOf("captureException")||(e=e.slice(1)),-1!==r.indexOf("sentryWrapped")&&(e=e.slice(0,-1)),e.slice(0,ce).map(t=>({colno:null===t.column?void 0:t.column,filename:t.url||e[0].url,function:t.func||"?",in_app:!0,lineno:null===t.line?void 0:t.line})).reverse()}function le(e,n,r){const i=de(n,r&&r.syntheticException||void 0,{attachStacktrace:e.attachStacktrace});return S(i,{handled:!0,type:"generic"}),i.level=t.Severity.Error,r&&r.event_id&&(i.event_id=r.event_id),Y.resolve(i)}function fe(e,n,r=t.Severity.Info,i){const s=pe(n,i&&i.syntheticException||void 0,{attachStacktrace:e.attachStacktrace});return s.level=r,i&&i.event_id&&(s.event_id=i.event_id),Y.resolve(s)}function de(t,e,n={}){let r;if(c(t)&&t.error){return r=ae(ie(t=t.error))}if(u(t)||(i=t,"[object DOMException]"===Object.prototype.toString.call(i))){const i=t,s=i.name||(u(i)?"DOMError":"DOMException"),o=i.message?`${s}: ${i.message}`:s;return x(r=pe(o,e,n),o),r}var i;if(o(t))return r=ae(ie(t));if(l(t)||f(t)){return S(r=function(t,e,n){const r={exception:{values:[{type:f(t)?t.constructor.name:n?"UnhandledRejection":"Error",value:`Non-Error ${n?"promise rejection":"exception"} captured with keys: ${K(t)}`}]},extra:{__serialized__:G(t)}};if(e){const t=he(ie(e).stack);r.stacktrace={frames:t}}return r}(t,e,n.rejection),{synthetic:!0}),r}return x(r=pe(t,e,n),`${t}`,void 0),S(r,{synthetic:!0}),r}function pe(t,e,n={}){const r={message:t};if(n.attachStacktrace&&e){const t=he(ie(e).stack);r.stacktrace={frames:t}}return r}class be{constructor(t){this.options=t,this.$=new Z(30),this.St=new Ft(this.options.dsn),this.url=this.St.getStoreEndpointWithUrlEncodedAuth()}sendEvent(t){throw new s("Transport Class has to implement `sendEvent` method")}close(t){return this.$.drain(t)}}const ye=E();class me extends be{constructor(){super(...arguments),this.kt=new Date(Date.now())}sendEvent(e){if(new Date(Date.now())<this.kt)return Promise.reject({event:e,reason:`Transport locked till ${this.kt} due to too many requests.`,status:429});const n=Xt(e,this.St),r={body:n.body,method:"POST",referrerPolicy:nt()?"origin":""};return void 0!==this.options.fetchParameters&&Object.assign(r,this.options.fetchParameters),void 0!==this.options.headers&&(r.headers=this.options.headers),this.$.add(new Y((e,i)=>{ye.fetch(n.url,r).then(n=>{const r=t.Status.fromHttpCode(n.status);if(r!==t.Status.Success){if(r===t.Status.RateLimit){const t=Date.now(),e=n.headers.get("Retry-After");this.kt=new Date(t+A(t,e)),B.warn(`Too many requests, backing off till: ${this.kt}`)}i(n)}else e({status:r})}).catch(i)}))}}class ve extends be{constructor(){super(...arguments),this.kt=new Date(Date.now())}sendEvent(e){if(new Date(Date.now())<this.kt)return Promise.reject({event:e,reason:`Transport locked till ${this.kt} due to too many requests.`,status:429});const n=Xt(e,this.St);return this.$.add(new Y((e,r)=>{const i=new XMLHttpRequest;i.onreadystatechange=(()=>{if(4!==i.readyState)return;const n=t.Status.fromHttpCode(i.status);if(n!==t.Status.Success){if(n===t.Status.RateLimit){const t=Date.now(),e=i.getResponseHeader("Retry-After");this.kt=new Date(t+A(t,e)),B.warn(`Too many requests, backing off till: ${this.kt}`)}r(i)}else e({status:n})}),i.open("POST",n.url);for(const t in this.options.headers)this.options.headers.hasOwnProperty(t)&&i.setRequestHeader(t,this.options.headers[t]);i.send(n.body)}))}}var ge=Object.freeze({__proto__:null,BaseTransport:be,FetchTransport:me,XHRTransport:ve});class je extends Wt{eventFromException(t,e){return le(this.it,t,e)}eventFromMessage(e,n=t.Severity.Info,r){return fe(this.it,e,n,r)}vt(){if(!this.it.dsn)return super.vt();const t=Object.assign(Object.assign({},this.it.transportOptions),{dsn:this.it.dsn});return this.it.transport?new this.it.transport(t):tt()?new me(t):new ve(t)}}let Ee=0;function we(){return Ee>0}function Oe(t,e={},n){if("function"!=typeof t)return t;try{if(t.__sentry__)return t;if(t.__sentry_wrapped__)return t.__sentry_wrapped__}catch(e){return t}const sentryWrapped=function(){const r=Array.prototype.slice.call(arguments);try{n&&"function"==typeof n&&n.apply(this,arguments);const i=r.map(t=>Oe(t,e));return t.handleEvent?t.handleEvent.apply(this,i):t.apply(this,i)}catch(t){throw Ee+=1,setTimeout(()=>{Ee-=1}),Ut(n=>{n.addEventProcessor(t=>{const n=Object.assign({},t);return e.mechanism&&(x(n,void 0,void 0),S(n,e.mechanism)),n.extra=Object.assign(Object.assign({},n.extra),{arguments:r}),n}),captureException(t)}),t}};try{for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(sentryWrapped[e]=t[e])}catch(t){}t.prototype=t.prototype||{},sentryWrapped.prototype=t.prototype,Object.defineProperty(t,"__sentry_wrapped__",{enumerable:!1,value:sentryWrapped}),Object.defineProperties(sentryWrapped,{__sentry__:{enumerable:!1,value:!0},__sentry_original__:{enumerable:!1,value:t}});try{Object.getOwnPropertyDescriptor(sentryWrapped,"name").configurable&&Object.defineProperty(sentryWrapped,"name",{get:()=>t.name})}catch(t){}return sentryWrapped}function $e(t={}){if(!t.eventId)return void B.error("Missing eventId option in showReportDialog call");if(!t.dsn)return void B.error("Missing dsn option in showReportDialog call");const e=document.createElement("script");e.async=!0,e.src=new Ft(t.dsn).getReportDialogEndpoint(t),t.onLoad&&(e.onload=t.onLoad),(document.head||document.body).appendChild(e)}class _e{constructor(t){this.name=_e.id,this.Tt=!1,this.Dt=!1,this.it=Object.assign({onerror:!0,onunhandledrejection:!0},t)}setupOnce(){Error.stackTraceLimit=50,this.it.onerror&&(B.log("Global Handler attached: onerror"),this.Rt()),this.it.onunhandledrejection&&(B.log("Global Handler attached: onunhandledrejection"),this.It())}Rt(){this.Tt||(ct({callback:t=>{const e=t.error,n=It(),r=n.getIntegration(_e),i=e&&!0===e.__sentry_own_request__;if(!r||we()||i)return;const s=n.getClient(),o=h(e)?this.Ct(t.msg,t.url,t.line,t.column):this.Mt(de(e,void 0,{attachStacktrace:s&&s.getOptions().attachStacktrace,rejection:!1}),t.url,t.line,t.column);S(o,{handled:!1,type:"onerror"}),n.captureEvent(o,{originalException:e})},type:"error"}),this.Tt=!0)}It(){this.Dt||(ct({callback:e=>{let n=e;try{"reason"in e?n=e.reason:"detail"in e&&"reason"in e.detail&&(n=e.detail.reason)}catch(t){}const r=It(),i=r.getIntegration(_e),s=n&&!0===n.__sentry_own_request__;if(!i||we()||s)return!0;const o=r.getClient(),c=h(n)?this.Nt(n):de(n,void 0,{attachStacktrace:o&&o.getOptions().attachStacktrace,rejection:!0});c.level=t.Severity.Error,S(c,{handled:!1,type:"onunhandledrejection"}),r.captureEvent(c,{originalException:n})},type:"unhandledrejection"}),this.Dt=!0)}Ct(t,e,n,r){const i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let s,o=c(t)?t.message:t;if(a(o)){const t=o.match(i);t&&(s=t[1],o=t[2])}const u={exception:{values:[{type:s||"Error",value:o}]}};return this.Mt(u,e,n,r)}Nt(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${t}`}]}}}Mt(t,e,n,r){t.exception=t.exception||{},t.exception.values=t.exception.values||[],t.exception.values[0]=t.exception.values[0]||{},t.exception.values[0].stacktrace=t.exception.values[0].stacktrace||{},t.exception.values[0].stacktrace.frames=t.exception.values[0].stacktrace.frames||[];const i=isNaN(parseInt(r,10))?void 0:r,s=isNaN(parseInt(n,10))?void 0:n,o=a(e)&&e.length>0?e:function(){try{return document.location.href}catch(t){return""}}();return 0===t.exception.values[0].stacktrace.frames.length&&t.exception.values[0].stacktrace.frames.push({colno:i,filename:o,function:"?",in_app:!0,lineno:s}),t}}_e.id="GlobalHandlers";const xe=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"];class Se{constructor(t){this.name=Se.id,this.it=Object.assign({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},t)}setupOnce(){const t=E();if(this.it.setTimeout&&P(t,"setTimeout",this.At.bind(this)),this.it.setInterval&&P(t,"setInterval",this.At.bind(this)),this.it.requestAnimationFrame&&P(t,"requestAnimationFrame",this.Ut.bind(this)),this.it.XMLHttpRequest&&"XMLHttpRequest"in t&&P(XMLHttpRequest.prototype,"send",this.Lt.bind(this)),this.it.eventTarget){(Array.isArray(this.it.eventTarget)?this.it.eventTarget:xe).forEach(this.Ft.bind(this))}}At(t){return function(...e){const n=e[0];return e[0]=Oe(n,{mechanism:{data:{function:L(t)},handled:!0,type:"instrument"}}),t.apply(this,e)}}Ut(t){return function(e){return t.call(this,Oe(e,{mechanism:{data:{function:"requestAnimationFrame",handler:L(t)},handled:!0,type:"instrument"}}))}}Ft(t){const e=E(),n=e[t]&&e[t].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(P(n,"addEventListener",function(e){return function(n,r,i){try{"function"==typeof r.handleEvent&&(r.handleEvent=Oe(r.handleEvent.bind(r),{mechanism:{data:{function:"handleEvent",handler:L(r),target:t},handled:!0,type:"instrument"}}))}catch(t){}return e.call(this,n,Oe(r,{mechanism:{data:{function:"addEventListener",handler:L(r),target:t},handled:!0,type:"instrument"}}),i)}}),P(n,"removeEventListener",function(t){return function(e,n,r){try{t.call(this,e,n.__sentry_wrapped__,r)}catch(t){}return t.call(this,e,n,r)}}))}Lt(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(t=>{t in n&&"function"==typeof n[t]&&P(n,t,function(e){const n={mechanism:{data:{function:t,handler:L(e)},handled:!0,type:"instrument"}};return e.__sentry_original__&&(n.mechanism.data.handler=L(e.__sentry_original__)),Oe(e,n)})}),t.apply(this,e)}}}Se.id="TryCatch";class ke{constructor(t){this.name=ke.id,this.it=Object.assign({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},t)}addSentryBreadcrumb(t){this.it.sentry&&It().addBreadcrumb({category:`sentry.${"transaction"===t.type?"transaction":"event"}`,event_id:t.event_id,level:t.level,message:$(t)},{event:t})}setupOnce(){this.it.console&&ct({callback:(...t)=>{this.qt(...t)},type:"console"}),this.it.dom&&ct({callback:(...t)=>{this.Bt(...t)},type:"dom"}),this.it.xhr&&ct({callback:(...t)=>{this.Ht(...t)},type:"xhr"}),this.it.fetch&&ct({callback:(...t)=>{this.Pt(...t)},type:"fetch"}),this.it.history&&ct({callback:(...t)=>{this.Wt(...t)},type:"history"})}qt(e){const n={category:"console",data:{arguments:e.args,logger:"console"},level:t.Severity.fromString(e.level),message:m(e.args," ")};if("assert"===e.level){if(!1!==e.args[0])return;n.message=`Assertion failed: ${m(e.args.slice(1)," ")||"console.assert"}`,n.data.arguments=e.args.slice(1)}It().addBreadcrumb(n,{input:e.args,level:e.level})}Bt(t){let e;try{e=t.event.target?k(t.event.target):k(t.event)}catch(t){e="<unknown>"}0!==e.length&&It().addBreadcrumb({category:`ui.${t.name}`,message:e},{event:t.event,name:t.name})}Ht(t){if(t.endTimestamp){if(t.xhr.__sentry_own_request__)return;It().addBreadcrumb({category:"xhr",data:t.xhr.__sentry_xhr__,type:"http"},{xhr:t.xhr})}else;}Pt(e){e.endTimestamp&&(e.fetchData.url.match(/sentry_key/)&&"POST"===e.fetchData.method||(e.error?It().addBreadcrumb({category:"fetch",data:e.fetchData,level:t.Severity.Error,type:"http"},{data:e.error,input:e.args}):It().addBreadcrumb({category:"fetch",data:Object.assign(Object.assign({},e.fetchData),{status_code:e.response.status}),type:"http"},{input:e.args,response:e.response})))}Wt(t){const e=E();let n=t.from,r=t.to;const i=O(e.location.href);let s=O(n);const o=O(r);s.path||(s=i),i.protocol===o.protocol&&i.host===o.host&&(r=o.relative),i.protocol===s.protocol&&i.host===s.host&&(n=s.relative),It().addBreadcrumb({category:"navigation",data:{from:n,to:r}})}}ke.id="Breadcrumbs";const Te="cause",De=5;class Re{constructor(t={}){this.name=Re.id,this.Xt=t.key||Te,this.O=t.limit||De}setupOnce(){_t((t,e)=>{const n=It().getIntegration(Re);return n?n.Gt(t,e):t})}Gt(t,e){if(!(t.exception&&t.exception.values&&e&&b(e.originalException,Error)))return t;const n=this.zt(e.originalException,this.Xt);return t.exception.values=[...n,...t.exception.values],t}zt(t,e,n=[]){if(!b(t[e],Error)||n.length+1>=this.O)return n;const r=ue(ie(t[e]));return this.zt(t[e],e,[r,...n])}}Re.id="LinkedErrors";const Ie=E();class Ce{constructor(){this.name=Ce.id}setupOnce(){_t(t=>{if(It().getIntegration(Ce)){if(!Ie.navigator||!Ie.location)return t;const e=t.request||{};return e.url=e.url||Ie.location.href,e.headers=e.headers||{},e.headers["User-Agent"]=Ie.navigator.userAgent,Object.assign(Object.assign({},t),{request:e})}return t})}}Ce.id="UserAgent";var Me=Object.freeze({__proto__:null,GlobalHandlers:_e,TryCatch:Se,Breadcrumbs:ke,LinkedErrors:Re,UserAgent:Ce});const Ne="sentry.javascript.browser",Ae="5.22.3";class Ue extends Ht{constructor(t={}){super(je,t)}showReportDialog(t={}){E().document&&(this.at()?$e(Object.assign(Object.assign({},t),{dsn:t.dsn||this.getDsn()})):B.error("Trying to call showReportDialog with Sentry Client disabled"))}ht(t,e,n){return t.platform=t.platform||"javascript",t.sdk=Object.assign(Object.assign({},t.sdk),{name:Ne,packages:[...t.sdk&&t.sdk.pack