UNPKG

@cloudflare/workers-shared

Version:

Package that is used at Cloudflare to power some internal features of Cloudflare Workers.

8 lines • 58.6 kB
var ue=class{constructor(e){this.performanceTimer=e}now(){return this.performanceTimer?this.performanceTimer.timeOrigin+this.performanceTimer.now():Date.now()}};var bt=Object.prototype.toString;function F(t){switch(bt.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return O(t,Error)}}function Le(t,e){return bt.call(t)===`[object ${e}]`}function Fe(t){return Le(t,"ErrorEvent")}function Ue(t){return Le(t,"String")}function H(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function pe(t){return t===null||H(t)||typeof t!="object"&&typeof t!="function"}function A(t){return Le(t,"Object")}function Be(t){return typeof Event<"u"&&O(t,Event)}function $e(t){return typeof Element<"u"&&O(t,Element)}function C(t){return!!(t&&t.then&&typeof t.then=="function")}function je(t){return A(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function O(t,e){try{return t instanceof e}catch{return!1}}function Ge(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}function k(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}var D="8.9.2";var m=globalThis;function q(t,e,n){let r=n||m,o=r.__SENTRY__=r.__SENTRY__||{},s=o[D]=o[D]||{};return s[t]||(s[t]=e())}var kn=m,Dn=80;function Rt(t,e={}){if(!t)return"<unknown>";try{let n=t,r=5,o=[],s=0,i=0,a=" > ",c=a.length,u,f=Array.isArray(e)?e:e.keyAttrs,p=!Array.isArray(e)&&e.maxStringLength||Dn;for(;n&&s++<r&&(u=vn(n,f),!(u==="html"||s>1&&i+o.length*c+u.length>=p));)o.push(u),i+=u.length,n=n.parentNode;return o.reverse().join(a)}catch{return"<unknown>"}}function vn(t,e){let n=t,r=[],o,s,i,a,c;if(!n||!n.tagName)return"";if(kn.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());let u=e&&e.length?e.filter(p=>n.getAttribute(p)).map(p=>[p,n.getAttribute(p)]):null;if(u&&u.length)u.forEach(p=>{r.push(`[${p[0]}="${p[1]}"]`)});else if(n.id&&r.push(`#${n.id}`),o=n.className,o&&Ue(o))for(s=o.split(/\s+/),c=0;c<s.length;c++)r.push(`.${s[c]}`);let f=["aria-label","type","name","title","alt"];for(c=0;c<f.length;c++)i=f[c],a=n.getAttribute(i),a&&r.push(`[${i}="${a}"]`);return r.join("")}var v=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var Mn="Sentry Logger ",He=["debug","info","warn","error","log","assert","trace"],qe={};function fe(t){if(!("console"in m))return t();let e=m.console,n={},r=Object.keys(qe);r.forEach(o=>{let s=qe[o];n[o]=e[o],e[o]=s});try{return t()}finally{r.forEach(o=>{e[o]=n[o]})}}function Pn(){let t=!1,e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return v?He.forEach(n=>{e[n]=(...r)=>{t&&fe(()=>{m.console[n](`${Mn}[${n}]:`,...r)})}}):He.forEach(n=>{e[n]=()=>{}}),e}var d=Pn();var wn=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Ln(t){return t==="http"||t==="https"}function M(t,e=!1){let{host:n,path:r,pass:o,port:s,projectId:i,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&o?`:${o}`:""}@${n}${s?`:${s}`:""}/${r&&`${r}/`}${i}`}function Ct(t){let e=wn.exec(t);if(!e){fe(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}let[n,r,o="",s,i="",a]=e.slice(1),c="",u=a,f=u.split("/");if(f.length>1&&(c=f.slice(0,-1).join("/"),u=f.pop()),u){let p=u.match(/^\d+/);p&&(u=p[0])}return Ot({host:s,pass:o,path:c,projectId:u,port:i,protocol:n,publicKey:r})}function Ot(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function Fn(t){if(!v)return!0;let{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(i=>t[i]?!1:(d.error(`Invalid Sentry Dsn: ${i} missing`),!0))?!1:n.match(/^\d+$/)?Ln(r)?e&&isNaN(parseInt(e,10))?(d.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(d.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(d.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function de(t){let e=typeof t=="string"?Ct(t):Ot(t);if(!(!e||!Fn(e)))return e}var y=class extends Error{constructor(e,n="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=n}};function U(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{v&&d.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function Ye(t){return Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}function le(t){if(F(t))return{message:t.message,name:t.name,stack:t.stack,...kt(t)};if(Be(t)){let e={type:t.type,target:Nt(t.target),currentTarget:Nt(t.currentTarget),...kt(t)};return typeof CustomEvent<"u"&&O(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Nt(t){try{return $e(t)?Rt(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function kt(t){if(typeof t=="object"&&t!==null){let e={};for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}else return{}}function K(t,e=40){let n=Object.keys(le(t));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=e)return k(n[0],e);for(let r=n.length;r>0;r--){let o=n.slice(0,r).join(", ");if(!(o.length>e))return r===n.length?o:k(o,e)}return""}function E(t){return ze(t,new Map)}function ze(t,e){if(Un(t)){let n=e.get(t);if(n!==void 0)return n;let r={};e.set(t,r);for(let o of Object.keys(t))typeof t[o]<"u"&&(r[o]=ze(t[o],e));return r}if(Array.isArray(t)){let n=e.get(t);if(n!==void 0)return n;let r=[];return e.set(t,r),t.forEach(o=>{r.push(ze(o,e))}),r}return t}function Un(t){if(!A(t))return!1;try{let e=Object.getPrototypeOf(t).constructor.name;return!e||e==="Object"}catch{return!0}}var me="?",Dt=/\(error: (.*)\)/,vt=/captureMessage|captureException/;function ge(...t){let e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,o=0)=>{let s=[],i=n.split(` `);for(let a=r;a<i.length;a++){let c=i[a];if(c.length>1024)continue;let u=Dt.test(c)?c.replace(Dt,"$1"):c;if(!u.match(/\S*Error: /)){for(let f of e){let p=f(u);if(p){s.push(p);break}}if(s.length>=50+o)break}}return Mt(s.slice(o))}}function We(t){return Array.isArray(t)?ge(...t):t}function Mt(t){if(!t.length)return[];let e=Array.from(t);return/sentryWrapped/.test(e[e.length-1].function||"")&&e.pop(),e.reverse(),vt.test(e[e.length-1].function||"")&&(e.pop(),vt.test(e[e.length-1].function||"")&&e.pop()),e.slice(0,50).map(n=>({...n,filename:n.filename||e[e.length-1].filename,function:n.function||me}))}var Je="<anonymous>";function V(t){try{return!t||typeof t!="function"?Je:t.name||Je}catch{return Je}}var he={},Pt={};function _e(t,e){he[t]=he[t]||[],he[t].push(e)}function Ee(t,e){Pt[t]||(e(),Pt[t]=!0)}function Se(t,e){let n=t&&he[t];if(n)for(let r of n)try{r(e)}catch(o){v&&d.error(`Error while triggering instrumentation handler. Type: ${t} Name: ${V(r)} Error:`,o)}}var wt=1e3;function z(){return Date.now()/wt}function Bn(){let{performance:t}=m;if(!t||!t.now)return z;let e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/wt}var Z=Bn(),X,$n=(()=>{let{performance:t}=m;if(!t||!t.now){X="none";return}let e=3600*1e3,n=t.now(),r=Date.now(),o=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,s=o<e,i=t.timing&&t.timing.navigationStart,c=typeof i=="number"?Math.abs(i+n-r):e,u=c<e;return s||u?o<=c?(X="timeOrigin",t.timeOrigin):(X="navigationStart",i):(X="dateNow",r)})();var ye=null;function Ke(t){let e="error";_e(e,t),Ee(e,jn)}function jn(){ye=m.onerror,m.onerror=function(t,e,n,r,o){return Se("error",{column:r,error:o,line:n,msg:t,url:e}),ye&&!ye.__SENTRY_LOADER__?ye.apply(this,arguments):!1},m.onerror.__SENTRY_INSTRUMENTED__=!0}var Te=null;function Ve(t){let e="unhandledrejection";_e(e,t),Ee(e,Gn)}function Gn(){Te=m.onunhandledrejection,m.onunhandledrejection=function(t){return Se("unhandledrejection",t),Te&&!Te.__SENTRY_LOADER__?Te.apply(this,arguments):!0},m.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}function Lt(){let t=typeof WeakSet=="function",e=t?new WeakSet:[];function n(o){if(t)return e.has(o)?!0:(e.add(o),!1);for(let s=0;s<e.length;s++)if(e[s]===o)return!0;return e.push(o),!1}function r(o){if(t)e.delete(o);else for(let s=0;s<e.length;s++)if(e[s]===o){e.splice(s,1);break}}return[n,r]}function S(){let t=m,e=t.crypto||t.msCrypto,n=()=>Math.random()*16;try{if(e&&e.randomUUID)return e.randomUUID().replace(/-/g,"");e&&e.getRandomValues&&(n=()=>{let r=new Uint8Array(1);return e.getRandomValues(r),r[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,r=>(r^(n()&15)>>r/4).toString(16))}function Hn(t){return t.exception&&t.exception.values?t.exception.values[0]:void 0}function Q(t,e,n){let r=t.exception=t.exception||{},o=r.values=r.values||[],s=o[0]=o[0]||{};s.value||(s.value=e||""),s.type||(s.type=n||"Error")}function B(t,e){let n=Hn(t);if(!n)return;let r={type:"generic",handled:!0},o=n.mechanism;if(n.mechanism={...r,...o,...e},e&&"data"in e){let s={...o&&o.data,...e.data};n.mechanism.data=s}}function Ie(t){if(t&&t.__sentry_captured__)return!0;try{U(t,"__sentry_captured__",!0)}catch{}return!1}function ee(t){return Array.isArray(t)?t:[t]}function b(t,e=100,n=1/0){try{return Xe("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Y(t,e=3,n=100*1024){let r=b(t,e);return Jn(r)>n?Y(t,e-1,n):r}function Xe(t,e,n=1/0,r=1/0,o=Lt()){let[s,i]=o;if(e==null||["number","boolean","string"].includes(typeof e)&&!Number.isNaN(e))return e;let a=qn(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;let c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(c===0)return a.replace("object ","");if(s(e))return"[Circular ~]";let u=e;if(u&&typeof u.toJSON=="function")try{let g=u.toJSON();return Xe("",g,c-1,r,o)}catch{}let f=Array.isArray(e)?[]:{},p=0,l=le(e);for(let g in l){if(!Object.prototype.hasOwnProperty.call(l,g))continue;if(p>=r){f[g]="[MaxProperties ~]";break}let h=l[g];f[g]=Xe(g,h,c-1,r,o),p++}return i(e),f}function qn(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(Ge(e))return"[VueViewModel]";if(je(e))return"[SyntheticEvent]";if(typeof e=="number"&&e!==e)return"[NaN]";if(typeof e=="function")return`[Function: ${V(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;let n=zn(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function zn(t){let e=Object.getPrototypeOf(t);return e?e.constructor.name:"null prototype"}function Yn(t){return~-encodeURI(t).split(/%..|./).length}function Jn(t){return Yn(JSON.stringify(t))}function Wn(t,e){let n=0;for(let r=t.length-1;r>=0;r--){let o=t[r];o==="."?t.splice(r,1):o===".."?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}var Kn=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function Vn(t){let e=t.length>1024?`<truncated>${t.slice(-1024)}`:t,n=Kn.exec(e);return n?n.slice(1):[]}function Ze(...t){let e="",n=!1;for(let r=t.length-1;r>=-1&&!n;r--){let o=r>=0?t[r]:"/";o&&(e=`${o}/${e}`,n=o.charAt(0)==="/")}return e=Wn(e.split("/").filter(r=>!!r),!n).join("/"),(n?"/":"")+e||"."}function Ft(t){let e=0;for(;e<t.length&&t[e]==="";e++);let n=t.length-1;for(;n>=0&&t[n]==="";n--);return e>n?[]:t.slice(e,n-e+1)}function Qe(t,e){t=Ze(t).slice(1),e=Ze(e).slice(1);let n=Ft(t.split("/")),r=Ft(e.split("/")),o=Math.min(n.length,r.length),s=o;for(let a=0;a<o;a++)if(n[a]!==r[a]){s=a;break}let i=[];for(let a=s;a<n.length;a++)i.push("..");return i=i.concat(r.slice(s)),i.join("/")}function te(t,e){let n=Vn(t)[2];return e&&n.slice(e.length*-1)===e&&(n=n.slice(0,n.length-e.length)),n}var N;(function(t){t[t.PENDING=0]="PENDING";let n=1;t[t.RESOLVED=n]="RESOLVED";let r=2;t[t.REJECTED=r]="REJECTED"})(N||(N={}));function I(t){return new R(e=>{e(t)})}function $(t){return new R((e,n)=>{n(t)})}var R=class t{constructor(e){t.prototype.__init.call(this),t.prototype.__init2.call(this),t.prototype.__init3.call(this),t.prototype.__init4.call(this),this._state=N.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(n){this._reject(n)}}then(e,n){return new t((r,o)=>{this._handlers.push([!1,s=>{if(!e)r(s);else try{r(e(s))}catch(i){o(i)}},s=>{if(!n)o(s);else try{r(n(s))}catch(i){o(i)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new t((n,r)=>{let o,s;return this.then(i=>{s=!1,o=i,e&&e()},i=>{s=!0,o=i,e&&e()}).then(()=>{if(s){r(o);return}n(o)})})}__init(){this._resolve=e=>{this._setResult(N.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(N.REJECTED,e)}}__init3(){this._setResult=(e,n)=>{if(this._state===N.PENDING){if(C(n)){n.then(this._resolve,this._reject);return}this._state=e,this._value=n,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===N.PENDING)return;let e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===N.RESOLVED&&n[1](this._value),this._state===N.REJECTED&&n[2](this._value),n[0]=!0)})}}};function et(t){let e=[];function n(){return t===void 0||e.length<t}function r(i){return e.splice(e.indexOf(i),1)[0]}function o(i){if(!n())return $(new y("Not adding Promise because buffer limit was reached."));let a=i();return e.indexOf(a)===-1&&e.push(a),a.then(()=>r(a)).then(null,()=>r(a).then(null,()=>{})),a}function s(i){return new R((a,c)=>{let u=e.length;if(!u)return a(!0);let f=setTimeout(()=>{i&&i>0&&a(!1)},i);e.forEach(p=>{I(p).then(()=>{--u||(clearTimeout(f),a(!0))},c)})})}return{$:e,add:o,drain:s}}function Ut(t,e=!1){return!(e||t&&!t.startsWith("/")&&!t.match(/^[A-Z]:/)&&!t.startsWith(".")&&!t.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&t!==void 0&&!t.includes("node_modules/")}function Bt(t){let e=/^\s*[-]{4,}$/,n=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return r=>{let o=r.match(n);if(o){let s,i,a,c,u;if(o[1]){a=o[1];let l=a.lastIndexOf(".");if(a[l-1]==="."&&l--,l>0){s=a.slice(0,l),i=a.slice(l+1);let g=s.indexOf(".Module");g>0&&(a=a.slice(g+1),s=s.slice(0,g))}c=void 0}i&&(c=s,u=i),i==="<anonymous>"&&(u=void 0,a=void 0),a===void 0&&(u=u||me,a=c?`${c}.${u}`:u);let f=o[2]&&o[2].startsWith("file://")?o[2].slice(7):o[2],p=o[5]==="native";return f&&f.match(/\/[A-Z]:/)&&(f=f.slice(1)),!f&&o[5]&&!p&&(f=o[5]),{filename:f,module:t?t(f):void 0,function:a,lineno:parseInt(o[3],10)||void 0,colno:parseInt(o[4],10)||void 0,in_app:Ut(f,p)}}if(r.match(e))return{filename:r}}}function tt(t){return[90,Bt(t)]}function P(t,e=[]){return[t,e]}function rt(t,e){let[n,r]=t;return[n,[...r,e]]}function xe(t,e){let n=t[1];for(let r of n){let o=r[0].type;if(e(r,o))return!0}return!1}function nt(t){return m.__SENTRY__&&m.__SENTRY__.encodePolyfill?m.__SENTRY__.encodePolyfill(t):new TextEncoder().encode(t)}function ot(t){let[e,n]=t,r=JSON.stringify(e);function o(s){typeof r=="string"?r=typeof s=="string"?r+s:[nt(r),s]:r.push(typeof s=="string"?nt(s):s)}for(let s of n){let[i,a]=s;if(o(` ${JSON.stringify(i)} `),typeof a=="string"||a instanceof Uint8Array)o(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(b(a))}o(c)}}return typeof r=="string"?r:Xn(r)}function Xn(t){let e=t.reduce((o,s)=>o+s.length,0),n=new Uint8Array(e),r=0;for(let o of t)n.set(o,r),r+=o.length;return n}function st(t){let e=typeof t.data=="string"?nt(t.data):t.data;return[E({type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType}),e]}var Zn={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function Ae(t){return Zn[t]}function be(t){if(!t||!t.sdk)return;let{name:e,version:n}=t.sdk;return{name:e,version:n}}function it(t,e,n,r){let o=t.sdkProcessingMetadata&&t.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:M(r)},...o&&{trace:E({...o})}}}function $t(t,e=Date.now()){let n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${t}`);return isNaN(r)?6e4:r-e}function jt(t,e){return t[e]||t.all||0}function at(t,e,n=Date.now()){return jt(t,e)>n}function ct(t,{statusCode:e,headers:n},r=Date.now()){let o={...t},s=n&&n["x-sentry-rate-limits"],i=n&&n["retry-after"];if(s)for(let a of s.trim().split(",")){let[c,u,,,f]=a.split(":",5),p=parseInt(c,10),l=(isNaN(p)?60:p)*1e3;if(!u)o.all=r+l;else for(let g of u.split(";"))g==="metric_bucket"?(!f||f.split(";").includes("custom"))&&(o[g]=r+l):o[g]=r+l}else i?o.all=r+$t(i,r):e===429&&(o.all=r+60*1e3);return o}function ut(t,e){return t(e.stack||"",1)}function Gt(t,e){let n={type:e.name||e.constructor.name,value:e.message},r=ut(t,e);return r.length&&(n.stacktrace={frames:r}),n}function Qn(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let n=t[e];if(n instanceof Error)return n}}function er(t){if("name"in t&&typeof t.name=="string"){let r=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(r+=` with message '${t.message}'`),r}else if("message"in t&&typeof t.message=="string")return t.message;let e=K(t);if(Fe(t))return`Event \`ErrorEvent\` captured as exception with message \`${t.message}\``;let n=tr(t);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${e}`}function tr(t){try{let e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function nr(t,e,n,r){if(F(n))return[n,void 0];if(e.synthetic=!0,A(n)){let s=t&&t.getOptions().normalizeDepth,i={__serialized__:Y(n,s)},a=Qn(n);if(a)return[a,i];let c=er(n),u=r&&r.syntheticException||new Error(c);return u.message=c,[u,i]}let o=r&&r.syntheticException||new Error(n);return o.message=`${n}`,[o,void 0]}function pt(t,e,n,r){let s=r&&r.data&&r.data.mechanism||{handled:!0,type:"generic"},[i,a]=nr(t,s,n,r),c={exception:{values:[Gt(e,i)]}};return a&&(c.extra=a),Q(c,void 0,void 0),B(c,s),{...c,event_id:r&&r.event_id}}function ft(t,e,n="info",r,o){let s={event_id:r&&r.event_id,level:n};if(o&&r&&r.syntheticException){let i=ut(t,r.syntheticException);i.length&&(s.exception={values:[{value:e,stacktrace:{frames:i}}]})}if(H(e)){let{__sentry_template_string__:i,__sentry_template_values__:a}=e;return s.logentry={message:i,params:a},s}return s.message=e,s}function Re(){return{traceId:S(),spanId:S().substring(16)}}var _=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function w(){return ne(m),m}function ne(t){let e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||D,e[D]=e[D]||{}}function re(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||Z(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:S()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{let n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}var dt="_sentrySpan";function lt(t,e){e?U(t,dt,e):delete t[dt]}function j(t){return t[dt]}var or=100,mt=class t{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=Re()}clone(){let e=new t;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._requestSession=this._requestSession,e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,lt(e,j(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&re(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;let n=typeof e=="function"?e(this):e,[r,o]=n instanceof x?[n.getScopeData(),n.getRequestSession()]:A(n)?[e,e.requestSession]:[],{tags:s,extra:i,user:a,contexts:c,level:u,fingerprint:f=[],propagationContext:p}=r||{};return this._tags={...this._tags,...s},this._extra={...this._extra,...i},this._contexts={...this._contexts,...c},a&&Object.keys(a).length&&(this._user=a),u&&(this._level=u),f.length&&(this._fingerprint=f),p&&(this._propagationContext=p),o&&(this._requestSession=o),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,lt(this,void 0),this._attachments=[],this._propagationContext=Re(),this._notifyScopeListeners(),this}addBreadcrumb(e,n){let r=typeof n=="number"?n:or;if(r<=0)return this;let o={timestamp:z(),...e},s=this._breadcrumbs;return s.push(o),this._breadcrumbs=s.length>r?s.slice(-r):s,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:j(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){let r=n&&n.event_id?n.event_id:S();if(!this._client)return d.warn("No client configured on scope - will not capture exception!"),r;let o=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:o,...n,event_id:r},this),r}captureMessage(e,n,r){let o=r&&r.event_id?r.event_id:S();if(!this._client)return d.warn("No client configured on scope - will not capture message!"),o;let s=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:o},this),o}captureEvent(e,n){let r=n&&n.event_id?n.event_id:S();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(d.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}},x=mt;function Ht(){return q("defaultCurrentScope",()=>new x)}function qt(){return q("defaultIsolationScope",()=>new x)}var gt=class{constructor(e,n){let r;e?r=e:r=new x;let o;n?o=n:o=new x,this._stack=[{scope:r}],this._isolationScope=o}withScope(e){let n=this._pushScope(),r;try{r=e(n)}catch(o){throw this._popScope(),o}return C(r)?r.then(o=>(this._popScope(),o),o=>{throw this._popScope(),o}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let e=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:e}),e}_popScope(){return this.getStack().length<=1?!1:!!this.getStack().pop()}};function J(){let t=w(),e=ne(t);return e.stack=e.stack||new gt(Ht(),qt())}function sr(t){return J().withScope(t)}function ir(t,e){let n=J();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function zt(t){return J().withScope(()=>t(J().getIsolationScope()))}function Yt(){return{withIsolationScope:zt,withScope:sr,withSetScope:ir,withSetIsolationScope:(t,e)=>zt(e),getCurrentScope:()=>J().getScope(),getIsolationScope:()=>J().getIsolationScope()}}function oe(t){let e=ne(t);return e.acs?e.acs:Yt()}function ht(){let t=w();return oe(t).getCurrentScope()}function G(){let t=w();return oe(t).getIsolationScope()}function Jt(){return q("globalScope",()=>new x)}function Wt(){return ht().getClient()}var ar="_sentryMetrics";function Kt(t){let e=t[ar];if(!e)return;let n={};for(let[,[r,o]]of e)n[r]||(n[r]=[]),n[r].push(E(o));return n}var Vt="sentry.source",Xt="sentry.sample_rate",Zt="sentry.op",Qt="sentry.origin";var cr=1;function Ce(t){let{spanId:e,traceId:n}=t.spanContext(),{parent_span_id:r}=W(t);return E({parent_span_id:r,span_id:e,trace_id:n})}function en(t){return typeof t=="number"?tn(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?tn(t.getTime()):Z()}function tn(t){return t>9999999999?t/1e3:t}function W(t){if(pr(t))return t.getSpanJSON();try{let{spanId:e,traceId:n}=t.spanContext();if(ur(t)){let{attributes:r,startTime:o,name:s,endTime:i,parentSpanId:a,status:c}=t;return E({span_id:e,trace_id:n,data:r,description:s,parent_span_id:a,start_timestamp:en(o),timestamp:en(i)||void 0,status:fr(c),op:r[Zt],origin:r[Qt],_metrics_summary:Kt(t)})}return{span_id:e,trace_id:n}}catch{return{}}}function ur(t){let e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function pr(t){return typeof t.getSpanJSON=="function"}function nn(t){let{traceFlags:e}=t.spanContext();return e===cr}function fr(t){if(!(!t||t.code===0))return t.code===1?"ok":t.message||"unknown_error"}var dr="_sentryRootSpan";function L(t){return t[dr]||t}function rn(){let t=w(),e=oe(t);return e.getActiveSpan?e.getActiveSpan():j(ht())}var on=!1;function sn(){on||(on=!0,Ke(_t),Ve(_t))}function _t(){let t=rn(),e=t&&L(t);if(e){let n="internal_error";_&&d.log(`[Tracing] Root span: ${n} -> Global error occured`),e.setStatus({code:2,message:n})}}_t.tag="sentry_tracingErrorCallback";var Oe="production";var lr="_frozenDsc";function se(t,e){let n=e.getOptions(),{publicKey:r}=e.getDsn()||{},o=E({environment:n.environment||Oe,release:n.release,public_key:r,trace_id:t});return e.emit("createDsc",o),o}function Ne(t){let e=Wt();if(!e)return{};let n=se(W(t).trace_id||"",e),r=L(t);if(!r)return n;let o=r[lr];if(o)return o;let s=W(r),i=s.data||{},a=i[Xt];a!=null&&(n.sample_rate=`${a}`);let c=i[Vt];return c&&c!=="url"&&(n.transaction=s.description),n.sampled=String(nn(r)),e.emit("createDsc",n),n}function an(t){if(typeof t=="boolean")return Number(t);let e=typeof t=="string"?parseFloat(t):t;if(typeof e!="number"||isNaN(e)||e<0||e>1){_&&d.warn(`[Tracing] Given sample rate is invalid. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`);return}return e}function mr(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function cn(t,e,n,r){let o=be(n),s={sent_at:new Date().toISOString(),...o&&{sdk:o},...!!r&&e&&{dsn:M(e)}},i="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return P(s,[i])}function un(t,e,n,r){let o=be(n),s=t.type&&t.type!=="replay_event"?t.type:"event";mr(t,n&&n.sdk);let i=it(t,o,r,e);return delete t.sdkProcessingMetadata,P(i,[[{type:s},t]])}function ke(t,e,n,r=0){return new R((o,s)=>{let i=t[r];if(e===null||typeof i!="function")o(e);else{let a=i({...e},n);_&&i.id&&a===null&&d.log(`Event processor "${i.id}" dropped event`),C(a)?a.then(c=>ke(t,c,n,r+1).then(o)).then(null,s):ke(t,a,n,r+1).then(o).then(null,s)}})}function pn(t,e){let{fingerprint:n,span:r,breadcrumbs:o,sdkProcessingMetadata:s}=e;gr(t,e),r&&Er(t,r),Sr(t,n),hr(t,o),_r(t,s)}function Et(t,e){let{extra:n,tags:r,user:o,contexts:s,level:i,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:u,eventProcessors:f,attachments:p,propagationContext:l,transactionName:g,span:h}=e;ie(t,"extra",n),ie(t,"tags",r),ie(t,"user",o),ie(t,"contexts",s),ie(t,"sdkProcessingMetadata",a),i&&(t.level=i),g&&(t.transactionName=g),h&&(t.span=h),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),u.length&&(t.fingerprint=[...t.fingerprint,...u]),f.length&&(t.eventProcessors=[...t.eventProcessors,...f]),p.length&&(t.attachments=[...t.attachments,...p]),t.propagationContext={...t.propagationContext,...l}}function ie(t,e,n){if(n&&Object.keys(n).length){t[e]={...t[e]};for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[e][r]=n[r])}}function gr(t,e){let{extra:n,tags:r,user:o,contexts:s,level:i,transactionName:a}=e,c=E(n);c&&Object.keys(c).length&&(t.extra={...c,...t.extra});let u=E(r);u&&Object.keys(u).length&&(t.tags={...u,...t.tags});let f=E(o);f&&Object.keys(f).length&&(t.user={...f,...t.user});let p=E(s);p&&Object.keys(p).length&&(t.contexts={...p,...t.contexts}),i&&(t.level=i),a&&t.type!=="transaction"&&(t.transaction=a)}function hr(t,e){let n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function _r(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function Er(t,e){t.contexts={trace:Ce(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Ne(e),...t.sdkProcessingMetadata};let n=L(e),r=W(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function Sr(t,e){t.fingerprint=t.fingerprint?ee(t.fingerprint):[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint&&!t.fingerprint.length&&delete t.fingerprint}function dn(t,e,n,r,o,s){let{normalizeDepth:i=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||S(),timestamp:e.timestamp||z()},u=n.integrations||t.integrations.map(T=>T.name);yr(c,t),xr(c,u),e.type===void 0&&Tr(c,t.stackParser);let f=br(r,n.captureContext);n.mechanism&&B(c,n.mechanism);let p=o?o.getEventProcessors():[],l=Jt().getScopeData();if(s){let T=s.getScopeData();Et(l,T)}if(f){let T=f.getScopeData();Et(l,T)}let g=[...n.attachments||[],...l.attachments];g.length&&(n.attachments=g),pn(c,l);let h=[...p,...l.eventProcessors];return ke(h,c,n).then(T=>(T&&Ir(T),typeof i=="number"&&i>0?Ar(T,i,a):T))}function yr(t,e){let{environment:n,release:r,dist:o,maxValueLength:s=250}=e;"environment"in t||(t.environment="environment"in e?n:Oe),t.release===void 0&&r!==void 0&&(t.release=r),t.dist===void 0&&o!==void 0&&(t.dist=o),t.message&&(t.message=k(t.message,s));let i=t.exception&&t.exception.values&&t.exception.values[0];i&&i.value&&(i.value=k(i.value,s));let a=t.request;a&&a.url&&(a.url=k(a.url,s))}var fn=new WeakMap;function Tr(t,e){let n=m._sentryDebugIds;if(!n)return;let r,o=fn.get(e);o?r=o:(r=new Map,fn.set(e,r));let s=Object.keys(n).reduce((i,a)=>{let c,u=r.get(a);u?c=u:(c=e(a),r.set(a,c));for(let f=c.length-1;f>=0;f--){let p=c[f];if(p.filename){i[p.filename]=n[a];break}}return i},{});try{t.exception.values.forEach(i=>{i.stacktrace.frames.forEach(a=>{a.filename&&(a.debug_id=s[a.filename])})})}catch{}}function Ir(t){let e={};try{t.exception.values.forEach(r=>{r.stacktrace.frames.forEach(o=>{o.debug_id&&(o.abs_path?e[o.abs_path]=o.debug_id:o.filename&&(e[o.filename]=o.debug_id),delete o.debug_id)})})}catch{}if(Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];let n=t.debug_meta.images;Object.keys(e).forEach(r=>{n.push({type:"sourcemap",code_file:r,debug_id:e[r]})})}function xr(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function Ar(t,e,n){if(!t)return null;let r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:b(o.data,e,n)}}))},...t.user&&{user:b(t.user,e,n)},...t.contexts&&{contexts:b(t.contexts,e,n)},...t.extra&&{extra:b(t.extra,e,n)}};return t.contexts&&t.contexts.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=b(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>({...o,...o.data&&{data:b(o.data,e,n)}}))),r}function br(t,e){if(!e)return t;let n=t?t.clone():new x;return n.update(e),n}var De=class{constructor(e,n){this._client=e,this.flushTimeout=60,this._pendingAggregates={},this._isEnabled=!0,this._intervalId=setInterval(()=>this.flush(),this.flushTimeout*1e3),this._intervalId.unref&&this._intervalId.unref(),this._sessionAttrs=n}flush(){let e=this.getSessionAggregates();e.aggregates.length!==0&&(this._pendingAggregates={},this._client.sendSession(e))}getSessionAggregates(){let e=Object.keys(this._pendingAggregates).map(r=>this._pendingAggregates[parseInt(r)]),n={attrs:this._sessionAttrs,aggregates:e};return E(n)}close(){clearInterval(this._intervalId),this._isEnabled=!1,this.flush()}incrementSessionStatusCount(){if(!this._isEnabled)return;let e=G(),n=e.getRequestSession();n&&n.status&&(this._incrementSessionStatusCount(n.status,new Date),e.setRequestSession(void 0))}_incrementSessionStatusCount(e,n){let r=new Date(n).setSeconds(0,0);this._pendingAggregates[r]=this._pendingAggregates[r]||{};let o=this._pendingAggregates[r];switch(o.started||(o.started=new Date(r).toISOString()),e){case"errored":return o.errored=(o.errored||0)+1,o.errored;case"ok":return o.exited=(o.exited||0)+1,o.exited;default:return o.crashed=(o.crashed||0)+1,o.crashed}}};var Rr="7";function Cr(t){let e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function Or(t){return`${Cr(t)}${t.projectId}/envelope/`}function Nr(t,e){return Ye({sentry_key:t.publicKey,sentry_version:Rr,...e&&{sentry_client:`${e.name}/${e.version}`}})}function ln(t,e,n){return e||`${Or(t)}?${Nr(t,n)}`}var mn=[];function kr(t){let e={};return t.forEach(n=>{let{name:r}=n,o=e[r];o&&!o.isDefaultInstance&&n.isDefaultInstance||(e[r]=n)}),Object.keys(e).map(n=>e[n])}function St(t){let e=t.defaultIntegrations||[],n=t.integrations;e.forEach(i=>{i.isDefaultInstance=!0});let r;Array.isArray(n)?r=[...e,...n]:typeof n=="function"?r=ee(n(e)):r=e;let o=kr(r),s=Dr(o,i=>i.name==="Debug");if(s!==-1){let[i]=o.splice(s,1);o.push(i)}return o}function gn(t,e){let n={};return e.forEach(r=>{r&&Tt(t,r,n)}),n}function yt(t,e){for(let n of e)n&&n.afterAllSetup&&n.afterAllSetup(t)}function Tt(t,e,n){if(n[e.name]){_&&d.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,mn.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),mn.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){let r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(o,s)=>r(o,s,t))}if(typeof e.processEvent=="function"){let r=e.processEvent.bind(e),o=Object.assign((s,i)=>r(s,i,t),{id:e.name});t.addEventProcessor(o)}_&&d.log(`Integration installed: ${e.name}`)}function Dr(t,e){for(let n=0;n<t.length;n++)if(e(t[n])===!0)return n;return-1}var hn="Not capturing exception because it's already been captured.",ve=class{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=de(e.dsn):_&&d.warn("No DSN provided, client will not send events."),this._dsn){let n=ln(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:n})}}captureException(e,n,r){let o=S();if(Ie(e))return _&&d.log(hn),o;let s={event_id:o,...n};return this._process(this.eventFromException(e,s).then(i=>this._captureEvent(i,s,r))),s.event_id}captureMessage(e,n,r,o){let s={event_id:S(),...r},i=H(e)?e:String(e),a=pe(e)?this.eventFromMessage(i,n,s):this.eventFromException(e,s);return this._process(a.then(c=>this._captureEvent(c,s,o))),s.event_id}captureEvent(e,n,r){let o=S();if(n&&n.originalException&&Ie(n.originalException))return _&&d.log(hn),o;let s={event_id:o,...n},a=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,s,a||r)),s.event_id}captureSession(e){typeof e.release!="string"?_&&d.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),re(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){let n=this._transport;return n?(this.emit("flush"),this._isClientDoneProcessing(e).then(r=>n.flush(e).then(o=>r&&o))):I(!0)}close(e){return this.flush(e).then(n=>(this.getOptions().enabled=!1,this.emit("close"),n))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){let n=this._integrations[e.name];Tt(this,e,this._integrations),n||yt(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=un(e,this._dsn,this._options._metadata,this._options.tunnel);for(let s of n.attachments||[])r=rt(r,st(s));let o=this.sendEnvelope(r);o&&o.then(s=>this.emit("afterSendEvent",e,s),null)}sendSession(e){let n=cn(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(n)}recordDroppedEvent(e,n,r){if(this._options.sendClientReports){let o=`${e}:${n}`;_&&d.log(`Adding outcome: "${o}"`),this._outcomes[o]=this._outcomes[o]+1||1}}on(e,n){this._hooks[e]||(this._hooks[e]=[]),this._hooks[e].push(n)}emit(e,...n){this._hooks[e]&&this._hooks[e].forEach(r=>r(...n))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,n=>(_&&d.error("Error while sending event:",n),n)):(_&&d.error("Transport disabled"),I({}))}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=gn(this,e),yt(this,e)}_updateSessionFromEvent(e,n){let r=!1,o=!1,s=n.exception&&n.exception.values;if(s){o=!0;for(let c of s){let u=c.mechanism;if(u&&u.handled===!1){r=!0;break}}}let i=e.status==="ok";(i&&e.errors===0||i&&r)&&(re(e,{...r&&{status:"crashed"},errors:e.errors||Number(o||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new R(n=>{let r=0,o=1,s=setInterval(()=>{this._numProcessing==0?(clearInterval(s),n(!0)):(r+=o,e&&r>=e&&(clearInterval(s),n(!1)))},o)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,o=G()){let s=this.getOptions(),i=Object.keys(this._integrations);return!n.integrations&&i.length>0&&(n.integrations=i),this.emit("preprocessEvent",e,n),e.type||o.setLastEventId(e.event_id||n.event_id),dn(s,e,n,r,this,o).then(a=>{if(a===null)return a;let c={...o.getPropagationContext(),...r?r.getPropagationContext():void 0};if(!(a.contexts&&a.contexts.trace)&&c){let{traceId:f,spanId:p,parentSpanId:l,dsc:g}=c;a.contexts={trace:E({trace_id:f,span_id:p,parent_span_id:l}),...a.contexts};let h=g||se(f,this);a.sdkProcessingMetadata={dynamicSamplingContext:h,...a.sdkProcessingMetadata}}return a})}_captureEvent(e,n={},r){return this._processEvent(e,n,r).then(o=>o.event_id,o=>{if(_){let s=o;s.logLevel==="log"?d.log(s.message):d.warn(s)}})}_processEvent(e,n,r){let o=this.getOptions(),{sampleRate:s}=o,i=En(e),a=_n(e),c=e.type||"error",u=`before send for type \`${c}\``,f=typeof s>"u"?void 0:an(s);if(a&&typeof f=="number"&&Math.random()>f)return this.recordDroppedEvent("sample_rate","error",e),$(new y(`Discarding event because it's not included in the random sample (sampling rate = ${s})`,"log"));let p=c==="replay_event"?"replay":c,g=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,n,r,g).then(h=>{if(h===null)throw this.recordDroppedEvent("event_processor",p,e),new y("An event processor returned `null`, will not send event.","log");if(n.data&&n.data.__sentry__===!0)return h;let T=Mr(o,h,n);return vr(T,u)}).then(h=>{if(h===null)throw this.recordDroppedEvent("before_send",p,e),new y(`${u} returned \`null\`, will not send event.`,"log");let ce=r&&r.getSession();!i&&ce&&this._updateSessionFromEvent(ce,h);let T=h.transaction_info;if(i&&T&&h.transaction!==e.transaction){let Nn="custom";h.transaction_info={...T,source:Nn}}return this.sendEvent(h,n),h}).then(null,h=>{throw h instanceof y?h:(this.captureException(h,{data:{__sentry__:!0},originalException:h}),new y(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event. Reason: ${h}`))})}_process(e){this._numProcessing++,e.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.keys(e).map(n=>{let[r,o]=n.split(":");return{reason:r,category:o,quantity:e[n]}})}};function vr(t,e){let n=`${e} must return \`null\` or a valid event.`;if(C(t))return t.then(r=>{if(!A(r)&&r!==null)throw new y(n);return r},r=>{throw new y(`${e} rejected with ${r}`)});if(!A(t)&&t!==null)throw new y(n);return t}function Mr(t,e,n){let{beforeSend:r,beforeSendTransaction:o,beforeSendSpan:s}=t;if(_n(e)&&r)return r(e,n);if(En(e)){if(e.spans&&s){let i=[];for(let a of e.spans){let c=s(a);c&&i.push(c)}e.spans=i}if(o)return o(e,n)}return e}function _n(t){return t.type===void 0}function En(t){return t.type==="transaction"}function Sn(t,e,n,r,o){let s={sent_at:new Date().toISOString()};n&&n.sdk&&(s.sdk={name:n.sdk.name,version:n.sdk.version}),r&&o&&(s.dsn=M(o)),e&&(s.trace=E(e));let i=Pr(t);return P(s,[i])}function Pr(t){return[{type:"check_in"},t]}var ae=class extends ve{constructor(e){sn(),super(e)}eventFromException(e,n){return I(pt(this,this._options.stackParser,e,n))}eventFromMessage(e,n="info",r){return I(ft(this._options.stackParser,e,n,r,this._options.attachStacktrace))}captureException(e,n,r){if(this._options.autoSessionTracking&&this._sessionFlusher){let o=G().getRequestSession();o&&o.status==="ok"&&(o.status="errored")}return super.captureException(e,n,r)}captureEvent(e,n,r){if(this._options.autoSessionTracking&&this._sessionFlusher&&(e.type||"exception")==="exception"&&e.exception&&e.exception.values&&e.exception.values.length>0){let i=G().getRequestSession();i&&i.status==="ok"&&(i.status="errored")}return super.captureEvent(e,n,r)}close(e){return this._sessionFlusher&&this._sessionFlusher.close(),super.close(e)}initSessionFlusher(){let{release:e,environment:n}=this._options;e?this._sessionFlusher=new De(this,{release:e,environment:n}):_&&d.warn("Cannot initialise an instance of SessionFlusher if no release is provided!")}captureCheckIn(e,n,r){let o="checkInId"in e&&e.checkInId?e.checkInId:S();if(!this._isEnabled())return _&&d.warn("SDK not enabled, will not capture checkin."),o;let s=this.getOptions(),{release:i,environment:a,tunnel:c}=s,u={check_in_id:o,monitor_slug:e.monitorSlug,status:e.status,release:i,environment:a};"duration"in e&&(u.duration=e.duration),n&&(u.monitor_config={schedule:n.schedule,checkin_margin:n.checkinMargin,max_runtime:n.maxRuntime,timezone:n.timezone,failure_issue_threshold:n.failureIssueThreshold,recovery_threshold:n.recoveryThreshold});let[f,p]=this._getTraceInfoFromScope(r);p&&(u.contexts={trace:p});let l=Sn(u,f,this.getSdkMetadata(),c,this.getDsn());return _&&d.info("Sending checkin:",e.monitorSlug,e.status),this.sendEnvelope(l),o}_captureRequestSession(){this._sessionFlusher?this._sessionFlusher.incrementSessionStatusCount():_&&d.warn("Discarded request mode session because autoSessionTracking option was disabled")}_prepareEvent(e,n,r,o){return this._options.platform&&(e.platform=e.platform||this._options.platform),this._options.runtime&&(e.contexts={...e.contexts,runtime:(e.contexts||{}).runtime||this._options.runtime}),this._options.serverName&&(e.server_name=e.server_name||this._options.serverName),super._prepareEvent(e,n,r,o)}_getTraceInfoFromScope(e){if(!e)return[void 0,void 0];let n=j(e);if(n){let c=L(n);return[Ne(c),Ce(c)]}let{traceId:r,spanId:o,parentSpanId:s,dsc:i}=e.getPropagationContext(),a={trace_id:r,span_id:o,parent_span_id:s};return i?[i,a]:[se(r,this),a]}};var wr=64;function It(t,e,n=et(t.bufferSize||wr)){let r={},o=i=>n.drain(i);function s(i){let a=[];if(xe(i,(p,l)=>{let g=Ae(l);if(at(r,g)){let h=yn(p,l);t.recordDroppedEvent("ratelimit_backoff",g,h)}else a.push(p)}),a.length===0)return I({});let c=P(i[0],a),u=p=>{xe(c,(l,g)=>{let h=yn(l,g);t.recordDroppedEvent(p,Ae(g),h)})},f=()=>e({body:ot(c)}).then(p=>(p.statusCode!==void 0&&(p.statusCode<200||p.statusCode>=300)&&_&&d.warn(`Sentry responded with status code ${p.statusCode} to sent event.`),r=ct(r,p),p),p=>{throw u("network_error"),p});return n.add(f).then(p=>p,p=>{if(p instanceof y)return _&&d.error("Skipped sending event because buffer is full."),u("queue_overflow"),I({});throw p})}return{send:s,flush:o}}function yn(t,e){if(!(e!=="event"&&e!=="transaction"))return Array.isArray(t)?t[1]:void 0}var Lr="RewriteFrames",Me=(t={})=>{let e=t.root,n=t.prefix||"app:///",r="window"in m&&m.window!==void 0,o=t.iteratee||Fr({isBrowser:r,root:e,prefix:n});function s(a){try{return{...a,exception:{...a.exception,values:a.exception.values.map(c=>({...c,...c.stacktrace&&{stacktrace:i(c.stacktrace)}}))}}}catch{return a}}function i(a){return{...a,frames:a&&a.frames&&a.frames.map(c=>o(c))}}return{name:Lr,processEvent(a){let c=a;return a.exception&&Array.isArray(a.exception.values)&&(c=s(c)),c}}};function Fr({isBrowser:t,root:e,prefix:n}){return r=>{if(!r.filename)return r;let o=/^[a-zA-Z]:\\/.test(r.filename)||r.filename.includes("\\")&&!r.filename.includes("/"),s=/^\//.test(r.filename);if(t){if(e){let i=r.filename;i.indexOf(e)===0&&(r.filename=i.replace(e,n))}}else if(o||s){let i=o?r.filename.replace(/^[a-zA-Z]:/,"").replace(/\\/g,"/"):r.filename,a=e?Qe(e,i):te(i);r.filename=`${n}${a}`}return r}}function In(t){return typeof t=="object"&&t!==null}function Br(t){return In(t)&&"handled"in t&&typeof t.handled=="boolean"&&"type"in t&&typeof t.type=="string"}function $r(t){return In(t)&&"mechanism"in t&&Br(t.mechanism)}function jr(){if(m.SENTRY_RELEASE&&m.SENTRY_RELEASE.id)return m.SENTRY_RELEASE.id}function Tn(t,e){return t!==void 0?(t[e[0]]=e[1],t):{[e[0]]:e[1]}}function xn(t,e){return t(e.stack||"",1)}function Gr(t){let e=t&&t.message;return e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function An(t,e){let n={type:e.name||e.constructor.name,value:Gr(e)},r=xn(t,e);return r.length&&(n.stacktrace={frames:r}),n.type===void 0&&n.value===""&&(n.value="Unrecoverable error caught"),n}function Hr(t,e,n,r){let o,i=(r&&r.data&&$r(r.data)?r.data.mechanism:void 0)??{handled:!0,type:"generic"};if(F(n))o=n;else{if(A(n)){let c=`Non-Error exception captured with keys: ${K(n)}`,u=t?.getClient(),f=u&&u.getOptions().normalizeDepth;t?.setExtra("__serialized__",Y(n,f)),o=r&&r.syntheticException||new Error(c),o.message=c}else o=r&&r.syntheticException||new Error(n),o.message=n;i.synthetic=!0}let a={exception:{values:[An(e,o)]}};return Q(a,void 0,void 0),B(a,i),{...a,event_id:r&&r.event_id}}function qr(t,e,n="info",r,o){let s={event_id:r&&r.event_id,level:n,message:e};if(o&&r&&r.syntheticException){let i=xn(t,r.syntheticException);i.length&&(s.exception={values:[{value:e,stacktrace:{frames:i}}]})}return s}var zr=5,Yr=(t={limit:zr})=>({name:"LinkedErrors",processEvent:(e,n,r)=>Jr(r.getOptions().stackParser,t.limit,e,n)});function Jr(t,e,n,r){if(!n.exception||!n.exception.values||!r||!O(r.originalException,Error))return n;let o=bn(t,e,r.originalException);return n.exception.values=[...o,...n.exception.values],n}function bn(t,e,n,r=[]){if(!O(n.cause,Error)||r.length+1>=e)return r;let o=An(t,n.cause);return bn(t,e,n.cause,[o,...r])}var Wr={allowedHeaders:["CF-RAY","CF-Worker"]},Kr=(t={})=>{let e={...Wr,...t};return{name:"RequestData",preprocessEvent:n=>{let{sdkProcessingMetadata:r}=n;return r&&("request"in r&&r.request instanceof Request&&(n.request=Xr(r.request,e),n.user=Vr(n.user??{},r.request,e)),"requestData"in r&&(n.request?n.request.data=r.requestData:n.request={data:r.requestData})),n}}};function Vr(t,e,n){let r=e.headers.get("CF-Connecting-IP"),{allowedIps