var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));!function(){"use strict";const e=Object.prototype.toString;function t(t){switch(e.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return h(t,Error)}}function n(t,n){return e.call(t)===`[object ${n}]`}function r(e){return n(e,"ErrorEvent")}function s(e){return n(e,"DOMError")}function o(e){return n(e,"String")}function i(e){return"object"==typeof e&&null!==e&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function a(e){return null===e||i(e)||"object"!=typeof e&&"function"!=typeof e}function c(e){return n(e,"Object")}function u(e){return"undefined"!=typeof Event&&h(e,Event)}function l(e){return Boolean(e&&e.then&&"function"==typeof e.then)}function h(e,t){try{return e instanceof t}catch(n){return!1}}function d(e){return!("object"!=typeof e||null===e||!e.__isVue&&!e._isVue)}function p(e,t=0){return"string"!=typeof e||0===t||e.length<=t?e:`${e.slice(0,t)}...`}function f(e,t){if(!Array.isArray(e))return"";const n=[];for(let s=0;s<e.length;s++){const t=e[s];try{d(t)?n.push("[VueViewModel]"):n.push(String(t))}catch(r){n.push("[value cannot be serialized]")}}return n.join(t)}function g(e,t,r=!1){return!!o(e)&&(n(t,"RegExp")?t.test(e):!!o(t)&&(r?e===t:e.includes(t)))}function _(e,t=[],n=!1){return t.some((t=>g(e,t,n)))}function m(e,t,n=250,r,s,o,i){if(!(o.exception&&o.exception.values&&i&&h(i.originalException,Error)))return;const a=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;var c,u;a&&(o.exception.values=(c=y(e,t,s,i.originalException,r,o.exception.values,a,0),u=n,c.map((e=>(e.value&&(e.value=p(e.value,u)),e)))))}function y(e,t,n,r,s,o,i,a){if(o.length>=n+1)return o;let c=[...o];if(h(r[s],Error)){v(i,a);const o=e(t,r[s]),u=c.length;b(o,s,u,a),c=y(e,t,n,r[s],s,[o,...c],o,u)}return Array.isArray(r.errors)&&r.errors.forEach(((r,o)=>{if(h(r,Error)){v(i,a);const u=e(t,r),l=c.length;b(u,`errors[${o}]`,l,a),c=y(e,t,n,r,s,[u,...c],u,l)}})),c}function v(e,t){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism=__spreadProps(__spreadValues(__spreadValues({},e.mechanism),"AggregateError"===e.type&&{is_exception_group:!0}),{exception_id:t})}function b(e,t,n,r){e.mechanism=e.mechanism||{type:"generic",handled:!0},e.mechanism=__spreadProps(__spreadValues({},e.mechanism),{type:"chained",source:t,exception_id:n,parent_id:r})}function E(e){return e&&e.Math==Math?e:void 0}const S="object"==typeof globalThis&&E(globalThis)||"object"==typeof window&&E(window)||"object"==typeof self&&E(self)||"object"==typeof global&&E(global)||function(){return this}()||{};function w(){return S}function k(e,t,n){const r=n||S,s=r.__SENTRY__=r.__SENTRY__||{};return s[e]||(s[e]=t())}const x=w();function T(e,t={}){if(!e)return"<unknown>";try{let n=e;const r=5,s=[];let o=0,i=0;const a=" > ",c=a.length;let u;const l=Array.isArray(t)?t:t.keyAttrs,h=!Array.isArray(t)&&t.maxStringLength||80;for(;n&&o++<r&&(u=C(n,l),!("html"===u||o>1&&i+s.length*c+u.length>=h));)s.push(u),i+=u.length,n=n.parentNode;return s.reverse().join(a)}catch(n){return"<unknown>"}}function C(e,t){const n=e,r=[];let s,i,a,c,u;if(!n||!n.tagName)return"";if(x.HTMLElement&&n instanceof HTMLElement&&n.dataset&&n.dataset.sentryComponent)return n.dataset.sentryComponent;r.push(n.tagName.toLowerCase());const l=t&&t.length?t.filter((e=>n.getAttribute(e))).map((e=>[e,n.getAttribute(e)])):null;if(l&&l.length)l.forEach((e=>{r.push(`[${e[0]}="${e[1]}"]`)}));else if(n.id&&r.push(`#${n.id}`),s=n.className,s&&o(s))for(i=s.split(/\s+/),u=0;u<i.length;u++)r.push(`.${i[u]}`);const h=["aria-label","type","name","title","alt"];for(u=0;u<h.length;u++)a=h[u],c=n.getAttribute(a),c&&r.push(`[${a}="${c}"]`);return r.join("")}const $="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,O=["debug","info","warn","error","log","assert","trace"],R={};function P(e){if(!("console"in S))return e();const t=S.console,n={},r=Object.keys(R);r.forEach((e=>{const r=R[e];n[e]=t[e],t[e]=r}));try{return e()}finally{r.forEach((e=>{t[e]=n[e]}))}}const I=function(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return $?O.forEach((n=>{t[n]=(...t)=>{e&&P((()=>{S.console[n](`Sentry Logger [${n}]:`,...t)}))}})):O.forEach((e=>{t[e]=()=>{}})),t}(),j=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function N(e,t=!1){const{host:n,path:r,pass:s,port:o,projectId:i,protocol:a,publicKey:c}=e;return`${a}://${c}${t&&s?`:${s}`:""}@${n}${o?`:${o}`:""}/${r?`${r}/`:r}${i}`}function D(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function A(e){const t="string"==typeof e?function(e){const t=j.exec(e);if(!t)return void P((()=>{console.error(`Invalid Sentry Dsn: ${e}`)}));const[n,r,s="",o,i="",a]=t.slice(1);let c="",u=a;const l=u.split("/");if(l.length>1&&(c=l.slice(0,-1).join("/"),u=l.pop()),u){const e=u.match(/^\d+/);e&&(u=e[0])}return D({host:o,pass:s,path:c,projectId:u,port:i,protocol:n,publicKey:r})}(e):D(e);if(t&&function(e){if(!$)return!0;const{port:t,projectId:n,protocol:r}=e;return!(["protocol","publicKey","host","projectId"].find((t=>!e[t]&&(I.error(`Invalid Sentry Dsn: ${t} missing`),!0)))||(n.match(/^\d+$/)?function(e){return"http"===e||"https"===e}(r)?t&&isNaN(parseInt(t,10))&&(I.error(`Invalid Sentry Dsn: Invalid port ${t}`),1):(I.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),1):(I.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),1)))}(t))return t}class L extends Error{constructor(e,t="warn"){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=t}}function V(e,t,n){if(!(t in e))return;const r=e[t],s=n(r);"function"==typeof s&&U(s,r),e[t]=s}function M(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch(r){$&&I.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function U(e,t){try{const n=t.prototype||{};e.prototype=t.prototype=n,M(e,"__sentry_original__",t)}catch(n){}}function H(e){return e.__sentry_original__}function q(e){if(t(e))return __spreadValues({message:e.message,name:e.name,stack:e.stack},F(e));if(u(e)){const t=__spreadValues({type:e.type,target:B(e.target),currentTarget:B(e.currentTarget)},F(e));return"undefined"!=typeof CustomEvent&&h(e,CustomEvent)&&(t.detail=e.detail),t}return e}function B(e){try{return t=e,"undefined"!=typeof Element&&h(t,Element)?T(e):Object.prototype.toString.call(e)}catch(n){return"<unknown>"}var t}function F(e){if("object"==typeof e&&null!==e){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}return{}}function J(e){return W(e,new Map)}function W(e,t){if(function(e){if(!c(e))return!1;try{const t=Object.getPrototypeOf(e).constructor.name;return!t||"Object"===t}catch(t){return!0}}(e)){const n=t.get(e);if(void 0!==n)return n;const r={};t.set(e,r);for(const s of Object.keys(e))void 0!==e[s]&&(r[s]=W(e[s],t));return r}if(Array.isArray(e)){const n=t.get(e);if(void 0!==n)return n;const r=[];return t.set(e,r),e.forEach((e=>{r.push(W(e,t))})),r}return e}const z=/\(error: (.*)\)/,Y=/captureMessage|captureException/;function G(...e){const t=e.sort(((e,t)=>e[0]-t[0])).map((e=>e[1]));return(e,n=0)=>{const r=[],s=e.split("\n");for(let o=n;o<s.length;o++){const e=s[o];if(e.length>1024)continue;const n=z.test(e)?e.replace(z,"$1"):e;if(!n.match(/\S*Error: /)){for(const e of t){const t=e(n);if(t){r.push(t);break}}if(r.length>=50)break}}return function(e){if(!e.length)return[];const t=Array.from(e);/sentryWrapped/.test(t[t.length-1].function||"")&&t.pop();t.reverse(),Y.test(t[t.length-1].function||"")&&(t.pop(),Y.test(t[t.length-1].function||"")&&t.pop());return t.slice(0,50).map((e=>__spreadProps(__spreadValues({},e),{filename:e.filename||t[t.length-1].filename,function:e.function||"?"})))}(r)}}const X="<anonymous>";function K(e){try{return e&&"function"==typeof e&&e.name||X}catch(t){return X}}const Z={},Q={};function ee(e,t){Z[e]=Z[e]||[],Z[e].push(t)}function te(e,t){Q[e]||(t(),Q[e]=!0)}function ne(e,t){const n=e&&Z[e];if(n)for(const s of n)try{s(t)}catch(r){$&&I.error(`Error while triggering instrumentation handler.\nType: ${e}\nName: ${K(s)}\nError:`,r)}}function re(){"console"in S&&O.forEach((function(e){e in S.console&&V(S.console,e,(function(t){return R[e]=t,function(...t){ne("console",{args:t,level:e});const n=R[e];n&&n.apply(S.console,t)}}))}))}function se(){const e=S,t=e.crypto||e.msCrypto;let n=()=>16*Math.random();try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(n=()=>{const e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch(r){}return"10000000100040008000100000000000".replace(/[018]/g,(e=>(e^(15&n())>>e/4).toString(16)))}function oe(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function ie(e){const{message:t,event_id:n}=e;if(t)return t;const r=oe(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function ae(e,t,n){const r=e.exception=e.exception||{},s=r.values=r.values||[],o=s[0]=s[0]||{};o.value||(o.value=t||""),o.type||(o.type="Error")}function ce(e,t){const n=oe(e);if(!n)return;const r=n.mechanism;if(n.mechanism=__spreadValues(__spreadValues(__spreadValues({},{type:"generic",handled:!0}),r),t),t&&"data"in t){const e=__spreadValues(__spreadValues({},r&&r.data),t.data);n.mechanism.data=e}}function ue(e){if(e&&e.__sentry_captured__)return!0;try{M(e,"__sentry_captured__",!0)}catch(t){}return!1}function le(e){return Array.isArray(e)?e:[e]}const he=S;let de,pe,fe;function ge(){if(!he.document)return;const e=ne.bind(null,"dom"),t=_e(e,!0);he.document.addEventListener("click",t,!1),he.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach((t=>{const n=he[t]&&he[t].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(V(n,"addEventListener",(function(t){return function(n,r,s){if("click"===n||"keypress"==n)try{const r=this,o=r.__sentry_instrumentation_handlers__=r.__sentry_instrumentation_handlers__||{},i=o[n]=o[n]||{refCount:0};if(!i.handler){const r=_e(e);i.handler=r,t.call(this,n,r,s)}i.refCount++}catch(o){}return t.call(this,n,r,s)}})),V(n,"removeEventListener",(function(e){return function(t,n,r){if("click"===t||"keypress"==t)try{const n=this,s=n.__sentry_instrumentation_handlers__||{},o=s[t];o&&(o.refCount--,o.refCount<=0&&(e.call(this,t,o.handler,r),o.handler=void 0,delete s[t]),0===Object.keys(s).length&&delete n.__sentry_instrumentation_handlers__)}catch(s){}return e.call(this,t,n,r)}})))}))}function _e(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;const r=function(e){try{return e.target}catch(t){return null}}(n);if(function(e,t){return"keypress"===e&&(!t||!t.tagName||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&!t.isContentEditable)}(n.type,r))return;M(n,"_sentryCaptured",!0),r&&!r._sentryId&&M(r,"_sentryId",se());const s="keypress"===n.type?"input":n.type;if(!function(e){if(e.type!==pe)return!1;try{if(!e.target||e.target._sentryId!==fe)return!1}catch(t){}return!0}(n)){e({event:n,name:s,global:t}),pe=n.type,fe=r?r._sentryId:void 0}clearTimeout(de),de=he.setTimeout((()=>{fe=void 0,pe=void 0}),1e3)}}const me=w();function ye(){if(!("fetch"in me))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch(e){return!1}}function ve(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function be(){(function(){if("string"==typeof EdgeRuntime)return!0;if(!ye())return!1;if(ve(me.fetch))return!0;let e=!1;const t=me.document;if(t&&"function"==typeof t.createElement)try{const n=t.createElement("iframe");n.hidden=!0,t.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(e=ve(n.contentWindow.fetch)),t.head.removeChild(n)}catch(n){$&&I.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return e})()&&V(S,"fetch",(function(e){return function(...t){const{method:n,url:r}=function(e){if(0===e.length)return{method:"GET",url:""};if(2===e.length){const[t,n]=e;return{url:Se(t),method:Ee(n,"method")?String(n.method).toUpperCase():"GET"}}const t=e[0];return{url:Se(t),method:Ee(t,"method")?String(t.method).toUpperCase():"GET"}}(t),s={args:t,fetchData:{method:n,url:r},startTimestamp:Date.now()};return ne("fetch",__spreadValues({},s)),e.apply(S,t).then((e=>(ne("fetch",__spreadProps(__spreadValues({},s),{endTimestamp:Date.now(),response:e})),e)),(e=>{throw ne("fetch",__spreadProps(__spreadValues({},s),{endTimestamp:Date.now(),error:e})),e}))}}))}function Ee(e,t){return!!e&&"object"==typeof e&&!!e[t]}function Se(e){return"string"==typeof e?e:e?Ee(e,"url")?e.url:e.toString?e.toString():"":""}let we=null;function ke(){we=S.onerror,S.onerror=function(e,t,n,r,s){return ne("error",{column:r,error:s,line:n,msg:e,url:t}),!(!we||we.__SENTRY_LOADER__)&&we.apply(this,arguments)},S.onerror.__SENTRY_INSTRUMENTED__=!0}let xe=null;function Te(){xe=S.onunhandledrejection,S.onunhandledrejection=function(e){return ne("unhandledrejection",e),!(xe&&!xe.__SENTRY_LOADER__)||xe.apply(this,arguments)},S.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Ce=w();const $e=S;let Oe;function Re(e){const t="history";ee(t,e),te(t,Pe)}function Pe(){if(!function(){const e=Ce.chrome,t=e&&e.app&&e.app.runtime,n="history"in Ce&&!!Ce.history.pushState&&!!Ce.history.replaceState;return!t&&n}())return;const e=$e.onpopstate;function t(e){return function(...t){const n=t.length>2?t[2]:void 0;if(n){const e=Oe,t=String(n);Oe=t;ne("history",{from:e,to:t})}return e.apply(this,t)}}$e.onpopstate=function(...t){const n=$e.location.href,r=Oe;Oe=n;if(ne("history",{from:r,to:n}),e)try{return e.apply(this,t)}catch(s){}},V($e.history,"pushState",t),V($e.history,"replaceState",t)}const Ie=S,je="__sentry_xhr_v3__";function Ne(){if(!Ie.XMLHttpRequest)return;const e=XMLHttpRequest.prototype;V(e,"open",(function(e){return function(...t){const n=Date.now(),r=o(t[0])?t[0].toUpperCase():void 0,s=function(e){if(o(e))return e;try{return e.toString()}catch(t){}return}(t[1]);if(!r||!s)return e.apply(this,t);this[je]={method:r,url:s,request_headers:{}},"POST"===r&&s.match(/sentry_key/)&&(this.__sentry_own_request__=!0);const i=()=>{const e=this[je];if(e&&4===this.readyState){try{e.status_code=this.status}catch(t){}ne("xhr",{args:[r,s],endTimestamp:Date.now(),startTimestamp:n,xhr:this})}};return"onreadystatechange"in this&&"function"==typeof this.onreadystatechange?V(this,"onreadystatechange",(function(e){return function(...t){return i(),e.apply(this,t)}})):this.addEventListener("readystatechange",i),V(this,"setRequestHeader",(function(e){return function(...t){const[n,r]=t,s=this[je];return s&&o(n)&&o(r)&&(s.request_headers[n.toLowerCase()]=r),e.apply(this,t)}})),e.apply(this,t)}})),V(e,"send",(function(e){return function(...t){const n=this[je];if(!n)return e.apply(this,t);void 0!==t[0]&&(n.body=t[0]);return ne("xhr",{args:[n.method,n.url],startTimestamp:Date.now(),xhr:this}),e.apply(this,t)}}))}function De(e,t=100,n=1/0){try{return Le("",e,t,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function Ae(e,t=3,n=102400){const r=De(e,t);return s=r,function(e){return~-encodeURI(e).split(/%..|./).length}(JSON.stringify(s))>n?Ae(e,t-1,n):r;var s}function Le(e,t,n=1/0,r=1/0,s=function(){const e="function"==typeof WeakSet,t=e?new WeakSet:[];return[function(n){if(e)return!!t.has(n)||(t.add(n),!1);for(let e=0;e<t.length;e++)if(t[e]===n)return!0;return t.push(n),!1},function(n){if(e)t.delete(n);else for(let e=0;e<t.length;e++)if(t[e]===n){t.splice(e,1);break}}]}()){const[o,i]=s;if(null==t||["number","boolean","string"].includes(typeof t)&&("number"!=typeof(a=t)||a==a))return t;var a;const u=function(e,t){try{if("domain"===e&&t&&"object"==typeof t&&t._events)return"[Domain]";if("domainEmitter"===e)return"[DomainEmitter]";if("undefined"!=typeof global&&t===global)return"[Global]";if("undefined"!=typeof window&&t===window)return"[Window]";if("undefined"!=typeof document&&t===document)return"[Document]";if(d(t))return"[VueViewModel]";if(function(e){return c(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}(t))return"[SyntheticEvent]";if("number"==typeof t&&t!=t)return"[NaN]";if("function"==typeof t)return`[Function: ${K(t)}]`;if("symbol"==typeof t)return`[${String(t)}]`;if("bigint"==typeof t)return`[BigInt: ${String(t)}]`;const n=function(e){const t=Object.getPrototypeOf(e);return t?t.constructor.name:"null prototype"}(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}(e,t);if(!u.startsWith("[object "))return u;if(t.__sentry_skip_normalization__)return t;const l="number"==typeof t.__sentry_override_normalization_depth__?t.__sentry_override_normalization_depth__:n;if(0===l)return u.replace("object ","");if(o(t))return"[Circular ~]";const h=t;if(h&&"function"==typeof h.toJSON)try{return Le("",h.toJSON(),l-1,r,s)}catch(_){}const p=Array.isArray(t)?[]:{};let f=0;const g=q(t);for(const c in g){if(!Object.prototype.hasOwnProperty.call(g,c))continue;if(f>=r){p[c]="[MaxProperties ~]";break}const e=g[c];p[c]=Le(c,e,l-1,r,s),f++}return i(t),p}var Ve;function Me(e){return new He((t=>{t(e)}))}function Ue(e){return new He(((t,n)=>{n(e)}))}!function(e){e[e.PENDING=0]="PENDING";e[e.RESOLVED=1]="RESOLVED";e[e.REJECTED=2]="REJECTED"}(Ve||(Ve={}));class He{constructor(e){He.prototype.__init.call(this),He.prototype.__init2.call(this),He.prototype.__init3.call(this),He.prototype.__init4.call(this),this._state=Ve.PENDING,this._handlers=[];try{e(this._resolve,this._reject)}catch(t){this._reject(t)}}then(e,t){return new He(((n,r)=>{this._handlers.push([!1,t=>{if(e)try{n(e(t))}catch(s){r(s)}else n(t)},e=>{if(t)try{n(t(e))}catch(s){r(s)}else r(e)}]),this._executeHandlers()}))}catch(e){return this.then((e=>e),e)}finally(e){return new He(((t,n)=>{let r,s;return this.then((t=>{s=!1,r=t,e&&e()}),(t=>{s=!0,r=t,e&&e()})).then((()=>{s?n(r):t(r)}))}))}__init(){this._resolve=e=>{this._setResult(Ve.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(Ve.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{this._state===Ve.PENDING&&(l(t)?t.then(this._resolve,this._reject):(this._state=e,this._value=t,this._executeHandlers()))}}__init4(){this._executeHandlers=()=>{if(this._state===Ve.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach((e=>{e[0]||(this._state===Ve.RESOLVED&&e[1](this._value),this._state===Ve.REJECTED&&e[2](this._value),e[0]=!0)}))}}}function qe(e){const t=[];function n(e){return t.splice(t.indexOf(e),1)[0]}return{$:t,add:function(r){if(!(void 0===e||t.length<e))return Ue(new L("Not adding Promise because buffer limit was reached."));const s=r();return-1===t.indexOf(s)&&t.push(s),s.then((()=>n(s))).then(null,(()=>n(s).then(null,(()=>{})))),s},drain:function(e){return new He(((n,r)=>{let s=t.length;if(!s)return n(!0);const o=setTimeout((()=>{e&&e>0&&n(!1)}),e);t.forEach((e=>{Me(e).then((()=>{--s||(clearTimeout(o),n(!0))}),r)}))}))}}}function Be(e){if(!e)return{};const t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const n=t[6]||"",r=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}const Fe=["fatal","error","warning","log","info","debug"];function Je(e){return"warn"===e?"warning":Fe.includes(e)?e:"log"}function We(){return Date.now()/1e3}const ze=function(){const{performance:e}=S;if(!e||!e.now)return We;const t=Date.now()-e.now(),n=null==e.timeOrigin?t:e.timeOrigin;return()=>(n+e.now())/1e3}();function Ye(e,t=[]){return[e,t]}function Ge(e,t){const[n,r]=e;return[n,[...r,t]]}function Xe(e,t){const n=e[1];for(const r of n){if(t(r,r[0].type))return!0}return!1}function Ke(e,t){return(t||new TextEncoder).encode(e)}function Ze(e,t){const[n,r]=e;let s=JSON.stringify(n);function o(e){"string"==typeof s?s="string"==typeof e?s+e:[Ke(s,t),e]:s.push("string"==typeof e?Ke(e,t):e)}for(const a of r){const[e,t]=a;if(o(`\n${JSON.stringify(e)}\n`),"string"==typeof t||t instanceof Uint8Array)o(t);else{let e;try{e=JSON.stringify(t)}catch(i){e=JSON.stringify(De(t))}o(e)}}return"string"==typeof s?s:function(e){const t=e.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(t);let r=0;for(const s of e)n.set(s,r),r+=s.length;return n}(s)}function Qe(e,t){const n="string"==typeof e.data?Ke(e.data,t):e.data;return[J({type:"attachment",length:n.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType}),n]}(()=>{const{performance:e}=S;if(!e||!e.now)return;const t=36e5,n=e.now(),r=Date.now(),s=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,o=s<t,i=e.timing&&e.timing.navigationStart,a="number"==typeof i?Math.abs(i+n-r):t;(o||a<t)&&(s<=a&&e.timeOrigin)})();const et={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",statsd:"metric_bucket"};function tt(e){return et[e]}function nt(e){if(!e||!e.sdk)return;const{name:t,version:n}=e.sdk;return{name:t,version:n}}function rt(e,{statusCode:t,headers:n},r=Date.now()){const s=__spreadValues({},e),o=n&&n["x-sentry-rate-limits"],i=n&&n["retry-after"];if(o)for(const a of o.trim().split(",")){const[e,t,,,n]=a.split(":",5),o=parseInt(e,10),i=1e3*(isNaN(o)?60:o);if(t)for(const a of t.split(";"))"metric_bucket"===a&&n&&!n.split(";").includes("custom")||(s[a]=r+i);else s.all=r+i}else i?s.all=r+function(e,t=Date.now()){const n=parseInt(`${e}`,10);if(!isNaN(n))return 1e3*n;const r=Date.parse(`${e}`);return isNaN(r)?6e4:r-t}(i,r):429===t&&(s.all=r+6e4);return s}const st="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__,ot="production";function it(){return k("globalEventProcessors",(()=>[]))}function at(e){it().push(e)}function ct(e,t,n,r=0){return new He(((s,o)=>{const i=e[r];if(null===t||"function"!=typeof i)s(t);else{const a=i(__spreadValues({},t),n);st&&i.id&&null===a&&I.log(`Event processor "${i.id}" dropped event`),l(a)?a.then((t=>ct(e,t,n,r+1).then(s))).then(null,o):ct(e,a,n,r+1).then(s).then(null,o)}}))}function ut(e){const t=ze(),n={sid:se(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(e){return J({sid:`${e.sid}`,init:e.init,started:new Date(1e3*e.started).toISOString(),timestamp:new Date(1e3*e.timestamp).toISOString(),status:e.status,errors:e.errors,did:"number"==typeof e.did||"string"==typeof e.did?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}(n)};return e&&lt(n,e),n}function lt(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),e.did||t.did||(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||ze(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=32===t.sid.length?t.sid:se()),void 0!==t.init&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),"number"==typeof t.started&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if("number"==typeof t.duration)e.duration=t.duration;else{const t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),"number"==typeof t.errors&&(e.errors=t.errors),t.status&&(e.status=t.status)}function ht(e,t){let n={};"ok"===e.status&&(n={status:"exited"}),lt(e,n)}function dt(e){const{spanId:t,traceId:n}=e.spanContext(),{data:r,op:s,parent_span_id:o,status:i,tags:a,origin:c}=pt(e);return J({data:r,op:s,parent_span_id:o,span_id:t,status:i,tags:a,trace_id:n,origin:c})}function pt(e){return function(e){return"function"==typeof e.getSpanJSON}(e)?e.getSpanJSON():"function"==typeof e.toJSON?e.toJSON():{}}function ft(e,t,n,r,s,o){const{normalizeDepth:i=3,normalizeMaxBreadth:a=1e3}=e,c=__spreadProps(__spreadValues({},t),{event_id:t.event_id||n.event_id||se(),timestamp:t.timestamp||We()}),u=n.integrations||e.integrations.map((e=>e.name));!function(e,t){const{environment:n,release:r,dist:s,maxValueLength:o=250}=t;"environment"in e||(e.environment="environment"in t?n:ot);void 0===e.release&&void 0!==r&&(e.release=r);void 0===e.dist&&void 0!==s&&(e.dist=s);e.message&&(e.message=p(e.message,o));const i=e.exception&&e.exception.values&&e.exception.values[0];i&&i.value&&(i.value=p(i.value,o));const a=e.request;a&&a.url&&(a.url=p(a.url,o))}(c,e),function(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}(c,u),void 0===t.type&&function(e,t){const n=S._sentryDebugIds;if(!n)return;let r;const s=gt.get(t);s?r=s:(r=new Map,gt.set(t,r));const o=Object.keys(n).reduce(((e,s)=>{let o;const i=r.get(s);i?o=i:(o=t(s),r.set(s,o));for(let t=o.length-1;t>=0;t--){const r=o[t];if(r.filename){e[r.filename]=n[s];break}}return e}),{});try{e.exception.values.forEach((e=>{e.stacktrace.frames.forEach((e=>{e.filename&&(e.debug_id=o[e.filename])}))}))}catch(i){}}(c,e.stackParser);const l=function(e,t){if(!t)return e;const n=e?e.clone():new Nt;return n.update(t),n}(r,n.captureContext);n.mechanism&&ce(c,n.mechanism);const h=s&&s.getEventProcessors?s.getEventProcessors():[],d=function(){jt||(jt=new Nt);return jt}().getScopeData();if(o){Pt(d,o.getScopeData())}if(l){Pt(d,l.getScopeData())}const f=[...n.attachments||[],...d.attachments];f.length&&(n.attachments=f),Rt(c,d);return ct([...h,...it(),...d.eventProcessors],c,n).then((e=>(e&&function(e){const t={};try{e.exception.values.forEach((e=>{e.stacktrace.frames.forEach((e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)}))}))}catch(r){}if(0===Object.keys(t).length)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const n=e.debug_meta.images;Object.keys(t).forEach((e=>{n.push({type:"sourcemap",code_file:e,debug_id:t[e]})}))}(e),"number"==typeof i&&i>0?function(e,t,n){if(!e)return null;const r=__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({},e),e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map((e=>__spreadValues(__spreadValues({},e),e.data&&{data:De(e.data,t,n)})))}),e.user&&{user:De(e.user,t,n)}),e.contexts&&{contexts:De(e.contexts,t,n)}),e.extra&&{extra:De(e.extra,t,n)});e.contexts&&e.contexts.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=De(e.contexts.trace.data,t,n)));e.spans&&(r.spans=e.spans.map((e=>{const r=pt(e).data;return r&&(e.data=De(r,t,n)),e})));return r}(e,i,a):e)))}const gt=new WeakMap;function _t(e){if(e)return function(e){return e instanceof Nt||"function"==typeof e}(e)||function(e){return Object.keys(e).some((e=>mt.includes(e)))}(e)?{captureContext:e}:e}const mt=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function yt(e,t){return qt().captureException(e,_t(t))}function vt(e,t){return qt().captureEvent(e,t)}function bt(e,t){qt().addBreadcrumb(e,t)}function Et(){return qt().getClient()}function St(){return qt().getScope()}function wt(e){const t=Et(),n=Bt(),r=St(),{release:s,environment:o=ot}=t&&t.getOptions()||{},{userAgent:i}=S.navigator||{},a=ut(__spreadValues(__spreadValues({release:s,environment:o,user:r.getUser()||n.getUser()},i&&{userAgent:i}),e)),c=n.getSession();return c&&"ok"===c.status&&lt(c,{status:"exited"}),kt(),n.setSession(a),r.setSession(a),a}function kt(){const e=Bt(),t=St(),n=t.getSession()||e.getSession();n&&ht(n),xt(),e.setSession(),t.setSession()}function xt(){const e=Bt(),t=St(),n=Et(),r=t.getSession()||e.getSession();r&&n&&n.captureSession&&n.captureSession(r)}function Tt(e=!1){e?kt():xt()}function Ct(e){return e.transaction}function $t(e,t,n){const r=t.getOptions(),{publicKey:s}=t.getDsn()||{},{segment:o}=n&&n.getUser()||{},i=J({environment:r.environment||ot,release:r.release,user_segment:o,public_key:s,trace_id:e});return t.emit&&t.emit("createDsc",i),i}function Ot(e){const t=Et();if(!t)return{};const n=$t(pt(e).trace_id||"",t,St()),r=Ct(e);if(!r)return n;const s=r&&r._frozenDynamicSamplingContext;if(s)return s;const{sampleRate:o,source:i}=r.metadata;null!=o&&(n.sample_rate=`${o}`);const a=pt(r);return i&&"url"!==i&&(n.transaction=a.description),n.sampled=String(function(e){const{traceFlags:t}=e.spanContext();return Boolean(1&t)}(r)),t.emit&&t.emit("createDsc",n),n}function Rt(e,t){const{fingerprint:n,span:r,breadcrumbs:s,sdkProcessingMetadata:o}=t;!function(e,t){const{extra:n,tags:r,user:s,contexts:o,level:i,transactionName:a}=t,c=J(n);c&&Object.keys(c).length&&(e.extra=__spreadValues(__spreadValues({},c),e.extra));const u=J(r);u&&Object.keys(u).length&&(e.tags=__spreadValues(__spreadValues({},u),e.tags));const l=J(s);l&&Object.keys(l).length&&(e.user=__spreadValues(__spreadValues({},l),e.user));const h=J(o);h&&Object.keys(h).length&&(e.contexts=__spreadValues(__spreadValues({},h),e.contexts));i&&(e.level=i);a&&(e.transaction=a)}(e,t),r&&function(e,t){e.contexts=__spreadValues({trace:dt(t)},e.contexts);const n=Ct(t);if(n){e.sdkProcessingMetadata=__spreadValues({dynamicSamplingContext:Ot(t)},e.sdkProcessingMetadata);const r=pt(n).description;r&&(e.tags=__spreadValues({transaction:r},e.tags))}}(e,r),function(e,t){e.fingerprint=e.fingerprint?le(e.fingerprint):[],t&&(e.fingerprint=e.fingerprint.concat(t));e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}(e,n),function(e,t){const n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}(e,s),function(e,t){e.sdkProcessingMetadata=__spreadValues(__spreadValues({},e.sdkProcessingMetadata),t)}(e,o)}function Pt(e,t){const{extra:n,tags:r,user:s,contexts:o,level:i,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:u,eventProcessors:l,attachments:h,propagationContext:d,transactionName:p,span:f}=t;It(e,"extra",n),It(e,"tags",r),It(e,"user",s),It(e,"contexts",o),It(e,"sdkProcessingMetadata",a),i&&(e.level=i),p&&(e.transactionName=p),f&&(e.span=f),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),u.length&&(e.fingerprint=[...e.fingerprint,...u]),l.length&&(e.eventProcessors=[...e.eventProcessors,...l]),h.length&&(e.attachments=[...e.attachments,...h]),e.propagationContext=__spreadValues(__spreadValues({},e.propagationContext),d)}function It(e,t,n){if(n&&Object.keys(n).length){e[t]=__spreadValues({},e[t]);for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[t][r]=n[r])}}let jt;class Nt{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=Dt()}static clone(e){return e?e.clone():new Nt}clone(){const e=new Nt;return e._breadcrumbs=[...this._breadcrumbs],e._tags=__spreadValues({},this._tags),e._extra=__spreadValues({},this._extra),e._contexts=__spreadValues({},this._contexts),e._user=this._user,e._level=this._level,e._span=this._span,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=__spreadValues({},this._sdkProcessingMetadata),e._propagationContext=__spreadValues({},this._propagationContext),e._client=this._client,e}setClient(e){this._client=e}getClient(){return this._client}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,segment:void 0,username:void 0},this._session&&lt(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=__spreadValues(__spreadValues({},this._tags),e),this._notifyScopeListeners(),this}setTag(e,t){return this._tags=__spreadProps(__spreadValues({},this._tags),{[e]:t}),this._notifyScopeListeners(),this}setExtras(e){return this._extra=__spreadValues(__spreadValues({},this._extra),e),this._notifyScopeListeners(),this}setExtra(e,t){return this._extra=__spreadProps(__spreadValues({},this._extra),{[e]:t}),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,t){return null===t?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){const e=this._span;return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const t="function"==typeof e?e(this):e;if(t instanceof Nt){const e=t.getScopeData();this._tags=__spreadValues(__spreadValues({},this._tags),e.tags),this._extra=__spreadValues(__spreadValues({},this._extra),e.extra),this._contexts=__spreadValues(__spreadValues({},this._contexts),e.contexts),e.user&&Object.keys(e.user).length&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint.length&&(this._fingerprint=e.fingerprint),t.getRequestSession()&&(this._requestSession=t.getRequestSession()),e.propagationContext&&(this._propagationContext=e.propagationContext)}else if(c(t)){const t=e;this._tags=__spreadValues(__spreadValues({},this._tags),t.tags),this._extra=__spreadValues(__spreadValues({},this._extra),t.extra),this._contexts=__spreadValues(__spreadValues({},this._contexts),t.contexts),t.user&&(this._user=t.user),t.level&&(this._level=t.level),t.fingerprint&&(this._fingerprint=t.fingerprint),t.requestSession&&(this._requestSession=t.requestSession),t.propagationContext&&(this._propagationContext=t.propagationContext)}return 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._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=Dt(),this}addBreadcrumb(e,t){const n="number"==typeof t?t:100;if(n<=0)return this;const r=__spreadValues({timestamp:We()},e),s=this._breadcrumbs;return s.push(r),this._breadcrumbs=s.length>n?s.slice(-n):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}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){const{_breadcrumbs:e,_attachments:t,_contexts:n,_tags:r,_extra:s,_user:o,_level:i,_fingerprint:a,_eventProcessors:c,_propagationContext:u,_sdkProcessingMetadata:l,_transactionName:h,_span:d}=this;return{breadcrumbs:e,attachments:t,contexts:n,tags:r,extra:s,user:o,level:i,fingerprint:a||[],eventProcessors:c,propagationContext:u,sdkProcessingMetadata:l,transactionName:h,span:d}}applyToEvent(e,t={},n=[]){Rt(e,this.getScopeData());return ct([...n,...it(),...this._eventProcessors],e,t)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=__spreadValues(__spreadValues({},this._sdkProcessingMetadata),e),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){const n=t&&t.event_id?t.event_id:se();if(!this._client)return I.warn("No client configured on scope - will not capture exception!"),n;const r=new Error("Sentry syntheticException");return this._client.captureException(e,__spreadProps(__spreadValues({originalException:e,syntheticException:r},t),{event_id:n}),this),n}captureMessage(e,t,n){const r=n&&n.event_id?n.event_id:se();if(!this._client)return I.warn("No client configured on scope - will not capture message!"),r;const s=new Error(e);return this._client.captureMessage(e,t,__spreadProps(__spreadValues({originalException:e,syntheticException:s},n),{event_id:r}),this),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:se();return this._client?(this._client.captureEvent(e,__spreadProps(__spreadValues({},t),{event_id:n}),this),n):(I.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach((e=>{e(this)})),this._notifyingListeners=!1)}}function Dt(){return{traceId:se(),spanId:se().substring(16)}}const At="7.120.0",Lt=parseFloat(At),Vt=100;class Mt{constructor(e,t,n,r=Lt){let s,o;this._version=r,t?s=t:(s=new Nt,s.setClient(e)),n?o=n:(o=new Nt,o.setClient(e)),this._stack=[{scope:s}],e&&this.bindClient(e),this._isolationScope=o}isOlderThan(e){return this._version<e}bindClient(e){const t=this.getStackTop();t.client=e,t.scope.setClient(e),e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){const e=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return!(this.getStack().length<=1)&&!!this.getStack().pop()}withScope(e){const t=this.pushScope();let n;try{n=e(t)}catch(r){throw this.popScope(),r}return l(n)?n.then((e=>(this.popScope(),e)),(e=>{throw this.popScope(),e})):(this.popScope(),n)}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]}captureException(e,t){const n=this._lastEventId=t&&t.event_id?t.event_id:se(),r=new Error("Sentry syntheticException");return this.getScope().captureException(e,__spreadProps(__spreadValues({originalException:e,syntheticException:r},t),{event_id:n})),n}captureMessage(e,t,n){const r=this._lastEventId=n&&n.event_id?n.event_id:se(),s=new Error(e);return this.getScope().captureMessage(e,t,__spreadProps(__spreadValues({originalException:e,syntheticException:s},n),{event_id:r})),r}captureEvent(e,t){const n=t&&t.event_id?t.event_id:se();return e.type||(this._lastEventId=n),this.getScope().captureEvent(e,__spreadProps(__spreadValues({},t),{event_id:n})),n}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){const{scope:n,client:r}=this.getStackTop();if(!r)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:o=Vt}=r.getOptions&&r.getOptions()||{};if(o<=0)return;const i=We(),a=__spreadValues({timestamp:i},e),c=s?P((()=>s(a,t))):a;null!==c&&(r.emit&&r.emit("beforeAddBreadcrumb",c,t),n.addBreadcrumb(c,o))}setUser(e){this.getScope().setUser(e),this.getIsolationScope().setUser(e)}setTags(e){this.getScope().setTags(e),this.getIsolationScope().setTags(e)}setExtras(e){this.getScope().setExtras(e),this.getIsolationScope().setExtras(e)}setTag(e,t){this.getScope().setTag(e,t),this.getIsolationScope().setTag(e,t)}setExtra(e,t){this.getScope().setExtra(e,t),this.getIsolationScope().setExtra(e,t)}setContext(e,t){this.getScope().setContext(e,t),this.getIsolationScope().setContext(e,t)}configureScope(e){const{scope:t,client:n}=this.getStackTop();n&&e(t)}run(e){const t=Ht(this);try{e(this)}finally{Ht(t)}}getIntegration(e){const t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch(n){return st&&I.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){const n=this._callExtensionMethod("startTransaction",e,t);if(st&&!n){this.getClient()?I.warn("Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':\nSentry.addTracingExtensions();\nSentry.init({...});\n"):I.warn("Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'")}return n}traceHeaders(){return this._callExtensionMethod("traceHeaders")}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){const e=this.getStackTop().scope,t=e.getSession();t&&ht(t),this._sendSessionUpdate(),e.setSession()}startSession(e){const{scope:t,client:n}=this.getStackTop(),{release:r,environment:s=ot}=n&&n.getOptions()||{},{userAgent:o}=S.navigator||{},i=ut(__spreadValues(__spreadValues({release:r,environment:s,user:t.getUser()},o&&{userAgent:o}),e)),a=t.getSession&&t.getSession();return a&&"ok"===a.status&&lt(a,{status:"exited"}),this.endSession(),t.setSession(i),i}shouldSendDefaultPii(){const e=this.getClient(),t=e&&e.getOptions();return Boolean(t&&t.sendDefaultPii)}_sendSessionUpdate(){const{scope:e,client:t}=this.getStackTop(),n=e.getSession();n&&t&&t.captureSession&&t.captureSession(n)}_callExtensionMethod(e,...t){const n=Ut().__SENTRY__;if(n&&n.extensions&&"function"==typeof n.extensions[e])return n.extensions[e].apply(this,t);st&&I.warn(`Extension method ${e} couldn't be found, doing nothing.`)}}function Ut(){return S.__SENTRY__=S.__SENTRY__||{extensions:{},hub:void 0},S}function Ht(e){const t=Ut(),n=Ft(t);return Jt(t,e),n}function qt(){const e=Ut();if(e.__SENTRY__&&e.__SENTRY__.acs){const t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return function(e=Ut()){t=e,t&&t.__SENTRY__&&t.__SENTRY__.hub&&!Ft(e).isOlderThan(Lt)||Jt(e,new Mt);var t;return Ft(e)}(e)}function Bt(){return qt().getIsolationScope()}function Ft(e){return k("hub",(()=>new Mt),e)}function Jt(e,t){if(!e)return!1;return(e.__SENTRY__=e.__SENTRY__||{}).hub=t,!0}function Wt(e,t,n,r){const s=nt(n),o=e.type&&"replay_event"!==e.type?e.type:"event";!function(e,t){t&&(e.sdk=e.sdk||{},e.sdk.name=e.sdk.name||t.name,e.sdk.version=e.sdk.version||t.version,e.sdk.integrations=[...e.sdk.integrations||[],...t.integrations||[]],e.sdk.packages=[...e.sdk.packages||[],...t.packages||[]])}(e,n&&n.sdk);const i=function(e,t,n,r){const s=e.sdkProcessingMetadata&&e.sdkProcessingMetadata.dynamicSamplingContext;return __spreadValues(__spreadValues(__spreadValues({event_id:e.event_id,sent_at:(new Date).toISOString()},t&&{sdk:t}),!!n&&r&&{dsn:N(r)}),s&&{trace:J(__spreadValues({},s))})}(e,s,r,t);delete e.sdkProcessingMetadata;return Ye(i,[[{type:o},e]])}function zt(e,t){return n=__spreadValues({sentry_key:e.publicKey,sentry_version:"7"},t&&{sentry_client:`${t.name}/${t.version}`}),Object.keys(n).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(n[e])}`)).join("&");var n}const Yt=[];function Gt(e){const t=e.defaultIntegrations||[],n=e.integrations;let r;t.forEach((e=>{e.isDefaultInstance=!0})),r=Array.isArray(n)?[...t,...n]:"function"==typeof n?le(n(t)):t;const s=function(e){const t={};return e.forEach((e=>{const{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)})),Object.keys(t).map((e=>t[e]))}(r),o=function(e,t){for(let n=0;n<e.length;n++)if(!0===t(e[n]))return n;return-1}(s,(e=>"Debug"===e.name));if(-1!==o){const[e]=s.splice(o,1);s.push(e)}return s}function Xt(e,t){for(const n of t)n&&n.afterAllSetup&&n.afterAllSetup(e)}function Kt(e,t,n){if(n[t.name])st&&I.log(`Integration skipped because it was already installed: ${t.name}`);else{if(n[t.name]=t,-1===Yt.indexOf(t.name)&&(t.setupOnce(at,qt),Yt.push(t.name)),t.setup&&"function"==typeof t.setup&&t.setup(e),e.on&&"function"==typeof t.preprocessEvent){const n=t.preprocessEvent.bind(t);e.on("preprocessEvent",((t,r)=>n(t,r,e)))}if(e.addEventProcessor&&"function"==typeof t.processEvent){const n=t.processEvent.bind(t),r=Object.assign(((t,r)=>n(t,r,e)),{id:t.name});e.addEventProcessor(r)}st&&I.log(`Integration installed: ${t.name}`)}}function Zt(e,t){return Object.assign((function(...e){return t(...e)}),{id:e})}function Qt(e,t,n,r){const s={sent_at:(new Date).toISOString()};n&&n.sdk&&(s.sdk={name:n.sdk.name,version:n.sdk.version}),r&&t&&(s.dsn=N(t));const o=function(e){const t=function(e){let t="";for(const n of e){const e=Object.entries(n.tags),r=e.length>0?`|#${e.map((([e,t])=>`${e}:${t}`)).join(",")}`:"";t+=`${n.name}@${n.unit}:${n.metric}|${n.metricType}${r}|T${n.timestamp}\n`}return t}(e);return[{type:"statsd",length:t.length},t]}(e);return Ye(s,[o])}const en="Not capturing exception because it's already been captured.";class tn{constructor(e){if(this._options=e,this._integrations={},this._integrationsInitialized=!1,this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=A(e.dsn):st&&I.warn("No DSN provided, client will not send events."),this._dsn){const t=function(e,t={}){const n="string"==typeof t?t:t.tunnel,r="string"!=typeof t&&t._metadata?t._metadata.sdk:void 0;return n||`${function(e){return`${function(e){const t=e.protocol?`${e.protocol}:`:"",n=e.port?`:${e.port}`:"";return`${t}//${e.host}${n}${e.path?`/${e.path}`:""}/api/`}(e)}${e.projectId}/envelope/`}(e)}?${zt(e,r)}`}(this._dsn,e);this._transport=e.transport(__spreadProps(__spreadValues({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this)},e.transportOptions),{url:t}))}}captureException(e,t,n){if(ue(e))return void(st&&I.log(en));let r=t&&t.event_id;return this._process(this.eventFromException(e,t).then((e=>this._captureEvent(e,t,n))).then((e=>{r=e}))),r}captureMessage(e,t,n,r){let s=n&&n.event_id;const o=i(e)?e:String(e),c=a(e)?this.eventFromMessage(o,t,n):this.eventFromException(e,n);return this._process(c.then((e=>this._captureEvent(e,n,r))).then((e=>{s=e}))),s}captureEvent(e,t,n){if(t&&t.originalException&&ue(t.originalException))return void(st&&I.log(en));let r=t&&t.event_id;const s=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,t,s||n).then((e=>{r=e}))),r}captureSession(e){"string"!=typeof e.release?st&&I.warn("Discarded session because of missing or non-string release"):(this.sendSession(e),lt(e,{init:!1}))}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const t=this._transport;return t?(this.metricsAggregator&&this.metricsAggregator.flush(),this._isClientDoneProcessing(e).then((n=>t.flush(e).then((e=>n&&e))))):Me(!0)}close(e){return this.flush(e).then((e=>(this.getOptions().enabled=!1,this.metricsAggregator&&this.metricsAggregator.close(),e)))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}setupIntegrations(e){(e&&!this._integrationsInitialized||this._isEnabled()&&!this._integrationsInitialized)&&this._setupIntegrations()}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationById(e){return this.getIntegrationByName(e)}getIntegrationByName(e){return this._integrations[e]}getIntegration(e){try{return this._integrations[e.id]||null}catch(t){return st&&I.warn(`Cannot retrieve integration ${e.id} from the current Client`),null}}addIntegration(e){const t=this._integrations[e.name];Kt(this,e,this._integrations),t||Xt(this,[e])}sendEvent(e,t={}){this.emit("beforeSendEvent",e,t);let n=Wt(e,this._dsn,this._options._metadata,this._options.tunnel);for(const s of t.attachments||[])n=Ge(n,Qe(s,this._options.transportOptions&&this._options.transportOptions.textEncoder));const r=this._sendEnvelope(n);r&&r.then((t=>this.emit("afterSendEvent",e,t)),null)}sendSession(e){const t=function(e,t,n,r){const s=nt(n);return Ye(__spreadValues(__spreadValues({sent_at:(new Date).toISOString()},s&&{sdk:s}),!!r&&t&&{dsn:N(t)}),["aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()]])}(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(t)}recordDroppedEvent(e,t,n){if(this._options.sendClientReports){const r="number"==typeof n?n:1,s=`${e}:${t}`;st&&I.log(`Recording outcome: "${s}"${r>1?` (${r} times)`:""}`),this._outcomes[s]=(this._outcomes[s]||0)+r}}captureAggregateMetrics(e){st&&I.log(`Flushing aggregated metrics, number of metrics: ${e.length}`);const t=Qt(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(t)}on(e,t){this._hooks[e]||(this._hooks[e]=[]),this._hooks[e].push(t)}emit(e,...t){this._hooks[e]&&this._hooks[e].forEach((e=>e(...t)))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=function(e,t){const n={};return t.forEach((t=>{t&&Kt(e,t,n)})),n}(this,e),Xt(this,e),this._integrationsInitialized=!0}_updateSessionFromEvent(e,t){let n=!1,r=!1;const s=t.exception&&t.exception.values;if(s){r=!0;for(const e of s){const t=e.mechanism;if(t&&!1===t.handled){n=!0;break}}}const o="ok"===e.status;(o&&0===e.errors||o&&n)&&(lt(e,__spreadProps(__spreadValues({},n&&{status:"crashed"}),{errors:e.errors||Number(r||n)})),this.captureSession(e))}_isClientDoneProcessing(e){return new He((t=>{let n=0;const r=setInterval((()=>{0==this._numProcessing?(clearInterval(r),t(!0)):(n+=1,e&&n>=e&&(clearInterval(r),t(!1)))}),1)}))}_isEnabled(){return!1!==this.getOptions().enabled&&void 0!==this._transport}_prepareEvent(e,t,n,r=Bt()){const s=this.getOptions(),o=Object.keys(this._integrations);return!t.integrations&&o.length>0&&(t.integrations=o),this.emit("preprocessEvent",e,t),ft(s,e,t,n,this,r).then((e=>{if(null===e)return e;const t=__spreadValues(__spreadValues({},r.getPropagationContext()),n?n.getPropagationContext():void 0);if(!(e.contexts&&e.contexts.trace)&&t){const{traceId:r,spanId:s,parentSpanId:o,dsc:i}=t;e.contexts=__spreadValues({trace:{trace_id:r,span_id:s,parent_span_id:o}},e.contexts);const a=i||$t(r,this,n);e.sdkProcessingMetadata=__spreadValues({dynamicSamplingContext:a},e.sdkProcessingMetadata)}return e}))}_captureEvent(e,t={},n){return this._processEvent(e,t,n).then((e=>e.event_id),(e=>{if(st){const t=e;"log"===t.logLevel?I.log(t.message):I.warn(t)}}))}_processEvent(e,t,n){const r=this.getOptions(),{sampleRate:s}=r,o=rn(e),i=nn(e),a=e.type||"error",u=`before send for type \`${a}\``;if(i&&"number"==typeof s&&Math.random()>s)return this.recordDroppedEvent("sample_rate","error",e),Ue(new L(`Discarding event because it's not included in the random sample (sampling rate = ${s})`,"log"));const h="replay_event"===a?"replay":a,d=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,t,n,d).then((n=>{if(null===n)throw this.recordDroppedEvent("event_processor",h,e),new L("An event processor returned `null`, will not send event.","log");if(t.data&&!0===t.data.__sentry__)return n;const s=function(e,t,n){const{beforeSend:r,beforeSendTransaction:s}=e;if(nn(t)&&r)return r(t,n);if(rn(t)&&s){if(t.spans){const e=t.spans.length;t.sdkProcessingMetadata=__spreadProps(__spreadValues({},t.sdkProcessingMetadata),{spanCountBeforeProcessing:e})}return s(t,n)}return t}(r,n,t);return function(e,t){const n=`${t} must return \`null\` or a valid event.`;if(l(e))return e.then((e=>{if(!c(e)&&null!==e)throw new L(n);return e}),(e=>{throw new L(`${t} rejected with ${e}`)}));if(!c(e)&&null!==e)throw new L(n);return e}(s,u)})).then((r=>{if(null===r){if(this.recordDroppedEvent("before_send",h,e),o){const t=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",t)}throw new L(`${u} returned \`null\`, will not send event.`,"log")}const s=n&&n.getSession();if(!o&&s&&this._updateSessionFromEvent(s,r),o){const e=(r.sdkProcessingMetadata&&r.sdkProcessingMetadata.spanCountBeforeProcessing||0)-(r.spans?r.spans.length:0);e>0&&this.recordDroppedEvent("before_send","span",e)}const i=r.transaction_info;if(o&&i&&r.transaction!==e.transaction){const e="custom";r.transaction_info=__spreadProps(__spreadValues({},i),{source:e})}return this.sendEvent(r,t),r})).then(null,(e=>{if(e instanceof L)throw e;throw this.captureException(e,{data:{__sentry__:!0},originalException:e}),new L(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${e}`)}))}_process(e){this._numProcessing++,e.then((e=>(this._numProcessing--,e)),(e=>(this._numProcessing--,e)))}_sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)return this._transport.send(e).then(null,(e=>{st&&I.error("Error while sending event:",e)}));st&&I.error("Transport disabled")}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.keys(e).map((t=>{const[n,r]=t.split(":");return{reason:n,category:r,quantity:e[t]}}))}}function nn(e){return void 0===e.type}function rn(e){return"transaction"===e.type}function sn(e,t){!0===t.debug&&(st?I.enable():P((()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})));St().update(t.initialScope);const n=new e(t);!function(e){const t=qt().getStackTop();t.client=e,t.scope.setClient(e)}(n),function(e){e.init?e.init():e.setupIntegrations&&e.setupIntegrations()}(n)}function on(e,t,n=qe(e.bufferSize||30)){let r={};function s(s){const o=[];if(Xe(s,((t,n)=>{const s=tt(n);if(function(e,t,n=Date.now()){return function(e,t){return e[t]||e.all||0}(e,t)>n}(r,s)){const r=an(t,n);e.recordDroppedEvent("ratelimit_backoff",s,r)}else o.push(t)})),0===o.length)return Me();const i=Ye(s[0],o),a=t=>{Xe(i,((n,r)=>{const s=an(n,r);e.recordDroppedEvent(t,tt(r),s)}))};return n.add((()=>t({body:Ze(i,e.textEncoder)}).then((e=>(void 0!==e.statusCode&&(e.statusCode<200||e.statusCode>=300)&&st&&I.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=rt(r,e),e)),(e=>{throw a("network_error"),e})))).then((e=>e),(e=>{if(e instanceof L)return st&&I.error("Skipped sending event because buffer is full."),a("queue_overflow"),Me();throw e}))}return s.__sentry__baseTransport__=!0,{send:s,flush:e=>n.drain(e)}}function an(e,t){if("event"===t||"transaction"===t)return Array.isArray(e)?e[1]:void 0}const cn=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/],un=[/^.*\/healthcheck$/,/^.*\/healthy$/,/^.*\/live$/,/^.*\/ready$/,/^.*\/heartbeat$/,/^.*\/health$/,/^.*\/healthz$/],ln="InboundFilters",hn=(e={})=>({name:ln,setupOnce(){},processEvent(t,n,r){const s=r.getOptions(),o=function(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:cn],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[],...e.disableTransactionDefaults?[]:un],ignoreInternal:void 0===e.ignoreInternal||e.ignoreInternal}}(e,s);return function(e,t){if(t.ignoreInternal&&function(e){try{return"SentryError"===e.exception.values[0].type}catch(t){}return!1}(e))return st&&I.warn(`Event dropped due to being internal Sentry Error.\nEvent: ${ie(e)}`),!0;if(function(e,t){if(e.type||!t||!t.length)return!1;return function(e){const t=[];e.message&&t.push(e.message);let n;try{n=e.exception.values[e.exception.values.length-1]}catch(r){}n&&n.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`));st&&0===t.length&&I.error(`Could not extract message for event ${ie(e)}`);return t}(e).some((e=>_(e,t)))}(e,t.ignoreErrors))return st&&I.warn(`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${ie(e)}`),!0;if(function(e,t){if("transaction"!==e.type||!t||!t.length)return!1;const n=e.transaction;return!!n&&_(n,t)}(e,t.ignoreTransactions))return st&&I.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${ie(e)}`),!0;if(function(e,t){if(!t||!t.length)return!1;const n=dn(e);return!!n&&_(n,t)}(e,t.denyUrls))return st&&I.warn(`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${ie(e)}.\nUrl: ${dn(e)}`),!0;if(!function(e,t){if(!t||!t.length)return!0;const n=dn(e);return!n||_(n,t)}(e,t.allowUrls))return st&&I.warn(`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${ie(e)}.\nUrl: ${dn(e)}`),!0;return!1}(t,o)?null:t}});function dn(e){try{let n;try{n=e.exception.values[0].stacktrace.frames}catch(t){}return n?function(e=[]){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n&&"<anonymous>"!==n.filename&&"[native code]"!==n.filename)return n.filename||null}return null}(n):null}catch(n){return st&&I.error(`Cannot extract url for event ${ie(e)}`),null}}let pn;Zt(ln,hn);const fn="FunctionToString",gn=new WeakMap,_n=()=>({name:fn,setupOnce(){pn=Function.prototype.toString;try{Function.prototype.toString=function(...e){const t=H(this),n=gn.has(Et())&&void 0!==t?t:this;return pn.apply(n,e)}}catch(e){}},setup(e){gn.set(e,!0)}});Zt(fn,_n);const mn=S;let yn=0;function vn(){return yn>0}function bn(e,t={},n){if("function"!=typeof e)return e;try{const t=e.__sentry_wrapped__;if(t)return"function"==typeof t?t:e;if(H(e))return e}catch(s){return e}const r=function(){const n=Array.prototype.slice.call(arguments);try{const r=n.map((e=>bn(e,t)));return e.apply(this,r)}catch(r){throw yn++,setTimeout((()=>{yn--})),function(...e){const t=qt();if(2===e.length){const[n,r]=e;return n?t.withScope((()=>(t.getStackTop().scope=n,r(n)))):t.withScope(r)}t.withScope(e[0])}((e=>{e.addEventProcessor((e=>(t.mechanism&&(ae(e,void 0),ce(e,t.mechanism)),e.extra=__spreadProps(__spreadValues({},e.extra),{arguments:n}),e))),yt(r)})),r}};try{for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}catch(o){}U(r,e),M(e,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get:()=>e.name})}catch(o){}return r}const En="undefined"==typeof __SENTRY_DEBUG__||__SENTRY_DEBUG__;function Sn(e,t){const n=kn(e,t),r={type:t&&t.name,value:Tn(t)};return n.length&&(r.stacktrace={frames:n}),void 0===r.type&&""===r.value&&(r.value="Unrecoverable error caught"),r}function wn(e,t){return{exception:{values:[Sn(e,t)]}}}function kn(e,t){const n=t.stacktrace||t.stack||"",r=function(e){if(e){if("number"==typeof e.framesToPop)return e.framesToPop;if(xn.test(e.message))return 1}return 0}(t);try{return e(n,r)}catch(s){}return[]}const xn=/Minified React error #\d+;/i;function Tn(e){const t=e&&e.message;return t?t.error&&"string"==typeof t.error.message?t.error.message:t:"No error message"}function Cn(e,o,i,a,l){let h;if(r(o)&&o.error){return wn(e,o.error)}if(s(o)||n(o,"DOMException")){const t=o;if("stack"in o)h=wn(e,o);else{const n=t.name||(s(t)?"DOMError":"DOMException"),r=t.message?`${n}: ${t.message}`:n;h=$n(e,r,i,a),ae(h,r)}return"code"in t&&(h.tags=__spreadProps(__spreadValues({},h.tags),{"DOMException.code":`${t.code}`})),h}if(t(o))return wn(e,o);if(c(o)||u(o)){return h=function(e,t,n,r){const s=Et(),o=s&&s.getOptions().normalizeDepth,i={exception:{values:[{type:u(t)?t.constructor.name:r?"UnhandledRejection":"Error",value:On(t,{isUnhandledRejection:r})}]},extra:{__serialized__:Ae(t,o)}};if(n){const t=kn(e,n);t.length&&(i.exception.values[0].stacktrace={frames:t})}return i}(e,o,i,l),ce(h,{synthetic:!0}),h}return h=$n(e,o,i,a),ae(h,`${o}`),ce(h,{synthetic:!0}),h}function $n(e,t,n,r){const s={};if(r&&n){const r=kn(e,n);r.length&&(s.exception={values:[{value:t,stacktrace:{frames:r}}]})}if(i(t)){const{__sentry_template_string__:e,__sentry_template_values__:n}=t;return s.logentry={message:e,params:n},s}return s.message=t,s}function On(e,{isUnhandledRejection:t}){const n=function(e,t=40){const n=Object.keys(q(e));if(n.sort(),!n.length)return"[object has no keys]";if(n[0].length>=t)return p(n[0],t);for(let r=n.length;r>0;r--){const e=n.slice(0,r).join(", ");if(!(e.length>t))return r===n.length?e:p(e,t)}return""}(e),s=t?"promise rejection":"exception";if(r(e))return`Event \`ErrorEvent\` captured as ${s} with message \`${e.message}\``;if(u(e)){return`Event \`${function(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(t){}}(e)}\` (type=${e.type}) captured as ${s}`}return`Object captured as ${s} with keys: ${n}`}class Rn extends tn{constructor(e){!function(e,t,n=[t],r="npm"){const s=e._metadata||{};s.sdk||(s.sdk={name:`sentry.javascript.${t}`,packages:n.map((e=>({name:`${r}:@sentry/${e}`,version:At}))),version:At}),e._metadata=s}(e,"browser",["browser"],mn.SENTRY_SDK_SOURCE||"npm"),super(e),e.sendClientReports&&mn.document&&mn.document.addEventListener("visibilitychange",(()=>{"hidden"===mn.document.visibilityState&&this._flushOutcomes()}))}eventFromException(e,t){return function(e,t,n,r){const s=Cn(e,t,n&&n.syntheticException||void 0,r);return ce(s),s.level="error",n&&n.event_id&&(s.event_id=n.event_id),Me(s)}(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t="info",n){return function(e,t,n="info",r,s){const o=$n(e,t,r&&r.syntheticException||void 0,s);return o.level=n,r&&r.event_id&&(o.event_id=r.event_id),Me(o)}(this._options.stackParser,e,t,n,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled())return void(En&&I.warn("SDK not enabled, will not capture user feedback."));const t=function(e,{metadata:t,tunnel:n,dsn:r}){const s=__spreadValues(__spreadValues({event_id:e.event_id,sent_at:(new Date).toISOString()},t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}}),!!n&&!!r&&{dsn:N(r)}),o=function(e){return[{type:"user_report"},e]}(e);return Ye(s,[o])}(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(t)}_prepareEvent(e,t,n){return e.platform=e.platform||"javascript",super._prepareEvent(e,t,n)}_flushOutcomes(){const e=this._clearOutcomes();if(0===e.length)return void(En&&I.log("No outcomes to send"));if(!this._dsn)return void(En&&I.log("No dsn provided, will not send outcomes"));En&&I.log("Sending outcomes:",e);const t=(n=e,Ye((r=this._options.tunnel&&N(this._dsn))?{dsn:r}:{},[[{type:"client_report"},{timestamp:We(),discarded_events:n}]]));var n,r;this._sendEnvelope(t)}}let Pn;function In(e,t=function(){if(Pn)return Pn;if(ve(mn.fetch))return Pn=mn.fetch.bind(mn);const e=mn.document;let t=mn.fetch;if(e&&"function"==typeof e.createElement)try{const n=e.createElement("iframe");n.hidden=!0,e.head.appendChild(n);const r=n.contentWindow;r&&r.fetch&&(t=r.fetch),e.head.removeChild(n)}catch(n){En&&I.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",n)}return Pn=t.bind(mn)}()){let n=0,r=0;return on(e,(function(s){const o=s.body.length;n+=o,r++;const i=__spreadValues({body:s.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:n<=6e4&&r<15},e.fetchOptions);try{return t(e.url,i).then((e=>(n-=o,r--,{statusCode:e.status,headers:{"x-sentry-rate-limits":e.headers.get("X-Sentry-Rate-Limits"),"retry-after":e.headers.get("Retry-After")}})))}catch(a){return Pn=void 0,n-=o,r--,Ue(a)}}))}function jn(e){return on(e,(function(t){return new He(((n,r)=>{const s=new XMLHttpRequest;s.onerror=r,s.onreadystatechange=()=>{4===s.readyState&&n({statusCode:s.status,headers:{"x-sentry-rate-limits":s.getResponseHeader("X-Sentry-Rate-Limits"),"retry-after":s.getResponseHeader("Retry-After")}})},s.open("POST",e.url);for(const t in e.headers)Object.prototype.hasOwnProperty.call(e.headers,t)&&s.setRequestHeader(t,e.headers[t]);s.send(t.body)}))}))}const Nn="?";function Dn(e,t,n,r){const s={filename:e,function:t,in_app:!0};return void 0!==n&&(s.lineno=n),void 0!==r&&(s.colno=r),s}const An=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ln=/\((\S*)(?::(\d+))(?::(\d+))\)/,Vn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Mn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Un=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,Hn=G(...[[30,e=>{const t=An.exec(e);if(t){if(t[2]&&0===t[2].indexOf("eval")){const e=Ln.exec(t[2]);e&&(t[2]=e[1],t[3]=e[2],t[4]=e[3])}const[e,n]=qn(t[1]||Nn,t[2]);return Dn(n,e,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],[50,e=>{const t=Vn.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const e=Mn.exec(t[3]);e&&(t[1]=t[1]||"eval",t[3]=e[1],t[4]=e[2],t[5]="")}let e=t[3],n=t[1]||Nn;return[n,e]=qn(n,e),Dn(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],[40,e=>{const t=Un.exec(e);return t?Dn(t[2],t[1]||Nn,+t[3],t[4]?+t[4]:void 0):void 0}]]),qn=(e,t)=>{const n=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return n||r?[-1!==e.indexOf("@")?e.split("@")[0]:Nn,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Bn=1024,Fn="Breadcrumbs",Jn=(e={})=>{const t=__spreadValues({console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0},e);return{name:Fn,setupOnce(){},setup(e){var n;t.console&&function(e){const t="console";ee(t,e),te(t,re)}(function(e){return function(t){if(Et()!==e)return;const n={category:"console",data:{arguments:t.args,logger:"console"},level:Je(t.level),message:f(t.args," ")};if("assert"===t.level){if(!1!==t.args[0])return;n.message=`Assertion failed: ${f(t.args.slice(1)," ")||"console.assert"}`,n.data.arguments=t.args.slice(1)}bt(n,{input:t.args,level:t.level})}}(e)),t.dom&&(n=function(e,t){return function(n){if(Et()!==e)return;let r,s,o="object"==typeof t?t.serializeAttribute:void 0,i="object"==typeof t&&"number"==typeof t.maxStringLength?t.maxStringLength:void 0;i&&i>Bn&&(En&&I.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${i} was configured. Sentry will use 1024 instead.`),i=Bn),"string"==typeof o&&(o=[o]);try{const e=n.event,t=function(e){return!!e&&!!e.target}(e)?e.target:e;r=T(t,{keyAttrs:o,maxStringLength:i}),s=function(e){if(!x.HTMLElement)return null;let t=e;for(let n=0;n<5;n++){if(!t)return null;if(t instanceof HTMLElement&&t.dataset.sentryComponent)return t.dataset.sentryComponent;t=t.parentNode}return null}(t)}catch(c){r="<unknown>"}if(0===r.length)return;const a={category:`ui.${n.name}`,message:r};s&&(a.data={"ui.component_name":s}),bt(a,{event:n.event,name:n.name,global:n.global})}}(e,t.dom),ee("dom",n),te("dom",ge)),t.xhr&&function(e){ee("xhr",e),te("xhr",Ne)}(function(e){return function(t){if(Et()!==e)return;const{startTimestamp:n,endTimestamp:r}=t,s=t.xhr[je];if(!n||!r||!s)return;const{method:o,url:i,status_code:a,body:c}=s;bt({category:"xhr",data:{method:o,url:i,status_code:a},type:"http"},{xhr:t.xhr,input:c,startTimestamp:n,endTimestamp:r})}}(e)),t.fetch&&function(e){const t="fetch";ee(t,e),te(t,be)}(function(e){return function(t){if(Et()!==e)return;const{startTimestamp:n,endTimestamp:r}=t;if(r&&(!t.fetchData.url.match(/sentry_key/)||"POST"!==t.fetchData.method))if(t.error){bt({category:"fetch",data:t.fetchData,level:"error",type:"http"},{data:t.error,input:t.args,startTimestamp:n,endTimestamp:r})}else{const e=t.response;bt({category:"fetch",data:__spreadProps(__spreadValues({},t.fetchData),{status_code:e&&e.status}),type:"http"},{input:t.args,response:e,startTimestamp:n,endTimestamp:r})}}}(e)),t.history&&Re(function(e){return function(t){if(Et()!==e)return;let n=t.from,r=t.to;const s=Be(mn.location.href);let o=n?Be(n):void 0;const i=Be(r);o&&o.path||(o=s),s.protocol===i.protocol&&s.host===i.host&&(r=i.relative),s.protocol===o.protocol&&s.host===o.host&&(n=o.relative),bt({category:"navigation",data:{from:n,to:r}})}}(e)),t.sentry&&e.on&&e.on("beforeSendEvent",function(e){return function(t){Et()===e&&bt({category:"sentry."+("transaction"===t.type?"transaction":"event"),event_id:t.event_id,level:t.level,message:ie(t)},{event:t})}}(e))}}};Zt(Fn,Jn);const Wn="Dedupe",zn=()=>{let e;return{name:Wn,setupOnce(){},processEvent(t){if(t.type)return t;try{if(function(e,t){if(!t)return!1;if(function(e,t){const n=e.message,r=t.message;if(!n&&!r)return!1;if(n&&!r||!n&&r)return!1;if(n!==r)return!1;if(!Gn(e,t))return!1;if(!Yn(e,t))return!1;return!0}(e,t))return!0;if(function(e,t){const n=Xn(t),r=Xn(e);if(!n||!r)return!1;if(n.type!==r.type||n.value!==r.value)return!1;if(!Gn(e,t))return!1;if(!Yn(e,t))return!1;return!0}(e,t))return!0;return!1}(t,e))return En&&I.warn("Event dropped due to being a duplicate of previously captured event."),null}catch(n){}return e=t}}};function Yn(e,t){let n=Kn(e),r=Kn(t);if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;if(r.length!==n.length)return!1;for(let s=0;s<r.length;s++){const e=r[s],t=n[s];if(e.filename!==t.filename||e.lineno!==t.lineno||e.colno!==t.colno||e.function!==t.function)return!1}return!0}function Gn(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;try{return!(n.join("")!==r.join(""))}catch(s){return!1}}function Xn(e){return e.exception&&e.exception.values&&e.exception.values[0]}function Kn(e){const t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch(n){return}}Zt(Wn,zn);const Zn="GlobalHandlers",Qn=(e={})=>{const t=__spreadValues({onerror:!0,onunhandledrejection:!0},e);return{name:Zn,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(!function(e){!function(e){const t="error";ee(t,e),te(t,ke)}((t=>{const{stackParser:n,attachStacktrace:s}=nr();if(Et()!==e||vn())return;const{msg:i,url:a,line:c,column:u,error:l}=t,h=void 0===l&&o(i)?function(e,t,n,s){const o=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;let i=r(e)?e.message:e,a="Error";const c=i.match(o);c&&(a=c[1],i=c[2]);const u={exception:{values:[{type:a,value:i}]}};return er(u,t,n,s)}(i,a,c,u):er(Cn(n,l||i,void 0,s,!1),a,c,u);h.level="error",vt(h,{originalException:l,mechanism:{handled:!1,type:"onerror"}})}))}(e),tr("onerror")),t.onunhandledrejection&&(!function(e){!function(e){const t="unhandledrejection";ee(t,e),te(t,Te)}((t=>{const{stackParser:n,attachStacktrace:r}=nr();if(Et()!==e||vn())return;const s=function(e){if(a(e))return e;const t=e;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch(n){}return e}(t),o=a(s)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`}]}}:Cn(n,s,void 0,r,!0);o.level="error",vt(o,{originalException:s,mechanism:{handled:!1,type:"onunhandledrejection"}})}))}(e),tr("onunhandledrejection"))}}};function er(e,t,n,r){const s=e.exception=e.exception||{},i=s.values=s.values||[],a=i[0]=i[0]||{},c=a.stacktrace=a.stacktrace||{},u=c.frames=c.frames||[],l=isNaN(parseInt(r,10))?void 0:r,h=isNaN(parseInt(n,10))?void 0:n,d=o(t)&&t.length>0?t:function(){try{return x.document.location.href}catch(e){return""}}();return 0===u.length&&u.push({colno:l,filename:d,function:"?",in_app:!0,lineno:h}),e}function tr(e){En&&I.log(`Global Handler attached: ${e}`)}function nr(){const e=Et();return e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}Zt(Zn,Qn);const rr="HttpContext",sr=()=>({name:rr,setupOnce(){},preprocessEvent(e){if(!mn.navigator&&!mn.location&&!mn.document)return;const t=e.request&&e.request.url||mn.location&&mn.location.href,{referrer:n}=mn.document||{},{userAgent:r}=mn.navigator||{},s=__spreadValues(__spreadValues(__spreadValues({},e.request&&e.request.headers),n&&{Referer:n}),r&&{"User-Agent":r}),o=__spreadProps(__spreadValues(__spreadValues({},e.request),t&&{url:t}),{headers:s});e.request=o}});Zt(rr,sr);const or="LinkedErrors",ir=(e={})=>{const t=e.limit||5,n=e.key||"cause";return{name:or,setupOnce(){},preprocessEvent(e,r,s){const o=s.getOptions();m(Sn,o.stackParser,o.maxValueLength,n,t,e,r)}}};Zt(or,ir);const ar=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],cr="TryCatch",ur=(e={})=>{const t=__spreadValues({XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0},e);return{name:cr,setupOnce(){t.setTimeout&&V(mn,"setTimeout",lr),t.setInterval&&V(mn,"setInterval",lr),t.requestAnimationFrame&&V(mn,"requestAnimationFrame",hr),t.XMLHttpRequest&&"XMLHttpRequest"in mn&&V(XMLHttpRequest.prototype,"send",dr);const e=t.eventTarget;if(e){(Array.isArray(e)?e:ar).forEach(pr)}}}};function lr(e){return function(...t){const n=t[0];return t[0]=bn(n,{mechanism:{data:{function:K(e)},handled:!1,type:"instrument"}}),e.apply(this,t)}}function hr(e){return function(t){return e.apply(this,[bn(t,{mechanism:{data:{function:"requestAnimationFrame",handler:K(e)},handled:!1,type:"instrument"}})])}}function dr(e){return function(...t){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach((e=>{e in n&&"function"==typeof n[e]&&V(n,e,(function(t){const n={mechanism:{data:{function:e,handler:K(t)},handled:!1,type:"instrument"}},r=H(t);return r&&(n.mechanism.data.handler=K(r)),bn(t,n)}))})),e.apply(this,t)}}function pr(e){const t=mn,n=t[e]&&t[e].prototype;n&&n.hasOwnProperty&&n.hasOwnProperty("addEventListener")&&(V(n,"addEventListener",(function(t){return function(n,r,s){try{"function"==typeof r.handleEvent&&(r.handleEvent=bn(r.handleEvent,{mechanism:{data:{function:"handleEvent",handler:K(r),target:e},handled:!1,type:"instrument"}}))}catch(o){}return t.apply(this,[n,bn(r,{mechanism:{data:{function:"addEventListener",handler:K(r),target:e},handled:!1,type:"instrument"}}),s])}})),V(n,"removeEventListener",(function(e){return function(t,n,r){const s=n;try{const n=s&&s.__sentry_wrapped__;n&&e.call(this,t,n,r)}catch(o){}return e.call(this,t,s,r)}})))}Zt(cr,ur);const fr=[hn(),_n(),ur(),Jn(),Qn(),ir(),zn(),sr()];function gr(e={}){void 0===e.defaultIntegrations&&(e.defaultIntegrations=[...fr]),void 0===e.release&&("string"==typeof __SENTRY_RELEASE__&&(e.release=__SENTRY_RELEASE__),mn.SENTRY_RELEASE&&mn.SENTRY_RELEASE.id&&(e.release=mn.SENTRY_RELEASE.id)),void 0===e.autoSessionTracking&&(e.autoSessionTracking=!0),void 0===e.sendClientReports&&(e.sendClientReports=!0);const t=__spreadProps(__spreadValues({},e),{stackParser:(n=e.stackParser||Hn,Array.isArray(n)?G(...n):n),integrations:Gt(e),transport:e.transport||(ye()?In:jn)});var n;sn(Rn,t),e.autoSessionTracking&&function(){if(void 0===mn.document)return void(En&&I.warn("Session tracking in non-browser environment with @sentry/browser is not supported."));wt({ignoreDuration:!0}),Tt(),Re((({from:e,to:t})=>{void 0!==e&&e!==t&&(wt({ignoreDuration:!0}),Tt())}))}()}class _r{static generateRandomString(e=8){const t="abcdefghijklmnopqrstuvwxyz0123456789";let n="";for(let r=0;r<e;r++)n+=t.charAt(Math.floor(36*Math.random()));return n}static generateSessionId(e){return`${e}-${Date.now()}-${this.generateRandomString(12)}`}static generatePageId(e){return`${e}-${Date.now()}-${this.generateRandomString(8)}`}static generateUserId(e){return`${e}-${Date.now()}-${this.generateRandomString(16)}`}static extractTimestamp(e){const t=e.split("-");if(t.length>=2){const e=parseInt(t[1],10);return isNaN(e)?null:e}return null}static isValidId(e){const t=e.split("-");return t.length>=3&&!isNaN(parseInt(t[1],10))}}function mr(e){try{let t=localStorage.getItem("visitorId");return t||(t=_r.generateUserId(e||"visitor"),localStorage.setItem("visitorId",t)),t}catch(t){return function(e,t){console.error("Analytics Error:",e),"localhost"!==window.location.hostname&&yt(e,{extra:t})}(t,{context:"getVisitorId"}),_r.generateUserId(e||"visitor")}}const yr=18e5;function vr(e){const t=function(){const e=localStorage.getItem("sessionId"),t=localStorage.getItem("sessionTimestamp");if(!e||!t)return null;const n=parseInt(t,10);if(Date.now()-n>yr)return xr(),null;return e}();if(t)return wr(),t;const n=_r.generateSessionId(e||"session");return function(e){localStorage.setItem("sessionId",e),wr(),localStorage.setItem("sessionSequence","0");const t=document.referrer||"";localStorage.setItem(`referrer-${e}`,t),localStorage.setItem(`initial_referrer_${e}`,t);const n=`utm_params_${e}`;if(!localStorage.getItem(n)){const e=Er();localStorage.setItem(n,JSON.stringify(e))}}(n),n}function br(e){const t=`initial_referrer_${e}`,n=localStorage.getItem(t);if(null!==n)return n;const r=function(e){if(!e||""===e.trim())return"";try{const t=new URL(e),n=new URL(window.location.href);return t.origin===n.origin||(t.hostname===n.hostname||function(e,t){const n=e.toLowerCase(),r=t.toLowerCase();if(n.includes(r)&&(n.includes("/redirect")||n.includes("/r/")||n.includes("/link/")))return!0;if(n.includes(`${r}.`)||n.includes(`//${r}`))return!0;const s=kr(r),o=kr(n);if(s&&o&&s===o)return!0;return!1}(e,n.hostname))?"":function(e){try{const t=new URL(e);return`${t.protocol}//${t.host}${t.pathname}`}catch(t){return e}}(e)}catch(t){return""}}(document.referrer||"");return localStorage.setItem(t,r),r}function Er(){const e=new URLSearchParams(window.location.search),t={};return["utm_source","utm_medium","utm_campaign","utm_term","utm_content"].forEach((n=>{const r=e.get(n);r&&(t[n]=r)})),t}function Sr(){const e=parseInt(localStorage.getItem("sessionSequence")||"0",10)+1;return localStorage.setItem("sessionSequence",e.toString()),e}function wr(){localStorage.setItem("sessionTimestamp",Date.now().toString())}function kr(e){try{const t=e.replace(/^https?:\/\//,""),n=t.split(".");return n.length>=2?n.slice(-2).join("."):t}catch(t){return null}}function xr(){const e=localStorage.getItem("visitorId"),t=Object.keys(localStorage),n=localStorage.getItem("sessionId");n&&t.forEach((e=>{(e.includes(n)||"sessionId"===e||"sessionTimestamp"===e||e.startsWith(`initial_referrer_${n}`)||e.startsWith(`utm_params_${n}`)||e.startsWith("flowganise_queue_"))&&localStorage.removeItem(e)})),localStorage.removeItem("sessionSequence"),e&&localStorage.setItem("visitorId",e)}var Tr=e=>{if("function"==typeof e)return e;return function(){return e}},Cr="undefined"!=typeof self?self:null,$r="undefined"!=typeof window?window:null,Or=Cr||$r||globalThis,Rr=0,Pr=1,Ir=2,jr=3,Nr="closed",Dr="errored",Ar="joined",Lr="joining",Vr="leaving",Mr="phx_close",Ur="phx_error",Hr="phx_join",qr="phx_reply",Br="phx_leave",Fr="longpoll",Jr="websocket",Wr=4,zr="base64url.bearer.phx.",Yr=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter((t=>t.status===e)).forEach((e=>e.callback(t)))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,(e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)})),this.timeoutTimer=setTimeout((()=>{this.trigger("timeout",{})}),this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},Gr=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout((()=>{this.tries=this.tries+1,this.callback()}),this.timerCalc(this.tries+1))}},Xr=class{constructor(e,t,n){this.state=Nr,this.topic=e,this.params=Tr(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Yr(this,Hr,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Gr((()=>{this.socket.isConnected()&&this.rejoin()}),this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError((()=>this.rejoinTimer.reset()))),this.stateChangeRefs.push(this.socket.onOpen((()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()}))),this.joinPush.receive("ok",(()=>{this.state=Ar,this.rejoinTimer.reset(),this.pushBuffer.forEach((e=>e.send())),this.pushBuffer=[]})),this.joinPush.receive("error",(()=>{this.state=Dr,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.onClose((()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=Nr,this.socket.remove(this)})),this.onError((e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=Dr,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.joinPush.receive("timeout",(()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new Yr(this,Br,Tr({}),this.timeout).send(),this.state=Dr,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()})),this.on(qr,((e,t)=>{this.trigger(this.replyEventName(t),e)}))}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(e){this.on(Mr,e)}onError(e){return this.on(Ur,(t=>e(t)))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter((n=>!(n.event===e&&(void 0===t||t===n.ref))))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new Yr(this,e,(function(){return t}),n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=Vr;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Mr,"leave")},n=new Yr(this,Br,Tr({}),e);return n.receive("ok",(()=>t())).receive("timeout",(()=>t())),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}isMember(e,t,n,r){return this.topic===e&&(!r||r===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:r}),!1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=Lr,this.joinPush.resend(e))}trigger(e,t,n,r){let s=this.onMessage(e,t,n,r);if(t&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter((t=>t.event===e));for(let i=0;i<o.length;i++){o[i].callback(s,n,r||this.joinRef())}}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===Nr}isErrored(){return this.state===Dr}isJoined(){return this.state===Ar}isJoining(){return this.state===Lr}isLeaving(){return this.state===Vr}},Kr=class{static request(e,t,n,r,s,o,i){if(Or.XDomainRequest){let n=new Or.XDomainRequest;return this.xdomainRequest(n,e,t,r,s,o,i)}if(Or.XMLHttpRequest){let a=new Or.XMLHttpRequest;return this.xhrRequest(a,e,t,n,r,s,o,i)}if(Or.fetch&&Or.AbortController)return this.fetchRequest(e,t,n,r,s,o,i);throw new Error("No suitable XMLHttpRequest implementation found")}static fetchRequest(e,t,n,r,s,o,i){let a={method:e,headers:n,body:r},c=null;return s&&(c=new AbortController,setTimeout((()=>c.abort()),s),a.signal=c.signal),Or.fetch(t,a).then((e=>e.text())).then((e=>this.parseJSON(e))).then((e=>i&&i(e))).catch((e=>{"AbortError"===e.name&&o?o():i&&i(null)})),c}static xdomainRequest(e,t,n,r,s,o,i){return e.timeout=s,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);i&&i(t)},o&&(e.ontimeout=o),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,s,o,i,a){e.open(t,n,!0),e.timeout=o;for(let[c,u]of Object.entries(r))e.setRequestHeader(c,u);return e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{if(e.readyState===Wr&&a){let t=this.parseJSON(e.responseText);a(t)}},i&&(e.ontimeout=i),e.send(s),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch(t){return console,null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let s=t?`${t}[${r}]`:r,o=e[r];"object"==typeof o?n.push(this.serialize(o,s)):n.push(encodeURIComponent(s)+"="+encodeURIComponent(o))}return n.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},Zr=class{constructor(e,t){t&&2===t.length&&t[1].startsWith(zr)&&(this.authToken=atob(t[1].slice(21))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=Rr,setTimeout((()=>this.poll()),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Jr),"$1/"+Fr)}endpointURL(){return Kr.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=Rr}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Pr||this.readyState===Rr}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,(()=>this.ontimeout()),(e=>{if(e){var{status:t,token:n,messages:r}=e;this.token=n}else t=0;switch(t){case 200:r.forEach((e=>{setTimeout((()=>this.onmessage({data:e})),0)})),this.poll();break;case 204:this.poll();break;case 410:this.readyState=Pr,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}}))}send(e){"string"!=typeof e&&(e=(e=>{let t="",n=new Uint8Array(e),r=n.byteLength;for(let s=0;s<r;s++)t+=String.fromCharCode(n[s]);return btoa(t)})(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout((()=>{this.batchSend(this.currentBatch),this.currentBatch=null}),0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join("\n"),(()=>this.onerror("timeout")),(e=>{this.awaitingBatchAck=!1,e&&200===e.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))}))}close(e,t,n){for(let s of this.reqs)s.abort();this.readyState=jr;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,n,r,s){let o;o=Kr.request(e,this.endpointURL(),t,n,this.timeout,(()=>{this.reqs.delete(o),r()}),(e=>{this.reqs.delete(o),this.isActive()&&s(e)})),this.reqs.add(o)}},Qr={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,s,o,i]=JSON.parse(e);return t({join_ref:n,ref:r,topic:s,event:o,payload:i})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:s,payload:o}=e,i=this.META_LENGTH+t.length+n.length+s.length+r.length,a=new ArrayBuffer(this.HEADER_LENGTH+i),c=new DataView(a),u=0;c.setUint8(u++,this.KINDS.push),c.setUint8(u++,t.length),c.setUint8(u++,n.length),c.setUint8(u++,s.length),c.setUint8(u++,r.length),Array.from(t,(e=>c.setUint8(u++,e.charCodeAt(0)))),Array.from(n,(e=>c.setUint8(u++,e.charCodeAt(0)))),Array.from(s,(e=>c.setUint8(u++,e.charCodeAt(0)))),Array.from(r,(e=>c.setUint8(u++,e.charCodeAt(0))));var l=new Uint8Array(a.byteLength+o.byteLength);return l.set(new Uint8Array(a),0),l.set(new Uint8Array(o),a.byteLength),l.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),o=t.getUint8(3),i=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(e.slice(i,i+r));i+=r;let c=n.decode(e.slice(i,i+s));i+=s;let u=n.decode(e.slice(i,i+o));return i+=o,{join_ref:a,ref:null,topic:c,event:u,payload:e.slice(i,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),o=t.getUint8(3),i=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,c=n.decode(e.slice(a,a+r));a+=r;let u=n.decode(e.slice(a,a+s));a+=s;let l=n.decode(e.slice(a,a+o));a+=o;let h=n.decode(e.slice(a,a+i));a+=i;let d=e.slice(a,e.byteLength);return{join_ref:c,ref:u,topic:l,event:qr,payload:{status:h,response:d}}},decodeBroadcast(e,t,n){let r=t.getUint8(1),s=t.getUint8(2),o=this.HEADER_LENGTH+2,i=n.decode(e.slice(o,o+r));o+=r;let a=n.decode(e.slice(o,o+s));return o+=s,{join_ref:null,ref:null,topic:i,event:a,payload:e.slice(o,e.byteLength)}}},es=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=t.timeout||1e4,this.transport=t.transport||Or.WebSocket||Zr,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||Or&&Or.sessionStorage,this.establishedConnections=0,this.defaultEncoder=Qr.encode.bind(Qr),this.defaultDecoder=Qr.decode.bind(Qr),this.closeWasClean=!1,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==Zr?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;$r&&$r.addEventListener&&($r.addEventListener("pagehide",(e=>{this.conn&&(this.disconnect(),n=this.connectClock)})),$r.addEventListener("pageshow",(e=>{n===this.connectClock&&(n=null,this.connect())}))),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=e=>t.rejoinAfterMs?t.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>t.reconnectAfterMs?t.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(e,t,n)=>{}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=Tr(t.params||{}),this.endPoint=`${e}/${Jr}`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Gr((()=>{this.teardown((()=>this.connect()))}),this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return Zr}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=Kr.appendParams(Kr.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown((()=>{this.disconnecting=!1,e&&e()}),t,n)}connect(e){e&&(console,this.params=Tr(e)),this.conn&&!this.disconnecting||(this.longPollFallbackMs&&this.transport!==Zr?this.connectWithFallback(Zr,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let r=this.onMessage((s=>{s.ref===t&&(this.off([r]),e(Date.now()-n))}));return!0}transportConnect(){let e;this.connectClock++,this.closeWasClean=!1,this.authToken&&(e=["phoenix",`${zr}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n,r=!1,s=!0,o=t=>{this.log("transport",`falling back to ${e.name}...`,t),this.off([undefined,n]),s=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${e.name}`))return o("memorized");this.fallbackTimer=setTimeout(o,t),n=this.onError((e=>{this.log("transport","error",e),s&&!r&&(clearTimeout(this.fallbackTimer),o(e))})),this.onOpen((()=>{if(r=!0,!s)return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${e.name}`,"true"),this.log("transport",`established ${e.name} fallback`);clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(o,t),this.ping((e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)}))})),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transport.name} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach((([,e])=>e()))}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown((()=>this.reconnectTimer.scheduleTimeout()),1e3,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();let r=this.connectClock;this.waitForBufferDone((()=>{r===this.connectClock&&(this.conn&&(t?this.conn.close(t,n||""):this.conn.close()),this.waitForSocketClosed((()=>{r===this.connectClock&&(this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e())})))}))}waitForBufferDone(e,t=1){5!==t&&this.conn&&this.conn.bufferedAmount?setTimeout((()=>{this.waitForBufferDone(e,t+1)}),150*t):e()}waitForSocketClosed(e,t=1){5!==t&&this.conn&&this.conn.readyState!==jr?setTimeout((()=>{this.waitForSocketClosed(e,t+1)}),150*t):e()}onConnClose(e){let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(),this.clearHeartbeats(),this.closeWasClean||1e3===t||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach((([,t])=>t(e)))}onConnError(e){this.hasLogger()&&this.log("transport",e);let t=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach((([,r])=>{r(e,t,n)})),(t===this.transport||n>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach((e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(Ur)}))}connectionState(){switch(this.conn&&this.conn.readyState){case Rr:return"connecting";case Pr:return"open";case Ir:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter((t=>t!==e))}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter((([t])=>-1===e.indexOf(t)))}channel(e,t={}){let n=new Xr(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:s,join_ref:o}=e;this.log("push",`${t} ${n} (${o}, ${s})`,r)}this.isConnected()?this.encode(e,(e=>this.conn.send(e))):this.sendBuffer.push((()=>this.encode(e,(e=>this.conn.send(e)))))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout((()=>this.heartbeatTimeout()),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach((e=>e())),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,(e=>{let{topic:t,event:n,payload:r,ref:s,join_ref:o}=e;s&&s===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout((()=>this.sendHeartbeat()),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${t} ${n} ${s&&"("+s+")"||""}`,r);for(let i=0;i<this.channels.length;i++){const e=this.channels[i];e.isMember(t,n,r,o)&&e.trigger(n,r,s,o)}for(let i=0;i<this.stateChangeCallbacks.message.length;i++){let[,t]=this.stateChangeCallbacks.message[i];t(e)}}))}leaveOpenTopic(e){let t=this.channels.find((t=>t.topic===e&&(t.isJoined()||t.isJoining())));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};function ts(e){var t,n,r,s,o;return(null==(t=e.title)?void 0:t.trim())||(null==(n=e.ariaLabel)?void 0:n.trim())||(null==(r=e.getAttribute("aria-label"))?void 0:r.trim())||(null==(s=e.innerText)?void 0:s.trim())||(null==(o=e.textContent)?void 0:o.trim())||(e.id?`#${e.id}`:null)||(e.className?`.${e.className.split(" ")[0]}`:null)||`${e.tagName}-${ns(e)}`}function ns(e){var t;return Array.from((null==(t=e.parentNode)?void 0:t.children)||[]).filter((t=>t.tagName===e.tagName)).indexOf(e)+1}function rs(e,t,n={}){const r=window.location.pathname,s=function(e){const t=e.id?`#${e.id}`:"",n=e.className?`.${e.className.replace(/\s+/g,".")}`:"";if(!t&&!n){return ts(e).substring(0,20).replace(/[^a-zA-Z0-9\-_.:#]/g,"")}return`${t}${n}`.replace(/[^a-zA-Z0-9\-_.:#]/g,"")}(t);return`${e}:${r}:${s}:${ns(t)}`}(()=>{"localhost"!==window.location.hostname&&gr({dsn:"https://1905c972c643a53d1adb58b2c8ab5fce@o4508330319544320.ingest.us.sentry.io/4508330321248256",tracesSampleRate:1,beforeSend(e){var t;return(null==(t=e.exception)?void 0:t.values)&&e.exception.values.some((e=>{var t,n;return null==(n=null==(t=e.stacktrace)?void 0:t.frames)?void 0:n.some((e=>{var t;return null==(t=e.filename)?void 0:t.includes("index.min.js")}))}))?e:null}});const e=function(){const e=document.currentScript||document.querySelector('script[src*="flowganise-script"]')||document.querySelector('script[src*="index.min.js"]');if(null==e?void 0:e.src)return new URL(e.src).searchParams.get("site-id");return null}();if(!e)return void console.error("[Flowganise] Site ID is required site-id to script URL");let t=!1,n=null,r=null,s=null,o=null,i=0,a=[];const c=`flowganise_queue_${e}`;function u(){try{a.length>0?localStorage.setItem(c,JSON.stringify(a)):localStorage.removeItem(c)}catch(e){}}function l(e){e.retryCount||(e.retryCount=0),a.push(e),u(),f()}function h(e){a=a.filter((t=>t.event_id!==e)),u()}function d(e){p(e)}function p(e,t=3){const s=e.event_id;r&&(null==n?void 0:n.isConnected())?r.push("track_event",e).receive("ok",(()=>{h(s)})).receive("error",(t=>{if(console.error(`[Flowganise] Event failed: ${s}`,t),t&&t.close_connection)return console.warn("[Flowganise] Server requested connection closure:",t.message||t.reason),void(n&&(n.disconnect(),n=null,r=null));t&&!1!==t.retryable?function(e,t){const n=a.find((t=>t.event_id===e));n&&(Object.assign(n,t),u())}(s,{retryCount:(e.retryCount||0)+1}):(console.warn(`[Flowganise] Event marked as non-retryable: ${s}`,t.reason),h(s))})):l(e)}function f(){if(0===a.length||!r||!(null==n?void 0:n.isConnected()))return;a.length;const e=[...a];for(const t of e)t.retryCount>=3?(console.warn(`[Flowganise] Dropping event after max retries: ${t.event_id}`),h(t.event_id)):p(t)}function g(t,n={}){const r=function(){if(crypto&&crypto.randomUUID)return crypto.randomUUID();if(crypto&&crypto.getRandomValues){const e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128;const t=Array.from(e,(e=>e.toString(16).padStart(2,"0"))).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20,32)}`}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}(),i=s?br(s):"",a=s?function(e){const t=`utm_params_${e}`,n=localStorage.getItem(t);if(n)try{return JSON.parse(n)}catch(s){return{}}const r=Er();return localStorage.setItem(t,JSON.stringify(r)),r}(s):{},c=function(e){if(!e)return"";try{const t=new URL(e),n=new URL(window.location.href);return t.origin===n.origin?"":e}catch(t){return""}}(i),u=window.pageYOffset||document.documentElement.scrollTop,l=window.pageXOffset||document.documentElement.scrollLeft;let h=n.event_identifier;return h||("page_view"===t?h=`page_view:${window.location.pathname}`:"purchase"===t&&(h="purchase:all")),{event_name:t,event_id:r,timestamp:(new Date).toISOString(),session_sequence:Sr(),properties:__spreadProps(__spreadValues(__spreadValues({},n),h?{event_identifier:h}:{}),{initial_referrer:c,utm_params:a,hostname:window.location.hostname,viewport_width:window.innerWidth,viewport_height:window.innerHeight,title:document.title,pathname:window.location.pathname,search:window.location.search,hash:window.location.hash,referrer:document.referrer||null,screen_width:window.screen.width,screen_height:window.screen.height,user_agent:navigator.userAgent,document_height:document.documentElement.scrollHeight,document_width:document.documentElement.scrollWidth,scroll_top:u,scroll_left:l}),site_id:e,session_id:s,visitor_id:o,url:window.location.href}}!function(){try{const e=localStorage.getItem(c);if(e){const t=JSON.parse(e);a.push(...t),t.length}}catch(e){console.error("[Flowganise] Failed to load queue from localStorage:",e)}}(),function(e){document.addEventListener("visibilitychange",(()=>{if("hidden"===document.visibilityState)localStorage.setItem("lastActiveTimestamp",Date.now().toString());else if("visible"===document.visibilityState){const e=localStorage.getItem("lastActiveTimestamp");e&&Date.now()-parseInt(e,10)>3e5&&xr(),wr()}})),s=vr(e),o=mr(e);l(g("page_view",{})),function(e){const t="wss://flowganise.com/socket";try{n=new es(t,{params:{siteId:e,sessionId:s,visitorId:o}}),n.connect(),r=n.channel(`analytics:${e}`,{sessionId:s,visitorId:o}),r.join().receive("ok",(e=>{f()})).receive("error",(e=>{if(null==e?void 0:e.close_connection)return console.error("❌ [Flowganise] Invalid site ID - connection rejected"),void(n&&(n.disconnect(),n=null,r=null));console.error("[Flowganise] Phoenix Channel join failed",e),JSON.stringify(e,null,2)})),r.on("message",(e=>{var t;e&&"error"===e.status&&(null==(t=e.response)?void 0:t.close_connection)&&(console.warn("[Flowganise] Server requested connection closure via message:",e.response.message||e.response.reason),n&&(n.disconnect(),n=null,r=null))})),r.onError((e=>{var t;((null==(t=null==e?void 0:e.response)?void 0:t.close_connection)||(null==e?void 0:e.close_connection))&&(console.warn("[Flowganise] Server requested connection closure via channel error"),n&&(n.disconnect(),n=null,r=null))})),n.conn&&n.conn.addEventListener&&n.conn.addEventListener("message",(e=>{var t;e.data;try{const s=JSON.parse(e.data);if(Array.isArray(s)&&s.length>=5){const[e,o,i,a,c]=s;"phx_reply"===a&&"error"===(null==c?void 0:c.status)&&(null==(t=null==c?void 0:c.response)?void 0:t.close_connection)&&(console.warn("[Flowganise] Server requested connection closure via raw message:",c.response.message||c.response.reason),n&&(n.disconnect(),n=null,r=null))}}catch(s){}})),n.onOpen((()=>{})),n.onClose((()=>{})),n.onError((e=>{console.error("[Flowganise] Phoenix Socket error:",e)}))}catch(i){console.error("[Flowganise] Failed to initialize Phoenix Socket:",i)}}(e),function(){let e;window.addEventListener("scroll",(()=>{clearTimeout(e),e=window.setTimeout((()=>{!function(){const e=window.pageYOffset||document.documentElement.scrollTop,n=window.pageXOffset||document.documentElement.scrollLeft,r=(window.innerHeight,window.innerWidth,document.documentElement.scrollHeight),s=document.documentElement.scrollWidth;i=Math.max(i,e),function(e){if(!t)return;d(g("scroll_position",{document_width:e.documentWidth,document_height:e.documentHeight})),e.scrollTop,e.scrollLeft}({scrollTop:e,scrollLeft:n,documentHeight:r,documentWidth:s})}()}),500)}),{passive:!0}),document.addEventListener("click",(e=>{const n=e.target,r=n.getBoundingClientRect(),s={x:e.pageX,y:e.pageY,rx:e.clientX-r.left,ry:e.clientY-r.top};if("BUTTON"===n.tagName||"INPUT"===n.tagName&&"button"===n.getAttribute("type"))!function(e,n){if(!t)return;const r=ts(e),s=rs("button_clicked",e);d(g("button_clicked",__spreadValues({button_text:r,button_type:e.type||"button",button_id:e.id||null,button_class:e.className||null,event_identifier:s},n)))}(n,s);else if("A"===n.tagName&&n.href)!function(e,n){if(!t)return;const r=ts(e),s=rs("link_clicked",e);d(g("link_clicked",__spreadValues({link_text:r,link_url:e.href,link_target:e.target||"_self",is_external:e.hostname!==window.location.hostname,link_id:e.id||null,link_class:e.className||null,event_identifier:s},n))),e.href}(n,s);else if(n.onclick||n.getAttribute("onclick")){if(!t)return;const e=ts(n),r=rs("element_clicked",n);d(g("element_clicked",__spreadValues({element_tag:n.tagName.toLowerCase(),element_text:e,element_id:n.id||null,element_class:n.className||null,event_identifier:r},s))),n.tagName}}),!0),document.addEventListener("visibilitychange",(()=>{if("hidden"===document.visibilityState&&i>0&&t){d(g("page_exit",{max_scroll_depth:i}))}}))}(),t=!0}(e),window.fgan=function(e,s={}){t||console.warn("[Flowganise] Tracker not initialized yet, queuing event");const o=g(e,s);r&&(null==n?void 0:n.isConnected())?d(o):l(o)}})()}();
//# sourceMappingURL=index.min.js.map
