browsermcp-background.js•841 kB
var background=function(){"use strict";var Hq=Object.defineProperty;var cT=Ke=>{throw TypeError(Ke)};var qq=(Ke,Ve,ct)=>Ve in Ke?Hq(Ke,Ve,{enumerable:!0,configurable:!0,writable:!0,value:ct}):Ke[Ve]=ct;var Sn=(Ke,Ve,ct)=>qq(Ke,typeof Ve!="symbol"?Ve+"":Ve,ct),Ug=(Ke,Ve,ct)=>Ve.has(Ke)||cT("Cannot "+ct);var A=(Ke,Ve,ct)=>(Ug(Ke,Ve,"read from private field"),ct?ct.call(Ke):Ve.get(Ke)),Me=(Ke,Ve,ct)=>Ve.has(Ke)?cT("Cannot add the same private member more than once"):Ve instanceof WeakSet?Ve.add(Ke):Ve.set(Ke,ct),ve=(Ke,Ve,ct,er)=>(Ug(Ke,Ve,"write to private field"),er?er.call(Ke,ct):Ve.set(Ke,ct),ct),st=(Ke,Ve,ct)=>(Ug(Ke,Ve,"access private method"),ct);var bd=(Ke,Ve,ct,er)=>({set _(Sd){ve(Ke,Ve,Sd,ct)},get _(){return A(Ke,Ve,er)}});var zC,VC,ms,Ii,Oo,KC,Lo,xi,Do,GC,vs,YC,No,Fo,Dn,_s,Vt,wc,ys,Xn,Xr,ZC,gr,XC,mr,on,bs,vr,Li,JC,Yr,Jn,Sc,QC,ht,Ri,Ai,$o,Uo,Pi,Bo,jo,eT,tT,nT,rT,Mi,Ho,Oi,Bg,jg,Nn,Qn,qo,vt,En,ws,uT,wd,iT,sT;function Ke(t){return t==null||typeof t=="function"?{main:t}:t}function Ve(t){if(!t)return!1;try{const{pathname:e}=new URL(t,location.origin);return e===location.pathname}catch{return!1}}function ct(t){var e,n,r;return(r=(n=(e=globalThis.chrome)==null?void 0:e.runtime)==null?void 0:n.getManifest)==null?void 0:r.call(n)}function er(t){let e;return()=>(e===void 0&&(e=t()),e)}const Sd=er(()=>["about:","http:","https:"].includes(location.protocol)),lT=er(()=>{var t,e;return typeof((e=(t=globalThis.chrome)==null?void 0:t.runtime)==null?void 0:e.id)=="string"}),dT=er(()=>lT()&&Sd()),Hg=()=>fT()||hT(),fT=er(()=>{var e,n;const t=ct();return t?Ve(t.background_page??((e=t.background)==null?void 0:e.page))?!0:!!((n=t.background)!=null&&n.scripts&&Ve("/_generated_background_page.html")):!1}),hT=er(()=>{var t,e;return Ve((e=(t=ct())==null?void 0:t.background)==null?void 0:e.service_worker)});var qg=Object.prototype.hasOwnProperty;function Ed(t,e){var n,r;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&Ed(t[r],e[r]););return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(qg.call(t,n)&&++r&&!qg.call(e,n)||!(n in e)||!Ed(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}const pT=new Error("request for lock canceled");var gT=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{u(r.next(d))}catch(l){o(l)}}function c(d){try{u(r.throw(d))}catch(l){o(l)}}function u(d){d.done?s(d.value):i(d.value).then(a,c)}u((r=r.apply(t,e||[])).next())})};class mT{constructor(e,n=pT){this._value=e,this._cancelError=n,this._queue=[],this._weightedWaiters=[]}acquire(e=1,n=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return new Promise((r,i)=>{const s={resolve:r,reject:i,weight:e,priority:n},o=Wg(this._queue,a=>n<=a.priority);o===-1&&e<=this._value?this._dispatchItem(s):this._queue.splice(o+1,0,s)})}runExclusive(e){return gT(this,arguments,void 0,function*(n,r=1,i=0){const[s,o]=yield this.acquire(r,i);try{return yield n(s)}finally{o()}})}waitForUnlock(e=1,n=0){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);return this._couldLockImmediately(e,n)?Promise.resolve():new Promise(r=>{this._weightedWaiters[e-1]||(this._weightedWaiters[e-1]=[]),vT(this._weightedWaiters[e-1],{resolve:r,priority:n})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(e){this._value=e,this._dispatchQueue()}release(e=1){if(e<=0)throw new Error(`invalid weight ${e}: must be positive`);this._value+=e,this._dispatchQueue()}cancel(){this._queue.forEach(e=>e.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(e){const n=this._value;this._value-=e.weight,e.resolve([n,this._newReleaser(e.weight)])}_newReleaser(e){let n=!1;return()=>{n||(n=!0,this.release(e))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let e=this._value;e>0;e--){const n=this._weightedWaiters[e-1];n&&(n.forEach(r=>r.resolve()),this._weightedWaiters[e-1]=[])}else{const e=this._queue[0].priority;for(let n=this._value;n>0;n--){const r=this._weightedWaiters[n-1];if(!r)continue;const i=r.findIndex(s=>s.priority<=e);(i===-1?r:r.splice(0,i)).forEach(s=>s.resolve())}}}_couldLockImmediately(e,n){return(this._queue.length===0||this._queue[0].priority<n)&&e<=this._value}}function vT(t,e){const n=Wg(t,r=>e.priority<=r.priority);t.splice(n+1,0,e)}function Wg(t,e){for(let n=t.length-1;n>=0;n--)if(e(t[n]))return n;return-1}var _T=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{u(r.next(d))}catch(l){o(l)}}function c(d){try{u(r.throw(d))}catch(l){o(l)}}function u(d){d.done?s(d.value):i(d.value).then(a,c)}u((r=r.apply(t,e||[])).next())})};class yT{constructor(e){this._semaphore=new mT(1,e)}acquire(){return _T(this,arguments,void 0,function*(e=0){const[,n]=yield this._semaphore.acquire(1,e);return n})}runExclusive(e,n=0){return this._semaphore.runExclusive(()=>e(),1,n)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(e=0){return this._semaphore.waitForUnlock(1,e)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}const kc=((VC=(zC=globalThis.browser)==null?void 0:zC.runtime)==null?void 0:VC.id)==null?globalThis.chrome:globalThis.browser,Ss=bT();function bT(){const t={local:Cc("local"),session:Cc("session"),sync:Cc("sync"),managed:Cc("managed")},e=g=>{const v=t[g];if(v==null){const m=Object.keys(t).join(", ");throw Error(`Invalid area "${g}". Options: ${m}`)}return v},n=g=>{const v=g.indexOf(":"),m=g.substring(0,v),_=g.substring(v+1);if(_==null)throw Error(`Storage key should be in the form of "area:key", but received "${g}"`);return{driverArea:m,driverKey:_,driver:e(m)}},r=g=>g+"$",i=(g,v)=>{const m={...g};return Object.entries(v).forEach(([_,w])=>{w==null?delete m[_]:m[_]=w}),m},s=(g,v)=>g??v??null,o=g=>typeof g=="object"&&!Array.isArray(g)?g:{},a=async(g,v,m)=>{const _=await g.getItem(v);return s(_,(m==null?void 0:m.fallback)??(m==null?void 0:m.defaultValue))},c=async(g,v)=>{const m=r(v),_=await g.getItem(m);return o(_)},u=async(g,v,m)=>{await g.setItem(v,m??null)},d=async(g,v,m)=>{const _=r(v),w=o(await g.getItem(_));await g.setItem(_,i(w,m))},l=async(g,v,m)=>{if(await g.removeItem(v),m!=null&&m.removeMeta){const _=r(v);await g.removeItem(_)}},h=async(g,v,m)=>{const _=r(v);if(m==null)await g.removeItem(_);else{const w=o(await g.getItem(_));[m].flat().forEach(T=>delete w[T]),await g.setItem(_,w)}},f=(g,v,m)=>g.watch(v,m);return{getItem:async(g,v)=>{const{driver:m,driverKey:_}=n(g);return await a(m,_,v)},getItems:async g=>{const v=new Map,m=new Map,_=[];g.forEach(T=>{let C,E;typeof T=="string"?C=T:"getValue"in T?(C=T.key,E={fallback:T.fallback}):(C=T.key,E=T.options),_.push(C);const{driverArea:I,driverKey:y}=n(C),b=v.get(I)??[];v.set(I,b.concat(y)),m.set(C,E)});const w=new Map;return await Promise.all(Array.from(v.entries()).map(async([T,C])=>{(await t[T].getItems(C)).forEach(I=>{const y=`${T}:${I.key}`,b=m.get(y),k=s(I.value,(b==null?void 0:b.fallback)??(b==null?void 0:b.defaultValue));w.set(y,k)})})),_.map(T=>({key:T,value:w.get(T)}))},getMeta:async g=>{const{driver:v,driverKey:m}=n(g);return await c(v,m)},getMetas:async g=>{const v=g.map(w=>{const T=typeof w=="string"?w:w.key,{driverArea:C,driverKey:E}=n(T);return{key:T,driverArea:C,driverKey:E,driverMetaKey:r(E)}}),m=v.reduce((w,T)=>{var C;return w[C=T.driverArea]??(w[C]=[]),w[T.driverArea].push(T),w},{}),_={};return await Promise.all(Object.entries(m).map(async([w,T])=>{const C=await kc.storage[w].get(T.map(E=>E.driverMetaKey));T.forEach(E=>{_[E.key]=C[E.driverMetaKey]??{}})})),v.map(w=>({key:w.key,meta:_[w.key]}))},setItem:async(g,v)=>{const{driver:m,driverKey:_}=n(g);await u(m,_,v)},setItems:async g=>{const v={};g.forEach(m=>{const{driverArea:_,driverKey:w}=n("key"in m?m.key:m.item.key);v[_]??(v[_]=[]),v[_].push({key:w,value:m.value})}),await Promise.all(Object.entries(v).map(async([m,_])=>{await e(m).setItems(_)}))},setMeta:async(g,v)=>{const{driver:m,driverKey:_}=n(g);await d(m,_,v)},setMetas:async g=>{const v={};g.forEach(m=>{const{driverArea:_,driverKey:w}=n("key"in m?m.key:m.item.key);v[_]??(v[_]=[]),v[_].push({key:w,properties:m.meta})}),await Promise.all(Object.entries(v).map(async([m,_])=>{const w=e(m),T=_.map(({key:y})=>r(y));console.log(m,T);const C=await w.getItems(T),E=Object.fromEntries(C.map(({key:y,value:b})=>[y,o(b)])),I=_.map(({key:y,properties:b})=>{const k=r(y);return{key:k,value:i(E[k]??{},b)}});await w.setItems(I)}))},removeItem:async(g,v)=>{const{driver:m,driverKey:_}=n(g);await l(m,_,v)},removeItems:async g=>{const v={};g.forEach(m=>{let _,w;typeof m=="string"?_=m:"getValue"in m?_=m.key:"item"in m?(_=m.item.key,w=m.options):(_=m.key,w=m.options);const{driverArea:T,driverKey:C}=n(_);v[T]??(v[T]=[]),v[T].push(C),w!=null&&w.removeMeta&&v[T].push(r(C))}),await Promise.all(Object.entries(v).map(async([m,_])=>{await e(m).removeItems(_)}))},clear:async g=>{await e(g).clear()},removeMeta:async(g,v)=>{const{driver:m,driverKey:_}=n(g);await h(m,_,v)},snapshot:async(g,v)=>{var w;const _=await e(g).snapshot();return(w=v==null?void 0:v.excludeKeys)==null||w.forEach(T=>{delete _[T],delete _[r(T)]}),_},restoreSnapshot:async(g,v)=>{await e(g).restoreSnapshot(v)},watch:(g,v)=>{const{driver:m,driverKey:_}=n(g);return f(m,_,v)},unwatch(){Object.values(t).forEach(g=>{g.unwatch()})},defineItem:(g,v)=>{const{driver:m,driverKey:_}=n(g),{version:w=1,migrations:T={}}=v??{};if(w<1)throw Error("Storage item version cannot be less than 1. Initial versions should be set to 1, not 0.");const C=async()=>{var U;const k=r(_),[{value:x},{value:R}]=await m.getItems([_,k]);if(x==null)return;const F=(R==null?void 0:R.v)??1;if(F>w)throw Error(`Version downgrade detected (v${F} -> v${w}) for "${g}"`);if(F===w)return;console.debug(`[@wxt-dev/storage] Running storage migration for ${g}: v${F} -> v${w}`);const z=Array.from({length:w-F},(q,V)=>F+V+1);let J=x;for(const q of z)try{J=await((U=T==null?void 0:T[q])==null?void 0:U.call(T,J))??J}catch(V){throw new wT(g,q,{cause:V})}await m.setItems([{key:_,value:J},{key:k,value:{...R,v:w}}]),console.debug(`[@wxt-dev/storage] Storage migration completed for ${g} v${w}`,{migratedValue:J})},E=(v==null?void 0:v.migrations)==null?Promise.resolve():C().catch(k=>{console.error(`[@wxt-dev/storage] Migration failed for ${g}`,k)}),I=new yT,y=()=>(v==null?void 0:v.fallback)??(v==null?void 0:v.defaultValue)??null,b=()=>I.runExclusive(async()=>{const k=await m.getItem(_);if(k!=null||(v==null?void 0:v.init)==null)return k;const x=await v.init();return await m.setItem(_,x),x});return E.then(b),{key:g,get defaultValue(){return y()},get fallback(){return y()},getValue:async()=>(await E,v!=null&&v.init?await b():await a(m,_,v)),getMeta:async()=>(await E,await c(m,_)),setValue:async k=>(await E,await u(m,_,k)),setMeta:async k=>(await E,await d(m,_,k)),removeValue:async k=>(await E,await l(m,_,k)),removeMeta:async k=>(await E,await h(m,_,k)),watch:k=>f(m,_,(x,R)=>k(x??y(),R??y())),migrate:C}}}}function Cc(t){const e=()=>{if(kc.runtime==null)throw Error(["'wxt/storage' must be loaded in a web extension environment",`
- If thrown during a build, see https://github.com/wxt-dev/wxt/issues/371`,` - If thrown during tests, mock 'wxt/browser' correctly. See https://wxt.dev/guide/go-further/testing.html
`].join(`
`));if(kc.storage==null)throw Error("You must add the 'storage' permission to your manifest to use 'wxt/storage'");const r=kc.storage[t];if(r==null)throw Error(`"browser.storage.${t}" is undefined`);return r},n=new Set;return{getItem:async r=>(await e().get(r))[r],getItems:async r=>{const i=await e().get(r);return r.map(s=>({key:s,value:i[s]??null}))},setItem:async(r,i)=>{i==null?await e().remove(r):await e().set({[r]:i})},setItems:async r=>{const i=r.reduce((s,{key:o,value:a})=>(s[o]=a,s),{});await e().set(i)},removeItem:async r=>{await e().remove(r)},removeItems:async r=>{await e().remove(r)},clear:async()=>{await e().clear()},snapshot:async()=>await e().get(),restoreSnapshot:async r=>{await e().set(r)},watch(r,i){const s=o=>{const a=o[r];a!=null&&(Ed(a.newValue,a.oldValue)||i(a.newValue??null,a.oldValue??null))};return e().onChanged.addListener(s),n.add(s),()=>{e().onChanged.removeListener(s),n.delete(s)}},unwatch(){n.forEach(r=>{e().onChanged.removeListener(r)}),n.clear()}}}class wT extends Error{constructor(e,n,r){super(`v${n} migration failed for "${e}"`,r),this.key=e,this.version=n}}const ST=Ss.defineItem("local:analyticsEnabled",{fallback:!0});async function ET(){return ST.getValue()}var Tc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ic=typeof window>"u"||"Deno"in globalThis;function Fn(){}function kT(t,e){return typeof t=="function"?t(e):t}function CT(t){return typeof t=="number"&&t>=0&&t!==1/0}function TT(t,e){return Math.max(t+(e||0)-Date.now(),0)}function zg(t,e){return typeof t=="function"?t(e):t}function IT(t,e){return typeof t=="function"?t(e):t}function Vg(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==kd(o,e.options))return!1}else if(!Vo(e.queryKey,o))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||s&&!s(e))}function Kg(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(zo(e.options.mutationKey)!==zo(s))return!1}else if(!Vo(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function kd(t,e){return((e==null?void 0:e.queryKeyHashFn)||zo)(t)}function zo(t){return JSON.stringify(t,(e,n)=>Cd(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Vo(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(n=>!Vo(t[n],e[n])):!1}function Gg(t,e){if(t===e)return t;const n=Yg(t)&&Yg(e);if(n||Cd(t)&&Cd(e)){const r=n?t:Object.keys(t),i=r.length,s=n?e:Object.keys(e),o=s.length,a=n?[]:{};let c=0;for(let u=0;u<o;u++){const d=n?u:s[u];(!n&&r.includes(d)||n)&&t[d]===void 0&&e[d]===void 0?(a[d]=void 0,c++):(a[d]=Gg(t[d],e[d]),a[d]===t[d]&&t[d]!==void 0&&c++)}return i===o&&c===i?t:a}return e}function Yg(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Cd(t){if(!Zg(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!Zg(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Zg(t){return Object.prototype.toString.call(t)==="[object Object]"}function xT(t){return new Promise(e=>{setTimeout(e,t)})}function RT(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?Gg(t,e):e}function AT(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function PT(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var Td=Symbol();function Xg(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Td?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var MT=(KC=class extends Tc{constructor(){super();Me(this,ms);Me(this,Ii);Me(this,Oo);ve(this,Oo,e=>{if(!Ic&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){A(this,Ii)||this.setEventListener(A(this,Oo))}onUnsubscribe(){var e;this.hasListeners()||((e=A(this,Ii))==null||e.call(this),ve(this,Ii,void 0))}setEventListener(e){var n;ve(this,Oo,e),(n=A(this,Ii))==null||n.call(this),ve(this,Ii,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){A(this,ms)!==e&&(ve(this,ms,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof A(this,ms)=="boolean"?A(this,ms):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},ms=new WeakMap,Ii=new WeakMap,Oo=new WeakMap,KC),Jg=new MT,OT=(GC=class extends Tc{constructor(){super();Me(this,Lo,!0);Me(this,xi);Me(this,Do);ve(this,Do,e=>{if(!Ic&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){A(this,xi)||this.setEventListener(A(this,Do))}onUnsubscribe(){var e;this.hasListeners()||((e=A(this,xi))==null||e.call(this),ve(this,xi,void 0))}setEventListener(e){var n;ve(this,Do,e),(n=A(this,xi))==null||n.call(this),ve(this,xi,e(this.setOnline.bind(this)))}setOnline(e){A(this,Lo)!==e&&(ve(this,Lo,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return A(this,Lo)}},Lo=new WeakMap,xi=new WeakMap,Do=new WeakMap,GC),xc=new OT;function LT(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}function DT(t){return Math.min(1e3*2**t,3e4)}function Qg(t){return(t??"online")==="online"?xc.isOnline():!0}var em=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Id(t){return t instanceof em}function tm(t){let e=!1,n=0,r=!1,i;const s=LT(),o=g=>{var v;r||(h(new em(g)),(v=t.abort)==null||v.call(t))},a=()=>{e=!0},c=()=>{e=!1},u=()=>Jg.isFocused()&&(t.networkMode==="always"||xc.isOnline())&&t.canRun(),d=()=>Qg(t.networkMode)&&t.canRun(),l=g=>{var v;r||(r=!0,(v=t.onSuccess)==null||v.call(t,g),i==null||i(),s.resolve(g))},h=g=>{var v;r||(r=!0,(v=t.onError)==null||v.call(t,g),i==null||i(),s.reject(g))},f=()=>new Promise(g=>{var v;i=m=>{(r||u())&&g(m)},(v=t.onPause)==null||v.call(t)}).then(()=>{var g;i=void 0,r||(g=t.onContinue)==null||g.call(t)}),p=()=>{if(r)return;let g;const v=n===0?t.initialPromise:void 0;try{g=v??t.fn()}catch(m){g=Promise.reject(m)}Promise.resolve(g).then(l).catch(m=>{var E;if(r)return;const _=t.retry??(Ic?0:3),w=t.retryDelay??DT,T=typeof w=="function"?w(n,m):w,C=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,m);if(e||!C){h(m);return}n++,(E=t.onFail)==null||E.call(t,n,m),xT(T).then(()=>u()?void 0:f()).then(()=>{e?h(m):p()})})};return{promise:s,cancel:o,continue:()=>(i==null||i(),s),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?p():f().then(p),s)}}var NT=t=>setTimeout(t,0);function FT(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=NT;const s=a=>{e?t.push(a):i(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&i(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;e++;try{c=a()}finally{e--,e||o()}return c},batchCalls:a=>(...c)=>{s(()=>{a(...c)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var Kt=FT(),nm=(YC=class{constructor(){Me(this,vs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),CT(this.gcTime)&&ve(this,vs,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Ic?1/0:5*60*1e3))}clearGcTimeout(){A(this,vs)&&(clearTimeout(A(this,vs)),ve(this,vs,void 0))}},vs=new WeakMap,YC),$T=(ZC=class extends nm{constructor(e){super();Me(this,Xn);Me(this,No);Me(this,Fo);Me(this,Dn);Me(this,_s);Me(this,Vt);Me(this,wc);Me(this,ys);ve(this,ys,!1),ve(this,wc,e.defaultOptions),this.setOptions(e.options),this.observers=[],ve(this,_s,e.client),ve(this,Dn,A(this,_s).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,ve(this,No,BT(this.options)),this.state=e.state??A(this,No),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=A(this,Vt))==null?void 0:e.promise}setOptions(e){this.options={...A(this,wc),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&A(this,Dn).remove(this)}setData(e,n){const r=RT(this.state.data,e,this.options);return st(this,Xn,Xr).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){st(this,Xn,Xr).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=A(this,Vt))==null?void 0:r.promise;return(i=A(this,Vt))==null||i.cancel(e),n?n.then(Fn).catch(Fn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(A(this,No))}isActive(){return this.observers.some(e=>IT(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Td||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!TT(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=A(this,Vt))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=A(this,Vt))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),A(this,Dn).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(A(this,Vt)&&(A(this,ys)?A(this,Vt).cancel({revert:!0}):A(this,Vt).cancelRetry()),this.scheduleGc()),A(this,Dn).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||st(this,Xn,Xr).call(this,{type:"invalidate"})}fetch(e,n){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(A(this,Vt))return A(this,Vt).continueRetry(),A(this,Vt).promise}if(e&&this.setOptions(e),!this.options.queryFn){const l=this.observers.find(h=>h.options.queryFn);l&&this.setOptions(l.options)}const r=new AbortController,i=l=>{Object.defineProperty(l,"signal",{enumerable:!0,get:()=>(ve(this,ys,!0),r.signal)})},s=()=>{const l=Xg(this.options,n),h={client:A(this,_s),queryKey:this.queryKey,meta:this.meta};return i(h),ve(this,ys,!1),this.options.persister?this.options.persister(l,h,this):l(h)},o={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:A(this,_s),state:this.state,fetchFn:s};i(o),(c=this.options.behavior)==null||c.onFetch(o,this),ve(this,Fo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&st(this,Xn,Xr).call(this,{type:"fetch",meta:(d=o.fetchOptions)==null?void 0:d.meta});const a=l=>{var h,f,p,g;Id(l)&&l.silent||st(this,Xn,Xr).call(this,{type:"error",error:l}),Id(l)||((f=(h=A(this,Dn).config).onError)==null||f.call(h,l,this),(g=(p=A(this,Dn).config).onSettled)==null||g.call(p,this.state.data,l,this)),this.scheduleGc()};return ve(this,Vt,tm({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:l=>{var h,f,p,g;if(l===void 0){a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(l)}catch(v){a(v);return}(f=(h=A(this,Dn).config).onSuccess)==null||f.call(h,l,this),(g=(p=A(this,Dn).config).onSettled)==null||g.call(p,l,this.state.error,this),this.scheduleGc()},onError:a,onFail:(l,h)=>{st(this,Xn,Xr).call(this,{type:"failed",failureCount:l,error:h})},onPause:()=>{st(this,Xn,Xr).call(this,{type:"pause"})},onContinue:()=>{st(this,Xn,Xr).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),A(this,Vt).start()}},No=new WeakMap,Fo=new WeakMap,Dn=new WeakMap,_s=new WeakMap,Vt=new WeakMap,wc=new WeakMap,ys=new WeakMap,Xn=new WeakSet,Xr=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...UT(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return Id(i)&&i.revert&&A(this,Fo)?{...A(this,Fo),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Kt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),A(this,Dn).notify({query:this,type:"updated",action:e})})},ZC);function UT(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Qg(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function BT(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var jT=(XC=class extends Tc{constructor(e={}){super();Me(this,gr);this.config=e,ve(this,gr,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??kd(i,n);let o=this.get(s);return o||(o=new $T({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){A(this,gr).has(e.queryHash)||(A(this,gr).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=A(this,gr).get(e.queryHash);n&&(e.destroy(),n===e&&A(this,gr).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Kt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return A(this,gr).get(e)}getAll(){return[...A(this,gr).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>Vg(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>Vg(e,r)):n}notify(e){Kt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Kt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Kt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},gr=new WeakMap,XC),HT=(JC=class extends nm{constructor(e){super();Me(this,vr);Me(this,mr);Me(this,on);Me(this,bs);this.mutationId=e.mutationId,ve(this,on,e.mutationCache),ve(this,mr,[]),this.state=e.state||qT(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){A(this,mr).includes(e)||(A(this,mr).push(e),this.clearGcTimeout(),A(this,on).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){ve(this,mr,A(this,mr).filter(n=>n!==e)),this.scheduleGc(),A(this,on).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){A(this,mr).length||(this.state.status==="pending"?this.scheduleGc():A(this,on).remove(this))}continue(){var e;return((e=A(this,bs))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,s,o,a,c,u,d,l,h,f,p,g,v,m,_,w,T,C,E,I;ve(this,bs,tm({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(y,b)=>{st(this,vr,Li).call(this,{type:"failed",failureCount:y,error:b})},onPause:()=>{st(this,vr,Li).call(this,{type:"pause"})},onContinue:()=>{st(this,vr,Li).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>A(this,on).canRun(this)}));const n=this.state.status==="pending",r=!A(this,bs).canStart();try{if(!n){st(this,vr,Li).call(this,{type:"pending",variables:e,isPaused:r}),await((s=(i=A(this,on).config).onMutate)==null?void 0:s.call(i,e,this));const b=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e));b!==this.state.context&&st(this,vr,Li).call(this,{type:"pending",context:b,variables:e,isPaused:r})}const y=await A(this,bs).start();return await((u=(c=A(this,on).config).onSuccess)==null?void 0:u.call(c,y,e,this.state.context,this)),await((l=(d=this.options).onSuccess)==null?void 0:l.call(d,y,e,this.state.context)),await((f=(h=A(this,on).config).onSettled)==null?void 0:f.call(h,y,null,this.state.variables,this.state.context,this)),await((g=(p=this.options).onSettled)==null?void 0:g.call(p,y,null,e,this.state.context)),st(this,vr,Li).call(this,{type:"success",data:y}),y}catch(y){try{throw await((m=(v=A(this,on).config).onError)==null?void 0:m.call(v,y,e,this.state.context,this)),await((w=(_=this.options).onError)==null?void 0:w.call(_,y,e,this.state.context)),await((C=(T=A(this,on).config).onSettled)==null?void 0:C.call(T,void 0,y,this.state.variables,this.state.context,this)),await((I=(E=this.options).onSettled)==null?void 0:I.call(E,void 0,y,e,this.state.context)),y}finally{st(this,vr,Li).call(this,{type:"error",error:y})}}finally{A(this,on).runNext(this)}}},mr=new WeakMap,on=new WeakMap,bs=new WeakMap,vr=new WeakSet,Li=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Kt.batch(()=>{A(this,mr).forEach(r=>{r.onMutationUpdate(e)}),A(this,on).notify({mutation:this,type:"updated",action:e})})},JC);function qT(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var WT=(QC=class extends Tc{constructor(e={}){super();Me(this,Yr);Me(this,Jn);Me(this,Sc);this.config=e,ve(this,Yr,new Set),ve(this,Jn,new Map),ve(this,Sc,0)}build(e,n,r){const i=new HT({mutationCache:this,mutationId:++bd(this,Sc)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){A(this,Yr).add(e);const n=Rc(e);if(typeof n=="string"){const r=A(this,Jn).get(n);r?r.push(e):A(this,Jn).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(A(this,Yr).delete(e)){const n=Rc(e);if(typeof n=="string"){const r=A(this,Jn).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&A(this,Jn).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=Rc(e);if(typeof n=="string"){const r=A(this,Jn).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=Rc(e);if(typeof n=="string"){const i=(r=A(this,Jn).get(n))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Kt.batch(()=>{A(this,Yr).forEach(e=>{this.notify({type:"removed",mutation:e})}),A(this,Yr).clear(),A(this,Jn).clear()})}getAll(){return Array.from(A(this,Yr))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>Kg(n,r))}findAll(e={}){return this.getAll().filter(n=>Kg(e,n))}notify(e){Kt.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Kt.batch(()=>Promise.all(e.map(n=>n.continue().catch(Fn))))}},Yr=new WeakMap,Jn=new WeakMap,Sc=new WeakMap,QC);function Rc(t){var e;return(e=t.options.scope)==null?void 0:e.id}function rm(t){return{onFetch:(e,n)=>{var d,l,h,f,p;const r=e.options,i=(h=(l=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:l.fetchMore)==null?void 0:h.direction,s=((f=e.state.data)==null?void 0:f.pages)||[],o=((p=e.state.data)==null?void 0:p.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let g=!1;const v=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(e.signal.aborted?g=!0:e.signal.addEventListener("abort",()=>{g=!0}),e.signal)})},m=Xg(e.options,e.fetchOptions),_=async(w,T,C)=>{if(g)return Promise.reject();if(T==null&&w.pages.length)return Promise.resolve(w);const E={client:e.client,queryKey:e.queryKey,pageParam:T,direction:C?"backward":"forward",meta:e.options.meta};v(E);const I=await m(E),{maxPages:y}=e.options,b=C?PT:AT;return{pages:b(w.pages,I,y),pageParams:b(w.pageParams,T,y)}};if(i&&s.length){const w=i==="backward",T=w?zT:im,C={pages:s,pageParams:o},E=T(r,C);a=await _(C,E,w)}else{const w=t??s.length;do{const T=c===0?o[0]??r.initialPageParam:im(r,a);if(c>0&&T==null)break;a=await _(a,T),c++}while(c<w)}return a};e.options.persister?e.fetchFn=()=>{var g,v;return(v=(g=e.options).persister)==null?void 0:v.call(g,u,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=u}}}function im(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function zT(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var VT=(eT=class{constructor(t={}){Me(this,ht);Me(this,Ri);Me(this,Ai);Me(this,$o);Me(this,Uo);Me(this,Pi);Me(this,Bo);Me(this,jo);ve(this,ht,t.queryCache||new jT),ve(this,Ri,t.mutationCache||new WT),ve(this,Ai,t.defaultOptions||{}),ve(this,$o,new Map),ve(this,Uo,new Map),ve(this,Pi,0)}mount(){bd(this,Pi)._++,A(this,Pi)===1&&(ve(this,Bo,Jg.subscribe(async t=>{t&&(await this.resumePausedMutations(),A(this,ht).onFocus())})),ve(this,jo,xc.subscribe(async t=>{t&&(await this.resumePausedMutations(),A(this,ht).onOnline())})))}unmount(){var t,e;bd(this,Pi)._--,A(this,Pi)===0&&((t=A(this,Bo))==null||t.call(this),ve(this,Bo,void 0),(e=A(this,jo))==null||e.call(this),ve(this,jo,void 0))}isFetching(t){return A(this,ht).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return A(this,Ri).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=A(this,ht).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=A(this,ht).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(zg(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return A(this,ht).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=A(this,ht).get(r.queryHash),s=i==null?void 0:i.state.data,o=kT(e,s);if(o!==void 0)return A(this,ht).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Kt.batch(()=>A(this,ht).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=A(this,ht).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=A(this,ht);Kt.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=A(this,ht);return Kt.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Kt.batch(()=>A(this,ht).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Fn).catch(Fn)}invalidateQueries(t,e={}){return Kt.batch(()=>(A(this,ht).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Kt.batch(()=>A(this,ht).findAll(t).filter(i=>!i.isDisabled()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Fn)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Fn)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=A(this,ht).build(this,e);return n.isStaleByTime(zg(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Fn).catch(Fn)}fetchInfiniteQuery(t){return t.behavior=rm(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Fn).catch(Fn)}ensureInfiniteQueryData(t){return t.behavior=rm(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return xc.isOnline()?A(this,Ri).resumePausedMutations():Promise.resolve()}getQueryCache(){return A(this,ht)}getMutationCache(){return A(this,Ri)}getDefaultOptions(){return A(this,Ai)}setDefaultOptions(t){ve(this,Ai,t)}setQueryDefaults(t,e){A(this,$o).set(zo(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...A(this,$o).values()],n={};return e.forEach(r=>{Vo(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){A(this,Uo).set(zo(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...A(this,Uo).values()],n={};return e.forEach(r=>{Vo(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...A(this,Ai).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=kd(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Td&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...A(this,Ai).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){A(this,ht).clear(),A(this,Ri).clear()}},ht=new WeakMap,Ri=new WeakMap,Ai=new WeakMap,$o=new WeakMap,Uo=new WeakMap,Pi=new WeakMap,Bo=new WeakMap,jo=new WeakMap,eT);function KT(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xd={exports:{}},Ie={};/**
* @license React
* react.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var sm;function GT(){if(sm)return Ie;sm=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),l=Symbol.iterator;function h(S){return S===null||typeof S!="object"?null:(S=l&&S[l]||S["@@iterator"],typeof S=="function"?S:null)}var f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},p=Object.assign,g={};function v(S,P,N){this.props=S,this.context=P,this.refs=g,this.updater=N||f}v.prototype.isReactComponent={},v.prototype.setState=function(S,P){if(typeof S!="object"&&typeof S!="function"&&S!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,S,P,"setState")},v.prototype.forceUpdate=function(S){this.updater.enqueueForceUpdate(this,S,"forceUpdate")};function m(){}m.prototype=v.prototype;function _(S,P,N){this.props=S,this.context=P,this.refs=g,this.updater=N||f}var w=_.prototype=new m;w.constructor=_,p(w,v.prototype),w.isPureReactComponent=!0;var T=Array.isArray,C={H:null,A:null,T:null,S:null,V:null},E=Object.prototype.hasOwnProperty;function I(S,P,N,O,W,te){return N=te.ref,{$$typeof:t,type:S,key:P,ref:N!==void 0?N:null,props:te}}function y(S,P){return I(S.type,P,void 0,void 0,void 0,S.props)}function b(S){return typeof S=="object"&&S!==null&&S.$$typeof===t}function k(S){var P={"=":"=0",":":"=2"};return"$"+S.replace(/[=:]/g,function(N){return P[N]})}var x=/\/+/g;function R(S,P){return typeof S=="object"&&S!==null&&S.key!=null?k(""+S.key):P.toString(36)}function F(){}function z(S){switch(S.status){case"fulfilled":return S.value;case"rejected":throw S.reason;default:switch(typeof S.status=="string"?S.then(F,F):(S.status="pending",S.then(function(P){S.status==="pending"&&(S.status="fulfilled",S.value=P)},function(P){S.status==="pending"&&(S.status="rejected",S.reason=P)})),S.status){case"fulfilled":return S.value;case"rejected":throw S.reason}}throw S}function J(S,P,N,O,W){var te=typeof S;(te==="undefined"||te==="boolean")&&(S=null);var K=!1;if(S===null)K=!0;else switch(te){case"bigint":case"string":case"number":K=!0;break;case"object":switch(S.$$typeof){case t:case e:K=!0;break;case d:return K=S._init,J(K(S._payload),P,N,O,W)}}if(K)return W=W(S),K=O===""?"."+R(S,0):O,T(W)?(N="",K!=null&&(N=K.replace(x,"$&/")+"/"),J(W,P,N,"",function(Se){return Se})):W!=null&&(b(W)&&(W=y(W,N+(W.key==null||S&&S.key===W.key?"":(""+W.key).replace(x,"$&/")+"/")+K)),P.push(W)),1;K=0;var Ue=O===""?".":O+":";if(T(S))for(var ee=0;ee<S.length;ee++)O=S[ee],te=Ue+R(O,ee),K+=J(O,P,N,te,W);else if(ee=h(S),typeof ee=="function")for(S=ee.call(S),ee=0;!(O=S.next()).done;)O=O.value,te=Ue+R(O,ee++),K+=J(O,P,N,te,W);else if(te==="object"){if(typeof S.then=="function")return J(z(S),P,N,O,W);throw P=String(S),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(S).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return K}function U(S,P,N){if(S==null)return S;var O=[],W=0;return J(S,O,"","",function(te){return P.call(N,te,W++)}),O}function q(S){if(S._status===-1){var P=S._result;P=P(),P.then(function(N){(S._status===0||S._status===-1)&&(S._status=1,S._result=N)},function(N){(S._status===0||S._status===-1)&&(S._status=2,S._result=N)}),S._status===-1&&(S._status=0,S._result=P)}if(S._status===1)return S._result.default;throw S._result}var V=typeof reportError=="function"?reportError:function(S){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var P=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof S=="object"&&S!==null&&typeof S.message=="string"?String(S.message):String(S),error:S});if(!window.dispatchEvent(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",S);return}console.error(S)};function j(){}return Ie.Children={map:U,forEach:function(S,P,N){U(S,function(){P.apply(this,arguments)},N)},count:function(S){var P=0;return U(S,function(){P++}),P},toArray:function(S){return U(S,function(P){return P})||[]},only:function(S){if(!b(S))throw Error("React.Children.only expected to receive a single React element child.");return S}},Ie.Component=v,Ie.Fragment=n,Ie.Profiler=i,Ie.PureComponent=_,Ie.StrictMode=r,Ie.Suspense=c,Ie.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,Ie.__COMPILER_RUNTIME={__proto__:null,c:function(S){return C.H.useMemoCache(S)}},Ie.cache=function(S){return function(){return S.apply(null,arguments)}},Ie.cloneElement=function(S,P,N){if(S==null)throw Error("The argument must be a React element, but you passed "+S+".");var O=p({},S.props),W=S.key,te=void 0;if(P!=null)for(K in P.ref!==void 0&&(te=void 0),P.key!==void 0&&(W=""+P.key),P)!E.call(P,K)||K==="key"||K==="__self"||K==="__source"||K==="ref"&&P.ref===void 0||(O[K]=P[K]);var K=arguments.length-2;if(K===1)O.children=N;else if(1<K){for(var Ue=Array(K),ee=0;ee<K;ee++)Ue[ee]=arguments[ee+2];O.children=Ue}return I(S.type,W,void 0,void 0,te,O)},Ie.createContext=function(S){return S={$$typeof:o,_currentValue:S,_currentValue2:S,_threadCount:0,Provider:null,Consumer:null},S.Provider=S,S.Consumer={$$typeof:s,_context:S},S},Ie.createElement=function(S,P,N){var O,W={},te=null;if(P!=null)for(O in P.key!==void 0&&(te=""+P.key),P)E.call(P,O)&&O!=="key"&&O!=="__self"&&O!=="__source"&&(W[O]=P[O]);var K=arguments.length-2;if(K===1)W.children=N;else if(1<K){for(var Ue=Array(K),ee=0;ee<K;ee++)Ue[ee]=arguments[ee+2];W.children=Ue}if(S&&S.defaultProps)for(O in K=S.defaultProps,K)W[O]===void 0&&(W[O]=K[O]);return I(S,te,void 0,void 0,null,W)},Ie.createRef=function(){return{current:null}},Ie.forwardRef=function(S){return{$$typeof:a,render:S}},Ie.isValidElement=b,Ie.lazy=function(S){return{$$typeof:d,_payload:{_status:-1,_result:S},_init:q}},Ie.memo=function(S,P){return{$$typeof:u,type:S,compare:P===void 0?null:P}},Ie.startTransition=function(S){var P=C.T,N={};C.T=N;try{var O=S(),W=C.S;W!==null&&W(N,O),typeof O=="object"&&O!==null&&typeof O.then=="function"&&O.then(j,V)}catch(te){V(te)}finally{C.T=P}},Ie.unstable_useCacheRefresh=function(){return C.H.useCacheRefresh()},Ie.use=function(S){return C.H.use(S)},Ie.useActionState=function(S,P,N){return C.H.useActionState(S,P,N)},Ie.useCallback=function(S,P){return C.H.useCallback(S,P)},Ie.useContext=function(S){return C.H.useContext(S)},Ie.useDebugValue=function(){},Ie.useDeferredValue=function(S,P){return C.H.useDeferredValue(S,P)},Ie.useEffect=function(S,P,N){var O=C.H;if(typeof N=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return O.useEffect(S,P)},Ie.useId=function(){return C.H.useId()},Ie.useImperativeHandle=function(S,P,N){return C.H.useImperativeHandle(S,P,N)},Ie.useInsertionEffect=function(S,P){return C.H.useInsertionEffect(S,P)},Ie.useLayoutEffect=function(S,P){return C.H.useLayoutEffect(S,P)},Ie.useMemo=function(S,P){return C.H.useMemo(S,P)},Ie.useOptimistic=function(S,P){return C.H.useOptimistic(S,P)},Ie.useReducer=function(S,P,N){return C.H.useReducer(S,P,N)},Ie.useRef=function(S){return C.H.useRef(S)},Ie.useState=function(S){return C.H.useState(S)},Ie.useSyncExternalStore=function(S,P,N){return C.H.useSyncExternalStore(S,P,N)},Ie.useTransition=function(){return C.H.useTransition()},Ie.version="19.1.0",Ie}var om;function YT(){return om||(om=1,xd.exports=GT()),xd.exports}var ZT=YT();const am=KT(ZT),Ac=new VT({defaultOptions:{queries:{staleTime:2*60*1e3,gcTime:1/0}}});var XT=t=>{let e=Object.keys(t).sort((n,r)=>n.localeCompare(r));if(e.some(n=>n.startsWith("_")))throw new Error('Keys that start with "_" are reserved for Query Key Factory');return e};function Rt(t){return Object.assign(Object.create(null),t)}function cm(t,e){let n={_def:[t]};if(e==null)return Rt(n);let r=(s,o)=>XT(s).reduce((a,c)=>{let u=s[c],d=[...o,c],l=f=>Array.isArray(f),h;if(typeof u=="function"){let f=(...p)=>{let g=u(...p);if(l(g))return Rt({queryKey:[...d,...g]});let v=[...d,...g.queryKey];if("queryFn"in g){let m={queryKey:v,queryFn:g.queryFn};if("contextQueries"in g){let _=r(g.contextQueries,v);return Rt({_ctx:Rt(Object.fromEntries(_)),...m})}return Rt({...m})}if("contextQueries"in g){let m=r(g.contextQueries,v);return Rt({_ctx:Rt(Object.fromEntries(m)),queryKey:v})}return Rt({queryKey:v})};f._def=d,h=f}else if(u==null)h=Rt({queryKey:d});else if(l(u))h=Rt({_def:d,queryKey:[...d,...u]});else if("queryFn"in u){let f={...u.queryKey?{_def:d}:void 0},p=[...d,...u.queryKey??[]],g={queryKey:p,queryFn:u.queryFn};if("contextQueries"in u){let v=r(u.contextQueries,p);h=Rt({_ctx:Rt(Object.fromEntries(v)),...f,...g})}else h=Rt({...f,...g})}else if("contextQueries"in u){let f={...u.queryKey?{_def:d}:void 0},p=[...d,...u.queryKey??[]],g=r(u.contextQueries,p);h=Rt({_ctx:Rt(Object.fromEntries(g)),queryKey:p,...f})}else{let f={...u.queryKey?{_def:d}:void 0},p=[...d,...u.queryKey??[]];h=Rt({queryKey:p,...f})}return a.set(c,h),a},new Map),i=r(e,n._def);return Rt({...Object.fromEntries(i),...n})}function JT(t){let e=Object.keys(t).reduce((n,r)=>{let i=t[r],s=i?cm(r,i):cm(r);return n.set(r,s),n},new Map);return Rt(Object.fromEntries(e))}const Pc=JT({users:{me:null}});function QT(){return Ac.getQueryData(Pc.users.me.queryKey)}function eI(){Ac.resetQueries({queryKey:Pc.users.me.queryKey})}function tI(t){Ac.setQueryData(Pc.users.me.queryKey,t)}function nI(t){return Ac.getQueryCache().subscribe(e=>{(e.type==="added"||e.type==="removed"||e.type==="updated")&&e.query.queryKey===Pc.users.me.queryKey&&t(e.query.state.data)})}function rI(t){const e=QT();if(e)t(e);else{const n=nI(r=>{r&&(t(r),n())})}}var je;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},t.getValidEnumValues=i=>{const s=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(s){return i[s]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},t.find=(i,s)=>{for(const o of i)if(s(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}t.joinValues=r,t.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(je||(je={}));var Rd;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(Rd||(Rd={}));const Q=je.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),yr=t=>{switch(typeof t){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return isNaN(t)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"symbol":return Q.symbol;case"object":return Array.isArray(t)?Q.array:t===null?Q.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Q.promise:typeof Map<"u"&&t instanceof Map?Q.map:typeof Set<"u"&&t instanceof Set?Q.set:typeof Date<"u"&&t instanceof Date?Q.date:Q.object;default:return Q.unknown}},$=je.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),iI=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class gn extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,c=0;for(;c<o.path.length;){const u=o.path[c];c===o.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(n(o))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return i(this),r}static assert(e){if(!(e instanceof gn))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,je.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}gn.create=t=>new gn(t);const Es=(t,e)=>{let n;switch(t.code){case $.invalid_type:t.received===Q.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case $.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,je.jsonStringifyReplacer)}`;break;case $.unrecognized_keys:n=`Unrecognized key(s) in object: ${je.joinValues(t.keys,", ")}`;break;case $.invalid_union:n="Invalid input";break;case $.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${je.joinValues(t.options)}`;break;case $.invalid_enum_value:n=`Invalid enum value. Expected ${je.joinValues(t.options)}, received '${t.received}'`;break;case $.invalid_arguments:n="Invalid function arguments";break;case $.invalid_return_type:n="Invalid function return type";break;case $.invalid_date:n="Invalid date";break;case $.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:je.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case $.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case $.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case $.custom:n="Invalid input";break;case $.invalid_intersection_types:n="Intersection results could not be merged";break;case $.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case $.not_finite:n="Number must be finite";break;default:n=e.defaultError,je.assertNever(t)}return{message:n}};let um=Es;function sI(t){um=t}function Mc(){return um}const Oc=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)a=u(o,{data:e,defaultError:a}).message;return{...i,path:s,message:a}},oI=[];function Y(t,e){const n=Mc(),r=Oc({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Es?void 0:Es].filter(i=>!!i)});t.common.issues.push(r)}class jt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return me;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return jt.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return me;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:e.value,value:r}}}const me=Object.freeze({status:"aborted"}),ks=t=>({status:"dirty",value:t}),Gt=t=>({status:"valid",value:t}),Ad=t=>t.status==="aborted",Pd=t=>t.status==="dirty",Di=t=>t.status==="valid",Ko=t=>typeof Promise<"u"&&t instanceof Promise;function Lc(t,e,n,r){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function lm(t,e,n,r,i){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}typeof SuppressedError=="function"&&SuppressedError;var re;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(re||(re={}));var Go,Yo;class tr{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const dm=(t,e)=>{if(Di(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new gn(t.common.issues);return this._error=n,this._error}}};function Te(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,a)=>{var c,u;const{message:d}=t;return o.code==="invalid_enum_value"?{message:d??a.defaultError}:typeof a.data>"u"?{message:(c=d??r)!==null&&c!==void 0?c:a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:a.defaultError}},description:i}}class xe{get description(){return this._def.description}_getType(e){return yr(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:yr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new jt,ctx:{common:e.parent.common,data:e.data,parsedType:yr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Ko(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:yr(e)},s=this._parseSync({data:e,path:i.path,parent:i});return dm(i,s)}"~validate"(e){var n,r;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:yr(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:i});return Di(s)?{value:s.value}:{issues:i.common.issues}}catch(s){!((r=(n=s==null?void 0:s.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(s=>Di(s)?{value:s.value}:{issues:i.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:yr(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(Ko(i)?i:Promise.resolve(i));return dm(r,s)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=e(i),a=()=>s.addIssue({code:$.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new Bn({schema:this,typeName:he.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return rr.create(this,this._def)}nullable(){return ti.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Un.create(this)}promise(){return xs.create(this,this._def)}or(e){return Qo.create([this,e],this._def)}and(e){return ea.create(this,e,this._def)}transform(e){return new Bn({...Te(this._def),schema:this,typeName:he.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new sa({...Te(this._def),innerType:this,defaultValue:n,typeName:he.ZodDefault})}brand(){return new Ld({typeName:he.ZodBranded,type:this,...Te(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new oa({...Te(this._def),innerType:this,catchValue:n,typeName:he.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return aa.create(this,e)}readonly(){return ca.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const aI=/^c[^\s-]{8,}$/i,cI=/^[0-9a-z]+$/,uI=/^[0-9A-HJKMNP-TV-Z]{26}$/i,lI=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,dI=/^[a-z0-9_-]{21}$/i,fI=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,hI=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,pI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,gI="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Md;const mI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,vI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,_I=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,yI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,bI=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,wI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fm="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",SI=new RegExp(`^${fm}$`);function hm(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function EI(t){return new RegExp(`^${hm(t)}$`)}function pm(t){let e=`${fm}T${hm(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function kI(t,e){return!!((e==="v4"||!e)&&mI.test(t)||(e==="v6"||!e)&&_I.test(t))}function CI(t,e){if(!fI.test(t))return!1;try{const[n]=t.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function TI(t,e){return!!((e==="v4"||!e)&&vI.test(t)||(e==="v6"||!e)&&yI.test(t))}class $n extends xe{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Q.string){const s=this._getOrReturnCtx(e);return Y(s,{code:$.invalid_type,expected:Q.string,received:s.parsedType}),me}const r=new jt;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),Y(i,{code:$.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),Y(i,{code:$.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=e.data.length>s.value,a=e.data.length<s.value;(o||a)&&(i=this._getOrReturnCtx(e,i),o?Y(i,{code:$.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&Y(i,{code:$.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")pI.test(e.data)||(i=this._getOrReturnCtx(e,i),Y(i,{validation:"email",code:$.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Md||(Md=new RegExp(gI,"u")),Md.test(e.data)||(i=this._getOrReturnCtx(e,i),Y(i,{validation:"emoji",code:$.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")lI.test(e.data)||(i=this._getOrReturnCtx(e,i),Y(i,{validation:"uuid",code:$.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")dI.test(e.data)||(i=this._getOrReturnCtx(e,i),Y(i,{validation:"nanoid",code:$.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")aI.test(e.data)||(i=this._getOrReturnCtx(e,i),Y(i,{validation:"cuid",code:$.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")cI.test(e.data)||(i=this._getOrReturnCtx(e,i),Y(i,{validation:"cuid2",code:$.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")uI.test(e.data)||(i=this._getOrReturnCtx(e,i),Y(i,{validation:"ulid",code:$.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),Y(i,{validation:"url",code:$.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),Y(i,{validation:"regex",code:$.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),Y(i,{code:$.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),Y(i,{code:$.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),Y(i,{code:$.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?pm(s).test(e.data)||(i=this._getOrReturnCtx(e,i),Y(i,{code:$.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?SI.test(e.data)||(i=this._getOrReturnCtx(e,i),Y(i,{code:$.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?EI(s).test(e.data)||(i=this._getOrReturnCtx(e,i),Y(i,{code:$.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?hI.test(e.data)||(i=this._getOrReturnCtx(e,i),Y(i,{validation:"duration",code:$.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?kI(e.data,s.version)||(i=this._getOrReturnCtx(e,i),Y(i,{validation:"ip",code:$.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?CI(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),Y(i,{validation:"jwt",code:$.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?TI(e.data,s.version)||(i=this._getOrReturnCtx(e,i),Y(i,{validation:"cidr",code:$.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?bI.test(e.data)||(i=this._getOrReturnCtx(e,i),Y(i,{validation:"base64",code:$.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?wI.test(e.data)||(i=this._getOrReturnCtx(e,i),Y(i,{validation:"base64url",code:$.invalid_string,message:s.message}),r.dirty()):je.assertNever(s);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(i=>e.test(i),{validation:n,code:$.invalid_string,...re.errToObj(r)})}_addCheck(e){return new $n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...re.errToObj(e)})}url(e){return this._addCheck({kind:"url",...re.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...re.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...re.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...re.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...re.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...re.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...re.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...re.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...re.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...re.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...re.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...re.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...re.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...re.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...re.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...re.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...re.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...re.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...re.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...re.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...re.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...re.errToObj(n)})}nonempty(e){return this.min(1,re.errToObj(e))}trim(){return new $n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new $n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new $n({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}$n.create=t=>{var e;return new $n({checks:[],typeName:he.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Te(t)})};function II(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,s=parseInt(t.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return s%o/Math.pow(10,i)}class Jr extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Q.number){const s=this._getOrReturnCtx(e);return Y(s,{code:$.invalid_type,expected:Q.number,received:s.parsedType}),me}let r;const i=new jt;for(const s of this._def.checks)s.kind==="int"?je.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Y(r,{code:$.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),Y(r,{code:$.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),Y(r,{code:$.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?II(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),Y(r,{code:$.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Y(r,{code:$.not_finite,message:s.message}),i.dirty()):je.assertNever(s);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,re.toString(n))}gt(e,n){return this.setLimit("min",e,!1,re.toString(n))}lte(e,n){return this.setLimit("max",e,!0,re.toString(n))}lt(e,n){return this.setLimit("max",e,!1,re.toString(n))}setLimit(e,n,r,i){return new Jr({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:re.toString(i)}]})}_addCheck(e){return new Jr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:re.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:re.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:re.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:re.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:re.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&je.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Jr.create=t=>new Jr({checks:[],typeName:he.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Te(t)});class Qr extends xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Q.bigint)return this._getInvalidInput(e);let r;const i=new jt;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),Y(r,{code:$.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),Y(r,{code:$.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Y(r,{code:$.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):je.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return Y(n,{code:$.invalid_type,expected:Q.bigint,received:n.parsedType}),me}gte(e,n){return this.setLimit("min",e,!0,re.toString(n))}gt(e,n){return this.setLimit("min",e,!1,re.toString(n))}lte(e,n){return this.setLimit("max",e,!0,re.toString(n))}lt(e,n){return this.setLimit("max",e,!1,re.toString(n))}setLimit(e,n,r,i){return new Qr({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:re.toString(i)}]})}_addCheck(e){return new Qr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:re.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Qr.create=t=>{var e;return new Qr({checks:[],typeName:he.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Te(t)})};class Zo extends xe{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Q.boolean){const r=this._getOrReturnCtx(e);return Y(r,{code:$.invalid_type,expected:Q.boolean,received:r.parsedType}),me}return Gt(e.data)}}Zo.create=t=>new Zo({typeName:he.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Te(t)});class Ni extends xe{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Q.date){const s=this._getOrReturnCtx(e);return Y(s,{code:$.invalid_type,expected:Q.date,received:s.parsedType}),me}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Y(s,{code:$.invalid_date}),me}const r=new jt;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),Y(i,{code:$.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),Y(i,{code:$.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):je.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ni({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:re.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:re.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Ni.create=t=>new Ni({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:he.ZodDate,...Te(t)});class Dc extends xe{_parse(e){if(this._getType(e)!==Q.symbol){const r=this._getOrReturnCtx(e);return Y(r,{code:$.invalid_type,expected:Q.symbol,received:r.parsedType}),me}return Gt(e.data)}}Dc.create=t=>new Dc({typeName:he.ZodSymbol,...Te(t)});class Xo extends xe{_parse(e){if(this._getType(e)!==Q.undefined){const r=this._getOrReturnCtx(e);return Y(r,{code:$.invalid_type,expected:Q.undefined,received:r.parsedType}),me}return Gt(e.data)}}Xo.create=t=>new Xo({typeName:he.ZodUndefined,...Te(t)});class Jo extends xe{_parse(e){if(this._getType(e)!==Q.null){const r=this._getOrReturnCtx(e);return Y(r,{code:$.invalid_type,expected:Q.null,received:r.parsedType}),me}return Gt(e.data)}}Jo.create=t=>new Jo({typeName:he.ZodNull,...Te(t)});class Cs extends xe{constructor(){super(...arguments),this._any=!0}_parse(e){return Gt(e.data)}}Cs.create=t=>new Cs({typeName:he.ZodAny,...Te(t)});class Fi extends xe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Gt(e.data)}}Fi.create=t=>new Fi({typeName:he.ZodUnknown,...Te(t)});class br extends xe{_parse(e){const n=this._getOrReturnCtx(e);return Y(n,{code:$.invalid_type,expected:Q.never,received:n.parsedType}),me}}br.create=t=>new br({typeName:he.ZodNever,...Te(t)});class Nc extends xe{_parse(e){if(this._getType(e)!==Q.undefined){const r=this._getOrReturnCtx(e);return Y(r,{code:$.invalid_type,expected:Q.void,received:r.parsedType}),me}return Gt(e.data)}}Nc.create=t=>new Nc({typeName:he.ZodVoid,...Te(t)});class Un extends xe{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==Q.array)return Y(n,{code:$.invalid_type,expected:Q.array,received:n.parsedType}),me;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(o||a)&&(Y(n,{code:o?$.too_big:$.too_small,minimum:a?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(Y(n,{code:$.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(Y(n,{code:$.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>i.type._parseAsync(new tr(n,o,n.path,a)))).then(o=>jt.mergeArray(r,o));const s=[...n.data].map((o,a)=>i.type._parseSync(new tr(n,o,n.path,a)));return jt.mergeArray(r,s)}get element(){return this._def.type}min(e,n){return new Un({...this._def,minLength:{value:e,message:re.toString(n)}})}max(e,n){return new Un({...this._def,maxLength:{value:e,message:re.toString(n)}})}length(e,n){return new Un({...this._def,exactLength:{value:e,message:re.toString(n)}})}nonempty(e){return this.min(1,e)}}Un.create=(t,e)=>new Un({type:t,minLength:null,maxLength:null,exactLength:null,typeName:he.ZodArray,...Te(e)});function Ts(t){if(t instanceof ot){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=rr.create(Ts(r))}return new ot({...t._def,shape:()=>e})}else return t instanceof Un?new Un({...t._def,type:Ts(t.element)}):t instanceof rr?rr.create(Ts(t.unwrap())):t instanceof ti?ti.create(Ts(t.unwrap())):t instanceof nr?nr.create(t.items.map(e=>Ts(e))):t}class ot extends xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=je.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==Q.object){const u=this._getOrReturnCtx(e);return Y(u,{code:$.invalid_type,expected:Q.object,received:u.parsedType}),me}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof br&&this._def.unknownKeys==="strip"))for(const u in i.data)o.includes(u)||a.push(u);const c=[];for(const u of o){const d=s[u],l=i.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new tr(i,l,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof br){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")a.length>0&&(Y(i,{code:$.unrecognized_keys,keys:a}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of a){const l=i.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new tr(i,l,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const l=await d.key,h=await d.value;u.push({key:l,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>jt.mergeObjectSync(r,u)):jt.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return re.errToObj,new ot({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,s,o,a;const c=(o=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,n,r).message)!==null&&o!==void 0?o:r.defaultError;return n.code==="unrecognized_keys"?{message:(a=re.errToObj(e).message)!==null&&a!==void 0?a:c}:{message:c}}}:{}})}strip(){return new ot({...this._def,unknownKeys:"strip"})}passthrough(){return new ot({...this._def,unknownKeys:"passthrough"})}extend(e){return new ot({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ot({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:he.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new ot({...this._def,catchall:e})}pick(e){const n={};return je.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new ot({...this._def,shape:()=>n})}omit(e){const n={};return je.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new ot({...this._def,shape:()=>n})}deepPartial(){return Ts(this)}partial(e){const n={};return je.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}),new ot({...this._def,shape:()=>n})}required(e){const n={};return je.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof rr;)s=s._def.innerType;n[r]=s}}),new ot({...this._def,shape:()=>n})}keyof(){return gm(je.objectKeys(this.shape))}}ot.create=(t,e)=>new ot({shape:()=>t,unknownKeys:"strip",catchall:br.create(),typeName:he.ZodObject,...Te(e)}),ot.strictCreate=(t,e)=>new ot({shape:()=>t,unknownKeys:"strict",catchall:br.create(),typeName:he.ZodObject,...Te(e)}),ot.lazycreate=(t,e)=>new ot({shape:t,unknownKeys:"strip",catchall:br.create(),typeName:he.ZodObject,...Te(e)});class Qo extends xe{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new gn(a.ctx.common.issues));return Y(n,{code:$.invalid_union,unionErrors:o}),me}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(c=>new gn(c));return Y(n,{code:$.invalid_union,unionErrors:a}),me}}get options(){return this._def.options}}Qo.create=(t,e)=>new Qo({options:t,typeName:he.ZodUnion,...Te(e)});const wr=t=>t instanceof na?wr(t.schema):t instanceof Bn?wr(t.innerType()):t instanceof ra?[t.value]:t instanceof ei?t.options:t instanceof ia?je.objectValues(t.enum):t instanceof sa?wr(t._def.innerType):t instanceof Xo?[void 0]:t instanceof Jo?[null]:t instanceof rr?[void 0,...wr(t.unwrap())]:t instanceof ti?[null,...wr(t.unwrap())]:t instanceof Ld||t instanceof ca?wr(t.unwrap()):t instanceof oa?wr(t._def.innerType):[];class Fc extends xe{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.object)return Y(n,{code:$.invalid_type,expected:Q.object,received:n.parsedType}),me;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(Y(n,{code:$.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),me)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const i=new Map;for(const s of n){const o=wr(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,s)}}return new Fc({typeName:he.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...Te(r)})}}function Od(t,e){const n=yr(t),r=yr(e);if(t===e)return{valid:!0,data:t};if(n===Q.object&&r===Q.object){const i=je.objectKeys(e),s=je.objectKeys(t).filter(a=>i.indexOf(a)!==-1),o={...t,...e};for(const a of s){const c=Od(t[a],e[a]);if(!c.valid)return{valid:!1};o[a]=c.data}return{valid:!0,data:o}}else if(n===Q.array&&r===Q.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let s=0;s<t.length;s++){const o=t[s],a=e[s],c=Od(o,a);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return n===Q.date&&r===Q.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class ea extends xe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=(s,o)=>{if(Ad(s)||Ad(o))return me;const a=Od(s.value,o.value);return a.valid?((Pd(s)||Pd(o))&&n.dirty(),{status:n.value,value:a.data}):(Y(r,{code:$.invalid_intersection_types}),me)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ea.create=(t,e,n)=>new ea({left:t,right:e,typeName:he.ZodIntersection,...Te(n)});class nr extends xe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.array)return Y(r,{code:$.invalid_type,expected:Q.array,received:r.parsedType}),me;if(r.data.length<this._def.items.length)return Y(r,{code:$.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),me;!this._def.rest&&r.data.length>this._def.items.length&&(Y(r,{code:$.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new tr(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>jt.mergeArray(n,o)):jt.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new nr({...this._def,rest:e})}}nr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new nr({items:t,typeName:he.ZodTuple,rest:null,...Te(e)})};class ta extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.object)return Y(r,{code:$.invalid_type,expected:Q.object,received:r.parsedType}),me;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in r.data)i.push({key:s._parse(new tr(r,a,r.path,a)),value:o._parse(new tr(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?jt.mergeObjectAsync(n,i):jt.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof xe?new ta({keyType:e,valueType:n,typeName:he.ZodRecord,...Te(r)}):new ta({keyType:$n.create(),valueType:e,typeName:he.ZodRecord,...Te(n)})}}class $c extends xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.map)return Y(r,{code:$.invalid_type,expected:Q.map,received:r.parsedType}),me;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,c],u)=>({key:i._parse(new tr(r,a,r.path,[u,"key"])),value:s._parse(new tr(r,c,r.path,[u,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return me;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const c of o){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return me;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(u.value,d.value)}return{status:n.value,value:a}}}}$c.create=(t,e,n)=>new $c({valueType:e,keyType:t,typeName:he.ZodMap,...Te(n)});class $i extends xe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Q.set)return Y(r,{code:$.invalid_type,expected:Q.set,received:r.parsedType}),me;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(Y(r,{code:$.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(Y(r,{code:$.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(c){const u=new Set;for(const d of c){if(d.status==="aborted")return me;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const a=[...r.data.values()].map((c,u)=>s._parse(new tr(r,c,r.path,u)));return r.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,n){return new $i({...this._def,minSize:{value:e,message:re.toString(n)}})}max(e,n){return new $i({...this._def,maxSize:{value:e,message:re.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}$i.create=(t,e)=>new $i({valueType:t,minSize:null,maxSize:null,typeName:he.ZodSet,...Te(e)});class Is extends xe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.function)return Y(n,{code:$.invalid_type,expected:Q.function,received:n.parsedType}),me;function r(a,c){return Oc({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Mc(),Es].filter(u=>!!u),issueData:{code:$.invalid_arguments,argumentsError:c}})}function i(a,c){return Oc({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Mc(),Es].filter(u=>!!u),issueData:{code:$.invalid_return_type,returnTypeError:c}})}const s={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof xs){const a=this;return Gt(async function(...c){const u=new gn([]),d=await a._def.args.parseAsync(c,s).catch(f=>{throw u.addIssue(r(c,f)),u}),l=await Reflect.apply(o,this,d);return await a._def.returns._def.type.parseAsync(l,s).catch(f=>{throw u.addIssue(i(l,f)),u})})}else{const a=this;return Gt(function(...c){const u=a._def.args.safeParse(c,s);if(!u.success)throw new gn([r(c,u.error)]);const d=Reflect.apply(o,this,u.data),l=a._def.returns.safeParse(d,s);if(!l.success)throw new gn([i(d,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Is({...this._def,args:nr.create(e).rest(Fi.create())})}returns(e){return new Is({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new Is({args:e||nr.create([]).rest(Fi.create()),returns:n||Fi.create(),typeName:he.ZodFunction,...Te(r)})}}class na extends xe{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}na.create=(t,e)=>new na({getter:t,typeName:he.ZodLazy,...Te(e)});class ra extends xe{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Y(n,{received:n.data,code:$.invalid_literal,expected:this._def.value}),me}return{status:"valid",value:e.data}}get value(){return this._def.value}}ra.create=(t,e)=>new ra({value:t,typeName:he.ZodLiteral,...Te(e)});function gm(t,e){return new ei({values:t,typeName:he.ZodEnum,...Te(e)})}class ei extends xe{constructor(){super(...arguments),Go.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return Y(n,{expected:je.joinValues(r),received:n.parsedType,code:$.invalid_type}),me}if(Lc(this,Go)||lm(this,Go,new Set(this._def.values)),!Lc(this,Go).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return Y(n,{received:n.data,code:$.invalid_enum_value,options:r}),me}return Gt(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return ei.create(e,{...this._def,...n})}exclude(e,n=this._def){return ei.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Go=new WeakMap,ei.create=gm;class ia extends xe{constructor(){super(...arguments),Yo.set(this,void 0)}_parse(e){const n=je.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Q.string&&r.parsedType!==Q.number){const i=je.objectValues(n);return Y(r,{expected:je.joinValues(i),received:r.parsedType,code:$.invalid_type}),me}if(Lc(this,Yo)||lm(this,Yo,new Set(je.getValidEnumValues(this._def.values))),!Lc(this,Yo).has(e.data)){const i=je.objectValues(n);return Y(r,{received:r.data,code:$.invalid_enum_value,options:i}),me}return Gt(e.data)}get enum(){return this._def.values}}Yo=new WeakMap,ia.create=(t,e)=>new ia({values:t,typeName:he.ZodNativeEnum,...Te(e)});class xs extends xe{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Q.promise&&n.common.async===!1)return Y(n,{code:$.invalid_type,expected:Q.promise,received:n.parsedType}),me;const r=n.parsedType===Q.promise?n.data:Promise.resolve(n.data);return Gt(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}xs.create=(t,e)=>new xs({type:t,typeName:he.ZodPromise,...Te(e)});class Bn extends xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===he.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{Y(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return me;const c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?me:c.status==="dirty"||n.value==="dirty"?ks(c.value):c});{if(n.value==="aborted")return me;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?me:a.status==="dirty"||n.value==="dirty"?ks(a.value):a}}if(i.type==="refinement"){const o=a=>{const c=i.refinement(a,s);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?me:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?me:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Di(o))return o;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Di(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:n.value,value:a})):o);je.assertNever(i)}}Bn.create=(t,e,n)=>new Bn({schema:t,typeName:he.ZodEffects,effect:e,...Te(n)}),Bn.createWithPreprocess=(t,e,n)=>new Bn({schema:e,effect:{type:"preprocess",transform:t},typeName:he.ZodEffects,...Te(n)});class rr extends xe{_parse(e){return this._getType(e)===Q.undefined?Gt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}rr.create=(t,e)=>new rr({innerType:t,typeName:he.ZodOptional,...Te(e)});class ti extends xe{_parse(e){return this._getType(e)===Q.null?Gt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ti.create=(t,e)=>new ti({innerType:t,typeName:he.ZodNullable,...Te(e)});class sa extends xe{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Q.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}sa.create=(t,e)=>new sa({innerType:t,typeName:he.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Te(e)});class oa extends xe{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Ko(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new gn(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new gn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}oa.create=(t,e)=>new oa({innerType:t,typeName:he.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Te(e)});class Uc extends xe{_parse(e){if(this._getType(e)!==Q.nan){const r=this._getOrReturnCtx(e);return Y(r,{code:$.invalid_type,expected:Q.nan,received:r.parsedType}),me}return{status:"valid",value:e.data}}}Uc.create=t=>new Uc({typeName:he.ZodNaN,...Te(t)});const xI=Symbol("zod_brand");class Ld extends xe{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class aa extends xe{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?me:s.status==="dirty"?(n.dirty(),ks(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?me:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new aa({in:e,out:n,typeName:he.ZodPipeline})}}class ca extends xe{_parse(e){const n=this._def.innerType._parse(e),r=i=>(Di(i)&&(i.value=Object.freeze(i.value)),i);return Ko(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}ca.create=(t,e)=>new ca({innerType:t,typeName:he.ZodReadonly,...Te(e)});function mm(t,e){const n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function vm(t,e={},n){return t?Cs.create().superRefine((r,i)=>{var s,o;const a=t(r);if(a instanceof Promise)return a.then(c=>{var u,d;if(!c){const l=mm(e,r),h=(d=(u=l.fatal)!==null&&u!==void 0?u:n)!==null&&d!==void 0?d:!0;i.addIssue({code:"custom",...l,fatal:h})}});if(!a){const c=mm(e,r),u=(o=(s=c.fatal)!==null&&s!==void 0?s:n)!==null&&o!==void 0?o:!0;i.addIssue({code:"custom",...c,fatal:u})}}):Cs.create()}const RI={object:ot.lazycreate};var he;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(he||(he={}));const AI=(t,e={message:`Input not instance of ${t.name}`})=>vm(n=>n instanceof t,e),_m=$n.create,ym=Jr.create,PI=Uc.create,MI=Qr.create,bm=Zo.create,OI=Ni.create,LI=Dc.create,DI=Xo.create,NI=Jo.create,FI=Cs.create,$I=Fi.create,UI=br.create,BI=Nc.create,jI=Un.create,HI=ot.create,qI=ot.strictCreate,WI=Qo.create,zI=Fc.create,VI=ea.create,KI=nr.create,GI=ta.create,YI=$c.create,ZI=$i.create,XI=Is.create,JI=na.create,QI=ra.create,e1=ei.create,t1=ia.create,n1=xs.create,wm=Bn.create,r1=rr.create,i1=ti.create,s1=Bn.createWithPreprocess,o1=aa.create;var H=Object.freeze({__proto__:null,defaultErrorMap:Es,setErrorMap:sI,getErrorMap:Mc,makeIssue:Oc,EMPTY_PATH:oI,addIssueToContext:Y,ParseStatus:jt,INVALID:me,DIRTY:ks,OK:Gt,isAborted:Ad,isDirty:Pd,isValid:Di,isAsync:Ko,get util(){return je},get objectUtil(){return Rd},ZodParsedType:Q,getParsedType:yr,ZodType:xe,datetimeRegex:pm,ZodString:$n,ZodNumber:Jr,ZodBigInt:Qr,ZodBoolean:Zo,ZodDate:Ni,ZodSymbol:Dc,ZodUndefined:Xo,ZodNull:Jo,ZodAny:Cs,ZodUnknown:Fi,ZodNever:br,ZodVoid:Nc,ZodArray:Un,ZodObject:ot,ZodUnion:Qo,ZodDiscriminatedUnion:Fc,ZodIntersection:ea,ZodTuple:nr,ZodRecord:ta,ZodMap:$c,ZodSet:$i,ZodFunction:Is,ZodLazy:na,ZodLiteral:ra,ZodEnum:ei,ZodNativeEnum:ia,ZodPromise:xs,ZodEffects:Bn,ZodTransformer:Bn,ZodOptional:rr,ZodNullable:ti,ZodDefault:sa,ZodCatch:oa,ZodNaN:Uc,BRAND:xI,ZodBranded:Ld,ZodPipeline:aa,ZodReadonly:ca,custom:vm,Schema:xe,ZodSchema:xe,late:RI,get ZodFirstPartyTypeKind(){return he},coerce:{string:t=>$n.create({...t,coerce:!0}),number:t=>Jr.create({...t,coerce:!0}),boolean:t=>Zo.create({...t,coerce:!0}),bigint:t=>Qr.create({...t,coerce:!0}),date:t=>Ni.create({...t,coerce:!0})},any:FI,array:jI,bigint:MI,boolean:bm,date:OI,discriminatedUnion:zI,effect:wm,enum:e1,function:XI,instanceof:AI,intersection:VI,lazy:JI,literal:QI,map:YI,nan:PI,nativeEnum:t1,never:UI,null:NI,nullable:i1,number:ym,object:HI,oboolean:()=>bm().optional(),onumber:()=>ym().optional(),optional:r1,ostring:()=>_m().optional(),pipeline:o1,preprocess:s1,promise:n1,record:GI,set:ZI,strictObject:qI,string:_m,symbol:LI,transformer:wm,tuple:KI,undefined:DI,union:WI,unknown:$I,void:BI,NEVER:me,ZodIssueCode:$,quotelessJson:iI,ZodError:gn});const Dd=H.enum(["development","production","test"]).parse("production"),Sm=H.object({id:H.string({description:"The unique ID of the extension generated by the Chrome Web Store"}),manifest:H.object({name:H.string({description:"The name of the extension to be displayed in the Chrome Web Store"}).min(1),key:H.string({description:"The key of the extension. Maintains the unique ID of an extension when it is loaded during development. See https://developer.chrome.com/docs/extensions/reference/manifest/key"}),externallyConnectable:H.object({matches:H.array(H.string({description:"The URLs that can connect to the extension. Allows web pages to send messages to the extension (e.g. to log in). See https://developer.chrome.com/docs/extensions/reference/manifest/externally_connectable"}))}),default_locale:H.string({description:"The default locale of the extension"}).default("en")})}),Nd=Sm.extend({uninstallUrl:H.string({description:"The URL to open when the user uninstalls the extension"}),analytics:H.object({enabled:H.boolean({description:"Whether analytics are enabled"}),amplitudeApiKey:H.string({description:"The API key for Amplitude"}),posthogApiKey:H.string({description:"The API key for PostHog"})}),sentry:H.object({enabled:H.boolean({description:"Whether Sentry is enabled"}),dsn:H.string({description:"The DSN for Sentry"})})}),Fd=Sm.parse({id:"bjfgambnhccakkhmkepdoekmckoijdlc",manifest:{name:"Browser MCP - Automate your browser using VS Code, Cursor, Claude, and more",key:"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtnIVuyyr0emD2C79jB4F6dzNaurwhd5cJdGhJFhNkQ9YcSBMfKHQAivecCE7KuOImGJ9D7hPZYE2DzDR5j0NWlGn7K/xNZer0t3d+AHJojWUgOMLYTXdn86WxjigdHIw3Bwbo9ElH0Z9pdNOrRy2SdXtCiq6iqTHUrXwxNdVnEKkAWPNyr5QcqmfJlq6iPuB36GUwo40XgKwVPxC9eChVWoK4U6XgNEkQf44oQRTxJkbvG7AYsU7LGaVdXXJwyKuwBhaQh5oHtAjjpujF9Sgwbd8IJSPBeF5ssRZAbCzr16yLV66D05/1RodJSia7E5OafCx78C/rLJ0tZyaOV+40wIDAQAB",externallyConnectable:{matches:["https://*.browsermcp.io/*"]},default_locale:"en"}}),a1=Nd.parse({...Fd,uninstallUrl:"",analytics:{enabled:!0,amplitudeApiKey:"bb45e733842c3732cd52d759e88826ca",posthogApiKey:"phc_l85rVI7wMQYhw4kca0JJy8TAyztKch5WT3smy4VTEmg"},sentry:{enabled:!1,dsn:""}}),c1=Nd.parse({...Fd,uninstallUrl:"",analytics:{enabled:!0,amplitudeApiKey:"10edd558159f01783d50d921d1ec4716",posthogApiKey:"phc_KWOh1iNHba9C7csIG27KqYmYx4BgXlcLz5ISzO9Scq1"},sentry:{enabled:!1,dsn:""}}),u1=Nd.parse({...Fd,uninstallUrl:"",analytics:{enabled:!1,amplitudeApiKey:"",posthogApiKey:""},sentry:{enabled:!1,dsn:""}}),mn={development:a1,production:c1,test:u1}[Dd];function Ui(t){if(t instanceof Error)return t.message||t.name;{console.error("Unexpected error:",t);const e=JSON.stringify(t);return e!=="{}"?e:String(t)}}const Em="__extensionStackError__";function l1(t){return typeof t=="object"&&t!==null&&Em in t}function km(t){return{[Em]:!0,message:t}}function ir(){async function t(r,i,s){const o={type:r,payload:i};let a;if(s===null?a=await chrome.runtime.sendMessage(o):a=await chrome.tabs.sendMessage(s,o),l1(a))throw new Error(a.message);return a}function e(r){return(i,s)=>t(r,i,s)}function n(r,i,{requiredSenderTabId:s}={}){const o=(a,c,u)=>{var d;if(!(a.type!==r||s&&((d=c.tab)==null?void 0:d.id)!==s))return i(a,c).then(l=>{u(l)}).catch(l=>{const h=Ui(l);u(km(h))}),!0};return chrome.runtime.onMessage.addListener(o),()=>chrome.runtime.onMessage.removeListener(o)}return{sendMessage:t,createMessageSender:e,addMessageListener:n}}var $d=function(t,e){return $d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},$d(t,e)};function Yt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");$d(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var ie=function(){return ie=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},ie.apply(this,arguments)};function Ud(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function X(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(d){try{u(r.next(d))}catch(l){o(l)}}function c(d){try{u(r.throw(d))}catch(l){o(l)}}function u(d){d.done?s(d.value):i(d.value).then(a,c)}u((r=r.apply(t,e||[])).next())})}function Z(t,e){var n={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(u){return function(d){return c([u,d])}}function c(u){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(n=0)),n;)try{if(r=1,i&&(s=u[0]&2?i.return:u[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,u[1])).done)return s;switch(i=0,s&&(u=[u[0]&2,s.value]),u[0]){case 0:case 1:s=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!s||u[1]>s[0]&&u[1]<s[3])){n.label=u[1];break}if(u[0]===6&&n.label<s[1]){n.label=s[1],s=u;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(u);break}s[2]&&n.ops.pop(),n.trys.pop();continue}u=e.call(t,n)}catch(d){u=[6,d],i=0}finally{r=s=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Ht(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Qe(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s}function Zt(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}function Rs(t){return this instanceof Rs?(this.v=t,this):new Rs(t)}function d1(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(f){return function(p){return Promise.resolve(p).then(f,l)}}function a(f,p){r[f]&&(i[f]=function(g){return new Promise(function(v,m){s.push([f,g,v,m])>1||c(f,g)})},p&&(i[f]=p(i[f])))}function c(f,p){try{u(r[f](p))}catch(g){h(s[0][3],g)}}function u(f){f.value instanceof Rs?Promise.resolve(f.value.v).then(d,l):h(s[0][2],f)}function d(f){c("next",f)}function l(f){c("throw",f)}function h(f,p){f(p),s.shift(),s.length&&c(s[0][0],s[0][1])}}function f1(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof Ht=="function"?Ht(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(o){return new Promise(function(a,c){o=t[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(u){s({value:u,done:a})},o)}}typeof SuppressedError=="function"&&SuppressedError;var h1="Event tracked successfully",p1="Unexpected error occurred",g1="Event rejected due to exceeded retry count",m1="Event skipped due to optOut config",v1="Event rejected due to missing API key",_1="Invalid API key",y1="Client not initialized",_t;(function(t){t.Unknown="unknown",t.Skipped="skipped",t.Success="success",t.RateLimit="rate_limit",t.PayloadTooLarge="payload_too_large",t.Invalid="invalid",t.Failed="failed",t.Timeout="Timeout",t.SystemError="SystemError"})(_t||(_t={}));var As=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=_t.Unknown),{event:t,code:e,message:n}},Ps=function(t){return t?(t^Math.random()*16>>t/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,Ps)},b1=function(){function t(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return t.prototype.register=function(e,n){var r,i;return X(this,void 0,void 0,function(){return Z(this,function(s){switch(s.label){case 0:return this.plugins.some(function(o){return o.name===e.name})?(n.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2]):(e.name===void 0&&(e.name=Ps(),n.loggerProvider.warn(`Plugin name is undefined.
Generating a random UUID for plugin name: `.concat(e.name,`.
Set a name for the plugin to prevent it from being added multiple times.`))),e.type=(r=e.type)!==null&&r!==void 0?r:"enrichment",[4,(i=e.setup)===null||i===void 0?void 0:i.call(e,n,this.client)]);case 1:return s.sent(),this.plugins.push(e),[2]}})})},t.prototype.deregister=function(e,n){var r;return X(this,void 0,void 0,function(){var i,s;return Z(this,function(o){switch(o.label){case 0:return i=this.plugins.findIndex(function(a){return a.name===e}),i===-1?(n.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(s=this.plugins[i],this.plugins.splice(i,1),[4,(r=s.teardown)===null||r===void 0?void 0:r.call(s)]);case 1:return o.sent(),[2]}})})},t.prototype.reset=function(e){this.applying=!1;var n=this.plugins;n.map(function(r){var i;return(i=r.teardown)===null||i===void 0?void 0:i.call(r)}),this.plugins=[],this.client=e},t.prototype.push=function(e){var n=this;return new Promise(function(r){n.queue.push([e,r]),n.scheduleApply(0)})},t.prototype.scheduleApply=function(e){var n=this;this.applying||(this.applying=!0,setTimeout(function(){n.apply(n.queue.shift()).then(function(){n.applying=!1,n.queue.length>0&&n.scheduleApply(0)})},e))},t.prototype.apply=function(e){return X(this,void 0,void 0,function(){var n,r,i,s,o,a,c,f,p,u,d,l,h,f,p,g,v,m,_,w,T,C;return Z(this,function(E){switch(E.label){case 0:if(!e)return[2];n=Qe(e,1),r=n[0],i=Qe(e,2),s=i[1],o=this.plugins.filter(function(I){return I.type==="before"}),E.label=1;case 1:E.trys.push([1,6,7,8]),a=Ht(o),c=a.next(),E.label=2;case 2:return c.done?[3,5]:(f=c.value,f.execute?[4,f.execute(ie({},r))]:[3,4]);case 3:if(p=E.sent(),p===null)return s({event:r,code:0,message:""}),[2];r=p,E.label=4;case 4:return c=a.next(),[3,2];case 5:return[3,8];case 6:return u=E.sent(),_={error:u},[3,8];case 7:try{c&&!c.done&&(w=a.return)&&w.call(a)}finally{if(_)throw _.error}return[7];case 8:d=this.plugins.filter(function(I){return I.type==="enrichment"||I.type===void 0}),E.label=9;case 9:E.trys.push([9,14,15,16]),l=Ht(d),h=l.next(),E.label=10;case 10:return h.done?[3,13]:(f=h.value,f.execute?[4,f.execute(ie({},r))]:[3,12]);case 11:if(p=E.sent(),p===null)return s({event:r,code:0,message:""}),[2];r=p,E.label=12;case 12:return h=l.next(),[3,10];case 13:return[3,16];case 14:return g=E.sent(),T={error:g},[3,16];case 15:try{h&&!h.done&&(C=l.return)&&C.call(l)}finally{if(T)throw T.error}return[7];case 16:return v=this.plugins.filter(function(I){return I.type==="destination"}),m=v.map(function(I){var y=ie({},r);return I.execute(y).catch(function(b){return As(y,0,String(b))})}),Promise.all(m).then(function(I){var y=Qe(I,1),b=y[0],k=b||As(r,100,"Event not tracked, no destination plugins on the instance");s(k)}),[2]}})})},t.prototype.flush=function(){return X(this,void 0,void 0,function(){var e,n,r,i=this;return Z(this,function(s){switch(s.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(o){return i.apply(o)}))];case 1:return s.sent(),n=this.plugins.filter(function(o){return o.type==="destination"}),r=n.map(function(o){return o.flush&&o.flush()}),[4,Promise.all(r)];case 2:return s.sent(),[2]}})})},t}(),Cm="-",Bc="AMP",w1="".concat(Bc,"_unsent"),Tm="https://api2.amplitude.com/2/httpapi",S1="https://api.eu.amplitude.com/2/httpapi",E1="https://api2.amplitude.com/batch",k1="https://api.eu.amplitude.com/batch",C1=1e3,Bd=function(t){if(Object.keys(t).length>C1)return!1;for(var e in t){var n=t[e];if(!Im(e,n))return!1}return!0},Im=function(t,e){var n,r;if(typeof t!="string")return!1;if(Array.isArray(e)){var i=!0;try{for(var s=Ht(e),o=s.next();!o.done;o=s.next()){var a=o.value;if(Array.isArray(a))return!1;if(typeof a=="object")i=i&&Bd(a);else if(!["number","string"].includes(typeof a))return!1;if(!i)return!1}}catch(c){n={error:c}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}else{if(e==null)return!1;if(typeof e=="object")return Bd(e);if(!["number","string","boolean"].includes(typeof e))return!1}return!0},ua=function(){function t(){this._propertySet=new Set,this._properties={}}return t.prototype.getUserProperties=function(){return ie({},this._properties)},t.prototype.set=function(e,n){return this._safeSet(qt.SET,e,n),this},t.prototype.setOnce=function(e,n){return this._safeSet(qt.SET_ONCE,e,n),this},t.prototype.append=function(e,n){return this._safeSet(qt.APPEND,e,n),this},t.prototype.prepend=function(e,n){return this._safeSet(qt.PREPEND,e,n),this},t.prototype.postInsert=function(e,n){return this._safeSet(qt.POSTINSERT,e,n),this},t.prototype.preInsert=function(e,n){return this._safeSet(qt.PREINSERT,e,n),this},t.prototype.remove=function(e,n){return this._safeSet(qt.REMOVE,e,n),this},t.prototype.add=function(e,n){return this._safeSet(qt.ADD,e,n),this},t.prototype.unset=function(e){return this._safeSet(qt.UNSET,e,Cm),this},t.prototype.clearAll=function(){return this._properties={},this._properties[qt.CLEAR_ALL]=Cm,this},t.prototype._safeSet=function(e,n,r){if(this._validate(e,n,r)){var i=this._properties[e];return i===void 0&&(i={},this._properties[e]=i),i[n]=r,this._propertySet.add(n),!0}return!1},t.prototype._validate=function(e,n,r){return this._properties[qt.CLEAR_ALL]!==void 0||this._propertySet.has(n)?!1:e===qt.ADD?typeof r=="number":e!==qt.UNSET&&e!==qt.REMOVE?Im(n,r):!0},t}(),qt;(function(t){t.SET="$set",t.SET_ONCE="$setOnce",t.ADD="$add",t.APPEND="$append",t.PREPEND="$prepend",t.REMOVE="$remove",t.PREINSERT="$preInsert",t.POSTINSERT="$postInsert",t.UNSET="$unset",t.CLEAR_ALL="$clearAll"})(qt||(qt={}));var jd;(function(t){t.SET="$set",t.SET_ONCE="$setOnce",t.ADD="$add",t.APPEND="$append",t.PREPEND="$prepend",t.REMOVE="$remove",t.PREINSERT="$preInsert",t.POSTINSERT="$postInsert",t.UNSET="$unset",t.CLEAR_ALL="$clearAll"})(jd||(jd={}));var Bi;(function(t){t.IDENTIFY="$identify",t.GROUP_IDENTIFY="$groupidentify",t.REVENUE="revenue_amount"})(Bi||(Bi={}));var T1=function(t,e,n){var r=typeof t=="string"?{event_type:t}:t;return ie(ie(ie({},r),n),e&&{event_properties:e})},xm=function(t,e){var n=ie(ie({},e),{event_type:Bi.IDENTIFY,user_properties:t.getUserProperties()});return n},I1=function(t,e,n,r){var i,s=ie(ie({},r),{event_type:Bi.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(i={},i[t]=e,i)});return s},x1=function(t,e,n){var r,i=new ua;i.set(t,e);var s=ie(ie({},n),{event_type:Bi.IDENTIFY,user_properties:i.getUserProperties(),groups:(r={},r[t]=e,r)});return s},R1=function(t,e){return ie(ie({},e),{event_type:Bi.REVENUE,event_properties:t.getEventProperties()})},an=function(t){return{promise:t||Promise.resolve()}},A1=function(){function t(e){e===void 0&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new b1(this),this.name=e}return t.prototype._init=function(e){return X(this,void 0,void 0,function(){return Z(this,function(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return n.sent(),this.isReady=!0,[2]}})})},t.prototype.runQueuedFunctions=function(e){return X(this,void 0,void 0,function(){var n,r,i,s,o,a,c,u;return Z(this,function(d){switch(d.label){case 0:n=this[e],this[e]=[],d.label=1;case 1:d.trys.push([1,8,9,10]),r=Ht(n),i=r.next(),d.label=2;case 2:return i.done?[3,7]:(s=i.value,o=s(),o&&"promise"in o?[4,o.promise]:[3,4]);case 3:return d.sent(),[3,6];case 4:return[4,o];case 5:d.sent(),d.label=6;case 6:return i=r.next(),[3,2];case 7:return[3,10];case 8:return a=d.sent(),c={error:a},[3,10];case 9:try{i&&!i.done&&(u=r.return)&&u.call(r)}finally{if(c)throw c.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:d.sent(),d.label=12;case 12:return[2]}})})},t.prototype.track=function(e,n,r){var i=T1(e,n,r);return an(this.dispatch(i))},t.prototype.identify=function(e,n){var r=xm(e,n);return an(this.dispatch(r))},t.prototype.groupIdentify=function(e,n,r,i){var s=I1(e,n,r,i);return an(this.dispatch(s))},t.prototype.setGroup=function(e,n,r){var i=x1(e,n,r);return an(this.dispatch(i))},t.prototype.revenue=function(e,n){var r=R1(e,n);return an(this.dispatch(r))},t.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),an())},t.prototype._addPlugin=function(e){return an(this.timeline.register(e,this.config))},t.prototype.remove=function(e){return this.isReady?this._removePlugin(e):(this.q.push(this._removePlugin.bind(this,e)),an())},t.prototype._removePlugin=function(e){return an(this.timeline.deregister(e,this.config))},t.prototype.dispatchWithCallback=function(e,n){if(!this.isReady)return n(As(e,0,y1));this.process(e).then(n)},t.prototype.dispatch=function(e){return X(this,void 0,void 0,function(){var n=this;return Z(this,function(r){return this.isReady?[2,this.process(e)]:[2,new Promise(function(i){n.dispatchQ.push(n.dispatchWithCallback.bind(n,e,i))})]})})},t.prototype.process=function(e){return X(this,void 0,void 0,function(){var i,n,r,i;return Z(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),this.config.optOut?[2,As(e,0,m1)]:[4,this.timeline.push(e)];case 1:return i=s.sent(),i.code===200?this.config.loggerProvider.log(i.message):i.code===100?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return n=s.sent(),r=String(n),this.config.loggerProvider.error(r),i=As(e,0,r),[2,i];case 3:return[2]}})})},t.prototype.setOptOut=function(e){if(!this.isReady){this.q.push(this._setOptOut.bind(this,!!e));return}this._setOptOut(e)},t.prototype._setOptOut=function(e){this.config.optOut=!!e},t.prototype.flush=function(){return an(this.timeline.flush())},t}(),P1=function(){function t(){this.productId="",this.quantity=1,this.price=0}return t.prototype.setProductId=function(e){return this.productId=e,this},t.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},t.prototype.setPrice=function(e){return this.price=e,this},t.prototype.setRevenueType=function(e){return this.revenueType=e,this},t.prototype.setCurrency=function(e){return this.currency=e,this},t.prototype.setRevenue=function(e){return this.revenue=e,this},t.prototype.setReceipt=function(e){return this.receipt=e,this},t.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},t.prototype.setEventProperties=function(e){return Bd(e)&&(this.properties=e),this},t.prototype.getEventProperties=function(){var e=this.properties?ie({},this.properties):{};return e[jn.REVENUE_PRODUCT_ID]=this.productId,e[jn.REVENUE_QUANTITY]=this.quantity,e[jn.REVENUE_PRICE]=this.price,e[jn.REVENUE_TYPE]=this.revenueType,e[jn.REVENUE_CURRENCY]=this.currency,e[jn.REVENUE]=this.revenue,e[jn.RECEIPT]=this.receipt,e[jn.RECEIPT_SIG]=this.receiptSig,e},t}(),jn;(function(t){t.REVENUE_PRODUCT_ID="$productId",t.REVENUE_QUANTITY="$quantity",t.REVENUE_PRICE="$price",t.REVENUE_TYPE="$revenueType",t.REVENUE_CURRENCY="$currency",t.REVENUE="$revenue",t.RECEIPT="$receipt",t.RECEIPT_SIG="$receiptSig"})(jn||(jn={}));var M1=function(t,e){var n=Math.max(e,1);return t.reduce(function(r,i,s){var o=Math.floor(s/n);return r[o]||(r[o]=[]),r[o].push(i),r},[])},cn;(function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Verbose=3]="Verbose",t[t.Debug=4]="Debug"})(cn||(cn={}));var jc="Amplitude Logger ",Rm=function(){function t(){this.logLevel=cn.None}return t.prototype.disable=function(){this.logLevel=cn.None},t.prototype.enable=function(e){e===void 0&&(e=cn.Warn),this.logLevel=e},t.prototype.log=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<cn.Verbose||console.log("".concat(jc,"[Log]: ").concat(e.join(" ")))},t.prototype.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<cn.Warn||console.warn("".concat(jc,"[Warn]: ").concat(e.join(" ")))},t.prototype.error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<cn.Error||console.error("".concat(jc,"[Error]: ").concat(e.join(" ")))},t.prototype.debug=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<cn.Debug||console.log("".concat(jc,"[Debug]: ").concat(e.join(" ")))},t}(),Hc=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:cn.Warn,loggerProvider:new Rm,offline:!1,optOut:!1,serverUrl:Tm,serverZone:"US",useBatch:!1}},O1=function(){function t(e){var n,r,i,s;this._optOut=!1;var o=Hc();this.apiKey=e.apiKey,this.flushIntervalMillis=(n=e.flushIntervalMillis)!==null&&n!==void 0?n:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=(r=e.logLevel)!==null&&r!==void 0?r:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=e.offline!==void 0?e.offline:o.offline,this.optOut=(i=e.optOut)!==null&&i!==void 0?i:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=(s=e.useBatch)!==null&&s!==void 0?s:o.useBatch,this.loggerProvider.enable(this.logLevel);var a=Am(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=a.serverZone,this.serverUrl=a.serverUrl}return Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),t}(),L1=function(t,e){return t==="EU"?e?k1:S1:e?E1:Tm},Am=function(t,e,n){if(t===void 0&&(t=""),e===void 0&&(e=Hc().serverZone),n===void 0&&(n=Hc().useBatch),t)return{serverUrl:t,serverZone:void 0};var r=["US","EU"].includes(e)?e:Hc().serverZone;return{serverZone:r,serverUrl:L1(r,n)}},Pm=function(){function t(){this.sdk={metrics:{histogram:{}}}}return t.prototype.recordHistogram=function(e,n){this.sdk.metrics.histogram[e]=n},t}();function D1(t){return t instanceof Error?t.message:String(t)}function qc(t){var e="";try{"body"in t&&(e=JSON.stringify(t.body,null,2))}catch{}return e}var N1=function(){function t(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[]}return t.prototype.setup=function(e){var n;return X(this,void 0,void 0,function(){var r,i=this;return Z(this,function(s){switch(s.label){case 0:return this.config=e,this.storageKey="".concat(w1,"_").concat(this.config.apiKey.substring(0,10)),[4,(n=this.config.storageProvider)===null||n===void 0?void 0:n.get(this.storageKey)];case 1:return r=s.sent(),r&&r.length>0&&Promise.all(r.map(function(o){return i.execute(o)})).catch(),[2,Promise.resolve(void 0)]}})})},t.prototype.execute=function(e){var n=this;return e.insert_id||(e.insert_id=Ps()),new Promise(function(r){var i={event:e,attempts:0,callback:function(s){return r(s)},timeout:0};n.queue.push(i),n.schedule(n.config.flushIntervalMillis),n.saveEvents()})},t.prototype.removeEventsExceedFlushMaxRetries=function(e){var n=this;return e.filter(function(r){return r.attempts+=1,r.attempts<n.config.flushMaxRetries?!0:(n.fulfillRequest([r],500,g1),!1)})},t.prototype.scheduleEvents=function(e){var n=this;e.forEach(function(r){n.schedule(r.timeout===0?n.config.flushIntervalMillis:r.timeout)})},t.prototype.schedule=function(e){var n=this;if(!this.config.offline&&(this.scheduleId===null||this.scheduleId&&e>this.scheduledTimeout)){this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,this.scheduleId=setTimeout(function(){n.queue=n.queue.map(function(r){return r.timeout=0,r}),n.flush(!0)},e);return}},t.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},t.prototype.flush=function(e){return e===void 0&&(e=!1),X(this,void 0,void 0,function(){var n,r,i,s=this;return Z(this,function(o){switch(o.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),n=[],r=[],this.queue.forEach(function(a){return a.timeout===0?n.push(a):r.push(a)}),i=M1(n,this.config.flushQueueSize),[4,i.reduce(function(a,c){return X(s,void 0,void 0,function(){return Z(this,function(u){switch(u.label){case 0:return[4,a];case 1:return u.sent(),[4,this.send(c,e)];case 2:return[2,u.sent()]}})})},Promise.resolve())]);case 1:return o.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}})})},t.prototype.send=function(e,n){return n===void 0&&(n=!0),X(this,void 0,void 0,function(){var r,i,s,o,a;return Z(this,function(c){switch(c.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,v1)];r={api_key:this.config.apiKey,events:e.map(function(u){var d=u.event;d.extra;var l=Ud(d,["extra"]);return l}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new Pm,c.label=1;case 1:return c.trys.push([1,3,,4]),i=Am(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,r)];case 2:return s=c.sent(),s===null?(this.fulfillRequest(e,0,p1),[2]):n?(this.handleResponse(s,e),[3,4]):("body"in s?this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(qc(s))):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return o=c.sent(),a=D1(o),this.config.loggerProvider.error(a),this.handleResponse({status:_t.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},t.prototype.handleResponse=function(e,n){var r=e.status;switch(r){case _t.Success:{this.handleSuccessResponse(e,n);break}case _t.Invalid:{this.handleInvalidResponse(e,n);break}case _t.PayloadTooLarge:{this.handlePayloadTooLargeResponse(e,n);break}case _t.RateLimit:{this.handleRateLimitResponse(e,n);break}default:{this.config.loggerProvider.warn(`{code: 0, error: "Status '`.concat(r,"' provided for ").concat(n.length,' events"}')),this.handleOtherResponse(n);break}}},t.prototype.handleSuccessResponse=function(e,n){this.fulfillRequest(n,e.statusCode,h1)},t.prototype.handleInvalidResponse=function(e,n){var r=this;if(e.body.missingField||e.body.error.startsWith(_1)){this.fulfillRequest(n,e.statusCode,e.body.error);return}var i=Zt(Zt(Zt(Zt([],Qe(Object.values(e.body.eventsWithInvalidFields)),!1),Qe(Object.values(e.body.eventsWithMissingFields)),!1),Qe(Object.values(e.body.eventsWithInvalidIdLengths)),!1),Qe(e.body.silencedEvents),!1).flat(),s=new Set(i),o=n.filter(function(c,u){if(s.has(u)){r.fulfillRequest([c],e.statusCode,e.body.error);return}return!0});o.length>0&&this.config.loggerProvider.warn(qc(e));var a=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(a)},t.prototype.handlePayloadTooLargeResponse=function(e,n){if(n.length===1){this.fulfillRequest(n,e.statusCode,e.body.error);return}this.config.loggerProvider.warn(qc(e)),this.config.flushQueueSize/=2;var r=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(r)},t.prototype.handleRateLimitResponse=function(e,n){var r=this,i=Object.keys(e.body.exceededDailyQuotaUsers),s=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,a=new Set(i),c=new Set(s),u=new Set(o),d=n.filter(function(h,f){if(h.event.user_id&&a.has(h.event.user_id)||h.event.device_id&&c.has(h.event.device_id)){r.fulfillRequest([h],e.statusCode,e.body.error);return}return u.has(f)&&(h.timeout=r.throttleTimeout),!0});d.length>0&&this.config.loggerProvider.warn(qc(e));var l=this.removeEventsExceedFlushMaxRetries(d);this.scheduleEvents(l)},t.prototype.handleOtherResponse=function(e){var n=this,r=e.map(function(s){return s.timeout=s.attempts*n.retryTimeout,s}),i=this.removeEventsExceedFlushMaxRetries(r);this.scheduleEvents(i)},t.prototype.fulfillRequest=function(e,n,r){this.removeEvents(e),e.forEach(function(i){return i.callback(As(i.event,n,r))})},t.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map(function(n){return n.event});this.config.storageProvider.set(this.storageKey,e)}},t.prototype.removeEvents=function(e){this.queue=this.queue.filter(function(n){return!e.some(function(r){return r.event.insert_id===n.event.insert_id})}),this.saveEvents()},t}(),F1=function(){function t(){}return t.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:$1(),platform:"Web",os:void 0,deviceModel:void 0}},t}(),$1=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},U1=function(){function t(){this.queue=[]}return t.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},t.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(n){e(n)}),this.queue=[])},t}(),ni=function(){return ni=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},ni.apply(this,arguments)};function Wc(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Mm(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(a){o={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s}typeof SuppressedError=="function"&&SuppressedError;var zc=function(t,e){var n,r,i=["string","number","boolean","undefined"],s=typeof t,o=typeof e;if(s!==o)return!1;try{for(var a=Wc(i),c=a.next();!c.done;c=a.next()){var u=c.value;if(u===s)return t===e}}catch(v){n={error:v}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}if(t==null&&e==null)return!0;if(t==null||e==null||t.length!==e.length)return!1;var d=Array.isArray(t),l=Array.isArray(e);if(d!==l)return!1;if(d&&l){for(var h=0;h<t.length;h++)if(!zc(t[h],e[h]))return!1}else{var f=Object.keys(t).sort(),p=Object.keys(e).sort();if(!zc(f,p))return!1;var g=!0;return Object.keys(t).forEach(function(v){zc(t[v],e[v])||(g=!1)}),g}return!0},B1="$set",j1="$unset",H1="$clearAll";Object.entries||(Object.entries=function(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r});var q1=function(){function t(){this.identity={userProperties:{}},this.listeners=new Set}return t.prototype.editIdentity=function(){var e=this,n=ni({},this.identity.userProperties),r=ni(ni({},this.identity),{userProperties:n});return{setUserId:function(i){return r.userId=i,this},setDeviceId:function(i){return r.deviceId=i,this},setUserProperties:function(i){return r.userProperties=i,this},setOptOut:function(i){return r.optOut=i,this},updateUserProperties:function(i){var s,o,a,c,u,d,l=r.userProperties||{};try{for(var h=Wc(Object.entries(i)),f=h.next();!f.done;f=h.next()){var p=Mm(f.value,2),g=p[0],v=p[1];switch(g){case B1:try{for(var m=(a=void 0,Wc(Object.entries(v))),_=m.next();!_.done;_=m.next()){var w=Mm(_.value,2),T=w[0],C=w[1];l[T]=C}}catch(y){a={error:y}}finally{try{_&&!_.done&&(c=m.return)&&c.call(m)}finally{if(a)throw a.error}}break;case j1:try{for(var E=(u=void 0,Wc(Object.keys(v))),I=E.next();!I.done;I=E.next()){var T=I.value;delete l[T]}}catch(y){u={error:y}}finally{try{I&&!I.done&&(d=E.return)&&d.call(E)}finally{if(u)throw u.error}}break;case H1:l={};break}}}catch(y){s={error:y}}finally{try{f&&!f.done&&(o=h.return)&&o.call(h)}finally{if(s)throw s.error}}return r.userProperties=l,this},commit:function(){return e.setIdentity(r),this}}},t.prototype.getIdentity=function(){return ni({},this.identity)},t.prototype.setIdentity=function(e){var n=ni({},this.identity);this.identity=ni({},e),zc(n,this.identity)||this.listeners.forEach(function(r){r(e)})},t.prototype.addIdentityListener=function(e){this.listeners.add(e)},t.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},t}(),la=typeof globalThis<"u"?globalThis:typeof global<"u"?global:self,W1=function(){function t(){this.identityStore=new q1,this.eventBridge=new U1,this.applicationContextProvider=new F1}return t.getInstance=function(e){return la.analyticsConnectorInstances||(la.analyticsConnectorInstances={}),la.analyticsConnectorInstances[e]||(la.analyticsConnectorInstances[e]=new t),la.analyticsConnectorInstances[e]},t}(),da=function(t){return t===void 0&&(t="$default_instance"),W1.getInstance(t)},z1=function(t,e){da(e).identityStore.editIdentity().setUserId(t).commit()},V1=function(t,e){da(e).identityStore.editIdentity().setDeviceId(t).commit()},K1=function(){function t(){this.name="identity",this.type="before",this.identityStore=da().identityStore}return t.prototype.execute=function(e){return X(this,void 0,void 0,function(){var n;return Z(this,function(r){return n=e.user_properties,n&&this.identityStore.editIdentity().updateUserProperties(n).commit(),[2,e]})})},t.prototype.setup=function(e){return X(this,void 0,void 0,function(){return Z(this,function(n){return e.instanceName&&(this.identityStore=da(e.instanceName).identityStore),[2]})})},t}(),sr=function(){var t="ampIntegrationContext";if(typeof globalThis<"u"&&typeof globalThis[t]<"u")return globalThis[t];if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global},Om=function(t,e){e===void 0&&(e=Date.now());var n=Date.now(),r=n-e;return r>t},Lm=function(t,e,n){return e===void 0&&(e=""),n===void 0&&(n=10),[Bc,e,t.substring(0,n)].filter(Boolean).join("_")},G1=function(t){return"".concat(Bc.toLowerCase(),"_").concat(t.substring(0,6))},Y1=function(){var t,e,n,r;if(typeof navigator>"u")return"";var i=navigator.userLanguage;return(r=(n=(e=(t=navigator.languages)===null||t===void 0?void 0:t[0])!==null&&e!==void 0?e:navigator.language)!==null&&n!==void 0?n:i)!==null&&r!==void 0?r:""},Vc=function(){var t,e=sr();if(!(!((t=e==null?void 0:e.location)===null||t===void 0)&&t.search))return{};var n=e.location.search.substring(1).split("&").filter(Boolean),r=n.reduce(function(i,s){var o=s.split("=",2),a=Dm(o[0]),c=Dm(o[1]);return c&&(i[a]=c),i},{});return r},Dm=function(t){t===void 0&&(t="");try{return decodeURIComponent(t)}catch{return""}},Z1=function(t){var e=new Error().stack||"";return e.split(`
`).slice(2+t).map(function(n){return n.trim()})},yt=function(t){return function(){var e=ie({},t.config),n=e.loggerProvider,r=e.logLevel;return{logger:n,logLevel:r}}},X1=function(t,e){var n,r;e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,"");try{for(var i=Ht(e.split(".")),s=i.next();!s.done;s=i.next()){var o=s.value;if(o in t)t=t[o];else return}}catch(a){n={error:a}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return t},bt=function(t,e){return function(){var n,r,i={};try{for(var s=Ht(e),o=s.next();!o.done;o=s.next()){var a=o.value;i[a]=X1(t,a)}}catch(c){n={error:c}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return i}},wt=function(t,e,n,r,i){return i===void 0&&(i=null),function(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];var a=n(),c=a.logger,u=a.logLevel;if(u&&u<cn.Debug||!u||!c)return t.apply(i,s);var d={type:"invoke public method",name:e,args:s,stacktrace:Z1(1),time:{start:new Date().toISOString()},states:{}};r&&d.states&&(d.states.before=r());var l=t.apply(i,s);return l&&l.promise?l.promise.then(function(){r&&d.states&&(d.states.after=r()),d.time&&(d.time.end=new Date().toISOString()),c.debug(JSON.stringify(d,null,2))}):(r&&d.states&&(d.states.after=r()),d.time&&(d.time.end=new Date().toISOString()),c.debug(JSON.stringify(d,null,2))),l}},Hd=function(){function t(){this.memoryStorage=new Map}return t.prototype.isEnabled=function(){return X(this,void 0,void 0,function(){return Z(this,function(e){return[2,!0]})})},t.prototype.get=function(e){return X(this,void 0,void 0,function(){return Z(this,function(n){return[2,this.memoryStorage.get(e)]})})},t.prototype.getRaw=function(e){return X(this,void 0,void 0,function(){var n;return Z(this,function(r){switch(r.label){case 0:return[4,this.get(e)];case 1:return n=r.sent(),[2,n?JSON.stringify(n):void 0]}})})},t.prototype.set=function(e,n){return X(this,void 0,void 0,function(){return Z(this,function(r){return this.memoryStorage.set(e,n),[2]})})},t.prototype.remove=function(e){return X(this,void 0,void 0,function(){return Z(this,function(n){return this.memoryStorage.delete(e),[2]})})},t.prototype.reset=function(){return X(this,void 0,void 0,function(){return Z(this,function(e){return this.memoryStorage.clear(),[2]})})},t}(),qd=function(){function t(e){this.options=ie({},e)}return t.prototype.isEnabled=function(){return X(this,void 0,void 0,function(){var e,n,r;return Z(this,function(i){switch(i.label){case 0:if(!sr())return[2,!1];t.testValue=String(Date.now()),e=new t(this.options),n="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,e.set(n,t.testValue)];case 2:return i.sent(),[4,e.get(n)];case 3:return r=i.sent(),[2,r===t.testValue];case 4:return i.sent(),[2,!1];case 5:return[4,e.remove(n)];case 6:return i.sent(),[7];case 7:return[2]}})})},t.prototype.get=function(e){var n;return X(this,void 0,void 0,function(){var r,i;return Z(this,function(s){switch(s.label){case 0:return[4,this.getRaw(e)];case 1:if(r=s.sent(),!r)return[2,void 0];try{return i=(n=J1(r))!==null&&n!==void 0?n:Q1(r),i===void 0?(console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(r)),[2,void 0]):[2,JSON.parse(i)]}catch{return console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(r)),[2,void 0]}return[2]}})})},t.prototype.getRaw=function(e){var n,r;return X(this,void 0,void 0,function(){var i,s,o;return Z(this,function(a){return i=sr(),s=(r=(n=i==null?void 0:i.document)===null||n===void 0?void 0:n.cookie.split("; "))!==null&&r!==void 0?r:[],o=s.find(function(c){return c.indexOf(e+"=")===0}),o?[2,o.substring(e.length+1)]:[2,void 0]})})},t.prototype.set=function(e,n){var r;return X(this,void 0,void 0,function(){var i,s,o,a,c,u,d;return Z(this,function(l){try{i=(r=this.options.expirationDays)!==null&&r!==void 0?r:0,s=n!==null?i:-1,o=void 0,s&&(a=new Date,a.setTime(a.getTime()+s*24*60*60*1e3),o=a),c="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(n)))),o&&(c+="; expires=".concat(o.toUTCString())),c+="; path=/",this.options.domain&&(c+="; domain=".concat(this.options.domain)),this.options.secure&&(c+="; Secure"),this.options.sameSite&&(c+="; SameSite=".concat(this.options.sameSite)),u=sr(),u&&(u.document.cookie=c)}catch(h){d=h instanceof Error?h.message:String(h),console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(d))}return[2]})})},t.prototype.remove=function(e){return X(this,void 0,void 0,function(){return Z(this,function(n){switch(n.label){case 0:return[4,this.set(e,null)];case 1:return n.sent(),[2]}})})},t.prototype.reset=function(){return X(this,void 0,void 0,function(){return Z(this,function(e){return[2]})})},t}(),J1=function(t){try{return decodeURIComponent(atob(t))}catch{return}},Q1=function(t){try{return decodeURIComponent(atob(decodeURIComponent(t)))}catch{return}},ex=function(t,e,n){return n===void 0&&(n=10),[Bc,e,t.substring(0,n)].filter(Boolean).join("_")},Kc=function(){function t(){}return t.prototype.send=function(e,n){return Promise.resolve(null)},t.prototype.buildResponse=function(e){var n,r,i,s,o,a,c,u,d,l,h,f,p,g,v,m,_,w,T,C,E,I;if(typeof e!="object")return null;var y=e.code||0,b=this.buildStatus(y);switch(b){case _t.Success:return{status:b,statusCode:y,body:{eventsIngested:(n=e.events_ingested)!==null&&n!==void 0?n:0,payloadSizeBytes:(r=e.payload_size_bytes)!==null&&r!==void 0?r:0,serverUploadTime:(i=e.server_upload_time)!==null&&i!==void 0?i:0}};case _t.Invalid:return{status:b,statusCode:y,body:{error:(s=e.error)!==null&&s!==void 0?s:"",missingField:(o=e.missing_field)!==null&&o!==void 0?o:"",eventsWithInvalidFields:(a=e.events_with_invalid_fields)!==null&&a!==void 0?a:{},eventsWithMissingFields:(c=e.events_with_missing_fields)!==null&&c!==void 0?c:{},eventsWithInvalidIdLengths:(u=e.events_with_invalid_id_lengths)!==null&&u!==void 0?u:{},epsThreshold:(d=e.eps_threshold)!==null&&d!==void 0?d:0,exceededDailyQuotaDevices:(l=e.exceeded_daily_quota_devices)!==null&&l!==void 0?l:{},silencedDevices:(h=e.silenced_devices)!==null&&h!==void 0?h:[],silencedEvents:(f=e.silenced_events)!==null&&f!==void 0?f:[],throttledDevices:(p=e.throttled_devices)!==null&&p!==void 0?p:{},throttledEvents:(g=e.throttled_events)!==null&&g!==void 0?g:[]}};case _t.PayloadTooLarge:return{status:b,statusCode:y,body:{error:(v=e.error)!==null&&v!==void 0?v:""}};case _t.RateLimit:return{status:b,statusCode:y,body:{error:(m=e.error)!==null&&m!==void 0?m:"",epsThreshold:(_=e.eps_threshold)!==null&&_!==void 0?_:0,throttledDevices:(w=e.throttled_devices)!==null&&w!==void 0?w:{},throttledUsers:(T=e.throttled_users)!==null&&T!==void 0?T:{},exceededDailyQuotaDevices:(C=e.exceeded_daily_quota_devices)!==null&&C!==void 0?C:{},exceededDailyQuotaUsers:(E=e.exceeded_daily_quota_users)!==null&&E!==void 0?E:{},throttledEvents:(I=e.throttled_events)!==null&&I!==void 0?I:[]}};case _t.Timeout:default:return{status:b,statusCode:y}}},t.prototype.buildStatus=function(e){return e>=200&&e<300?_t.Success:e===429?_t.RateLimit:e===413?_t.PayloadTooLarge:e===408?_t.Timeout:e>=400&&e<500?_t.Invalid:e>=500?_t.Failed:_t.Unknown},t}(),tx=function(t){Yt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.send=function(n,r){return X(this,void 0,void 0,function(){var i,s,o;return Z(this,function(a){switch(a.label){case 0:if(typeof fetch>"u")throw new Error("FetchTransport is not supported");return i={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(r),method:"POST"},[4,fetch(n,i)];case 1:return s=a.sent(),[4,s.text()];case 2:o=a.sent();try{return[2,this.buildResponse(JSON.parse(o))]}catch{return[2,this.buildResponse({code:s.status})]}return[2]}})})},e}(Kc),Nm=null,Fm=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],$m="data-amp-track-",Um=["div","span","h1","h2","h3","h4","h5","h6"],fa=function(t,e){return typeof t=="boolean"?t:(t==null?void 0:t[e])!==!1},Bm=function(t){return fa(t,"attribution")},nx=function(t){return fa(t,"fileDownloads")},rx=function(t){return fa(t,"formInteractions")},jm=function(t){return fa(t,"pageViews")},Hm=function(t){return fa(t,"sessions")},qm=function(t){return typeof t=="boolean"?t:typeof t=="object"&&(t.elementInteractions===!0||typeof t.elementInteractions=="object")},ix=function(t){if(qm(t.autocapture)&&typeof t.autocapture=="object"&&typeof t.autocapture.elementInteractions=="object")return t.autocapture.elementInteractions},sx=function(t){var e=function(){return!1},n=void 0,r,i=t.pageCounter,s=jm(t.defaultTracking);return s&&(e=void 0,r=void 0,t.defaultTracking&&typeof t.defaultTracking=="object"&&t.defaultTracking.pageViews&&typeof t.defaultTracking.pageViews=="object"&&("trackOn"in t.defaultTracking.pageViews&&(e=t.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in t.defaultTracking.pageViews&&(n=t.defaultTracking.pageViews.trackHistoryChanges),"eventType"in t.defaultTracking.pageViews&&t.defaultTracking.pageViews.eventType&&(r=t.defaultTracking.pageViews.eventType))),{trackOn:e,trackHistoryChanges:n,eventType:r,pageCounter:i}},ox=function(t){return Bm(t.defaultTracking)&&t.defaultTracking&&typeof t.defaultTracking=="object"&&t.defaultTracking.attribution&&typeof t.defaultTracking.attribution=="object"?ie({},t.defaultTracking.attribution):{}},Wd=function(t,e){for(var n=0;n<e.length;n++){var r=e[n],i=r.name,s=r.args,o=r.resolve,a=t&&t[i];if(typeof a=="function"){var c=a.apply(t,s);typeof o=="function"&&o(c==null?void 0:c.promise)}}return t},zd=function(t){var e=t;return e&&e._q!==void 0},Wm="2.12.2",ax="amplitude-ts",cx="Web",ux="$remote",lx=function(){function t(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(ax,"/").concat(Wm),typeof navigator<"u"&&(this.userAgent=navigator.userAgent)}return t.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},t.prototype.execute=function(e){var n,r;return X(this,void 0,void 0,function(){var i,s,o,a;return Z(this,function(c){return i=new Date().getTime(),s=(n=this.config.lastEventId)!==null&&n!==void 0?n:-1,o=(r=e.event_id)!==null&&r!==void 0?r:s+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=i),a=ie(ie(ie(ie(ie(ie(ie(ie({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:cx}),this.config.trackingOptions.language&&{language:Y1()}),this.config.trackingOptions.ipAddress&&{ip:ux}),{insert_id:Ps(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:o,library:this.library,user_agent:this.userAgent}),[2,a]})})},t}(),zm=function(){function t(e){this.storage=e}return t.prototype.isEnabled=function(){return X(this,void 0,void 0,function(){var e,n,r,i;return Z(this,function(s){switch(s.label){case 0:if(!this.storage)return[2,!1];e=String(Date.now()),n=new t(this.storage),r="AMP_TEST",s.label=1;case 1:return s.trys.push([1,4,5,7]),[4,n.set(r,e)];case 2:return s.sent(),[4,n.get(r)];case 3:return i=s.sent(),[2,i===e];case 4:return s.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return s.sent(),[7];case 7:return[2]}})})},t.prototype.get=function(e){return X(this,void 0,void 0,function(){var n;return Z(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return n=r.sent(),n?[2,JSON.parse(n)]:[2,void 0];case 2:return r.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},t.prototype.getRaw=function(e){var n;return X(this,void 0,void 0,function(){return Z(this,function(r){return[2,((n=this.storage)===null||n===void 0?void 0:n.getItem(e))||void 0]})})},t.prototype.set=function(e,n){var r;return X(this,void 0,void 0,function(){return Z(this,function(i){try{(r=this.storage)===null||r===void 0||r.setItem(e,JSON.stringify(n))}catch{}return[2]})})},t.prototype.remove=function(e){var n;return X(this,void 0,void 0,function(){return Z(this,function(r){try{(n=this.storage)===null||n===void 0||n.removeItem(e)}catch{}return[2]})})},t.prototype.reset=function(){var e;return X(this,void 0,void 0,function(){return Z(this,function(n){try{(e=this.storage)===null||e===void 0||e.clear()}catch{}return[2]})})},t}(),Gc=1e3,Vm=function(t){Yt(e,t);function e(n){var r=this,i;return r=t.call(this,(i=sr())===null||i===void 0?void 0:i.localStorage)||this,r.loggerProvider=n==null?void 0:n.loggerProvider,r}return e.prototype.set=function(n,r){var i;return X(this,void 0,void 0,function(){var s;return Z(this,function(o){switch(o.label){case 0:return Array.isArray(r)&&r.length>Gc?(s=r.length-Gc,[4,t.prototype.set.call(this,n,r.slice(0,Gc))]):[3,2];case 1:return o.sent(),(i=this.loggerProvider)===null||i===void 0||i.error("Failed to save ".concat(s," events because the queue length exceeded ").concat(Gc,".")),[3,4];case 2:return[4,t.prototype.set.call(this,n,r)];case 3:o.sent(),o.label=4;case 4:return[2]}})})},e}(zm),dx=function(t){Yt(e,t);function e(){var n;return t.call(this,(n=sr())===null||n===void 0?void 0:n.sessionStorage)||this}return e}(zm),fx=function(t){Yt(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.state={done:4},n}return e.prototype.send=function(n,r){return X(this,void 0,void 0,function(){var i=this;return Z(this,function(s){return[2,new Promise(function(o,a){typeof XMLHttpRequest>"u"&&a(new Error("XHRTransport is not supported."));var c=new XMLHttpRequest;c.open("POST",n,!0),c.onreadystatechange=function(){if(c.readyState===i.state.done){var u=c.responseText;try{o(i.buildResponse(JSON.parse(u)))}catch{o(i.buildResponse({code:c.status}))}}},c.setRequestHeader("Content-Type","application/json"),c.setRequestHeader("Accept","*/*"),c.send(JSON.stringify(r))})]})})},e}(Kc),hx=function(t){Yt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.send=function(n,r){return X(this,void 0,void 0,function(){var i=this;return Z(this,function(s){return[2,new Promise(function(o,a){var c=sr();if(!(c!=null&&c.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var u=JSON.stringify(r),d=c.navigator.sendBeacon(n,JSON.stringify(r));return o(d?i.buildResponse({code:200,events_ingested:r.events.length,payload_size_bytes:u.length,server_upload_time:Date.now()}):i.buildResponse({code:500}))}catch(l){a(l)}})]})})},e}(Kc),px=function(t,e,n){return n===void 0&&(n=!0),X(void 0,void 0,void 0,function(){var r,i,s,o,a,c,u,d,l;return Z(this,function(h){switch(h.label){case 0:return r=G1(t),[4,e.getRaw(r)];case 1:return i=h.sent(),i?n?[4,e.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:h.sent(),h.label=3;case 3:return s=Qe(i.split("."),6),o=s[0],a=s[1],c=s[2],u=s[3],d=s[4],l=s[5],[2,{deviceId:o,userId:gx(a),sessionId:Vd(u),lastEventId:Vd(l),lastEventTime:Vd(d),optOut:!!c}]}})})},Vd=function(t){var e=parseInt(t,32);if(!isNaN(e))return e},gx=function(t){if(!(!atob||!escape||!t))try{return decodeURIComponent(escape(atob(t)))}catch{return}},Hn="[Amplitude]",Km="".concat(Hn," Form Started"),mx="".concat(Hn," Form Submitted"),vx="".concat(Hn," File Downloaded"),Gm="session_start",Ym="session_end",_x="".concat(Hn," File Extension"),yx="".concat(Hn," File Name"),bx="".concat(Hn," Link ID"),wx="".concat(Hn," Link Text"),Sx="".concat(Hn," Link URL"),Kd="".concat(Hn," Form ID"),Gd="".concat(Hn," Form Name"),Yd="".concat(Hn," Form Destination"),Yc="cookie",Ex="US",kx=function(t){Yt(e,t);function e(n,r,i,s,o,a,c,u,d,l,h,f,p,g,v,m,_,w,T,C,E,I,y,b,k,x,R,F,z,J,U,q,V,j){i===void 0&&(i=new Hd),s===void 0&&(s={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),u===void 0&&(u=1e3),d===void 0&&(d=5),l===void 0&&(l=30),h===void 0&&(h=Yc),m===void 0&&(m=new Rm),_===void 0&&(_=cn.Warn),T===void 0&&(T=!1),C===void 0&&(C=!1),y===void 0&&(y=""),b===void 0&&(b=Ex),x===void 0&&(x=30*60*1e3),R===void 0&&(R=new Vm({loggerProvider:m})),F===void 0&&(F={ipAddress:!0,language:!0,platform:!0}),z===void 0&&(z="fetch"),J===void 0&&(J=!1),U===void 0&&(U=!1);var S=t.call(this,{apiKey:n,storageProvider:R,transportProvider:Zm(z)})||this;return S.apiKey=n,S.appVersion=r,S.cookieOptions=s,S.defaultTracking=o,S.autocapture=a,S.flushIntervalMillis=u,S.flushMaxRetries=d,S.flushQueueSize=l,S.identityStorage=h,S.ingestionMetadata=f,S.instanceName=p,S.loggerProvider=m,S.logLevel=_,S.minIdLength=w,S.offline=T,S.partnerId=E,S.plan=I,S.serverUrl=y,S.serverZone=b,S.sessionTimeout=x,S.storageProvider=R,S.trackingOptions=F,S.transport=z,S.useBatch=J,S.fetchRemoteConfig=U,S.version=Wm,S._optOut=!1,S._cookieStorage=i,S.deviceId=c,S.lastEventId=g,S.lastEventTime=v,S.optOut=C,S.sessionId=k,S.pageCounter=V,S.userId=q,S.debugLogsEnabled=j,S.loggerProvider.enable(j?cn.Debug:S.logLevel),S}return Object.defineProperty(e.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(n){this._cookieStorage!==n&&(this._cookieStorage=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deviceId",{get:function(){return this._deviceId},set:function(n){this._deviceId!==n&&(this._deviceId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},set:function(n){this._userId!==n&&(this._userId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},set:function(n){this._sessionId!==n&&(this._sessionId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(n){this._optOut!==n&&(this._optOut=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(n){this._lastEventTime!==n&&(this._lastEventTime=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(n){this._lastEventId!==n&&(this._lastEventId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(n){this._pageCounter!==n&&(this._pageCounter=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"debugLogsEnabled",{set:function(n){this._debugLogsEnabled!==n&&(this._debugLogsEnabled=n,this.updateStorage())},enumerable:!1,configurable:!0}),e.prototype.updateStorage=function(){var n={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled};this.cookieStorage.set(Lm(this.apiKey),n)},e}(O1),Cx=function(t,e,n){return e===void 0&&(e={}),X(void 0,void 0,void 0,function(){var r,i,s,o,a,c,u,d,l,h,f,p,g,v,m,_,w,T,C,E,I,y,b,k,x,R,F,z,J,U,q,V,j,S,P,N,O,W,te,K,Ue,ee,Se;return Z(this,function(be){switch(be.label){case 0:return r=e.identityStorage||Yc,C={},r===Yc?[3,1]:(s="",[3,5]);case 1:return(I=(E=e.cookieOptions)===null||E===void 0?void 0:E.domain)!==null&&I!==void 0?(o=I,[3,4]):[3,2];case 2:return[4,Ix()];case 3:o=be.sent(),be.label=4;case 4:s=o,be.label=5;case 5:return i=ie.apply(void 0,[(C.domain=s,C.expiration=365,C.sameSite="Lax",C.secure=!1,C.upgrade=!0,C),e.cookieOptions]),a=Tx(e.identityStorage,i),[4,px(t,a,(b=(y=e.cookieOptions)===null||y===void 0?void 0:y.upgrade)!==null&&b!==void 0?b:!0)];case 6:return c=be.sent(),[4,a.get(Lm(t))];case 7:return u=be.sent(),d=Vc(),l=(z=(F=(R=(x=(k=e.deviceId)!==null&&k!==void 0?k:d.ampDeviceId)!==null&&x!==void 0?x:d.deviceId)!==null&&R!==void 0?R:u==null?void 0:u.deviceId)!==null&&F!==void 0?F:c.deviceId)!==null&&z!==void 0?z:Ps(),h=(J=u==null?void 0:u.lastEventId)!==null&&J!==void 0?J:c.lastEventId,f=(U=u==null?void 0:u.lastEventTime)!==null&&U!==void 0?U:c.lastEventTime,p=(V=(q=e.optOut)!==null&&q!==void 0?q:u==null?void 0:u.optOut)!==null&&V!==void 0?V:c.optOut,g=(j=u==null?void 0:u.sessionId)!==null&&j!==void 0?j:c.sessionId,v=(P=(S=e.userId)!==null&&S!==void 0?S:u==null?void 0:u.userId)!==null&&P!==void 0?P:c.userId,n.previousSessionDeviceId=(N=u==null?void 0:u.deviceId)!==null&&N!==void 0?N:c.deviceId,n.previousSessionUserId=(O=u==null?void 0:u.userId)!==null&&O!==void 0?O:c.userId,m={ipAddress:(te=(W=e.trackingOptions)===null||W===void 0?void 0:W.ipAddress)!==null&&te!==void 0?te:!0,language:(Ue=(K=e.trackingOptions)===null||K===void 0?void 0:K.language)!==null&&Ue!==void 0?Ue:!0,platform:(Se=(ee=e.trackingOptions)===null||ee===void 0?void 0:ee.platform)!==null&&Se!==void 0?Se:!0},_=u==null?void 0:u.pageCounter,w=u==null?void 0:u.debugLogsEnabled,e.autocapture!==void 0&&(e.defaultTracking=e.autocapture),T=new kx(t,e.appVersion,a,i,e.defaultTracking,e.autocapture,l,e.flushIntervalMillis,e.flushMaxRetries,e.flushQueueSize,r,e.ingestionMetadata,e.instanceName,h,f,e.loggerProvider,e.logLevel,e.minIdLength,e.offline,p,e.partnerId,e.plan,e.serverUrl,e.serverZone,g,e.sessionTimeout,e.storageProvider,m,e.transport,e.useBatch,e.fetchRemoteConfig,v,_,w),[4,T.storageProvider.isEnabled()];case 8:return be.sent()||(T.loggerProvider.warn("Storage provider ".concat(T.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),T.storageProvider=new Hd),[2,T]}})})},Tx=function(t,e){switch(t===void 0&&(t=Yc),e===void 0&&(e={}),t){case"localStorage":return new Vm;case"sessionStorage":return new dx;case"none":return new Hd;case"cookie":default:return new qd(ie(ie({},e),{expirationDays:e.expiration}))}},Zm=function(t){return t==="xhr"?new fx:t==="beacon"?new hx:new tx},Ix=function(t){return X(void 0,void 0,void 0,function(){var e,n,r,i,s,s,o,a,c,u;return Z(this,function(d){switch(d.label){case 0:return[4,new qd().isEnabled()];case 1:if(!d.sent()||typeof location>"u"||!location.hostname)return[2,""];for(e=location.hostname,n=e.split("."),r=[],i="AMP_TLDTEST",s=n.length-2;s>=0;--s)r.push(n.slice(s).join("."));s=0,d.label=2;case 2:return s<r.length?(o=r[s],a={domain:"."+o},c=new qd(a),[4,c.set(i,1)]):[3,7];case 3:return d.sent(),[4,c.get(i)];case 4:return u=d.sent(),u?[4,c.remove(i)]:[3,6];case 5:return d.sent(),[2,"."+o];case 6:return s++,[3,2];case 7:return[2,""]}})})},Xm=function(){var t="ampIntegrationContext";if(typeof globalThis<"u"&&typeof globalThis[t]<"u")return globalThis[t];if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global},Jm=function(){var t,e=Xm();if(!(!((t=e==null?void 0:e.location)===null||t===void 0)&&t.search))return{};var n=e.location.search.substring(1).split("&").filter(Boolean),r=n.reduce(function(i,s){var o=s.split("=",2),a=Qm(o[0]),c=Qm(o[1]);return c&&(i[a]=c),i},{});return r},Qm=function(t){t===void 0&&(t="");try{return decodeURIComponent(t)}catch{return""}},xx="utm_campaign",Rx="utm_content",Ax="utm_id",Px="utm_medium",Mx="utm_source",Ox="utm_term",ev="dclid",tv="fbclid",nv="gbraid",rv="gclid",iv="ko_click_id",sv="li_fat_id",ov="msclkid",av="rtd_cid",cv="ttclid",uv="twclid",lv="wbraid",dv={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},Lx=function(){function t(){}return t.prototype.parse=function(){return X(this,void 0,void 0,function(){return Z(this,function(e){return[2,ie(ie(ie(ie({},dv),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},t.prototype.getUtmParam=function(){var e=Jm(),n=e[xx],r=e[Rx],i=e[Ax],s=e[Px],o=e[Mx],a=e[Ox];return{utm_campaign:n,utm_content:r,utm_id:i,utm_medium:s,utm_source:o,utm_term:a}},t.prototype.getReferrer=function(){var e,n,r={referrer:void 0,referring_domain:void 0};try{r.referrer=document.referrer||void 0,r.referring_domain=(n=(e=r.referrer)===null||e===void 0?void 0:e.split("/")[2])!==null&&n!==void 0?n:void 0}catch{}return r},t.prototype.getClickIds=function(){var e,n=Jm();return e={},e[ev]=n[ev],e[tv]=n[tv],e[nv]=n[nv],e[rv]=n[rv],e[iv]=n[iv],e[sv]=n[sv],e[ov]=n[ov],e[av]=n[av],e[cv]=n[cv],e[uv]=n[uv],e[lv]=n[lv],e},t}(),Zc;(function(t){t.SET="$set",t.SET_ONCE="$setOnce",t.ADD="$add",t.APPEND="$append",t.PREPEND="$prepend",t.REMOVE="$remove",t.PREINSERT="$preInsert",t.POSTINSERT="$postInsert",t.UNSET="$unset",t.CLEAR_ALL="$clearAll"})(Zc||(Zc={}));var fv;(function(t){t.REVENUE_PRODUCT_ID="$productId",t.REVENUE_QUANTITY="$quantity",t.REVENUE_PRICE="$price",t.REVENUE_TYPE="$revenueType",t.REVENUE_CURRENCY="$currency",t.REVENUE="$revenue"})(fv||(fv={}));var hv;(function(t){t.IDENTIFY="$identify",t.GROUP_IDENTIFY="$groupidentify",t.REVENUE="revenue_amount"})(hv||(hv={}));var Xc;(function(t){t.US="US",t.EU="EU"})(Xc||(Xc={}));var Jc;(function(t){t.Unknown="unknown",t.Skipped="skipped",t.Success="success",t.RateLimit="rate_limit",t.PayloadTooLarge="payload_too_large",t.Invalid="invalid",t.Failed="failed",t.Timeout="Timeout",t.SystemError="SystemError"})(Jc||(Jc={}));var Dx=function(t){var e={};for(var n in t){var r=t[n];r&&(e[n]=r)}return e},Nx="[Amplitude] Page Viewed",Fx=function(t){t===void 0&&(t={});var e,n=Xm(),r=void 0,i,s,o=t.trackOn,a=t.trackHistoryChanges,c=t.eventType,u=c===void 0?Nx:c,d=function(m){var _=m;try{_=decodeURI(m)}catch(w){r==null||r.error("Malformed URI sequence: ",w)}return _},l=function(){return X(void 0,void 0,void 0,function(){var m,_,w;return Z(this,function(T){switch(T.label){case 0:return m=d(typeof location<"u"&&location.href||""),w={event_type:u},_=[{}],[4,$x()];case 1:return[2,(w.event_properties=ie.apply(void 0,[ie.apply(void 0,_.concat([T.sent()])),{"[Amplitude] Page Domain":typeof location<"u"&&location.hostname||"","[Amplitude] Page Location":m,"[Amplitude] Page Path":typeof location<"u"&&d(location.pathname)||"","[Amplitude] Page Title":typeof document<"u"&&document.title||"","[Amplitude] Page URL":m.split("?")[0]}]),w)]}})})},h=function(){return typeof o>"u"||typeof o=="function"&&o()},f=typeof location<"u"?location.href:null,p=function(){return X(void 0,void 0,void 0,function(){var m,_,w,T;return Z(this,function(C){switch(C.label){case 0:return m=location.href,_=Bx(a,m,f||"")&&h(),f=m,_?(r==null||r.log("Tracking page view event"),e!=null?[3,1]:[3,3]):[3,4];case 1:return T=(w=e).track,[4,l()];case 2:T.apply(w,[C.sent()]),C.label=3;case 3:C.label=4;case 4:return[2]}})})},g=function(){p()},v={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(m,_){return X(void 0,void 0,void 0,function(){var w,T;return Z(this,function(C){switch(C.label){case 0:return e=_,s=m,r=m.loggerProvider,r.log("Installing @amplitude/plugin-page-view-tracking-browser"),n&&(n.addEventListener("popstate",g),i=n.history.pushState,n.history.pushState=new Proxy(n.history.pushState,{apply:function(E,I,y){var b=Qe(y,3),k=b[0],x=b[1],R=b[2];E.apply(I,[k,x,R]),p()}})),h()?(r.log("Tracking page view event"),T=(w=e).track,[4,l()]):[3,2];case 1:T.apply(w,[C.sent()]),C.label=2;case 2:return[2]}})})},execute:function(m){return X(void 0,void 0,void 0,function(){var _;return Z(this,function(w){switch(w.label){case 0:return o==="attribution"&&Ux(m)?(r==null||r.log("Enriching campaign event to page view event with campaign parameters"),[4,l()]):[3,2];case 1:_=w.sent(),m.event_type=_.event_type,m.event_properties=ie(ie({},m.event_properties),_.event_properties),w.label=2;case 2:return s&&m.event_type===u&&(s.pageCounter=s.pageCounter?s.pageCounter+1:1,m.event_properties=ie(ie({},m.event_properties),{"[Amplitude] Page Counter":s.pageCounter})),[2,m]}})})},teardown:function(){return X(void 0,void 0,void 0,function(){return Z(this,function(m){return n&&(n.removeEventListener("popstate",g),i&&(n.history.pushState=i)),[2]})})}};return v},$x=function(){return X(void 0,void 0,void 0,function(){var t;return Z(this,function(e){switch(e.label){case 0:return t=Dx,[4,new Lx().parse()];case 1:return[2,t.apply(void 0,[e.sent()])]}})})},Ux=function(t){if(t.event_type==="$identify"&&t.user_properties){var e=t.user_properties,n=e[Zc.SET]||{},r=e[Zc.UNSET]||{},i=Zt(Zt([],Qe(Object.keys(n)),!1),Qe(Object.keys(r)),!1);return Object.keys(dv).every(function(s){return i.includes(s)})}return!1},Bx=function(t,e,n){switch(t){case"pathOnly":{if(n=="")return!0;var r=new URL(e),i=new URL(n),s=r.origin+r.pathname,o=i.origin+i.pathname;return s!==o}default:return e!==n}},jx=function(){var t,e=[],n=function(u,d,l){u.addEventListener(d,l),e.push({element:u,type:d,handler:l})},r=function(){e.forEach(function(u){var d=u.element,l=u.type,h=u.handler;d==null||d.removeEventListener(l,h)}),e=[]},i="@amplitude/plugin-form-interaction-tracking-browser",s="enrichment",o=function(u,d){return X(void 0,void 0,void 0,function(){var l,h;return Z(this,function(f){return l=function(){if(!d){u.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");return}if(!(typeof document>"u")){var p=function(v){var m=!1;n(v,"change",function(){var _,w=pv(v);m||d.track(Km,(_={},_[Kd]=Ms(v.id),_[Gd]=Ms(v.name),_[Yd]=w,_)),m=!0}),n(v,"submit",function(){var _,w,T=pv(v);m||d.track(Km,(_={},_[Kd]=Ms(v.id),_[Gd]=Ms(v.name),_[Yd]=T,_)),d.track(mx,(w={},w[Kd]=Ms(v.id),w[Gd]=Ms(v.name),w[Yd]=T,w)),m=!1})},g=Array.from(document.getElementsByTagName("form"));g.forEach(p),typeof MutationObserver<"u"&&(t=new MutationObserver(function(v){v.forEach(function(m){m.addedNodes.forEach(function(_){_.nodeName==="FORM"&&p(_),"querySelectorAll"in _&&typeof _.querySelectorAll=="function"&&Array.from(_.querySelectorAll("form")).map(p)})})}),t.observe(document.body,{subtree:!0,childList:!0}))}},document.readyState==="complete"?l():(h=sr(),h?h.addEventListener("load",l):u.loggerProvider.debug("Form interaction tracking is not installed because global is undefined.")),[2]})})},a=function(u){return X(void 0,void 0,void 0,function(){return Z(this,function(d){return[2,u]})})},c=function(){return X(void 0,void 0,void 0,function(){return Z(this,function(u){return t==null||t.disconnect(),r(),[2]})})};return{name:i,type:s,setup:o,execute:a,teardown:c}},Ms=function(t){if(typeof t=="string")return t},pv=function(t){var e=t.getAttribute("action");try{e=new URL(encodeURI(e??""),window.location.href).href}catch{}return e},Hx=function(){var t,e=[],n=function(u,d,l){u.addEventListener(d,l),e.push({element:u,type:d,handler:l})},r=function(){e.forEach(function(u){var d=u.element,l=u.type,h=u.handler;d==null||d.removeEventListener(l,h)}),e=[]},i="@amplitude/plugin-file-download-tracking-browser",s="enrichment",o=function(u,d){return X(void 0,void 0,void 0,function(){var l,h;return Z(this,function(f){return l=function(){if(!d){u.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");return}if(!(typeof document>"u")){var p=function(m){var _;try{_=new URL(m.href,window.location.href)}catch{return}var w=g.exec(_.href),T=w==null?void 0:w[1];T&&n(m,"click",function(){var C;T&&d.track(vx,(C={},C[_x]=T,C[yx]=_.pathname,C[bx]=m.id,C[wx]=m.text,C[Sx]=m.href,C))})},g=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/,v=Array.from(document.getElementsByTagName("a"));v.forEach(p),typeof MutationObserver<"u"&&(t=new MutationObserver(function(m){m.forEach(function(_){_.addedNodes.forEach(function(w){w.nodeName==="A"&&p(w),"querySelectorAll"in w&&typeof w.querySelectorAll=="function"&&Array.from(w.querySelectorAll("a")).map(p)})})}),t.observe(document.body,{subtree:!0,childList:!0}))}},document.readyState==="complete"?l():(h=sr(),h?h.addEventListener("load",l):u.loggerProvider.debug("File download tracking is not installed because global is undefined.")),[2]})})},a=function(u){return X(void 0,void 0,void 0,function(){return Z(this,function(d){return[2,u]})})},c=function(){return X(void 0,void 0,void 0,function(){return Z(this,function(u){return t==null||t.disconnect(),r(),[2]})})};return{name:i,type:s,setup:o,execute:a,teardown:c}},gv=!1,qx=function(t){if(!(gv||t.defaultTracking!==void 0)){var e=`\`options.defaultTracking\` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to \`options.defaultTracking\`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:
amplitude.init(<YOUR_API_KEY>, {
defaultTracking: true,
});
Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.`;t.loggerProvider.warn(e),gv=!0}},Wx=function(){var t="@amplitude/plugin-network-checker-browser",e="before",n=sr(),r=[],i=function(c,u){n&&(n.addEventListener(c,u),r.push({type:c,handler:u}))},s=function(){r.forEach(function(c){var u=c.type,d=c.handler;n&&n.removeEventListener(u,d)}),r=[]},o=function(c,u){return X(void 0,void 0,void 0,function(){return Z(this,function(d){return typeof navigator>"u"?(c.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),c.offline=!1,[2]):(c.offline=!navigator.onLine,i("online",function(){c.loggerProvider.debug("Network connectivity changed to online."),c.offline=!1,setTimeout(function(){u.flush()},c.flushIntervalMillis)}),i("offline",function(){c.loggerProvider.debug("Network connectivity changed to offline."),c.offline=!0}),[2])})})},a=function(){return X(void 0,void 0,void 0,function(){return Z(this,function(c){return s(),[2]})})};return{name:t,type:e,setup:o,teardown:a}},zx="Network error occurred, remote config fetch failed",Vx="Remote config successfully fetched",Kx="Remote config fetch rejected due to exceeded retry count",mv="Remote config fetch rejected due to timeout after 5 seconds",vv="Unexpected error occurred",Gx="https://sr-client-cfg.amplitude.com/config",Yx="https://sr-client-cfg.stag2.amplitude.com/config",Zx="https://sr-client-cfg.eu.amplitude.com/config",Xx=function(){function t(e){var n=e.localConfig,r=e.configKeys,i=this;this.retryTimeout=1e3,this.attempts=0,this.sessionTargetingMatch=!1,this.metrics={},this.getRemoteConfig=function(s,o,a){return X(i,void 0,void 0,function(){var c,u,d;return Z(this,function(l){switch(l.label){case 0:return c=Date.now(),[4,this.fetchWithTimeout(a)];case 1:return u=l.sent(),u&&(d=u.configs&&u.configs[s],d)?(this.metrics.fetchTimeAPISuccess=Date.now()-c,[2,d[o]]):(this.metrics.fetchTimeAPIFail=Date.now()-c,[2,void 0])}})})},this.fetchWithTimeout=function(s){return X(i,void 0,void 0,function(){var o,a,c;return Z(this,function(u){switch(u.label){case 0:return o=new AbortController,a=setTimeout(function(){return o.abort()},5e3),[4,this.fetchRemoteConfig(o.signal,s)];case 1:return c=u.sent(),clearTimeout(a),[2,c]}})})},this.fetchRemoteConfig=function(s,o){return X(i,void 0,void 0,function(){var a,c,u,d,l,h,f,p,g,v,m,_,w;return Z(this,function(T){switch(T.label){case 0:if(o===this.lastFetchedSessionId&&this.attempts>=this.localConfig.flushMaxRetries)return[2,this.completeRequest({err:Kx})];if(s.aborted)return[2,this.completeRequest({err:mv})];o!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=o,this.attempts=0),T.label=1;case 1:T.trys.push([1,3,,4]),a=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(c=Ht(this.configKeys),u=c.next();!u.done;u=c.next())d=u.value,a.append("config_keys",d)}catch(C){m={error:C}}finally{try{u&&!u.done&&(_=c.return)&&_.call(c)}finally{if(m)throw m.error}}return o&&a.set("session_id",String(o)),l={headers:{Accept:"*/*"},method:"GET"},h="".concat(this.getServerUrl(),"?").concat(a.toString()),this.attempts+=1,[4,fetch(h,ie(ie({},l),{signal:s}))];case 2:if(f=T.sent(),f===null)return[2,this.completeRequest({err:vv})];switch(p=new Kc().buildStatus(f.status),p){case Jc.Success:return this.attempts=0,[2,this.parseAndStoreConfig(f)];case Jc.Failed:return[2,this.retryFetch(s,o)];default:return[2,this.completeRequest({err:zx})]}case 3:return g=T.sent(),v=g,s.aborted?[2,this.completeRequest({err:mv})]:[2,this.completeRequest({err:(w=v.message)!==null&&w!==void 0?w:vv})];case 4:return[2]}})})},this.retryFetch=function(s,o){return X(i,void 0,void 0,function(){var a=this;return Z(this,function(c){switch(c.label){case 0:return[4,new Promise(function(u){return setTimeout(u,a.attempts*a.retryTimeout)})];case 1:return c.sent(),[2,this.fetchRemoteConfig(s,o)]}})})},this.parseAndStoreConfig=function(s){return X(i,void 0,void 0,function(){var o;return Z(this,function(a){switch(a.label){case 0:return[4,s.json()];case 1:return o=a.sent(),this.completeRequest({success:Vx}),[2,o]}})})},this.localConfig=n,this.configKeys=r}return t.prototype.getServerUrl=function(){return this.localConfig.serverZone===Xc.STAGING?Yx:this.localConfig.serverZone===Xc.EU?Zx:Gx},t.prototype.completeRequest=function(e){var n=e.err,r=e.success;if(n)throw new Error(n);r&&this.localConfig.loggerProvider.log(r)},t}(),Jx=function(t){var e=t.localConfig,n=t.configKeys;return X(void 0,void 0,void 0,function(){return Z(this,function(r){return[2,new Xx({localConfig:e,configKeys:n})]})})},Qx=Jx,eR=function(){function t(e){this.config=e,this.config.loggerProvider.debug("Local configuration before merging with remote config",JSON.stringify(this.config,null,2))}return t.prototype.initialize=function(){return X(this,void 0,void 0,function(){var e;return Z(this,function(n){switch(n.label){case 0:return e=this,[4,Qx({localConfig:this.config,configKeys:["analyticsSDK"]})];case 1:return e.remoteConfigFetch=n.sent(),[2]}})})},t.prototype.generateJoinedConfig=function(){var e,n,r,i;return X(this,void 0,void 0,function(){var s,o,a;return Z(this,function(c){switch(c.label){case 0:return c.trys.push([0,3,,4]),o=this.remoteConfigFetch,o?[4,this.remoteConfigFetch.getRemoteConfig("analyticsSDK","browserSDK",this.config.sessionId)]:[3,2];case 1:o=c.sent(),c.label=2;case 2:return s=o,this.config.loggerProvider.debug("Remote configuration:",JSON.stringify(s,null,2)),s&&"autocapture"in s&&(typeof s.autocapture=="boolean"&&(this.config.autocapture=s.autocapture),typeof s.autocapture=="object"&&(this.config.autocapture===void 0&&(this.config.autocapture=s.autocapture),typeof this.config.autocapture=="boolean"&&(this.config.autocapture=ie({attribution:this.config.autocapture,fileDownloads:this.config.autocapture,formInteractions:this.config.autocapture,pageViews:this.config.autocapture,sessions:this.config.autocapture,elementInteractions:this.config.autocapture},s.autocapture)),typeof this.config.autocapture=="object"&&(this.config.autocapture=ie(ie({},this.config.autocapture),s.autocapture))),this.config.defaultTracking=this.config.autocapture),this.config.loggerProvider.debug("Joined configuration: ",JSON.stringify(this.config,null,2)),(e=(i=this.config).requestMetadata)!==null&&e!==void 0||(i.requestMetadata=new Pm),!((n=this.remoteConfigFetch)===null||n===void 0)&&n.metrics.fetchTimeAPISuccess&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_success",this.remoteConfigFetch.metrics.fetchTimeAPISuccess),!((r=this.remoteConfigFetch)===null||r===void 0)&&r.metrics.fetchTimeAPIFail&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_fail",this.remoteConfigFetch.metrics.fetchTimeAPIFail),[3,4];case 3:return a=c.sent(),this.config.loggerProvider.error("Failed to fetch remote configuration because of error: ",a),[3,4];case 4:return[2,this.config]}})})},t}(),tR=function(t){return X(void 0,void 0,void 0,function(){var e;return Z(this,function(n){switch(n.label){case 0:return e=new eR(t),[4,e.initialize()];case 1:return n.sent(),[2,e]}})})},nR="@amplitude/plugin-autocapture-browser",Zd="[Amplitude] Element Clicked",rR="[Amplitude] Element Changed",iR="[Amplitude] Element ID",sR="[Amplitude] Element Class",_v="[Amplitude] Element Tag",yv="[Amplitude] Element Text",oR="[Amplitude] Element Hierarchy",aR="[Amplitude] Element Href",cR="[Amplitude] Element Position Left",uR="[Amplitude] Element Position Top",lR="[Amplitude] Element Aria Label",dR="[Amplitude] Element Attributes",fR="[Amplitude] Element Parent Label",bv="[Amplitude] Page URL",hR="[Amplitude] Page Title",pR="[Amplitude] Viewport Height",gR="[Amplitude] Viewport Width",Qc="https://app.amplitude.com",mR="https://app.eu.amplitude.com",vR="https://apps.stag2.amplitude.com",_R={US:Qc,EU:mR,STAGING:vR},yR="",bR="amp-visual-tagging-selector-highlight";function et(t){return typeof t=="function"}function Xd(t){var e=function(r){Error.call(r),r.stack=new Error().stack},n=t(e);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var Jd=Xd(function(t){return function(n){t(this),this.message=n?n.length+` errors occurred during unsubscription:
`+n.map(function(r,i){return i+1+") "+r.toString()}).join(`
`):"",this.name="UnsubscriptionError",this.errors=n}});function eu(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var ha=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,n,r,i,s;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=Ht(o),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(g){e={error:g}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}else o.remove(this);var d=this.initialTeardown;if(et(d))try{d()}catch(g){s=g instanceof Jd?g.errors:[g]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var h=Ht(l),f=h.next();!f.done;f=h.next()){var p=f.value;try{Ev(p)}catch(g){s=s??[],g instanceof Jd?s=Zt(Zt([],Qe(s)),Qe(g.errors)):s.push(g)}}}catch(g){r={error:g}}finally{try{f&&!f.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}}if(s)throw new Jd(s)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)Ev(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(e)}},t.prototype._hasParent=function(e){var n=this._parentage;return n===e||Array.isArray(n)&&n.includes(e)},t.prototype._addParent=function(e){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(e),n):n?[n,e]:e},t.prototype._removeParent=function(e){var n=this._parentage;n===e?this._parentage=null:Array.isArray(n)&&eu(n,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&eu(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),wv=ha.EMPTY;function Sv(t){return t instanceof ha||t&&"closed"in t&&et(t.remove)&&et(t.add)&&et(t.unsubscribe)}function Ev(t){et(t)?t():t.unsubscribe()}var wR={Promise:void 0},SR={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,Zt([t,e],Qe(n)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function kv(t){SR.setTimeout(function(){throw t})}function Qd(){}function tu(t){t()}var ef=function(t){Yt(e,t);function e(n){var r=t.call(this)||this;return r.isStopped=!1,n?(r.destination=n,Sv(n)&&n.add(r)):r.destination=CR,r}return e.create=function(n,r,i){return new pa(n,r,i)},e.prototype.next=function(n){this.isStopped||this._next(n)},e.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(n){this.destination.next(n)},e.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(ha),ER=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var n=this.partialObserver;if(n.next)try{n.next(e)}catch(r){nu(r)}},t.prototype.error=function(e){var n=this.partialObserver;if(n.error)try{n.error(e)}catch(r){nu(r)}else nu(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(n){nu(n)}},t}(),pa=function(t){Yt(e,t);function e(n,r,i){var s=t.call(this)||this,o;return et(n)||!n?o={next:n??void 0,error:r??void 0,complete:i??void 0}:o=n,s.destination=new ER(o),s}return e}(ef);function nu(t){kv(t)}function kR(t){throw t}var CR={closed:!0,next:Qd,error:kR,complete:Qd},tf=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Cv(t){return t}function TR(t){return t.length===0?Cv:t.length===1?t[0]:function(n){return t.reduce(function(r,i){return i(r)},n)}}var Xt=function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(e,n,r){var i=this,s=xR(e)?e:new pa(e,n,r);return tu(function(){var o=i,a=o.operator,c=o.source;s.add(a?a.call(s,c):c?i._subscribe(s):i._trySubscribe(s))}),s},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(n){e.error(n)}},t.prototype.forEach=function(e,n){var r=this;return n=Tv(n),new n(function(i,s){var o=new pa({next:function(a){try{e(a)}catch(c){s(c),o.unsubscribe()}},error:s,complete:i});r.subscribe(o)})},t.prototype._subscribe=function(e){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(e)},t.prototype[tf]=function(){return this},t.prototype.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return TR(e)(this)},t.prototype.toPromise=function(e){var n=this;return e=Tv(e),new e(function(r,i){var s;n.subscribe(function(o){return s=o},function(o){return i(o)},function(){return r(s)})})},t.create=function(e){return new t(e)},t}();function Tv(t){var e;return(e=t??wR.Promise)!==null&&e!==void 0?e:Promise}function IR(t){return t&&et(t.next)&&et(t.error)&&et(t.complete)}function xR(t){return t&&t instanceof ef||IR(t)&&Sv(t)}function RR(t){return et(t==null?void 0:t.lift)}function kn(t){return function(e){if(RR(e))return e.lift(function(n){try{return t(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function vn(t,e,n,r,i){return new AR(t,e,n,r,i)}var AR=function(t){Yt(e,t);function e(n,r,i,s,o,a){var c=t.call(this,n)||this;return c.onFinalize=o,c.shouldUnsubscribe=a,c._next=r?function(u){try{r(u)}catch(d){n.error(d)}}:t.prototype._next,c._error=s?function(u){try{s(u)}catch(d){n.error(d)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=i?function(){try{i()}catch(u){n.error(u)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},e}(ef),PR=Xd(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Iv=function(t){Yt(e,t);function e(){var n=t.call(this)||this;return n.closed=!1,n.currentObservers=null,n.observers=[],n.isStopped=!1,n.hasError=!1,n.thrownError=null,n}return e.prototype.lift=function(n){var r=new xv(this,this);return r.operator=n,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new PR},e.prototype.next=function(n){var r=this;tu(function(){var i,s;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var o=Ht(r.currentObservers),a=o.next();!a.done;a=o.next()){var c=a.value;c.next(n)}}catch(u){i={error:u}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}}})},e.prototype.error=function(n){var r=this;tu(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=n;for(var i=r.observers;i.length;)i.shift().error(n)}})},e.prototype.complete=function(){var n=this;tu(function(){if(n._throwIfClosed(),!n.isStopped){n.isStopped=!0;for(var r=n.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var n;return((n=this.observers)===null||n===void 0?void 0:n.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(n){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,n)},e.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},e.prototype._innerSubscribe=function(n){var r=this,i=this,s=i.hasError,o=i.isStopped,a=i.observers;return s||o?wv:(this.currentObservers=null,a.push(n),new ha(function(){r.currentObservers=null,eu(a,n)}))},e.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,s=r.thrownError,o=r.isStopped;i?n.error(s):o&&n.complete()},e.prototype.asObservable=function(){var n=new Xt;return n.source=this,n},e.create=function(n,r){return new xv(n,r)},e}(Xt),xv=function(t){Yt(e,t);function e(n,r){var i=t.call(this)||this;return i.destination=n,i.source=r,i}return e.prototype.next=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,n)},e.prototype.error=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,n)},e.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},e.prototype._subscribe=function(n){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&i!==void 0?i:wv},e}(Iv),MR={now:function(){return Date.now()}},OR=function(t){Yt(e,t);function e(n,r){return t.call(this)||this}return e.prototype.schedule=function(n,r){return this},e}(ha),Rv={setInterval:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,Zt([t,e],Qe(n)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},LR=function(t){Yt(e,t);function e(n,r){var i=t.call(this,n,r)||this;return i.scheduler=n,i.work=r,i.pending=!1,i}return e.prototype.schedule=function(n,r){var i;if(r===void 0&&(r=0),this.closed)return this;this.state=n;var s=this.id,o=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(o,s,r)),this.pending=!0,this.delay=r,this.id=(i=this.id)!==null&&i!==void 0?i:this.requestAsyncId(o,this.id,r),this},e.prototype.requestAsyncId=function(n,r,i){return i===void 0&&(i=0),Rv.setInterval(n.flush.bind(n,this),i)},e.prototype.recycleAsyncId=function(n,r,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return r;r!=null&&Rv.clearInterval(r)},e.prototype.execute=function(n,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(n,r);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(n,r){var i=!1,s;try{this.work(n)}catch(o){i=!0,s=o||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var n=this,r=n.id,i=n.scheduler,s=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,eu(s,this),r!=null&&(this.id=this.recycleAsyncId(i,r,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(OR),Av=function(){function t(e,n){n===void 0&&(n=t.now),this.schedulerActionCtor=e,this.now=n}return t.prototype.schedule=function(e,n,r){return n===void 0&&(n=0),new this.schedulerActionCtor(this,e).schedule(r,n)},t.now=MR.now,t}(),DR=function(t){Yt(e,t);function e(n,r){r===void 0&&(r=Av.now);var i=t.call(this,n,r)||this;return i.actions=[],i._active=!1,i}return e.prototype.flush=function(n){var r=this.actions;if(this._active){r.push(n);return}var i;this._active=!0;do if(i=n.execute(n.state,n.delay))break;while(n=r.shift());if(this._active=!1,i){for(;n=r.shift();)n.unsubscribe();throw i}},e}(Av),ru=new DR(LR),NR=ru,nf=new Xt(function(t){return t.complete()});function Pv(t){return t&&et(t.schedule)}function Mv(t){return t[t.length-1]}function FR(t){return Pv(Mv(t))?t.pop():void 0}function $R(t,e){return typeof Mv(t)=="number"?t.pop():e}var rf=function(t){return t&&typeof t.length=="number"&&typeof t!="function"};function Ov(t){return et(t==null?void 0:t.then)}function Lv(t){return et(t[tf])}function Dv(t){return Symbol.asyncIterator&&et(t==null?void 0:t[Symbol.asyncIterator])}function Nv(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function UR(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Fv=UR();function $v(t){return et(t==null?void 0:t[Fv])}function Uv(t){return d1(this,arguments,function(){var n,r,i,s;return Z(this,function(o){switch(o.label){case 0:n=t.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,Rs(n.read())];case 3:return r=o.sent(),i=r.value,s=r.done,s?[4,Rs(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,Rs(i)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function Bv(t){return et(t==null?void 0:t.getReader)}function _n(t){if(t instanceof Xt)return t;if(t!=null){if(Lv(t))return BR(t);if(rf(t))return jR(t);if(Ov(t))return HR(t);if(Dv(t))return jv(t);if($v(t))return qR(t);if(Bv(t))return WR(t)}throw Nv(t)}function BR(t){return new Xt(function(e){var n=t[tf]();if(et(n.subscribe))return n.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function jR(t){return new Xt(function(e){for(var n=0;n<t.length&&!e.closed;n++)e.next(t[n]);e.complete()})}function HR(t){return new Xt(function(e){t.then(function(n){e.closed||(e.next(n),e.complete())},function(n){return e.error(n)}).then(null,kv)})}function qR(t){return new Xt(function(e){var n,r;try{for(var i=Ht(t),s=i.next();!s.done;s=i.next()){var o=s.value;if(e.next(o),e.closed)return}}catch(a){n={error:a}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()})}function jv(t){return new Xt(function(e){zR(t,e).catch(function(n){return e.error(n)})})}function WR(t){return jv(Uv(t))}function zR(t,e){var n,r,i,s;return X(this,void 0,void 0,function(){var o,a;return Z(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=f1(t),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(o=r.value,e.next(o),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(s=n.return)?[4,s.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function ri(t,e,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var s=e.schedule(function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()},r);if(t.add(s),!i)return s}function Hv(t,e){return e===void 0&&(e=0),kn(function(n,r){n.subscribe(vn(r,function(i){return ri(r,t,function(){return r.next(i)},e)},function(){return ri(r,t,function(){return r.complete()},e)},function(i){return ri(r,t,function(){return r.error(i)},e)}))})}function qv(t,e){return e===void 0&&(e=0),kn(function(n,r){r.add(t.schedule(function(){return n.subscribe(r)},e))})}function VR(t,e){return _n(t).pipe(qv(e),Hv(e))}function KR(t,e){return _n(t).pipe(qv(e),Hv(e))}function GR(t,e){return new Xt(function(n){var r=0;return e.schedule(function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())})})}function YR(t,e){return new Xt(function(n){var r;return ri(n,e,function(){r=t[Fv](),ri(n,e,function(){var i,s,o;try{i=r.next(),s=i.value,o=i.done}catch(a){n.error(a);return}o?n.complete():n.next(s)},0,!0)}),function(){return et(r==null?void 0:r.return)&&r.return()}})}function Wv(t,e){if(!t)throw new Error("Iterable cannot be null");return new Xt(function(n){ri(n,e,function(){var r=t[Symbol.asyncIterator]();ri(n,e,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function ZR(t,e){return Wv(Uv(t),e)}function XR(t,e){if(t!=null){if(Lv(t))return VR(t,e);if(rf(t))return GR(t,e);if(Ov(t))return KR(t,e);if(Dv(t))return Wv(t,e);if($v(t))return YR(t,e);if(Bv(t))return ZR(t,e)}throw Nv(t)}function JR(t,e){return e?XR(t,e):_n(t)}function zv(t){return t instanceof Date&&!isNaN(t)}var QR=Xd(function(t){return function(n){n===void 0&&(n=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=n}});function eA(t,e){var n=zv(t)?{first:t}:typeof t=="number"?{each:t}:t,r=n.first,i=n.each,s=n.with,o=s===void 0?tA:s,a=n.scheduler,c=a===void 0?ru:a,u=n.meta,d=u===void 0?null:u;if(r==null&&i==null)throw new TypeError("No timeout provided.");return kn(function(l,h){var f,p,g=null,v=0,m=function(_){p=ri(h,c,function(){try{f.unsubscribe(),_n(o({meta:d,lastValue:g,seen:v})).subscribe(h)}catch(w){h.error(w)}},_)};f=l.subscribe(vn(h,function(_){p==null||p.unsubscribe(),v++,h.next(g=_),i>0&&m(i)},void 0,void 0,function(){p!=null&&p.closed||p==null||p.unsubscribe(),g=null})),!v&&m(r!=null?typeof r=="number"?r:+r-c.now():i)})}function tA(t){throw new QR(t)}function or(t,e){return kn(function(n,r){var i=0;n.subscribe(vn(r,function(s){r.next(t.call(e,s,i++))}))})}var nA=Array.isArray;function rA(t,e){return nA(e)?t.apply(void 0,Zt([],Qe(e))):t(e)}function iA(t){return or(function(e){return rA(t,e)})}function sA(t,e,n,r,i,s,o,a){var c=[],u=0,d=0,l=!1,h=function(){l&&!c.length&&!u&&e.complete()},f=function(g){return u<r?p(g):c.push(g)},p=function(g){u++;var v=!1;_n(n(g,d++)).subscribe(vn(e,function(m){e.next(m)},function(){v=!0},void 0,function(){if(v)try{u--;for(var m=function(){var _=c.shift();o||p(_)};c.length&&u<r;)m();h()}catch(_){e.error(_)}}))};return t.subscribe(vn(e,f,function(){l=!0,h()})),function(){}}function iu(t,e,n){return n===void 0&&(n=1/0),et(e)?iu(function(r,i){return or(function(s,o){return e(r,s,i,o)})(_n(t(r,i)))},n):(typeof e=="number"&&(n=e),kn(function(r,i){return sA(r,i,t,n)}))}function oA(t){return t===void 0&&(t=1/0),iu(Cv,t)}var aA=["addListener","removeListener"],cA=["addEventListener","removeEventListener"],uA=["on","off"];function ga(t,e,n,r){if(et(n)&&(r=n,n=void 0),r)return ga(t,e,n).pipe(iA(r));var i=Qe(fA(t)?cA.map(function(a){return function(c){return t[a](e,c,n)}}):lA(t)?aA.map(Vv(t,e)):dA(t)?uA.map(Vv(t,e)):[],2),s=i[0],o=i[1];if(!s&&rf(t))return iu(function(a){return ga(a,e,n)})(_n(t));if(!s)throw new TypeError("Invalid event target");return new Xt(function(a){var c=function(){for(var u=[],d=0;d<arguments.length;d++)u[d]=arguments[d];return a.next(1<u.length?u:u[0])};return s(c),function(){return o(c)}})}function Vv(t,e){return function(n){return function(r){return t[n](e,r)}}}function lA(t){return et(t.addListener)&&et(t.removeListener)}function dA(t){return et(t.on)&&et(t.off)}function fA(t){return et(t.addEventListener)&&et(t.removeEventListener)}function hA(t,e,n){n===void 0&&(n=NR);var r=-1;return e!=null&&(Pv(e)?n=e:r=e),new Xt(function(i){var s=zv(t)?0-n.now():t;s<0&&(s=0);var o=0;return n.schedule(function(){i.closed||(i.next(o++),0<=r?this.schedule(void 0,r):i.complete())},s)})}function Kv(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=FR(t),r=$R(t,1/0),i=t;return i.length?i.length===1?_n(i[0]):oA(r)(JR(i,n)):nf}function ii(t,e){return kn(function(n,r){var i=0;n.subscribe(vn(r,function(s){return t.call(e,s,i++)&&r.next(s)}))})}function pA(t){return kn(function(e,n){var r=[];return e.subscribe(vn(n,function(i){return r.push(i)},function(){n.next(r),n.complete()})),_n(t).subscribe(vn(n,function(){var i=r;r=[],n.next(i)},Qd)),function(){r=null}})}function gA(t,e){return e===void 0&&(e=ru),kn(function(n,r){var i=null,s=null,o=null,a=function(){if(i){i.unsubscribe(),i=null;var u=s;s=null,r.next(u)}};function c(){var u=o+t,d=e.now();if(d<u){i=this.schedule(void 0,u-d),r.add(i);return}a()}n.subscribe(vn(r,function(u){s=u,o=e.now(),i||(i=e.schedule(c,t),r.add(i))},function(){a(),r.complete()},void 0,function(){s=i=null}))})}function Gv(t){return t<=0?function(){return nf}:kn(function(e,n){var r=0;e.subscribe(vn(n,function(i){++r<=t&&(n.next(i),t<=r&&n.complete())}))})}function mA(t){return or(function(){return t})}function vA(t,e){return iu(function(n,r){return _n(t(n,r)).pipe(Gv(1),mA(n))})}function _A(t,e){e===void 0&&(e=ru);var n=hA(t,e);return vA(function(){return n})}function yA(){return kn(function(t,e){var n,r=!1;t.subscribe(vn(e,function(i){var s=n;n=i,r&&e.next([s,i]),r=!0}))})}function su(t){t===void 0&&(t={});var e=t.connector,n=e===void 0?function(){return new Iv}:e,r=t.resetOnError,i=r===void 0?!0:r,s=t.resetOnComplete,o=s===void 0?!0:s,a=t.resetOnRefCountZero,c=a===void 0?!0:a;return function(u){var d,l,h,f=0,p=!1,g=!1,v=function(){l==null||l.unsubscribe(),l=void 0},m=function(){v(),d=h=void 0,p=g=!1},_=function(){var w=d;m(),w==null||w.unsubscribe()};return kn(function(w,T){f++,!g&&!p&&v();var C=h=h??n();T.add(function(){f--,f===0&&!g&&!p&&(l=sf(_,c))}),C.subscribe(T),!d&&f>0&&(d=new pa({next:function(E){return C.next(E)},error:function(E){g=!0,v(),l=sf(m,i,E),C.error(E)},complete:function(){p=!0,v(),l=sf(m,o),C.complete()}}),_n(w).subscribe(d))})(u)}}function sf(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(e===!0){t();return}if(e!==!1){var i=new pa({next:function(){i.unsubscribe(),t()}});return _n(e.apply(void 0,Zt([],Qe(n)))).subscribe(i)}}function bA(t,e){return kn(function(n,r){var i=null,s=0,o=!1,a=function(){return o&&!i&&r.complete()};n.subscribe(vn(r,function(c){i==null||i.unsubscribe();var u=0,d=s++;_n(t(c,d)).subscribe(i=vn(r,function(l){return r.next(e?e(c,l,d,u++):l)},function(){i=null,a()}))},function(){o=!0,a()}))})}var wA=["input","select","textarea"],of=function(t,e){return function(n,r){var i,s,o,a=t.pageUrlAllowlist,c=t.shouldTrackEventResolver,u=(s=(i=r==null?void 0:r.tagName)===null||i===void 0?void 0:i.toLowerCase)===null||s===void 0?void 0:s.call(i);if(!u)return!1;if(c)return c(n,r);if(!EA(window.location.href,a))return!1;var d=String(r==null?void 0:r.getAttribute("type"))||"";if(typeof d=="string")switch(d.toLowerCase()){case"hidden":return!1;case"password":return!1}if(e){var l=e.some(function(f){var p;return!!(!((p=r==null?void 0:r.matches)===null||p===void 0)&&p.call(r,f))});if(!l)return!1}switch(u){case"input":case"select":case"textarea":return n==="change"||n==="click";default:{var h=(o=window==null?void 0:window.getComputedStyle)===null||o===void 0?void 0:o.call(window,r);return h&&h.getPropertyValue("cursor")==="pointer"&&n==="click"?!0:n==="click"}}}},Yv=function(t){if(t==null)return!1;if(typeof t=="string"){var e=/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/;if(e.test((t||"").replace(/[- ]/g,"")))return!1;var n=/(^\d{3}-?\d{2}-?\d{4}$)/;if(n.test(t))return!1}return!0},SA=function(t){return!!t&&t.nodeType===3},Zv=function(t){var e,n,r,i=(n=(e=t==null?void 0:t.tagName)===null||e===void 0?void 0:e.toLowerCase)===null||n===void 0?void 0:n.call(e),s=t instanceof HTMLElement?((r=t.getAttribute("contenteditable"))===null||r===void 0?void 0:r.toLowerCase())==="true":!1;return!wA.includes(i)&&!s},af=function(t){var e="";return Zv(t)&&t.childNodes&&t.childNodes.length&&t.childNodes.forEach(function(n){var r="";SA(n)?n.textContent&&(r=n.textContent):r=af(n),e+=r.split(/(\s+)/).filter(Yv).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}),e},EA=function(t,e){return!e||!e.length?!0:e.some(function(n){return typeof n=="string"?t===n:t.match(n)})},kA=function(t,e){return t.getAttributeNames().reduce(function(n,r){if(r.startsWith(e)){var i=r.replace(e,""),s=t.getAttribute(r);i&&(n[i]=s||"")}return n},{})},CA=function(t){return t==null||typeof t=="object"&&Object.keys(t).length===0||typeof t=="string"&&t.trim().length===0},Xv=function(t){return Object.keys(t).reduce(function(e,n){var r=t[n];return CA(r)||(e[n]=r),e},{})},Jv=function(t){var e=t.parentElement;if(!e)return"";var n;try{n=e.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch{n=null}if(n){var r=n.textContent||"";return Yv(r)?r:""}return Jv(e)},cf=function(t,e){return t?e.some(function(n){var r;return(r=t==null?void 0:t.matches)===null||r===void 0?void 0:r.call(t,n)})?t:cf(t==null?void 0:t.parentElement,e):null},TA=function(t){var e,n,r;if(!t)return{};var i=(r=(n=t==null?void 0:t.tagName)===null||n===void 0?void 0:n.toLowerCase)===null||r===void 0?void 0:r.call(n),s=(e={},e[_v]=i,e[yv]=af(t),e[bv]=window.location.href.split("?")[0],e);return Xv(s)},IA=function(t){return new Promise(function(e,n){var r;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=t,i.addEventListener("load",function(){e({status:!0})},{once:!0}),i.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(t)})}),(r=document.head)===null||r===void 0||r.appendChild(i)}catch(s){n(s)}})};function xA(){return"".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9))}var uf=function(t){return!(t.event.target===null||!t.closestTrackedAncestor)},RA=function(){function t(e){var n=e===void 0?{}:e,r=n.origin,i=r===void 0?Qc:r,s=this;this.endpoint=Qc,this.requestCallbacks={},this.onSelect=function(o){s.notify({action:"element-selected",data:o})},this.onTrack=function(o,a){o==="selector-mode-changed"?s.notify({action:"track-selector-mode-changed",data:a}):o==="selector-moved"&&s.notify({action:"track-selector-moved",data:a})},this.endpoint=i}return t.prototype.notify=function(e){var n,r,i,s;(r=(n=this.logger)===null||n===void 0?void 0:n.debug)===null||r===void 0||r.call(n,"Message sent: ",JSON.stringify(e)),(s=(i=window.opener)===null||i===void 0?void 0:i.postMessage)===null||s===void 0||s.call(i,e,this.endpoint)},t.prototype.sendRequest=function(e,n,r){var i=this;r===void 0&&(r={timeout:15e3});var s=xA(),o={id:s,action:e,args:n},a=new Promise(function(c,u){i.requestCallbacks[s]={resolve:c,reject:u},i.notify(o),(r==null?void 0:r.timeout)>0&&setTimeout(function(){u(new Error("".concat(e," timed out (id: ").concat(s,")"))),delete i.requestCallbacks[s]},r.timeout)});return a},t.prototype.handleResponse=function(e){var n;if(!this.requestCallbacks[e.id]){(n=this.logger)===null||n===void 0||n.warn("No callback found for request id: ".concat(e.id));return}this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]},t.prototype.setup=function(e){var n=this,r=e===void 0?{}:e,i=r.logger,s=r.endpoint,o=r.isElementSelectable,a=r.cssSelectorAllowlist,c=r.actionClickAllowlist;this.logger=i,s&&this.endpoint===Qc&&(this.endpoint=s);var u=null;window.addEventListener("message",function(d){var l,h,f,p,g;if((h=(l=n.logger)===null||l===void 0?void 0:l.debug)===null||h===void 0||h.call(l,"Message received: ",JSON.stringify(d)),n.endpoint===d.origin){var v=d==null?void 0:d.data,m=v==null?void 0:v.action;if(m)if("id"in v)(p=(f=n.logger)===null||f===void 0?void 0:f.debug)===null||p===void 0||p.call(f,"Received Response to previous request: ",JSON.stringify(d)),n.handleResponse(v);else if(m==="ping")n.notify({action:"pong"});else if(m==="initialize-visual-tagging-selector"){var _=v==null?void 0:v.data;IA(yR).then(function(){var w;u=(w=window==null?void 0:window.amplitudeVisualTaggingSelector)===null||w===void 0?void 0:w.call(window,{getEventTagProps:TA,isElementSelectable:function(T){return o?o((_==null?void 0:_.actionType)||"click",T):!0},onTrack:n.onTrack,onSelect:n.onSelect,visualHighlightClass:bR,messenger:n,cssSelectorAllowlist:a,actionClickAllowlist:c}),n.notify({action:"selector-loaded"})}).catch(function(){var w;(w=n.logger)===null||w===void 0||w.warn("Failed to initialize visual tagging selector")})}else m==="close-visual-tagging-selector"&&((g=u==null?void 0:u.close)===null||g===void 0||g.call(u))}}),this.notify({action:"page-loaded"})},t}(),AA=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],PA=["type"],MA=["svg","path","g"],OA=["password","hidden"],LA=128,DA=1024;function NA(t){var e,n,r,i,s,o;if(t===null)return null;var a=String(t.tagName).toLowerCase(),c={tag:a},u=Array.from((i=(r=t.parentElement)===null||r===void 0?void 0:r.children)!==null&&i!==void 0?i:[]);u.length&&(c.index=u.indexOf(t),c.indexOfType=u.filter(function(T){return T.tagName===t.tagName}).indexOf(t));var d=(o=(s=t.previousElementSibling)===null||s===void 0?void 0:s.tagName)===null||o===void 0?void 0:o.toLowerCase();d&&(c.prevSib=String(d));var l=t.getAttribute("id");l&&(c.id=String(l));var h=Array.from(t.classList);h.length&&(c.classes=h);var f={},p=Array.from(t.attributes),g=p.filter(function(T){return!AA.includes(T.name)}),v=!Zv(t);if(!OA.includes(String(t.getAttribute("type")))&&!MA.includes(a))try{for(var m=Ht(g),_=m.next();!_.done;_=m.next()){var w=_.value;v&&!PA.includes(w.name)||(f[w.name]=String(w.value).substring(0,LA))}}catch(T){e={error:T}}finally{try{_&&!_.done&&(n=m.return)&&n.call(m)}finally{if(e)throw e.error}}return Object.keys(f).length&&(c.attrs=f),c}function FA(t){var e=[];if(!t)return e;e.push(t);for(var n=t.parentElement;n&&n.tagName!=="HTML";)e.push(n),n=n.parentElement;return e}var $A=function(t){var e=[];if(!t)return[];var n=FA(t);return e=UA(n.map(function(r){return NA(r)}),DA),e};function UA(t,e){for(var n=0,r=0;r<t.length;r++){var i=t[r];if(i===null)n+=4;else{var s=ou(i);n+=s?Array.from(s).length:4}if(n>e)return t.slice(0,r)}return t}function ou(t,e){e===void 0&&(e=!1);try{if(t==null)return e?"None":null;if(typeof t=="string")return e?(t=t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r"),t.includes('"')?"'".concat(t,"'"):t.includes("'")?'"'.concat(t.replace(/'/g,"\\'"),'"'):"'".concat(t,"'")):t;if(typeof t=="boolean")return t?"True":"False";if(Array.isArray(t)){var n=t.map(function(s){return ou(s,!0)});return"[".concat(n.join(", "),"]")}else if(typeof t=="object"){var r=Object.entries(t).filter(function(s){var o=Qe(s,1),a=o[0];return a!=null}).map(function(s){var o=Qe(s,2),a=o[0],c=o[1];return"".concat(String(ou(a,!0)),": ").concat(String(ou(c,!0)))}),i="{".concat(r.join(", "),"}");return i.includes("\\'")&&(i=i.replace(/'/g,"'").replace(/'/g,"\\'")),i}return t.toString()}catch{return null}}var BA=5;function jA(t){var e=t.amplitude,n=t.allObservables,r=t.options,i=t.shouldTrackEvent,s=n.clickObservable,o=s.pipe(yA(),ii(function(d){var l=Qe(d,2),h=l[0],f=l[1],p=h.event.target!==f.event.target,g=Math.abs(f.event.screenX-h.event.screenX)<=20&&Math.abs(f.event.screenY-h.event.screenY)<=20;return p&&!g})),a=s.pipe(gA(r.debounceTime),or(function(){return"timeout"})),c=Kv(o,a),u=s.pipe(_A(0),ii(uf),ii(function(d){return i("click",d.closestTrackedAncestor)}),pA(c));return u.subscribe(function(d){var l,h,f=(d.length>=BA,Zd);try{for(var p=Ht(d),g=p.next();!g.done;g=p.next()){var v=g.value;e==null||e.track(f,v.targetElementProperties)}}catch(m){l={error:m}}finally{try{g&&!g.done&&(h=p.return)&&h.call(p)}finally{if(l)throw l.error}}})}function HA(t){var e=t.amplitude,n=t.allObservables,r=t.getEventProperties,i=t.shouldTrackEvent,s=n.changeObservable,o=s.pipe(ii(uf),ii(function(a){return i("change",a.closestTrackedAncestor)}));return o.subscribe(function(a){e==null||e.track(rR,r("change",a.closestTrackedAncestor))})}function qA(t){var e=t.amplitude,n=t.allObservables,r=t.options,i=t.getEventProperties,s=t.shouldTrackEvent,o=t.shouldTrackActionClick,a=n.clickObservable,c=n.mutationObservable,u=n.navigateObservable,d=a.pipe(ii(function(p){return!s("click",p.closestTrackedAncestor)}),or(function(p){var g=cf(p.event.target,r.actionClickAllowlist);return p.closestTrackedAncestor=g,p.closestTrackedAncestor!==null&&(p.targetElementProperties=i(p.type,p.closestTrackedAncestor)),p}),ii(uf),ii(function(p){return o("click",p.closestTrackedAncestor)})),l=[c];u&&l.push(u);var h=Kv.apply(void 0,Zt([],Qe(l),!1)),f=d.pipe(bA(function(p){return h.pipe(Gv(1),eA({first:500,with:function(){return nf}}),or(function(){return p}))}));return f.subscribe(function(p){e==null||e.track(Zd,i("click",p.closestTrackedAncestor))})}var Os;(function(t){t.ClickObservable="clickObservable",t.ChangeObservable="changeObservable",t.NavigateObservable="navigateObservable",t.MutationObservable="mutationObservable"})(Os||(Os={}));function WA(t){return t.type==="click"||t.type==="change"}var zA=function(t){var e,n,r;t===void 0&&(t={});var i=t.dataAttributePrefix,s=i===void 0?$m:i,o=t.visualTaggingOptions,a=o===void 0?{enabled:!0,messenger:new RA}:o;t.cssSelectorAllowlist=(e=t.cssSelectorAllowlist)!==null&&e!==void 0?e:Fm,t.actionClickAllowlist=(n=t.actionClickAllowlist)!==null&&n!==void 0?n:Um,t.debounceTime=(r=t.debounceTime)!==null&&r!==void 0?r:0;var c=nR,u="enrichment",d=[],l=function(){var m,_=ga(document,"click",{capture:!0}).pipe(or(function(E){return f(E,"click")}),su()),w=ga(document,"change",{capture:!0}).pipe(or(function(E){return f(E,"change")}),su()),T;window.navigation&&(T=ga(window.navigation,"navigate").pipe(or(function(E){return f(E,"navigate")}),su()));var C=new Xt(function(E){var I=new MutationObserver(function(y){E.next(y)});return I.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return I.disconnect()}}).pipe(or(function(E){return f(E,"mutation")}),su());return m={},m[Os.ClickObservable]=_,m[Os.ChangeObservable]=w,m[Os.NavigateObservable]=T,m[Os.MutationObservable]=C,m},h=function(m,_){var w,T,C,E=(C=(T=_==null?void 0:_.tagName)===null||T===void 0?void 0:T.toLowerCase)===null||C===void 0?void 0:C.call(T),I=typeof _.getBoundingClientRect=="function"?_.getBoundingClientRect():{left:null,top:null},y=_.getAttribute("aria-label"),b=kA(_,s),k=Jv(_),x=(w={},w[iR]=_.getAttribute("id")||"",w[sR]=_.getAttribute("class"),w[oR]=$A(_),w[_v]=E,w[yv]=af(_),w[cR]=I.left==null?null:Math.round(I.left),w[uR]=I.top==null?null:Math.round(I.top),w[lR]=y,w[dR]=b,w[fR]=k,w[bv]=window.location.href.split("?")[0],w[hR]=typeof document<"u"&&document.title||"",w[pR]=window.innerHeight,w[gR]=window.innerWidth,w);return E==="a"&&m==="click"&&_ instanceof HTMLAnchorElement&&(x[aR]=_.href),Xv(x)},f=function(m,_){var w={event:m,timestamp:Date.now(),type:_};if(WA(w)&&w.event.target!==null){var T=cf(w.event.target,t.cssSelectorAllowlist);return T&&(w.closestTrackedAncestor=T,w.targetElementProperties=h(w.type,T)),w}return w},p=function(m,_){return X(void 0,void 0,void 0,function(){var w,T,C,E,I,y,b,k,x,R;return Z(this,function(F){return typeof document>"u"?[2]:(w=of(t,t.cssSelectorAllowlist),T=of(t,t.actionClickAllowlist),C=l(),E=jA({allObservables:C,options:t,amplitude:_,shouldTrackEvent:w}),d.push(E),I=HA({allObservables:C,getEventProperties:h,amplitude:_,shouldTrackEvent:w}),d.push(I),y=qA({allObservables:C,options:t,getEventProperties:h,amplitude:_,shouldTrackEvent:w,shouldTrackActionClick:T}),d.push(y),(x=m==null?void 0:m.loggerProvider)===null||x===void 0||x.log("".concat(c," has been successfully added.")),window.opener&&a.enabled&&(b=t.cssSelectorAllowlist,k=t.actionClickAllowlist,(R=a.messenger)===null||R===void 0||R.setup(ie(ie({logger:m==null?void 0:m.loggerProvider},(m==null?void 0:m.serverZone)&&{endpoint:_R[m.serverZone]}),{isElementSelectable:of(t,Zt(Zt([],Qe(b),!1),Qe(k),!1)),cssSelectorAllowlist:b,actionClickAllowlist:k}))),[2])})})},g=function(m){return X(void 0,void 0,void 0,function(){return Z(this,function(_){return[2,m]})})},v=function(){return X(void 0,void 0,void 0,function(){var m,_,w,T,C;return Z(this,function(E){try{for(m=Ht(d),_=m.next();!_.done;_=m.next())w=_.value,w.unsubscribe()}catch(I){T={error:I}}finally{try{_&&!_.done&&(C=m.return)&&C.call(m)}finally{if(T)throw T.error}}return[2]})})};return{name:c,type:u,setup:p,execute:g,teardown:v}},VA="utm_campaign",KA="utm_content",GA="utm_id",YA="utm_medium",ZA="utm_source",XA="utm_term",Qv="dclid",e_="fbclid",t_="gbraid",n_="gclid",r_="ko_click_id",i_="li_fat_id",s_="msclkid",o_="rtd_cid",a_="ttclid",c_="twclid",u_="wbraid",lf={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},l_=function(t){var e=t.split(".");return e.length<=2?t:e.slice(e.length-2,e.length).join(".")},JA=function(t){return Object.values(t).every(function(e){return!e})},QA=function(t,e,n,r,i){i===void 0&&(i=!0),t.referrer;var s=t.referring_domain,o=Ud(t,["referrer","referring_domain"]),a=e||{};a.referrer;var c=a.referring_domain,u=Ud(a,["referrer","referring_domain"]);if(eP(n.excludeReferrers,t.referring_domain))return r.debug("This is not a new campaign because ".concat(t.referring_domain," is in the exclude referrer list.")),!1;if(!i&&JA(t)&&e)return r.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var d=JSON.stringify(o)!==JSON.stringify(u),l=l_(s||"")!==l_(c||""),h=!e||d||l;return h?r.debug("This is a new campaign. An $identify event will be sent."):r.debug("This is not a new campaign because it's the same as the previous one."),h},eP=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=""),t.some(function(n){return n instanceof RegExp?n.test(e):n===e})},tP=function(t,e){var n=ie(ie({},lf),t),r=Object.entries(n).reduce(function(i,s){var o,a=Qe(s,2),c=a[0],u=a[1];return i.setOnce("initial_".concat(c),(o=u??e.initialEmptyValue)!==null&&o!==void 0?o:"EMPTY"),u?i.set(c,u):i.unset(c)},new ua);return xm(r)},nP=function(t){var e=t;return e?(e.startsWith(".")&&(e=e.substring(1)),[new RegExp("".concat(e.replace(".","\\."),"$"))]):[]},rP=function(){function t(){}return t.prototype.parse=function(){return X(this,void 0,void 0,function(){return Z(this,function(e){return[2,ie(ie(ie(ie({},lf),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},t.prototype.getUtmParam=function(){var e=Vc(),n=e[VA],r=e[KA],i=e[GA],s=e[YA],o=e[ZA],a=e[XA];return{utm_campaign:n,utm_content:r,utm_id:i,utm_medium:s,utm_source:o,utm_term:a}},t.prototype.getReferrer=function(){var e,n,r={referrer:void 0,referring_domain:void 0};try{r.referrer=document.referrer||void 0,r.referring_domain=(n=(e=r.referrer)===null||e===void 0?void 0:e.split("/")[2])!==null&&n!==void 0?n:void 0}catch{}return r},t.prototype.getClickIds=function(){var e,n=Vc();return e={},e[Qv]=n[Qv],e[e_]=n[e_],e[t_]=n[t_],e[n_]=n[n_],e[r_]=n[r_],e[i_]=n[i_],e[s_]=n[s_],e[o_]=n[o_],e[a_]=n[a_],e[c_]=n[c_],e[u_]=n[u_],e},t}(),iP=function(){function t(e,n){var r;this.shouldTrackNewCampaign=!1,this.options=ie({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:nP((r=n.cookieOptions)===null||r===void 0?void 0:r.domain)},e),this.storage=n.cookieStorage,this.storageKey=ex(n.apiKey,"MKTG"),this.currentCampaign=lf,this.sessionTimeout=n.sessionTimeout,this.lastEventTime=n.lastEventTime,this.logger=n.loggerProvider,n.loggerProvider.log("Installing web attribution tracking.")}return t.prototype.init=function(){return X(this,void 0,void 0,function(){var e,n;return Z(this,function(r){switch(r.label){case 0:return[4,this.fetchCampaign()];case 1:return n=Qe.apply(void 0,[r.sent(),2]),this.currentCampaign=n[0],this.previousCampaign=n[1],e=this.lastEventTime?Om(this.sessionTimeout,this.lastEventTime):!0,QA(this.currentCampaign,this.previousCampaign,this.options,this.logger,e)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:r.sent(),r.label=3;case 3:return[2]}})})},t.prototype.fetchCampaign=function(){return X(this,void 0,void 0,function(){return Z(this,function(e){switch(e.label){case 0:return[4,Promise.all([new rP().parse(),this.storage.get(this.storageKey)])];case 1:return[2,e.sent()]}})})},t.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var n=tP(this.currentCampaign,this.options);return e&&(n.event_id=e),n},t.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},t}(),sP=function(t){Yt(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.init=function(n,r,i){n===void 0&&(n="");var s,o;return arguments.length>2?(s=r,o=i):typeof r=="string"?(s=r,o=void 0):(s=r==null?void 0:r.userId,o=r),an(this._init(ie(ie({},o),{userId:s,apiKey:n})))},e.prototype._init=function(n){var r,i,s;return X(this,void 0,void 0,function(){var o,a,c,u,d,l,h=this;return Z(this,function(f){switch(f.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,Cx(n.apiKey,n,this)]);case 1:return o=f.sent(),n.fetchRemoteConfig?[4,tR(o)]:[3,4];case 2:return a=f.sent(),[4,a.generateJoinedConfig()];case 3:o=f.sent(),f.label=4;case 4:return[4,t.prototype._init.call(this,o)];case 5:return f.sent(),this.logBrowserOptions(o),Bm(this.config.defaultTracking)?(c=ox(this.config),this.webAttribution=new iP(c,this.config),[4,this.webAttribution.init()]):[3,7];case 6:f.sent(),f.label=7;case 7:return u=Vc(),d=Number.isNaN(Number(u.ampSessionId))?void 0:Number(u.ampSessionId),this.setSessionId((s=(i=(r=n.sessionId)!==null&&r!==void 0?r:d)!==null&&i!==void 0?i:this.config.sessionId)!==null&&s!==void 0?s:Date.now()),l=da(n.instanceName),l.identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),this.config.offline===Nm?[3,9]:[4,this.add(Wx()).promise];case 8:f.sent(),f.label=9;case 9:return[4,this.add(new N1).promise];case 10:return f.sent(),[4,this.add(new lx).promise];case 11:return f.sent(),[4,this.add(new K1).promise];case 12:return f.sent(),qx(this.config),nx(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(Hx()).promise]):[3,14];case 13:f.sent(),f.label=14;case 14:return rx(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(jx()).promise]):[3,16];case 15:f.sent(),f.label=16;case 16:return jm(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Fx(sx(this.config))).promise]):[3,18];case 17:f.sent(),f.label=18;case 18:return qm(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(zA(ix(this.config))).promise]):[3,20];case 19:f.sent(),f.label=20;case 20:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 21:return f.sent(),l.eventBridge.setEventReceiver(function(p){h.track(p.eventType,p.eventProperties)}),[2]}})})},e.prototype.getUserId=function(){var n;return(n=this.config)===null||n===void 0?void 0:n.userId},e.prototype.setUserId=function(n){if(!this.config){this.q.push(this.setUserId.bind(this,n));return}this.config.loggerProvider.debug("function setUserId: ",n),(n!==this.config.userId||n===void 0)&&(this.config.userId=n,z1(n,this.config.instanceName))},e.prototype.getDeviceId=function(){var n;return(n=this.config)===null||n===void 0?void 0:n.deviceId},e.prototype.setDeviceId=function(n){if(!this.config){this.q.push(this.setDeviceId.bind(this,n));return}this.config.loggerProvider.debug("function setDeviceId: ",n),this.config.deviceId=n,V1(n,this.config.instanceName)},e.prototype.reset=function(){this.setDeviceId(Ps()),this.setUserId(void 0)},e.prototype.getSessionId=function(){var n;return(n=this.config)===null||n===void 0?void 0:n.sessionId},e.prototype.setSessionId=function(n){var r,i=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,n)),an(Promise.resolve());if(n===this.config.sessionId)return an(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",n);var s=this.getSessionId(),o=this.config.lastEventTime,a=(r=this.config.lastEventId)!==null&&r!==void 0?r:-1;this.config.sessionId=n,this.config.lastEventTime=void 0,this.config.pageCounter=0,Hm(this.config.defaultTracking)&&(s&&o&&i.push(this.track(Ym,void 0,{device_id:this.previousSessionDeviceId,event_id:++a,session_id:s,time:o+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var c=this.trackCampaignEventIfNeeded(++a,i);return Hm(this.config.defaultTracking)&&i.push(this.track(Gm,void 0,{event_id:c?++a:a,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,an(Promise.all(i))},e.prototype.extendSession=function(){if(!this.config){this.q.push(this.extendSession.bind(this));return}this.config.lastEventTime=Date.now()},e.prototype.setTransport=function(n){if(!this.config){this.q.push(this.setTransport.bind(this,n));return}this.config.transportProvider=Zm(n)},e.prototype.identify=function(n,r){if(zd(n)){var i=n._q;n._q=[],n=Wd(new ua,i)}return r!=null&&r.user_id&&this.setUserId(r.user_id),r!=null&&r.device_id&&this.setDeviceId(r.device_id),t.prototype.identify.call(this,n,r)},e.prototype.groupIdentify=function(n,r,i,s){if(zd(i)){var o=i._q;i._q=[],i=Wd(new ua,o)}return t.prototype.groupIdentify.call(this,n,r,i,s)},e.prototype.revenue=function(n,r){if(zd(n)){var i=n._q;n._q=[],n=Wd(new P1,i)}return t.prototype.revenue.call(this,n,r)},e.prototype.trackCampaignEventIfNeeded=function(n,r){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var i=this.webAttribution.generateCampaignEvent(n);return r?r.push(this.track(i).promise):this.track(i),this.config.loggerProvider.log("Tracking attribution."),!0},e.prototype.process=function(n){return X(this,void 0,void 0,function(){var r,i,s;return Z(this,function(o){return r=Date.now(),i=Om(this.config.sessionTimeout,this.config.lastEventTime),s=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),n.event_type!==Gm&&n.event_type!==Ym&&(!n.session_id||n.session_id===this.getSessionId())&&(i||s?(this.setSessionId(r),s&&this.config.loggerProvider.log("Created a new session for new campaign.")):i||this.trackCampaignEventIfNeeded()),[2,t.prototype.process.call(this,n)]})})},e.prototype.logBrowserOptions=function(n){try{var r=ie(ie({},n),{apiKey:n.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",JSON.stringify(r))}catch(i){this.config.loggerProvider.error("Error logging browser config",i)}},e}(A1),oP=function(){var t=new sP;return{init:wt(t.init.bind(t),"init",yt(t),bt(t,["config"])),add:wt(t.add.bind(t),"add",yt(t),bt(t,["config.apiKey","timeline.plugins"])),remove:wt(t.remove.bind(t),"remove",yt(t),bt(t,["config.apiKey","timeline.plugins"])),track:wt(t.track.bind(t),"track",yt(t),bt(t,["config.apiKey","timeline.queue.length"])),logEvent:wt(t.logEvent.bind(t),"logEvent",yt(t),bt(t,["config.apiKey","timeline.queue.length"])),identify:wt(t.identify.bind(t),"identify",yt(t),bt(t,["config.apiKey","timeline.queue.length"])),groupIdentify:wt(t.groupIdentify.bind(t),"groupIdentify",yt(t),bt(t,["config.apiKey","timeline.queue.length"])),setGroup:wt(t.setGroup.bind(t),"setGroup",yt(t),bt(t,["config.apiKey","timeline.queue.length"])),revenue:wt(t.revenue.bind(t),"revenue",yt(t),bt(t,["config.apiKey","timeline.queue.length"])),flush:wt(t.flush.bind(t),"flush",yt(t),bt(t,["config.apiKey","timeline.queue.length"])),getUserId:wt(t.getUserId.bind(t),"getUserId",yt(t),bt(t,["config","config.userId"])),setUserId:wt(t.setUserId.bind(t),"setUserId",yt(t),bt(t,["config","config.userId"])),getDeviceId:wt(t.getDeviceId.bind(t),"getDeviceId",yt(t),bt(t,["config","config.deviceId"])),setDeviceId:wt(t.setDeviceId.bind(t),"setDeviceId",yt(t),bt(t,["config","config.deviceId"])),reset:wt(t.reset.bind(t),"reset",yt(t),bt(t,["config","config.userId","config.deviceId"])),getSessionId:wt(t.getSessionId.bind(t),"getSessionId",yt(t),bt(t,["config"])),setSessionId:wt(t.setSessionId.bind(t),"setSessionId",yt(t),bt(t,["config"])),extendSession:wt(t.extendSession.bind(t),"extendSession",yt(t),bt(t,["config"])),setOptOut:wt(t.setOptOut.bind(t),"setOptOut",yt(t),bt(t,["config"])),setTransport:wt(t.setTransport.bind(t),"setTransport",yt(t),bt(t,["config"]))}};const au=oP();var aP=au.identify,cP=au.init,uP=au.logEvent,lP=au.setUserId,d_;(function(t){t.IdentifyOperation=jd,t.SpecialEventType=Bi,t.RevenueProperty=jn,t.LogLevel=cn,t.OfflineDisabled=Nm,t.DEFAULT_CSS_SELECTOR_ALLOWLIST=Fm,t.DEFAULT_DATA_ATTRIBUTE_PREFIX=$m,t.DEFAULT_ACTION_CLICK_ALLOWLIST=Um})(d_||(d_={}));const Dt=[];for(let t=0;t<256;++t)Dt.push((t+256).toString(16).slice(1));function dP(t,e=0){return(Dt[t[e+0]]+Dt[t[e+1]]+Dt[t[e+2]]+Dt[t[e+3]]+"-"+Dt[t[e+4]]+Dt[t[e+5]]+"-"+Dt[t[e+6]]+Dt[t[e+7]]+"-"+Dt[t[e+8]]+Dt[t[e+9]]+"-"+Dt[t[e+10]]+Dt[t[e+11]]+Dt[t[e+12]]+Dt[t[e+13]]+Dt[t[e+14]]+Dt[t[e+15]]).toLowerCase()}let df;const fP=new Uint8Array(16);function hP(){if(!df){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");df=crypto.getRandomValues.bind(crypto)}return df(fP)}const f_={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function pP(t,e,n){var i;if(f_.randomUUID&&!t)return f_.randomUUID();t=t||{};const r=t.random??((i=t.rng)==null?void 0:i.call(t))??hP();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,dP(r)}const gP=Ss.defineItem("local:deviceId",{init:()=>pP()});async function mP(){return gP.getValue()}const ff={init:async()=>{const t=await mP();cP(mn.analytics.amplitudeApiKey,{deviceId:t,appVersion:chrome.runtime.getManifest().version,autocapture:!1,identityStorage:"none"})},identify:({user:t})=>{if(lP(t.id),t.email){const e=new ua;e.set("email",t.email),aP(e)}},logEvent:(t,e)=>{uP(t,e)}};function h_(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function D(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?h_(Object(n),!0).forEach(function(r){B(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h_(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function B(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function p_(t,e){if(t==null)return{};var n,r,i=function(o,a){if(o==null)return{};var c,u,d={},l=Object.keys(o);for(u=0;u<l.length;u++)c=l[u],a.indexOf(c)>=0||(d[c]=o[c]);return d}(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}var qn,M=typeof window<"u"?window:void 0,un=typeof globalThis<"u"?globalThis:M,g_=Array.prototype,m_=g_.forEach,v_=g_.indexOf,yn=un==null?void 0:un.navigator,ae=un==null?void 0:un.document,Cn=un==null?void 0:un.location,hf=un==null?void 0:un.fetch,pf=un!=null&&un.XMLHttpRequest&&"withCredentials"in new un.XMLHttpRequest?un.XMLHttpRequest:void 0,__=un==null?void 0:un.AbortController,St=yn==null?void 0:yn.userAgent,Fe=M??{},gf="$copy_autocapture",vP=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];(function(t){t.GZipJS="gzip-js",t.Base64="base64"})(qn||(qn={}));var _P=["fatal","error","warning","log","info","debug"];function $e(t,e){return t.indexOf(e)!==-1}var cu=function(t){return t.trim()},mf=function(t){return t.replace(/^\$/,"")},yP=Array.isArray,y_=Object.prototype,b_=y_.hasOwnProperty,uu=y_.toString,ut=yP||function(t){return uu.call(t)==="[object Array]"},Wn=t=>typeof t=="function",lt=t=>t===Object(t)&&!ut(t),Ls=t=>{if(lt(t)){for(var e in t)if(b_.call(t,e))return!1;return!0}return!1},G=t=>t===void 0,Et=t=>uu.call(t)=="[object String]",vf=t=>Et(t)&&t.trim().length===0,si=t=>t===null,Ge=t=>G(t)||si(t),Jt=t=>uu.call(t)=="[object Number]",oi=t=>uu.call(t)==="[object Boolean]",bP=t=>t instanceof FormData,wP=t=>$e(vP,t),Sr={DEBUG:!1,LIB_VERSION:"1.234.1"},w_=t=>{var e={_log:function(n){if(M&&(Sr.DEBUG||Fe.POSTHOG_DEBUG)&&!G(M.console)&&M.console){for(var r=("__rrweb_original__"in M.console[n])?M.console[n].__rrweb_original__:M.console[n],i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];r(t,...s)}},info:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e._log("log",...r)},warn:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e._log("warn",...r)},error:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e._log("error",...r)},critical:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];console.error(t,...r)},uninitializedWarning:n=>{e.error("You must initialize PostHog before calling ".concat(n))},createLogger:n=>w_("".concat(t," ").concat(n))};return e},se=w_("[PostHog.js]"),Qt=se.createLogger,lu={};function ai(t,e,n){if(ut(t)){if(m_&&t.forEach===m_)t.forEach(e,n);else if("length"in t&&t.length===+t.length){for(var r=0,i=t.length;r<i;r++)if(r in t&&e.call(n,t[r],r)===lu)return}}}function Ye(t,e,n){if(!Ge(t)){if(ut(t))return ai(t,e,n);if(bP(t)){for(var r of t.entries())if(e.call(n,r[1],r[0])===lu)return}else for(var i in t)if(b_.call(t,i)&&e.call(n,t[i],i)===lu)return}}var kt=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return ai(n,function(i){for(var s in i)i[s]!==void 0&&(t[s]=i[s])}),t},du=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return ai(n,function(i){ai(i,function(s){t.push(s)})}),t};function fu(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r}var S_=function(t){try{return t()}catch{return}},SP=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.apply(this,n)}catch(i){se.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),se.critical(i)}}},ma=function(t){var e={};return Ye(t,function(n,r){Et(n)&&n.length>0&&(e[r]=n)}),e};function EP(t,e){return n=t,r=s=>Et(s)&&!si(e)?s.slice(0,e):s,i=new Set,function s(o,a){return o!==Object(o)?r?r(o,a):o:i.has(o)?void 0:(i.add(o),ut(o)?(c=[],ai(o,u=>{c.push(s(u))})):(c={},Ye(o,(u,d)=>{i.has(u)||(c[d]=s(u,d))})),c);var c}(n);var n,r,i}var kP=["herokuapp.com","vercel.app","netlify.app"];function CP(t){var e=t==null?void 0:t.hostname;if(!Et(e))return!1;var n=e.split(".").slice(-2).join(".");for(var r of kP)if(n===r)return!1;return!0}function E_(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return t[n]}function gt(t,e,n,r){var{capture:i=!1,passive:s=!0}=r??{};t==null||t.addEventListener(e,n,{capture:i,passive:s})}var k_="$people_distinct_id",va="__alias",_a="__timers",C_="$autocapture_disabled_server_side",_f="$heatmaps_enabled_server_side",T_="$exception_capture_enabled_server_side",I_="$web_vitals_enabled_server_side",x_="$dead_clicks_enabled_server_side",R_="$web_vitals_allowed_metrics",yf="$session_recording_enabled_server_side",A_="$console_log_recording_enabled_server_side",P_="$session_recording_network_payload_capture",M_="$session_recording_masking",O_="$session_recording_canvas_recording",L_="$replay_sample_rate",D_="$replay_minimum_duration",N_="$replay_script_config",hu="$sesid",ya="$session_is_sampled",bf="$session_recording_url_trigger_activated_session",wf="$session_recording_event_trigger_activated_session",Ds="$enabled_feature_flags",pu="$early_access_features",Sf="$feature_flag_details",ba="$stored_person_properties",ji="$stored_group_properties",Ef="$surveys",gu="$surveys_activated",mu="$flag_call_reported",Er="$user_state",kf="$client_session_props",Cf="$capture_rate_limit",Tf="$initial_campaign_params",If="$initial_referrer_info",xf="$initial_person_info",vu="$epp",F_="__POSTHOG_TOOLBAR__",$_="$posthog_cookieless",TP=[k_,va,"__cmpns",_a,yf,_f,hu,Ds,Er,pu,Sf,ji,ba,Ef,mu,kf,Cf,Tf,If,vu];function U_(t){var e;return t instanceof Element&&(t.id===F_||!((e=t.closest)===null||e===void 0||!e.call(t,".toolbar-global-fade-container")))}function _u(t){return!!t&&t.nodeType===1}function ci(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function B_(t){return!!t&&t.nodeType===3}function j_(t){return!!t&&t.nodeType===11}function Rf(t){return t?cu(t).split(/\s+/):[]}function H_(t){var e=M==null?void 0:M.location.href;return!!(e&&t&&t.some(n=>e.match(n)))}function yu(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Rf(e)}function q_(t){return Ge(t)?null:cu(t).split(/(\s+)/).filter(e=>Ns(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function bu(t){var e="";return Pf(t)&&!V_(t)&&t.childNodes&&t.childNodes.length&&Ye(t.childNodes,function(n){var r;B_(n)&&n.textContent&&(e+=(r=q_(n.textContent))!==null&&r!==void 0?r:"")}),cu(e)}function W_(t){return G(t.target)?t.srcElement||null:(e=t.target)!==null&&e!==void 0&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var Af=["a","button","form","input","select","textarea","label"];function z_(t){var e=t.parentNode;return!(!e||!_u(e))&&e}function IP(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(!M||!t||ci(t,"html")||!_u(t)||n!=null&&n.url_allowlist&&!H_(n.url_allowlist)||n!=null&&n.url_ignorelist&&H_(n.url_ignorelist))return!1;if(n!=null&&n.dom_event_allowlist){var s=n.dom_event_allowlist;if(s&&!s.some(f=>e.type===f))return!1}for(var o=!1,a=[t],c=!0,u=t;u.parentNode&&!ci(u,"body");)if(j_(u.parentNode))a.push(u.parentNode.host),u=u.parentNode.host;else{if(!(c=z_(u)))break;if(r||Af.indexOf(c.tagName.toLowerCase())>-1)o=!0;else{var d=M.getComputedStyle(c);d&&d.getPropertyValue("cursor")==="pointer"&&(o=!0)}a.push(c),u=c}if(!function(f,p){var g=p==null?void 0:p.element_allowlist;if(G(g))return!0;var v=function(w){if(g.some(T=>w.tagName.toLowerCase()===T))return{v:!0}};for(var m of f){var _=v(m);if(typeof _=="object")return _.v}return!1}(a,n)||!function(f,p){var g=p==null?void 0:p.css_selector_allowlist;if(G(g))return!0;var v=function(w){if(g.some(T=>w.matches(T)))return{v:!0}};for(var m of f){var _=v(m);if(typeof _=="object")return _.v}return!1}(a,n))return!1;var l=M.getComputedStyle(t);if(l&&l.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var h=t.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(i||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(i||["change","click"]).indexOf(e.type)>=0;default:return o?(i||["click"]).indexOf(e.type)>=0:(i||["click"]).indexOf(e.type)>=0&&(Af.indexOf(h)>-1||t.getAttribute("contenteditable")==="true")}}function Pf(t){for(var e=t;e.parentNode&&!ci(e,"body");e=e.parentNode){var n=yu(e);if($e(n,"ph-sensitive")||$e(n,"ph-no-capture"))return!1}if($e(yu(t),"ph-include"))return!0;var r=t.type||"";if(Et(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=t.name||t.id||"";return!(Et(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))}function V_(t){return!!(ci(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ci(t,"select")||ci(t,"textarea")||t.getAttribute("contenteditable")==="true")}var K_="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",xP=new RegExp("^(?:".concat(K_,")$")),RP=new RegExp(K_),G_="\\d{3}-?\\d{2}-?\\d{4}",AP=new RegExp("^(".concat(G_,")$")),PP=new RegExp("(".concat(G_,")"));function Ns(t){var e=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(Ge(t)||Et(t)&&(t=cu(t),(e?xP:RP).test((t||"").replace(/[- ]/g,""))||(e?AP:PP).test(t)))}function Y_(t){var e=bu(t);return Ns(e="".concat(e," ").concat(Z_(t)).trim())?e:""}function Z_(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Ye(t.childNodes,function(n){var r;if(n&&((r=n.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var i=bu(n);e="".concat(e," ").concat(i).trim(),n.childNodes&&n.childNodes.length&&(e="".concat(e," ").concat(Z_(n)).trim())}catch(s){se.error("[AutoCapture]",s)}}),e}function MP(t){return function(e){var n=e.map(r=>{var i,s,o="";if(r.tag_name&&(o+=r.tag_name),r.attr_class)for(var a of(r.attr_class.sort(),r.attr_class))o+=".".concat(a.replace(/"/g,""));var c=D(D(D(D({},r.text?{text:r.text}:{}),{},{"nth-child":(i=r.nth_child)!==null&&i!==void 0?i:0,"nth-of-type":(s=r.nth_of_type)!==null&&s!==void 0?s:0},r.href?{href:r.href}:{}),r.attr_id?{attr_id:r.attr_id}:{}),r.attributes),u={};return fu(c).sort((d,l)=>{var[h]=d,[f]=l;return h.localeCompare(f)}).forEach(d=>{var[l,h]=d;return u[X_(l.toString())]=X_(h.toString())}),o+=":",o+=fu(c).map(d=>{var[l,h]=d;return"".concat(l,'="').concat(h,'"')}).join("")});return n.join(";")}(function(e){return e.map(n=>{var r,i,s={text:(r=n.$el_text)===null||r===void 0?void 0:r.slice(0,400),tag_name:n.tag_name,href:(i=n.attr__href)===null||i===void 0?void 0:i.slice(0,2048),attr_class:OP(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return fu(n).filter(o=>{var[a]=o;return a.indexOf("attr__")===0}).forEach(o=>{var[a,c]=o;return s.attributes[a]=c}),s})}(t))}function X_(t){return t.replace(/"|\\"/g,'\\"')}function OP(t){var e=t.attr__class;return e?ut(e)?e:Rf(e):void 0}class J_{constructor(){this.clicks=[]}isRageClick(e,n,r){var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(n-i.y)<30&&r-i.timestamp<1e3){if(this.clicks.push({x:e,y:n,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:n,timestamp:r}];return!1}}var LP=["localhost","127.0.0.1"],Fs=t=>{var e=ae==null?void 0:ae.createElement("a");return G(e)?null:(e.href=t,e)},DP=function(t){var e,n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",i=[];return Ye(t,function(s,o){G(s)||G(o)||o==="undefined"||(e=encodeURIComponent((a=>a instanceof File)(s)?s.name:s.toString()),n=encodeURIComponent(o),i[i.length]=n+"="+e)}),i.join(r)},wu=function(t,e){for(var n,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<r.length;i++){var s=r[i].split("=");if(s[0]===e){n=s;break}}if(!ut(n)||n.length<2)return"";var o=n[1];try{o=decodeURIComponent(o)}catch{se.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Mf=function(t,e,n){if(!t||!e||!e.length)return t;for(var r=t.split("#"),i=r[0]||"",s=r[1],o=i.split("?"),a=o[1],c=o[0],u=(a||"").split("&"),d=[],l=0;l<u.length;l++){var h=u[l].split("=");ut(h)&&(e.includes(h[0])?d.push(h[0]+"="+n):d.push(u[l]))}var f=c;return a!=null&&(f+="?"+d.join("&")),s!=null&&(f+="#"+s),f},Su=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},Q_=Qt("[AutoCapture]");function Of(t,e){return e.length>t?e.slice(0,t)+"...":e}function NP(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!_u(e));return e}function FP(t,e,n,r){var i=t.tagName.toLowerCase(),s={tag_name:i};Af.indexOf(i)>-1&&!n&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=Of(1024,Y_(t)):s.$el_text=Of(1024,bu(t)));var o=yu(t);o.length>0&&(s.classes=o.filter(function(d){return d!==""})),Ye(t.attributes,function(d){var l;if((!V_(t)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(r==null||!r.includes(d.name))&&!e&&Ns(d.value)&&(l=d.name,!Et(l)||l.substring(0,10)!=="_ngcontent"&&l.substring(0,7)!=="_nghost")){var h=d.value;d.name==="class"&&(h=Rf(h).join(" ")),s["attr__"+d.name]=Of(1024,h)}});for(var a=1,c=1,u=t;u=NP(u);)a++,u.tagName===t.tagName&&c++;return s.nth_child=a,s.nth_of_type=c,s}function $P(t,e){for(var n,r,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:c}=e,u=[t],d=t;d.parentNode&&!ci(d,"body");)j_(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var l,h=[],f={},p=!1,g=!1;if(Ye(u,T=>{var C=Pf(T);T.tagName.toLowerCase()==="a"&&(p=T.getAttribute("href"),p=C&&p&&Ns(p)&&p),$e(yu(T),"ph-no-capture")&&(g=!0),h.push(FP(T,s,o,a));var E=function(I){if(!Pf(I))return{};var y={};return Ye(I.attributes,function(b){if(b.name&&b.name.indexOf("data-ph-capture-attribute")===0){var k=b.name.replace("data-ph-capture-attribute-",""),x=b.value;k&&x&&Ns(x)&&(y[k]=x)}}),y}(T);kt(f,E)}),g)return{props:{},explicitNoCapture:g};if(o||(t.tagName.toLowerCase()==="a"||t.tagName.toLowerCase()==="button"?h[0].$el_text=Y_(t):h[0].$el_text=bu(t)),p){var v,m;h[0].attr__href=p;var _=(v=Fs(p))===null||v===void 0?void 0:v.host,w=M==null||(m=M.location)===null||m===void 0?void 0:m.host;_&&w&&_!==w&&(l=p)}return{props:kt({$event_type:i.type,$ce_version:1},c?{}:{$elements:h},{$elements_chain:MP(h)},(n=h[0])!==null&&n!==void 0&&n.$el_text?{$el_text:(r=h[0])===null||r===void 0?void 0:r.$el_text}:{},l&&i.type==="click"?{$external_click_url:l}:{},f)}}class UP{constructor(e){B(this,"_initialized",!1),B(this,"_isDisabledServerSide",null),B(this,"rageclicks",new J_),B(this,"_elementsChainAsString",!1),this.instance=e,this._elementSelectors=null}get config(){var e,n,r=lt(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(e=r.url_allowlist)===null||e===void 0?void 0:e.map(i=>new RegExp(i)),r.url_ignorelist=(n=r.url_ignorelist)===null||n===void 0?void 0:n.map(i=>new RegExp(i)),r}_addDomEventHandlers(){if(this.isBrowserSupported()){if(M&&ae){var e=r=>{r=r||(M==null?void 0:M.event);try{this._captureEvent(r)}catch(i){Q_.error("Failed to capture event",i)}};if(gt(ae,"submit",e,{capture:!0}),gt(ae,"change",e,{capture:!0}),gt(ae,"click",e,{capture:!0}),this.config.capture_copied_text){var n=r=>{r=r||(M==null?void 0:M.event),this._captureEvent(r,gf)};gt(ae,"copy",n,{capture:!0}),gt(ae,"cut",n,{capture:!0})}}}else Q_.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[C_]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var n,r=[];return(n=this._elementSelectors)===null||n===void 0||n.forEach(i=>{var s=ae==null?void 0:ae.querySelectorAll(i);s==null||s.forEach(o=>{e===o&&r.push(i)})}),r}get isEnabled(){var e,n,r=(e=this.instance.persistence)===null||e===void 0?void 0:e.props[C_],i=this._isDisabledServerSide;if(si(i)&&!oi(r)&&!this.instance.config.advanced_disable_decide)return!1;var s=(n=this._isDisabledServerSide)!==null&&n!==void 0?n:!!r;return!!this.instance.config.autocapture&&!s}_captureEvent(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var r,i=W_(e);B_(i)&&(i=i.parentNode||null),n==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!==null&&r!==void 0&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this._captureEvent(e,"$rageclick");var s=n===gf;if(i&&IP(i,e,this.config,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=$P(i,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(a)return!1;var c=this.getElementSelectors(i);if(c&&c.length>0&&(o.$element_selectors=c),n===gf){var u,d=q_(M==null||(u=M.getSelection())===null||u===void 0?void 0:u.toString()),l=e.type||"clipboard";if(!d)return!1;o.$selected_content=d,o.$copy_type=l}return this.instance.capture(n,o),!0}}}isBrowserSupported(){return Wn(ae==null?void 0:ae.querySelectorAll)}}Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Jt(t)&&isFinite(t)&&Math.floor(t)===t});var ey="0123456789abcdef";class Eu{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,r,i){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||e<0||n<0||r<0||i<0||e>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|n>>>8,s[7]=n,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new Eu(s)}toString(){for(var e="",n=0;n<this.bytes.length;n++)e=e+ey.charAt(this.bytes[n]>>>4)+ey.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Eu(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;n<16;n++){var r=this.bytes[n]-e.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class BP{constructor(){B(this,"timestamp",0),B(this,"counter",0),B(this,"random",new jP)}generate(){var e=this.generateOrAbort();if(G(e)){this.timestamp=0;var n=this.generateOrAbort();if(G(n))throw new Error("Could not generate UUID after timestamp reset");return n}return e}generateOrAbort(){var e=Date.now();if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return Eu.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}var ty,ny=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<t.length;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};M&&!G(M.crypto)&&crypto.getRandomValues&&(ny=t=>crypto.getRandomValues(t));class jP{constructor(){B(this,"buffer",new Uint32Array(8)),B(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(ny(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}var ui=()=>HP().toString(),HP=()=>(ty||(ty=new BP)).generate(),qP="Thu, 01 Jan 1970 00:00:00 GMT",wa="",WP=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function zP(t,e){if(e){var n=function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ae;if(wa)return wa;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var o=i.split("."),a=Math.min(o.length,8),c="dmn_chk_"+ui(),u=new RegExp("(^|;)\\s*"+c+"=1");!wa&&a--;){var d=o.slice(a).join("."),l=c+"=1;domain=."+d;s.cookie=l,u.test(s.cookie)&&(s.cookie=l+";expires="+qP,wa=d)}return wa}(t);if(!n){var r=(i=>{var s=i.match(WP);return s?s[0]:""})(t);r!==n&&se.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var li,kr={is_supported:()=>!!ae,error:function(t){se.error("cookieStore error: "+t)},get:function(t){if(ae){try{for(var e=t+"=",n=ae.cookie.split(";").filter(s=>s.length),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}},parse:function(t){var e;try{e=JSON.parse(kr.get(t))||{}}catch{}return e},set:function(t,e,n,r,i){if(ae)try{var s="",o="",a=zP(ae.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+24*n*60*60*1e3),s="; expires="+c.toUTCString()}i&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&se.warn("cookieStore warning: large cookie, len="+u.length),ae.cookie=u,u}catch{return}},remove:function(t,e){try{kr.set(t,"",-1,e)}catch{return}}},Lf=null,Tt={is_supported:function(){if(!si(Lf))return Lf;var t=!0;if(G(M))t=!1;else try{var e="__mplssupport__";Tt.set(e,"xyz"),Tt.get(e)!=='"xyz"'&&(t=!1),Tt.remove(e)}catch{t=!1}return t||se.error("localStorage unsupported; falling back to cookie store"),Lf=t,t},error:function(t){se.error("localStorage error: "+t)},get:function(t){try{return M==null?void 0:M.localStorage.getItem(t)}catch(e){Tt.error(e)}return null},parse:function(t){try{return JSON.parse(Tt.get(t))||{}}catch{}return null},set:function(t,e){try{M==null||M.localStorage.setItem(t,JSON.stringify(e))}catch(n){Tt.error(n)}},remove:function(t){try{M==null||M.localStorage.removeItem(t)}catch(e){Tt.error(e)}}},VP=["distinct_id",hu,ya,vu,xf],ku=D(D({},Tt),{},{parse:function(t){try{var e={};try{e=kr.parse(t)||{}}catch{}var n=kt(e,JSON.parse(Tt.get(t)||"{}"));return Tt.set(t,n),n}catch{}return null},set:function(t,e,n,r,i,s){try{Tt.set(t,e,void 0,void 0,s);var o={};VP.forEach(a=>{e[a]&&(o[a]=e[a])}),Object.keys(o).length&&kr.set(t,o,n,r,i,s)}catch(a){Tt.error(a)}},remove:function(t,e){try{M==null||M.localStorage.removeItem(t),kr.remove(t,e)}catch(n){Tt.error(n)}}}),Cu={},KP={is_supported:function(){return!0},error:function(t){se.error("memoryStorage error: "+t)},get:function(t){return Cu[t]||null},parse:function(t){return Cu[t]||null},set:function(t,e){Cu[t]=e},remove:function(t){delete Cu[t]}},Hi=null,Nt={is_supported:function(){if(!si(Hi))return Hi;if(Hi=!0,G(M))Hi=!1;else try{var t="__support__";Nt.set(t,"xyz"),Nt.get(t)!=='"xyz"'&&(Hi=!1),Nt.remove(t)}catch{Hi=!1}return Hi},error:function(t){se.error("sessionStorage error: ",t)},get:function(t){try{return M==null?void 0:M.sessionStorage.getItem(t)}catch(e){Nt.error(e)}return null},parse:function(t){try{return JSON.parse(Nt.get(t))||null}catch{}return null},set:function(t,e){try{M==null||M.sessionStorage.setItem(t,JSON.stringify(e))}catch(n){Nt.error(n)}},remove:function(t){try{M==null||M.sessionStorage.removeItem(t)}catch(e){Nt.error(e)}}};(function(t){t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED"})(li||(li={}));class GP{constructor(e){this.instance=e}get config(){return this.instance.config}get consent(){return this.getDnt()?li.DENIED:this.storedConsent}isOptedOut(){return this.consent===li.DENIED||this.consent===li.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(e){this.storage.set(this.storageKey,e?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){var{token:e,opt_out_capturing_cookie_prefix:n}=this.instance.config;return(n||"__ph_opt_in_out_")+e}get storedConsent(){var e=this.storage.get(this.storageKey);return e==="1"?li.GRANTED:e==="0"?li.DENIED:li.PENDING}get storage(){if(!this._storage){var e=this.config.opt_out_capturing_persistence_type;this._storage=e==="localStorage"?Tt:kr;var n=e==="localStorage"?kr:Tt;n.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(n.get(this.storageKey)==="1"),n.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!E_([yn==null?void 0:yn.doNotTrack,yn==null?void 0:yn.msDoNotTrack,Fe.doNotTrack],e=>$e([!0,1,"1","yes"],e))}}var Tu=Qt("[Dead Clicks]"),YP=()=>!0,ZP=t=>{var e,n=!((e=t.instance.persistence)===null||e===void 0||!e.get_property(x_)),r=t.instance.config.capture_dead_clicks;return oi(r)?r:n};class ry{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,n,r){this.instance=e,this.isEnabled=n,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[x_]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(e){var n,r,i;(n=Fe.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&e(),(r=Fe.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"dead-clicks-autocapture",s=>{s?Tu.error("failed to load script",s):e()})}start(){var e;if(ae){if(!this._lazyLoadedDeadClicksAutocapture&&(e=Fe.__PosthogExtensions__)!==null&&e!==void 0&&e.initDeadClicksAutocapture){var n=lt(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Fe.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(ae),Tu.info("starting...")}}else Tu.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Tu.info("stopping..."))}}var Iu=Qt("[ExceptionAutocapture]");class XP{constructor(e){var n;B(this,"startCapturing",()=>{var r,i,s,o,a,c;if(M&&this.isEnabled){var u=(r=Fe.__PosthogExtensions__)===null||r===void 0||(i=r.errorWrappingFunctions)===null||i===void 0?void 0:i.wrapOnError,d=(s=Fe.__PosthogExtensions__)===null||s===void 0||(o=s.errorWrappingFunctions)===null||o===void 0?void 0:o.wrapUnhandledRejection,l=(a=Fe.__PosthogExtensions__)===null||a===void 0||(c=a.errorWrappingFunctions)===null||c===void 0?void 0:c.wrapConsoleError;if(u&&d&&l)try{this.unwrapOnError||(this.unwrapOnError=u(this.captureException.bind(this))),this.unwrapUnhandledRejection||(this.unwrapUnhandledRejection=d(this.captureException.bind(this))),this.unwrapConsoleError||(this.unwrapConsoleError=l(this.captureException.bind(this)))}catch(h){Iu.error("failed to start",h),this.stopCapturing()}else Iu.error("failed to load error wrapping functions - cannot start")}}),this.instance=e,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[T_]),this.config=this.requiredConfig(),this.startIfEnabled()}requiredConfig(){var e=this.instance.config.capture_exceptions,n={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return lt(e)?n=D(D({},n),e):(G(e)?this.remoteEnabled:e)&&(n=D(D({},n),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.config.capture_console_errors||this.config.capture_unhandled_errors||this.config.capture_unhandled_rejections}get hasHandlers(){return!G(this.unwrapOnError)&&!G(this.unwrapUnhandledRejection)&&!G(this.unwrapConsoleError)}startIfEnabled(){this.isEnabled&&!this.hasHandlers&&(Iu.info("enabled, starting..."),this.loadScript(this.startCapturing))}loadScript(e){var n,r;this.hasHandlers&&e(),(n=Fe.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this.instance,"exception-autocapture",i=>{if(i)return Iu.error("failed to load script",i);e()})}stopCapturing(){var e,n,r;(e=this.unwrapOnError)===null||e===void 0||e.call(this),this.unwrapOnError=void 0,(n=this.unwrapUnhandledRejection)===null||n===void 0||n.call(this),this.unwrapUnhandledRejection=void 0,(r=this.unwrapConsoleError)===null||r===void 0||r.call(this),this.unwrapConsoleError=void 0}onRemoteConfig(e){var n=e.autocaptureExceptions;this.remoteEnabled=!!n||!1,this.config=this.requiredConfig(),this.instance.persistence&&this.instance.persistence.register({[T_]:this.remoteEnabled}),this.startIfEnabled()}captureException(e){var n=this.instance.requestRouter.endpointFor("ui");e.$exception_personURL="".concat(n,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(e)}}function iy(t){return!G(Event)&&sy(t,Event)}function sy(t,e){try{return t instanceof e}catch{return!1}}function xu(t,e){return Object.prototype.toString.call(t)==="[object ".concat(e,"]")}function Df(t){return xu(t,"DOMError")}var oy=/\(error: (.*)\)/,ay=50,$s="?";function Nf(t,e,n,r){var i={platform:"web:javascript",filename:t,function:e==="<anonymous>"?$s:e,in_app:!0};return G(n)||(i.lineno=n),G(r)||(i.colno=r),i}var JP=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,QP=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,eM=/\((\S*)(?::(\d+))(?::(\d+))\)/,tM=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,nM=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,rM=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e.sort((i,s)=>i[0]-s[0]).map(i=>i[1]);return function(i){for(var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=[],a=i.split(`
`),c=s;c<a.length;c++){var u=a[c];if(!(u.length>1024)){var d=oy.test(u)?u.replace(oy,"$1"):u;if(!d.match(/\S*Error: /)){for(var l of r){var h=l(d);if(h){o.push(h);break}}if(o.length>=ay)break}}}return function(f){if(!f.length)return[];var p=Array.from(f);return p.reverse(),p.slice(0,ay).map(g=>D(D({},g),{},{filename:g.filename||iM(p).filename,function:g.function||$s}))}(o)}}([30,t=>{var e=JP.exec(t);if(e){var[,n,r,i]=e;return Nf(n,$s,+r,+i)}var s=QP.exec(t);if(s){if(s[2]&&s[2].indexOf("eval")===0){var o=eM.exec(s[2]);o&&(s[2]=o[1],s[3]=o[2],s[4]=o[3])}var[a,c]=uy(s[1]||$s,s[2]);return Nf(c,a,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}}],[50,t=>{var e=tM.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var n=nM.exec(e[3]);n&&(e[1]=e[1]||"eval",e[3]=n[1],e[4]=n[2],e[5]="")}var r=e[3],i=e[1]||$s;return[i,r]=uy(i,r),Nf(r,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]);function iM(t){return t[t.length-1]||{}}var Ru,cy,Ff,uy=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:$s,n?"safari-extension:".concat(e):"safari-web-extension:".concat(e)]:[t,e]},sM=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function $f(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=t.stacktrace||t.stack||"",r=function(o){return o&&oM.test(o.message)?1:0}(t);try{var i=rM,s=function(o,a){var c=function(u){var d=globalThis._posthogChunkIds;if(!d)return{};var l=Object.keys(d);return Ff&&l.length===cy||(cy=l.length,Ff=l.reduce((h,f)=>{Ru||(Ru={});var p=Ru[f];if(p)h[p[0]]=p[1];else for(var g=u(f),v=g.length-1;v>=0;v--){var m=g[v],_=m==null?void 0:m.filename,w=d[f];if(_&&w){h[_]=w,Ru[f]=[_,w];break}}return h},{})),Ff}(a);return o.forEach(u=>{u.filename&&(u.chunk_id=c[u.filename])}),o}(i(n,r),i);return s.slice(0,s.length-e)}catch{}return[]}var oM=/Minified React error #\d+;/i;function Uf(t,e){var n,r,i=$f(t),s=(n=e==null?void 0:e.handled)===null||n===void 0||n,o=(r=e==null?void 0:e.synthetic)!==null&&r!==void 0&&r;return{$exception_list:[{type:e!=null&&e.overrideExceptionType?e.overrideExceptionType:t.name,value:e!=null&&e.overrideExceptionMessage?e.overrideExceptionMessage:function(a){var c=a.message;return c.error&&typeof c.error.message=="string"?c.error.message:c}(t),stacktrace:{frames:i,type:"raw"},mechanism:{handled:s,synthetic:o}}],$exception_level:"error"}}function Bf(t,e){var n,r,i,s=(n=e==null?void 0:e.handled)===null||n===void 0||n,o=(r=e==null?void 0:e.synthetic)===null||r===void 0||r,a={type:e!=null&&e.overrideExceptionType?e.overrideExceptionType:(i=e==null?void 0:e.defaultExceptionType)!==null&&i!==void 0?i:"Error",value:e!=null&&e.overrideExceptionMessage?e.overrideExceptionMessage:t||(e==null?void 0:e.defaultExceptionMessage),mechanism:{handled:s,synthetic:o}};if(e!=null&&e.syntheticException){var c=$f(e.syntheticException,1);c.length&&(a.stacktrace={frames:c,type:"raw"})}return{$exception_list:[a],$exception_level:"error"}}function aM(t){return Et(t)&&!vf(t)&&_P.indexOf(t)>=0}function cM(t,e){var n,r,i=(n=e==null?void 0:e.handled)===null||n===void 0||n,s=(r=e==null?void 0:e.synthetic)===null||r===void 0||r,o=e!=null&&e.overrideExceptionType?e.overrideExceptionType:iy(t)?t.constructor.name:"Error",a=e!=null&&e.overrideExceptionMessage?e.overrideExceptionMessage:"Non-Error ".concat("exception"," captured with keys: ",function(d){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:40,h=Object.keys(d);if(h.sort(),!h.length)return"[object has no keys]";for(var f=h.length;f>0;f--){var p=h.slice(0,f).join(", ");if(!(p.length>l))return f===h.length||p.length<=l?p:"".concat(p.slice(0,l),"...")}return""}(t)),c={type:o,value:a,mechanism:{handled:i,synthetic:s}};if(e!=null&&e.syntheticException){var u=$f(e==null?void 0:e.syntheticException,1);u.length&&(c.stacktrace={frames:u,type:"raw"})}return{$exception_list:[c],$exception_level:aM(t.level)?t.level:"error"}}function uM(t,e){var{error:n,event:r}=t,i={$exception_list:[]},s=n||r;if(Df(s)||function(f){return xu(f,"DOMException")}(s)){var o=s;if(function(f){return"stack"in f}(s))i=Uf(s,e);else{var a=o.name||(Df(o)?"DOMError":"DOMException"),c=o.message?"".concat(a,": ").concat(o.message):a,u=Df(o)?"DOMError":"DOMException";i=Bf(c,D(D({},e),{},{overrideExceptionType:u,defaultExceptionMessage:c}))}return"code"in o&&(i.$exception_DOMException_code="".concat(o.code)),i}if(function(f){return xu(f,"ErrorEvent")}(s)&&s.error)return Uf(s.error,e);if(function(f){switch(Object.prototype.toString.call(f)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return sy(f,Error)}}(s))return Uf(s,e);if(function(f){return xu(f,"Object")}(s)||iy(s))return cM(s,e);if(G(n)&&Et(r)){var d="Error",l=r,h=r.match(sM);return h&&(d=h[1],l=h[2]),Bf(l,D(D({},e),{},{overrideExceptionType:d,defaultExceptionMessage:l}))}return Bf(s,e)}function Au(t){var e,n;return((e=JSON.stringify(t,(n=[],function(r,i){if(lt(i)){for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(i)?"[Circular]":(n.push(i),i)}return i})))===null||e===void 0?void 0:e.length)||0}function jf(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:66060288e-1;if(t.size>=e&&t.data.length>1){var n=Math.floor(t.data.length/2),r=t.data.slice(0,n),i=t.data.slice(n);return[jf({size:Au(r),data:r,sessionId:t.sessionId,windowId:t.windowId}),jf({size:Au(i),data:i,sessionId:t.sessionId,windowId:t.windowId})].flatMap(s=>s)}return[t]}var Cr=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(Cr||{}),zn=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(zn||{}),Hf="[SessionRecording]",qf="redacted",Pu={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com"]},lM=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],dM=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],fM=["/s/","/e/","/i/"];function ly(t,e,n,r){if(Ge(t))return t;var i=(e==null?void 0:e["content-length"])||function(s){return new Blob([s]).size}(t);return Et(i)&&(i=parseInt(i)),i>n?Hf+" ".concat(r," body too large to record (").concat(i," bytes)"):t}function dy(t,e){if(Ge(t))return t;var n=t;return Ns(n,!1)||(n=Hf+" "+e+" body "+qf),Ye(dM,r=>{var i,s;(i=n)!==null&&i!==void 0&&i.length&&((s=n)===null||s===void 0?void 0:s.indexOf(r))!==-1&&(n=Hf+" "+e+" body "+qf+" as might contain: "+r)}),n}var hM=(t,e)=>{var n,r,i,s={payloadSizeLimitBytes:Pu.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Pu.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...Pu.payloadHostDenyList]},o=t.session_recording.recordHeaders!==!1&&e.recordHeaders,a=t.session_recording.recordBody!==!1&&e.recordBody,c=t.capture_performance!==!1&&e.recordPerformance,u=(n=s,i=Math.min(1e6,(r=n.payloadSizeLimitBytes)!==null&&r!==void 0?r:1e6),h=>(h!=null&&h.requestBody&&(h.requestBody=ly(h.requestBody,h.requestHeaders,i,"Request")),h!=null&&h.responseBody&&(h.responseBody=ly(h.responseBody,h.responseHeaders,i,"Response")),h)),d=h=>{return u(((g,v)=>{var m,_=Fs(g.name),w=v.indexOf("http")===0?(m=Fs(v))===null||m===void 0?void 0:m.pathname:v;w==="/"&&(w="");var T=_==null?void 0:_.pathname.replace(w||"","");if(!(_&&T&&fM.some(C=>T.indexOf(C)===0)))return g})((p=(f=h).requestHeaders,Ge(p)||Ye(Object.keys(p??{}),g=>{lM.includes(g.toLowerCase())&&(p[g]=qf)}),f),t.api_host));var f,p},l=Wn(t.session_recording.maskNetworkRequestFn);return l&&Wn(t.session_recording.maskCapturedNetworkRequestFn)&&se.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),l&&(t.session_recording.maskCapturedNetworkRequestFn=h=>{var f=t.session_recording.maskNetworkRequestFn({url:h.name});return D(D({},h),{},{name:f==null?void 0:f.url})}),s.maskRequestFn=Wn(t.session_recording.maskCapturedNetworkRequestFn)?h=>{var f,p,g,v=d(h);return v&&(f=(p=(g=t.session_recording).maskCapturedNetworkRequestFn)===null||p===void 0?void 0:p.call(g,v))!==null&&f!==void 0?f:void 0}:h=>function(f){if(!G(f))return f.requestBody=dy(f.requestBody,"Request"),f.responseBody=dy(f.responseBody,"Response"),f}(d(h)),D(D(D({},Pu),s),{},{recordHeaders:o,recordBody:a,recordPerformance:c,recordInitialRequests:c})};function Tn(t,e,n,r,i){return e>n&&(se.warn("min cannot be greater than max."),e=n),Jt(t)?t>n?(r&&se.warn(r+" cannot be greater than max: "+n+". Using max value instead."),n):t<e?(r&&se.warn(r+" cannot be less than min: "+e+". Using min value instead."),e):t:(r&&se.warn(r+" must be a number. using max or fallback. max: "+n+", fallback: "+i),Tn(i||n,e,n,r))}class pM{constructor(e){var n,r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};B(this,"bucketSize",100),B(this,"refillRate",10),B(this,"mutationBuckets",{}),B(this,"loggedTracker",{}),B(this,"refillBuckets",()=>{Object.keys(this.mutationBuckets).forEach(s=>{this.mutationBuckets[s]=this.mutationBuckets[s]+this.refillRate,this.mutationBuckets[s]>=this.bucketSize&&delete this.mutationBuckets[s]})}),B(this,"getNodeOrRelevantParent",s=>{var o=this.rrweb.mirror.getNode(s);if((o==null?void 0:o.nodeName)!=="svg"&&o instanceof Element){var a=o.closest("svg");if(a)return[this.rrweb.mirror.getId(a),a]}return[s,o]}),B(this,"numberOfChanges",s=>{var o,a,c,u,d,l,h,f;return((o=(a=s.removes)===null||a===void 0?void 0:a.length)!==null&&o!==void 0?o:0)+((c=(u=s.attributes)===null||u===void 0?void 0:u.length)!==null&&c!==void 0?c:0)+((d=(l=s.texts)===null||l===void 0?void 0:l.length)!==null&&d!==void 0?d:0)+((h=(f=s.adds)===null||f===void 0?void 0:f.length)!==null&&h!==void 0?h:0)}),B(this,"throttleMutations",s=>{if(s.type!==3||s.data.source!==0)return s;var o=s.data,a=this.numberOfChanges(o);o.attributes&&(o.attributes=o.attributes.filter(u=>{var d,l,h,[f,p]=this.getNodeOrRelevantParent(u.id);return this.mutationBuckets[f]===0?!1:(this.mutationBuckets[f]=(d=this.mutationBuckets[f])!==null&&d!==void 0?d:this.bucketSize,this.mutationBuckets[f]=Math.max(this.mutationBuckets[f]-1,0),this.mutationBuckets[f]===0&&(this.loggedTracker[f]||(this.loggedTracker[f]=!0,(l=(h=this.options).onBlockedNode)===null||l===void 0||l.call(h,f,p))),u)}));var c=this.numberOfChanges(o);return c!==0||a===c?s:void 0}),this.rrweb=e,this.options=i,this.refillRate=Tn((n=this.options.refillRate)!==null&&n!==void 0?n:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=Tn((r=this.options.bucketSize)!==null&&r!==void 0?r:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}}var In=Uint8Array,ln=Uint16Array,Us=Uint32Array,Wf=new In([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),zf=new In([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),fy=new In([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hy=function(t,e){for(var n=new ln(31),r=0;r<31;++r)n[r]=e+=1<<t[r-1];var i=new Us(n[30]);for(r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return[n,i]},py=hy(Wf,2),gM=py[0],Vf=py[1];gM[28]=258,Vf[258]=28;for(var gy=hy(zf,0)[1],my=new ln(32768),rt=0;rt<32768;++rt){var qi=(43690&rt)>>>1|(21845&rt)<<1;qi=(61680&(qi=(52428&qi)>>>2|(13107&qi)<<2))>>>4|(3855&qi)<<4,my[rt]=((65280&qi)>>>8|(255&qi)<<8)>>>1}var Sa=function(t,e,n){for(var r=t.length,i=0,s=new ln(e);i<r;++i)++s[t[i]-1];var o,a=new ln(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;for(o=new ln(r),i=0;i<r;++i)o[i]=my[a[t[i]-1]++]>>>15-t[i];return o},Wi=new In(288);for(rt=0;rt<144;++rt)Wi[rt]=8;for(rt=144;rt<256;++rt)Wi[rt]=9;for(rt=256;rt<280;++rt)Wi[rt]=7;for(rt=280;rt<288;++rt)Wi[rt]=8;var Mu=new In(32);for(rt=0;rt<32;++rt)Mu[rt]=5;var mM=Sa(Wi,9),vM=Sa(Mu,5),vy=function(t){return(t/8>>0)+(7&t&&1)},_y=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof ln?ln:t instanceof Us?Us:In)(n-e);return r.set(t.subarray(e,n)),r},Tr=function(t,e,n){n<<=7&e;var r=e/8>>0;t[r]|=n,t[r+1]|=n>>>8},Ea=function(t,e,n){n<<=7&e;var r=e/8>>0;t[r]|=n,t[r+1]|=n>>>8,t[r+2]|=n>>>16},Kf=function(t,e){for(var n=[],r=0;r<t.length;++r)t[r]&&n.push({s:r,f:t[r]});var i=n.length,s=n.slice();if(!i)return[new In(0),0];if(i==1){var o=new In(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(C,E){return C.f-E.f}),n.push({s:-1,f:25001});var a=n[0],c=n[1],u=0,d=1,l=2;for(n[0]={s:-1,f:a.f+c.f,l:a,r:c};d!=i-1;)a=n[n[u].f<n[l].f?u++:l++],c=n[u!=d&&n[u].f<n[l].f?u++:l++],n[d++]={s:-1,f:a.f+c.f,l:a,r:c};var h=s[0].s;for(r=1;r<i;++r)s[r].s>h&&(h=s[r].s);var f=new ln(h+1),p=Gf(n[d-1],f,0);if(p>e){r=0;var g=0,v=p-e,m=1<<v;for(s.sort(function(C,E){return f[E.s]-f[C.s]||C.f-E.f});r<i;++r){var _=s[r].s;if(!(f[_]>e))break;g+=m-(1<<p-f[_]),f[_]=e}for(g>>>=v;g>0;){var w=s[r].s;f[w]<e?g-=1<<e-f[w]++-1:++r}for(;r>=0&&g;--r){var T=s[r].s;f[T]==e&&(--f[T],++g)}p=e}return[new In(f),p]},Gf=function(t,e,n){return t.s==-1?Math.max(Gf(t.l,e,n+1),Gf(t.r,e,n+1)):e[t.s]=n},yy=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new ln(++e),r=0,i=t[0],s=1,o=function(c){n[r++]=c},a=1;a<=e;++a)if(t[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=t[a]}return[n.subarray(0,r),e]},ka=function(t,e){for(var n=0,r=0;r<e.length;++r)n+=t[r]*e[r];return n},Yf=function(t,e,n){var r=n.length,i=vy(e+2);t[i]=255&r,t[i+1]=r>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;s<r;++s)t[i+s+4]=n[s];return 8*(i+4+r)},by=function(t,e,n,r,i,s,o,a,c,u,d){Tr(e,d++,n),++i[256];for(var l=Kf(i,15),h=l[0],f=l[1],p=Kf(s,15),g=p[0],v=p[1],m=yy(h),_=m[0],w=m[1],T=yy(g),C=T[0],E=T[1],I=new ln(19),y=0;y<_.length;++y)I[31&_[y]]++;for(y=0;y<C.length;++y)I[31&C[y]]++;for(var b=Kf(I,7),k=b[0],x=b[1],R=19;R>4&&!k[fy[R-1]];--R);var F,z,J,U,q=u+5<<3,V=ka(i,Wi)+ka(s,Mu)+o,j=ka(i,h)+ka(s,g)+o+14+3*R+ka(I,k)+(2*I[16]+3*I[17]+7*I[18]);if(q<=V&&q<=j)return Yf(e,d,t.subarray(c,c+u));if(Tr(e,d,1+(j<V)),d+=2,j<V){F=Sa(h,f),z=h,J=Sa(g,v),U=g;var S=Sa(k,x);for(Tr(e,d,w-257),Tr(e,d+5,E-1),Tr(e,d+10,R-4),d+=14,y=0;y<R;++y)Tr(e,d+3*y,k[fy[y]]);d+=3*R;for(var P=[_,C],N=0;N<2;++N){var O=P[N];for(y=0;y<O.length;++y){var W=31&O[y];Tr(e,d,S[W]),d+=k[W],W>15&&(Tr(e,d,O[y]>>>5&127),d+=O[y]>>>12)}}}else F=mM,z=Wi,J=vM,U=Mu;for(y=0;y<a;++y)if(r[y]>255){W=r[y]>>>18&31,Ea(e,d,F[W+257]),d+=z[W+257],W>7&&(Tr(e,d,r[y]>>>23&31),d+=Wf[W]);var te=31&r[y];Ea(e,d,J[te]),d+=U[te],te>3&&(Ea(e,d,r[y]>>>5&8191),d+=zf[te])}else Ea(e,d,F[r[y]]),d+=z[r[y]];return Ea(e,d,F[256]),d+z[256]},_M=new Us([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),yM=function(){for(var t=new Us(256),e=0;e<256;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),bM=function(){var t=4294967295;return{p:function(e){for(var n=t,r=0;r<e.length;++r)n=yM[255&n^e[r]]^n>>>8;t=n},d:function(){return 4294967295^t}}},wM=function(t,e,n,r,i){return function(s,o,a,c,u,d){var l=s.length,h=new In(c+l+5*(1+Math.floor(l/7e3))+u),f=h.subarray(c,h.length-u),p=0;if(!o||l<8)for(var g=0;g<=l;g+=65535){var v=g+65535;v<l?p=Yf(f,p,s.subarray(g,v)):(f[g]=d,p=Yf(f,p,s.subarray(g,l)))}else{for(var m=_M[o-1],_=m>>>13,w=8191&m,T=(1<<a)-1,C=new ln(32768),E=new ln(T+1),I=Math.ceil(a/3),y=2*I,b=function(We){return(s[We]^s[We+1]<<I^s[We+2]<<y)&T},k=new Us(25e3),x=new ln(288),R=new ln(32),F=0,z=0,J=(g=0,0),U=0,q=0;g<l;++g){var V=b(g),j=32767&g,S=E[V];if(C[j]=S,E[V]=j,U<=g){var P=l-g;if((F>7e3||J>24576)&&P>423){p=by(s,f,0,k,x,R,z,J,q,g-q,p),J=F=z=0,q=g;for(var N=0;N<286;++N)x[N]=0;for(N=0;N<30;++N)R[N]=0}var O=2,W=0,te=w,K=j-S&32767;if(P>2&&V==b(g-K))for(var Ue=Math.min(_,P)-1,ee=Math.min(32767,g),Se=Math.min(258,P);K<=ee&&--te&&j!=S;){if(s[g+O]==s[g+O-K]){for(var be=0;be<Se&&s[g+be]==s[g+be-K];++be);if(be>O){if(O=be,W=K,be>Ue)break;var le=Math.min(K,be-2),ue=0;for(N=0;N<le;++N){var Ce=g-K+N+32768&32767,pe=Ce-C[Ce]+32768&32767;pe>ue&&(ue=pe,S=Ce)}}}K+=(j=S)-(S=C[j])+32768&32767}if(W){k[J++]=268435456|Vf[O]<<18|gy[W];var fe=31&Vf[O],ne=31&gy[W];z+=Wf[fe]+zf[ne],++x[257+fe],++R[ne],U=g+O,++F}else k[J++]=s[g],++x[s[g]]}}p=by(s,f,d,k,x,R,z,J,q,g-q,p)}return _y(h,0,c+vy(p)+u)}(t,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,n,r,!0)},Zf=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},SM=function(t,e){var n=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:e.level==9?2:0,t[9]=3,e.mtime!=0&&Zf(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var r=0;r<=n.length;++r)t[r+10]=n.charCodeAt(r)}},EM=function(t){return 10+(t.filename&&t.filename.length+1||0)};function wy(t,e){e===void 0&&(e={});var n=bM(),r=t.length;n.p(t);var i=wM(t,e,EM(e),8),s=i.length;return SM(i,e),Zf(i,s-8,n.d()),Zf(i,s-4,r),i}function Sy(t,e){var n=t.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(t);for(var r=new In(t.length+(t.length>>>1)),i=0,s=function(u){r[i++]=u},o=0;o<n;++o){if(i+5>r.length){var a=new In(i+8+(n-o<<1));a.set(r),r=a}var c=t.charCodeAt(o);c<128||e?s(c):c<2048?(s(192|c>>>6),s(128|63&c)):c>55295&&c<57344?(s(240|(c=65536+(1047552&c)|1023&t.charCodeAt(++o))>>>18),s(128|c>>>12&63),s(128|c>>>6&63),s(128|63&c)):(s(224|c>>>12),s(128|c>>>6&63),s(128|63&c))}return _y(r,0,i)}function kM(t,e){return function(n){for(var r=0,i=0;i<n.length;i++)r=(r<<5)-r+n.charCodeAt(i),r|=0;return Math.abs(r)}(t)%100<Tn(100*e,0,100)}var Ca="[SessionRecording]",Wt=Qt(Ca);function Ou(){var t,e;return Fe==null||(t=Fe.__PosthogExtensions__)===null||t===void 0||(e=t.rrweb)===null||e===void 0?void 0:e.record}var CM=3e5,TM=[zn.MouseMove,zn.MouseInteraction,zn.Scroll,zn.ViewportResize,zn.Input,zn.TouchMove,zn.MediaInteraction,zn.Drag],Ey=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function zi(t){return function(e,n){for(var r="",i=0;i<e.length;){var s=e[i++];r+=String.fromCharCode(s)}return r}(wy(Sy(JSON.stringify(t))))}function ky(t){return t.type===Cr.Custom&&t.data.tag==="sessionIdle"}function Cy(t,e){return e.some(n=>n.matching==="regex"&&new RegExp(n.url).test(t))}class IM{get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this._captureStarted}get sessionManager(){if(!this.instance.sessionManager)throw new Error(Ca+" must be started with a valid sessionManager.");return this.instance.sessionManager}get fullSnapshotIntervalMillis(){var e,n;return this.triggerStatus==="trigger_pending"?6e4:(e=(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.full_snapshot_interval_millis)!==null&&e!==void 0?e:CM}get isSampled(){var e=this.instance.get_property(ya);return oi(e)?e:null}get sessionDuration(){var e,n,r=(e=this.buffer)===null||e===void 0?void 0:e.data[((n=this.buffer)===null||n===void 0?void 0:n.data.length)-1],{sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i:null}get isRecordingEnabled(){var e=!!this.instance.get_property(yf),n=!this.instance.config.disable_session_recording;return M&&e&&n}get isConsoleLogCaptureEnabled(){var e=!!this.instance.get_property(A_),n=this.instance.config.enable_recording_console_log;return n??e}get canvasRecording(){var e,n,r,i,s,o,a=this.instance.config.session_recording.captureCanvas,c=this.instance.get_property(O_),u=(e=(n=a==null?void 0:a.recordCanvas)!==null&&n!==void 0?n:c==null?void 0:c.enabled)!==null&&e!==void 0&&e,d=(r=(i=a==null?void 0:a.canvasFps)!==null&&i!==void 0?i:c==null?void 0:c.fps)!==null&&r!==void 0?r:4,l=(s=(o=a==null?void 0:a.canvasQuality)!==null&&o!==void 0?o:c==null?void 0:c.quality)!==null&&s!==void 0?s:.4;if(typeof l=="string"){var h=parseFloat(l);l=isNaN(h)?.4:h}return{enabled:u,fps:Tn(d,0,12,"canvas recording fps",4),quality:Tn(l,0,1,"canvas recording quality",.4)}}get networkPayloadCapture(){var e,n,r=this.instance.get_property(P_),i={recordHeaders:(e=this.instance.config.session_recording)===null||e===void 0?void 0:e.recordHeaders,recordBody:(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.recordBody},s=(i==null?void 0:i.recordHeaders)||(r==null?void 0:r.recordHeaders),o=(i==null?void 0:i.recordBody)||(r==null?void 0:r.recordBody),a=lt(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,c=!!(oi(a)?a:r!=null&&r.capturePerformance);return s||o||c?{recordHeaders:s,recordBody:o,recordPerformance:c}:void 0}get masking(){var e,n,r,i,s,o,a=this.instance.get_property(M_),c={maskAllInputs:(e=this.instance.config.session_recording)===null||e===void 0?void 0:e.maskAllInputs,maskTextSelector:(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.maskTextSelector,blockSelector:(r=this.instance.config.session_recording)===null||r===void 0?void 0:r.blockSelector},u=(i=c==null?void 0:c.maskAllInputs)!==null&&i!==void 0?i:a==null?void 0:a.maskAllInputs,d=(s=c==null?void 0:c.maskTextSelector)!==null&&s!==void 0?s:a==null?void 0:a.maskTextSelector,l=(o=c==null?void 0:c.blockSelector)!==null&&o!==void 0?o:a==null?void 0:a.blockSelector;return G(u)&&G(d)&&G(l)?void 0:{maskAllInputs:u==null||u,maskTextSelector:d,blockSelector:l}}get sampleRate(){var e=this.instance.get_property(L_);return Jt(e)?e:null}get minimumDuration(){var e=this.instance.get_property(D_);return Jt(e)?e:null}get status(){return this.receivedDecide?this.isRecordingEnabled?this.isSampled===!1?"disabled":this._urlBlocked?"paused":Ge(this._linkedFlag)||this._linkedFlagSeen?this.triggerStatus==="trigger_pending"?"buffering":oi(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}get urlTriggerStatus(){var e;return this._urlTriggers.length===0?"trigger_disabled":((e=this.instance)===null||e===void 0?void 0:e.get_property(bf))===this.sessionId?"trigger_activated":"trigger_pending"}get eventTriggerStatus(){var e;return this._eventTriggers.length===0?"trigger_disabled":((e=this.instance)===null||e===void 0?void 0:e.get_property(wf))===this.sessionId?"trigger_activated":"trigger_pending"}get triggerStatus(){var e=this.eventTriggerStatus==="trigger_activated"||this.urlTriggerStatus==="trigger_activated",n=this.eventTriggerStatus==="trigger_pending"||this.urlTriggerStatus==="trigger_pending";return e?"trigger_activated":n?"trigger_pending":"trigger_disabled"}constructor(e){if(B(this,"queuedRRWebEvents",[]),B(this,"isIdle","unknown"),B(this,"_linkedFlagSeen",!1),B(this,"_lastActivityTimestamp",Date.now()),B(this,"_linkedFlag",null),B(this,"_removePageViewCaptureHook",void 0),B(this,"_onSessionIdListener",void 0),B(this,"_persistDecideOnSessionListener",void 0),B(this,"_samplingSessionListener",void 0),B(this,"_urlTriggers",[]),B(this,"_urlBlocklist",[]),B(this,"_urlBlocked",!1),B(this,"_eventTriggers",[]),B(this,"_removeEventTriggerCaptureHook",void 0),B(this,"_forceAllowLocalhostNetworkCapture",!1),B(this,"_onBeforeUnload",()=>{this._flushBuffer()}),B(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),B(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),B(this,"_onVisibilityChange",()=>{if(ae!=null&&ae.visibilityState){var i="window "+ae.visibilityState;this._tryAddCustomEvent(i,{})}}),this.instance=e,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw Wt.error("started without valid sessionManager"),new Error(Ca+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(Ca+" cannot be used with __preview_experimental_cookieless_mode.");var{sessionId:n,windowId:r}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=n,this.windowId=r,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&Wt.warn("session_idle_threshold_ms (".concat(this.sessionIdleThresholdMilliseconds,") is greater than the session timeout (").concat(this.sessionManager.sessionTimeoutMs,"). Session will never be detected as idle"))}startIfEnabledOrStop(e){this.isRecordingEnabled?(this._startCapture(e),gt(M,"beforeunload",this._onBeforeUnload),gt(M,"offline",this._onOffline),gt(M,"online",this._onOnline),gt(M,"visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),Ge(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance.on("eventCaptured",n=>{try{if(n.event==="$pageview"){var r=n!=null&&n.properties.$current_url?this._maskUrl(n==null?void 0:n.properties.$current_url):"";if(!r)return;this._tryAddCustomEvent("$pageview",{href:r})}}catch(i){Wt.error("Could not add $pageview to rrweb session",i)}})),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId((n,r,i)=>{var s,o,a,c;i&&(this._tryAddCustomEvent("$session_id_change",{sessionId:n,windowId:r,changeReason:i}),(s=this.instance)===null||s===void 0||(o=s.persistence)===null||o===void 0||o.unregister(wf),(a=this.instance)===null||a===void 0||(c=a.persistence)===null||c===void 0||c.unregister(bf))}))):this.stopRecording()}stopRecording(){var e,n,r,i;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,M==null||M.removeEventListener("beforeunload",this._onBeforeUnload),M==null||M.removeEventListener("offline",this._onOffline),M==null||M.removeEventListener("online",this._onOnline),M==null||M.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),(e=this._removePageViewCaptureHook)===null||e===void 0||e.call(this),this._removePageViewCaptureHook=void 0,(n=this._removeEventTriggerCaptureHook)===null||n===void 0||n.call(this),this._removeEventTriggerCaptureHook=void 0,(r=this._onSessionIdListener)===null||r===void 0||r.call(this),this._onSessionIdListener=void 0,(i=this._samplingSessionListener)===null||i===void 0||i.call(this),this._samplingSessionListener=void 0,Wt.info("stopped"))}makeSamplingDecision(e){var n,r=this.sessionId!==e,i=this.sampleRate;if(Jt(i)){var s=this.isSampled,o=r||!oi(s),a=o?kM(e,i):s;o&&(a?this._reportStarted("sampled"):Wt.warn("Sample rate (".concat(i,") has determined that this sessionId (").concat(e,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:i,isSampled:a})),(n=this.instance.persistence)===null||n===void 0||n.register({[ya]:a})}else{var c;(c=this.instance.persistence)===null||c===void 0||c.register({[ya]:null})}}onRemoteConfig(e){var n,r,i,s,o,a;if(this._tryAddCustomEvent("$remote_config_received",e),this._persistRemoteConfig(e),this._linkedFlag=((n=e.sessionRecording)===null||n===void 0?void 0:n.linkedFlag)||null,(r=e.sessionRecording)!==null&&r!==void 0&&r.endpoint&&(this._endpoint=(a=e.sessionRecording)===null||a===void 0?void 0:a.endpoint),this._setupSampling(),!Ge(this._linkedFlag)&&!this._linkedFlagSeen){var c=Et(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,u=Et(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((d,l)=>{var h=lt(l)&&c in l,f=u?l[c]===u:h;f&&this._reportStarted("linked_flag_matched",{linkedFlag:c,linkedVariant:u}),this._linkedFlagSeen=f})}(i=e.sessionRecording)!==null&&i!==void 0&&i.urlTriggers&&(this._urlTriggers=e.sessionRecording.urlTriggers),(s=e.sessionRecording)!==null&&s!==void 0&&s.urlBlocklist&&(this._urlBlocklist=e.sessionRecording.urlBlocklist),(o=e.sessionRecording)!==null&&o!==void 0&&o.eventTriggers&&(this._eventTriggers=e.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){Jt(this.sampleRate)&&Ge(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId(e=>{this.makeSamplingDecision(e)}))}_persistRemoteConfig(e){if(this.instance.persistence){var n,r=this.instance.persistence,i=()=>{var s,o,a,c,u,d,l,h,f,p=(s=e.sessionRecording)===null||s===void 0?void 0:s.sampleRate,g=Ge(p)?null:parseFloat(p),v=(o=e.sessionRecording)===null||o===void 0?void 0:o.minimumDurationMilliseconds;r.register({[yf]:!!e.sessionRecording,[A_]:(a=e.sessionRecording)===null||a===void 0?void 0:a.consoleLogRecordingEnabled,[P_]:D({capturePerformance:e.capturePerformance},(c=e.sessionRecording)===null||c===void 0?void 0:c.networkPayloadCapture),[M_]:(u=e.sessionRecording)===null||u===void 0?void 0:u.masking,[O_]:{enabled:(d=e.sessionRecording)===null||d===void 0?void 0:d.recordCanvas,fps:(l=e.sessionRecording)===null||l===void 0?void 0:l.canvasFps,quality:(h=e.sessionRecording)===null||h===void 0?void 0:h.canvasQuality},[L_]:g,[D_]:G(v)?null:v,[N_]:(f=e.sessionRecording)===null||f===void 0?void 0:f.scriptConfig})};i(),(n=this._persistDecideOnSessionListener)===null||n===void 0||n.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(i)}}log(e){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(n=this.instance.sessionRecording)===null||n===void 0||n.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:r,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}_startCapture(e){if(!G(Object.assign)&&!G(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var n,r;this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),Ou()?this._onScriptLoaded():(n=Fe.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this.instance,this.scriptName,i=>{if(i)return Wt.error("could not load recorder",i);this._onScriptLoaded()}),Wt.info("starting"),this.status==="active"&&this._reportStarted(e||"recording_initialized")}}get scriptName(){var e,n,r;return((e=this.instance)===null||e===void 0||(n=e.persistence)===null||n===void 0||(r=n.get_property(N_))===null||r===void 0?void 0:r.script)||"recorder"}isInteractiveEvent(e){var n;return e.type===3&&TM.indexOf((n=e.data)===null||n===void 0?void 0:n.source)!==-1}_updateWindowAndSessionIds(e){var n=this.isInteractiveEvent(e);n||this.isIdle||e.timestamp-this._lastActivityTimestamp>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer());var r=!1;if(n&&(this._lastActivityTimestamp=e.timestamp,this.isIdle)){var i=this.isIdle==="unknown";this.isIdle=!1,i||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),r=!0)}if(!this.isIdle){var{windowId:s,sessionId:o}=this.sessionManager.checkAndGetSessionAndWindowId(!n,e.timestamp),a=this.sessionId!==o,c=this.windowId!==s;this.windowId=s,this.sessionId=o,a||c?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):r&&this._scheduleFullSnapshot()}}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(n){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):Wt.warn("could not emit queued rrweb event.",n,e),!1}}_tryAddCustomEvent(e,n){return this._tryRRWebMethod(Ey(()=>Ou().addCustomEvent(e,n)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(Ey(()=>Ou().takeFullSnapshot()))}_onScriptLoaded(){var e,n,r,i,s={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},o=this.instance.config.session_recording;for(var[a,c]of Object.entries(o||{}))a in s&&(a==="maskInputOptions"?s.maskInputOptions=D({password:!0},c):s[a]=c);this.canvasRecording&&this.canvasRecording.enabled&&(s.recordCanvas=!0,s.sampling={canvas:this.canvasRecording.fps},s.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.masking&&(s.maskAllInputs=(n=this.masking.maskAllInputs)===null||n===void 0||n,s.maskTextSelector=(r=this.masking.maskTextSelector)!==null&&r!==void 0?r:void 0,s.blockSelector=(i=this.masking.blockSelector)!==null&&i!==void 0?i:void 0);var u=Ou();if(u){this.mutationRateLimiter=(e=this.mutationRateLimiter)!==null&&e!==void 0?e:new pM(u,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(l,h)=>{var f="Too many mutations on node '".concat(l,"'. Rate limiting. This could be due to SVG animations or something similar");Wt.info(f,{node:h}),this.log(Ca+" "+f,"warn")}});var d=this._gatherRRWebPlugins();this.stopRrweb=u(D({emit:l=>{this.onRRwebEmit(l)},plugins:d},s)),this._lastActivityTimestamp=Date.now(),this.isIdle=oi(this.isIdle)?this.isIdle:"unknown",this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:s,activePlugins:d.map(l=>l==null?void 0:l.name)}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else Wt.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),this.isIdle!==!0){var e=this.fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},e))}}_gatherRRWebPlugins(){var e,n,r,i,s=[],o=(e=Fe.__PosthogExtensions__)===null||e===void 0||(n=e.rrwebPlugins)===null||n===void 0?void 0:n.getRecordConsolePlugin;o&&this.isConsoleLogCaptureEnabled&&s.push(o());var a=(r=Fe.__PosthogExtensions__)===null||r===void 0||(i=r.rrwebPlugins)===null||i===void 0?void 0:i.getRecordNetworkPlugin;return this.networkPayloadCapture&&Wn(a)&&(!LP.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?s.push(a(hM(this.instance.config,this.networkPayloadCapture))):Wt.info("NetworkCapture not started because we are on localhost.")),s}onRRwebEmit(e){var n;if(this._processQueuedEvents(),e&<(e)){if(e.type===Cr.Meta){var r=this._maskUrl(e.data.href);if(this._lastHref=r,!r)return;e.data.href=r}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),!this._urlBlocked||function(l){return l.type===Cr.Custom&&l.data.tag==="recording paused"}(e)){e.type===Cr.FullSnapshot&&this._scheduleFullSnapshot(),e.type===Cr.FullSnapshot&&this.triggerStatus==="trigger_pending"&&this.clearBuffer();var i=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(i){var s=function(l){var h=l;if(h&<(h)&&h.type===6&<(h.data)&&h.data.plugin==="rrweb/console@1"){h.data.payload.payload.length>10&&(h.data.payload.payload=h.data.payload.payload.slice(0,10),h.data.payload.payload.push("...[truncated]"));for(var f=[],p=0;p<h.data.payload.payload.length;p++)h.data.payload.payload[p]&&h.data.payload.payload[p].length>2e3?f.push(h.data.payload.payload[p].slice(0,2e3)+"...[truncated]"):f.push(h.data.payload.payload[p]);return h.data.payload.payload=f,l}return l}(i);if(this._updateWindowAndSessionIds(s),this.isIdle!==!0||ky(s)){if(ky(s)){var o=s.data.payload;if(o){var a=o.lastActivityTimestamp,c=o.threshold;s.timestamp=a+c}}var u=(n=this.instance.config.session_recording.compress_events)===null||n===void 0||n?function(l){if(Au(l)<1024)return l;try{if(l.type===Cr.FullSnapshot)return D(D({},l),{},{data:zi(l.data),cv:"2024-10"});if(l.type===Cr.IncrementalSnapshot&&l.data.source===zn.Mutation)return D(D({},l),{},{cv:"2024-10",data:D(D({},l.data),{},{texts:zi(l.data.texts),attributes:zi(l.data.attributes),removes:zi(l.data.removes),adds:zi(l.data.adds)})});if(l.type===Cr.IncrementalSnapshot&&l.data.source===zn.StyleSheetRule)return D(D({},l),{},{cv:"2024-10",data:D(D({},l.data),{},{adds:l.data.adds?zi(l.data.adds):void 0,removes:l.data.removes?zi(l.data.removes):void 0})})}catch(h){Wt.error("could not compress event - will use uncompressed event",h)}return l}(s):s,d={$snapshot_bytes:Au(u),$snapshot_data:u,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(d):this.clearBuffer()}}}}}_pageViewFallBack(){if(!this.instance.config.capture_pageview&&M){var e=this._maskUrl(M.location.href);this._lastHref!==e&&(this._tryAddCustomEvent("$url_changed",{href:e}),this._lastHref=e)}}_processQueuedEvents(){if(this.queuedRRWebEvents.length){var e=[...this.queuedRRWebEvents];this.queuedRRWebEvents=[],e.forEach(n=>{Date.now()-n.enqueuedAt<=2e3&&this._tryRRWebMethod(n)})}}_maskUrl(e){var n=this.instance.config.session_recording;if(n.maskNetworkRequestFn){var r,i={url:e};return(r=i=n.maskNetworkRequestFn(i))===null||r===void 0?void 0:r.url}return e}clearBuffer(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}_flushBuffer(){this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var e=this.minimumDuration,n=this.sessionDuration,r=Jt(n)&&n>=0,i=Jt(e)&&r&&n<e;return this.status==="buffering"||this.status==="paused"||this.status==="disabled"||i?(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&jf(this.buffer).forEach(s=>{this._captureSnapshot({$snapshot_bytes:s.size,$snapshot_data:s.data,$session_id:s.sessionId,$window_id:s.windowId,$lib:"web",$lib_version:Sr.LIB_VERSION})}),this.clearBuffer())}_captureSnapshotBuffered(e){var n,r=2+(((n=this.buffer)===null||n===void 0?void 0:n.data.length)||0);!this.isIdle&&(this.buffer.size+e.$snapshot_bytes+r>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_captureSnapshot(e){this.instance.capture("$snapshot",e,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(M!==void 0&&M.location.href){var e=M.location.href,n=this._urlBlocked,r=Cy(e,this._urlBlocklist);r&&!n?this._pauseRecording():!r&&n&&this._resumeRecording(),Cy(e,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(e){var n,r;this.triggerStatus==="trigger_pending"&&((n=this.instance)===null||n===void 0||(r=n.persistence)===null||r===void 0||r.register({[e==="url"?bf:wf]:this.sessionId}),this._flushBuffer(),this._reportStarted(e+"_trigger_matched"))}_pauseRecording(){this._urlBlocked||(this._urlBlocked=!0,clearInterval(this._fullSnapshotTimer),Wt.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){this._urlBlocked&&(this._urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),Wt.info("recording resumed"))}_addEventTriggerListener(){this._eventTriggers.length!==0&&Ge(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",e=>{try{this._eventTriggers.includes(e.event)&&this._activateTrigger("event")}catch(n){Wt.error("Could not activate event trigger",n)}}))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;(e=this.instance.persistence)===null||e===void 0||e.register({[ya]:!0}),this._tryTakeFullSnapshot(),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_reportStarted(e,n){this.instance.register_for_session({$session_recording_start_reason:e}),Wt.info(e.replace("_"," "),n),$e(["recording_initialized","session_id_changed"],e)||this._tryAddCustomEvent(e,n)}}var Xf=Qt("[SegmentIntegration]");function xM(t,e){var n=t.config.segment;if(!n)return e();(function(r,i){var s=r.config.segment;if(!s)return i();var o=c=>{var u=()=>c.anonymousId()||ui();r.config.get_device_id=u,c.id()&&(r.register({distinct_id:c.id(),$device_id:u()}),r.persistence.set_property(Er,"identified")),i()},a=s.user();"then"in a&&Wn(a.then)?a.then(c=>o(c)):o(a)})(t,()=>{n.register((r=>{Promise&&Promise.resolve||Xf.warn("This browser does not have Promise support, and can not use the segment integration");var i=(s,o)=>{var a;if(!o)return s;s.event.userId||s.event.anonymousId===r.get_distinct_id()||(Xf.info("No userId set, resetting PostHog"),r.reset()),s.event.userId&&s.event.userId!==r.get_distinct_id()&&(Xf.info("UserId set, identifying with PostHog"),r.identify(s.event.userId));var c=r._calculate_event_properties(o,(a=s.event.properties)!==null&&a!==void 0?a:{},new Date);return s.event.properties=Object.assign({},c,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:s=>i(s,s.event.event),page:s=>i(s,"$pageview"),identify:s=>i(s,"$identify"),screen:s=>i(s,"$screen")}})(t)).then(()=>{e()})})}var Ty="posthog-js";function Iy(t){var{organization:e,projectId:n,prefix:r,severityAllowList:i=["error"]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return s=>{var o,a,c,u,d;if(!(i==="*"||i.includes(s.level))||!t.__loaded)return s;s.tags||(s.tags={});var l=t.requestRouter.endpointFor("ui","/project/".concat(t.config.token,"/person/").concat(t.get_distinct_id()));s.tags["PostHog Person URL"]=l,t.sessionRecordingStarted()&&(s.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var h=((o=s.exception)===null||o===void 0?void 0:o.values)||[],f=h.map(g=>D(D({},g),{},{stacktrace:g.stacktrace?D(D({},g.stacktrace),{},{type:"raw",frames:(g.stacktrace.frames||[]).map(v=>D(D({},v),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:((a=h[0])===null||a===void 0?void 0:a.value)||s.message,$exception_type:(c=h[0])===null||c===void 0?void 0:c.type,$exception_personURL:l,$exception_level:s.level,$exception_list:f,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:((u=h[0])===null||u===void 0?void 0:u.value)||s.message,$sentry_exception_type:(d=h[0])===null||d===void 0?void 0:d.type,$sentry_tags:s.tags};return e&&n&&(p.$sentry_url=(r||"https://sentry.io/organizations/")+e+"/issues/?project="+n+"&query="+s.event_id),t.exceptions.sendExceptionEvent(p),s}}class RM{constructor(e,n,r,i,s){this.name=Ty,this.setupOnce=function(o){o(Iy(e,{organization:n,projectId:r,prefix:i,severityAllowList:s}))}}}var Ir,AM=M!=null&&M.location?Su(M.location.hash,"__posthog")||Su(location.hash,"state"):null,xy="_postHogToolbarParams",Ry=Qt("[Toolbar]");(function(t){t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED"})(Ir||(Ir={}));class PM{constructor(e){this.instance=e}setToolbarState(e){Fe.ph_toolbar_state=e}getToolbarState(){var e;return(e=Fe.ph_toolbar_state)!==null&&e!==void 0?e:Ir.UNINITIALIZED}maybeLoadToolbar(){var e,n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!M||!ae)return!1;r=(e=r)!==null&&e!==void 0?e:M.location,s=(n=s)!==null&&n!==void 0?n:M.history;try{if(!i){try{M.localStorage.setItem("test","test"),M.localStorage.removeItem("test")}catch{return!1}i=M==null?void 0:M.localStorage}var o,a=AM||Su(r.hash,"__posthog")||Su(r.hash,"state"),c=a?S_(()=>JSON.parse(atob(decodeURIComponent(a))))||S_(()=>JSON.parse(decodeURIComponent(a))):null;return c&&c.action==="ph_authorize"?((o=c).source="url",o&&Object.keys(o).length>0&&(c.desiredHash?r.hash=c.desiredHash:s?s.replaceState(s.state,"",r.pathname+r.search):r.hash="")):((o=JSON.parse(i.getItem(xy)||"{}")).source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token)&&(this.loadToolbar(o),!0)}catch{return!1}}_callLoadToolbar(e){var n=Fe.ph_load_toolbar||Fe.ph_load_editor;!Ge(n)&&Wn(n)?n(e,this.instance):Ry.warn("No toolbar load function found")}loadToolbar(e){var n=!(ae==null||!ae.getElementById(F_));if(!M||n)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=D(D({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(M.localStorage.setItem(xy,JSON.stringify(D(D({},i),{},{source:void 0}))),this.getToolbarState()===Ir.LOADED)this._callLoadToolbar(i);else if(this.getToolbarState()===Ir.UNINITIALIZED){var s,o;this.setToolbarState(Ir.LOADING),(s=Fe.__PosthogExtensions__)===null||s===void 0||(o=s.loadExternalDependency)===null||o===void 0||o.call(s,this.instance,"toolbar",a=>{if(a)return Ry.error("[Toolbar] Failed to load",a),void this.setToolbarState(Ir.UNINITIALIZED);this.setToolbarState(Ir.LOADED),this._callLoadToolbar(i)}),gt(M,"turbolinks:load",()=>{this.setToolbarState(Ir.UNINITIALIZED),this.loadToolbar(i)})}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(e,n,r)}}var MM=Qt("[TracingHeaders]");class OM{constructor(e){B(this,"_restoreXHRPatch",void 0),B(this,"_restoreFetchPatch",void 0),B(this,"_startCapturing",()=>{var n,r,i,s;G(this._restoreXHRPatch)&&((n=Fe.__PosthogExtensions__)===null||n===void 0||(r=n.tracingHeadersPatchFns)===null||r===void 0||r._patchXHR(this.instance.sessionManager)),G(this._restoreFetchPatch)&&((i=Fe.__PosthogExtensions__)===null||i===void 0||(s=i.tracingHeadersPatchFns)===null||s===void 0||s._patchFetch(this.instance.sessionManager))}),this.instance=e}_loadScript(e){var n,r,i;(n=Fe.__PosthogExtensions__)!==null&&n!==void 0&&n.tracingHeadersPatchFns&&e(),(r=Fe.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"tracing-headers",s=>{if(s)return MM.error("failed to load script",s);e()})}startIfEnabledOrStop(){var e,n;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):((e=this._restoreXHRPatch)===null||e===void 0||e.call(this),(n=this._restoreFetchPatch)===null||n===void 0||n.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}var Vi=Qt("[Web Vitals]"),Ay=9e5;class LM{constructor(e){var n;B(this,"_enabledServerSide",!1),B(this,"_initialized",!1),B(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),B(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),this.buffer.metrics.length!==0&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce((r,i)=>D(D({},r),{},{["$web_vitals_".concat(i.name,"_event")]:D({},i),["$web_vitals_".concat(i.name,"_value")]:i.value}),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),B(this,"_addToBuffer",r=>{var i,s=(i=this.instance.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0);if(G(s))Vi.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this._currentURL();G(o)||(Ge(r==null?void 0:r.name)||Ge(r==null?void 0:r.value)?Vi.error("Invalid metric received",r):this._maxAllowedValue&&r.value>=this._maxAllowedValue?Vi.error("Ignoring metric with value >= "+this._maxAllowedValue,r):(this.buffer.url!==o&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),G(this.buffer.url)&&(this.buffer.url=o),this.buffer.firstMetricTimestamp=G(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(D(D({},r),{},{$current_url:o,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),B(this,"_startCapturing",()=>{var r,i,s,o,a=Fe.__PosthogExtensions__;G(a)||G(a.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:i,onFCP:s,onINP:o}=a.postHogWebVitalsCallbacks),r&&i&&s&&o?(this.allowedMetrics.indexOf("LCP")>-1&&r(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this._addToBuffer.bind(this)),this._initialized=!0):Vi.error("web vitals callbacks not loaded - not starting")}),this.instance=e,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[I_]),this.startIfEnabled()}get allowedMetrics(){var e,n,r=lt(this.instance.config.capture_performance)?(e=this.instance.config.capture_performance)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return G(r)?((n=this.instance.persistence)===null||n===void 0?void 0:n.props[R_])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(lt(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var e=lt(this.instance.config.capture_performance)&&Jt(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:Ay;return 0<e&&e<=6e4?Ay:e}get isEnabled(){var e=lt(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return oi(e)?e:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Vi.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(e){var n=lt(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=lt(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[I_]:n}),this.instance.persistence.register({[R_]:r})),this._enabledServerSide=n,this.startIfEnabled()}loadScript(e){var n,r,i;(n=Fe.__PosthogExtensions__)!==null&&n!==void 0&&n.postHogWebVitalsCallbacks&&e(),(r=Fe.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"web-vitals",s=>{s?Vi.error("failed to load script",s):e()})}_currentURL(){var e=M?M.location.href:void 0;return e||Vi.error("Could not determine current URL"),e}}var DM=Qt("[Heatmaps]");function Py(t){return lt(t)&&"clientX"in t&&"clientY"in t&&Jt(t.clientX)&&Jt(t.clientY)}class NM{constructor(e){var n;B(this,"rageclicks",new J_),B(this,"_enabledServerSide",!1),B(this,"_initialized",!1),B(this,"_flushInterval",null),this.instance=e,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[_f])}get flushIntervalMilliseconds(){var e=5e3;return lt(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return G(this.instance.config.capture_heatmaps)?G(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;DM.info("starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var e,n;clearInterval((e=this._flushInterval)!==null&&e!==void 0?e:void 0),(n=this.deadClicksCapture)===null||n===void 0||n.stop(),this.getAndClearBuffer()}}onRemoteConfig(e){var n=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[_f]:n}),this._enabledServerSide=n,this.startIfEnabled()}getAndClearBuffer(){var e=this.buffer;return this.buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_setupListeners(){M&&ae&&(gt(M,"beforeunload",this.flush.bind(this)),gt(ae,"click",e=>this._onClick(e||(M==null?void 0:M.event)),{capture:!0}),gt(ae,"mousemove",e=>this._onMouseMove(e||(M==null?void 0:M.event)),{capture:!0}),this.deadClicksCapture=new ry(this.instance,YP,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(e,n){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),o=function(a,c,u){for(var d=a;d&&_u(d)&&!ci(d,"body");){if(d===u)return!1;if($e(c,M==null?void 0:M.getComputedStyle(d).position))return!0;d=z_(d)}return!1}(W_(e),["fixed","sticky"],s);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:r),target_fixed:o,type:n}}_onClick(e){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"click";if(!U_(e.target)&&Py(e)){var i=this._getProperties(e,r);(n=this.rageclicks)!==null&&n!==void 0&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this._capture(D(D({},i),{},{type:"rageclick"})),this._capture(i)}}_onMouseMove(e){!U_(e.target)&&Py(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(e,"mousemove"))},500))}_capture(e){if(M){var n=M.location.href;this.buffer=this.buffer||{},this.buffer[n]||(this.buffer[n]=[]),this.buffer[n].push(e)}}flush(){this.buffer&&!Ls(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class FM{constructor(e){this._instance=e}doPageView(e,n){var r,i=this._previousPageViewProperties(e,n);return this._currentPageview={pathname:(r=M==null?void 0:M.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var n;return this._previousPageViewProperties(e,(n=this._currentPageview)===null||n===void 0?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this._currentPageview)===null||e===void 0?void 0:e.pageViewId}}_previousPageViewProperties(e,n){var r=this._currentPageview;if(!r)return{$pageview_id:n};var i={$pageview_id:n,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:c,maxContentHeight:u,lastContentY:d,maxContentY:l}=s;if(!(G(o)||G(a)||G(c)||G(u)||G(d)||G(l))){o=Math.ceil(o),a=Math.ceil(a),c=Math.ceil(c),u=Math.ceil(u),d=Math.ceil(d),l=Math.ceil(l);var h=o<=1?1:Tn(a/o,0,1),f=o<=1?1:Tn(c/o,0,1),p=u<=1?1:Tn(d/u,0,1),g=u<=1?1:Tn(l/u,0,1);i=kt(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:c,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:l,$prev_pageview_max_content_percentage:g})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}}class $M{constructor(e){this.instance=e}sendExceptionEvent(e){this.instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}var xn="Mobile",Lu="iOS",ar="Android",Ta="Tablet",My=ar+" "+Ta,Oy="iPad",Ly="Apple",Dy=Ly+" Watch",Ia="Safari",Bs="BlackBerry",Ny="Samsung",Fy=Ny+"Browser",$y=Ny+" Internet",Ki="Chrome",UM=Ki+" OS",Uy=Ki+" "+Lu,Jf="Internet Explorer",By=Jf+" "+xn,Qf="Opera",BM=Qf+" Mini",eh="Edge",jy="Microsoft "+eh,js="Firefox",Hy=js+" "+Lu,xa="Nintendo",Ra="PlayStation",Hs="Xbox",qy=ar+" "+xn,Wy=xn+" "+Ia,Aa="Windows",th=Aa+" Phone",zy="Nokia",nh="Ouya",Vy="Generic",jM=Vy+" "+xn.toLowerCase(),Ky=Vy+" "+Ta.toLowerCase(),rh="Konqueror",en="(\\d+(\\.\\d+)?)",ih=new RegExp("Version/"+en),HM=new RegExp(Hs,"i"),qM=new RegExp(Ra+" \\w+","i"),WM=new RegExp(xa+" \\w+","i"),sh=new RegExp(Bs+"|PlayBook|BB10","i"),zM={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},oh,VM=(t,e)=>e&&$e(e,Ly)||function(n){return $e(n,Ia)&&!$e(n,Ki)&&!$e(n,ar)}(t),Gy=function(t,e){return e=e||"",$e(t," OPR/")&&$e(t,"Mini")?BM:$e(t," OPR/")?Qf:sh.test(t)?Bs:$e(t,"IE"+xn)||$e(t,"WPDesktop")?By:$e(t,Fy)?$y:$e(t,eh)||$e(t,"Edg/")?jy:$e(t,"FBIOS")?"Facebook "+xn:$e(t,"UCWEB")||$e(t,"UCBrowser")?"UC Browser":$e(t,"CriOS")?Uy:$e(t,"CrMo")||$e(t,Ki)?Ki:$e(t,ar)&&$e(t,Ia)?qy:$e(t,"FxiOS")?Hy:$e(t.toLowerCase(),rh.toLowerCase())?rh:VM(t,e)?$e(t,xn)?Wy:Ia:$e(t,js)?js:$e(t,"MSIE")||$e(t,"Trident/")?Jf:$e(t,"Gecko")?js:""},KM={[By]:[new RegExp("rv:"+en)],[jy]:[new RegExp(eh+"?\\/"+en)],[Ki]:[new RegExp("("+Ki+"|CrMo)\\/"+en)],[Uy]:[new RegExp("CriOS\\/"+en)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+en)],[Ia]:[ih],[Wy]:[ih],[Qf]:[new RegExp("(Opera|OPR)\\/"+en)],[js]:[new RegExp(js+"\\/"+en)],[Hy]:[new RegExp("FxiOS\\/"+en)],[rh]:[new RegExp("Konqueror[:/]?"+en,"i")],[Bs]:[new RegExp(Bs+" "+en),ih],[qy]:[new RegExp("android\\s"+en,"i")],[$y]:[new RegExp(Fy+"\\/"+en)],[Jf]:[new RegExp("(rv:|MSIE )"+en)],Mozilla:[new RegExp("rv:"+en)]},Yy=[[new RegExp(Hs+"; "+Hs+" (.*?)[);]","i"),t=>[Hs,t&&t[1]||""]],[new RegExp(xa,"i"),[xa,""]],[new RegExp(Ra,"i"),[Ra,""]],[sh,[Bs,""]],[new RegExp(Aa,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[th,""];if(new RegExp(xn).test(e)&&!/IEMobile\b/.test(e))return[Aa+" "+xn,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=n[1],i=zM[r]||"";return/arm/i.test(e)&&(i="RT"),[Aa,i]}return[Aa,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var e=[t[3],t[4],t[5]||"0"];return[Lu,e.join(".")]}return[Lu,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=G(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+ar+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ar+")","i"),t=>{if(t&&t[2]){var e=[t[2],t[3],t[4]||"0"];return[ar,e.join(".")]}return[ar,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];if(t&&t[1]){var n=[t[1],t[2],t[3]||"0"];e[1]=n.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[UM,""]],[/Linux|debian/i,["Linux",""]]],Zy=function(t){return WM.test(t)?xa:qM.test(t)?Ra:HM.test(t)?Hs:new RegExp(nh,"i").test(t)?nh:new RegExp("("+th+"|WPDesktop)","i").test(t)?th:/iPad/.test(t)?Oy:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Dy:sh.test(t)?Bs:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(zy,"i").test(t)?zy:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?!new RegExp(xn).test(t)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)?/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?ar:My:ar:new RegExp("(pda|"+xn+")","i").test(t)?jM:new RegExp(Ta,"i").test(t)&&!new RegExp(Ta+" pc","i").test(t)?Ky:""},Du="https?://(.*)",Nu=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],GM=du(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Nu),ah="<masked>",it={campaignParams:function(){var{customTrackedParams:t,maskPersonalDataProperties:e,customPersonalDataProperties:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!ae)return{};var r=e?du([],Nu,n||[]):[];return this._campaignParamsFromUrl(Mf(ae.URL,r,ah),t)},_campaignParamsFromUrl:function(t,e){var n=GM.concat(e||[]),r={};return Ye(n,function(i){var s=wu(t,i);r[i]=s||null}),r},_searchEngine:function(t){return t?t.search(Du+"google.([^/?]*)")===0?"google":t.search(Du+"bing.com")===0?"bing":t.search(Du+"yahoo.com")===0?"yahoo":t.search(Du+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(t){var e=it._searchEngine(t),n=e!="yahoo"?"q":"p",r={};if(!si(e)){r.$search_engine=e;var i=ae?wu(ae.referrer,n):"";i.length&&(r.ph_keyword=i)}return r},searchInfo:function(){var t=ae==null?void 0:ae.referrer;return t?this._searchInfoFromReferrer(t):{}},browser:Gy,browserVersion:function(t,e){var n=Gy(t,e),r=KM[n];if(G(r))return null;for(var i=0;i<r.length;i++){var s=r[i],o=t.match(s);if(o)return parseFloat(o[o.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},browserLanguagePrefix:function(){var t=this.browserLanguage();return typeof t=="string"?t.split("-")[0]:void 0},os:function(t){for(var e=0;e<Yy.length;e++){var[n,r]=Yy[e],i=n.exec(t),s=i&&(Wn(r)?r(i,t):r);if(s)return s}return["",""]},device:Zy,deviceType:function(t){var e=Zy(t);return e===Oy||e===My||e==="Kobo"||e==="Kindle Fire"||e===Ky?Ta:e===xa||e===Hs||e===Ra||e===nh?"Console":e===Dy?"Wearable":e?xn:"Desktop"},referrer:function(){return(ae==null?void 0:ae.referrer)||"$direct"},referringDomain:function(){var t;return ae!=null&&ae.referrer&&((t=Fs(ae.referrer))===null||t===void 0?void 0:t.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},personInfo:function(){var{maskPersonalDataProperties:t,customPersonalDataProperties:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t?du([],Nu,e||[]):[],r=Cn==null?void 0:Cn.href.substring(0,1e3);return{r:this.referrer().substring(0,1e3),u:r?Mf(r,n,ah):void 0}},personPropsFromInfo:function(t){var e,{r:n,u:r}=t,i={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(e=Fs(n))===null||e===void 0?void 0:e.host};if(r){i.$current_url=r;var s=Fs(r);i.$host=s==null?void 0:s.host,i.$pathname=s==null?void 0:s.pathname;var o=this._campaignParamsFromUrl(r);kt(i,o)}if(n){var a=this._searchInfoFromReferrer(n);kt(i,a)}return i},initialPersonPropsFromInfo:function(t){var e=this.personPropsFromInfo(t),n={};return Ye(e,function(r,i){n["$initial_".concat(mf(i))]=r}),n},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}},timezoneOffset:function(){try{return new Date().getTimezoneOffset()}catch{return}},properties:function(){var{maskPersonalDataProperties:t,customPersonalDataProperties:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!St)return{};var n=t?du([],Nu,e||[]):[],[r,i]=it.os(St);return kt(ma({$os:r,$os_version:i,$browser:it.browser(St,navigator.vendor),$device:it.device(St),$device_type:it.deviceType(St),$timezone:it.timezone(),$timezone_offset:it.timezoneOffset()}),{$current_url:Mf(Cn==null?void 0:Cn.href,n,ah),$host:Cn==null?void 0:Cn.host,$pathname:Cn==null?void 0:Cn.pathname,$raw_user_agent:St.length>1e3?St.substring(0,997)+"...":St,$browser_version:it.browserVersion(St,navigator.vendor),$browser_language:it.browserLanguage(),$browser_language_prefix:it.browserLanguagePrefix(),$screen_height:M==null?void 0:M.screen.height,$screen_width:M==null?void 0:M.screen.width,$viewport_height:M==null?void 0:M.innerHeight,$viewport_width:M==null?void 0:M.innerWidth,$lib:"web",$lib_version:Sr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!St)return{};var[t,e]=it.os(St);return kt(ma({$os:t,$os_version:e,$browser:it.browser(St,navigator.vendor)}),{$browser_version:it.browserVersion(St,navigator.vendor)})}},cr=Qt("[FeatureFlags]"),ch="$active_feature_flags",qs="$override_feature_flags",Xy="$feature_flag_payloads",Pa="$override_feature_flag_payloads",Jy="$feature_flag_request_id",Qy=t=>{var e={};for(var[n,r]of fu(t||{}))r&&(e[n]=r);return e},YM=t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map(n=>{var r;return[n,(r=e[n].variant)!==null&&r!==void 0?r:e[n].enabled]})),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(n=>e[n].enabled).filter(n=>{var r;return(r=e[n].metadata)===null||r===void 0?void 0:r.payload}).map(n=>{var r;return[n,(r=e[n].metadata)===null||r===void 0?void 0:r.payload]}))):cr.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t};(function(t){t.FeatureFlags="feature_flags",t.Recordings="recordings"})(oh||(oh={}));class ZM{constructor(e){B(this,"_override_warning",!1),B(this,"_hasLoadedFlags",!1),B(this,"_requestInFlight",!1),B(this,"_reloadingDisabled",!1),B(this,"_additionalReloadRequested",!1),B(this,"_decideCalled",!1),B(this,"_flagsLoadedFromRemote",!1),this.instance=e,this.featureFlagEventHandlers=[]}decide(){if(this.instance.config.__preview_remote_config)this._decideCalled=!0;else{var e=!this._reloadDebouncer&&(this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load);this._callDecideEndpoint({disableFlags:e})}}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.instance.get_property(Sf),n=this.instance.get_property(qs),r=this.instance.get_property(Pa);if(!r&&!n)return e||{};var i=kt({},e||{}),s=[...new Set([...Object.keys(r||{}),...Object.keys(n||{})])];for(var o of s){var a,c,u=i[o],d=n==null?void 0:n[o],l=G(d)?(a=u==null?void 0:u.enabled)!==null&&a!==void 0&&a:!!d,h=G(d)?u.variant:typeof d=="string"?d:void 0,f=r==null?void 0:r[o],p=D(D({},u),{},{enabled:l,variant:l?h??(u==null?void 0:u.variant):void 0});l!==(u==null?void 0:u.enabled)&&(p.original_enabled=u==null?void 0:u.enabled),h!==(u==null?void 0:u.variant)&&(p.original_variant=u==null?void 0:u.variant),f&&(p.metadata=D(D({},u==null?void 0:u.metadata),{},{payload:f,original_payload:u==null||(c=u.metadata)===null||c===void 0?void 0:c.payload})),i[o]=p}return this._override_warning||(cr.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this._override_warning=!0),i}getFlagVariants(){var e=this.instance.get_property(Ds),n=this.instance.get_property(qs);if(!n)return e||{};for(var r=kt({},e),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this._override_warning||(cr.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:n,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){var e=this.instance.get_property(Xy),n=this.instance.get_property(Pa);if(!n)return e||{};for(var r=kt({},e||{}),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this._override_warning||(cr.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:n,finalPayloads:r}),this._override_warning=!0),r}reloadFeatureFlags(){this._reloadingDisabled||this.instance.config.advanced_disable_feature_flags||this._reloadDebouncer||(this._reloadDebouncer=setTimeout(()=>{this._callDecideEndpoint()},5))}clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}_callDecideEndpoint(e){var n;if(this.clearDebouncer(),!this.instance.config.advanced_disable_decide)if(this._requestInFlight)this._additionalReloadRequested=!0;else{var r={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:D(D({},((n=this.instance.persistence)===null||n===void 0?void 0:n.get_initial_props())||{}),this.instance.get_property(ba)||{}),group_properties:this.instance.get_property(ji)};(e!=null&&e.disableFlags||this.instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0);var i=this.instance.config.__preview_flags_v2&&this.instance.config.__preview_remote_config;i&&(r.timezone=it.timezone()),this._requestInFlight=!0,this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api",i?"/flags/?v=2":"/decide/?v=4"),data:r,compression:this.instance.config.disable_compression?void 0:qn.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:s=>{var o,a,c,u=!0;s.statusCode===200&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),u=!1),this._requestInFlight=!1,this._decideCalled||(this._decideCalled=!0,this.instance._onRemoteConfig((c=s.json)!==null&&c!==void 0?c:{})),r.disable_flags&&!this._additionalReloadRequested||(this._flagsLoadedFromRemote=!u,s.json&&(o=s.json.quotaLimited)!==null&&o!==void 0&&o.includes(oh.FeatureFlags)?cr.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(this.receivedFeatureFlags((a=s.json)!==null&&a!==void 0?a:{},u),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callDecideEndpoint())))}})}}getFeatureFlag(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var r=this.getFlagVariants()[e],i="".concat(r),s=this.instance.get_property(Jy)||void 0,o=this.instance.get_property(mu)||{};if((n.send_event||!("send_event"in n))&&(!(e in o)||!o[e].includes(i))){var a,c,u,d,l,h,f,p,g,v,m;ut(o[e])?o[e].push(i):o[e]=[i],(a=this.instance.persistence)===null||a===void 0||a.register({[mu]:o});var _=this.getFeatureFlagDetails(e),w={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:s,$feature_flag_bootstrapped_response:((c=this.instance.config.bootstrap)===null||c===void 0||(u=c.featureFlags)===null||u===void 0?void 0:u[e])||null,$feature_flag_bootstrapped_payload:((d=this.instance.config.bootstrap)===null||d===void 0||(l=d.featureFlagPayloads)===null||l===void 0?void 0:l[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};G(_==null||(h=_.metadata)===null||h===void 0?void 0:h.version)||(w.$feature_flag_version=_.metadata.version);var T,C=(f=_==null||(p=_.reason)===null||p===void 0?void 0:p.description)!==null&&f!==void 0?f:_==null||(g=_.reason)===null||g===void 0?void 0:g.code;C&&(w.$feature_flag_reason=C),_!=null&&(v=_.metadata)!==null&&v!==void 0&&v.id&&(w.$feature_flag_id=_.metadata.id),G(_==null?void 0:_.original_variant)&&G(_==null?void 0:_.original_enabled)||(w.$feature_flag_original_response=G(_.original_variant)?_.original_enabled:_.original_variant),_!=null&&(m=_.metadata)!==null&&m!==void 0&&m.original_payload&&(w.$feature_flag_original_payload=_==null||(T=_.metadata)===null||T===void 0?void 0:T.original_payload),this.instance.capture("$feature_flag_called",w)}return r}cr.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,n){var r=this.instance.config.token;this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=4"),data:{distinct_id:this.instance.get_distinct_id(),token:r},compression:this.instance.config.disable_compression?void 0:qn.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:i=>{var s,o=(s=i.json)===null||s===void 0?void 0:s.featureFlagPayloads;n((o==null?void 0:o[e])||void 0)}})}isFeatureEnabled(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,n);cr.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(n=>n!==e)}receivedFeatureFlags(e,n){if(this.instance.persistence){this._hasLoadedFlags=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{},l=YM(o),h=l.flags,f=l.featureFlags,p=l.featureFlagPayloads;if(f){var g=o.requestId;if(ut(f)){cr.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(f)for(var m=0;m<f.length;m++)v[f[m]]=!0;a&&a.register({[ch]:f,[Ds]:v})}else{var _=f,w=p,T=h;o.errorsWhileComputingFlags&&(_=D(D({},c),_),w=D(D({},u),w),T=D(D({},d),T)),a&&a.register(D({[ch]:Object.keys(Qy(_)),[Ds]:_||{},[Xy]:w||{},[Sf]:T||{}},g?{[Jy]:g}:{}))}}})(e,this.instance.persistence,r,i,s),this._fireFeatureFlagsCallbacks(n)}}override(e){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];cr.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:n})}overrideFeatureFlags(e){if(!this.instance.__loaded||!this.instance.persistence)return cr.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.instance.persistence.unregister(qs),this.instance.persistence.unregister(Pa),void this._fireFeatureFlagsCallbacks();if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,r=e;if(this._override_warning=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.instance.persistence.unregister(qs);else if(r.flags)if(ut(r.flags)){for(var i={},s=0;s<r.flags.length;s++)i[r.flags[s]]=!0;this.instance.persistence.register({[qs]:i})}else this.instance.persistence.register({[qs]:r.flags})}return"payloads"in r&&(r.payloads===!1?this.instance.persistence.unregister(Pa):r.payloads&&this.instance.persistence.register({[Pa]:r.payloads})),void this._fireFeatureFlagsCallbacks()}this._fireFeatureFlagsCallbacks()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var{flags:n,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();e(n,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,n){var r,i=(this.instance.get_property(pu)||[]).find(c=>c.flagKey===e),s={["$feature_enrollment/".concat(e)]:n},o={$feature_flag:e,$feature_enrollment:n,$set:s};i&&(o.$early_access_feature_name=i.name),this.instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(s,!1);var a=D(D({},this.getFlagVariants()),{},{[e]:n});(r=this.instance.persistence)===null||r===void 0||r.register({[ch]:Object.keys(Qy(a)),[Ds]:a}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],r=arguments.length>2?arguments[2]:void 0,i=this.instance.get_property(pu),s=r?"&".concat(r.map(o=>"stage=".concat(o)).join("&")):"";if(i&&!n)return e(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token).concat(s)),method:"GET",callback:o=>{var a;if(o.json){var c=o.json.earlyAccessFeatures;return(a=this.instance.persistence)===null||a===void 0||a.register({[pu]:c}),e(c)}}})}_prepareFeatureFlagsForCallbacks(){var e=this.getFlags(),n=this.getFlagVariants();return{flags:e.filter(r=>n[r]),flagVariants:Object.keys(n).filter(r=>n[r]).reduce((r,i)=>(r[i]=n[i],r),{})}}_fireFeatureFlagsCallbacks(e){var{flags:n,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(i=>i(n,r,{errorsLoading:e}))}setPersonPropertiesForFlags(e){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(ba)||{};this.instance.register({[ba]:D(D({},r),e)}),n&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(ba)}setGroupPropertiesForFlags(e){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(ji)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(i=>{r[i]=D(D({},r[i]),e[i]),delete e[i]}),this.instance.register({[ji]:D(D({},r),e)}),n&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var n=this.instance.get_property(ji)||{};this.instance.register({[ji]:D(D({},n),{},{[e]:{}})})}else this.instance.unregister(ji)}}var XM=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class uh{constructor(e){this.config=e,this.props={},this.campaign_params_saved=!1,this.name=(n=>{var r="";return n.token&&(r=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+r+"_posthog"})(e),this.storage=this.buildStorage(e),this.load(),e.debug&&se.info("Persistence loaded",e.persistence,D({},this.props)),this.update_config(e,e),this.save()}buildStorage(e){XM.indexOf(e.persistence.toLowerCase())===-1&&(se.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n=e.persistence.toLowerCase();return n==="localstorage"&&Tt.is_supported()?Tt:n==="localstorage+cookie"&&ku.is_supported()?ku:n==="sessionstorage"&&Nt.is_supported()?Nt:n==="memory"?KP:n==="cookie"?kr:ku.is_supported()?ku:kr}properties(){var e={};return Ye(this.props,function(n,r){if(r===Ds&<(n))for(var i=Object.keys(n),s=0;s<i.length;s++)e["$feature/".concat(i[s])]=n[i[s]];else a=r,c=!1,(si(o=TP)?c:v_&&o.indexOf===v_?o.indexOf(a)!=-1:(Ye(o,function(u){if(c||(c=u===a))return lu}),c))||(e[r]=n);var o,a,c}),e}load(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=kt({},e))}}save(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}remove(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}clear(){this.remove(),this.props={}}register_once(e,n,r){if(lt(e)){G(n)&&(n="None"),this.expire_days=G(r)?this.default_expiry:r;var i=!1;if(Ye(e,(s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==n||(this.props[o]=s,i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(lt(e)){this.expire_days=G(n)?this.default_expiry:n;var r=!1;if(Ye(e,(i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.props[s]=i,r=!0)}),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.campaign_params_saved){var e=it.campaignParams({customTrackedParams:this.config.custom_campaign_params,maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});Ls(ma(e))||this.register(e),this.campaign_params_saved=!0}}update_search_keyword(){this.register(it.searchInfo())}update_referrer_info(){this.register_once(it.referrerInfo(),void 0)}set_initial_person_info(){this.props[Tf]||this.props[If]||this.register_once({[xf]:it.personInfo({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties})},void 0)}get_referrer_info(){return ma({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var e={};Ye([If,Tf],i=>{var s=this.props[i];s&&Ye(s,function(o,a){e["$initial_"+mf(a)]=o})});var n=this.props[xf];if(n){var r=it.initialPersonPropsFromInfo(n);kt(e,r)}return e}safe_merge(e){return Ye(this.props,function(n,r){r in e||(e[r]=n)}),e}update_config(e,n){if(this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==n.persistence){var r=this.buildStorage(e),i=this.props;this.clear(),this.storage=r,this.props=i,this.save()}}set_disabled(e){this.disabled=e,this.disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}set_event_timer(e,n){var r=this.props[_a]||{};r[e]=n,this.props[_a]=r,this.save()}remove_event_timer(e){var n=(this.props[_a]||{})[e];return G(n)||(delete this.props[_a][e],this.save()),n}get_property(e){return this.props[e]}set_property(e,n){this.props[e]=n,this.save()}}var eb,dt,tb,Gi,nb,rb,lh,ib,sb,ob,ab,cb,dh={},ub=[],JM=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,fh=Array.isArray;function di(t,e){for(var n in e)t[n]=e[n];return t}function lb(t){var e=t.parentNode;e&&e.removeChild(t)}function hh(t,e,n,r,i){var s={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i??++tb,__i:-1,__u:0};return i==null&&dt.vnode!=null&&dt.vnode(s),s}function ph(t){return t.children}function Fu(t,e){this.props=t,this.context=e}function Ws(t,e){if(e==null)return t.__?Ws(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?Ws(t):null}function db(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return db(t)}}function gh(t){(!t.__d&&(t.__d=!0)&&Gi.push(t)&&!$u.__r++||nb!==dt.debounceRendering)&&((nb=dt.debounceRendering)||rb)($u)}function $u(){var t,e,n,r,i,s,o,a,c;for(Gi.sort(lh);t=Gi.shift();)t.__d&&(e=Gi.length,r=void 0,s=(i=(n=t).__v).__e,a=[],c=[],(o=n.__P)&&((r=di({},i)).__v=i.__v+1,dt.vnode&&dt.vnode(r),vb(o,r,i,n.__n,o.ownerSVGElement!==void 0,32&i.__u?[s]:null,a,s??Ws(i),!!(32&i.__u),c),r.__.__k[r.__i]=r,tO(a,r,c),r.__e!=s&&db(r)),Gi.length>e&&Gi.sort(lh));$u.__r=0}function fb(t,e,n,r,i,s,o,a,c,u,d){var l,h,f,p,g,v=r&&r.__k||ub,m=e.length;for(n.__d=c,QM(n,e,v),c=n.__d,l=0;l<m;l++)(f=n.__k[l])!=null&&typeof f!="boolean"&&typeof f!="function"&&(h=f.__i===-1?dh:v[f.__i]||dh,f.__i=l,vb(t,f,h,i,s,o,a,c,u,d),p=f.__e,f.ref&&h.ref!=f.ref&&(h.ref&&mh(h.ref,null,f),d.push(f.ref,f.__c||p,f)),g==null&&p!=null&&(g=p),65536&f.__u||h.__k===f.__k?c=hb(f,c,t):typeof f.type=="function"&&f.__d!==void 0?c=f.__d:p&&(c=p.nextSibling),f.__d=void 0,f.__u&=-196609);n.__d=c,n.__e=g}function QM(t,e,n){var r,i,s,o,a,c=e.length,u=n.length,d=u,l=0;for(t.__k=[],r=0;r<c;r++)(i=t.__k[r]=(i=e[r])==null||typeof i=="boolean"||typeof i=="function"?null:typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?hh(null,i,null,null,i):fh(i)?hh(ph,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?hh(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)!=null?(i.__=t,i.__b=t.__b+1,a=eO(i,n,o=r+l,d),i.__i=a,s=null,a!==-1&&(d--,(s=n[a])&&(s.__u|=131072)),s==null||s.__v===null?(a==-1&&l--,typeof i.type!="function"&&(i.__u|=65536)):a!==o&&(a===o+1?l++:a>o?d>c-o?l+=a-o:l--:l=a<o&&a==o-1?a-o:0,a!==r+l&&(i.__u|=65536))):(s=n[r])&&s.key==null&&s.__e&&(s.__e==t.__d&&(t.__d=Ws(s)),vh(s,s,!1),n[r]=null,d--);if(d)for(r=0;r<u;r++)(s=n[r])!=null&&(131072&s.__u)==0&&(s.__e==t.__d&&(t.__d=Ws(s)),vh(s,s))}function hb(t,e,n){var r,i;if(typeof t.type=="function"){for(r=t.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=t,e=hb(r[i],e,n));return e}return t.__e!=e&&(n.insertBefore(t.__e,e||null),e=t.__e),e&&e.nextSibling}function eO(t,e,n,r){var i=t.key,s=t.type,o=n-1,a=n+1,c=e[n];if(c===null||c&&i==c.key&&s===c.type)return n;if(r>(c!=null&&(131072&c.__u)==0?1:0))for(;o>=0||a<e.length;){if(o>=0){if((c=e[o])&&(131072&c.__u)==0&&i==c.key&&s===c.type)return o;o--}if(a<e.length){if((c=e[a])&&(131072&c.__u)==0&&i==c.key&&s===c.type)return a;a++}}return-1}function pb(t,e,n){e[0]==="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||JM.test(e)?n:n+"px"}function Uu(t,e,n,r,i){var s;e:if(e==="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||pb(t.style,e,"");if(n)for(e in n)r&&n[e]===r[e]||pb(t.style,e,n[e])}else if(e[0]==="o"&&e[1]==="n")s=e!==(e=e.replace(/(PointerCapture)$|Capture$/,"$1")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=n,n?r?n.u=r.u:(n.u=Date.now(),t.addEventListener(e,s?mb:gb,s)):t.removeEventListener(e,s?mb:gb,s);else{if(i)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="width"&&e!=="height"&&e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e!=="rowSpan"&&e!=="colSpan"&&e!=="role"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!=="-"?t.removeAttribute(e):t.setAttribute(e,n))}}function gb(t){var e=this.l[t.type+!1];if(t.t){if(t.t<=e.u)return}else t.t=Date.now();return e(dt.event?dt.event(t):t)}function mb(t){return this.l[t.type+!0](dt.event?dt.event(t):t)}function vb(t,e,n,r,i,s,o,a,c,u){var d,l,h,f,p,g,v,m,_,w,T,C,E,I,y,b=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),s=[a=e.__e=n.__e]),(d=dt.__b)&&d(e);e:if(typeof b=="function")try{if(m=e.props,_=(d=b.contextType)&&r[d.__c],w=d?_?_.props.value:d.__:r,n.__c?v=(l=e.__c=n.__c).__=l.__E:("prototype"in b&&b.prototype.render?e.__c=l=new b(m,w):(e.__c=l=new Fu(m,w),l.constructor=b,l.render=rO),_&&_.sub(l),l.props=m,l.state||(l.state={}),l.context=w,l.__n=r,h=l.__d=!0,l.__h=[],l._sb=[]),l.__s==null&&(l.__s=l.state),b.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=di({},l.__s)),di(l.__s,b.getDerivedStateFromProps(m,l.__s))),f=l.props,p=l.state,l.__v=e,h)b.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(b.getDerivedStateFromProps==null&&m!==f&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(m,w),!l.__e&&(l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(m,l.__s,w)===!1||e.__v===n.__v)){for(e.__v!==n.__v&&(l.props=m,l.state=l.__s,l.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.forEach(function(k){k&&(k.__=e)}),T=0;T<l._sb.length;T++)l.__h.push(l._sb[T]);l._sb=[],l.__h.length&&o.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(m,l.__s,w),l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(f,p,g)})}if(l.context=w,l.props=m,l.__P=t,l.__e=!1,C=dt.__r,E=0,"prototype"in b&&b.prototype.render){for(l.state=l.__s,l.__d=!1,C&&C(e),d=l.render(l.props,l.state,l.context),I=0;I<l._sb.length;I++)l.__h.push(l._sb[I]);l._sb=[]}else do l.__d=!1,C&&C(e),d=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++E<25);l.state=l.__s,l.getChildContext!=null&&(r=di(di({},r),l.getChildContext())),h||l.getSnapshotBeforeUpdate==null||(g=l.getSnapshotBeforeUpdate(f,p)),fb(t,fh(y=d!=null&&d.type===ph&&d.key==null?d.props.children:d)?y:[y],e,n,r,i,s,o,a,c,u),l.base=e.__e,e.__u&=-161,l.__h.length&&o.push(l),v&&(l.__E=l.__=null)}catch(k){e.__v=null,c||s!=null?(e.__e=a,e.__u|=c?160:32,s[s.indexOf(a)]=null):(e.__e=n.__e,e.__k=n.__k),dt.__e(k,e,n)}else s==null&&e.__v===n.__v?(e.__k=n.__k,e.__e=n.__e):e.__e=nO(n.__e,e,n,r,i,s,o,c,u);(d=dt.diffed)&&d(e)}function tO(t,e,n){e.__d=void 0;for(var r=0;r<n.length;r++)mh(n[r],n[++r],n[++r]);dt.__c&&dt.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(s){s.call(i)})}catch(s){dt.__e(s,i.__v)}})}function nO(t,e,n,r,i,s,o,a,c){var u,d,l,h,f,p,g,v=n.props,m=e.props,_=e.type;if(_==="svg"&&(i=!0),s!=null){for(u=0;u<s.length;u++)if((f=s[u])&&"setAttribute"in f==!!_&&(_?f.localName===_:f.nodeType===3)){t=f,s[u]=null;break}}if(t==null){if(_===null)return document.createTextNode(m);t=i?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,m.is&&m),s=null,a=!1}if(_===null)v===m||a&&t.data===m||(t.data=m);else{if(s=s&&eb.call(t.childNodes),v=n.props||dh,!a&&s!=null)for(v={},u=0;u<t.attributes.length;u++)v[(f=t.attributes[u]).name]=f.value;for(u in v)f=v[u],u=="children"||(u=="dangerouslySetInnerHTML"?l=f:u==="key"||u in m||Uu(t,u,null,f,i));for(u in m)f=m[u],u=="children"?h=f:u=="dangerouslySetInnerHTML"?d=f:u=="value"?p=f:u=="checked"?g=f:u==="key"||a&&typeof f!="function"||v[u]===f||Uu(t,u,f,v[u],i);if(d)a||l&&(d.__html===l.__html||d.__html===t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(l&&(t.innerHTML=""),fb(t,fh(h)?h:[h],e,n,r,i&&_!=="foreignObject",s,o,s?s[0]:n.__k&&Ws(n,0),a,c),s!=null)for(u=s.length;u--;)s[u]!=null&&lb(s[u]);a||(u="value",p!==void 0&&(p!==t[u]||_==="progress"&&!p||_==="option"&&p!==v[u])&&Uu(t,u,p,v[u],!1),u="checked",g!==void 0&&g!==t[u]&&Uu(t,u,g,v[u],!1))}return t}function mh(t,e,n){try{typeof t=="function"?t(e):t.current=e}catch(r){dt.__e(r,n)}}function vh(t,e,n){var r,i;if(dt.unmount&&dt.unmount(t),(r=t.ref)&&(r.current&&r.current!==t.__e||mh(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){dt.__e(s,e)}r.base=r.__P=null,t.__c=void 0}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&vh(r[i],e,n||typeof t.type!="function");n||t.__e==null||lb(t.__e),t.__=t.__e=t.__d=void 0}function rO(t,e,n){return this.constructor(t,n)}eb=ub.slice,dt={__e:function(t,e,n,r){for(var i,s,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(t)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,r||{}),o=i.__d),o)return i.__E=i}catch(a){t=a}throw t}},tb=0,Fu.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=di({},this.state),typeof t=="function"&&(t=t(di({},n),this.props)),t&&di(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),gh(this))},Fu.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),gh(this))},Fu.prototype.render=ph,Gi=[],rb=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,lh=function(t,e){return t.__v.__b-e.__v.__b},$u.__r=0,ib=0,function(t){t.Popover="popover",t.API="api",t.Widget="widget"}(sb||(sb={})),function(t){t.Open="open",t.MultipleChoice="multiple_choice",t.SingleChoice="single_choice",t.Rating="rating",t.Link="link"}(ob||(ob={})),function(t){t.NextQuestion="next_question",t.End="end",t.ResponseBased="response_based",t.SpecificQuestion="specific_question"}(ab||(ab={})),function(t){t.Once="once",t.Recurring="recurring",t.Always="always"}(cb||(cb={})),function(t,e){var n={__c:e="__cC"+ib++,__:t,Consumer:function(r,i){return r.children(i)},Provider:function(r){var i,s;return this.getChildContext||(i=[],(s={})[e]=this,this.getChildContext=function(){return s},this.shouldComponentUpdate=function(o){this.props.value!==o.value&&i.some(function(a){a.__e=!0,gh(a)})},this.sub=function(o){i.push(o);var a=o.componentWillUnmount;o.componentWillUnmount=function(){i.splice(i.indexOf(o),1),a&&a.call(o)}}),r.children}};n.Provider.__=n.Consumer.contextType=n}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed:()=>{},isPopup:!0,onPreviewSubmit:()=>{}});var zs=function(t,e){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};class _b{constructor(){B(this,"events",{}),this.events={}}on(e,n){return this.events[e]||(this.events[e]=[]),this.events[e].push(n),()=>{this.events[e]=this.events[e].filter(r=>r!==n)}}emit(e,n){for(var r of this.events[e]||[])r(n);for(var i of this.events["*"]||[])i(e,n)}}class Yi{constructor(e){B(this,"_debugEventEmitter",new _b),B(this,"checkStep",(n,r)=>this.checkStepEvent(n,r)&&this.checkStepUrl(n,r)&&this.checkStepElement(n,r)),B(this,"checkStepEvent",(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event)),this.instance=e,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var e;if(!G((e=this.instance)===null||e===void 0?void 0:e._addCaptureHook)){var n;(n=this.instance)===null||n===void 0||n._addCaptureHook((r,i)=>{this.on(r,i)})}}register(e){var n,r;if(!G((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)&&(e.forEach(o=>{var a,c;(a=this.actionRegistry)===null||a===void 0||a.add(o),(c=o.steps)===null||c===void 0||c.forEach(u=>{var d;(d=this.actionEvents)===null||d===void 0||d.add((u==null?void 0:u.event)||"")})}),(r=this.instance)!==null&&r!==void 0&&r.autocapture)){var i,s=new Set;e.forEach(o=>{var a;(a=o.steps)===null||a===void 0||a.forEach(c=>{c!=null&&c.selector&&s.add(c==null?void 0:c.selector)})}),(i=this.instance)===null||i===void 0||i.autocapture.setElementSelectors(s)}}on(e,n){var r;n!=null&&e.length!=0&&(this.actionEvents.has(e)||this.actionEvents.has(n==null?void 0:n.event))&&this.actionRegistry&&((r=this.actionRegistry)===null||r===void 0?void 0:r.size)>0&&this.actionRegistry.forEach(i=>{this.checkAction(n,i)&&this._debugEventEmitter.emit("actionCaptured",i.name)})}_addActionHook(e){this.onAction("actionCaptured",n=>e(n))}checkAction(e,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.checkStep(e,r))return!0;return!1}onAction(e,n){return this._debugEventEmitter.on(e,n)}checkStepUrl(e,n){if(n!=null&&n.url){var r,i=e==null||(r=e.properties)===null||r===void 0?void 0:r.$current_url;if(!i||typeof i!="string"||!Yi.matchString(i,n==null?void 0:n.url,(n==null?void 0:n.url_matching)||"contains"))return!1}return!0}static matchString(e,n,r){switch(r){case"regex":return!!M&&zs(e,n);case"exact":return n===e;case"contains":var i=Yi.escapeStringRegexp(n).replace(/_/g,".").replace(/%/g,".*");return zs(e,i);default:return!1}}static escapeStringRegexp(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(e,n){if((n!=null&&n.href||n!=null&&n.tag_name||n!=null&&n.text)&&!this.getElementsList(e).some(s=>!(n!=null&&n.href&&!Yi.matchString(s.href||"",n==null?void 0:n.href,(n==null?void 0:n.href_matching)||"exact"))&&(n==null||!n.tag_name||s.tag_name===(n==null?void 0:n.tag_name))&&!(n!=null&&n.text&&!Yi.matchString(s.text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact")&&!Yi.matchString(s.$el_text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact"))))return!1;if(n!=null&&n.selector){var r,i=e==null||(r=e.properties)===null||r===void 0?void 0:r.$element_selectors;if(!i||!i.includes(n==null?void 0:n.selector))return!1}return!0}getElementsList(e){return(e==null?void 0:e.properties.$elements)==null?[]:e==null?void 0:e.properties.$elements}}class Ma{constructor(e){this.instance=e,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(e){var n;G((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)||(this.setupEventBasedSurveys(e),this.setupActionBasedSurveys(e))}setupActionBasedSurveys(e){var n=e.filter(r=>{var i,s,o,a;return((i=r.conditions)===null||i===void 0?void 0:i.actions)&&((s=r.conditions)===null||s===void 0||(o=s.actions)===null||o===void 0||(a=o.values)===null||a===void 0?void 0:a.length)>0});n.length!==0&&(this.actionMatcher==null&&(this.actionMatcher=new Yi(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(r=>{this.onAction(r)})),n.forEach(r=>{var i,s,o,a,c,u,d,l,h,f;r.conditions&&(i=r.conditions)!==null&&i!==void 0&&i.actions&&(s=r.conditions)!==null&&s!==void 0&&(o=s.actions)!==null&&o!==void 0&&o.values&&((a=r.conditions)===null||a===void 0||(c=a.actions)===null||c===void 0||(u=c.values)===null||u===void 0?void 0:u.length)>0&&((d=this.actionMatcher)===null||d===void 0||d.register(r.conditions.actions.values),(l=r.conditions)===null||l===void 0||(h=l.actions)===null||h===void 0||(f=h.values)===null||f===void 0||f.forEach(p=>{if(p&&p.name){var g=this.actionToSurveys.get(p.name);g&&g.push(r.id),this.actionToSurveys.set(p.name,g||[r.id])}}))}))}setupEventBasedSurveys(e){var n;e.filter(r=>{var i,s,o,a;return((i=r.conditions)===null||i===void 0?void 0:i.events)&&((s=r.conditions)===null||s===void 0||(o=s.events)===null||o===void 0||(a=o.values)===null||a===void 0?void 0:a.length)>0}).length!==0&&((n=this.instance)===null||n===void 0||n._addCaptureHook((r,i)=>{this.onEvent(r,i)}),e.forEach(r=>{var i,s,o;(i=r.conditions)===null||i===void 0||(s=i.events)===null||s===void 0||(o=s.values)===null||o===void 0||o.forEach(a=>{if(a&&a.name){var c=this.eventToSurveys.get(a.name);c&&c.push(r.id),this.eventToSurveys.set(a.name,c||[r.id])}})}))}onEvent(e,n){var r,i,s=((r=this.instance)===null||r===void 0||(i=r.persistence)===null||i===void 0?void 0:i.props[gu])||[];if(Ma.SURVEY_SHOWN_EVENT_NAME==e&&n&&s.length>0){var o,a=n==null||(o=n.properties)===null||o===void 0?void 0:o.$survey_id;if(a){var c=s.indexOf(a);c>=0&&(s.splice(c,1),this._updateActivatedSurveys(s))}}else this.eventToSurveys.has(e)&&this._updateActivatedSurveys(s.concat(this.eventToSurveys.get(e)||[]))}onAction(e){var n,r,i=((n=this.instance)===null||n===void 0||(r=n.persistence)===null||r===void 0?void 0:r.props[gu])||[];this.actionToSurveys.has(e)&&this._updateActivatedSurveys(i.concat(this.actionToSurveys.get(e)||[]))}_updateActivatedSurveys(e){var n,r;(n=this.instance)===null||n===void 0||(r=n.persistence)===null||r===void 0||r.register({[gu]:[...new Set(e)]})}getSurveys(){var e,n,r=(e=this.instance)===null||e===void 0||(n=e.persistence)===null||n===void 0?void 0:n.props[gu];return r||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}}B(Ma,"SURVEY_SHOWN_EVENT_NAME","survey shown");var Ft=Qt("[Surveys]"),yb={icontains:(t,e)=>t.some(n=>e.toLowerCase().includes(n.toLowerCase())),not_icontains:(t,e)=>t.every(n=>!e.toLowerCase().includes(n.toLowerCase())),regex:(t,e)=>t.some(n=>zs(e,n)),not_regex:(t,e)=>t.every(n=>!zs(e,n)),exact:(t,e)=>t.some(n=>e===n),is_not:(t,e)=>t.every(n=>e!==n)};function bb(t){return t??"icontains"}class iO{constructor(e){B(this,"_isFetchingSurveys",!1),B(this,"_isInitializingSurveys",!1),B(this,"_surveyCallbacks",[]),this.instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){var n=e.surveys;if(Ge(n))return Ft.warn("Decide not loaded yet. Not loading surveys.");var r=ut(n);this._hasSurveys=r?n.length>0:n,Ft.info("decide response received, hasSurveys: ".concat(this._hasSurveys)),this._hasSurveys&&this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var e=(()=>{for(var n=[],r=0;r<localStorage.length;r++){var i=localStorage.key(r);i!=null&&i.startsWith("seenSurvey_")&&n.push(i)}return n})();e.forEach(n=>localStorage.removeItem(n))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)Ft.info("Already initializing surveys, skipping...");else if(this.instance.config.disable_surveys)Ft.info("Disabled. Not loading surveys.");else{var e=Fe==null?void 0:Fe.__PosthogExtensions__;if(e)if(this._hasSurveys){this._isInitializingSurveys=!0;try{var n=e.generateSurveys;if(n)this._surveyManager=n(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new Ma(this.instance),Ft.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0});else{var r=e.loadExternalDependency;if(r)r(this.instance,"surveys",s=>{if(s||!e.generateSurveys)return Ft.error("Could not load surveys script",s),void(this._isInitializingSurveys=!1);this._surveyManager=e.generateSurveys(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new Ma(this.instance),Ft.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})});else{var i="PostHog loadExternalDependency extension not found. Cannot load remote config.";Ft.error(i),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:i})}}}catch(s){throw Ft.error("Error initializing surveys",s),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:"Error initializing surveys"}),s}}else Ft.info("No surveys to load.");else Ft.error("PostHog Extensions not found.")}}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter(n=>n!==e)}}getSurveys(e){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this.instance.config.disable_surveys)return Ft.info("Disabled. Not loading surveys."),e([]);var r=this.instance.get_property(Ef);if(r&&!n)return e(r,{isLoaded:!0});if(this._isFetchingSurveys)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this._isFetchingSurveys=!0,this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",timeout:this.instance.config.surveys_request_timeout_ms,callback:i=>{var s;this._isFetchingSurveys=!1;var o=i.statusCode;if(o!==200||!i.json){var a="Surveys API could not be loaded, status: ".concat(o);return Ft.error(a),e([],{isLoaded:!1,error:a})}var c,u=i.json.surveys||[],d=u.filter(l=>{var h,f,p,g,v,m,_,w,T,C,E,I;return((h=l.conditions)===null||h===void 0?void 0:h.events)&&((f=l.conditions)===null||f===void 0||(p=f.events)===null||p===void 0?void 0:p.values)&&((g=l.conditions)===null||g===void 0||(v=g.events)===null||v===void 0||(m=v.values)===null||m===void 0?void 0:m.length)>0||((_=l.conditions)===null||_===void 0?void 0:_.actions)&&((w=l.conditions)===null||w===void 0||(T=w.actions)===null||T===void 0?void 0:T.values)&&((C=l.conditions)===null||C===void 0||(E=C.actions)===null||E===void 0||(I=E.values)===null||I===void 0?void 0:I.length)>0});return d.length>0&&((c=this._surveyEventReceiver)===null||c===void 0||c.register(d)),(s=this.instance.persistence)===null||s===void 0||s.register({[Ef]:u}),e(u,{isLoaded:!0})}})}catch(i){throw this._isFetchingSurveys=!1,i}}_notifySurveyCallbacks(e){for(var n of this._surveyCallbacks)try{e.isLoaded?this.getSurveys(n):n([],e)}catch(r){Ft.error("Error in survey callback",r)}}isSurveyFeatureFlagEnabled(e){return!e||this.instance.featureFlags.isFeatureEnabled(e)}getActiveMatchingSurveys(e){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(r=>{var i,s=r.filter(c=>!(!c.start_date||c.end_date)).filter(c=>{var u;if(!c.conditions)return!0;var d=function(f){var p,g,v;if((p=f.conditions)===null||p===void 0||!p.url)return!0;var m=M==null||(g=M.location)===null||g===void 0?void 0:g.href;if(!m)return!1;var _=[f.conditions.url];return yb[bb((v=f.conditions)===null||v===void 0?void 0:v.urlMatchType)](_,m)}(c),l=(u=c.conditions)===null||u===void 0||!u.selector||(ae==null?void 0:ae.querySelector(c.conditions.selector)),h=function(f){var p,g,v;if((p=f.conditions)===null||p===void 0||!p.deviceTypes||((g=f.conditions)===null||g===void 0?void 0:g.deviceTypes.length)===0)return!0;if(!St)return!1;var m=it.deviceType(St);return yb[bb((v=f.conditions)===null||v===void 0?void 0:v.deviceTypesMatchType)](f.conditions.deviceTypes,m)}(c);return d&&l&&h}),o=(i=this._surveyEventReceiver)===null||i===void 0?void 0:i.getSurveys(),a=s.filter(c=>{var u,d,l,h,f,p,g,v,m;if(!(c.linked_flag_key||c.targeting_flag_key||c.internal_targeting_flag_key||(u=c.feature_flag_keys)!==null&&u!==void 0&&u.length))return!0;var _=this.isSurveyFeatureFlagEnabled(c.linked_flag_key),w=this.isSurveyFeatureFlagEnabled(c.targeting_flag_key),T=((d=(l=c.conditions)===null||l===void 0||(h=l.events)===null||h===void 0||(f=h.values)===null||f===void 0?void 0:f.length)!==null&&d!==void 0?d:0)>0,C=((p=(g=c.conditions)===null||g===void 0||(v=g.actions)===null||v===void 0||(m=v.values)===null||m===void 0?void 0:m.length)!==null&&p!==void 0?p:0)>0,E=!T&&!C||(o==null?void 0:o.includes(c.id)),I=this._canActivateRepeatedly(c)||this.isSurveyFeatureFlagEnabled(c.internal_targeting_flag_key),y=this.checkFlags(c);return _&&w&&I&&E&&y});return e(a)},n)}checkFlags(e){var n;return(n=e.feature_flag_keys)===null||n===void 0||!n.length||e.feature_flag_keys.every(r=>{var{key:i,value:s}=r;return!i||!s||this.instance.featureFlags.isFeatureEnabled(s)})}_canActivateRepeatedly(e){var n;return Ge((n=Fe.__PosthogExtensions__)===null||n===void 0?void 0:n.canActivateRepeatedly)?(Ft.warn("init was not called"),!1):Fe.__PosthogExtensions__.canActivateRepeatedly(e)}canRenderSurvey(e){Ge(this._surveyManager)?Ft.warn("init was not called"):this.getSurveys(n=>{var r=n.filter(i=>i.id===e)[0];this._surveyManager.canRenderSurvey(r)})}renderSurvey(e,n){Ge(this._surveyManager)?Ft.warn("init was not called"):this.getSurveys(r=>{var i=r.filter(s=>s.id===e)[0];this._surveyManager.renderSurvey(i,ae==null?void 0:ae.querySelector(n))})}}var wb=Qt("[RateLimiter]");class sO{constructor(e){var n,r;B(this,"serverLimits",{}),B(this,"lastEventRateLimited",!1),B(this,"checkForLimiting",i=>{var s=i.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach(o=>{wb.info("".concat(o||"events"," is quota limited.")),this.serverLimits[o]=new Date().getTime()+6e4})}catch(o){return void wb.warn('could not rate limit - continuing. Error: "'.concat(o==null?void 0:o.message,'"'),{text:s})}}),this.instance=e,this.captureEventsPerSecond=((n=e.config.rate_limiting)===null||n===void 0?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((r=e.config.rate_limiting)===null||r===void 0?void 0:r.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var e,n,r,i=arguments.length>0&&arguments[0]!==void 0&&arguments[0],s=new Date().getTime(),o=(e=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_property(Cf))!==null&&e!==void 0?e:{tokens:this.captureEventsBurstLimit,last:s};o.tokens+=(s-o.last)/1e3*this.captureEventsPerSecond,o.last=s,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var a=o.tokens<1;return a||i||(o.tokens=Math.max(0,o.tokens-1)),!a||this.lastEventRateLimited||i||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=a,(r=this.instance.persistence)===null||r===void 0||r.set_property(Cf,o),{isRateLimited:a,remainingTokens:o.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Zi=Qt("[RemoteConfig]");class oO{constructor(e){this.instance=e}get remoteConfig(){var e,n;return(e=Fe._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(n=e[this.instance.config.token])===null||n===void 0?void 0:n.config}_loadRemoteConfigJs(e){var n,r,i;(n=Fe.__PosthogExtensions__)!==null&&n!==void 0&&n.loadExternalDependency?(r=Fe.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"remote-config",()=>e(this.remoteConfig)):(Zi.error("PostHog Extensions not found. Cannot load remote config."),e())}_loadRemoteConfigJSON(e){this.instance._send_request({method:"GET",url:this.instance.requestRouter.endpointFor("assets","/array/".concat(this.instance.config.token,"/config")),callback:n=>{e(n.json)}})}load(){try{if(this.remoteConfig)return Zi.info("Using preloaded remote config",this.remoteConfig),void this.onRemoteConfig(this.remoteConfig);if(this.instance.config.advanced_disable_decide)return void Zi.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(e=>{if(!e)return Zi.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(n=>{this.onRemoteConfig(n)});this.onRemoteConfig(e)})}catch(e){Zi.error("Error loading remote config",e)}}onRemoteConfig(e){e?this.instance.config.__preview_remote_config?(this.instance._onRemoteConfig(e),e.hasFeatureFlags!==!1&&this.instance.featureFlags.ensureFlagsLoaded()):Zi.info("__preview_remote_config is disabled. Logging config instead",e):Zi.error("Failed to fetch remote config from PostHog.")}}var aO=function(t){var e,n,r,i,s="";for(e=n=0,r=(t=(t+"").replace(/\r\n/g,`
`).replace(/\r/g,`
`)).length,i=0;i<r;i++){var o=t.charCodeAt(i),a=null;o<128?n++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),si(a)||(n>e&&(s+=t.substring(e,n)),s+=a,e=n=i+1)}return n>e&&(s+=t.substring(e,t.length)),s},cO=!!pf||!!hf,Sb="text/plain",Bu=(t,e)=>{var[n,r]=t.split("?"),i=D({},e);r==null||r.split("&").forEach(o=>{var[a]=o.split("=");delete i[a]});var s=DP(i);return s=s?(r?r+"&":"")+s:r,"".concat(n,"?").concat(s)},Oa=(t,e)=>JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r,e),_h=t=>{var{data:e,compression:n}=t;if(e){if(n===qn.GZipJS){var r=wy(Sy(Oa(e)),{mtime:0}),i=new Blob([r],{type:Sb});return{contentType:Sb,body:i,estimatedSize:i.size}}if(n===qn.Base64){var s=function(c){var u,d,l,h,f,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,v=0,m="",_=[];if(!c)return c;c=aO(c);do u=(f=c.charCodeAt(g++)<<16|c.charCodeAt(g++)<<8|c.charCodeAt(g++))>>18&63,d=f>>12&63,l=f>>6&63,h=63&f,_[v++]=p.charAt(u)+p.charAt(d)+p.charAt(l)+p.charAt(h);while(g<c.length);switch(m=_.join(""),c.length%3){case 1:m=m.slice(0,-2)+"==";break;case 2:m=m.slice(0,-1)+"="}return m}(Oa(e)),o=(c=>"data="+encodeURIComponent(typeof c=="string"?c:Oa(c)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=Oa(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},La=[];hf&&La.push({transport:"fetch",method:t=>{var e,n,{contentType:r,body:i,estimatedSize:s}=(e=_h(t))!==null&&e!==void 0?e:{},o=new Headers;Ye(t.headers,function(d,l){o.append(l,d)}),r&&o.append("Content-Type",r);var a=t.url,c=null;if(__){var u=new __;c={signal:u.signal,timeout:setTimeout(()=>u.abort(),t.timeout)}}hf(a,D({method:(t==null?void 0:t.method)||"GET",headers:o,keepalive:t.method==="POST"&&(s||0)<52428.8,body:i,signal:(n=c)===null||n===void 0?void 0:n.signal},t.fetchOptions)).then(d=>d.text().then(l=>{var h,f={statusCode:d.status,text:l};if(d.status===200)try{f.json=JSON.parse(l)}catch(p){se.error(p)}(h=t.callback)===null||h===void 0||h.call(t,f)})).catch(d=>{var l;se.error(d),(l=t.callback)===null||l===void 0||l.call(t,{statusCode:0,text:d})}).finally(()=>c?clearTimeout(c.timeout):null)}}),pf&&La.push({transport:"XHR",method:t=>{var e,n=new pf;n.open(t.method||"GET",t.url,!0);var{contentType:r,body:i}=(e=_h(t))!==null&&e!==void 0?e:{};Ye(t.headers,function(s,o){n.setRequestHeader(o,s)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),n.withCredentials=!0,n.onreadystatechange=()=>{if(n.readyState===4){var s,o={statusCode:n.status,text:n.responseText};if(n.status===200)try{o.json=JSON.parse(n.responseText)}catch{}(s=t.callback)===null||s===void 0||s.call(t,o)}},n.send(i)}}),yn!=null&&yn.sendBeacon&&La.push({transport:"sendBeacon",method:t=>{var e=Bu(t.url,{beacon:"1"});try{var n,{contentType:r,body:i}=(n=_h(t))!==null&&n!==void 0?n:{},s=typeof i=="string"?new Blob([i],{type:r}):i;yn.sendBeacon(e,s)}catch{}}});var yh=3e3;class uO{constructor(e,n){B(this,"isPaused",!0),B(this,"queue",[]),this.flushTimeoutMs=Tn((n==null?void 0:n.flush_interval_ms)||yh,250,5e3,"flush interval",yh),this.sendRequest=e}enqueue(e){this.queue.push(e),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();var e=this.queue.length>0?this.formatQueue():{},n=Object.values(e),r=[...n.filter(i=>i.url.indexOf("/e")===0),...n.filter(i=>i.url.indexOf("/e")!==0)];r.map(i=>{this.sendRequest(D(D({},i),{},{transport:"sendBeacon"}))})}enable(){this.isPaused=!1,this.setFlushTimeout()}setFlushTimeout(){var e=this;this.isPaused||(this.flushTimeout=setTimeout(()=>{if(this.clearFlushTimeout(),this.queue.length>0){var n=this.formatQueue(),r=function(s){var o=n[s],a=new Date().getTime();o.data&&ut(o.data)&&Ye(o.data,c=>{c.offset=Math.abs(c.timestamp-a),delete c.timestamp}),e.sendRequest(o)};for(var i in n)r(i)}},this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var e={};return Ye(this.queue,n=>{var r,i=n,s=(i?i.batchKey:null)||i.url;G(e[s])&&(e[s]=D(D({},i),{},{data:[]})),(r=e[s].data)===null||r===void 0||r.push(i.data)}),this.queue=[],e}}var lO=["retriesPerformedSoFar"];class dO{constructor(e){B(this,"isPolling",!1),B(this,"pollIntervalMs",3e3),B(this,"queue",[]),this.instance=e,this.queue=[],this.areWeOnline=!0,!G(M)&&"onLine"in M.navigator&&(this.areWeOnline=M.navigator.onLine,gt(M,"online",()=>{this.areWeOnline=!0,this.flush()}),gt(M,"offline",()=>{this.areWeOnline=!1}))}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=p_(e,lO);Jt(n)&&n>0&&(r.url=Bu(r.url,{retry_count:n})),this.instance._send_request(D(D({},r),{},{callback:i=>{var s;i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(n??0)<10?this.enqueue(D({retriesPerformedSoFar:n},r)):(s=r.callback)===null||s===void 0||s.call(r,i)}}))}enqueue(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var r=function(o){var a=3e3*Math.pow(2,o),c=a/2,u=Math.min(18e5,a),d=(Math.random()-.5)*(u-c);return Math.ceil(u+d)}(n),i=Date.now()+r;this.queue.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in ".concat(r);navigator.onLine||(s+=" (Browser is offline)"),se.warn(s),this.isPolling||(this.isPolling=!0,this.poll())}poll(){this.poller&&clearTimeout(this.poller),this.poller=setTimeout(()=>{this.areWeOnline&&this.queue.length>0&&this.flush(),this.poll()},this.pollIntervalMs)}flush(){var e=Date.now(),n=[],r=this.queue.filter(s=>s.retryAt<e||(n.push(s),!1));if(this.queue=n,r.length>0)for(var{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.queue))try{this.instance._send_request(D(D({},e),{},{transport:"sendBeacon"}))}catch(n){se.error(n)}this.queue=[]}}class fO{constructor(e){B(this,"_updateScrollData",()=>{var n,r,i,s;this.context||(this.context={});var o=this.scrollElement(),a=this.scrollY(),c=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=a+((o==null?void 0:o.clientHeight)||0),d=(o==null?void 0:o.scrollHeight)||0;this.context.lastScrollY=Math.ceil(a),this.context.maxScrollY=Math.max(a,(n=this.context.maxScrollY)!==null&&n!==void 0?n:0),this.context.maxScrollHeight=Math.max(c,(r=this.context.maxScrollHeight)!==null&&r!==void 0?r:0),this.context.lastContentY=u,this.context.maxContentY=Math.max(u,(i=this.context.maxContentY)!==null&&i!==void 0?i:0),this.context.maxContentHeight=Math.max(d,(s=this.context.maxContentHeight)!==null&&s!==void 0?s:0)}),this.instance=e}getContext(){return this.context}resetContext(){var e=this.context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){gt(M,"scroll",this._updateScrollData,{capture:!0}),gt(M,"scrollend",this._updateScrollData,{capture:!0}),gt(M,"resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return M==null?void 0:M.document.documentElement;var e=ut(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(var n of e){var r=M==null?void 0:M.document.querySelector(n);if(r)return r}}scrollY(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return M&&(M.scrollY||M.pageYOffset||M.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return M&&(M.scrollX||M.pageXOffset||M.document.documentElement.scrollLeft)||0}}var hO=t=>it.personInfo({maskPersonalDataProperties:t==null?void 0:t.config.mask_personal_data_properties,customPersonalDataProperties:t==null?void 0:t.config.custom_personal_data_properties});class pO{constructor(e,n,r,i){B(this,"_onSessionIdCallback",s=>{var o=this._getStored();if(!o||o.sessionId!==s){var a={sessionId:s,props:this._sessionSourceParamGenerator(this.instance)};this._persistence.register({[kf]:a})}}),this.instance=e,this._sessionIdManager=n,this._persistence=r,this._sessionSourceParamGenerator=i||hO,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[kf]}getSetOnceProps(){var e,n=(e=this._getStored())===null||e===void 0?void 0:e.props;return n?"r"in n?it.personPropsFromInfo(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var e={};return Ye(ma(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_".concat(mf(r))]=n}),e}}var Eb=Qt("[SessionId]");class gO{constructor(e,n,r){var i;if(B(this,"_sessionIdChangedHandlers",[]),!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.config=e.config,this.persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=n||ui,this._windowIdGenerator=r||ui;var s=this.config.persistence_name||this.config.token,o=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Tn(o,60,36e3,"session_idle_timeout_seconds",1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.resetIdleTimer(),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var a=Nt.parse(this._window_id_storage_key),c=Nt.parse(this._primary_window_exists_storage_key);a&&!c?this._windowId=a:Nt.remove(this._window_id_storage_key),Nt.set(this._primary_window_exists_storage_key,!0)}if((i=this.config.bootstrap)!==null&&i!==void 0&&i.sessionID)try{var u=(d=>{var l=d.replace(/-/g,"");if(l.length!==32)throw new Error("Not a valid UUID");if(l[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(l.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),u)}catch(d){Eb.error("Invalid sessionID in bootstrap",d)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return G(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(n=>n!==e)}}_canUseSessionStorage(){return this.config.persistence!=="memory"&&!this.persistence.disabled&&Nt.is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Nt.set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Nt.parse(this._window_id_storage_key):null}_setSessionId(e,n,r){e===this._sessionId&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this._sessionId=e,this.persistence.register({[hu]:[n,e,r]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[hu];return ut(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){gt(M,"beforeunload",()=>{this._canUseSessionStorage()&&Nt.remove(this._primary_window_exists_storage_key)},{capture:!1})}checkAndGetSessionAndWindowId(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(this.config.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var r=n||new Date().getTime(),[i,s,o]=this._getSessionId(),a=this._getWindowId(),c=Jt(o)&&o>0&&Math.abs(r-o)>864e5,u=!1,d=!s,l=!e&&Math.abs(r-i)>this.sessionTimeoutMs;d||l||c?(s=this._sessionIdGenerator(),a=this._windowIdGenerator(),Eb.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:d,activityTimeout:l,sessionPastMaximumLength:c}}),o=r,u=!0):a||(a=this._windowIdGenerator(),u=!0);var h=i===0||!e||c?r:i,f=o===0?new Date().getTime():o;return this._setWindowId(a),this._setSessionId(s,h,f),e||this.resetIdleTimer(),u&&this._sessionIdChangedHandlers.forEach(p=>p(s,a,u?{noSessionId:d,activityTimeout:l,sessionPastMaximumLength:c}:void 0)),{sessionId:s,windowId:a,sessionStartTimestamp:f,changeReason:u?{noSessionId:d,activityTimeout:l,sessionPastMaximumLength:c}:void 0,lastActivityTimestamp:i}}resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}}var mO=["$set_once","$set"],fi=Qt("[SiteApps]");class vO{constructor(e){this.instance=e,this.bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this.instance.config.opt_in_site_apps}eventCollector(e,n){if(n){var r=this.globalsForEvent(n);this.bufferedInvocations.push(r),this.bufferedInvocations.length>1e3&&(this.bufferedInvocations=this.bufferedInvocations.slice(10))}}get siteAppLoaders(){var e,n;return(e=Fe._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(n=e[this.instance.config.token])===null||n===void 0?void 0:n.siteApps}init(){if(this.isEnabled){var e=this.instance._addCaptureHook(this.eventCollector.bind(this));this.stopBuffering=()=>{e(),this.bufferedInvocations=[],this.stopBuffering=void 0}}}globalsForEvent(e){var n,r,i,s,o,a,c;if(!e)throw new Error("Event payload is required");var u={},d=this.instance.get_property("$groups")||[],l=this.instance.get_property("$stored_group_properties")||{};for(var[h,f]of Object.entries(l))u[h]={id:d[h],type:h,properties:f};var{$set_once:p,$set:g}=e;return{event:D(D({},p_(e,mO)),{},{properties:D(D(D({},e.properties),g?{$set:D(D({},(n=(r=e.properties)===null||r===void 0?void 0:r.$set)!==null&&n!==void 0?n:{}),g)}:{}),p?{$set_once:D(D({},(i=(s=e.properties)===null||s===void 0?void 0:s.$set_once)!==null&&i!==void 0?i:{}),p)}:{}),elements_chain:(o=(a=e.properties)===null||a===void 0?void 0:a.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(c=e.properties)===null||c===void 0?void 0:c.distinct_id}),person:{properties:this.instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(e){var n=this.apps[e.id],r=()=>{var a;!n.errored&&this.bufferedInvocations.length&&(fi.info("Processing ".concat(this.bufferedInvocations.length," events for site app with id ").concat(e.id)),this.bufferedInvocations.forEach(c=>{var u;return(u=n.processEvent)===null||u===void 0?void 0:u.call(n,c)}),n.processedBuffer=!0),Object.values(this.apps).every(c=>c.processedBuffer||c.errored)&&((a=this.stopBuffering)===null||a===void 0||a.call(this))},i=!1,s=a=>{n.errored=!a,n.loaded=!0,fi.info("Site app with id ".concat(e.id," ").concat(a?"loaded":"errored")),i&&r()};try{var{processEvent:o}=e.init({posthog:this.instance,callback:a=>{s(a)}});o&&(n.processEvent=o),i=!0}catch(a){fi.error("Error while initializing PostHog app with config id ".concat(e.id),a),s(!1)}if(i&&n.loaded)try{r()}catch(a){fi.error("Error while processing buffered events PostHog app with config id ".concat(e.id),a),n.errored=!0}}setupSiteApps(){var e=this.siteAppLoaders||[];for(var n of e)this.apps[n.id]={id:n.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}onCapturedEvent(e){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e);for(var r of Object.values(this.apps))try{var i;(i=r.processEvent)===null||i===void 0||i.call(r,n)}catch(s){fi.error("Error while processing event ".concat(e.event," for site app ").concat(r.id),s)}}}onRemoteConfig(e){var n,r,i,s=this;if((n=this.siteAppLoaders)!==null&&n!==void 0&&n.length)return this.isEnabled?(this.setupSiteApps(),void this.instance.on("eventCaptured",u=>this.onCapturedEvent(u))):void fi.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.stopBuffering)===null||r===void 0||r.call(this),(i=e.siteApps)!==null&&i!==void 0&&i.length)if(this.isEnabled){var o=function(u,d){var l,h;Fe["__$$ph_site_app_".concat(u)]=s.instance,(l=Fe.__PosthogExtensions__)===null||l===void 0||(h=l.loadSiteApp)===null||h===void 0||h.call(l,s.instance,d,f=>{if(f)return fi.error("Error while initializing PostHog app with config id ".concat(u),f)})};for(var{id:a,url:c}of e.siteApps)o(a,c)}else fi.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var Xi,_O=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","bytespider"],kb=function(t,e){if(!t)return!1;var n=t.toLowerCase();return _O.concat(e||[]).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})},Cb=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&kb(n,e))return!0;try{var r=t==null?void 0:t.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>kb(i==null?void 0:i.brand,e)))return!0}catch{}return!!t.webdriver};function bh(t,e,n){return Oa({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}(function(t){t.US="us",t.EU="eu",t.CUSTOM="custom"})(Xi||(Xi={}));var Tb="i.posthog.com";class yO{constructor(e){B(this,"_regionCache",{}),this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get uiHost(){var e,n=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace(".".concat(Tb),".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=Xi.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=Xi.EU:this._regionCache[this.apiHost]=Xi.CUSTOM),this._regionCache[this.apiHost]}endpointFor(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(n&&(n=n[0]==="/"?n:"/".concat(n)),e==="ui")return this.uiHost+n;if(this.region===Xi.CUSTOM)return this.apiHost+n;var r=Tb+n;switch(e){case"assets":return"https://".concat(this.region,"-assets.").concat(r);case"api":return"https://".concat(this.region,".").concat(r)}}}var bO={icontains:(t,e)=>!!M&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!M&&e.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>!!M&&zs(e.href,t),not_regex:(t,e)=>!!M&&!zs(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class zt{constructor(e){var n=this;B(this,"getWebExperimentsAndEvaluateDisplayLogic",function(){var r=arguments.length>0&&arguments[0]!==void 0&&arguments[0];n.getWebExperiments(i=>{zt.logInfo("retrieved web experiments from the server"),n._flagToExperiments=new Map,i.forEach(s=>{if(s.feature_flag_key){var o;n._flagToExperiments&&(zt.logInfo("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=n._flagToExperiments)===null||o===void 0||o.set(s.feature_flag_key,s));var a=n.instance.getFeatureFlag(s.feature_flag_key);Et(a)&&s.variants[a]&&n.applyTransforms(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var c in s.variants){var u=s.variants[c];zt.matchesTestVariant(u)&&n.applyTransforms(s.name,c,u.transforms)}})},r)}),this.instance=e,this.instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}onFeatureFlags(e){if(this._is_bot())zt.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(Ge(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();zt.logInfo("applying feature flags",e),e.forEach(n=>{var r;if(this._flagToExperiments&&(r=this._flagToExperiments)!==null&&r!==void 0&&r.has(n)){var i,s=this.instance.getFeatureFlag(n),o=(i=this._flagToExperiments)===null||i===void 0?void 0:i.get(n);s&&o!=null&&o.variants[s]&&this.applyTransforms(o.name,s,o.variants[s].transforms)}})}}previewWebExperiment(){var e=zt.getWindowLocation();if(e!=null&&e.search){var n=wu(e==null?void 0:e.search,"__experiment_id"),r=wu(e==null?void 0:e.search,"__experiment_variant");n&&r&&(zt.logInfo("previewing web experiments ".concat(n," && ").concat(r)),this.getWebExperiments(i=>{this.showPreviewWebExperiment(parseInt(n),r,i)},!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,r){if(this.instance.config.disable_web_experiments&&!r)return e([]);var i=this.instance.get_property("$web_experiments");if(i&&!n)return e(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.instance.config.token)),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return e([]);var o=s.json.experiments||[];return e(o)}})}showPreviewWebExperiment(e,n,r){var i=r.filter(s=>s.id===e);i&&i.length>0&&(zt.logInfo("Previewing web experiment [".concat(i[0].name,"] with variant [").concat(n,"]")),this.applyTransforms(i[0].name,n,i[0].variants[n].transforms))}static matchesTestVariant(e){return!Ge(e.conditions)&&zt.matchUrlConditions(e)&&zt.matchUTMConditions(e)}static matchUrlConditions(e){var n;if(Ge(e.conditions)||Ge((n=e.conditions)===null||n===void 0?void 0:n.url))return!0;var r,i,s,o=zt.getWindowLocation();return!!o&&((r=e.conditions)===null||r===void 0||!r.url||bO[(i=(s=e.conditions)===null||s===void 0?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return M==null?void 0:M.location}static matchUTMConditions(e){var n;if(Ge(e.conditions)||Ge((n=e.conditions)===null||n===void 0?void 0:n.utm))return!0;var r=it.campaignParams();if(r.utm_source){var i,s,o,a,c,u,d,l,h,f,p,g,v,m,_,w,T=(i=e.conditions)===null||i===void 0||(s=i.utm)===null||s===void 0||!s.utm_campaign||((o=e.conditions)===null||o===void 0||(a=o.utm)===null||a===void 0?void 0:a.utm_campaign)==r.utm_campaign,C=(c=e.conditions)===null||c===void 0||(u=c.utm)===null||u===void 0||!u.utm_source||((d=e.conditions)===null||d===void 0||(l=d.utm)===null||l===void 0?void 0:l.utm_source)==r.utm_source,E=(h=e.conditions)===null||h===void 0||(f=h.utm)===null||f===void 0||!f.utm_medium||((p=e.conditions)===null||p===void 0||(g=p.utm)===null||g===void 0?void 0:g.utm_medium)==r.utm_medium,I=(v=e.conditions)===null||v===void 0||(m=v.utm)===null||m===void 0||!m.utm_term||((_=e.conditions)===null||_===void 0||(w=_.utm)===null||w===void 0?void 0:w.utm_term)==r.utm_term;return T&&E&&I&&C}return!1}static logInfo(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];se.info("[WebExperiments] ".concat(e),r)}applyTransforms(e,n,r){this._is_bot()?zt.logInfo("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach(i=>{if(i.selector){var s;zt.logInfo("applying transform of variant ".concat(n," for experiment ").concat(e," "),i);var o=(s=document)===null||s===void 0?void 0:s.querySelectorAll(i.selector);o==null||o.forEach(a=>{var c=a;i.html&&(c.innerHTML=i.html),i.css&&c.setAttribute("style",i.css)})}}):zt.logInfo("Control variants leave the page unmodified.")}_is_bot(){return yn&&this.instance?Cb(yn,this.instance.config.custom_blocked_useragents):void 0}}var Da={},wh=()=>{},Vs="posthog",Ib=!cO&&(St==null?void 0:St.indexOf("MSIE"))===-1&&(St==null?void 0:St.indexOf("Mozilla"))===-1,xb=()=>{var t;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:CP(ae==null?void 0:ae.location),persistence:"localStorage+cookie",persistence_name:"",loaded:wh,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:Cn&&Et(Cn==null?void 0:Cn.search)&&Cn.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(M==null||(t=M.location)===null||t===void 0?void 0:t.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var n="Bad HTTP status: "+e.statusCode+" "+e.text;se.error(n)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:yh},_onCapture:wh}},Rb=t=>{var e={};G(t.process_person)||(e.person_profiles=t.process_person),G(t.xhr_headers)||(e.request_headers=t.xhr_headers),G(t.cookie_name)||(e.persistence_name=t.cookie_name),G(t.disable_cookie)||(e.disable_persistence=t.disable_cookie),G(t.store_google)||(e.save_campaign_params=t.store_google),G(t.verbose)||(e.debug=t.verbose);var n=kt({},e,t);return ut(t.property_blacklist)&&(G(t.property_denylist)?n.property_denylist=t.property_blacklist:ut(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:se.error("Invalid value for property_denylist config: "+t.property_denylist)),n};class wO{constructor(){B(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){se.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class ju{get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){B(this,"webPerformance",new wO),B(this,"_personProcessingSetOncePropertiesSent",!1),B(this,"version",Sr.LIB_VERSION),B(this,"_internalEventEmitter",new _b),this.config=xb(),this.SentryIntegration=RM,this.sentryIntegration=e=>function(n,r){var i=Iy(n,r);return{name:Ty,processEvent:s=>i(s)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this._cachedIdentify=null,this.featureFlags=new ZM(this),this.toolbar=new PM(this),this.scrollManager=new fO(this),this.pageViewManager=new FM(this),this.surveys=new iO(this),this.experiments=new zt(this),this.exceptions=new $M(this),this.rateLimiter=new sO(this),this.requestRouter=new yO(this),this.consent=new GP(this),this.people={set:(e,n,r)=>{var i=Et(e)?{[e]:n}:e;this.setPersonProperties(i),r==null||r({})},set_once:(e,n,r)=>{var i=Et(e)?{[e]:n}:e;this.setPersonProperties(void 0,i),r==null||r({})}},this.on("eventCaptured",e=>se.info('send "'.concat(e==null?void 0:e.event,'"'),e))}init(e,n,r){if(r&&r!==Vs){var i,s=(i=Da[r])!==null&&i!==void 0?i:new ju;return s._init(e,n,r),Da[r]=s,Da[Vs][r]=s,s}return this._init(e,n,r)}_init(e){var n,r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;if(G(e)||vf(e))return se.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return se.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],i.person_profiles&&(this._initialPersonProfilesConfig=i.person_profiles),this.set_config(kt({},xb(),Rb(i),{name:s,token:e})),this.config.on_xhr_error&&se.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:qn.GZipJS,this.persistence=new uh(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new uh(D(D({},this.config),{},{persistence:"sessionStorage"}));var o=D({},this.persistence.props),a=D({},this.sessionPersistence.props);if(this._requestQueue=new uO(m=>this._send_retriable_request(m),this.config.request_queue_config),this._retryQueue=new dO(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new gO(this),this.sessionPropsManager=new pO(this,this.sessionManager,this.persistence)),new OM(this).startIfEnabledOrStop(),this.siteApps=new vO(this),(n=this.siteApps)===null||n===void 0||n.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new IM(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new UP(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new NM(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new LM(this),this.exceptionObserver=new XP(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new ry(this,ZP),this.deadClicksAutocapture.startIfEnabled(),Sr.DEBUG=Sr.DEBUG||this.config.debug,Sr.DEBUG&&se.info("Starting in debug mode",{this:this,config:i,thisC:D({},this.config),p:o,s:a}),this._sync_opt_out_with_persistence(),((r=i.bootstrap)===null||r===void 0?void 0:r.distinctID)!==void 0){var c,u,d=this.config.get_device_id(ui()),l=(c=i.bootstrap)!==null&&c!==void 0&&c.isIdentifiedID?d:i.bootstrap.distinctID;this.persistence.set_property(Er,(u=i.bootstrap)!==null&&u!==void 0&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.bootstrap.distinctID,$device_id:l})}if(this._hasBootstrappedFeatureFlags()){var h,f,p=Object.keys(((h=i.bootstrap)===null||h===void 0?void 0:h.featureFlags)||{}).filter(m=>{var _,w;return!((_=i.bootstrap)===null||_===void 0||(w=_.featureFlags)===null||w===void 0||!w[m])}).reduce((m,_)=>{var w,T;return m[_]=((w=i.bootstrap)===null||w===void 0||(T=w.featureFlags)===null||T===void 0?void 0:T[_])||!1,m},{}),g=Object.keys(((f=i.bootstrap)===null||f===void 0?void 0:f.featureFlagPayloads)||{}).filter(m=>p[m]).reduce((m,_)=>{var w,T,C,E;return(w=i.bootstrap)!==null&&w!==void 0&&(T=w.featureFlagPayloads)!==null&&T!==void 0&&T[_]&&(m[_]=(C=i.bootstrap)===null||C===void 0||(E=C.featureFlagPayloads)===null||E===void 0?void 0:E[_]),m},{});this.featureFlags.receivedFeatureFlags({featureFlags:p,featureFlagPayloads:g})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:$_,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(ui());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(Er,"anonymous")}return gt(M,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),i.segment?xM(this,()=>this._loaded()):this._loaded(),Wn(this.config._onCapture)&&this.config._onCapture!==wh&&(se.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",m=>this.config._onCapture(m.event,m))),this}_onRemoteConfig(e){var n,r,i,s,o,a,c,u;if(!ae||!ae.body)return se.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(e)},500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=$e(e.supportedCompression,qn.GZipJS)?qn.GZipJS:$e(e.supportedCompression,qn.Base64)?qn.Base64:void 0),(n=e.analytics)!==null&&n!==void 0&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:"identified_only"}),(r=this.siteApps)===null||r===void 0||r.onRemoteConfig(e),(i=this.sessionRecording)===null||i===void 0||i.onRemoteConfig(e),(s=this.autocapture)===null||s===void 0||s.onRemoteConfig(e),(o=this.heatmaps)===null||o===void 0||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(a=this.webVitalsAutocapture)===null||a===void 0||a.onRemoteConfig(e),(c=this.exceptionObserver)===null||c===void 0||c.onRemoteConfig(e),(u=this.deadClicksAutocapture)===null||u===void 0||u.onRemoteConfig(e)}_loaded(){try{this.config.loaded(this)}catch(e){se.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this._captureInitialPageview()},1),new oO(this).load(),this.featureFlags.decide()}_start_queue_if_opted_in(){var e;this.has_opted_out_capturing()||this.config.request_batching&&((e=this._requestQueue)===null||e===void 0||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||ai(this.__request_queue,e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,n;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),(e=this._requestQueue)===null||e===void 0||e.unload(),(n=this._retryQueue)===null||n===void 0||n.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Ib?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Bu(e.url,{ip:this.config.ip?1:0}),e.headers=D({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var r,i,s,o=D({},n);o.timeout=o.timeout||6e4,o.url=Bu(o.url,{_:new Date().getTime().toString(),ver:Sr.LIB_VERSION,compression:o.compression});var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",c=(i=(s=E_(La,u=>u.transport===a))===null||s===void 0?void 0:s.method)!==null&&i!==void 0?i:La[0].method;if(!c)throw new Error("No available transport method");c(o)})(D(D({},e),{},{callback:n=>{var r,i,s;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((i=(s=this.config).on_request_error)===null||i===void 0||i.call(s,n)),(r=e.callback)===null||r===void 0||r.call(e,n)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){var n,r=[],i=[],s=[];ai(e,a=>{a&&(n=a[0],ut(n)?s.push(a):Wn(a)?a.call(this):ut(a)&&n==="alias"?r.push(a):ut(a)&&n.indexOf("capture")!==-1&&Wn(this[n])?s.push(a):i.push(a))});var o=function(a,c){ai(a,function(u){if(ut(u[0])){var d=c;Ye(u,function(l){d=d[l[0]].apply(d,l.slice(1))})}else this[u[0]].apply(this,u.slice(1))},c)};o(r,this),o(i,this),o(s,this)}_hasBootstrappedFeatureFlags(){var e,n;return((e=this.config.bootstrap)===null||e===void 0?void 0:e.featureFlags)&&Object.keys((n=this.config.bootstrap)===null||n===void 0?void 0:n.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,n,r){var i;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!G(e)&&Et(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var s=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(s==null||!s.isRateLimited){n!=null&&n.$current_url&&!Et(n==null?void 0:n.$current_url)&&(se.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,a=(r==null?void 0:r.timestamp)||o,c=ui(),u={uuid:c,event:e,properties:this._calculate_event_properties(e,n||{},a,c)};s&&(u.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),r!=null&&r.$set&&(u.$set=r==null?void 0:r.$set);var d=this._calculate_set_once_properties(r==null?void 0:r.$set_once);d&&(u.$set_once=d),(u=EP(u,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,G(r==null?void 0:r.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o);var l=D(D({},u.properties.$set),u.$set);if(Ls(l)||this.setPersonPropertiesForFlags(l),!Ge(this.config.before_send)){var h=this._runBeforeSend(u);if(!h)return;u=h}this._internalEventEmitter.emit("eventCaptured",u);var f={method:"POST",url:(i=r==null?void 0:r._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:r==null?void 0:r._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this._send_retriable_request(f):this._requestQueue.enqueue(f),u}se.critical("This capture call is ignored due to client rate limiting.")}}else se.error("No event name provided to posthog.capture")}else se.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",n=>e(n.event,n))}_calculate_event_properties(e,n,r,i){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var s=this.persistence.remove_event_timer(e),o=D({},n);if(o.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(o.$cookieless_mode=!0),e==="$snapshot"){var a=D(D({},this.persistence.properties()),this.sessionPersistence.properties());return o.distinct_id=a.distinct_id,(!Et(o.distinct_id)&&!Jt(o.distinct_id)||vf(o.distinct_id))&&se.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var c,u=it.properties({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});if(this.sessionManager){var{sessionId:d,windowId:l}=this.sessionManager.checkAndGetSessionAndWindowId();o.$session_id=d,o.$window_id=l}this.sessionPropsManager&&kt(o,this.sessionPropsManager.getSessionProps());try{var h,f;this.sessionRecording&&(o.$recording_status=this.sessionRecording.status,o.$sdk_debug_replay_internal_buffer_length=this.sessionRecording.buffer.data.length,o.$sdk_debug_replay_internal_buffer_size=this.sessionRecording.buffer.size),o.$sdk_debug_retry_queue_size=(h=this._retryQueue)===null||h===void 0||(f=h.queue)===null||f===void 0?void 0:f.length}catch(m){o.$sdk_debug_error_capturing_properties=String(m)}if(this.requestRouter.region===Xi.CUSTOM&&(o.$lib_custom_api_host=this.config.api_host),c=e==="$pageview"?this.pageViewManager.doPageView(r,i):e==="$pageleave"?this.pageViewManager.doPageLeave(r):this.pageViewManager.doEvent(),o=kt(o,c),e==="$pageview"&&ae&&(o.title=ae.title),!G(s)){var p=r.getTime()-s;o.$duration=parseFloat((p/1e3).toFixed(3))}St&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=kt({},u,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),ut(this.config.property_denylist)?Ye(this.config.property_denylist,function(m){delete o[m]}):se.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(se.error("sanitize_properties is deprecated. Use before_send instead"),o=g(o,e));var v=this._hasPersonProcessing();return o.$process_person_profile=v,v&&this._requirePersonProcessing("_calculate_event_properties"),o}_calculate_set_once_properties(e){var n;if(!this.persistence||!this._hasPersonProcessing()||this._personProcessingSetOncePropertiesSent)return e;var r=this.persistence.get_initial_props(),i=(n=this.sessionPropsManager)===null||n===void 0?void 0:n.getSetOnceProps(),s=kt({},r,i||{},e||{}),o=this.config.sanitize_properties;return o&&(se.error("sanitize_properties is deprecated. Use before_send instead"),s=o(s,"$set_once")),this._personProcessingSetOncePropertiesSent=!0,Ls(s)?void 0:s}register(e,n){var r;(r=this.persistence)===null||r===void 0||r.register(e,n)}register_once(e,n,r){var i;(i=this.persistence)===null||i===void 0||i.register_once(e,n,r)}register_for_session(e){var n;(n=this.sessionPersistence)===null||n===void 0||n.register(e)}unregister(e){var n;(n=this.persistence)===null||n===void 0||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(e)}_register_single(e,n){this.register({[e]:n})}getFeatureFlag(e,n){return this.featureFlags.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(n)}catch{return n}}isFeatureEnabled(e,n){return this.featureFlags.isFeatureEnabled(e,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,n)}getEarlyAccessFeatures(e){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],r=arguments.length>2?arguments[2]:void 0;return this.featureFlags.getEarlyAccessFeatures(e,n,r)}on(e,n){return this._internalEventEmitter.on(e,n)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var n,r;return(n=(r=this.sessionManager)===null||r===void 0?void 0:r.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(e,n)}getActiveMatchingSurveys(e){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(e,n)}renderSurvey(e,n){this.surveys.renderSurvey(e,n)}canRenderSurvey(e){this.surveys.canRenderSurvey(e)}identify(e,n,r){if(!this.__loaded||!this.persistence)return se.uninitializedWarning("posthog.identify");if(Jt(e)&&(e=e.toString(),se.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e){if(["distinct_id","distinctid"].includes(e.toLowerCase()))se.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var i=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=i;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==i&&e!==this.get_property(va)&&(this.unregister(va),this.register({distinct_id:e}));var o=(this.persistence.get_property(Er)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(Er,"identified"),this.setPersonPropertiesForFlags(D(D({},r||{}),n||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:n||{},$set_once:r||{}}),this.featureFlags.setAnonymousDistinctId(i),this._cachedIdentify=bh(e,n,r)):(n||r)&&(this._cachedIdentify!==bh(e,n,r)?(this.setPersonProperties(n,r),this._cachedIdentify=bh(e,n,r)):se.info("A duplicate posthog.identify call was made with the same properties. It has been ignored.")),e!==i&&(this.reloadFeatureFlags(),this.unregister(mu))}}else se.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,n){(e||n)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(D(D({},n||{}),e||{})),this.capture("$set",{$set:e||{},$set_once:n||{}}))}group(e,n,r){if(e&&n){if(this._requirePersonProcessing("posthog.group")){var i=this.getGroups();i[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:D(D({},i),{},{[e]:n})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),i[e]===n||r||this.reloadFeatureFlags()}}else se.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,n)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var n,r,i,s;if(se.info("reset"),!this.__loaded)return se.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)===null||n===void 0||n.clear(),(r=this.sessionPersistence)===null||r===void 0||r.clear(),this.surveys.reset(),(i=this.persistence)===null||i===void 0||i.set_property(Er,"anonymous"),(s=this.sessionManager)===null||s===void 0||s.resetSessionId(),this._cachedIdentify=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:$_,$device_id:null},"");else{var a=this.config.get_device_id(ui());this.register_once({distinct_id:a,$device_id:e?a:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(n));if(e!=null&&e.withTimestamp&&r){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return i;var a=Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0);i+="?t=".concat(a)}return i}alias(e,n){return e===this.get_property(k_)?(se.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(G(n)&&(n=this.get_distinct_id()),e!==n?(this._register_single(va,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(se.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n,r,i,s,o=D({},this.config);lt(e)&&(kt(this.config,Rb(e)),(n=this.persistence)===null||n===void 0||n.update_config(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new uh(D(D({},this.config),{},{persistence:"sessionStorage"})),Tt.is_supported()&&Tt.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(Sr.DEBUG=!0,se.info("set_config",JSON.stringify({config:e,oldConfig:o,newConfig:D({},this.config)},null,2))),(r=this.sessionRecording)===null||r===void 0||r.startIfEnabledOrStop(),(i=this.autocapture)===null||i===void 0||i.startIfEnabled(),(s=this.heatmaps)===null||s===void 0||s.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(e){var n=e===!0,r={sampling:n||!(e==null||!e.sampling),linked_flag:n||!(e==null||!e.linked_flag),url_trigger:n||!(e==null||!e.url_trigger),event_trigger:n||!(e==null||!e.event_trigger)};if(Object.values(r).some(Boolean)){var i,s,o,a,c;(i=this.sessionManager)===null||i===void 0||i.checkAndGetSessionAndWindowId(),r.sampling&&((s=this.sessionRecording)===null||s===void 0||s.overrideSampling()),r.linked_flag&&((o=this.sessionRecording)===null||o===void 0||o.overrideLinkedFlag()),r.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),r.event_trigger&&((c=this.sessionRecording)===null||c===void 0||c.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)===null||e===void 0||!e.started)}captureException(e,n){var r=new Error("PostHog syntheticException");this.exceptions.sendExceptionEvent(D(D({},uM((i=>i instanceof Error)(e)?{error:e,event:e.message}:{event:e},{syntheticException:r})),n))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var n;return(n=this.persistence)===null||n===void 0?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)===null||n===void 0?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:Vs;return n!==Vs&&(n=Vs+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)===null||e===void 0?void 0:e.get_property(Er))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property(Er))==="identified"}_hasPersonProcessing(){var e,n,r,i;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Ls(this.getGroups())&&((e=this.persistence)===null||e===void 0||(n=e.props)===null||n===void 0||!n[va])&&((r=this.persistence)===null||r===void 0||(i=r.props)===null||i===void 0||!i[vu]))}_shouldCapturePageleave(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(e){return this.config.person_profiles==="never"?(se.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(vu,!0),!0)}_sync_opt_out_with_persistence(){var e,n,r,i,s=this.consent.isOptedOut(),o=this.config.opt_out_persistence_by_default,a=this.config.disable_persistence||s&&!!o;((e=this.persistence)===null||e===void 0?void 0:e.disabled)!==a&&((r=this.persistence)===null||r===void 0||r.set_disabled(a)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.disabled)!==a&&((i=this.sessionPersistence)===null||i===void 0||i.set_disabled(a))}opt_in_capturing(e){var n;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(G(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((n=e==null?void 0:e.captureEventName)!==null&&n!==void 0?n:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}opt_out_capturing(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return yn?Cb(yn,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){ae&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:ae.title},{send_instantly:!0}))}debug(e){e===!1?(M==null||M.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(M==null||M.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}_runBeforeSend(e){if(Ge(this.config.before_send))return e;var n=ut(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var i of n){if(r=i(r),Ge(r)){var s="Event '".concat(e.event,"' was rejected in beforeSend function");return wP(e.event)?se.warn("".concat(s,". This can cause unexpected behavior.")):se.info(s),null}r.properties&&!Ls(r.properties)||se.warn("Event '".concat(e.event,"' has no properties after beforeSend function, this is likely an error."))}return r}getPageViewId(){var e;return(e=this.pageViewManager._currentPageview)===null||e===void 0?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(r)})}}(function(t,e){for(var n=0;n<e.length;n++)t.prototype[e[n]]=SP(t.prototype[e[n]])})(ju,["identify"]);var Ab,Na=(Ab=Da[Vs]=new ju,function(){function t(){t.done||(t.done=!0,Ib=!1,Ye(Da,function(e){e._dom_loaded()}))}ae!=null&&ae.addEventListener?ae.readyState==="complete"?t():gt(ae,"DOMContentLoaded",t,{capture:!1}):M&&se.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Ab);const Sh={init:()=>{Na.init(mn.analytics.posthogApiKey,{api_host:"https://us.i.posthog.com",person_profiles:"identified_only",disable_persistence:!0,autocapture:!1,capture_pageview:!1,capture_pageleave:!1}),Na.register({app_version:chrome.runtime.getManifest().version})},identify:({user:t})=>{Na.identify(t.id,{email:t.email})},logEvent:(t,e)=>{t==="open extension"?Na.capture("$pageview",{$current_url:"extension"}):Na.capture(t,e)}},{sendMessage:SO,addMessageListener:EO}=ir();function Hu(){async function t(n,r){if(await Pb()){if(!Hg()){SO("logEvent",{event:n,properties:r},null);return}mn.analytics.posthogApiKey&&Sh.logEvent(n,r),mn.analytics.amplitudeApiKey&&ff.logEvent(n,r)}}function e(){if(!Hg())throw new Error("Analytics listener must be added from background");mn.analytics.posthogApiKey&&Sh.init(),mn.analytics.amplitudeApiKey&&ff.init(),rI(async r=>{await Pb()&&(mn.analytics.posthogApiKey&&Sh.identify({user:r}),mn.analytics.amplitudeApiKey&&ff.identify({user:r}))});const n=EO("logEvent",async r=>{const{event:i,properties:s}=r.payload;t(i,s)});return()=>{n()}}return{logEvent:t,addAnalyticsListener:e}}async function Pb(){return mn.analytics.enabled&&await ET()}const{addMessageListener:kO}=ir();function CO(){return kO("pingServiceWorker",async()=>{})}function qu(){function t(e,n,{requiredSenderTabId:r}={}){const i=(s,o,a)=>{var c;if(!(s.type!==e||r&&((c=o.tab)==null?void 0:c.id)!==r))return n(s,o).then(u=>{a(u)}).catch(u=>{const d=Ui(u);a(km(d))}),!0};return chrome.runtime.onMessageExternal.addListener(i),()=>chrome.runtime.onMessageExternal.removeListener(i)}return{addWebMessageListener:t}}const{addWebMessageListener:TO}=qu(),{logEvent:IO}=Hu();function xO(){return TO("logWebEvent",async t=>{const{event:e,properties:n}=t.payload;return IO(e,n)})}const{addWebMessageListener:Mb}=qu(),RO=async t=>{const{user:e}=t.payload;tI(e)},AO=async()=>{eI(),await chrome.storage.local.clear(),setTimeout(()=>chrome.runtime.reload(),100)};function PO(){const t=[Mb("logIn",RO),Mb("logOut",AO)];return()=>{t.forEach(e=>e())}}const{addWebMessageListener:MO}=qu();function OO(){return MO("ping",async()=>{})}const{addWebMessageListener:LO}=qu();function DO(){return LO("version",async()=>chrome.runtime.getManifest().version)}function NO(){const t=[PO(),OO(),xO(),DO()];return()=>{t.forEach(e=>e())}}const de=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ke=globalThis,hi=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,xr="9.10.1";function Rr(){return Fa(ke),ke}function Fa(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||xr,e[xr]=e[xr]||{}}function Wu(t,e,n=ke){const r=n.__SENTRY__=n.__SENTRY__||{},i=r[xr]=r[xr]||{};return i[t]||(i[t]=e())}const FO="Sentry Logger ",zu=["debug","info","warn","error","log","assert","trace"],Vu={};function Ji(t){if(!("console"in ke))return t();const e=ke.console,n={},r=Object.keys(Vu);r.forEach(i=>{const s=Vu[i];n[i]=e[i],e[i]=s});try{return t()}finally{r.forEach(i=>{e[i]=n[i]})}}function $O(){let t=!1;const e={enable:()=>{t=!0},disable:()=>{t=!1},isEnabled:()=>t};return hi?zu.forEach(n=>{e[n]=(...r)=>{t&&Ji(()=>{ke.console[n](`${FO}[${n}]:`,...r)})}}):zu.forEach(n=>{e[n]=()=>{}}),e}const L=Wu("logger",$O),Ob=50,ur="?",Lb=/\(error: (.*)\)/,Db=/captureMessage|captureException/;function Nb(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,i=0)=>{const s=[],o=n.split(`
`);for(let a=r;a<o.length;a++){const c=o[a];if(c.length>1024)continue;const u=Lb.test(c)?c.replace(Lb,"$1"):c;if(!u.match(/\S*Error: /)){for(const d of e){const l=d(u);if(l){s.push(l);break}}if(s.length>=Ob+i)break}}return BO(s.slice(i))}}function UO(t){return Array.isArray(t)?Nb(...t):t}function BO(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(Ku(e).function||"")&&e.pop(),e.reverse(),Db.test(Ku(e).function||"")&&(e.pop(),Db.test(Ku(e).function||"")&&e.pop()),e.slice(0,Ob).map(n=>({...n,filename:n.filename||Ku(e).filename,function:n.function||ur}))}function Ku(t){return t[t.length-1]||{}}const Eh="<anonymous>";function Ar(t){try{return!t||typeof t!="function"?Eh:t.name||Eh}catch{return Eh}}function kh(t){const e=t.exception;if(e){const n=[];try{return e.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}const Gu={},Fb={};function pi(t,e){Gu[t]=Gu[t]||[],Gu[t].push(e)}function gi(t,e){if(!Fb[t]){Fb[t]=!0;try{e()}catch(n){hi&&L.error(`Error while instrumenting ${t}`,n)}}}function Rn(t,e){const n=t&&Gu[t];if(n)for(const r of n)try{r(e)}catch(i){hi&&L.error(`Error while triggering instrumentation handler.
Type: ${t}
Name: ${Ar(r)}
Error:`,i)}}let Ch=null;function $b(t){const e="error";pi(e,t),gi(e,jO)}function jO(){Ch=ke.onerror,ke.onerror=function(t,e,n,r,i){return Rn("error",{column:r,error:i,line:n,msg:t,url:e}),Ch?Ch.apply(this,arguments):!1},ke.onerror.__SENTRY_INSTRUMENTED__=!0}let Th=null;function Ub(t){const e="unhandledrejection";pi(e,t),gi(e,HO)}function HO(){Th=ke.onunhandledrejection,ke.onunhandledrejection=function(t){return Rn("unhandledrejection",t),Th?Th.apply(this,arguments):!0},ke.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Bb=1e3;function $a(){return Date.now()/Bb}function qO(){const{performance:t}=ke;if(!(t!=null&&t.now))return $a;const e=Date.now()-t.now(),n=t.timeOrigin==null?e:t.timeOrigin;return()=>(n+t.now())/Bb}const At=qO();let Ih;function WO(){var d;const{performance:t}=ke;if(!(t!=null&&t.now))return[void 0,"none"];const e=3600*1e3,n=t.now(),r=Date.now(),i=t.timeOrigin?Math.abs(t.timeOrigin+n-r):e,s=i<e,o=(d=t.timing)==null?void 0:d.navigationStart,c=typeof o=="number"?Math.abs(o+n-r):e,u=c<e;return s||u?i<=c?[t.timeOrigin,"timeOrigin"]:[o,"navigationStart"]:[r,"dateNow"]}function dn(){return Ih||(Ih=WO()),Ih[0]}const jb=Object.prototype.toString;function mi(t){switch(jb.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Pr(t,Error)}}function Ks(t,e){return jb.call(t)===`[object ${e}]`}function Hb(t){return Ks(t,"ErrorEvent")}function qb(t){return Ks(t,"DOMError")}function zO(t){return Ks(t,"DOMException")}function Vn(t){return Ks(t,"String")}function Yu(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function xh(t){return t===null||Yu(t)||typeof t!="object"&&typeof t!="function"}function Gs(t){return Ks(t,"Object")}function Zu(t){return typeof Event<"u"&&Pr(t,Event)}function VO(t){return typeof Element<"u"&&Pr(t,Element)}function KO(t){return Ks(t,"RegExp")}function Ua(t){return!!(t!=null&&t.then&&typeof t.then=="function")}function GO(t){return Gs(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function Pr(t,e){try{return t instanceof e}catch{return!1}}function Wb(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue))}const Rh=ke,YO=80;function Mr(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,i=[];let s=0,o=0;const a=" > ",c=a.length;let u;const d=Array.isArray(e)?e:e.keyAttrs,l=!Array.isArray(e)&&e.maxStringLength||YO;for(;n&&s++<r&&(u=ZO(n,d),!(u==="html"||s>1&&o+i.length*c+u.length>=l));)i.push(u),o+=u.length,n=n.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function ZO(t,e){const n=t,r=[];if(!(n!=null&&n.tagName))return"";if(Rh.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const i=e!=null&&e.length?e.filter(o=>n.getAttribute(o)).map(o=>[o,n.getAttribute(o)]):null;if(i!=null&&i.length)i.forEach(o=>{r.push(`[${o[0]}="${o[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const o=n.className;if(o&&Vn(o)){const a=o.split(/\s+/);for(const c of a)r.push(`.${c}`)}}const s=["aria-label","type","name","title","alt"];for(const o of s){const a=n.getAttribute(o);a&&r.push(`[${o}="${a}"]`)}return r.join("")}function Qi(){try{return Rh.document.location.href}catch{return""}}function zb(t){if(!Rh.HTMLElement)return null;let e=t;const n=5;for(let r=0;r<n;r++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function Or(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function Ah(t,e){let n=t;const r=n.length;if(r<=150)return n;e>r&&(e=r);let i=Math.max(e-60,0);i<5&&(i=0);let s=Math.min(i+140,r);return s>r-5&&(s=r),s===r&&(i=Math.max(s-140,0)),n=n.slice(i,s),i>0&&(n=`'{snip} ${n}`),s<r&&(n+=" {snip}"),n}function Xu(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const i=t[r];try{Wb(i)?n.push("[VueViewModel]"):n.push(String(i))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function XO(t,e,n=!1){return Vn(t)?KO(e)?e.test(t):Vn(e)?n?t===e:t.includes(e):!1:!1}function lr(t,e=[],n=!1){return e.some(r=>XO(t,r,n))}function tn(t,e,n){if(!(e in t))return;const r=t[e];if(typeof r!="function")return;const i=n(r);typeof i=="function"&&Vb(i,r);try{t[e]=i}catch{hi&&L.log(`Failed to replace method "${e}" in object`,t)}}function fn(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{hi&&L.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function Vb(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,fn(t,"__sentry_original__",e)}catch{}}function Ph(t){return t.__sentry_original__}function Kb(t){if(mi(t))return{message:t.message,name:t.name,stack:t.stack,...Yb(t)};if(Zu(t)){const e={type:t.type,target:Gb(t.target),currentTarget:Gb(t.currentTarget),...Yb(t)};return typeof CustomEvent<"u"&&Pr(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function Gb(t){try{return VO(t)?Mr(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function Yb(t){if(typeof t=="object"&&t!==null){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}else return{}}function JO(t,e=40){const n=Object.keys(Kb(t));n.sort();const r=n[0];if(!r)return"[object has no keys]";if(r.length>=e)return Or(r,e);for(let i=n.length;i>0;i--){const s=n.slice(0,i).join(", ");if(!(s.length>e))return i===n.length?s:Or(s,e)}return""}function QO(){const t=ke;return t.crypto||t.msCrypto}function nn(t=QO()){let e=()=>Math.random()*16;try{if(t!=null&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t!=null&&t.getRandomValues&&(e=()=>{const n=new Uint8Array(1);return t.getRandomValues(n),n[0]})}catch{}return("10000000100040008000"+1e11).replace(/[018]/g,n=>(n^(e()&15)>>n/4).toString(16))}function Zb(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)==null?void 0:n[0]}function es(t){const{message:e,event_id:n}=t;if(e)return e;const r=Zb(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Mh(t,e,n){const r=t.exception=t.exception||{},i=r.values=r.values||[],s=i[0]=i[0]||{};s.value||(s.value=e||""),s.type||(s.type="Error")}function vi(t,e){const n=Zb(t);if(!n)return;const r={type:"generic",handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...e},e&&"data"in e){const s={...i==null?void 0:i.data,...e.data};n.mechanism.data=s}}function eL(t,e,n=5){if(e.lineno===void 0)return;const r=t.length,i=Math.max(Math.min(r-1,e.lineno-1),0);e.pre_context=t.slice(Math.max(0,i-n),i).map(o=>Ah(o,0));const s=Math.min(r-1,i);e.context_line=Ah(t[s],e.colno||0),e.post_context=t.slice(Math.min(i+1,r),i+1+n).map(o=>Ah(o,0))}function Xb(t){if(tL(t))return!0;try{fn(t,"__sentry_captured__",!0)}catch{}return!1}function tL(t){try{return t.__sentry_captured__}catch{}}var Lr;(function(t){t[t.PENDING=0]="PENDING";const n=1;t[t.RESOLVED=n]="RESOLVED";const r=2;t[t.REJECTED=r]="REJECTED"})(Lr||(Lr={}));function Dr(t){return new _i(e=>{e(t)})}function Ju(t){return new _i((e,n)=>{n(t)})}class _i{constructor(e){this._state=Lr.PENDING,this._handlers=[],this._runExecutor(e)}then(e,n){return new _i((r,i)=>{this._handlers.push([!1,s=>{if(!e)r(s);else try{r(e(s))}catch(o){i(o)}},s=>{if(!n)i(s);else try{r(n(s))}catch(o){i(o)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new _i((n,r)=>{let i,s;return this.then(o=>{s=!1,i=o,e&&e()},o=>{s=!0,i=o,e&&e()}).then(()=>{if(s){r(i);return}n(i)})})}_executeHandlers(){if(this._state===Lr.PENDING)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===Lr.RESOLVED&&n[1](this._value),this._state===Lr.REJECTED&&n[2](this._value),n[0]=!0)})}_runExecutor(e){const n=(s,o)=>{if(this._state===Lr.PENDING){if(Ua(o)){o.then(r,i);return}this._state=s,this._value=o,this._executeHandlers()}},r=s=>{n(Lr.RESOLVED,s)},i=s=>{n(Lr.REJECTED,s)};try{e(r,i)}catch(s){i(s)}}}function nL(t){const e=At(),n={sid:nn(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>iL(n)};return t&&Ys(n,t),n}function Ys(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||At(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:nn()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function rL(t,e){let n={};t.status==="ok"&&(n={status:"exited"}),Ys(t,n)}function iL(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function Nr(){return nn()}function Ba(){return nn().substring(16)}function ja(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;const r={...t};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=ja(r[i],e[i],n-1));return r}const Oh="_sentrySpan";function ts(t,e){e?fn(t,Oh,e):delete t[Oh]}function Zs(t){return t[Oh]}const sL=100;class Kn{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:Nr(),sampleRand:Math.random()}}clone(){const e=new Kn;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,ts(e,Zs(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Ys(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this._tags={...this._tags,[e]:n},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,r=n instanceof Kn?n.getScopeData():Gs(n)?e:void 0,{tags:i,extra:s,user:o,contexts:a,level:c,fingerprint:u=[],propagationContext:d}=r||{};return this._tags={...this._tags,...i},this._extra={...this._extra,...s},this._contexts={...this._contexts,...a},o&&Object.keys(o).length&&(this._user=o),c&&(this._level=c),u.length&&(this._fingerprint=u),d&&(this._propagationContext=d),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._session=void 0,ts(this,void 0),this._attachments=[],this.setPropagationContext({traceId:Nr(),sampleRand:Math.random()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){var s;const r=typeof n=="number"?n:sL;if(r<=0)return this;const i={timestamp:$a(),...e,message:e.message?Or(e.message,2048):e.message};return this._breadcrumbs.push(i),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),(s=this._client)==null||s.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Zs(this)}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=ja(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=(n==null?void 0:n.event_id)||nn();if(!this._client)return L.warn("No client configured on scope - will not capture exception!"),r;const i=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureMessage(e,n,r){const i=(r==null?void 0:r.event_id)||nn();if(!this._client)return L.warn("No client configured on scope - will not capture message!"),i;const s=new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:s,...r,event_id:i},this),i}captureEvent(e,n){const r=(n==null?void 0:n.event_id)||nn();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(L.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function oL(){return Wu("defaultCurrentScope",()=>new Kn)}function aL(){return Wu("defaultIsolationScope",()=>new Kn)}class cL{constructor(e,n){let r;e?r=e:r=new Kn;let i;n?i=n:i=new Kn,this._stack=[{scope:r}],this._isolationScope=i}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(i){throw this._popScope(),i}return Ua(r)?r.then(i=>(this._popScope(),i),i=>{throw this._popScope(),i}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Xs(){const t=Rr(),e=Fa(t);return e.stack=e.stack||new cL(oL(),aL())}function uL(t){return Xs().withScope(t)}function lL(t,e){const n=Xs();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function Jb(t){return Xs().withScope(()=>t(Xs().getIsolationScope()))}function dL(){return{withIsolationScope:Jb,withScope:uL,withSetScope:lL,withSetIsolationScope:(t,e)=>Jb(e),getCurrentScope:()=>Xs().getScope(),getIsolationScope:()=>Xs().getIsolationScope()}}function yi(t){const e=Fa(t);return e.acs?e.acs:dL()}function Be(){const t=Rr();return yi(t).getCurrentScope()}function Pt(){const t=Rr();return yi(t).getIsolationScope()}function Lh(){return Wu("globalScope",()=>new Kn)}function Gn(...t){const e=Rr(),n=yi(e);if(t.length===2){const[r,i]=t;return r?n.withSetScope(r,i):n.withScope(i)}return n.withScope(t[0])}function fL(...t){const e=Rr(),n=yi(e);if(t.length===2){const[r,i]=t;return r?n.withSetIsolationScope(r,i):n.withIsolationScope(i)}return n.withIsolationScope(t[0])}function oe(){return Be().getClient()}function Qb(t){const e=t.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:i}=e,s={trace_id:n,span_id:i||Ba()};return r&&(s.parent_span_id=r),s}const An="sentry.source",Dh="sentry.sample_rate",Fr="sentry.op",It="sentry.origin",Nh="sentry.idle_span_finish_reason",Qu="sentry.measurement_unit",el="sentry.measurement_value",Fh="sentry.custom_span_name",$h="sentry.profile_id",Ha="sentry.exclusive_time",hL="http.request.method",pL="url.full",gL="sentry.link.type",mL=0,e0=1,Ct=2;function t0(t){if(t<400&&t>=100)return{code:e0};if(t>=400&&t<500)switch(t){case 401:return{code:Ct,message:"unauthenticated"};case 403:return{code:Ct,message:"permission_denied"};case 404:return{code:Ct,message:"not_found"};case 409:return{code:Ct,message:"already_exists"};case 413:return{code:Ct,message:"failed_precondition"};case 429:return{code:Ct,message:"resource_exhausted"};case 499:return{code:Ct,message:"cancelled"};default:return{code:Ct,message:"invalid_argument"}}if(t>=500&&t<600)switch(t){case 501:return{code:Ct,message:"unimplemented"};case 503:return{code:Ct,message:"unavailable"};case 504:return{code:Ct,message:"deadline_exceeded"};default:return{code:Ct,message:"internal_error"}}return{code:Ct,message:"unknown_error"}}function Uh(t,e){t.setAttribute("http.response.status_code",e);const n=t0(e);n.message!=="unknown_error"&&t.setStatus(n)}const n0="_sentryScope",r0="_sentryIsolationScope";function vL(t,e,n){t&&(fn(t,r0,n),fn(t,n0,e))}function tl(t){return{scope:t[n0],isolationScope:t[r0]}}function ns(t){if(typeof t=="boolean")return Number(t);const e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const Bh="sentry-",_L=/^sentry-/,yL=8192;function i0(t){const e=bL(t);if(!e)return;const n=Object.entries(e).reduce((r,[i,s])=>{if(i.match(_L)){const o=i.slice(Bh.length);r[o]=s}return r},{});if(Object.keys(n).length>0)return n}function s0(t){if(!t)return;const e=Object.entries(t).reduce((n,[r,i])=>(i&&(n[`${Bh}${r}`]=i),n),{});return wL(e)}function bL(t){if(!(!t||!Vn(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{const r=o0(n);return Object.entries(r).forEach(([i,s])=>{e[i]=s}),e},{}):o0(t)}function o0(t){return t.split(",").map(e=>e.split("=").map(n=>decodeURIComponent(n.trim()))).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}function wL(t){if(Object.keys(t).length!==0)return Object.entries(t).reduce((e,[n,r],i)=>{const s=`${encodeURIComponent(n)}=${encodeURIComponent(r)}`,o=i===0?s:`${e},${s}`;return o.length>yL?(hi&&L.warn(`Not adding key: ${n} with val: ${r} to baggage header due to exceeding baggage size limits.`),e):o},"")}const a0=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function SL(t){if(!t)return;const e=t.match(a0);if(!e)return;let n;return e[3]==="1"?n=!0:e[3]==="0"&&(n=!1),{traceId:e[1],parentSampled:n,parentSpanId:e[2]}}function c0(t,e){const n=SL(t),r=i0(e);if(!(n!=null&&n.traceId))return{traceId:Nr(),sampleRand:Math.random()};const i=EL(n,r);r&&(r.sample_rand=i.toString());const{traceId:s,parentSpanId:o,parentSampled:a}=n;return{traceId:s,parentSpanId:o,sampled:a,dsc:r||{},sampleRand:i}}function u0(t=Nr(),e=Ba(),n){let r="";return n!==void 0&&(r=n?"-1":"-0"),`${t}-${e}${r}`}function EL(t,e){const n=ns(e==null?void 0:e.sample_rand);if(n!==void 0)return n;const r=ns(e==null?void 0:e.sample_rate);return r&&(t==null?void 0:t.parentSampled)!==void 0?t.parentSampled?Math.random()*r:r+Math.random()*(1-r):Math.random()}const l0=0,jh=1;let d0=!1;function kL(t){const{spanId:e,traceId:n}=t.spanContext(),{data:r,op:i,parent_span_id:s,status:o,origin:a,links:c}=Re(t);return{parent_span_id:s,span_id:e,trace_id:n,data:r,op:i,status:o,origin:a,links:c}}function f0(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext(),i=r?e:Re(t).parent_span_id,s=tl(t).scope,o=r?(s==null?void 0:s.getPropagationContext().propagationSpanId)||Ba():e;return{parent_span_id:i,span_id:o,trace_id:n}}function h0(t){const{traceId:e,spanId:n}=t.spanContext(),r=is(t);return u0(e,n,r)}function p0(t){if(t&&t.length>0)return t.map(({context:{spanId:e,traceId:n,traceFlags:r,...i},attributes:s})=>({span_id:e,trace_id:n,sampled:r===jh,attributes:s,...i}))}function rs(t){return typeof t=="number"?g0(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?g0(t.getTime()):At()}function g0(t){return t>9999999999?t/1e3:t}function Re(t){if(TL(t))return t.getSpanJSON();const{spanId:e,traceId:n}=t.spanContext();if(CL(t)){const{attributes:r,startTime:i,name:s,endTime:o,parentSpanId:a,status:c,links:u}=t;return{span_id:e,trace_id:n,data:r,description:s,parent_span_id:a,start_timestamp:rs(i),timestamp:rs(o)||void 0,status:m0(c),op:r[Fr],origin:r[It],links:p0(u)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function CL(t){const e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function TL(t){return typeof t.getSpanJSON=="function"}function is(t){const{traceFlags:e}=t.spanContext();return e===jh}function m0(t){if(!(!t||t.code===mL))return t.code===e0?"ok":t.message||"unknown_error"}const ss="_sentryChildSpans",Hh="_sentryRootSpan";function v0(t,e){const n=t[Hh]||t;fn(e,Hh,n),t[ss]?t[ss].add(e):fn(t,ss,new Set([e]))}function IL(t,e){t[ss]&&t[ss].delete(e)}function qa(t){const e=new Set;function n(r){if(!e.has(r)&&is(r)){e.add(r);const i=r[ss]?Array.from(r[ss]):[];for(const s of i)n(s)}}return n(t),Array.from(e)}function xt(t){return t[Hh]||t}function $t(){const t=Rr(),e=yi(t);return e.getActiveSpan?e.getActiveSpan():Zs(Be())}function qh(){d0||(Ji(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly.")}),d0=!0)}function xL(t,e){t.updateName(e),t.setAttributes({[An]:"custom",[Fh]:e})}let _0=!1;function y0(){_0||(_0=!0,$b(Wh),Ub(Wh))}function Wh(){const t=$t(),e=t&&xt(t);if(e){const n="internal_error";de&&L.log(`[Tracing] Root span: ${n} -> Global error occurred`),e.setStatus({code:Ct,message:n})}}Wh.tag="sentry_tracingErrorCallback";function bi(t){var n;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=t||((n=oe())==null?void 0:n.getOptions());return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}const nl="production",b0="_frozenDsc";function rl(t,e){fn(t,b0,e)}function w0(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},i={environment:n.environment||nl,release:n.release,public_key:r,trace_id:t};return e.emit("createDsc",i),i}function zh(t,e){const n=e.getPropagationContext();return n.dsc||w0(n.traceId,t)}function Yn(t){var p;const e=oe();if(!e)return{};const n=xt(t),r=Re(n),i=r.data,s=n.spanContext().traceState,o=(s==null?void 0:s.get("sentry.sample_rate"))??i[Dh];function a(g){return(typeof o=="number"||typeof o=="string")&&(g.sample_rate=`${o}`),g}const c=n[b0];if(c)return a(c);const u=s==null?void 0:s.get("sentry.dsc"),d=u&&i0(u);if(d)return a(d);const l=w0(t.spanContext().traceId,e),h=i[An],f=r.description;return h!=="url"&&f&&(l.transaction=f),bi()&&(l.sampled=String(is(n)),l.sample_rand=(s==null?void 0:s.get("sentry.sample_rand"))??((p=tl(n).scope)==null?void 0:p.getPropagationContext().sampleRand.toString())),a(l),e.emit("createDsc",l,n),l}function RL(t){const e=Yn(t);return s0(e)}class $r{constructor(e={}){this._traceId=e.traceId||Nr(),this._spanId=e.spanId||Ba()}spanContext(){return{spanId:this._spanId,traceId:this._traceId,traceFlags:l0}}end(e){}setAttribute(e,n){return this}setAttributes(e){return this}setStatus(e){return this}updateName(e){return this}isRecording(){return!1}addEvent(e,n,r){return this}addLink(e){return this}addLinks(e){return this}recordException(e,n){}}function S0(t,e,n=()=>{}){let r;try{r=t()}catch(i){throw e(i),n(),i}return AL(r,e,n)}function AL(t,e,n){return Ua(t)?t.then(r=>(n(),r),r=>{throw e(r),n(),r}):(n(),t)}function PL(t){if(!de)return;const{description:e="< unknown name >",op:n="< unknown op >",parent_span_id:r}=Re(t),{spanId:i}=t.spanContext(),s=is(t),o=xt(t),a=o===t,c=`[Tracing] Starting ${s?"sampled":"unsampled"} ${a?"root ":""}span`,u=[`op: ${n}`,`name: ${e}`,`ID: ${i}`];if(r&&u.push(`parent ID: ${r}`),!a){const{op:d,description:l}=Re(o);u.push(`root ID: ${o.spanContext().spanId}`),d&&u.push(`root op: ${d}`),l&&u.push(`root description: ${l}`)}L.log(`${c}
${u.join(`
`)}`)}function ML(t){if(!de)return;const{description:e="< unknown name >",op:n="< unknown op >"}=Re(t),{spanId:r}=t.spanContext(),s=xt(t)===t,o=`[Tracing] Finishing "${n}" ${s?"root ":""}span "${e}" with ID ${r}`;L.log(o)}function OL(t,e,n){if(!bi(t))return[!1];let r,i;typeof t.tracesSampler=="function"?(i=t.tracesSampler({...e,inheritOrSampleWith:a=>typeof e.parentSampleRate=="number"?e.parentSampleRate:typeof e.parentSampled=="boolean"?Number(e.parentSampled):a}),r=!0):e.parentSampled!==void 0?i=e.parentSampled:typeof t.tracesSampleRate<"u"&&(i=t.tracesSampleRate,r=!0);const s=ns(i);if(s===void 0)return de&&L.warn(`[Tracing] Discarding root span because of invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(i)} of type ${JSON.stringify(typeof i)}.`),[!1];if(!s)return de&&L.log(`[Tracing] Discarding transaction because ${typeof t.tracesSampler=="function"?"tracesSampler returned 0 or false":"a negative sampling decision was inherited or tracesSampleRate is set to 0"}`),[!1,s,r];const o=n<s;return o||de&&L.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(i)})`),[o,s,r]}const LL=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function DL(t){return t==="http"||t==="https"}function os(t,e=!1){const{host:n,path:r,pass:i,port:s,projectId:o,protocol:a,publicKey:c}=t;return`${a}://${c}${e&&i?`:${i}`:""}@${n}${s?`:${s}`:""}/${r&&`${r}/`}${o}`}function E0(t){const e=LL.exec(t);if(!e){Ji(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[n,r,i="",s="",o="",a=""]=e.slice(1);let c="",u=a;const d=u.split("/");if(d.length>1&&(c=d.slice(0,-1).join("/"),u=d.pop()),u){const l=u.match(/^\d+/);l&&(u=l[0])}return k0({host:s,pass:i,path:c,projectId:u,port:o,protocol:n,publicKey:r})}function k0(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function NL(t){if(!hi)return!0;const{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(o=>t[o]?!1:(L.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?DL(r)?e&&isNaN(parseInt(e,10))?(L.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(L.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(L.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function C0(t){const e=typeof t=="string"?E0(t):k0(t);if(!(!e||!NL(e)))return e}function Pn(t,e=100,n=1/0){try{return Vh("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function T0(t,e=3,n=102400){const r=Pn(t,e);return BL(r)>n?T0(t,e-1,n):r}function Vh(t,e,n=1/0,r=1/0,i=jL()){const[s,o]=i;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=FL(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const c=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(c===0)return a.replace("object ","");if(s(e))return"[Circular ~]";const u=e;if(u&&typeof u.toJSON=="function")try{const f=u.toJSON();return Vh("",f,c-1,r,i)}catch{}const d=Array.isArray(e)?[]:{};let l=0;const h=Kb(e);for(const f in h){if(!Object.prototype.hasOwnProperty.call(h,f))continue;if(l>=r){d[f]="[MaxProperties ~]";break}const p=h[f];d[f]=Vh(f,p,c-1,r,i),l++}return o(e),d}function FL(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(Wb(e))return"[VueViewModel]";if(GO(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${Ar(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=$L(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function $L(t){const e=Object.getPrototypeOf(t);return e!=null&&e.constructor?e.constructor.name:"null prototype"}function UL(t){return~-encodeURI(t).split(/%..|./).length}function BL(t){return UL(JSON.stringify(t))}function jL(){const t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}function Ur(t,e=[]){return[t,e]}function HL(t,e){const[n,r]=t;return[n,[...r,e]]}function as(t,e){const n=t[1];for(const r of n){const i=r[0].type;if(e(r,i))return!0}return!1}function I0(t,e){return as(t,(n,r)=>e.includes(r))}function il(t){const e=Fa(ke);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function qL(t){const e=Fa(ke);return e.decodePolyfill?e.decodePolyfill(t):new TextDecoder().decode(t)}function sl(t){const[e,n]=t;let r=JSON.stringify(e);function i(s){typeof r=="string"?r=typeof s=="string"?r+s:[il(r),s]:r.push(typeof s=="string"?il(s):s)}for(const s of n){const[o,a]=s;if(i(`
${JSON.stringify(o)}
`),typeof a=="string"||a instanceof Uint8Array)i(a);else{let c;try{c=JSON.stringify(a)}catch{c=JSON.stringify(Pn(a))}i(c)}}return typeof r=="string"?r:WL(r)}function WL(t){const e=t.reduce((i,s)=>i+s.length,0),n=new Uint8Array(e);let r=0;for(const i of t)n.set(i,r),r+=i.length;return n}function zL(t){let e=typeof t=="string"?il(t):t;function n(o){const a=e.subarray(0,o);return e=e.subarray(o+1),a}function r(){let o=e.indexOf(10);return o<0&&(o=e.length),JSON.parse(qL(n(o)))}const i=r(),s=[];for(;e.length;){const o=r(),a=typeof o.length=="number"?o.length:void 0;s.push([o,a?n(a):r()])}return[i,s]}function VL(t){return[{type:"span"},t]}function KL(t){const e=typeof t.data=="string"?il(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}const GL={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",otel_log:"log_item"};function x0(t){return GL[t]}function Kh(t){if(!(t!=null&&t.sdk))return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function R0(t,e,n,r){var s;const i=(s=t.sdkProcessingMetadata)==null?void 0:s.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:os(r)},...i&&{trace:i}}}function YL(t,e){return e&&(t.sdk=t.sdk||{},t.sdk.name=t.sdk.name||e.name,t.sdk.version=t.sdk.version||e.version,t.sdk.integrations=[...t.sdk.integrations||[],...e.integrations||[]],t.sdk.packages=[...t.sdk.packages||[],...e.packages||[]]),t}function ZL(t,e,n,r){const i=Kh(n),s={sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&e&&{dsn:os(e)}},o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return Ur(s,[o])}function XL(t,e,n,r){const i=Kh(n),s=t.type&&t.type!=="replay_event"?t.type:"event";YL(t,n==null?void 0:n.sdk);const o=R0(t,i,r,e);return delete t.sdkProcessingMetadata,Ur(o,[[{type:s},t]])}function JL(t,e){function n(d){return!!d.trace_id&&!!d.public_key}const r=Yn(t[0]),i=e==null?void 0:e.getDsn(),s=e==null?void 0:e.getOptions().tunnel,o={sent_at:new Date().toISOString(),...n(r)&&{trace:r},...!!s&&i&&{dsn:os(i)}},a=e==null?void 0:e.getOptions().beforeSendSpan,c=a?d=>{const l=Re(d),h=a(l);return h||(qh(),l)}:Re,u=[];for(const d of t){const l=c(d);l&&u.push(VL(l))}return Ur(o,u)}function A0(t,e,n,r=$t()){const i=r&&xt(r);i&&(de&&L.log(`[Measurement] Setting measurement on root span: ${t} = ${e} ${n}`),i.addEvent(t,{[el]:e,[Qu]:n}))}function P0(t){if(!t||t.length===0)return;const e={};return t.forEach(n=>{const r=n.attributes||{},i=r[Qu],s=r[el];typeof i=="string"&&typeof s=="number"&&(e[n.name]={value:s,unit:i})}),e}const M0=1e3;class Gh{constructor(e={}){this._traceId=e.traceId||Nr(),this._spanId=e.spanId||Ba(),this._startTime=e.startTimestamp||At(),this._links=e.links,this._attributes={},this.setAttributes({[It]:"manual",[Fr]:e.op,...e.attributes}),this._name=e.name,e.parentSpanId&&(this._parentSpanId=e.parentSpanId),"sampled"in e&&(this._sampled=e.sampled),e.endTimestamp&&(this._endTime=e.endTimestamp),this._events=[],this._isStandaloneSpan=e.isStandalone,this._endTime&&this._onSpanEnded()}addLink(e){return this._links?this._links.push(e):this._links=[e],this}addLinks(e){return this._links?this._links.push(...e):this._links=e,this}recordException(e,n){}spanContext(){const{_spanId:e,_traceId:n,_sampled:r}=this;return{spanId:e,traceId:n,traceFlags:r?jh:l0}}setAttribute(e,n){return n===void 0?delete this._attributes[e]:this._attributes[e]=n,this}setAttributes(e){return Object.keys(e).forEach(n=>this.setAttribute(n,e[n])),this}updateStartTime(e){this._startTime=rs(e)}setStatus(e){return this._status=e,this}updateName(e){return this._name=e,this.setAttribute(An,"custom"),this}end(e){this._endTime||(this._endTime=rs(e),ML(this),this._onSpanEnded())}getSpanJSON(){return{data:this._attributes,description:this._name,op:this._attributes[Fr],parent_span_id:this._parentSpanId,span_id:this._spanId,start_timestamp:this._startTime,status:m0(this._status),timestamp:this._endTime,trace_id:this._traceId,origin:this._attributes[It],profile_id:this._attributes[$h],exclusive_time:this._attributes[Ha],measurements:P0(this._events),is_segment:this._isStandaloneSpan&&xt(this)===this||void 0,segment_id:this._isStandaloneSpan?xt(this).spanContext().spanId:void 0,links:p0(this._links)}}isRecording(){return!this._endTime&&!!this._sampled}addEvent(e,n,r){de&&L.log("[Tracing] Adding an event to span:",e);const i=O0(n)?n:r||At(),s=O0(n)?{}:n||{},o={name:e,time:rs(i),attributes:s};return this._events.push(o),this}isStandaloneSpan(){return!!this._isStandaloneSpan}_onSpanEnded(){const e=oe();if(e&&e.emit("spanEnd",this),!(this._isStandaloneSpan||this===xt(this)))return;if(this._isStandaloneSpan){this._sampled?eD(JL([this],e)):(de&&L.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled."),e&&e.recordDroppedEvent("sample_rate","span"));return}const r=this._convertSpanToTransaction();r&&(tl(this).scope||Be()).captureEvent(r)}_convertSpanToTransaction(){if(!L0(Re(this)))return;this._name||(de&&L.warn("Transaction has no name, falling back to `<unlabeled transaction>`."),this._name="<unlabeled transaction>");const{scope:e,isolationScope:n}=tl(this);if(this._sampled!==!0)return;const i=qa(this).filter(u=>u!==this&&!QL(u)).map(u=>Re(u)).filter(L0),s=this._attributes[An];delete this._attributes[Fh],i.forEach(u=>{delete u.data[Fh]});const o={contexts:{trace:kL(this)},spans:i.length>M0?i.sort((u,d)=>u.start_timestamp-d.start_timestamp).slice(0,M0):i,start_timestamp:this._startTime,timestamp:this._endTime,transaction:this._name,type:"transaction",sdkProcessingMetadata:{capturedSpanScope:e,capturedSpanIsolationScope:n,dynamicSamplingContext:Yn(this)},...s&&{transaction_info:{source:s}}},a=P0(this._events);return a&&Object.keys(a).length&&(de&&L.log("[Measurements] Adding measurements to transaction event",JSON.stringify(a,void 0,2)),o.measurements=a),o}}function O0(t){return t&&typeof t=="number"||t instanceof Date||Array.isArray(t)}function L0(t){return!!t.start_timestamp&&!!t.timestamp&&!!t.span_id&&!!t.trace_id}function QL(t){return t instanceof Gh&&t.isStandaloneSpan()}function eD(t){const e=oe();if(!e)return;const n=t[1];if(!n||n.length===0){e.recordDroppedEvent("before_send","span");return}e.sendEnvelope(t)}const Yh="__SENTRY_SUPPRESS_TRACING__";function tD(t,e){const n=za();if(n.startSpan)return n.startSpan(t,e);const r=Xh(t),{forceTransaction:i,parentSpan:s,scope:o}=t,a=o==null?void 0:o.clone();return Gn(a,()=>N0(s)(()=>{const u=Be(),d=Jh(u),h=t.onlyIfParent&&!d?new $r:Zh({parentSpan:d,spanArguments:r,forceTransaction:i,scope:u});return ts(u,h),S0(()=>e(h),()=>{const{status:f}=Re(h);h.isRecording()&&(!f||f==="ok")&&h.setStatus({code:Ct,message:"internal_error"})},()=>{h.end()})}))}function nD(t,e){const n=za();if(n.startSpanManual)return n.startSpanManual(t,e);const r=Xh(t),{forceTransaction:i,parentSpan:s,scope:o}=t,a=o==null?void 0:o.clone();return Gn(a,()=>N0(s)(()=>{const u=Be(),d=Jh(u),h=t.onlyIfParent&&!d?new $r:Zh({parentSpan:d,spanArguments:r,forceTransaction:i,scope:u});return ts(u,h),S0(()=>e(h,()=>h.end()),()=>{const{status:f}=Re(h);h.isRecording()&&(!f||f==="ok")&&h.setStatus({code:Ct,message:"internal_error"})})}))}function Js(t){const e=za();if(e.startInactiveSpan)return e.startInactiveSpan(t);const n=Xh(t),{forceTransaction:r,parentSpan:i}=t;return(t.scope?o=>Gn(t.scope,o):i!==void 0?o=>Wa(i,o):o=>o())(()=>{const o=Be(),a=Jh(o);return t.onlyIfParent&&!a?new $r:Zh({parentSpan:a,spanArguments:n,forceTransaction:r,scope:o})})}const rD=(t,e)=>{const n=Rr(),r=yi(n);if(r.continueTrace)return r.continueTrace(t,e);const{sentryTrace:i,baggage:s}=t;return Gn(o=>{const a=c0(i,s);return o.setPropagationContext(a),e()})};function Wa(t,e){const n=za();return n.withActiveSpan?n.withActiveSpan(t,e):Gn(r=>(ts(r,t||void 0),e(r)))}function iD(t){const e=za();return e.suppressTracing?e.suppressTracing(t):Gn(n=>(n.setSDKProcessingMetadata({[Yh]:!0}),t()))}function sD(t){return Gn(e=>(e.setPropagationContext({traceId:Nr(),sampleRand:Math.random()}),de&&L.info(`Starting a new trace with id ${e.getPropagationContext().traceId}`),Wa(null,t)))}function Zh({parentSpan:t,spanArguments:e,forceTransaction:n,scope:r}){if(!bi()){const o=new $r;if(n||!t){const a={sampled:"false",sample_rate:"0",transaction:e.name,...Yn(o)};rl(o,a)}return o}const i=Pt();let s;if(t&&!n)s=oD(t,r,e),v0(t,s);else if(t){const o=Yn(t),{traceId:a,spanId:c}=t.spanContext(),u=is(t);s=D0({traceId:a,parentSpanId:c,...e},r,u),rl(s,o)}else{const{traceId:o,dsc:a,parentSpanId:c,sampled:u}={...i.getPropagationContext(),...r.getPropagationContext()};s=D0({traceId:o,parentSpanId:c,...e},r,u),a&&rl(s,a)}return PL(s),vL(s,r,i),s}function Xh(t){const n={isStandalone:(t.experimental||{}).standalone,...t};if(t.startTime){const r={...n};return r.startTimestamp=rs(t.startTime),delete r.startTime,r}return n}function za(){const t=Rr();return yi(t)}function D0(t,e,n){var h;const r=oe(),i=(r==null?void 0:r.getOptions())||{},{name:s="",attributes:o}=t,a=e.getPropagationContext(),[c,u,d]=e.getScopeData().sdkProcessingMetadata[Yh]?[!1]:OL(i,{name:s,parentSampled:n,attributes:o,parentSampleRate:ns((h=a.dsc)==null?void 0:h.sample_rate)},a.sampleRand),l=new Gh({...t,attributes:{[An]:"custom",[Dh]:u!==void 0&&d?u:void 0,...t.attributes},sampled:c});return!c&&r&&(de&&L.log("[Tracing] Discarding root span because its trace was not chosen to be sampled."),r.recordDroppedEvent("sample_rate","transaction")),r&&r.emit("spanStart",l),l}function oD(t,e,n){const{spanId:r,traceId:i}=t.spanContext(),s=e.getScopeData().sdkProcessingMetadata[Yh]?!1:is(t),o=s?new Gh({...n,parentSpanId:r,traceId:i,sampled:s}):new $r({traceId:i});v0(t,o);const a=oe();return a&&(a.emit("spanStart",o),n.endTimestamp&&a.emit("spanEnd",o)),o}function Jh(t){const e=Zs(t);if(!e)return;const n=oe();return(n?n.getOptions():{}).parentSpanIsAlwaysRootSpan?xt(e):e}function N0(t){return t!==void 0?e=>Wa(t,e):e=>e()}const ol={idleTimeout:1e3,finalTimeout:3e4,childSpanTimeout:15e3},aD="heartbeatFailed",cD="idleTimeout",uD="finalTimeout",lD="externalFinish";function F0(t,e={}){const n=new Map;let r=!1,i,s=lD,o=!e.disableAutoFinish;const a=[],{idleTimeout:c=ol.idleTimeout,finalTimeout:u=ol.finalTimeout,childSpanTimeout:d=ol.childSpanTimeout,beforeSpanEnd:l}=e,h=oe();if(!h||!bi()){const E=new $r,I={sample_rate:"0",sampled:"false",...Yn(E)};return rl(E,I),E}const f=Be(),p=$t(),g=dD(t);g.end=new Proxy(g.end,{apply(E,I,y){if(l&&l(g),I instanceof $r)return;const[b,...k]=y,x=b||At(),R=rs(x),F=qa(g).filter(V=>V!==g);if(!F.length)return C(R),Reflect.apply(E,I,[R,...k]);const z=F.map(V=>Re(V).timestamp).filter(V=>!!V),J=z.length?Math.max(...z):void 0,U=Re(g).start_timestamp,q=Math.min(U?U+u/1e3:1/0,Math.max(U||-1/0,Math.min(R,J||1/0)));return C(q),Reflect.apply(E,I,[q,...k])}});function v(){i&&(clearTimeout(i),i=void 0)}function m(E){v(),i=setTimeout(()=>{!r&&n.size===0&&o&&(s=cD,g.end(E))},c)}function _(E){i=setTimeout(()=>{!r&&o&&(s=aD,g.end(E))},d)}function w(E){v(),n.set(E,!0);const I=At();_(I+d/1e3)}function T(E){if(n.has(E)&&n.delete(E),n.size===0){const I=At();m(I+c/1e3)}}function C(E){r=!0,n.clear(),a.forEach(R=>R()),ts(f,p);const I=Re(g),{start_timestamp:y}=I;if(!y)return;I.data[Nh]||g.setAttribute(Nh,s),L.log(`[Tracing] Idle span "${I.op}" finished`);const k=qa(g).filter(R=>R!==g);let x=0;k.forEach(R=>{R.isRecording()&&(R.setStatus({code:Ct,message:"cancelled"}),R.end(E),de&&L.log("[Tracing] Cancelling span since span ended early",JSON.stringify(R,void 0,2)));const F=Re(R),{timestamp:z=0,start_timestamp:J=0}=F,U=J<=E,q=(u+c)/1e3,V=z-J<=q;if(de){const j=JSON.stringify(R,void 0,2);U?V||L.log("[Tracing] Discarding span since it finished after idle span final timeout",j):L.log("[Tracing] Discarding span since it happened after idle span was finished",j)}(!V||!U)&&(IL(g,R),x++)}),x>0&&g.setAttribute("sentry.idle_span_discarded_spans",x)}return a.push(h.on("spanStart",E=>{if(r||E===g||Re(E).timestamp)return;qa(g).includes(E)&&w(E.spanContext().spanId)})),a.push(h.on("spanEnd",E=>{r||T(E.spanContext().spanId)})),a.push(h.on("idleSpanEnableAutoFinish",E=>{E===g&&(o=!0,m(),n.size&&_())})),e.disableAutoFinish||m(),setTimeout(()=>{r||(g.setStatus({code:Ct,message:"deadline_exceeded"}),s=uD,g.end())},u),g}function dD(t){const e=Js(t);return ts(Be(),e),de&&L.log("[Tracing] Started span is an idle span"),e}function Qh(t,e,n,r=0){return new _i((i,s)=>{const o=t[r];if(e===null||typeof o!="function")i(e);else{const a=o({...e},n);de&&o.id&&a===null&&L.log(`Event processor "${o.id}" dropped event`),Ua(a)?a.then(c=>Qh(t,c,n,r+1).then(i)).then(null,s):Qh(t,a,n,r+1).then(i).then(null,s)}})}let al,$0,cl;function U0(t){const e=ke._sentryDebugIds;if(!e)return{};const n=Object.keys(e);return cl&&n.length===$0||($0=n.length,cl=n.reduce((r,i)=>{al||(al={});const s=al[i];if(s)r[s[0]]=s[1];else{const o=t(i);for(let a=o.length-1;a>=0;a--){const c=o[a],u=c==null?void 0:c.filename,d=e[i];if(u&&d){r[u]=d,al[i]=[u,d];break}}}return r},{})),cl}function fD(t,e){const n=U0(t);if(!n)return[];const r=[];for(const i of e)i&&n[i]&&r.push({type:"sourcemap",code_file:i,debug_id:n[i]});return r}function hD(t,e){const{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:s}=e;pD(t,e),r&&vD(t,r),_D(t,n),gD(t,i),mD(t,s)}function B0(t,e){const{extra:n,tags:r,user:i,contexts:s,level:o,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:u,eventProcessors:d,attachments:l,propagationContext:h,transactionName:f,span:p}=e;ul(t,"extra",n),ul(t,"tags",r),ul(t,"user",i),ul(t,"contexts",s),t.sdkProcessingMetadata=ja(t.sdkProcessingMetadata,a,2),o&&(t.level=o),f&&(t.transactionName=f),p&&(t.span=p),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),u.length&&(t.fingerprint=[...t.fingerprint,...u]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),l.length&&(t.attachments=[...t.attachments,...l]),t.propagationContext={...t.propagationContext,...h}}function ul(t,e,n){t[e]=ja(t[e],n,1)}function pD(t,e){const{extra:n,tags:r,user:i,contexts:s,level:o,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(i).length&&(t.user={...i,...t.user}),Object.keys(s).length&&(t.contexts={...s,...t.contexts}),o&&(t.level=o),a&&t.type!=="transaction"&&(t.transaction=a)}function gD(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function mD(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function vD(t,e){t.contexts={trace:f0(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Yn(e),...t.sdkProcessingMetadata};const n=xt(e),r=Re(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function _D(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}function j0(t,e,n,r,i,s){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=t,c={...e,event_id:e.event_id||n.event_id||nn(),timestamp:e.timestamp||$a()},u=n.integrations||t.integrations.map(v=>v.name);yD(c,t),SD(c,u),i&&i.emit("applyFrameMetadata",e),e.type===void 0&&bD(c,t.stackParser);const d=kD(r,n.captureContext);n.mechanism&&vi(c,n.mechanism);const l=i?i.getEventProcessors():[],h=Lh().getScopeData();if(s){const v=s.getScopeData();B0(h,v)}if(d){const v=d.getScopeData();B0(h,v)}const f=[...n.attachments||[],...h.attachments];f.length&&(n.attachments=f),hD(c,h);const p=[...l,...h.eventProcessors];return Qh(p,c,n).then(v=>(v&&wD(v),typeof o=="number"&&o>0?ED(v,o,a):v))}function yD(t,e){var c,u;const{environment:n,release:r,dist:i,maxValueLength:s=250}=e;t.environment=t.environment||n||nl,!t.release&&r&&(t.release=r),!t.dist&&i&&(t.dist=i),t.message&&(t.message=Or(t.message,s));const o=(u=(c=t.exception)==null?void 0:c.values)==null?void 0:u[0];o!=null&&o.value&&(o.value=Or(o.value,s));const a=t.request;a!=null&&a.url&&(a.url=Or(a.url,s))}function bD(t,e){var r,i;const n=U0(e);(i=(r=t.exception)==null?void 0:r.values)==null||i.forEach(s=>{var o,a;(a=(o=s.stacktrace)==null?void 0:o.frames)==null||a.forEach(c=>{c.filename&&(c.debug_id=n[c.filename])})})}function wD(t){var r,i;const e={};if((i=(r=t.exception)==null?void 0:r.values)==null||i.forEach(s=>{var o,a;(a=(o=s.stacktrace)==null?void 0:o.frames)==null||a.forEach(c=>{c.debug_id&&(c.abs_path?e[c.abs_path]=c.debug_id:c.filename&&(e[c.filename]=c.debug_id),delete c.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([s,o])=>{n.push({type:"sourcemap",code_file:s,debug_id:o})})}function SD(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function ED(t,e,n){var i,s;if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:Pn(o.data,e,n)}}))},...t.user&&{user:Pn(t.user,e,n)},...t.contexts&&{contexts:Pn(t.contexts,e,n)},...t.extra&&{extra:Pn(t.extra,e,n)}};return(i=t.contexts)!=null&&i.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Pn(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>({...o,...o.data&&{data:Pn(o.data,e,n)}}))),(s=t.contexts)!=null&&s.flags&&r.contexts&&(r.contexts.flags=Pn(t.contexts.flags,3,n)),r}function kD(t,e){if(!e)return t;const n=t?t.clone():new Kn;return n.update(e),n}function CD(t){if(t)return TD(t)?{captureContext:t}:xD(t)?{captureContext:t}:t}function TD(t){return t instanceof Kn||typeof t=="function"}const ID=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function xD(t){return Object.keys(t).some(e=>ID.includes(e))}function ll(t,e){return Be().captureException(t,CD(e))}function dl(t,e){const n=typeof e=="string"?e:void 0,r=typeof e!="string"?{captureContext:e}:void 0;return Be().captureMessage(t,n,r)}function Va(t,e){return Be().captureEvent(t,e)}function H0(t,e){Pt().setContext(t,e)}function RD(t){Pt().setExtras(t)}function AD(t,e){Pt().setExtra(t,e)}function PD(t){Pt().setTags(t)}function MD(t,e){Pt().setTag(t,e)}function OD(t){Pt().setUser(t)}function q0(){return Pt().lastEventId()}async function LD(t){const e=oe();return e?e.flush(t):(de&&L.warn("Cannot flush events. No client defined."),Promise.resolve(!1))}async function DD(t){const e=oe();return e?e.close(t):(de&&L.warn("Cannot flush events and disable SDK. No client defined."),Promise.resolve(!1))}function ND(){return!!oe()}function FD(){const t=oe();return(t==null?void 0:t.getOptions().enabled)!==!1&&!!(t!=null&&t.getTransport())}function W0(t){Pt().addEventProcessor(t)}function ep(t){const e=Pt(),n=Be(),{userAgent:r}=ke.navigator||{},i=nL({user:n.getUser()||e.getUser(),...r&&{userAgent:r},...t}),s=e.getSession();return(s==null?void 0:s.status)==="ok"&&Ys(s,{status:"exited"}),tp(),e.setSession(i),i}function tp(){const t=Pt(),n=Be().getSession()||t.getSession();n&&rL(n),z0(),t.setSession()}function z0(){const t=Pt(),e=oe(),n=t.getSession();n&&e&&e.captureSession(n)}function np(t=!1){if(t){tp();return}z0()}const $D="7";function V0(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function UD(t){return`${V0(t)}${t.projectId}/envelope/`}function BD(t,e){const n={sentry_version:$D};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function K0(t,e,n){return e||`${UD(t)}?${BD(t,n)}`}function jD(t,e){const n=C0(t);if(!n)return"";const r=`${V0(n)}embed/error-page/`;let i=`dsn=${os(n)}`;for(const s in e)if(s!=="dsn"&&s!=="onClose")if(s==="user"){const o=e.user;if(!o)continue;o.name&&(i+=`&name=${encodeURIComponent(o.name)}`),o.email&&(i+=`&email=${encodeURIComponent(o.email)}`)}else i+=`&${encodeURIComponent(s)}=${encodeURIComponent(e[s])}`;return`${r}?${i}`}const G0=[];function HD(t){const e={};return t.forEach(n=>{const{name:r}=n,i=e[r];i&&!i.isDefaultInstance&&n.isDefaultInstance||(e[r]=n)}),Object.values(e)}function qD(t){const e=t.defaultIntegrations||[],n=t.integrations;e.forEach(i=>{i.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...e,...n];else if(typeof n=="function"){const i=n(e);r=Array.isArray(i)?i:[i]}else r=e;return HD(r)}function WD(t,e){const n={};return e.forEach(r=>{r&&Z0(t,r,n)}),n}function Y0(t,e){for(const n of e)n!=null&&n.afterAllSetup&&n.afterAllSetup(t)}function Z0(t,e,n){if(n[e.name]){de&&L.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,G0.indexOf(e.name)===-1&&typeof e.setupOnce=="function"&&(e.setupOnce(),G0.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(i,s)=>r(i,s,t))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),i=Object.assign((s,o)=>r(s,o,t),{id:e.name});t.addEventProcessor(i)}de&&L.log(`Integration installed: ${e.name}`)}function rp(t){const e=oe();if(!e){de&&L.warn(`Cannot add integration "${t.name}" because no SDK Client is available.`);return}e.addIntegration(t)}function Jq(t){return t}function zD(t,e,n){const r=[{type:"client_report"},{timestamp:$a(),discarded_events:t}];return Ur(e?{dsn:e}:{},[r])}function X0(t){const e=[];t.message&&e.push(t.message);try{const n=t.exception.values[t.exception.values.length-1];n!=null&&n.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}function VD(t){var c;const{trace_id:e,parent_span_id:n,span_id:r,status:i,origin:s,data:o,op:a}=((c=t.contexts)==null?void 0:c.trace)??{};return{data:o??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:i,timestamp:t.timestamp,trace_id:e??"",origin:s,profile_id:o==null?void 0:o[$h],exclusive_time:o==null?void 0:o[Ha],measurements:t.measurements,is_segment:!0}}function KD(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:{...t.data,...t.profile_id&&{[$h]:t.profile_id},...t.exclusive_time&&{[Ha]:t.exclusive_time}}}},measurements:t.measurements}}const J0="Not capturing exception because it's already been captured.",Q0="Discarded session because of missing or non-string release",ew=Symbol.for("SentryInternalError"),tw=Symbol.for("SentryDoNotSendEventError");function fl(t){return{message:t,[ew]:!0}}function ip(t){return{message:t,[tw]:!0}}function nw(t){return!!t&&typeof t=="object"&&ew in t}function rw(t){return!!t&&typeof t=="object"&&tw in t}class GD{constructor(e){if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=C0(e.dsn):de&&L.warn("No DSN provided, client will not send events."),this._dsn){const n=K0(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:n})}}captureException(e,n,r){const i=nn();if(Xb(e))return de&&L.log(J0),i;const s={event_id:i,...n};return this._process(this.eventFromException(e,s).then(o=>this._captureEvent(o,s,r))),s.event_id}captureMessage(e,n,r,i){const s={event_id:nn(),...r},o=Yu(e)?e:String(e),a=xh(e)?this.eventFromMessage(o,n,s):this.eventFromException(e,s);return this._process(a.then(c=>this._captureEvent(c,s,i))),s.event_id}captureEvent(e,n,r){const i=nn();if(n!=null&&n.originalException&&Xb(n.originalException))return de&&L.log(J0),i;const s={event_id:i,...n},o=e.sdkProcessingMetadata||{},a=o.capturedSpanScope,c=o.capturedSpanIsolationScope;return this._process(this._captureEvent(e,s,a||r,c)),s.event_id}captureSession(e){this.sendSession(e),Ys(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){const n=this._transport;return n?(this.emit("flush"),this._isClientDoneProcessing(e).then(r=>n.flush(e).then(i=>r&&i))):Dr(!0)}close(e){return this.flush(e).then(n=>(this.getOptions().enabled=!1,this.emit("close"),n))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const n=this._integrations[e.name];Z0(this,e,this._integrations),n||Y0(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=XL(e,this._dsn,this._options._metadata,this._options.tunnel);for(const s of n.attachments||[])r=HL(r,KL(s));const i=this.sendEnvelope(r);i&&i.then(s=>this.emit("afterSendEvent",e,s),null)}sendSession(e){const{release:n,environment:r=nl}=this._options;if("aggregates"in e){const s=e.attrs||{};if(!s.release&&!n){de&&L.warn(Q0);return}s.release=s.release||n,s.environment=s.environment||r,e.attrs=s}else{if(!e.release&&!n){de&&L.warn(Q0);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);const i=ZL(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(i)}recordDroppedEvent(e,n,r=1){if(this._options.sendClientReports){const i=`${e}:${n}`;de&&L.log(`Recording outcome: "${i}"${r>1?` (${r} times)`:""}`),this._outcomes[i]=(this._outcomes[i]||0)+r}}on(e,n){const r=this._hooks[e]=this._hooks[e]||[];return r.push(n),()=>{const i=r.indexOf(n);i>-1&&r.splice(i,1)}}emit(e,...n){const r=this._hooks[e];r&&r.forEach(i=>i(...n))}sendEnvelope(e){return this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport?this._transport.send(e).then(null,n=>(de&&L.error("Error while sending envelope:",n),n)):(de&&L.error("Transport disabled"),Dr({}))}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=WD(this,e),Y0(this,e)}_updateSessionFromEvent(e,n){var c;let r=n.level==="fatal",i=!1;const s=(c=n.exception)==null?void 0:c.values;if(s){i=!0;for(const u of s){const d=u.mechanism;if((d==null?void 0:d.handled)===!1){r=!0;break}}}const o=e.status==="ok";(o&&e.errors===0||o&&r)&&(Ys(e,{...r&&{status:"crashed"},errors:e.errors||Number(i||r)}),this.captureSession(e))}_isClientDoneProcessing(e){return new _i(n=>{let r=0;const i=1,s=setInterval(()=>{this._numProcessing==0?(clearInterval(s),n(!0)):(r+=i,e&&r>=e&&(clearInterval(s),n(!1)))},i)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,i){const s=this.getOptions(),o=Object.keys(this._integrations);return!n.integrations&&(o!=null&&o.length)&&(n.integrations=o),this.emit("preprocessEvent",e,n),e.type||i.setLastEventId(e.event_id||n.event_id),j0(s,e,n,r,this,i).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:Qb(r),...a.contexts};const c=zh(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:c,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r=Be(),i=Pt()){return de&&sp(e)&&L.log(`Captured error event \`${X0(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,i).then(s=>s.event_id,s=>{de&&(rw(s)?L.log(s.message):nw(s)?L.warn(s.message):L.warn(s))})}_processEvent(e,n,r,i){const s=this.getOptions(),{sampleRate:o}=s,a=iw(e),c=sp(e),u=e.type||"error",d=`before send for type \`${u}\``,l=typeof o>"u"?void 0:ns(o);if(c&&typeof l=="number"&&Math.random()>l)return this.recordDroppedEvent("sample_rate","error"),Ju(ip(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const h=u==="replay_event"?"replay":u;return this._prepareEvent(e,n,r,i).then(f=>{if(f===null)throw this.recordDroppedEvent("event_processor",h),ip("An event processor returned `null`, will not send event.");if(n.data&&n.data.__sentry__===!0)return f;const g=ZD(this,s,f,n);return YD(g,d)}).then(f=>{var v;if(f===null){if(this.recordDroppedEvent("before_send",h),a){const _=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",_)}throw ip(`${d} returned \`null\`, will not send event.`)}const p=r.getSession()||i.getSession();if(c&&p&&this._updateSessionFromEvent(p,f),a){const m=((v=f.sdkProcessingMetadata)==null?void 0:v.spanCountBeforeProcessing)||0,_=f.spans?f.spans.length:0,w=m-_;w>0&&this.recordDroppedEvent("before_send","span",w)}const g=f.transaction_info;if(a&&g&&f.transaction!==e.transaction){const m="custom";f.transaction_info={...g,source:m}}return this.sendEvent(f,n),f}).then(null,f=>{throw rw(f)||nw(f)?f:(this.captureException(f,{data:{__sentry__:!0},originalException:f}),fl(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
Reason: ${f}`))})}_process(e){this._numProcessing++,e.then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{const[i,s]=n.split(":");return{reason:i,category:s,quantity:r}})}_flushOutcomes(){de&&L.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){de&&L.log("No outcomes to send");return}if(!this._dsn){de&&L.log("No dsn provided, will not send outcomes");return}de&&L.log("Sending outcomes:",e);const n=zD(e,this._options.tunnel&&os(this._dsn));this.sendEnvelope(n)}}function YD(t,e){const n=`${e} must return \`null\` or a valid event.`;if(Ua(t))return t.then(r=>{if(!Gs(r)&&r!==null)throw fl(n);return r},r=>{throw fl(`${e} rejected with ${r}`)});if(!Gs(t)&&t!==null)throw fl(n);return t}function ZD(t,e,n,r){const{beforeSend:i,beforeSendTransaction:s,beforeSendSpan:o}=e;let a=n;if(sp(a)&&i)return i(a,r);if(iw(a)){if(o){const c=o(VD(a));if(c?a=ja(n,KD(c)):qh(),a.spans){const u=[];for(const d of a.spans){const l=o(d);l?u.push(l):(qh(),u.push(d))}a.spans=u}}if(s){if(a.spans){const c=a.spans.length;a.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:c}}return s(a,r)}}return a}function sp(t){return t.type===void 0}function iw(t){return t.type==="transaction"}function XD(t,e){if(!e)return[void 0,void 0];const n=Zs(e),r=n?f0(n):Qb(e);return[n?Yn(n):zh(t,e),r]}const JD={trace:1,debug:5,info:9,warn:13,error:17,fatal:21};function QD(t){return[{type:"otel_log"},t]}function eN(t,e,n,r){const i={};return e!=null&&e.sdk&&(i.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(i.dsn=os(r)),Ur(i,t.map(QD))}const tN=100,op=new WeakMap;function nN(t,e){switch(typeof e){case"number":return{key:t,value:{doubleValue:e}};case"boolean":return{key:t,value:{boolValue:e}};case"string":return{key:t,value:{stringValue:e}};default:{let n="";try{n=JSON.stringify(e)??""}catch{}return{key:t,value:{stringValue:n}}}}}function rN(t,e=oe(),n=Be()){if(!e){de&&L.warn("No client available to capture log.");return}const{_experiments:r,release:i,environment:s}=e.getOptions(),{enableLogs:o=!1,beforeSendLog:a}=r??{};if(!o){de&&L.warn("logging option not enabled, log will not be captured.");return}e.emit("beforeCaptureLog",t);const c=a?a(t):t;if(!c){e.recordDroppedEvent("before_send","log_item",1),de&&L.warn("beforeSendLog returned null, log will not be captured.");return}const[,u]=XD(e,n),{level:d,message:l,attributes:h,severityNumber:f}=c,p={...h};if(i&&(p.release=i),s&&(p.environment=s),Yu(l)){const{__sentry_template_string__:_,__sentry_template_values__:w=[]}=l;p["sentry.message.template"]=_,w.forEach((T,C)=>{p[`sentry.message.param.${C}`]=T})}const g=Zs(n);g&&(p["sentry.trace.parent_span_id"]=g.spanContext().spanId);const v={severityText:d,body:{stringValue:l},attributes:Object.entries(p).map(([_,w])=>nN(_,w)),timeUnixNano:`${new Date().getTime().toString()}000000`,traceId:u==null?void 0:u.trace_id,severityNumber:f??JD[d]},m=op.get(e);m===void 0?op.set(e,[v]):(m.push(v),m.length>tN&&hl(e,m)),e.emit("afterCaptureLog",c)}function hl(t,e){const n=e??op.get(t)??[];if(n.length===0)return;const r=t.getOptions(),i=eN(n,r._metadata,r.tunnel,t.getDsn());n.length=0,t.sendEnvelope(i)}function iN(t,e){e.debug===!0&&(de?L.enable():Ji(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Be().update(e.initialScope);const r=new t(e);return sw(r),r.init(),r}function sw(t){Be().setClient(t)}const ow=Symbol.for("SentryBufferFullError");function sN(t){const e=[];function n(){return t===void 0||e.length<t}function r(o){return e.splice(e.indexOf(o),1)[0]||Promise.resolve(void 0)}function i(o){if(!n())return Ju(ow);const a=o();return e.indexOf(a)===-1&&e.push(a),a.then(()=>r(a)).then(null,()=>r(a).then(null,()=>{})),a}function s(o){return new _i((a,c)=>{let u=e.length;if(!u)return a(!0);const d=setTimeout(()=>{o&&o>0&&a(!1)},o);e.forEach(l=>{Dr(l).then(()=>{--u||(clearTimeout(d),a(!0))},c)})})}return{$:e,add:i,drain:s}}const oN=60*1e3;function aw(t,e=Date.now()){const n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;const r=Date.parse(`${t}`);return isNaN(r)?oN:r-e}function aN(t,e){return t[e]||t.all||0}function cw(t,e,n=Date.now()){return aN(t,e)>n}function uw(t,{statusCode:e,headers:n},r=Date.now()){const i={...t},s=n==null?void 0:n["x-sentry-rate-limits"],o=n==null?void 0:n["retry-after"];if(s)for(const a of s.trim().split(",")){const[c,u,,,d]=a.split(":",5),l=parseInt(c,10),h=(isNaN(l)?60:l)*1e3;if(!u)i.all=r+h;else for(const f of u.split(";"))f==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(i[f]=r+h):i[f]=r+h}else o?i.all=r+aw(o,r):e===429&&(i.all=r+6e4);return i}const cN=64;function lw(t,e,n=sN(t.bufferSize||cN)){let r={};const i=o=>n.drain(o);function s(o){const a=[];if(as(o,(l,h)=>{const f=x0(h);cw(r,f)?t.recordDroppedEvent("ratelimit_backoff",f):a.push(l)}),a.length===0)return Dr({});const c=Ur(o[0],a),u=l=>{as(c,(h,f)=>{t.recordDroppedEvent(l,x0(f))})},d=()=>e({body:sl(c)}).then(l=>(l.statusCode!==void 0&&(l.statusCode<200||l.statusCode>=300)&&de&&L.warn(`Sentry responded with status code ${l.statusCode} to sent event.`),r=uw(r,l),l),l=>{throw u("network_error"),l});return n.add(d).then(l=>l,l=>{if(l===ow)return de&&L.error("Skipped sending event because buffer is full."),u("queue_overflow"),Dr({});throw l})}return{send:s,flush:i}}const ap=100,cp=5e3,uN=36e5;function lN(t){function e(...n){de&&L.info("[Offline]:",...n)}return n=>{const r=t(n);if(!n.createStore)throw new Error("No `createStore` function was provided");const i=n.createStore(n);let s=cp,o;function a(l,h,f){return I0(l,["client_report"])?!1:n.shouldStore?n.shouldStore(l,h,f):!0}function c(l){o&&clearTimeout(o),o=setTimeout(async()=>{o=void 0;const h=await i.shift();h&&(e("Attempting to send previously queued event"),h[0].sent_at=new Date().toISOString(),d(h,!0).catch(f=>{e("Failed to retry sending",f)}))},l),typeof o!="number"&&o.unref&&o.unref()}function u(){o||(c(s),s=Math.min(s*2,uN))}async function d(l,h=!1){var f,p;if(!h&&I0(l,["replay_event","replay_recording"]))return await i.push(l),c(ap),{};try{const g=await r.send(l);let v=ap;if(g){if((f=g.headers)!=null&&f["retry-after"])v=aw(g.headers["retry-after"]);else if((p=g.headers)!=null&&p["x-sentry-rate-limits"])v=6e4;else if((g.statusCode||0)>=400)return g}return c(v),s=cp,g}catch(g){if(await a(l,g,s))return h?await i.unshift(l):await i.push(l),u(),e("Error sending. Event queued.",g),{};throw g}}return n.flushAtStartup&&u(),{send:d,flush:l=>(l===void 0&&(s=cp,c(ap)),r.flush(l))}}}function dw(t,e){let n;return as(t,(r,i)=>(e.includes(i)&&(n=Array.isArray(r)?r[1]:void 0),!!n)),n}function dN(t,e){return n=>{const r=t(n);return{...r,send:async i=>{const s=dw(i,["event","transaction","profile","replay_event"]);return s&&(s.release=e),r.send(i)}}}}function fN(t,e){return Ur(e?{...t[0],dsn:e}:t[0],t[1])}function hN(t,e){return n=>{const r=t(n),i=new Map;function s(c,u){const d=u?`${c}:${u}`:c;let l=i.get(d);if(!l){const h=E0(c);if(!h)return;const f=K0(h,n.tunnel);l=u?dN(t,u)({...n,url:f}):t({...n,url:f}),i.set(d,l)}return[c,l]}async function o(c){function u(f){const p=f!=null&&f.length?f:["event"];return dw(c,p)}const d=e({envelope:c,getEvent:u}).map(f=>typeof f=="string"?s(f,void 0):s(f.dsn,f.release)).filter(f=>!!f),l=d.length?d:[["",r]];return(await Promise.all(l.map(([f,p])=>p.send(fN(c,f)))))[0]}async function a(c){const u=[...i.values(),r];return(await Promise.all(u.map(l=>l.flush(c)))).every(l=>l)}return{send:o,flush:a}}}function fw(t,e){const n=e==null?void 0:e.getDsn(),r=e==null?void 0:e.getOptions().tunnel;return gN(t,n)||pN(t,r)}function pN(t,e){return e?hw(t)===hw(e):!1}function gN(t,e){return e?t.includes(e.host):!1}function hw(t){return t[t.length-1]==="/"?t.slice(0,-1):t}function pw(t,...e){const n=new String(String.raw(t,...e));return n.__sentry_template_string__=t.join("\0").replace(/%/g,"%%").replace(/\0/g,"%s"),n.__sentry_template_values__=e,n}const mN=pw;function vN(t){var e;((e=t.user)==null?void 0:e.ip_address)===void 0&&(t.user={...t.user,ip_address:"{{auto}}"})}function _N(t){var e;"aggregates"in t?((e=t.attrs)==null?void 0:e.ip_address)===void 0&&(t.attrs={...t.attrs,ip_address:"{{auto}}"}):t.ipAddress===void 0&&(t.ipAddress="{{auto}}")}function yN(t,e,n=[e],r="npm"){const i=t._metadata||{};i.sdk||(i.sdk={name:`sentry.javascript.${e}`,packages:n.map(s=>({name:`${r}:@sentry/${s}`,version:xr})),version:xr}),t._metadata=i}function gw(t={}){const e=oe();if(!FD()||!e)return{};const n=Rr(),r=yi(n);if(r.getTraceData)return r.getTraceData(t);const i=Be(),s=t.span||$t(),o=s?h0(s):bN(i),a=s?Yn(s):zh(e,i),c=s0(a);return a0.test(o)?{"sentry-trace":o,baggage:c}:(L.warn("Invalid sentry-trace data. Cannot generate trace data"),{})}function bN(t){const{traceId:e,sampled:n,propagationSpanId:r}=t.getPropagationContext();return u0(e,r,n)}const wN=100;function Br(t,e){const n=oe(),r=Pt();if(!n)return;const{beforeBreadcrumb:i=null,maxBreadcrumbs:s=wN}=n.getOptions();if(s<=0)return;const a={timestamp:$a(),...t},c=i?Ji(()=>i(a,e)):a;c!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",c,e),r.addBreadcrumb(c,s))}let mw;const SN="FunctionToString",vw=new WeakMap,_w=()=>({name:SN,setupOnce(){mw=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=Ph(this),n=vw.has(oe())&&e!==void 0?e:this;return mw.apply(n,t)}}catch{}},setup(t){vw.set(t,!0)}}),EN=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],kN="EventFilters",yw=(t={})=>{let e;return{name:kN,setup(n){const r=n.getOptions();e=ww(t,r)},processEvent(n,r,i){if(!e){const s=i.getOptions();e=ww(t,s)}return CN(n,e)?null:n}}},bw=(t={})=>({...yw(t),name:"InboundFilters"});function ww(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:EN],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function CN(t,e){if(t.type){if(t.type==="transaction"&&IN(t,e.ignoreTransactions))return de&&L.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
Event: ${es(t)}`),!0}else{if(TN(t,e.ignoreErrors))return de&&L.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
Event: ${es(t)}`),!0;if(PN(t))return de&&L.warn(`Event dropped due to not having an error message, error type or stacktrace.
Event: ${es(t)}`),!0;if(xN(t,e.denyUrls))return de&&L.warn(`Event dropped due to being matched by \`denyUrls\` option.
Event: ${es(t)}.
Url: ${pl(t)}`),!0;if(!RN(t,e.allowUrls))return de&&L.warn(`Event dropped due to not being matched by \`allowUrls\` option.
Event: ${es(t)}.
Url: ${pl(t)}`),!0}return!1}function TN(t,e){return e!=null&&e.length?X0(t).some(n=>lr(n,e)):!1}function IN(t,e){if(!(e!=null&&e.length))return!1;const n=t.transaction;return n?lr(n,e):!1}function xN(t,e){if(!(e!=null&&e.length))return!1;const n=pl(t);return n?lr(n,e):!1}function RN(t,e){if(!(e!=null&&e.length))return!0;const n=pl(t);return n?lr(n,e):!0}function AN(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function pl(t){var e,n;try{const r=[...((e=t.exception)==null?void 0:e.values)??[]].reverse().find(s=>{var o,a,c;return((o=s.mechanism)==null?void 0:o.parent_id)===void 0&&((c=(a=s.stacktrace)==null?void 0:a.frames)==null?void 0:c.length)}),i=(n=r==null?void 0:r.stacktrace)==null?void 0:n.frames;return i?AN(i):null}catch{return de&&L.error(`Cannot extract url for event ${es(t)}`),null}}function PN(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)!=null&&n.length?!t.message&&!t.exception.values.some(r=>r.stacktrace||r.type&&r.type!=="Error"||r.value):!1}function MN(t,e,n=250,r,i,s,o){var c;if(!((c=s.exception)!=null&&c.values)||!o||!Pr(o.originalException,Error))return;const a=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;a&&(s.exception.values=ON(up(t,e,i,o.originalException,r,s.exception.values,a,0),n))}function up(t,e,n,r,i,s,o,a){if(s.length>=n+1)return s;let c=[...s];if(Pr(r[i],Error)){Sw(o,a);const u=t(e,r[i]),d=c.length;Ew(u,i,d,a),c=up(t,e,n,r[i],i,[u,...c],u,d)}return Array.isArray(r.errors)&&r.errors.forEach((u,d)=>{if(Pr(u,Error)){Sw(o,a);const l=t(e,u),h=c.length;Ew(l,`errors[${d}]`,h,a),c=up(t,e,n,u,i,[l,...c],l,h)}}),c}function Sw(t,e){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,...t.type==="AggregateError"&&{is_exception_group:!0},exception_id:e}}function Ew(t,e,n,r){t.mechanism=t.mechanism||{type:"generic",handled:!0},t.mechanism={...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function ON(t,e){return t.map(n=>(n.value&&(n.value=Or(n.value,e)),n))}const kw=new Map,Cw=new Set;function LN(t){if(ke._sentryModuleMetadata)for(const e of Object.keys(ke._sentryModuleMetadata)){const n=ke._sentryModuleMetadata[e];if(Cw.has(e))continue;Cw.add(e);const r=t(e);for(const i of r.reverse())if(i.filename){kw.set(i.filename,n);break}}}function DN(t,e){return LN(t),kw.get(e)}function Tw(t,e){try{e.exception.values.forEach(n=>{if(n.stacktrace)for(const r of n.stacktrace.frames||[]){if(!r.filename||r.module_metadata)continue;const i=DN(t,r.filename);i&&(r.module_metadata=i)}})}catch{}}function Iw(t){try{t.exception.values.forEach(e=>{if(e.stacktrace)for(const n of e.stacktrace.frames||[])delete n.module_metadata})}catch{}}const NN=()=>({name:"ModuleMetadata",setup(t){t.on("beforeEnvelope",e=>{as(e,(n,r)=>{if(r==="event"){const i=Array.isArray(n)?n[1]:void 0;i&&(Iw(i),n[1]=i)}})}),t.on("applyFrameMetadata",e=>{if(e.type)return;const n=t.getOptions().stackParser;Tw(n,e)})}});function xw(t){const e="console";pi(e,t),gi(e,FN)}function FN(){"console"in ke&&zu.forEach(function(t){t in ke.console&&tn(ke.console,t,function(e){return Vu[t]=e,function(...n){Rn("console",{args:n,level:t});const i=Vu[t];i==null||i.apply(ke.console,n)}})})}function lp(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}const $N="CaptureConsole",UN=(t={})=>{const e=t.levels||zu,n=t.handled??!0;return{name:$N,setup(r){"console"in ke&&xw(({args:i,level:s})=>{oe()!==r||!e.includes(s)||BN(i,s,n)})}}};function BN(t,e,n){const r={level:lp(e),extra:{arguments:t}};Gn(i=>{if(i.addEventProcessor(a=>(a.logger="console",vi(a,{handled:n,type:"console"}),a)),e==="assert"){if(!t[0]){const a=`Assertion failed: ${Xu(t.slice(1)," ")||"console.assert"}`;i.setExtra("arguments",t.slice(1)),dl(a,r)}return}const s=t.find(a=>a instanceof Error);if(s){ll(s,r);return}const o=Xu(t," ");dl(o,r)})}const jN="Dedupe",Rw=()=>{let t;return{name:jN,processEvent(e){if(e.type)return e;try{if(HN(e,t))return de&&L.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}};function HN(t,e){return e?!!(qN(t,e)||WN(t,e)):!1}function qN(t,e){const n=t.message,r=e.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!Pw(t,e)||!Aw(t,e))}function WN(t,e){const n=Mw(e),r=Mw(t);return!(!n||!r||n.type!==r.type||n.value!==r.value||!Pw(t,e)||!Aw(t,e))}function Aw(t,e){let n=kh(t),r=kh(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let i=0;i<r.length;i++){const s=r[i],o=n[i];if(s.filename!==o.filename||s.lineno!==o.lineno||s.colno!==o.colno||s.function!==o.function)return!1}return!0}function Pw(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function Mw(t){var e;return((e=t.exception)==null?void 0:e.values)&&t.exception.values[0]}const zN="ExtraErrorData",VN=(t={})=>{const{depth:e=3,captureErrorCause:n=!0}=t;return{name:zN,processEvent(r,i,s){const{maxValueLength:o=250}=s.getOptions();return KN(r,i,e,n,o)}}};function KN(t,e={},n,r,i){if(!e.originalException||!mi(e.originalException))return t;const s=e.originalException.name||e.originalException.constructor.name,o=GN(e.originalException,r,i);if(o){const a={...t.contexts},c=Pn(o,n);return Gs(c)&&(fn(c,"__sentry_skip_normalization__",!0),a[s]=c),{...t,contexts:a}}return t}function GN(t,e,n){try{const r=["name","message","stack","line","column","fileName","lineNumber","columnNumber","toJSON"],i={};for(const s of Object.keys(t)){if(r.indexOf(s)!==-1)continue;const o=t[s];i[s]=mi(o)||typeof o=="string"?Or(`${o}`,n):o}if(e&&t.cause!==void 0&&(i.cause=mi(t.cause)?t.cause.toString():t.cause),typeof t.toJSON=="function"){const s=t.toJSON();for(const o of Object.keys(s)){const a=s[o];i[o]=mi(a)?a.toString():a}}return i}catch(r){de&&L.error("Unable to extract extra data from the Error object:",r)}return null}function YN(t,e){let n=0;for(let r=t.length-1;r>=0;r--){const i=t[r];i==="."?t.splice(r,1):i===".."?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}const ZN=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function XN(t){const e=t.length>1024?`<truncated>${t.slice(-1024)}`:t,n=ZN.exec(e);return n?n.slice(1):[]}function Ow(...t){let e="",n=!1;for(let r=t.length-1;r>=-1&&!n;r--){const i=r>=0?t[r]:"/";i&&(e=`${i}/${e}`,n=i.charAt(0)==="/")}return e=YN(e.split("/").filter(r=>!!r),!n).join("/"),(n?"/":"")+e||"."}function Lw(t){let e=0;for(;e<t.length&&t[e]==="";e++);let n=t.length-1;for(;n>=0&&t[n]==="";n--);return e>n?[]:t.slice(e,n-e+1)}function JN(t,e){t=Ow(t).slice(1),e=Ow(e).slice(1);const n=Lw(t.split("/")),r=Lw(e.split("/")),i=Math.min(n.length,r.length);let s=i;for(let a=0;a<i;a++)if(n[a]!==r[a]){s=a;break}let o=[];for(let a=s;a<n.length;a++)o.push("..");return o=o.concat(r.slice(s)),o.join("/")}function QN(t,e){return XN(t)[2]||""}const eF="RewriteFrames",tF=(t={})=>{const e=t.root,n=t.prefix||"app:///",r="window"in ke&&!!ke.window,i=t.iteratee||nF({isBrowser:r,root:e,prefix:n});function s(a){try{return{...a,exception:{...a.exception,values:a.exception.values.map(c=>({...c,...c.stacktrace&&{stacktrace:o(c.stacktrace)}}))}}}catch{return a}}function o(a){return{...a,frames:(a==null?void 0:a.frames)&&a.frames.map(c=>i(c))}}return{name:eF,processEvent(a){let c=a;return a.exception&&Array.isArray(a.exception.values)&&(c=s(c)),c}}};function nF({isBrowser:t,root:e,prefix:n}){return r=>{if(!r.filename)return r;const i=/^[a-zA-Z]:\\/.test(r.filename)||r.filename.includes("\\")&&!r.filename.includes("/"),s=/^\//.test(r.filename);if(t){if(e){const o=r.filename;o.indexOf(e)===0&&(r.filename=o.replace(e,n))}}else if(i||s){const o=i?r.filename.replace(/^[a-zA-Z]:/,"").replace(/\\/g,"/"):r.filename,a=e?JN(e,o):QN(o);r.filename=`${n}${a}`}return r}}const rF=10,iF="ZodErrors";function sF(t){return mi(t)&&t.name==="ZodError"&&Array.isArray(t.issues)}function oF(t){return{...t,path:"path"in t&&Array.isArray(t.path)?t.path.join("."):void 0,keys:"keys"in t?JSON.stringify(t.keys):void 0,unionErrors:"unionErrors"in t?JSON.stringify(t.unionErrors):void 0}}function aF(t){return t.map(e=>typeof e=="number"?"<array>":e).join(".")}function cF(t){const e=new Set;for(const r of t.issues){const i=aF(r.path);i.length>0&&e.add(i)}const n=Array.from(e);if(n.length===0){let r="variable";if(t.issues.length>0){const i=t.issues[0];i!==void 0&&"expected"in i&&typeof i.expected=="string"&&(r=i.expected)}return`Failed to validate ${r}`}return`Failed to validate keys: ${Or(n.join(", "),100)}`}function uF(t,e=!1,n,r){var i;if(!((i=n.exception)!=null&&i.values)||!r.originalException||!sF(r.originalException)||r.originalException.issues.length===0)return n;try{const o=(e?r.originalException.issues:r.originalException.issues.slice(0,t)).map(oF);return e&&(Array.isArray(r.attachments)||(r.attachments=[]),r.attachments.push({filename:"zod_issues.json",data:JSON.stringify({issues:o})})),{...n,exception:{...n.exception,values:[{...n.exception.values[0],value:cF(r.originalException)},...n.exception.values.slice(1)]},extra:{...n.extra,"zoderror.issues":o.slice(0,t)}}}catch(s){return{...n,extra:{...n.extra,"zoderrors sentry integration parse error":{message:"an exception was thrown while processing ZodError within applyZodErrorsToEvent()",error:s instanceof Error?`${s.name}: ${s.message}
${s.stack}`:"unknown"}}}}}const lF=(t={})=>{const e=t.limit??rF;return{name:iF,processEvent(n,r){return uF(e,t.saveZodIssuesAsAttachment,n,r)}}},dF=t=>({name:"ThirdPartyErrorsFilter",setup(e){e.on("beforeEnvelope",n=>{as(n,(r,i)=>{if(i==="event"){const s=Array.isArray(r)?r[1]:void 0;s&&(Iw(s),r[1]=s)}})}),e.on("applyFrameMetadata",n=>{if(n.type)return;const r=e.getOptions().stackParser;Tw(r,n)})},processEvent(e){const n=fF(e);if(n){const r=t.behaviour==="drop-error-if-contains-third-party-frames"||t.behaviour==="apply-tag-if-contains-third-party-frames"?"some":"every";if(n[r](s=>!s.some(o=>t.filterKeys.includes(o)))){if(t.behaviour==="drop-error-if-contains-third-party-frames"||t.behaviour==="drop-error-if-exclusively-contains-third-party-frames")return null;e.tags={...e.tags,third_party_code:!0}}}return e}});function fF(t){const e=kh(t);if(e)return e.filter(n=>!!n.filename).map(n=>n.module_metadata?Object.keys(n.module_metadata).filter(r=>r.startsWith(Dw)).map(r=>r.slice(Dw.length)):[])}const Dw="_sentryBundlerPluginAppKey:";function Nw(t,e){try{return"canParse"in URL&&!URL.canParse(t,e)?void 0:new URL(t,e)}catch{}}function cs(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function dp(t){return t.split(/[?#]/,1)[0]}function hF(t,e,n,r,i="auto.http.browser"){if(!t.fetchData)return;const{method:s,url:o}=t.fetchData,a=bi()&&e(o);if(t.endTimestamp&&a){const f=t.fetchData.__span;if(!f)return;const p=r[f];p&&(gF(p,t),delete r[f]);return}const c=o.startsWith("/")?Nw(o,"thismessage:/"):Nw(o),u=o.startsWith("/")||c==null?void 0:c.href,d=!!$t(),l=a&&d?Js({name:`${s} ${dp(o)}`,attributes:{url:o,type:"fetch","http.method":s,"http.url":c==null?void 0:c.href,[It]:i,[Fr]:"http.client",...u&&{"http.url":u},...u&&(c==null?void 0:c.host)&&{"server.address":c.host},...(c==null?void 0:c.search)&&{"http.query":c.search},...(c==null?void 0:c.hash)&&{"http.fragment":c.hash}}}):new $r;if(t.fetchData.__span=l.spanContext().spanId,r[l.spanContext().spanId]=l,n(t.fetchData.url)){const f=t.args[0],p=t.args[1]||{},g=pF(f,p,bi()&&d?l:void 0);g&&(t.args[1]=p,p.headers=g)}const h=oe();if(h){const f={input:t.args,response:t.response,startTimestamp:t.startTimestamp,endTimestamp:t.endTimestamp};h.emit("beforeOutgoingRequestSpan",l,f)}return l}function pF(t,e,n){const r=gw({span:n}),i=r["sentry-trace"],s=r.baggage;if(!i)return;const o=e.headers||(mF(t)?t.headers:void 0);if(o)if(vF(o)){const a=new Headers(o);if(a.set("sentry-trace",i),s){const c=a.get("baggage");if(c){const u=gl(c);a.set("baggage",u?`${u},${s}`:s)}else a.set("baggage",s)}return a}else if(Array.isArray(o)){const a=[...o.filter(c=>!(Array.isArray(c)&&c[0]==="sentry-trace")).map(c=>{if(Array.isArray(c)&&c[0]==="baggage"&&typeof c[1]=="string"){const[u,d,...l]=c;return[u,gl(d),...l]}else return c}),["sentry-trace",i]];return s&&a.push(["baggage",s]),a}else{const a="baggage"in o?o.baggage:void 0;let c=[];return Array.isArray(a)?c=a.map(u=>typeof u=="string"?gl(u):u).filter(u=>u===""):a&&c.push(gl(a)),s&&c.push(s),{...o,"sentry-trace":i,baggage:c.length>0?c.join(","):void 0}}else return{...r}}function gF(t,e){var n;if(e.response){Uh(t,e.response.status);const r=((n=e.response)==null?void 0:n.headers)&&e.response.headers.get("content-length");if(r){const i=parseInt(r);i>0&&t.setAttribute("http.response_content_length",i)}}else e.error&&t.setStatus({code:Ct,message:"internal_error"});t.end()}function gl(t){return t.split(",").filter(e=>!e.split("=")[0].startsWith(Bh)).join(",")}function mF(t){return typeof Request<"u"&&Pr(t,Request)}function vF(t){return typeof Headers<"u"&&Pr(t,Headers)}function Fw(t,e={},n=Be()){const{message:r,name:i,email:s,url:o,source:a,associatedEventId:c,tags:u}=t,d={contexts:{feedback:{contact_email:s,name:i,message:r,url:o,source:a,associated_event_id:c}},type:"feedback",level:"info",tags:u},l=(n==null?void 0:n.getClient())||oe();return l&&l.emit("beforeSendFeedback",d,e),n.captureEvent(d,e)}function $w(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}const Qs=ke;function _F(){return"history"in Qs&&!!Qs.history}function Uw(){if(!("fetch"in Qs))return!1;try{return new Headers,new Request("http://www.example.com"),new Response,!0}catch{return!1}}function fp(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function Bw(){var n;if(typeof EdgeRuntime=="string")return!0;if(!Uw())return!1;if(fp(Qs.fetch))return!0;let t=!1;const e=Qs.document;if(e&&typeof e.createElement=="function")try{const r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),(n=r.contentWindow)!=null&&n.fetch&&(t=fp(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){hi&&L.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}function yF(){return"ReportingObserver"in Qs}function hp(t,e){const n="fetch";pi(n,t),gi(n,()=>jw(void 0,e))}function bF(t){const e="fetch-body-resolved";pi(e,t),gi(e,()=>jw(SF))}function jw(t,e=!1){e&&!Bw()||tn(ke,"fetch",function(n){return function(...r){const i=new Error,{method:s,url:o}=EF(r),a={args:r,fetchData:{method:s,url:o},startTimestamp:At()*1e3,virtualError:i};return t||Rn("fetch",{...a}),n.apply(ke,r).then(async c=>(t?t(c):Rn("fetch",{...a,endTimestamp:At()*1e3,response:c}),c),c=>{if(Rn("fetch",{...a,endTimestamp:At()*1e3,error:c}),mi(c)&&c.stack===void 0&&(c.stack=i.stack,fn(c,"framesToPop",1)),c instanceof TypeError&&(c.message==="Failed to fetch"||c.message==="Load failed"||c.message==="NetworkError when attempting to fetch resource."))try{const u=new URL(a.fetchData.url);c.message=`${c.message} (${u.host})`}catch{}throw c})}})}async function wF(t,e){if(t!=null&&t.body){const n=t.body,r=n.getReader(),i=setTimeout(()=>{n.cancel().then(null,()=>{})},90*1e3);let s=!0;for(;s;){let o;try{o=setTimeout(()=>{n.cancel().then(null,()=>{})},5e3);const{done:a}=await r.read();clearTimeout(o),a&&(e(),s=!1)}catch{s=!1}finally{clearTimeout(o)}}clearTimeout(i),r.releaseLock(),n.cancel().then(null,()=>{})}}function SF(t){let e;try{e=t.clone()}catch{return}wF(e,()=>{Rn("fetch-body-resolved",{endTimestamp:At()*1e3,response:t})})}function pp(t,e){return!!t&&typeof t=="object"&&!!t[e]}function Hw(t){return typeof t=="string"?t:t?pp(t,"url")?t.url:t.toString?t.toString():"":""}function EF(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){const[n,r]=t;return{url:Hw(n),method:pp(r,"method")?String(r.method).toUpperCase():"GET"}}const e=t[0];return{url:Hw(e),method:pp(e,"method")?String(e.method).toUpperCase():"GET"}}function kF(){return typeof __SENTRY_BROWSER_BUNDLE__<"u"&&!!__SENTRY_BROWSER_BUNDLE__}function CF(){return"npm"}function TF(){return!kF()&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]"}function gp(){return typeof window<"u"&&(!TF()||IF())}function IF(){const t=ke.process;return(t==null?void 0:t.type)==="renderer"}const ce=ke;let mp=0;function qw(){return mp>0}function xF(){mp++,setTimeout(()=>{mp--})}function eo(t,e={}){function n(i){return typeof i=="function"}if(!n(t))return t;try{const i=t.__sentry_wrapped__;if(i)return typeof i=="function"?i:t;if(Ph(t))return t}catch{return t}const r=function(...i){try{const s=i.map(o=>eo(o,e));return t.apply(this,s)}catch(s){throw xF(),Gn(o=>{o.addEventProcessor(a=>(e.mechanism&&(Mh(a,void 0),vi(a,e.mechanism)),a.extra={...a.extra,arguments:i},a)),ll(s)}),s}};try{for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}catch{}Vb(r,t),fn(t,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return t.name}})}catch{}return r}function ml(t,e){const n=_p(t,e),r={type:OF(e),value:LF(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function RF(t,e,n,r){const i=oe(),s=i==null?void 0:i.getOptions().normalizeDepth,o=FF(e),a={__serialized__:T0(e,s)};if(o)return{exception:{values:[ml(t,o)]},extra:a};const c={exception:{values:[{type:Zu(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:DF(e,{isUnhandledRejection:r})}]},extra:a};if(n){const u=_p(t,n);u.length&&(c.exception.values[0].stacktrace={frames:u})}return c}function vp(t,e){return{exception:{values:[ml(t,e)]}}}function _p(t,e){const n=e.stacktrace||e.stack||"",r=PF(e),i=MF(e);try{return t(n,r,i)}catch{}return[]}const AF=/Minified React error #\d+;/i;function PF(t){return t&&AF.test(t.message)?1:0}function MF(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Ww(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function OF(t){const e=t==null?void 0:t.name;return!e&&Ww(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function LF(t){const e=t==null?void 0:t.message;return Ww(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?e.error.message:e:"No error message"}function zw(t,e,n,r){const i=(n==null?void 0:n.syntheticException)||void 0,s=yp(t,e,i,r);return vi(s),s.level="error",n!=null&&n.event_id&&(s.event_id=n.event_id),Dr(s)}function Vw(t,e,n="info",r,i){const s=(r==null?void 0:r.syntheticException)||void 0,o=bp(t,e,s,i);return o.level=n,r!=null&&r.event_id&&(o.event_id=r.event_id),Dr(o)}function yp(t,e,n,r,i){let s;if(Hb(e)&&e.error)return vp(t,e.error);if(qb(e)||zO(e)){const o=e;if("stack"in e)s=vp(t,e);else{const a=o.name||(qb(o)?"DOMError":"DOMException"),c=o.message?`${a}: ${o.message}`:a;s=bp(t,c,n,r),Mh(s,c)}return"code"in o&&(s.tags={...s.tags,"DOMException.code":`${o.code}`}),s}return mi(e)?vp(t,e):Gs(e)||Zu(e)?(s=RF(t,e,n,i),vi(s,{synthetic:!0}),s):(s=bp(t,e,n,r),Mh(s,`${e}`),vi(s,{synthetic:!0}),s)}function bp(t,e,n,r){const i={};if(r&&n){const s=_p(t,n);s.length&&(i.exception={values:[{value:e,stacktrace:{frames:s}}]}),vi(i,{synthetic:!0})}if(Yu(e)){const{__sentry_template_string__:s,__sentry_template_values__:o}=e;return i.logentry={message:s,params:o},i}return i.message=e,i}function DF(t,{isUnhandledRejection:e}){const n=JO(t),r=e?"promise rejection":"exception";return Hb(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:Zu(t)?`Event \`${NF(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function NF(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function FF(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];if(n instanceof Error)return n}}class Kw extends GD{constructor(e){const n={parentSpanIsAlwaysRootSpan:!0,...e},r=ce.SENTRY_SDK_SOURCE||CF();yN(n,"browser",["browser"],r),super(n),n.sendClientReports&&ce.document&&ce.document.addEventListener("visibilitychange",()=>{ce.document.visibilityState==="hidden"&&this._flushOutcomes()}),this._options.sendDefaultPii&&(this.on("postprocessEvent",vN),this.on("beforeSendSession",_N))}eventFromException(e,n){return zw(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return Vw(this._options.stackParser,e,n,r,this._options.attachStacktrace)}_prepareEvent(e,n,r,i){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r,i)}}const Ka=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,$F=(t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good",to=(t,e,n,r)=>{let i,s;return o=>{e.value>=0&&(o||r)&&(s=e.value-(i||0),(s||i===void 0)&&(i=e.value,e.delta=s,e.rating=$F(e.value,n),t(e)))}},De=ke,UF=()=>`v4-${Date.now()}-${Math.floor(Math.random()*(9e12-1))+1e12}`,Ga=(t=!0)=>{var n,r;const e=(r=(n=De.performance)==null?void 0:n.getEntriesByType)==null?void 0:r.call(n,"navigation")[0];if(!t||e&&e.responseStart>0&&e.responseStart<performance.now())return e},Ya=()=>{const t=Ga();return(t==null?void 0:t.activationStart)||0},no=(t,e)=>{var s,o;const n=Ga();let r="navigate";return n&&((s=De.document)!=null&&s.prerendering||Ya()>0?r="prerender":(o=De.document)!=null&&o.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:t,value:typeof e>"u"?-1:e,rating:"good",delta:0,entries:[],id:UF(),navigationType:r}},us=(t,e,n)=>{try{if(PerformanceObserver.supportedEntryTypes.includes(t)){const r=new PerformanceObserver(i=>{Promise.resolve().then(()=>{e(i.getEntries())})});return r.observe(Object.assign({type:t,buffered:!0},n||{})),r}}catch{}},ro=t=>{const e=n=>{var r;(n.type==="pagehide"||((r=De.document)==null?void 0:r.visibilityState)==="hidden")&&t(n)};De.document&&(addEventListener("visibilitychange",e,!0),addEventListener("pagehide",e,!0))},vl=t=>{let e=!1;return()=>{e||(t(),e=!0)}};let Za=-1;const BF=()=>De.document.visibilityState==="hidden"&&!De.document.prerendering?0:1/0,_l=t=>{De.document.visibilityState==="hidden"&&Za>-1&&(Za=t.type==="visibilitychange"?t.timeStamp:0,HF())},jF=()=>{addEventListener("visibilitychange",_l,!0),addEventListener("prerenderingchange",_l,!0)},HF=()=>{removeEventListener("visibilitychange",_l,!0),removeEventListener("prerenderingchange",_l,!0)},yl=()=>(De.document&&Za<0&&(Za=BF(),jF()),{get firstHiddenTime(){return Za}}),Xa=t=>{var e;(e=De.document)!=null&&e.prerendering?addEventListener("prerenderingchange",()=>t(),!0):t()},qF=[1800,3e3],WF=(t,e={})=>{Xa(()=>{const n=yl(),r=no("FCP");let i;const o=us("paint",a=>{a.forEach(c=>{c.name==="first-contentful-paint"&&(o.disconnect(),c.startTime<n.firstHiddenTime&&(r.value=Math.max(c.startTime-Ya(),0),r.entries.push(c),i(!0)))})});o&&(i=to(t,r,qF,e.reportAllChanges))})},zF=[.1,.25],VF=(t,e={})=>{WF(vl(()=>{const n=no("CLS",0);let r,i=0,s=[];const o=c=>{c.forEach(u=>{if(!u.hadRecentInput){const d=s[0],l=s[s.length-1];i&&d&&l&&u.startTime-l.startTime<1e3&&u.startTime-d.startTime<5e3?(i+=u.value,s.push(u)):(i=u.value,s=[u])}}),i>n.value&&(n.value=i,n.entries=s,r())},a=us("layout-shift",o);a&&(r=to(t,n,zF,e.reportAllChanges),ro(()=>{o(a.takeRecords()),r(!0)}),setTimeout(r,0))}))},KF=[100,300],GF=(t,e={})=>{Xa(()=>{const n=yl(),r=no("FID");let i;const s=c=>{c.startTime<n.firstHiddenTime&&(r.value=c.processingStart-c.startTime,r.entries.push(c),i(!0))},o=c=>{c.forEach(s)},a=us("first-input",o);i=to(t,r,KF,e.reportAllChanges),a&&ro(vl(()=>{o(a.takeRecords()),a.disconnect()}))})};let Gw=0,wp=1/0,bl=0;const YF=t=>{t.forEach(e=>{e.interactionId&&(wp=Math.min(wp,e.interactionId),bl=Math.max(bl,e.interactionId),Gw=bl?(bl-wp)/7+1:0)})};let Sp;const ZF=()=>Sp?Gw:performance.interactionCount||0,XF=()=>{"interactionCount"in performance||Sp||(Sp=us("event",YF,{type:"event",buffered:!0,durationThreshold:0}))},jr=[],Ep=new Map,JF=40;let QF=0;const e2=()=>ZF()-QF,t2=()=>{const t=Math.min(jr.length-1,Math.floor(e2()/50));return jr[t]},kp=10,n2=[],r2=t=>{var r;if(n2.forEach(i=>i(t)),!(t.interactionId||t.entryType==="first-input"))return;const e=jr[jr.length-1],n=Ep.get(t.interactionId);if(n||jr.length<kp||e&&t.duration>e.latency){if(n)t.duration>n.latency?(n.entries=[t],n.latency=t.duration):t.duration===n.latency&&t.startTime===((r=n.entries[0])==null?void 0:r.startTime)&&n.entries.push(t);else{const i={id:t.interactionId,latency:t.duration,entries:[t]};Ep.set(i.id,i),jr.push(i)}jr.sort((i,s)=>s.latency-i.latency),jr.length>kp&&jr.splice(kp).forEach(i=>Ep.delete(i.id))}},Yw=t=>{var r;const e=De.requestIdleCallback||De.setTimeout;let n=-1;return t=vl(t),((r=De.document)==null?void 0:r.visibilityState)==="hidden"?t():(n=e(t),ro(t)),n},i2=[200,500],s2=(t,e={})=>{"PerformanceEventTiming"in De&&"interactionId"in PerformanceEventTiming.prototype&&Xa(()=>{XF();const n=no("INP");let r;const i=o=>{Yw(()=>{o.forEach(r2);const a=t2();a&&a.latency!==n.value&&(n.value=a.latency,n.entries=a.entries,r())})},s=us("event",i,{durationThreshold:e.durationThreshold!=null?e.durationThreshold:JF});r=to(t,n,i2,e.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),ro(()=>{i(s.takeRecords()),r(!0)}))})},o2=[2500,4e3],Zw={},a2=(t,e={})=>{Xa(()=>{const n=yl(),r=no("LCP");let i;const s=a=>{e.reportAllChanges||(a=a.slice(-1)),a.forEach(c=>{c.startTime<n.firstHiddenTime&&(r.value=Math.max(c.startTime-Ya(),0),r.entries=[c],i())})},o=us("largest-contentful-paint",s);if(o){i=to(t,r,o2,e.reportAllChanges);const a=vl(()=>{Zw[r.id]||(s(o.takeRecords()),o.disconnect(),Zw[r.id]=!0,i(!0))});["keydown","click"].forEach(c=>{De.document&&addEventListener(c,()=>Yw(a),{once:!0,capture:!0})}),ro(a)}})},c2=[800,1800],Cp=t=>{var e,n;(e=De.document)!=null&&e.prerendering?Xa(()=>Cp(t)):((n=De.document)==null?void 0:n.readyState)!=="complete"?addEventListener("load",()=>Cp(t),!0):setTimeout(t,0)},u2=(t,e={})=>{const n=no("TTFB"),r=to(t,n,c2,e.reportAllChanges);Cp(()=>{const i=Ga();i&&(n.value=Math.max(i.responseStart-Ya(),0),n.entries=[i],r(!0))})},Ja={},wl={};let Xw,Jw,Qw,eS,tS;function Tp(t,e=!1){return Qa("cls",t,d2,Xw,e)}function nS(t,e=!1){return Qa("lcp",t,h2,Qw,e)}function rS(t){return Qa("fid",t,f2,Jw)}function l2(t){return Qa("ttfb",t,p2,eS)}function iS(t){return Qa("inp",t,g2,tS)}function io(t,e){return sS(t,e),wl[t]||(m2(t),wl[t]=!0),oS(t,e)}function so(t,e){const n=Ja[t];if(n!=null&&n.length)for(const r of n)try{r(e)}catch(i){Ka&&L.error(`Error while triggering instrumentation handler.
Type: ${t}
Name: ${Ar(r)}
Error:`,i)}}function d2(){return VF(t=>{so("cls",{metric:t}),Xw=t},{reportAllChanges:!0})}function f2(){return GF(t=>{so("fid",{metric:t}),Jw=t})}function h2(){return a2(t=>{so("lcp",{metric:t}),Qw=t},{reportAllChanges:!0})}function p2(){return u2(t=>{so("ttfb",{metric:t}),eS=t})}function g2(){return s2(t=>{so("inp",{metric:t}),tS=t})}function Qa(t,e,n,r,i=!1){sS(t,e);let s;return wl[t]||(s=n(),wl[t]=!0),r&&e({metric:r}),oS(t,e,i?s:void 0)}function m2(t){const e={};t==="event"&&(e.durationThreshold=0),us(t,n=>{so(t,{entries:n})},e)}function sS(t,e){Ja[t]=Ja[t]||[],Ja[t].push(e)}function oS(t,e,n){return()=>{n&&n();const r=Ja[t];if(!r)return;const i=r.indexOf(e);i!==-1&&r.splice(i,1)}}function v2(t){return"duration"in t}function Ip(t){return typeof t=="number"&&isFinite(t)}function Hr(t,e,n,{...r}){const i=Re(t).start_timestamp;return i&&i>e&&typeof t.updateStartTime=="function"&&t.updateStartTime(e),Wa(t,()=>{const s=Js({startTime:e,...r});return s&&s.end(n),s})}function aS(t){var v;const e=oe();if(!e)return;const{name:n,transaction:r,attributes:i,startTime:s}=t,{release:o,environment:a,sendDefaultPii:c}=e.getOptions(),u=e.getIntegrationByName("Replay"),d=u==null?void 0:u.getReplayId(),l=Be(),h=l.getUser(),f=h!==void 0?h.email||h.id||h.ip_address:void 0;let p;try{p=l.getScopeData().contexts.profile.profile_id}catch{}const g={release:o,environment:a,user:f||void 0,profile_id:p||void 0,replay_id:d||void 0,transaction:r,"user_agent.original":(v=De.navigator)==null?void 0:v.userAgent,"client.address":c?"{{auto}}":void 0,...i};return Js({name:n,attributes:g,startTime:s,experimental:{standalone:!0}})}function xp(){return De.addEventListener&&De.performance}function mt(t){return t/1e3}function cS(t){let e="unknown",n="unknown",r="";for(const i of t){if(i==="/"){[e,n]=t.split("/");break}if(!isNaN(Number(i))){e=r==="h"?"http":r,n=t.split(r)[1];break}r+=i}return r===t&&(e=r),{name:e,version:n}}function _2(){let t=0,e,n;if(!b2())return;let r=!1;function i(){r||(r=!0,n&&y2(t,e,n),s())}const s=Tp(({metric:o})=>{const a=o.entries[o.entries.length-1];a&&(t=o.value,e=a)},!0);ro(()=>{i()}),setTimeout(()=>{const o=oe();if(!o)return;const a=o.on("startNavigationSpan",()=>{i(),a==null||a()}),c=$t();if(c){const u=xt(c);Re(u).op==="pageload"&&(n=u.spanContext().spanId)}},0)}function y2(t,e,n){var c;Ka&&L.log(`Sending CLS span (${t})`);const r=mt((dn()||0)+((e==null?void 0:e.startTime)||0)),i=Be().getScopeData().transactionName,s=e?Mr((c=e.sources[0])==null?void 0:c.node):"Layout shift",o={[It]:"auto.http.browser.cls",[Fr]:"ui.webvital.cls",[Ha]:(e==null?void 0:e.duration)||0,"sentry.pageload.span_id":n},a=aS({name:s,transaction:i,attributes:o,startTime:r});a&&(a.addEvent("cls",{[Qu]:"",[el]:t}),a.end(r))}function b2(){try{return PerformanceObserver.supportedEntryTypes.includes("layout-shift")}catch{return!1}}const w2=2147483647;let uS=0,Ut={},hn,oo;function S2({recordClsStandaloneSpans:t}){const e=xp();if(e&&dn()){e.mark&&De.performance.mark("sentry-tracing-init");const n=x2(),r=I2(),i=R2(),s=t?_2():T2();return()=>{n(),r(),i(),s==null||s()}}return()=>{}}function E2(){io("longtask",({entries:t})=>{const e=$t();if(!e)return;const{op:n,start_timestamp:r}=Re(e);for(const i of t){const s=mt(dn()+i.startTime),o=mt(i.duration);n==="navigation"&&r&&s<r||Hr(e,s,s+o,{name:"Main UI thread blocked",op:"ui.long-task",attributes:{[It]:"auto.ui.browser.metrics"}})}})}function k2(){new PerformanceObserver(e=>{const n=$t();if(n)for(const r of e.getEntries()){if(!r.scripts[0])continue;const i=mt(dn()+r.startTime),{start_timestamp:s,op:o}=Re(n);if(o==="navigation"&&s&&i<s)continue;const a=mt(r.duration),c={[It]:"auto.ui.browser.metrics"},u=r.scripts[0],{invoker:d,invokerType:l,sourceURL:h,sourceFunctionName:f,sourceCharPosition:p}=u;c["browser.script.invoker"]=d,c["browser.script.invoker_type"]=l,h&&(c["code.filepath"]=h),f&&(c["code.function"]=f),p!==-1&&(c["browser.script.source_char_position"]=p),Hr(n,i,i+a,{name:"Main UI thread blocked",op:"ui.long-animation-frame",attributes:c})}}).observe({type:"long-animation-frame",buffered:!0})}function C2(){io("event",({entries:t})=>{const e=$t();if(e){for(const n of t)if(n.name==="click"){const r=mt(dn()+n.startTime),i=mt(n.duration),s={name:Mr(n.target),op:`ui.interaction.${n.name}`,startTime:r,attributes:{[It]:"auto.ui.browser.metrics"}},o=zb(n.target);o&&(s.attributes["ui.component_name"]=o),Hr(e,r,r+i,s)}}})}function T2(){return Tp(({metric:t})=>{const e=t.entries[t.entries.length-1];e&&(Ut.cls={value:t.value,unit:""},oo=e)},!0)}function I2(){return nS(({metric:t})=>{const e=t.entries[t.entries.length-1];e&&(Ut.lcp={value:t.value,unit:"millisecond"},hn=e)},!0)}function x2(){return rS(({metric:t})=>{const e=t.entries[t.entries.length-1];if(!e)return;const n=mt(dn()),r=mt(e.startTime);Ut.fid={value:t.value,unit:"millisecond"},Ut["mark.fid"]={value:n+r,unit:"second"}})}function R2(){return l2(({metric:t})=>{t.entries[t.entries.length-1]&&(Ut.ttfb={value:t.value,unit:"millisecond"})})}function A2(t,e){const n=xp(),r=dn();if(!(n!=null&&n.getEntries)||!r)return;const i=mt(r),s=n.getEntries(),{op:o,start_timestamp:a}=Re(t);if(s.slice(uS).forEach(c=>{const u=mt(c.startTime),d=mt(Math.max(0,c.duration));if(!(o==="navigation"&&a&&i+u<a))switch(c.entryType){case"navigation":{M2(t,c,i);break}case"mark":case"paint":case"measure":{P2(t,c,u,d,i);const l=yl(),h=c.startTime<l.firstHiddenTime;c.name==="first-paint"&&h&&(Ut.fp={value:c.startTime,unit:"millisecond"}),c.name==="first-contentful-paint"&&h&&(Ut.fcp={value:c.startTime,unit:"millisecond"});break}case"resource":{D2(t,c,c.name,u,d,i);break}}}),uS=Math.max(s.length-1,0),N2(t),o==="pageload"){$2(Ut);const c=Ut["mark.fid"];c&&Ut.fid&&(Hr(t,c.value,c.value+mt(Ut.fid.value),{name:"first input delay",op:"ui.action",attributes:{[It]:"auto.ui.browser.metrics"}}),delete Ut["mark.fid"]),(!("fcp"in Ut)||!e.recordClsOnPageloadSpan)&&delete Ut.cls,Object.entries(Ut).forEach(([u,d])=>{A0(u,d.value,d.unit)}),t.setAttribute("performance.timeOrigin",i),t.setAttribute("performance.activationStart",Ya()),F2(t)}hn=void 0,oo=void 0,Ut={}}function P2(t,e,n,r,i){const s=Ga(!1),o=mt(s?s.requestStart:0),a=i+Math.max(n,o),c=i+n,u=c+r,d={[It]:"auto.resource.browser.metrics"};a!==c&&(d["sentry.browser.measure_happened_before_request"]=!0,d["sentry.browser.measure_start_time"]=a),a<=u&&Hr(t,a,u,{name:e.name,op:e.entryType,attributes:d})}function M2(t,e,n){["unloadEvent","redirect","domContentLoadedEvent","loadEvent","connect"].forEach(r=>{Sl(t,e,r,n)}),Sl(t,e,"secureConnection",n,"TLS/SSL"),Sl(t,e,"fetch",n,"cache"),Sl(t,e,"domainLookup",n,"DNS"),L2(t,e,n)}function Sl(t,e,n,r,i=n){const s=O2(n),o=e[s],a=e[`${n}Start`];!a||!o||Hr(t,r+mt(a),r+mt(o),{op:`browser.${i}`,name:e.name,attributes:{[It]:"auto.ui.browser.metrics"}})}function O2(t){return t==="secureConnection"?"connectEnd":t==="fetch"?"domainLookupStart":`${t}End`}function L2(t,e,n){const r=n+mt(e.requestStart),i=n+mt(e.responseEnd),s=n+mt(e.responseStart);e.responseEnd&&(Hr(t,r,i,{op:"browser.request",name:e.name,attributes:{[It]:"auto.ui.browser.metrics"}}),Hr(t,s,i,{op:"browser.response",name:e.name,attributes:{[It]:"auto.ui.browser.metrics"}}))}function D2(t,e,n,r,i,s){if(e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch")return;const o=cs(n),a={[It]:"auto.resource.browser.metrics"};Rp(a,e,"transferSize","http.response_transfer_size"),Rp(a,e,"encodedBodySize","http.response_content_length"),Rp(a,e,"decodedBodySize","http.decoded_response_content_length");const c=e.deliveryType;c!=null&&(a["http.response_delivery_type"]=c);const u=e.renderBlockingStatus;u&&(a["resource.render_blocking_status"]=u),o.protocol&&(a["url.scheme"]=o.protocol.split(":").pop()),o.host&&(a["server.address"]=o.host),a["url.same_origin"]=n.includes(De.location.origin);const{name:d,version:l}=cS(e.nextHopProtocol);a["network.protocol.name"]=d,a["network.protocol.version"]=l;const h=s+r,f=h+i;Hr(t,h,f,{name:n.replace(De.location.origin,""),op:e.initiatorType?`resource.${e.initiatorType}`:"resource.other",attributes:a})}function N2(t){const e=De.navigator;if(!e)return;const n=e.connection;n&&(n.effectiveType&&t.setAttribute("effectiveConnectionType",n.effectiveType),n.type&&t.setAttribute("connectionType",n.type),Ip(n.rtt)&&(Ut["connection.rtt"]={value:n.rtt,unit:"millisecond"})),Ip(e.deviceMemory)&&t.setAttribute("deviceMemory",`${e.deviceMemory} GB`),Ip(e.hardwareConcurrency)&&t.setAttribute("hardwareConcurrency",String(e.hardwareConcurrency))}function F2(t){hn&&(hn.element&&t.setAttribute("lcp.element",Mr(hn.element)),hn.id&&t.setAttribute("lcp.id",hn.id),hn.url&&t.setAttribute("lcp.url",hn.url.trim().slice(0,200)),hn.loadTime!=null&&t.setAttribute("lcp.loadTime",hn.loadTime),hn.renderTime!=null&&t.setAttribute("lcp.renderTime",hn.renderTime),t.setAttribute("lcp.size",hn.size)),oo!=null&&oo.sources&&oo.sources.forEach((e,n)=>t.setAttribute(`cls.source.${n+1}`,Mr(e.node)))}function Rp(t,e,n,r){const i=e[n];i!=null&&i<w2&&(t[r]=i)}function $2(t){const e=Ga(!1);if(!e)return;const{responseStart:n,requestStart:r}=e;r<=n&&(t["ttfb.requestTime"]={value:n-r,unit:"millisecond"})}const U2=1e3;let lS,Ap,Pp;function dS(t){const e="dom";pi(e,t),gi(e,B2)}function B2(){if(!De.document)return;const t=Rn.bind(null,"dom"),e=fS(t,!0);De.document.addEventListener("click",e,!1),De.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{var s,o;const i=(s=De[n])==null?void 0:s.prototype;(o=i==null?void 0:i.hasOwnProperty)!=null&&o.call(i,"addEventListener")&&(tn(i,"addEventListener",function(a){return function(c,u,d){if(c==="click"||c=="keypress")try{const l=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},h=l[c]=l[c]||{refCount:0};if(!h.handler){const f=fS(t);h.handler=f,a.call(this,c,f,d)}h.refCount++}catch{}return a.call(this,c,u,d)}}),tn(i,"removeEventListener",function(a){return function(c,u,d){if(c==="click"||c=="keypress")try{const l=this.__sentry_instrumentation_handlers__||{},h=l[c];h&&(h.refCount--,h.refCount<=0&&(a.call(this,c,h.handler,d),h.handler=void 0,delete l[c]),Object.keys(l).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return a.call(this,c,u,d)}}))})}function j2(t){if(t.type!==Ap)return!1;try{if(!t.target||t.target._sentryId!==Pp)return!1}catch{}return!0}function H2(t,e){return t!=="keypress"?!1:e!=null&&e.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function fS(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=q2(n);if(H2(n.type,r))return;fn(n,"_sentryCaptured",!0),r&&!r._sentryId&&fn(r,"_sentryId",nn());const i=n.type==="keypress"?"input":n.type;j2(n)||(t({event:n,name:i,global:e}),Ap=n.type,Pp=r?r._sentryId:void 0),clearTimeout(lS),lS=De.setTimeout(()=>{Pp=void 0,Ap=void 0},U2)}}function q2(t){try{return t.target}catch{return null}}let El;function kl(t){const e="history";pi(e,t),gi(e,W2)}function W2(){if(De.addEventListener("popstate",()=>{const e=De.location.href,n=El;if(El=e,n===e)return;Rn("history",{from:n,to:e})}),!_F())return;function t(e){return function(...n){const r=n.length>2?n[2]:void 0;if(r){const i=El,s=String(r);if(El=s,i===s)return e.apply(this,n);Rn("history",{from:i,to:s})}return e.apply(this,n)}}tn(De.history,"pushState",t),tn(De.history,"replaceState",t)}const Cl={};function Mp(t){const e=Cl[t];if(e)return e;let n=De[t];if(fp(n))return Cl[t]=n.bind(De);const r=De.document;if(r&&typeof r.createElement=="function")try{const i=r.createElement("iframe");i.hidden=!0,r.head.appendChild(i);const s=i.contentWindow;s!=null&&s[t]&&(n=s[t]),r.head.removeChild(i)}catch(i){Ka&&L.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,i)}return n&&(Cl[t]=n.bind(De))}function hS(t){Cl[t]=void 0}function ao(...t){return Mp("setTimeout")(...t)}const qr="__sentry_xhr_v3__";function Op(t){const e="xhr";pi(e,t),gi(e,z2)}function z2(){if(!De.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,r){const i=new Error,s=At()*1e3,o=Vn(r[0])?r[0].toUpperCase():void 0,a=V2(r[1]);if(!o||!a)return e.apply(n,r);n[qr]={method:o,url:a,request_headers:{}},o==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const c=()=>{const u=n[qr];if(u&&n.readyState===4){try{u.status_code=n.status}catch{}const d={endTimestamp:At()*1e3,startTimestamp:s,xhr:n,virtualError:i};Rn("xhr",d)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(u,d,l){return c(),u.apply(d,l)}}):n.addEventListener("readystatechange",c),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(u,d,l){const[h,f]=l,p=d[qr];return p&&Vn(h)&&Vn(f)&&(p.request_headers[h.toLowerCase()]=f),u.apply(d,l)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const i=n[qr];if(!i)return e.apply(n,r);r[0]!==void 0&&(i.body=r[0]);const s={startTimestamp:At()*1e3,xhr:n};return Rn("xhr",s),e.apply(n,r)}})}function V2(t){if(Vn(t))return t;try{return t.toString()}catch{}}function pS(t){return new URLSearchParams(t).toString()}function Tl(t,e=L){try{if(typeof t=="string")return[t];if(t instanceof URLSearchParams)return[t.toString()];if(t instanceof FormData)return[pS(t)];if(!t)return[void 0]}catch(n){return Ka&&e.error(n,"Failed to serialize body",t),[void 0,"BODY_PARSE_ERROR"]}return Ka&&e.info("Skipping network body because of body type",t),[void 0,"UNPARSEABLE_BODY_TYPE"]}function Lp(t=[]){if(!(t.length!==2||typeof t[1]!="object"))return t[1].body}const Dp=[],Il=new Map;function K2(){if(xp()&&dn()){const e=G2();return()=>{e()}}return()=>{}}const gS={click:"click",pointerdown:"click",pointerup:"click",mousedown:"click",mouseup:"click",touchstart:"click",touchend:"click",mouseover:"hover",mouseout:"hover",mouseenter:"hover",mouseleave:"hover",pointerover:"hover",pointerout:"hover",pointerenter:"hover",pointerleave:"hover",dragstart:"drag",dragend:"drag",drag:"drag",dragenter:"drag",dragleave:"drag",dragover:"drag",drop:"drag",keydown:"press",keyup:"press",keypress:"press",input:"press"};function G2(){return iS(({metric:t})=>{if(t.value==null)return;const e=t.entries.find(p=>p.duration===t.value&&gS[p.name]);if(!e)return;const{interactionId:n}=e,r=gS[e.name],i=mt(dn()+e.startTime),s=mt(t.value),o=$t(),a=o?xt(o):void 0,u=(n!=null?Il.get(n):void 0)||a,d=u?Re(u).description:Be().getScopeData().transactionName,l=Mr(e.target),h={[It]:"auto.http.browser.inp",[Fr]:`ui.interaction.${r}`,[Ha]:e.duration},f=aS({name:l,transaction:d,attributes:h,startTime:i});f&&(f.addEvent("inp",{[Qu]:"millisecond",[el]:t.value}),f.end(i+s))})}function Y2(){const t=({entries:e})=>{const n=$t(),r=n&&xt(n);e.forEach(i=>{if(!v2(i)||!r)return;const s=i.interactionId;if(s!=null&&!Il.has(s)){if(Dp.length>10){const o=Dp.shift();Il.delete(o)}Dp.push(s),Il.set(s,r)}})};io("event",t),io("first-input",t)}function Np(t,e=Mp("fetch")){let n=0,r=0;function i(s){const o=s.body.length;n+=o,r++;const a={body:s.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};if(!e)return hS("fetch"),Ju("No fetch implementation available");try{return e(t.url,a).then(c=>(n-=o,r--,{statusCode:c.status,headers:{"x-sentry-rate-limits":c.headers.get("X-Sentry-Rate-Limits"),"retry-after":c.headers.get("Retry-After")}}))}catch(c){return hS("fetch"),n-=o,r--,Ju(c)}}return lw(t,i)}const Z2=10,X2=20,J2=30,Q2=40,e$=50;function co(t,e,n,r){const i={filename:t,function:e==="<anonymous>"?ur:e,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}const t$=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,n$=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,r$=/\((\S*)(?::(\d+))(?::(\d+))\)/,mS=[J2,t=>{const e=t$.exec(t);if(e){const[,r,i,s]=e;return co(r,ur,+i,+s)}const n=n$.exec(t);if(n){if(n[2]&&n[2].indexOf("eval")===0){const o=r$.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}const[i,s]=bS(n[1]||ur,n[2]);return co(s,i,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}}],i$=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,s$=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,vS=[e$,t=>{const e=i$.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const s=s$.exec(e[3]);s&&(e[1]=e[1]||"eval",e[3]=s[1],e[4]=s[2],e[5]="")}let r=e[3],i=e[1]||ur;return[i,r]=bS(i,r),co(r,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}],o$=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,a$=[Q2,t=>{const e=o$.exec(t);return e?co(e[2],e[1]||ur,+e[3],e[4]?+e[4]:void 0):void 0}],c$=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,u$=[Z2,t=>{const e=c$.exec(t);return e?co(e[2],e[3]||ur,+e[1]):void 0}],l$=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,d$=[X2,t=>{const e=l$.exec(t);return e?co(e[5],e[3]||e[4]||ur,+e[1],+e[2]):void 0}],_S=[mS,vS],yS=Nb(..._S),bS=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:ur,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]};function f$(t,{metadata:e,tunnel:n,dsn:r}){const i={event_id:t.event_id,sent_at:new Date().toISOString(),...(e==null?void 0:e.sdk)&&{sdk:{name:e.sdk.name,version:e.sdk.version}},...!!n&&!!r&&{dsn:os(r)}},s=h$(t);return Ur(i,[s])}function h$(t){return[{type:"user_report"},t]}const Ae=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,xl=1024,p$="Breadcrumbs",wS=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:p$,setup(n){e.console&&xw(v$(n)),e.dom&&dS(m$(n,e.dom)),e.xhr&&Op(_$(n)),e.fetch&&hp(y$(n)),e.history&&kl(b$(n)),e.sentry&&n.on("beforeSendEvent",g$(n))}}};function g$(t){return function(n){oe()===t&&Br({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:es(n)},{event:n})}}function m$(t,e){return function(r){if(oe()!==t)return;let i,s,o=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>xl&&(Ae&&L.warn(`\`dom.maxStringLength\` cannot exceed ${xl}, but a value of ${a} was configured. Sentry will use ${xl} instead.`),a=xl),typeof o=="string"&&(o=[o]);try{const u=r.event,d=w$(u)?u.target:u;i=Mr(d,{keyAttrs:o,maxStringLength:a}),s=zb(d)}catch{i="<unknown>"}if(i.length===0)return;const c={category:`ui.${r.name}`,message:i};s&&(c.data={"ui.component_name":s}),Br(c,{event:r.event,name:r.name,global:r.global})}}function v$(t){return function(n){if(oe()!==t)return;const r={category:"console",data:{arguments:n.args,logger:"console"},level:lp(n.level),message:Xu(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)r.message=`Assertion failed: ${Xu(n.args.slice(1)," ")||"console.assert"}`,r.data.arguments=n.args.slice(1);else return;Br(r,{input:n.args,level:n.level})}}function _$(t){return function(n){if(oe()!==t)return;const{startTimestamp:r,endTimestamp:i}=n,s=n.xhr[qr];if(!r||!i||!s)return;const{method:o,url:a,status_code:c,body:u}=s,d={method:o,url:a,status_code:c},l={xhr:n.xhr,input:u,startTimestamp:r,endTimestamp:i},h={category:"xhr",data:d,type:"http",level:$w(c)};t.emit("beforeOutgoingRequestBreadcrumb",h,l),Br(h,l)}}function y$(t){return function(n){if(oe()!==t)return;const{startTimestamp:r,endTimestamp:i}=n;if(i&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.fetchData.method,n.fetchData.url,n.error){const s=n.fetchData,o={data:n.error,input:n.args,startTimestamp:r,endTimestamp:i},a={category:"fetch",data:s,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",a,o),Br(a,o)}else{const s=n.response,o={...n.fetchData,status_code:s==null?void 0:s.status};n.fetchData.request_body_size,n.fetchData.response_body_size,s==null||s.status;const a={input:n.args,response:s,startTimestamp:r,endTimestamp:i},c={category:"fetch",data:o,type:"http",level:$w(o.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",c,a),Br(c,a)}}}function b$(t){return function(n){if(oe()!==t)return;let r=n.from,i=n.to;const s=cs(ce.location.href);let o=r?cs(r):void 0;const a=cs(i);o!=null&&o.path||(o=s),s.protocol===a.protocol&&s.host===a.host&&(i=a.relative),s.protocol===o.protocol&&s.host===o.host&&(r=o.relative),Br({category:"navigation",data:{from:r,to:i}})}}function w$(t){return!!t&&!!t.target}const S$=["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"],E$="BrowserApiErrors",SS=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...t};return{name:E$,setupOnce(){e.setTimeout&&tn(ce,"setTimeout",ES),e.setInterval&&tn(ce,"setInterval",ES),e.requestAnimationFrame&&tn(ce,"requestAnimationFrame",k$),e.XMLHttpRequest&&"XMLHttpRequest"in ce&&tn(XMLHttpRequest.prototype,"send",C$);const n=e.eventTarget;n&&(Array.isArray(n)?n:S$).forEach(T$)}}};function ES(t){return function(...e){const n=e[0];return e[0]=eo(n,{mechanism:{data:{function:Ar(t)},handled:!1,type:"instrument"}}),t.apply(this,e)}}function k$(t){return function(e){return t.apply(this,[eo(e,{mechanism:{data:{function:"requestAnimationFrame",handler:Ar(t)},handled:!1,type:"instrument"}})])}}function C$(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(i=>{i in n&&typeof n[i]=="function"&&tn(n,i,function(s){const o={mechanism:{data:{function:i,handler:Ar(s)},handled:!1,type:"instrument"}},a=Ph(s);return a&&(o.mechanism.data.handler=Ar(a)),eo(s,o)})}),t.apply(this,e)}}function T$(t){var r,i;const n=(r=ce[t])==null?void 0:r.prototype;(i=n==null?void 0:n.hasOwnProperty)!=null&&i.call(n,"addEventListener")&&(tn(n,"addEventListener",function(s){return function(o,a,c){try{I$(a)&&(a.handleEvent=eo(a.handleEvent,{mechanism:{data:{function:"handleEvent",handler:Ar(a),target:t},handled:!1,type:"instrument"}}))}catch{}return s.apply(this,[o,eo(a,{mechanism:{data:{function:"addEventListener",handler:Ar(a),target:t},handled:!1,type:"instrument"}}),c])}}),tn(n,"removeEventListener",function(s){return function(o,a,c){try{const u=a.__sentry_wrapped__;u&&s.call(this,o,u,c)}catch{}return s.call(this,o,a,c)}}))}function I$(t){return typeof t.handleEvent=="function"}const kS=()=>({name:"BrowserSession",setupOnce(){if(typeof ce.document>"u"){Ae&&L.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}ep({ignoreDuration:!0}),np(),kl(({from:t,to:e})=>{t!==void 0&&t!==e&&(ep({ignoreDuration:!0}),np())})}}),x$="GlobalHandlers",CS=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:x$,setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(R$(n),TS("onerror")),e.onunhandledrejection&&(A$(n),TS("onunhandledrejection"))}}};function R$(t){$b(e=>{const{stackParser:n,attachStacktrace:r}=IS();if(oe()!==t||qw())return;const{msg:i,url:s,line:o,column:a,error:c}=e,u=O$(yp(n,c||i,void 0,r,!1),s,o,a);u.level="error",Va(u,{originalException:c,mechanism:{handled:!1,type:"onerror"}})})}function A$(t){Ub(e=>{const{stackParser:n,attachStacktrace:r}=IS();if(oe()!==t||qw())return;const i=P$(e),s=xh(i)?M$(i):yp(n,i,void 0,r,!0);s.level="error",Va(s,{originalException:i,mechanism:{handled:!1,type:"onunhandledrejection"}})})}function P$(t){if(xh(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function M$(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function O$(t,e,n,r){const i=t.exception=t.exception||{},s=i.values=i.values||[],o=s[0]=s[0]||{},a=o.stacktrace=o.stacktrace||{},c=a.frames=a.frames||[],u=r,d=n,l=Vn(e)&&e.length>0?e:Qi();return c.length===0&&c.push({colno:u,filename:l,function:ur,in_app:!0,lineno:d}),t}function TS(t){Ae&&L.log(`Global Handler attached: ${t}`)}function IS(){const t=oe();return(t==null?void 0:t.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}const xS=()=>({name:"HttpContext",preprocessEvent(t){var o,a;if(!ce.navigator&&!ce.location&&!ce.document)return;const e=((o=t.request)==null?void 0:o.url)||Qi(),{referrer:n}=ce.document||{},{userAgent:r}=ce.navigator||{},i={...(a=t.request)==null?void 0:a.headers,...n&&{Referer:n},...r&&{"User-Agent":r}},s={...t.request,...e&&{url:e},headers:i};t.request=s}}),L$="cause",D$=5,N$="LinkedErrors",RS=(t={})=>{const e=t.limit||D$,n=t.key||L$;return{name:N$,preprocessEvent(r,i,s){const o=s.getOptions();MN(ml,o.stackParser,o.maxValueLength,n,e,r,i)}}};function AS(t){return[bw(),_w(),SS(),wS(),CS(),RS(),Rw(),xS(),kS()]}function F$(t={}){var n;return{...{defaultIntegrations:AS(),release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(n=ce.SENTRY_RELEASE)==null?void 0:n.id,sendClientReports:!0},...$$(t)}}function $$(t){const e={};for(const n of Object.getOwnPropertyNames(t)){const r=n;t[r]!==void 0&&(e[r]=t[r])}return e}function U$(){var c;const t=typeof ce.window<"u"&&ce;if(!t)return!1;const e=t.chrome?"chrome":"browser",n=t[e],r=(c=n==null?void 0:n.runtime)==null?void 0:c.id,i=Qi()||"",s=["chrome-extension:","moz-extension:","ms-browser-extension:","safari-web-extension:"],o=!!r&&ce===ce.top&&s.some(u=>i.startsWith(`${u}//`)),a=typeof t.nw<"u";return!!r&&!o&&!a}function PS(t={}){const e=F$(t);if(!e.skipBrowserExtensionCheck&&U$()){Ae&&Ji(()=>{console.error("[Sentry] You cannot run Sentry this way in a browser extension, check: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")});return}Ae&&!Uw()&&L.warn("No Fetch API detected. The Sentry SDK requires a Fetch API compatible environment to send events. Please add a Fetch API polyfill.");const n={...e,stackParser:UO(e.stackParser||yS),integrations:qD(e),transport:e.transport||Np};return iN(Kw,n)}function B$(t={}){if(!ce.document){Ae&&L.error("Global document not defined in showReportDialog call");return}const e=Be(),n=e.getClient(),r=n==null?void 0:n.getDsn();if(!r){Ae&&L.error("DSN not configured for showReportDialog call");return}if(e&&(t.user={...e.getUser(),...t.user}),!t.eventId){const a=q0();a&&(t.eventId=a)}const i=ce.document.createElement("script");i.async=!0,i.crossOrigin="anonymous",i.src=jD(r,t),t.onLoad&&(i.onload=t.onLoad);const{onClose:s}=t;if(s){const a=c=>{if(c.data==="__sentry_reportdialog_closed__")try{s()}finally{ce.removeEventListener("message",a)}};ce.addEventListener("message",a)}const o=ce.document.head||ce.document.body;o?o.appendChild(i):Ae&&L.error("Not injecting report dialog. No injection point found in HTML")}function j$(){}function H$(t){t()}const q$={replayIntegration:"replay",replayCanvasIntegration:"replay-canvas",feedbackIntegration:"feedback",feedbackModalIntegration:"feedback-modal",feedbackScreenshotIntegration:"feedback-screenshot",captureConsoleIntegration:"captureconsole",contextLinesIntegration:"contextlines",linkedErrorsIntegration:"linkederrors",dedupeIntegration:"dedupe",extraErrorDataIntegration:"extraerrordata",graphqlClientIntegration:"graphqlclient",httpClientIntegration:"httpclient",reportingObserverIntegration:"reportingobserver",rewriteFramesIntegration:"rewriteframes",browserProfilingIntegration:"browserprofiling",moduleMetadataIntegration:"modulemetadata"},MS=ce;async function OS(t,e){const n=q$[t],r=MS.Sentry=MS.Sentry||{};if(!n)throw new Error(`Cannot lazy load integration: ${t}`);const i=r[t];if(typeof i=="function"&&!("_isShim"in i))return i;const s=W$(n),o=ce.document.createElement("script");o.src=s,o.crossOrigin="anonymous",o.referrerPolicy="strict-origin",e&&o.setAttribute("nonce",e);const a=new Promise((l,h)=>{o.addEventListener("load",()=>l()),o.addEventListener("error",h)}),c=ce.document.currentScript,u=ce.document.body||ce.document.head||(c==null?void 0:c.parentElement);if(u)u.appendChild(o);else throw new Error(`Could not find parent element to insert lazy-loaded ${t} script`);try{await a}catch{throw new Error(`Error when loading integration: ${t}`)}const d=r[t];if(typeof d!="function")throw new Error(`Could not load integration: ${t}`);return d}function W$(t){var r;const e=oe(),n=((r=e==null?void 0:e.getOptions())==null?void 0:r.cdnBaseUrl)||"";return new URL(`/${xr}/${t}.min.js`,n).toString()}const z$=5e3;let Fp;function V$(t){Fp&&clearTimeout(Fp),Fp=setTimeout(()=>{hl(t)},z$)}let LS=!1;function K$(t){var e;LS||!((e=t.getOptions()._experiments)!=null&&e.enableLogs)||(LS=!0,ce.document&&ce.document.addEventListener("visibilitychange",()=>{ce.document.visibilityState==="hidden"&&hl(t)}),t.on("flush",()=>{hl(t)}))}function uo(t,e,n,r){const i=oe();i&&(K$(i),V$(i)),rN({level:t,message:e,attributes:n,severityNumber:r},i,void 0)}function G$(t,e){uo("trace",t,e)}function Y$(t,e){uo("debug",t,e)}function Z$(t,e){uo("info",t,e)}function X$(t,e){uo("warn",t,e)}function J$(t,e){uo("error",t,e)}function Q$(t,e){uo("fatal",t,e)}const e3=Object.freeze(Object.defineProperty({__proto__:null,debug:Y$,error:J$,fatal:Q$,fmt:mN,info:Z$,trace:G$,warn:X$},Symbol.toStringTag,{value:"Module"})),t3=ke,n3="ReportingObserver",DS=new WeakMap,r3=(t={})=>{const e=t.types||["crash","deprecation","intervention"];function n(r){if(DS.has(oe()))for(const i of r)Gn(s=>{s.setExtra("url",i.url);const o=`ReportingObserver [${i.type}]`;let a="No details available";if(i.body){const c={};for(const u in i.body)c[u]=i.body[u];if(s.setExtra("body",c),i.type==="crash"){const u=i.body;a=[u.crashId||"",u.reason||""].join(" ").trim()||a}else a=i.body.message||a}dl(`${o}: ${a}`)})}return{name:n3,setupOnce(){if(!yF())return;new t3.ReportingObserver(n,{buffered:!0,types:e}).observe()},setup(r){DS.set(r,!0)}}},i3="HttpClient",s3=(t={})=>{const e={failedRequestStatusCodes:[[500,599]],failedRequestTargets:[/.*/],...t};return{name:i3,setup(n){h3(n,e),p3(n,e)}}};function o3(t,e,n,r,i){if($S(t,n.status,n.url)){const s=g3(e,r);let o,a,c,u;BS()&&([o,c]=NS("Cookie",s),[a,u]=NS("Set-Cookie",n));const d=US({url:s.url,method:s.method,status:n.status,requestHeaders:o,responseHeaders:a,requestCookies:c,responseCookies:u,error:i});Va(d)}}function NS(t,e){const n=u3(e.headers);let r;try{const i=n[t]||n[t.toLowerCase()]||void 0;i&&(r=FS(i))}catch{}return[n,r]}function a3(t,e,n,r,i){if($S(t,e.status,e.responseURL)){let s,o,a;if(BS()){try{const u=e.getResponseHeader("Set-Cookie")||e.getResponseHeader("set-cookie")||void 0;u&&(o=FS(u))}catch{}try{a=l3(e)}catch{}s=r}const c=US({url:e.responseURL,method:n,status:e.status,requestHeaders:s,responseHeaders:a,responseCookies:o,error:i});Va(c)}}function c3(t){if(t){const e=t["Content-Length"]||t["content-length"];if(e)return parseInt(e,10)}}function FS(t){return t.split("; ").reduce((e,n)=>{const[r,i]=n.split("=");return r&&i&&(e[r]=i),e},{})}function u3(t){const e={};return t.forEach((n,r)=>{e[r]=n}),e}function l3(t){const e=t.getAllResponseHeaders();return e?e.split(`\r
`).reduce((n,r)=>{const[i,s]=r.split(": ");return i&&s&&(n[i]=s),n},{}):{}}function d3(t,e){return t.some(n=>typeof n=="string"?e.includes(n):n.test(e))}function f3(t,e){return t.some(n=>typeof n=="number"?n===e:e>=n[0]&&e<=n[1])}function h3(t,e){Bw()&&hp(n=>{if(oe()!==t)return;const{response:r,args:i,error:s,virtualError:o}=n,[a,c]=i;r&&o3(e,a,r,c,s||o)},!1)}function p3(t,e){"XMLHttpRequest"in ke&&Op(n=>{if(oe()!==t)return;const{error:r,virtualError:i}=n,s=n.xhr,o=s[qr];if(!o)return;const{method:a,request_headers:c}=o;try{a3(e,s,a,c,r||i)}catch(u){Ae&&L.warn("Error while extracting response event form XHR response",u)}})}function $S(t,e,n){return f3(t.failedRequestStatusCodes,e)&&d3(t.failedRequestTargets,n)&&!fw(n,oe())}function US(t){const e=oe(),n=e&&t.error&&t.error instanceof Error?t.error.stack:void 0,r=n&&e?e.getOptions().stackParser(n,0,1):void 0,i=`HTTP Client Error with status code: ${t.status}`,s={message:i,exception:{values:[{type:"Error",value:i,stacktrace:r?{frames:r}:void 0}]},request:{url:t.url,method:t.method,headers:t.requestHeaders,cookies:t.requestCookies},contexts:{response:{status_code:t.status,headers:t.responseHeaders,cookies:t.responseCookies,body_size:c3(t.responseHeaders)}}};return vi(s,{type:"http.client",handled:!1}),s}function g3(t,e){return!e&&t instanceof Request||t instanceof Request&&t.bodyUsed?t:new Request(t,e)}function BS(){const t=oe();return t?!!t.getOptions().sendDefaultPii:!1}const $p=ke,m3=7,v3="ContextLines",_3=(t={})=>{const e=t.frameContextLines!=null?t.frameContextLines:m3;return{name:v3,processEvent(n){return y3(n,e)}}};function y3(t,e){var a;const n=$p.document,r=$p.location&&dp($p.location.href);if(!n||!r)return t;const i=(a=t.exception)==null?void 0:a.values;if(!(i!=null&&i.length))return t;const s=n.documentElement.innerHTML;if(!s)return t;const o=["<!DOCTYPE html>","<html>",...s.split(`
`),"</html>"];return i.forEach(c=>{const u=c.stacktrace;u!=null&&u.frames&&(u.frames=u.frames.map(d=>b3(d,o,r,e)))}),t}function b3(t,e,n,r){return t.filename!==n||!t.lineno||!e.length||eL(e,t,r),t}const w3="GraphQLClient",S3=t=>({name:w3,setup(e){E3(e,t),k3(e,t)}});function E3(t,e){t.on("beforeOutgoingRequestSpan",(n,r)=>{const s=Re(n).data||{};if(!(s[Fr]==="http.client"))return;const c=s[pL]||s["http.url"],u=s[hL]||s["http.method"];if(!Vn(c)||!Vn(u))return;const{endpoints:d}=e,l=lr(c,d),h=HS(r);if(l&&h){const f=qS(h);if(f){const p=jS(f);n.updateName(`${u} ${c} (${p})`),n.setAttribute("graphql.document",h)}}})}function k3(t,e){t.on("beforeOutgoingRequestBreadcrumb",(n,r)=>{const{category:i,type:s,data:o}=n;if(s==="http"&&(i==="fetch"||i==="xhr")){const d=o==null?void 0:o.url,{endpoints:l}=e,h=lr(d,l),f=HS(r);if(h&&o&&f){const p=qS(f);if(!o.graphql&&p){const g=jS(p);o["graphql.document"]=p.query,o["graphql.operation"]=g}}}})}function jS(t){const{query:e,operationName:n}=t,{operationName:r=n,operationType:i}=C3(e);return r?`${i} ${r}`:`${i}`}function HS(t){const e="xhr"in t;let n;if(e){const r=t.xhr[qr];n=r&&Tl(r.body)[0]}else{const r=Lp(t.input);n=Tl(r)[0]}return n}function C3(t){const e=/^(?:\s*)(query|mutation|subscription)(?:\s*)(\w+)(?:\s*)[{(]/,n=/^(?:\s*)(query|mutation|subscription)(?:\s*)[{(]/,r=t.match(e);if(r)return{operationType:r[1],operationName:r[2]};const i=t.match(n);return i?{operationType:i[1],operationName:void 0}:{operationType:void 0,operationName:void 0}}function qS(t){let e;try{const n=JSON.parse(t);!!n.query&&(e=n)}finally{return e}}const T3=S3,tt=ke,Up="sentryReplaySession",I3="replay_event",Bp="Unable to send Replay",x3=3e5,R3=9e5,A3=5e3,P3=5500,M3=6e4,O3=5e3,L3=3,WS=15e4,Rl=5e3,D3=3e3,N3=300,jp=2e7,F3=4999,$3=15e3,zS=36e5;var U3=Object.defineProperty,B3=(t,e,n)=>e in t?U3(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,VS=(t,e,n)=>B3(t,typeof e!="symbol"?e+"":e,n),Mt=(t=>(t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t))(Mt||{});function j3(t){return t.nodeType===t.ELEMENT_NODE}function ec(t){const e=t==null?void 0:t.host;return(e==null?void 0:e.shadowRoot)===t}function tc(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function H3(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}function q3(t){const{cssText:e}=t;if(e.split('"').length<3)return e;const n=["@import",`url(${JSON.stringify(t.href)})`];return t.layerName===""?n.push("layer"):t.layerName&&n.push(`layer(${t.layerName})`),t.supportsText&&n.push(`supports(${t.supportsText})`),t.media.length&&n.push(t.media.mediaText),n.join(" ")+";"}function Al(t){try{const e=t.rules||t.cssRules;return e?H3(Array.from(e,KS).join("")):null}catch{return null}}function W3(t){let e="";for(let n=0;n<t.style.length;n++){const r=t.style,i=r[n],s=r.getPropertyPriority(i);e+=`${i}:${r.getPropertyValue(i)}${s?" !important":""};`}return`${t.selectorText} { ${e} }`}function KS(t){let e;if(V3(t))try{e=Al(t.styleSheet)||q3(t)}catch{}else if(K3(t)){let n=t.cssText;const r=t.selectorText.includes(":"),i=typeof t.style.all=="string"&&t.style.all;if(i&&(n=W3(t)),r&&(n=z3(n)),r||i)return n}return e||t.cssText}function z3(t){const e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return t.replace(e,"$1\\$2")}function V3(t){return"styleSheet"in t}function K3(t){return"selectorText"in t}let GS=class{constructor(){VS(this,"idNodeMap",new Map),VS(this,"nodeMetaMap",new WeakMap)}getId(e){var r;return e?((r=this.getMeta(e))==null?void 0:r.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,n){const r=n.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,n)}replace(e,n){const r=this.getNode(e);if(r){const i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(n,i)}this.idNodeMap.set(e,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function G3(){return new GS}function Pl({maskInputOptions:t,tagName:e,type:n}){return e==="OPTION"&&(e="SELECT"),!!(t[e.toLowerCase()]||n&&t[n]||n==="password"||e==="INPUT"&&!n&&t.text)}function nc({isMasked:t,element:e,value:n,maskInputFn:r}){let i=n||"";return t?(r&&(i=r(i,e)),"*".repeat(i.length)):i}function lo(t){return t.toLowerCase()}function Hp(t){return t.toUpperCase()}const YS="__rrweb_original__";function Y3(t){const e=t.getContext("2d");if(!e)return!0;const n=50;for(let r=0;r<t.width;r+=n)for(let i=0;i<t.height;i+=n){const s=e.getImageData,o=YS in s?s[YS]:s;if(new Uint32Array(o.call(e,r,i,Math.min(n,t.width-r),Math.min(n,t.height-i)).data.buffer).some(c=>c!==0))return!1}return!0}function qp(t){const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?lo(e):null}function Ml(t,e,n){return e==="INPUT"&&(n==="radio"||n==="checkbox")?t.getAttribute("value")||"":t.value}function ZS(t,e){let n;try{n=new URL(t,e??window.location.href)}catch{return null}const r=/\.([0-9a-z]+)(?:$)/i,i=n.pathname.match(r);return(i==null?void 0:i[1])??null}const XS={};function JS(t){const e=XS[t];if(e)return e;const n=window.document;let r=window[t];if(n&&typeof n.createElement=="function")try{const i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);const s=i.contentWindow;s&&s[t]&&(r=s[t]),n.head.removeChild(i)}catch{}return XS[t]=r.bind(window)}function Wp(...t){return JS("setTimeout")(...t)}function QS(...t){return JS("clearTimeout")(...t)}function eE(t){try{return t.contentDocument}catch{}}let Z3=1;const X3=new RegExp("[^a-z0-9-_:]"),rc=-2;function zp(){return Z3++}function J3(t){if(t instanceof HTMLFormElement)return"form";const e=lo(t.tagName);return X3.test(e)?"div":e}function Q3(t){let e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}let fo,tE;const eU=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,tU=/^(?:[a-z+]+:)?\/\//i,nU=/^www\..*/i,rU=/^(data:)([^,]*),(.*)/i;function Ol(t,e){return(t||"").replace(eU,(n,r,i,s,o,a)=>{const c=i||o||a,u=r||s||"";if(!c)return n;if(tU.test(c)||nU.test(c))return`url(${u}${c}${u})`;if(rU.test(c))return`url(${u}${c}${u})`;if(c[0]==="/")return`url(${u}${Q3(e)+c}${u})`;const d=e.split("/"),l=c.split("/");d.pop();for(const h of l)h!=="."&&(h===".."?d.pop():d.push(h));return`url(${u}${d.join("/")}${u})`})}const iU=/^[^ \t\n\r\u000c]+/,sU=/^[, \t\n\r\u000c]+/;function oU(t,e){if(e.trim()==="")return e;let n=0;function r(s){let o;const a=s.exec(e.substring(n));return a?(o=a[0],n+=o.length,o):""}const i=[];for(;r(sU),!(n>=e.length);){let s=r(iU);if(s.slice(-1)===",")s=ho(t,s.substring(0,s.length-1)),i.push(s);else{let o="";s=ho(t,s);let a=!1;for(;;){const c=e.charAt(n);if(c===""){i.push((s+o).trim());break}else if(a)c===")"&&(a=!1);else if(c===","){n+=1,i.push((s+o).trim());break}else c==="("&&(a=!0);o+=c,n+=1}}}return i.join(", ")}const nE=new WeakMap;function ho(t,e){return!e||e.trim()===""?e:Ll(t,e)}function aU(t){return!!(t.tagName==="svg"||t.ownerSVGElement)}function Ll(t,e){let n=nE.get(t);if(n||(n=t.createElement("a"),nE.set(t,n)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return n.setAttribute("href",e),n.href}function rE(t,e,n,r,i,s){return r&&(n==="src"||n==="href"&&!(e==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&(e==="table"||e==="td"||e==="th")?ho(t,r):n==="srcset"?oU(t,r):n==="style"?Ol(r,Ll(t)):e==="object"&&n==="data"?ho(t,r):typeof s=="function"?s(n,r,i):r)}function iE(t,e,n){return(t==="video"||t==="audio")&&e==="autoplay"}function sE(t,e,n,r){try{if(r&&t.matches(r))return!1;if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(let i=t.classList.length;i--;){const s=t.classList[i];if(e.test(s))return!0}if(n)return t.matches(n)}catch{}return!1}function cU(t,e){for(let n=t.classList.length;n--;){const r=t.classList[n];if(e.test(r))return!0}return!1}function ls(t,e,n=1/0,r=0){return!t||t.nodeType!==t.ELEMENT_NODE||r>n?-1:e(t)?r:ls(t.parentNode,e,n,r+1)}function po(t,e){return n=>{const r=n;if(r===null)return!1;try{if(t){if(typeof t=="string"){if(r.matches(`.${t}`))return!0}else if(cU(r,t))return!0}return!!(e&&r.matches(e))}catch{return!1}}}function go(t,e,n,r,i,s){try{const o=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(o===null)return!1;if(o.tagName==="INPUT"){const u=o.getAttribute("autocomplete");if(["current-password","new-password","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc"].includes(u))return!0}let a=-1,c=-1;if(s){if(c=ls(o,po(r,i)),c<0)return!0;a=ls(o,po(e,n),c>=0?c:1/0)}else{if(a=ls(o,po(e,n)),a<0)return!1;c=ls(o,po(r,i),a>=0?a:1/0)}return a>=0?c>=0?a<=c:!0:c>=0?!1:!!s}catch{}return!!s}function uU(t,e,n){const r=t.contentWindow;if(!r)return;let i=!1,s;try{s=r.document.readyState}catch{return}if(s!=="complete"){const a=Wp(()=>{i||(e(),i=!0)},n);t.addEventListener("load",()=>{QS(a),i=!0,e()});return}const o="about:blank";if(r.location.href!==o||t.src===o||t.src==="")return Wp(e,0),t.addEventListener("load",e);t.addEventListener("load",e)}function lU(t,e,n){let r=!1,i;try{i=t.sheet}catch{return}if(i)return;const s=Wp(()=>{r||(e(),r=!0)},n);t.addEventListener("load",()=>{QS(s),r=!0,e()})}function dU(t,e){const{doc:n,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskAttributeFn:c,maskTextClass:u,unmaskTextClass:d,maskTextSelector:l,unmaskTextSelector:h,inlineStylesheet:f,maskInputOptions:p={},maskTextFn:g,maskInputFn:v,dataURLOptions:m={},inlineImages:_,recordCanvas:w,keepIframeSrcFn:T,newlyAddedElement:C=!1}=e,E=fU(n,r);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:Mt.Document,childNodes:[],compatMode:t.compatMode}:{type:Mt.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:Mt.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:E};case t.ELEMENT_NODE:return pU(t,{doc:n,blockClass:i,blockSelector:s,unblockSelector:o,inlineStylesheet:f,maskAttributeFn:c,maskInputOptions:p,maskInputFn:v,dataURLOptions:m,inlineImages:_,recordCanvas:w,keepIframeSrcFn:T,newlyAddedElement:C,rootId:E,maskTextClass:u,unmaskTextClass:d,maskTextSelector:l,unmaskTextSelector:h});case t.TEXT_NODE:return hU(t,{doc:n,maskAllText:a,maskTextClass:u,unmaskTextClass:d,maskTextSelector:l,unmaskTextSelector:h,maskTextFn:g,maskInputOptions:p,maskInputFn:v,rootId:E});case t.CDATA_SECTION_NODE:return{type:Mt.CDATA,textContent:"",rootId:E};case t.COMMENT_NODE:return{type:Mt.Comment,textContent:t.textContent||"",rootId:E};default:return!1}}function fU(t,e){if(!e.hasNode(t))return;const n=e.getId(t);return n===1?void 0:n}function hU(t,e){var m;const{maskAllText:n,maskTextClass:r,unmaskTextClass:i,maskTextSelector:s,unmaskTextSelector:o,maskTextFn:a,maskInputOptions:c,maskInputFn:u,rootId:d}=e,l=t.parentNode&&t.parentNode.tagName;let h=t.textContent;const f=l==="STYLE"?!0:void 0,p=l==="SCRIPT"?!0:void 0,g=l==="TEXTAREA"?!0:void 0;if(f&&h){try{t.nextSibling||t.previousSibling||(m=t.parentNode.sheet)!=null&&m.cssRules&&(h=Al(t.parentNode.sheet))}catch(_){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${_}`,t)}h=Ol(h,Ll(e.doc))}p&&(h="SCRIPT_PLACEHOLDER");const v=go(t,r,s,i,o,n);if(!f&&!p&&!g&&h&&v&&(h=a?a(h,t.parentElement):h.replace(/[\S]/g,"*")),g&&h&&(c.textarea||v)&&(h=u?u(h,t.parentNode):h.replace(/[\S]/g,"*")),l==="OPTION"&&h){const _=Pl({type:null,tagName:l,maskInputOptions:c});h=nc({isMasked:go(t,r,s,i,o,_),element:t,value:h,maskInputFn:u})}return{type:Mt.Text,textContent:h||"",isStyle:f,rootId:d}}function pU(t,e){const{doc:n,blockClass:r,blockSelector:i,unblockSelector:s,inlineStylesheet:o,maskInputOptions:a={},maskAttributeFn:c,maskInputFn:u,dataURLOptions:d={},inlineImages:l,recordCanvas:h,keepIframeSrcFn:f,newlyAddedElement:p=!1,rootId:g,maskTextClass:v,unmaskTextClass:m,maskTextSelector:_,unmaskTextSelector:w}=e,T=sE(t,r,i,s),C=J3(t);let E={};const I=t.attributes.length;for(let b=0;b<I;b++){const k=t.attributes[b];k.name&&!iE(C,k.name,k.value)&&(E[k.name]=rE(n,C,lo(k.name),k.value,t,c))}if(C==="link"&&o){const b=Array.from(n.styleSheets).find(x=>x.href===t.href);let k=null;b&&(k=Al(b)),k&&(E.rel=null,E.href=null,E.crossorigin=null,E._cssText=Ol(k,b.href))}if(C==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){const b=Al(t.sheet);b&&(E._cssText=Ol(b,Ll(n)))}if(C==="input"||C==="textarea"||C==="select"||C==="option"){const b=t,k=qp(b),x=Ml(b,Hp(C),k),R=b.checked;if(k!=="submit"&&k!=="button"&&x){const F=go(b,v,_,m,w,Pl({type:k,tagName:Hp(C),maskInputOptions:a}));E.value=nc({isMasked:F,element:b,value:x,maskInputFn:u})}R&&(E.checked=R)}if(C==="option"&&(t.selected&&!a.select?E.selected=!0:delete E.selected),C==="canvas"&&h){if(t.__context==="2d")Y3(t)||(E.rr_dataURL=t.toDataURL(d.type,d.quality));else if(!("__context"in t)){const b=t.toDataURL(d.type,d.quality),k=n.createElement("canvas");k.width=t.width,k.height=t.height;const x=k.toDataURL(d.type,d.quality);b!==x&&(E.rr_dataURL=b)}}if(C==="img"&&l){fo||(fo=n.createElement("canvas"),tE=fo.getContext("2d"));const b=t,k=b.currentSrc||b.getAttribute("src")||"<unknown-src>",x=b.crossOrigin,R=()=>{b.removeEventListener("load",R);try{fo.width=b.naturalWidth,fo.height=b.naturalHeight,tE.drawImage(b,0,0),E.rr_dataURL=fo.toDataURL(d.type,d.quality)}catch(F){if(b.crossOrigin!=="anonymous"){b.crossOrigin="anonymous",b.complete&&b.naturalWidth!==0?R():b.addEventListener("load",R);return}else console.warn(`Cannot inline img src=${k}! Error: ${F}`)}b.crossOrigin==="anonymous"&&(x?E.crossOrigin=x:b.removeAttribute("crossorigin"))};b.complete&&b.naturalWidth!==0?R():b.addEventListener("load",R)}if((C==="audio"||C==="video")&&(E.rr_mediaState=t.paused?"paused":"played",E.rr_mediaCurrentTime=t.currentTime),p||(t.scrollLeft&&(E.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(E.rr_scrollTop=t.scrollTop)),T){const{width:b,height:k}=t.getBoundingClientRect();E={class:E.class,rr_width:`${b}px`,rr_height:`${k}px`}}C==="iframe"&&!f(E.src)&&(!T&&!eE(t)&&(E.rr_src=E.src),delete E.src);let y;try{customElements.get(C)&&(y=!0)}catch{}return{type:Mt.Element,tagName:C,attributes:E,childNodes:[],isSVG:aU(t)||void 0,needBlock:T,rootId:g,isCustom:y}}function nt(t){return t==null?"":t.toLowerCase()}function gU(t,e){if(e.comment&&t.type===Mt.Comment)return!0;if(t.type===Mt.Element){if(e.script&&(t.tagName==="script"||t.tagName==="link"&&(t.attributes.rel==="preload"||t.attributes.rel==="modulepreload")||t.tagName==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&ZS(t.attributes.href)==="js"))return!0;if(e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(nt(t.attributes.name).match(/^msapplication-tile(image|color)$/)||nt(t.attributes.name)==="application-name"||nt(t.attributes.rel)==="icon"||nt(t.attributes.rel)==="apple-touch-icon"||nt(t.attributes.rel)==="shortcut icon")))return!0;if(t.tagName==="meta"){if(e.headMetaDescKeywords&&nt(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(nt(t.attributes.property).match(/^(og|twitter|fb):/)||nt(t.attributes.name).match(/^(og|twitter):/)||nt(t.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(nt(t.attributes.name)==="robots"||nt(t.attributes.name)==="googlebot"||nt(t.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(nt(t.attributes.name)==="author"||nt(t.attributes.name)==="generator"||nt(t.attributes.name)==="framework"||nt(t.attributes.name)==="publisher"||nt(t.attributes.name)==="progid"||nt(t.attributes.property).match(/^article:/)||nt(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(nt(t.attributes.name)==="google-site-verification"||nt(t.attributes.name)==="yandex-verification"||nt(t.attributes.name)==="csrf-token"||nt(t.attributes.name)==="p:domain_verify"||nt(t.attributes.name)==="verify-v1"||nt(t.attributes.name)==="verification"||nt(t.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function mo(t,e){const{doc:n,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:h=!1,inlineStylesheet:f=!0,maskInputOptions:p={},maskAttributeFn:g,maskTextFn:v,maskInputFn:m,slimDOMOptions:_,dataURLOptions:w={},inlineImages:T=!1,recordCanvas:C=!1,onSerialize:E,onIframeLoad:I,iframeLoadTimeout:y=5e3,onStylesheetLoad:b,stylesheetLoadTimeout:k=5e3,keepIframeSrcFn:x=()=>!1,newlyAddedElement:R=!1}=e;let{preserveWhiteSpace:F=!0}=e;const z=dU(t,{doc:n,mirror:r,blockClass:i,blockSelector:s,maskAllText:a,unblockSelector:o,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,inlineStylesheet:f,maskInputOptions:p,maskAttributeFn:g,maskTextFn:v,maskInputFn:m,dataURLOptions:w,inlineImages:T,recordCanvas:C,keepIframeSrcFn:x,newlyAddedElement:R});if(!z)return console.warn(t,"not serialized"),null;let J;r.hasNode(t)?J=r.getId(t):gU(z,_)||!F&&z.type===Mt.Text&&!z.isStyle&&!z.textContent.replace(/^\s+|\s+$/gm,"").length?J=rc:J=zp();const U=Object.assign(z,{id:J});if(r.add(t,U),J===rc)return null;E&&E(t);let q=!h;if(U.type===Mt.Element){q=q&&!U.needBlock,delete U.needBlock;const V=t.shadowRoot;V&&tc(V)&&(U.isShadowHost=!0)}if((U.type===Mt.Document||U.type===Mt.Element)&&q){_.headWhitespace&&U.type===Mt.Element&&U.tagName==="head"&&(F=!1);const V={doc:n,mirror:r,blockClass:i,blockSelector:s,maskAllText:a,unblockSelector:o,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:h,inlineStylesheet:f,maskInputOptions:p,maskAttributeFn:g,maskTextFn:v,maskInputFn:m,slimDOMOptions:_,dataURLOptions:w,inlineImages:T,recordCanvas:C,preserveWhiteSpace:F,onSerialize:E,onIframeLoad:I,iframeLoadTimeout:y,onStylesheetLoad:b,stylesheetLoadTimeout:k,keepIframeSrcFn:x};for(const j of Array.from(t.childNodes)){const S=mo(j,V);S&&U.childNodes.push(S)}if(j3(t)&&t.shadowRoot)for(const j of Array.from(t.shadowRoot.childNodes)){const S=mo(j,V);S&&(tc(t.shadowRoot)&&(S.isShadow=!0),U.childNodes.push(S))}}return t.parentNode&&ec(t.parentNode)&&tc(t.parentNode)&&(U.isShadow=!0),U.type===Mt.Element&&U.tagName==="iframe"&&!sE(t,i,s,o)&&uU(t,()=>{const V=eE(t);if(V&&I){const j=mo(V,{doc:V,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:!1,inlineStylesheet:f,maskInputOptions:p,maskAttributeFn:g,maskTextFn:v,maskInputFn:m,slimDOMOptions:_,dataURLOptions:w,inlineImages:T,recordCanvas:C,preserveWhiteSpace:F,onSerialize:E,onIframeLoad:I,iframeLoadTimeout:y,onStylesheetLoad:b,stylesheetLoadTimeout:k,keepIframeSrcFn:x});j&&I(t,j)}},y),U.type===Mt.Element&&U.tagName==="link"&&typeof U.attributes.rel=="string"&&(U.attributes.rel==="stylesheet"||U.attributes.rel==="preload"&&typeof U.attributes.href=="string"&&ZS(U.attributes.href)==="css")&&lU(t,()=>{if(b){const V=mo(t,{doc:n,mirror:r,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:l,skipChild:!1,inlineStylesheet:f,maskInputOptions:p,maskAttributeFn:g,maskTextFn:v,maskInputFn:m,slimDOMOptions:_,dataURLOptions:w,inlineImages:T,recordCanvas:C,preserveWhiteSpace:F,onSerialize:E,onIframeLoad:I,iframeLoadTimeout:y,onStylesheetLoad:b,stylesheetLoadTimeout:k,keepIframeSrcFn:x});V&&b(t,V)}},k),U}function mU(t,e){const{mirror:n=new GS,blockClass:r="rr-block",blockSelector:i=null,unblockSelector:s=null,maskAllText:o=!1,maskTextClass:a="rr-mask",unmaskTextClass:c=null,maskTextSelector:u=null,unmaskTextSelector:d=null,inlineStylesheet:l=!0,inlineImages:h=!1,recordCanvas:f=!1,maskAllInputs:p=!1,maskAttributeFn:g,maskTextFn:v,maskInputFn:m,slimDOM:_=!1,dataURLOptions:w,preserveWhiteSpace:T,onSerialize:C,onIframeLoad:E,iframeLoadTimeout:I,onStylesheetLoad:y,stylesheetLoadTimeout:b,keepIframeSrcFn:k=()=>!1}=e||{};return mo(t,{doc:t,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,maskAllText:o,maskTextClass:a,unmaskTextClass:c,maskTextSelector:u,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:l,maskInputOptions:p===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:p===!1?{}:p,maskAttributeFn:g,maskTextFn:v,maskInputFn:m,slimDOMOptions:_===!0||_==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:_==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:_===!1?{}:_,dataURLOptions:w,inlineImages:h,recordCanvas:f,preserveWhiteSpace:T,onSerialize:C,onIframeLoad:E,iframeLoadTimeout:I,onStylesheetLoad:y,stylesheetLoadTimeout:b,keepIframeSrcFn:k,newlyAddedElement:!1})}function rn(t,e,n=document){const r={capture:!0,passive:!0};return n.addEventListener(t,e,r),()=>n.removeEventListener(t,e,r)}const vo=`Please stop import mirror directly. Instead of that,\r
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
or you can use record.mirror to access the mirror instance during recording.`;let oE={map:{},getId(){return console.error(vo),-1},getNode(){return console.error(vo),null},removeNodeFromMap(){console.error(vo)},has(){return console.error(vo),!1},reset(){console.error(vo)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(oE=new Proxy(oE,{get(t,e,n){return e==="map"&&console.error(vo),Reflect.get(t,e,n)}}));function ic(t,e,n={}){let r=null,i=0;return function(...s){const o=Date.now();!i&&n.leading===!1&&(i=o);const a=e-(o-i),c=this;a<=0||a>e?(r&&(EU(r),r=null),i=o,t.apply(c,s)):!r&&n.trailing!==!1&&(r=Nl(()=>{i=n.leading===!1?0:Date.now(),r=null,t.apply(c,s)},a))}}function aE(t,e,n,r,i=window){const s=i.Object.getOwnPropertyDescriptor(t,e);return i.Object.defineProperty(t,e,r?n:{set(o){Nl(()=>{n.set.call(this,o)},0),s&&s.set&&s.set.call(this,o)}}),()=>aE(t,e,s||{},!0)}function Vp(t,e,n){try{if(!(e in t))return()=>{};const r=t[e],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=i,()=>{t[e]=r}}catch{return()=>{}}}let Dl=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Dl=()=>new Date().getTime());function cE(t){var n,r,i,s,o,a;const e=t.document;return{left:e.scrollingElement?e.scrollingElement.scrollLeft:t.pageXOffset!==void 0?t.pageXOffset:(e==null?void 0:e.documentElement.scrollLeft)||((r=(n=e==null?void 0:e.body)==null?void 0:n.parentElement)==null?void 0:r.scrollLeft)||((i=e==null?void 0:e.body)==null?void 0:i.scrollLeft)||0,top:e.scrollingElement?e.scrollingElement.scrollTop:t.pageYOffset!==void 0?t.pageYOffset:(e==null?void 0:e.documentElement.scrollTop)||((o=(s=e==null?void 0:e.body)==null?void 0:s.parentElement)==null?void 0:o.scrollTop)||((a=e==null?void 0:e.body)==null?void 0:a.scrollTop)||0}}function uE(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function lE(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function dE(t){if(!t)return null;try{return t.nodeType===t.ELEMENT_NODE?t:t.parentElement}catch{return null}}function bn(t,e,n,r,i){if(!t)return!1;const s=dE(t);if(!s)return!1;const o=po(e,n);if(!i){const u=r&&s.matches(r);return o(s)&&!u}const a=ls(s,o);let c=-1;return a<0?!1:(r&&(c=ls(s,po(null,r))),a>-1&&c<0?!0:a<c)}function vU(t,e){return e.getId(t)!==-1}function Kp(t,e){return e.getId(t)===rc}function fE(t,e){if(ec(t))return!1;const n=e.getId(t);return e.has(n)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?fE(t.parentNode,e):!0:!0}function Gp(t){return!!t.changedTouches}function _U(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let n=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===n)return!0;while(n=n&&n.parentNode);return!1})}function hE(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function pE(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function Yp(t){return!!(t!=null&&t.shadowRoot)}class yU{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,n){if(this.has(e))return this.getId(e);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function gE(t){var n,r;let e=null;return((r=(n=t.getRootNode)==null?void 0:n.call(t))==null?void 0:r.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&t.getRootNode().host&&(e=t.getRootNode().host),e}function bU(t){let e=t,n;for(;n=gE(e);)e=n;return e}function wU(t){const e=t.ownerDocument;if(!e)return!1;const n=bU(t);return e.contains(n)}function mE(t){const e=t.ownerDocument;return e?e.contains(t)||wU(t):!1}const vE={};function Zp(t){const e=vE[t];if(e)return e;const n=window.document;let r=window[t];if(n&&typeof n.createElement=="function")try{const i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);const s=i.contentWindow;s&&s[t]&&(r=s[t]),n.head.removeChild(i)}catch{}return vE[t]=r.bind(window)}function SU(...t){return Zp("requestAnimationFrame")(...t)}function Nl(...t){return Zp("setTimeout")(...t)}function EU(...t){return Zp("clearTimeout")(...t)}var Oe=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(Oe||{}),we=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(we||{}),sn=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(sn||{}),Wr=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(Wr||{}),_o=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t))(_o||{});function Xp(t){try{return t.contentDocument}catch{}}function kU(t){try{return t.contentWindow}catch{}}function _E(t){return"__ln"in t}class CU{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r<e;r++)n=(n==null?void 0:n.next)||null;return n}addNode(e){const n={value:e,previous:null,next:null};if(e.__ln=n,e.previousSibling&&_E(e.previousSibling)){const r=e.previousSibling.__ln.next;n.next=r,n.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(e.nextSibling&&_E(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;n.previous=r,n.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;n.next===null&&(this.tail=n),this.length++}removeNode(e){const n=e.__ln;this.head&&(n.previous?(n.previous.next=n.next,n.next?n.next.previous=n.previous:this.tail=n.previous):(this.head=n.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const yE=(t,e)=>`${t}@${e}`;class TU{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],n=new Set,r=new CU,i=c=>{let u=c,d=rc;for(;d===rc;)u=u&&u.nextSibling,d=u&&this.mirror.getId(u);return d},s=c=>{if(!c.parentNode||!mE(c))return;const u=ec(c.parentNode)?this.mirror.getId(gE(c)):this.mirror.getId(c.parentNode),d=i(c);if(u===-1||d===-1)return r.addNode(c);const l=mo(c,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskAllText:this.maskAllText,unblockSelector:this.unblockSelector,maskTextClass:this.maskTextClass,unmaskTextClass:this.unmaskTextClass,maskTextSelector:this.maskTextSelector,unmaskTextSelector:this.unmaskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskAttributeFn:this.maskAttributeFn,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:h=>{hE(h,this.mirror)&&!bn(h,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(h),pE(h,this.mirror)&&this.stylesheetManager.trackLinkElement(h),Yp(c)&&this.shadowDomManager.addShadowRoot(c.shadowRoot,this.doc)},onIframeLoad:(h,f)=>{bn(h,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(this.iframeManager.attachIframe(h,f),h.contentWindow&&this.canvasManager.addWindow(h.contentWindow),this.shadowDomManager.observeAttachShadow(h))},onStylesheetLoad:(h,f)=>{this.stylesheetManager.attachLinkElement(h,f)}});l&&(e.push({parentId:u,nextId:d,node:l}),n.add(l.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const c of this.movedSet)bE(this.removes,c,this.mirror)&&!this.movedSet.has(c.parentNode)||s(c);for(const c of this.addedSet)!wE(this.droppedSet,c)&&!bE(this.removes,c,this.mirror)||wE(this.movedSet,c)?s(c):this.droppedSet.add(c);let o=null;for(;r.length;){let c=null;if(o){const u=this.mirror.getId(o.value.parentNode),d=i(o.value);u!==-1&&d!==-1&&(c=o)}if(!c){let u=r.tail;for(;u;){const d=u;if(u=u.previous,d){const l=this.mirror.getId(d.value.parentNode);if(i(d.value)===-1)continue;if(l!==-1){c=d;break}else{const f=d.value;if(f.parentNode&&f.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const p=f.parentNode.host;if(this.mirror.getId(p)!==-1){c=d;break}}}}}}if(!c){for(;r.head;)r.removeNode(r.head.value);break}o=c.previous,r.removeNode(c.value),s(c.value)}const a={texts:this.texts.map(c=>({id:this.mirror.getId(c.node),value:c.value})).filter(c=>!n.has(c.id)).filter(c=>this.mirror.has(c.id)),attributes:this.attributes.map(c=>{const{attributes:u}=c;if(typeof u.style=="string"){const d=JSON.stringify(c.styleDiff),l=JSON.stringify(c._unchangedStyles);d.length<u.style.length&&(d+l).split("var(").length===u.style.split("var(").length&&(u.style=c.styleDiff)}return{id:this.mirror.getId(c.node),attributes:u}}).filter(c=>!n.has(c.id)).filter(c=>this.mirror.has(c.id)),removes:this.removes,adds:e};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.processMutation=e=>{if(!Kp(e.target,this.mirror))switch(e.type){case"characterData":{const n=e.target.textContent;!bn(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&n!==e.oldValue&&this.texts.push({value:go(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&n?this.maskTextFn?this.maskTextFn(n,dE(e.target)):n.replace(/[\S]/g,"*"):n,node:e.target});break}case"attributes":{const n=e.target;let r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){const o=qp(n),a=n.tagName;i=Ml(n,a,o);const c=Pl({maskInputOptions:this.maskInputOptions,tagName:a,type:o}),u=go(e.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,c);i=nc({isMasked:u,element:n,value:i,maskInputFn:this.maskInputFn})}if(bn(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||i===e.oldValue)return;let s=this.attributeMap.get(e.target);if(n.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!Xp(n))r="rr_src";else return;if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(e.target,s)),r==="type"&&n.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&n.setAttribute("data-rr-is-password","true"),!iE(n.tagName,r)&&(s.attributes[r]=rE(this.doc,lo(n.tagName),lo(r),i,n,this.maskAttributeFn),r==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const o=this.unattachedDoc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue);for(const a of Array.from(n.style)){const c=n.style.getPropertyValue(a),u=n.style.getPropertyPriority(a);c!==o.style.getPropertyValue(a)||u!==o.style.getPropertyPriority(a)?u===""?s.styleDiff[a]=c:s.styleDiff[a]=[c,u]:s._unchangedStyles[a]=[c,u]}for(const a of Array.from(o.style))n.style.getPropertyValue(a)===""&&(s.styleDiff[a]=!1)}break}case"childList":{if(bn(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!0))return;e.addedNodes.forEach(n=>this.genAdds(n,e.target)),e.removedNodes.forEach(n=>{const r=this.mirror.getId(n),i=ec(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);bn(e.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||Kp(n,this.mirror)||!vU(n,this.mirror)||(this.addedSet.has(n)?(Jp(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(e.target)&&r===-1||fE(e.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[yE(r,i)]?Jp(this.movedSet,n):this.removes.push({parentId:i,id:r,isShadow:ec(e.target)&&tc(e.target)?!0:void 0})),this.mapRemoves.push(n))});break}}},this.genAdds=(e,n)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Kp(e,this.mirror))return;this.movedSet.add(e);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[yE(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);bn(e,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(e.childNodes.forEach(r=>this.genAdds(r)),Yp(e)&&e.shadowRoot.childNodes.forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}}}init(e){["mutationCb","blockClass","blockSelector","unblockSelector","maskAllText","maskTextClass","unmaskTextClass","maskTextSelector","unmaskTextSelector","inlineStylesheet","maskInputOptions","maskAttributeFn","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(n=>{this[n]=e[n]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Jp(t,e){t.delete(e),e.childNodes.forEach(n=>Jp(t,n))}function bE(t,e,n){return t.length===0?!1:IU(t,e,n)}function IU(t,e,n){let r=e.parentNode;for(;r;){const i=n.getId(r);if(t.some(s=>s.id===i))return!0;r=r.parentNode}return!1}function wE(t,e){return t.size===0?!1:SE(t,e)}function SE(t,e){const{parentNode:n}=e;return n?t.has(n)?!0:SE(t,n):!1}let sc;function xU(t){sc=t}function RU(){sc=void 0}const He=t=>sc?(...n)=>{try{return t(...n)}catch(r){if(sc&&sc(r)===!0)return()=>{};throw r}}:t,yo=[];function oc(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch{}return t&&t.target}function EE(t,e){var o,a;const n=new TU;yo.push(n),n.init(t);let r=window.MutationObserver||window.__rrMutationObserver;const i=(a=(o=window==null?void 0:window.Zone)==null?void 0:o.__symbol__)==null?void 0:a.call(o,"MutationObserver");i&&window[i]&&(r=window[i]);const s=new r(He(c=>{t.onMutation&&t.onMutation(c)===!1||n.processMutations.bind(n)(c)}));return s.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function AU({mousemoveCb:t,sampling:e,doc:n,mirror:r}){if(e.mousemove===!1)return()=>{};const i=typeof e.mousemove=="number"?e.mousemove:50,s=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let o=[],a;const c=ic(He(l=>{const h=Date.now()-a;t(o.map(f=>(f.timeOffset-=h,f)),l),o=[],a=null}),s),u=He(ic(He(l=>{const h=oc(l),{clientX:f,clientY:p}=Gp(l)?l.changedTouches[0]:l;a||(a=Dl()),o.push({x:f,y:p,id:r.getId(h),timeOffset:Dl()-a}),c(typeof DragEvent<"u"&&l instanceof DragEvent?we.Drag:l instanceof MouseEvent?we.MouseMove:we.TouchMove)}),i,{trailing:!1})),d=[rn("mousemove",u,n),rn("touchmove",u,n),rn("drag",u,n)];return He(()=>{d.forEach(l=>l())})}function PU({mouseInteractionCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,sampling:o}){if(o.mouseInteraction===!1)return()=>{};const a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,c=[];let u=null;const d=l=>h=>{const f=oc(h);if(bn(f,r,i,s,!0))return;let p=null,g=l;if("pointerType"in h){switch(h.pointerType){case"mouse":p=Wr.Mouse;break;case"touch":p=Wr.Touch;break;case"pen":p=Wr.Pen;break}p===Wr.Touch?sn[l]===sn.MouseDown?g="TouchStart":sn[l]===sn.MouseUp&&(g="TouchEnd"):Wr.Pen}else Gp(h)&&(p=Wr.Touch);p!==null?(u=p,(g.startsWith("Touch")&&p===Wr.Touch||g.startsWith("Mouse")&&p===Wr.Mouse)&&(p=null)):sn[l]===sn.Click&&(p=u,u=null);const v=Gp(h)?h.changedTouches[0]:h;if(!v)return;const m=n.getId(f),{clientX:_,clientY:w}=v;He(t)({type:sn[g],id:m,x:_,y:w,...p!==null&&{pointerType:p}})};return Object.keys(sn).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&a[l]!==!1).forEach(l=>{let h=lo(l);const f=d(l);if(window.PointerEvent)switch(sn[l]){case sn.MouseDown:case sn.MouseUp:h=h.replace("mouse","pointer");break;case sn.TouchStart:case sn.TouchEnd:return}c.push(rn(h,f,e))}),He(()=>{c.forEach(l=>l())})}function kE({scrollCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,sampling:o}){const a=He(ic(He(c=>{const u=oc(c);if(!u||bn(u,r,i,s,!0))return;const d=n.getId(u);if(u===e&&e.defaultView){const l=cE(e.defaultView);t({id:d,x:l.left,y:l.top})}else t({id:d,x:u.scrollLeft,y:u.scrollTop})}),o.scroll||100));return rn("scroll",a,e)}function MU({viewportResizeCb:t},{win:e}){let n=-1,r=-1;const i=He(ic(He(()=>{const s=uE(),o=lE();(n!==s||r!==o)&&(t({width:Number(o),height:Number(s)}),n=s,r=o)}),200));return rn("resize",i,e)}const OU=["INPUT","TEXTAREA","SELECT"],CE=new WeakMap;function LU({inputCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,ignoreClass:o,ignoreSelector:a,maskInputOptions:c,maskInputFn:u,sampling:d,userTriggeredOnInput:l,maskTextClass:h,unmaskTextClass:f,maskTextSelector:p,unmaskTextSelector:g}){function v(I){let y=oc(I);const b=I.isTrusted,k=y&&Hp(y.tagName);if(k==="OPTION"&&(y=y.parentElement),!y||!k||OU.indexOf(k)<0||bn(y,r,i,s,!0))return;const x=y;if(x.classList.contains(o)||a&&x.matches(a))return;const R=qp(y);let F=Ml(x,k,R),z=!1;const J=Pl({maskInputOptions:c,tagName:k,type:R}),U=go(y,h,p,f,g,J);(R==="radio"||R==="checkbox")&&(z=y.checked),F=nc({isMasked:U,element:y,value:F,maskInputFn:u}),m(y,l?{text:F,isChecked:z,userTriggered:b}:{text:F,isChecked:z});const q=y.name;R==="radio"&&q&&z&&e.querySelectorAll(`input[type="radio"][name="${q}"]`).forEach(V=>{if(V!==y){const j=nc({isMasked:U,element:V,value:Ml(V,k,R),maskInputFn:u});m(V,l?{text:j,isChecked:!z,userTriggered:!1}:{text:j,isChecked:!z})}})}function m(I,y){const b=CE.get(I);if(!b||b.text!==y.text||b.isChecked!==y.isChecked){CE.set(I,y);const k=n.getId(I);He(t)({...y,id:k})}}const w=(d.input==="last"?["change"]:["input","change"]).map(I=>rn(I,He(v),e)),T=e.defaultView;if(!T)return()=>{w.forEach(I=>I())};const C=T.Object.getOwnPropertyDescriptor(T.HTMLInputElement.prototype,"value"),E=[[T.HTMLInputElement.prototype,"value"],[T.HTMLInputElement.prototype,"checked"],[T.HTMLSelectElement.prototype,"value"],[T.HTMLTextAreaElement.prototype,"value"],[T.HTMLSelectElement.prototype,"selectedIndex"],[T.HTMLOptionElement.prototype,"selected"]];return C&&C.set&&w.push(...E.map(I=>aE(I[0],I[1],{set(){He(v)({target:this,isTrusted:!1})}},!1,T))),He(()=>{w.forEach(I=>I())})}function Fl(t){const e=[];function n(r,i){if($l("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||$l("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||$l("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||$l("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){const o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return n(t,e)}function wi(t,e,n){let r,i;return t?(t.ownerNode?r=e.getId(t.ownerNode):i=n.getId(t),{styleId:i,id:r}):{}}function DU({styleSheetRuleCb:t,mirror:e,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:He((d,l,h)=>{const[f,p]=h,{id:g,styleId:v}=wi(l,e,n.styleMirror);return(g&&g!==-1||v&&v!==-1)&&t({id:g,styleId:v,adds:[{rule:f,index:p}]}),d.apply(l,h)})});const s=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:He((d,l,h)=>{const[f]=h,{id:p,styleId:g}=wi(l,e,n.styleMirror);return(p&&p!==-1||g&&g!==-1)&&t({id:p,styleId:g,removes:[{index:f}]}),d.apply(l,h)})});let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:He((d,l,h)=>{const[f]=h,{id:p,styleId:g}=wi(l,e,n.styleMirror);return(p&&p!==-1||g&&g!==-1)&&t({id:p,styleId:g,replace:f}),d.apply(l,h)})}));let a;r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:He((d,l,h)=>{const[f]=h,{id:p,styleId:g}=wi(l,e,n.styleMirror);return(p&&p!==-1||g&&g!==-1)&&t({id:p,styleId:g,replaceSync:f}),d.apply(l,h)})}));const c={};Ul("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(Ul("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),Ul("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),Ul("CSSSupportsRule")&&(c.CSSSupportsRule=r.CSSSupportsRule));const u={};return Object.entries(c).forEach(([d,l])=>{u[d]={insertRule:l.prototype.insertRule,deleteRule:l.prototype.deleteRule},l.prototype.insertRule=new Proxy(u[d].insertRule,{apply:He((h,f,p)=>{const[g,v]=p,{id:m,styleId:_}=wi(f.parentStyleSheet,e,n.styleMirror);return(m&&m!==-1||_&&_!==-1)&&t({id:m,styleId:_,adds:[{rule:g,index:[...Fl(f),v||0]}]}),h.apply(f,p)})}),l.prototype.deleteRule=new Proxy(u[d].deleteRule,{apply:He((h,f,p)=>{const[g]=p,{id:v,styleId:m}=wi(f.parentStyleSheet,e,n.styleMirror);return(v&&v!==-1||m&&m!==-1)&&t({id:v,styleId:m,removes:[{index:[...Fl(f),g]}]}),h.apply(f,p)})})}),He(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=s,o&&(r.CSSStyleSheet.prototype.replace=o),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([d,l])=>{l.prototype.insertRule=u[d].insertRule,l.prototype.deleteRule=u[d].deleteRule})})}function TE({mirror:t,stylesheetManager:e},n){var o,a,c;let r=null;n.nodeName==="#document"?r=t.getId(n):r=t.getId(n.host);const i=n.nodeName==="#document"?(o=n.defaultView)==null?void 0:o.Document:(c=(a=n.ownerDocument)==null?void 0:a.defaultView)==null?void 0:c.ShadowRoot,s=i!=null&&i.prototype?Object.getOwnPropertyDescriptor(i==null?void 0:i.prototype,"adoptedStyleSheets"):void 0;return r===null||r===-1||!i||!s?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get(){var u;return(u=s.get)==null?void 0:u.call(this)},set(u){var l;const d=(l=s.set)==null?void 0:l.call(this,u);if(r!==null&&r!==-1)try{e.adoptStyleSheets(u,r)}catch{}return d}}),He(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get:s.get,set:s.set})}))}function NU({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const s=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:He((a,c,u)=>{var g;const[d,l,h]=u;if(n.has(d))return s.apply(c,[d,l,h]);const{id:f,styleId:p}=wi((g=c.parentRule)==null?void 0:g.parentStyleSheet,e,r.styleMirror);return(f&&f!==-1||p&&p!==-1)&&t({id:f,styleId:p,set:{property:d,value:l,priority:h},index:Fl(c.parentRule)}),a.apply(c,u)})});const o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:He((a,c,u)=>{var f;const[d]=u;if(n.has(d))return o.apply(c,[d]);const{id:l,styleId:h}=wi((f=c.parentRule)==null?void 0:f.parentStyleSheet,e,r.styleMirror);return(l&&l!==-1||h&&h!==-1)&&t({id:l,styleId:h,remove:{property:d},index:Fl(c.parentRule)}),a.apply(c,u)})}),He(()=>{i.CSSStyleDeclaration.prototype.setProperty=s,i.CSSStyleDeclaration.prototype.removeProperty=o})}function FU({mediaInteractionCb:t,blockClass:e,blockSelector:n,unblockSelector:r,mirror:i,sampling:s,doc:o}){const a=He(u=>ic(He(d=>{const l=oc(d);if(!l||bn(l,e,n,r,!0))return;const{currentTime:h,volume:f,muted:p,playbackRate:g}=l;t({type:u,id:i.getId(l),currentTime:h,volume:f,muted:p,playbackRate:g})}),s.media||500)),c=[rn("play",a(_o.Play),o),rn("pause",a(_o.Pause),o),rn("seeked",a(_o.Seeked),o),rn("volumechange",a(_o.VolumeChange),o),rn("ratechange",a(_o.RateChange),o)];return He(()=>{c.forEach(u=>u())})}function $U({fontCb:t,doc:e}){const n=e.defaultView;if(!n)return()=>{};const r=[],i=new WeakMap,s=n.FontFace;n.FontFace=function(c,u,d){const l=new s(c,u,d);return i.set(l,{family:c,buffer:typeof u!="string",descriptors:d,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),l};const o=Vp(e.fonts,"add",function(a){return function(c){return Nl(He(()=>{const u=i.get(c);u&&(t(u),i.delete(c))}),0),a.apply(this,[c])}});return r.push(()=>{n.FontFace=s}),r.push(o),He(()=>{r.forEach(a=>a())})}function UU(t){const{doc:e,mirror:n,blockClass:r,blockSelector:i,unblockSelector:s,selectionCb:o}=t;let a=!0;const c=He(()=>{const u=e.getSelection();if(!u||a&&(u!=null&&u.isCollapsed))return;a=u.isCollapsed||!1;const d=[],l=u.rangeCount||0;for(let h=0;h<l;h++){const f=u.getRangeAt(h),{startContainer:p,startOffset:g,endContainer:v,endOffset:m}=f;bn(p,r,i,s,!0)||bn(v,r,i,s,!0)||d.push({start:n.getId(p),startOffset:g,end:n.getId(v),endOffset:m})}o({ranges:d})});return c(),rn("selectionchange",c)}function BU({doc:t,customElementCb:e}){const n=t.defaultView;return!n||!n.customElements?()=>{}:Vp(n.customElements,"define",function(i){return function(s,o,a){try{e({define:{name:s}})}catch{}return i.apply(this,[s,o,a])}})}function jU(t,e={}){const n=t.doc.defaultView;if(!n)return()=>{};let r;t.recordDOM&&(r=EE(t,t.doc));const i=AU(t),s=PU(t),o=kE(t),a=MU(t,{win:n}),c=LU(t),u=FU(t);let d=()=>{},l=()=>{},h=()=>{},f=()=>{};t.recordDOM&&(d=DU(t,{win:n}),l=TE(t,t.doc),h=NU(t,{win:n}),t.collectFonts&&(f=$U(t)));const p=UU(t),g=BU(t),v=[];for(const m of t.plugins)v.push(m.observer(m.callback,n,m.options));return He(()=>{yo.forEach(m=>m.reset()),r==null||r.disconnect(),i(),s(),o(),a(),c(),u(),d(),l(),h(),f(),p(),g(),v.forEach(m=>m())})}function $l(t){return typeof window[t]<"u"}function Ul(t){return!!(typeof window[t]<"u"&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}class Qp{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,n,r,i){const s=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e);let a=s.get(n);return a||(a=this.generateIdFn(),s.set(n,a),o.set(a,n)),a}getIds(e,n){const r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return n.map(s=>this.getId(e,s,r,i))}getRemoteId(e,n,r){const i=r||this.getRemoteIdToIdMap(e);if(typeof n!="number")return n;const s=i.get(n);return s||-1}getRemoteIds(e,n){const r=this.getRemoteIdToIdMap(e);return n.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let n=this.iframeIdToRemoteIdMap.get(e);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(e,n)),n}getRemoteIdToIdMap(e){let n=this.iframeRemoteIdToIdMap.get(e);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(e,n)),n}}class HU{constructor(){this.crossOriginIframeMirror=new Qp(zp),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}}class qU{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Qp(zp),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Qp(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,n){var i,s;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((i=e.contentWindow)==null||i.addEventListener("message",this.handleMessage.bind(this))),(s=this.loadListener)==null||s.call(this,e);const r=Xp(e);r&&r.adoptedStyleSheets&&r.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(r.adoptedStyleSheets,this.mirror.getId(r))}handleMessage(e){const n=e;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!e.source)return;const i=this.crossOriginIframeMap.get(e.source);if(!i)return;const s=this.transformCrossOriginEvent(i,n.data.event);s&&this.wrappedEmit(s,n.data.isCheckout)}transformCrossOriginEvent(e,n){var r;switch(n.type){case Oe.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(n.data.node,e);const i=n.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(n.data.node,i),{timestamp:n.timestamp,type:Oe.IncrementalSnapshot,data:{source:we.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Oe.Meta:case Oe.Load:case Oe.DomContentLoaded:return!1;case Oe.Plugin:return n;case Oe.Custom:return this.replaceIds(n.data.payload,e,["id","parentId","previousId","nextId"]),n;case Oe.IncrementalSnapshot:switch(n.data.source){case we.Mutation:return n.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);const s=this.crossOriginIframeRootIdMap.get(e);s&&this.patchRootIdOnNode(i.node,s)}),n.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),n.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),n.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),n;case we.Drag:case we.TouchMove:case we.MouseMove:return n.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),n;case we.ViewportResize:return!1;case we.MediaInteraction:case we.MouseInteraction:case we.Scroll:case we.CanvasMutation:case we.Input:return this.replaceIds(n.data,e,["id"]),n;case we.StyleSheetRule:case we.StyleDeclaration:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleId"]),n;case we.Font:return n;case we.Selection:return n.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),n;case we.AdoptedStyleSheet:return this.replaceIds(n.data,e,["id"]),this.replaceStyleIds(n.data,e,["styleIds"]),(r=n.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),n}}return!1}replace(e,n,r,i){for(const s of i)!Array.isArray(n[s])&&typeof n[s]!="number"||(Array.isArray(n[s])?n[s]=e.getIds(r,n[s]):n[s]=e.getId(r,n[s]));return n}replaceIds(e,n,r){return this.replace(this.crossOriginIframeMirror,e,n,r)}replaceStyleIds(e,n,r){return this.replace(this.crossOriginIframeStyleMirror,e,n,r)}replaceIdOnNode(e,n){this.replaceIds(e,n,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(e,n){e.type!==Mt.Document&&!e.rootId&&(e.rootId=n),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}}class WU{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}}class zU{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,n){if(!tc(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e),this.bypassOptions.canvasManager.addShadowRoot(e);const r=EE({...this.bypassOptions,doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(kE({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),Nl(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(TE({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))},0)}observeAttachShadow(e){const n=Xp(e),r=kU(e);!n||!r||this.patchAttachShadow(r.Element,n)}patchAttachShadow(e,n){const r=this;this.restoreHandlers.push(Vp(e.prototype,"attachShadow",function(i){return function(s){const o=i.call(this,s);return this.shadowRoot&&mE(this)&&r.addShadowRoot(this.shadowRoot,n),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet,this.bypassOptions.canvasManager.resetShadowRoots()}}for(var IE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",VU=typeof Uint8Array>"u"?[]:new Uint8Array(256),Bl=0;Bl<IE.length;Bl++)VU[IE.charCodeAt(Bl)]=Bl;class xE{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}}class KU{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new yU,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,n){if(e.length===0)return;const r={id:n,styleIds:[]},i=[];for(const s of e){let o;this.styleMirror.has(s)?o=this.styleMirror.getId(s):(o=this.styleMirror.add(s),i.push({styleId:o,rules:Array.from(s.rules||CSSRule,(a,c)=>({rule:KS(a),index:c}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class GU{constructor(){this.nodeMap=new WeakMap,this.active=!1}inOtherBuffer(e,n){const r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==n)}add(e,n){this.active||(this.active=!0,SU(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(n))}destroy(){}}let ft,jl;try{if(Array.from([1],t=>t*2)[0]!==2){const t=document.createElement("iframe");document.body.appendChild(t),Array.from=((tT=t.contentWindow)==null?void 0:tT.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}const Zn=G3();function zr(t={}){const{emit:e,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:s=null,unblockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:c=null,maskAllText:u=!1,maskTextClass:d="rr-mask",unmaskTextClass:l=null,maskTextSelector:h=null,unmaskTextSelector:f=null,inlineStylesheet:p=!0,maskAllInputs:g,maskInputOptions:v,slimDOMOptions:m,maskAttributeFn:_,maskInputFn:w,maskTextFn:T,maxCanvasSize:C=null,packFn:E,sampling:I={},dataURLOptions:y={},mousemoveWait:b,recordDOM:k=!0,recordCanvas:x=!1,recordCrossOriginIframes:R=!1,recordAfter:F=t.recordAfter==="DOMContentLoaded"?t.recordAfter:"load",userTriggeredOnInput:z=!1,collectFonts:J=!1,inlineImages:U=!1,plugins:q,keepIframeSrcFn:V=()=>!1,ignoreCSSAttributes:j=new Set([]),errorHandler:S,onMutation:P,getCanvasManager:N}=t;xU(S);const O=R?window.parent===window:!0;let W=!1;if(!O)try{window.parent.document&&(W=!1)}catch{W=!0}if(O&&!e)throw new Error("emit function is required");if(!O&&!W)return()=>{};b!==void 0&&I.mousemove===void 0&&(I.mousemove=b),Zn.reset();const te=g===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,radio:!0,checkbox:!0}:v!==void 0?v:{},K=m===!0||m==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:m==="all",headMetaDescKeywords:m==="all"}:m||{};_U();let Ue,ee=0;const Se=Pe=>{for(const Ot of q||[])Ot.eventProcessor&&(Pe=Ot.eventProcessor(Pe));return E&&!W&&(Pe=E(Pe)),Pe};ft=(Pe,Ot)=>{var Lt;const Ee=Pe;if(Ee.timestamp=Dl(),(Lt=yo[0])!=null&&Lt.isFrozen()&&Ee.type!==Oe.FullSnapshot&&!(Ee.type===Oe.IncrementalSnapshot&&Ee.data.source===we.Mutation)&&yo.forEach(Je=>Je.unfreeze()),O)e==null||e(Se(Ee),Ot);else if(W){const Je={type:"rrweb",event:Se(Ee),origin:window.location.origin,isCheckout:Ot};window.parent.postMessage(Je,"*")}if(Ee.type===Oe.FullSnapshot)Ue=Ee,ee=0;else if(Ee.type===Oe.IncrementalSnapshot){if(Ee.data.source===we.Mutation&&Ee.data.isAttachIframe)return;ee++;const Je=r&&ee>=r,Ne=n&&Ue&&Ee.timestamp-Ue.timestamp>n;(Je||Ne)&&ze(!0)}};const be=Pe=>{ft({type:Oe.IncrementalSnapshot,data:{source:we.Mutation,...Pe}})},le=Pe=>ft({type:Oe.IncrementalSnapshot,data:{source:we.Scroll,...Pe}}),ue=Pe=>ft({type:Oe.IncrementalSnapshot,data:{source:we.CanvasMutation,...Pe}}),Ce=Pe=>ft({type:Oe.IncrementalSnapshot,data:{source:we.AdoptedStyleSheet,...Pe}}),pe=new KU({mutationCb:be,adoptedStyleSheetCb:Ce}),fe=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new HU:new qU({mirror:Zn,mutationCb:be,stylesheetManager:pe,recordCrossOriginIframes:R,wrappedEmit:ft});for(const Pe of q||[])Pe.getMirror&&Pe.getMirror({nodeMirror:Zn,crossOriginIframeMirror:fe.crossOriginIframeMirror,crossOriginIframeStyleMirror:fe.crossOriginIframeStyleMirror});const ne=new GU,We=ZU(N,{mirror:Zn,win:window,mutationCb:Pe=>ft({type:Oe.IncrementalSnapshot,data:{source:we.CanvasMutation,...Pe}}),recordCanvas:x,blockClass:i,blockSelector:s,unblockSelector:o,maxCanvasSize:C,sampling:I.canvas,dataURLOptions:y,errorHandler:S}),ge=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new WU:new zU({mutationCb:be,scrollCb:le,bypassOptions:{onMutation:P,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:u,maskTextClass:d,unmaskTextClass:l,maskTextSelector:h,unmaskTextSelector:f,inlineStylesheet:p,maskInputOptions:te,dataURLOptions:y,maskAttributeFn:_,maskTextFn:T,maskInputFn:w,recordCanvas:x,inlineImages:U,sampling:I,slimDOMOptions:K,iframeManager:fe,stylesheetManager:pe,canvasManager:We,keepIframeSrcFn:V,processedNodeManager:ne},mirror:Zn}),ze=(Pe=!1)=>{if(!k)return;ft({type:Oe.Meta,data:{href:window.location.href,width:lE(),height:uE()}},Pe),pe.reset(),ge.init(),yo.forEach(Ee=>Ee.lock());const Ot=mU(document,{mirror:Zn,blockClass:i,blockSelector:s,unblockSelector:o,maskAllText:u,maskTextClass:d,unmaskTextClass:l,maskTextSelector:h,unmaskTextSelector:f,inlineStylesheet:p,maskAllInputs:te,maskAttributeFn:_,maskInputFn:w,maskTextFn:T,slimDOM:K,dataURLOptions:y,recordCanvas:x,inlineImages:U,onSerialize:Ee=>{hE(Ee,Zn)&&fe.addIframe(Ee),pE(Ee,Zn)&&pe.trackLinkElement(Ee),Yp(Ee)&&ge.addShadowRoot(Ee.shadowRoot,document)},onIframeLoad:(Ee,Lt)=>{fe.attachIframe(Ee,Lt),Ee.contentWindow&&We.addWindow(Ee.contentWindow),ge.observeAttachShadow(Ee)},onStylesheetLoad:(Ee,Lt)=>{pe.attachLinkElement(Ee,Lt)},keepIframeSrcFn:V});if(!Ot)return console.warn("Failed to snapshot the document");ft({type:Oe.FullSnapshot,data:{node:Ot,initialOffset:cE(window)}}),yo.forEach(Ee=>Ee.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&pe.adoptStyleSheets(document.adoptedStyleSheets,Zn.getId(document))};jl=ze;try{const Pe=[],Ot=Lt=>{var Je;return He(jU)({onMutation:P,mutationCb:be,mousemoveCb:(Ne,pt)=>ft({type:Oe.IncrementalSnapshot,data:{source:pt,positions:Ne}}),mouseInteractionCb:Ne=>ft({type:Oe.IncrementalSnapshot,data:{source:we.MouseInteraction,...Ne}}),scrollCb:le,viewportResizeCb:Ne=>ft({type:Oe.IncrementalSnapshot,data:{source:we.ViewportResize,...Ne}}),inputCb:Ne=>ft({type:Oe.IncrementalSnapshot,data:{source:we.Input,...Ne}}),mediaInteractionCb:Ne=>ft({type:Oe.IncrementalSnapshot,data:{source:we.MediaInteraction,...Ne}}),styleSheetRuleCb:Ne=>ft({type:Oe.IncrementalSnapshot,data:{source:we.StyleSheetRule,...Ne}}),styleDeclarationCb:Ne=>ft({type:Oe.IncrementalSnapshot,data:{source:we.StyleDeclaration,...Ne}}),canvasMutationCb:ue,fontCb:Ne=>ft({type:Oe.IncrementalSnapshot,data:{source:we.Font,...Ne}}),selectionCb:Ne=>{ft({type:Oe.IncrementalSnapshot,data:{source:we.Selection,...Ne}})},customElementCb:Ne=>{ft({type:Oe.IncrementalSnapshot,data:{source:we.CustomElement,...Ne}})},blockClass:i,ignoreClass:a,ignoreSelector:c,maskAllText:u,maskTextClass:d,unmaskTextClass:l,maskTextSelector:h,unmaskTextSelector:f,maskInputOptions:te,inlineStylesheet:p,sampling:I,recordDOM:k,recordCanvas:x,inlineImages:U,userTriggeredOnInput:z,collectFonts:J,doc:Lt,maskAttributeFn:_,maskInputFn:w,maskTextFn:T,keepIframeSrcFn:V,blockSelector:s,unblockSelector:o,slimDOMOptions:K,dataURLOptions:y,mirror:Zn,iframeManager:fe,stylesheetManager:pe,shadowDomManager:ge,processedNodeManager:ne,canvasManager:We,ignoreCSSAttributes:j,plugins:((Je=q==null?void 0:q.filter(Ne=>Ne.observer))==null?void 0:Je.map(Ne=>({observer:Ne.observer,options:Ne.options,callback:pt=>ft({type:Oe.Plugin,data:{plugin:Ne.name,payload:pt}})})))||[]},{})};fe.addLoadListener(Lt=>{try{Pe.push(Ot(Lt.contentDocument))}catch(Je){console.warn(Je)}});const Ee=()=>{ze(),Pe.push(Ot(document))};return document.readyState==="interactive"||document.readyState==="complete"?Ee():(Pe.push(rn("DOMContentLoaded",()=>{ft({type:Oe.DomContentLoaded,data:{}}),F==="DOMContentLoaded"&&Ee()})),Pe.push(rn("load",()=>{ft({type:Oe.Load,data:{}}),F==="load"&&Ee()},window))),()=>{Pe.forEach(Lt=>Lt()),ne.destroy(),jl=void 0,RU()}}catch(Pe){console.warn(Pe)}}function YU(t){if(!jl)throw new Error("please take full snapshot after start recording");jl(t)}zr.mirror=Zn,zr.takeFullSnapshot=YU;function ZU(t,e){try{return t?t(e):new xE}catch{return console.warn("Unable to initialize CanvasManager"),new xE}}var RE;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(RE||(RE={}));const XU=3,JU=5;function eg(t){return t>9999999999?t:t*1e3}function tg(t){return t>9999999999?t/1e3:t}function ac(t,e){e.category!=="sentry.transaction"&&(["ui.click","ui.input"].includes(e.category)?t.triggerUserActivity():t.checkAndHandleExpiredSession(),t.addUpdate(()=>(t.throttledAddEvent({type:Oe.Custom,timestamp:(e.timestamp||0)*1e3,data:{tag:"breadcrumb",payload:Pn(e,10,1e3)}}),e.category==="console")))}const QU="button,a";function AE(t){return t.closest(QU)||t}function PE(t){const e=ME(t);return!e||!(e instanceof Element)?e:AE(e)}function ME(t){return e4(t)?t.target:t}function e4(t){return typeof t=="object"&&!!t&&"target"in t}let Si;function t4(t){return Si||(Si=[],n4()),Si.push(t),()=>{const e=Si?Si.indexOf(t):-1;e>-1&&Si.splice(e,1)}}function n4(){tn(tt,"open",function(t){return function(...e){if(Si)try{Si.forEach(n=>n())}catch{}return t.apply(tt,e)}})}const r4=new Set([we.Mutation,we.StyleSheetRule,we.StyleDeclaration,we.AdoptedStyleSheet,we.CanvasMutation,we.Selection,we.MediaInteraction]);function i4(t,e,n){t.handleClick(e,n)}class s4{constructor(e,n,r=ac){this._lastMutation=0,this._lastScroll=0,this._clicks=[],this._timeout=n.timeout/1e3,this._threshold=n.threshold/1e3,this._scrollTimeout=n.scrollTimeout/1e3,this._replay=e,this._ignoreSelector=n.ignoreSelector,this._addBreadcrumbEvent=r}addListeners(){const e=t4(()=>{this._lastMutation=OE()});this._teardown=()=>{e(),this._clicks=[],this._lastMutation=0,this._lastScroll=0}}removeListeners(){this._teardown&&this._teardown(),this._checkClickTimeout&&clearTimeout(this._checkClickTimeout)}handleClick(e,n){if(a4(n,this._ignoreSelector)||!c4(e))return;const r={timestamp:tg(e.timestamp),clickBreadcrumb:e,clickCount:0,node:n};this._clicks.some(i=>i.node===r.node&&Math.abs(i.timestamp-r.timestamp)<1)||(this._clicks.push(r),this._clicks.length===1&&this._scheduleCheckClicks())}registerMutation(e=Date.now()){this._lastMutation=tg(e)}registerScroll(e=Date.now()){this._lastScroll=tg(e)}registerClick(e){const n=AE(e);this._handleMultiClick(n)}_handleMultiClick(e){this._getClicks(e).forEach(n=>{n.clickCount++})}_getClicks(e){return this._clicks.filter(n=>n.node===e)}_checkClicks(){const e=[],n=OE();this._clicks.forEach(r=>{!r.mutationAfter&&this._lastMutation&&(r.mutationAfter=r.timestamp<=this._lastMutation?this._lastMutation-r.timestamp:void 0),!r.scrollAfter&&this._lastScroll&&(r.scrollAfter=r.timestamp<=this._lastScroll?this._lastScroll-r.timestamp:void 0),r.timestamp+this._timeout<=n&&e.push(r)});for(const r of e){const i=this._clicks.indexOf(r);i>-1&&(this._generateBreadcrumbs(r),this._clicks.splice(i,1))}this._clicks.length&&this._scheduleCheckClicks()}_generateBreadcrumbs(e){const n=this._replay,r=e.scrollAfter&&e.scrollAfter<=this._scrollTimeout,i=e.mutationAfter&&e.mutationAfter<=this._threshold,s=!r&&!i,{clickCount:o,clickBreadcrumb:a}=e;if(s){const c=Math.min(e.mutationAfter||this._timeout,this._timeout)*1e3,u=c<this._timeout*1e3?"mutation":"timeout",d={type:"default",message:a.message,timestamp:a.timestamp,category:"ui.slowClickDetected",data:{...a.data,url:tt.location.href,route:n.getCurrentRoute(),timeAfterClickMs:c,endReason:u,clickCount:o||1}};this._addBreadcrumbEvent(n,d);return}if(o>1){const c={type:"default",message:a.message,timestamp:a.timestamp,category:"ui.multiClick",data:{...a.data,url:tt.location.href,route:n.getCurrentRoute(),clickCount:o,metric:!0}};this._addBreadcrumbEvent(n,c)}}_scheduleCheckClicks(){this._checkClickTimeout&&clearTimeout(this._checkClickTimeout),this._checkClickTimeout=ao(()=>this._checkClicks(),1e3)}}const o4=["A","BUTTON","INPUT"];function a4(t,e){return!!(!o4.includes(t.tagName)||t.tagName==="INPUT"&&!["submit","button"].includes(t.getAttribute("type")||"")||t.tagName==="A"&&(t.hasAttribute("download")||t.hasAttribute("target")&&t.getAttribute("target")!=="_self")||e&&t.matches(e))}function c4(t){return!!(t.data&&typeof t.data.nodeId=="number"&&t.timestamp)}function OE(){return Date.now()/1e3}function u4(t,e){try{if(!l4(e))return;const{source:n}=e.data;if(r4.has(n)&&t.registerMutation(e.timestamp),n===we.Scroll&&t.registerScroll(e.timestamp),d4(e)){const{type:r,id:i}=e.data,s=zr.mirror.getNode(i);s instanceof HTMLElement&&r===sn.Click&&t.registerClick(s)}}catch{}}function l4(t){return t.type===XU}function d4(t){return t.data.source===we.MouseInteraction}function dr(t){return{timestamp:Date.now()/1e3,type:"default",...t}}var ng=(t=>(t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t))(ng||{});const f4=new Set(["id","class","aria-label","role","name","alt","title","data-test-id","data-testid","disabled","aria-disabled","data-sentry-component"]);function h4(t){const e={};!t["data-sentry-component"]&&t["data-sentry-element"]&&(t["data-sentry-component"]=t["data-sentry-element"]);for(const n in t)if(f4.has(n)){let r=n;(n==="data-testid"||n==="data-test-id")&&(r="testId"),e[r]=t[n]}return e}const p4=t=>e=>{if(!t.isEnabled())return;const n=g4(e);if(!n)return;const r=e.name==="click",i=r?e.event:void 0;r&&t.clickDetector&&i&&i.target&&!i.altKey&&!i.metaKey&&!i.ctrlKey&&!i.shiftKey&&i4(t.clickDetector,n,PE(e.event)),ac(t,n)};function LE(t,e){const n=zr.mirror.getId(t),r=n&&zr.mirror.getNode(n),i=r&&zr.mirror.getMeta(r),s=i&&v4(i)?i:null;return{message:e,data:s?{nodeId:n,node:{id:n,tagName:s.tagName,textContent:Array.from(s.childNodes).map(o=>o.type===ng.Text&&o.textContent).filter(Boolean).map(o=>o.trim()).join(""),attributes:h4(s.attributes)}}:{}}}function g4(t){const{target:e,message:n}=m4(t);return dr({category:`ui.${t.name}`,...LE(e,n)})}function m4(t){const e=t.name==="click";let n,r=null;try{r=e?PE(t.event):ME(t.event),n=Mr(r,{maxStringLength:200})||"<unknown>"}catch{n="<unknown>"}return{target:r,message:n}}function v4(t){return t.type===ng.Element}function _4(t,e){if(!t.isEnabled())return;t.updateUserActivity();const n=y4(e);n&&ac(t,n)}function y4(t){const{metaKey:e,shiftKey:n,ctrlKey:r,altKey:i,key:s,target:o}=t;if(!o||b4(o)||!s)return null;const a=e||r||i,c=s.length===1;if(!a&&c)return null;const u=Mr(o,{maxStringLength:200})||"<unknown>",d=LE(o,u);return dr({category:"ui.keyDown",message:u,data:{...d.data,metaKey:e,shiftKey:n,ctrlKey:r,altKey:i,key:s}})}function b4(t){return t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.isContentEditable}const w4={resource:T4,paint:k4,navigation:C4};function Hl(t,e){return({metric:n})=>void e.replayPerformanceEntries.push(t(n))}function S4(t){return t.map(E4).filter(Boolean)}function E4(t){const e=w4[t.entryType];return e?e(t):null}function bo(t){return((dn()||tt.performance.timeOrigin)+t)/1e3}function k4(t){const{duration:e,entryType:n,name:r,startTime:i}=t,s=bo(i);return{type:n,name:r,start:s,end:s+e,data:void 0}}function C4(t){const{entryType:e,name:n,decodedBodySize:r,duration:i,domComplete:s,encodedBodySize:o,domContentLoadedEventStart:a,domContentLoadedEventEnd:c,domInteractive:u,loadEventStart:d,loadEventEnd:l,redirectCount:h,startTime:f,transferSize:p,type:g}=t;return i===0?null:{type:`${e}.${g}`,start:bo(f),end:bo(s),name:n,data:{size:p,decodedBodySize:r,encodedBodySize:o,duration:i,domInteractive:u,domContentLoadedEventStart:a,domContentLoadedEventEnd:c,loadEventStart:d,loadEventEnd:l,domComplete:s,redirectCount:h}}}function T4(t){const{entryType:e,initiatorType:n,name:r,responseEnd:i,startTime:s,decodedBodySize:o,encodedBodySize:a,responseStatus:c,transferSize:u}=t;return["fetch","xmlhttprequest"].includes(n)?null:{type:`${e}.${n}`,start:bo(s),end:bo(i),name:r,data:{size:u,statusCode:c,decodedBodySize:o,encodedBodySize:a}}}function I4(t){const e=t.entries[t.entries.length-1],n=e!=null&&e.element?[e.element]:void 0;return ql(t,"largest-contentful-paint",n)}function x4(t){return t.sources!==void 0}function R4(t){const e=[],n=[];for(const r of t.entries)if(x4(r)){const i=[];for(const s of r.sources)if(s.node){n.push(s.node);const o=zr.mirror.getId(s.node);o&&i.push(o)}e.push({value:r.value,nodeIds:i.length?i:void 0})}return ql(t,"cumulative-layout-shift",n,e)}function A4(t){const e=t.entries[t.entries.length-1],n=e!=null&&e.target?[e.target]:void 0;return ql(t,"first-input-delay",n)}function P4(t){const e=t.entries[t.entries.length-1],n=e!=null&&e.target?[e.target]:void 0;return ql(t,"interaction-to-next-paint",n)}function ql(t,e,n,r){const i=t.value,s=t.rating,o=bo(i);return{type:"web-vital",name:e,start:o,end:o,data:{value:i,size:i,rating:s,nodeIds:n?n.map(a=>zr.mirror.getId(a)):void 0,attributions:r}}}function M4(t){function e(i){t.performanceEntries.includes(i)||t.performanceEntries.push(i)}function n({entries:i}){i.forEach(e)}const r=[];return["navigation","paint","resource"].forEach(i=>{r.push(io(i,n))}),r.push(nS(Hl(I4,t)),Tp(Hl(R4,t)),rS(Hl(A4,t)),iS(Hl(P4,t))),()=>{r.forEach(i=>i())}}const _e=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,O4='var t=Uint8Array,n=Uint16Array,r=Int32Array,e=new t([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),i=new t([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),s=new t([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=function(t,e){for(var i=new n(31),s=0;s<31;++s)i[s]=e+=1<<t[s-1];var a=new r(i[30]);for(s=1;s<30;++s)for(var o=i[s];o<i[s+1];++o)a[o]=o-i[s]<<5|s;return{b:i,r:a}},o=a(e,2),h=o.b,f=o.r;h[28]=258,f[258]=28;for(var l=a(i,0).r,u=new n(32768),c=0;c<32768;++c){var v=(43690&c)>>1|(21845&c)<<1;v=(61680&(v=(52428&v)>>2|(13107&v)<<2))>>4|(3855&v)<<4,u[c]=((65280&v)>>8|(255&v)<<8)>>1}var d=function(t,r,e){for(var i=t.length,s=0,a=new n(r);s<i;++s)t[s]&&++a[t[s]-1];var o,h=new n(r);for(s=1;s<r;++s)h[s]=h[s-1]+a[s-1]<<1;if(e){o=new n(1<<r);var f=15-r;for(s=0;s<i;++s)if(t[s])for(var l=s<<4|t[s],c=r-t[s],v=h[t[s]-1]++<<c,d=v|(1<<c)-1;v<=d;++v)o[u[v]>>f]=l}else for(o=new n(i),s=0;s<i;++s)t[s]&&(o[s]=u[h[t[s]-1]++]>>15-t[s]);return o},p=new t(288);for(c=0;c<144;++c)p[c]=8;for(c=144;c<256;++c)p[c]=9;for(c=256;c<280;++c)p[c]=7;for(c=280;c<288;++c)p[c]=8;var g=new t(32);for(c=0;c<32;++c)g[c]=5;var w=d(p,9,0),y=d(g,5,0),m=function(t){return(t+7)/8|0},b=function(n,r,e){return(null==e||e>n.length)&&(e=n.length),new t(n.subarray(r,e))},M=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],E=function(t,n,r){var e=new Error(n||M[t]);if(e.code=t,Error.captureStackTrace&&Error.captureStackTrace(e,E),!r)throw e;return e},z=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8},_=function(t,n,r){r<<=7&n;var e=n/8|0;t[e]|=r,t[e+1]|=r>>8,t[e+2]|=r>>16},x=function(r,e){for(var i=[],s=0;s<r.length;++s)r[s]&&i.push({s:s,f:r[s]});var a=i.length,o=i.slice();if(!a)return{t:F,l:0};if(1==a){var h=new t(i[0].s+1);return h[i[0].s]=1,{t:h,l:1}}i.sort((function(t,n){return t.f-n.f})),i.push({s:-1,f:25001});var f=i[0],l=i[1],u=0,c=1,v=2;for(i[0]={s:-1,f:f.f+l.f,l:f,r:l};c!=a-1;)f=i[i[u].f<i[v].f?u++:v++],l=i[u!=c&&i[u].f<i[v].f?u++:v++],i[c++]={s:-1,f:f.f+l.f,l:f,r:l};var d=o[0].s;for(s=1;s<a;++s)o[s].s>d&&(d=o[s].s);var p=new n(d+1),g=A(i[c-1],p,0);if(g>e){s=0;var w=0,y=g-e,m=1<<y;for(o.sort((function(t,n){return p[n.s]-p[t.s]||t.f-n.f}));s<a;++s){var b=o[s].s;if(!(p[b]>e))break;w+=m-(1<<g-p[b]),p[b]=e}for(w>>=y;w>0;){var M=o[s].s;p[M]<e?w-=1<<e-p[M]++-1:++s}for(;s>=0&&w;--s){var E=o[s].s;p[E]==e&&(--p[E],++w)}g=e}return{t:new t(p),l:g}},A=function(t,n,r){return-1==t.s?Math.max(A(t.l,n,r+1),A(t.r,n,r+1)):n[t.s]=r},D=function(t){for(var r=t.length;r&&!t[--r];);for(var e=new n(++r),i=0,s=t[0],a=1,o=function(t){e[i++]=t},h=1;h<=r;++h)if(t[h]==s&&h!=r)++a;else{if(!s&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(s),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(s);a=1,s=t[h]}return{c:e.subarray(0,i),n:r}},T=function(t,n){for(var r=0,e=0;e<n.length;++e)r+=t[e]*n[e];return r},k=function(t,n,r){var e=r.length,i=m(n+2);t[i]=255&e,t[i+1]=e>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;s<e;++s)t[i+s+4]=r[s];return 8*(i+4+e)},U=function(t,r,a,o,h,f,l,u,c,v,m){z(r,m++,a),++h[256];for(var b=x(h,15),M=b.t,E=b.l,A=x(f,15),U=A.t,C=A.l,F=D(M),I=F.c,S=F.n,L=D(U),O=L.c,j=L.n,q=new n(19),B=0;B<I.length;++B)++q[31&I[B]];for(B=0;B<O.length;++B)++q[31&O[B]];for(var G=x(q,7),H=G.t,J=G.l,K=19;K>4&&!H[s[K-1]];--K);var N,P,Q,R,V=v+5<<3,W=T(h,p)+T(f,g)+l,X=T(h,M)+T(f,U)+l+14+3*K+T(q,H)+2*q[16]+3*q[17]+7*q[18];if(c>=0&&V<=W&&V<=X)return k(r,m,t.subarray(c,c+v));if(z(r,m,1+(X<W)),m+=2,X<W){N=d(M,E,0),P=M,Q=d(U,C,0),R=U;var Y=d(H,J,0);z(r,m,S-257),z(r,m+5,j-1),z(r,m+10,K-4),m+=14;for(B=0;B<K;++B)z(r,m+3*B,H[s[B]]);m+=3*K;for(var Z=[I,O],$=0;$<2;++$){var tt=Z[$];for(B=0;B<tt.length;++B){var nt=31&tt[B];z(r,m,Y[nt]),m+=H[nt],nt>15&&(z(r,m,tt[B]>>5&127),m+=tt[B]>>12)}}}else N=w,P=p,Q=y,R=g;for(B=0;B<u;++B){var rt=o[B];if(rt>255){_(r,m,N[(nt=rt>>18&31)+257]),m+=P[nt+257],nt>7&&(z(r,m,rt>>23&31),m+=e[nt]);var et=31&rt;_(r,m,Q[et]),m+=R[et],et>3&&(_(r,m,rt>>5&8191),m+=i[et])}else _(r,m,N[rt]),m+=P[rt]}return _(r,m,N[256]),m+P[256]},C=new r([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),F=new t(0),I=function(){for(var t=new Int32Array(256),n=0;n<256;++n){for(var r=n,e=9;--e;)r=(1&r&&-306674912)^r>>>1;t[n]=r}return t}(),S=function(){var t=-1;return{p:function(n){for(var r=t,e=0;e<n.length;++e)r=I[255&r^n[e]]^r>>>8;t=r},d:function(){return~t}}},L=function(){var t=1,n=0;return{p:function(r){for(var e=t,i=n,s=0|r.length,a=0;a!=s;){for(var o=Math.min(a+2655,s);a<o;++a)i+=e+=r[a];e=(65535&e)+15*(e>>16),i=(65535&i)+15*(i>>16)}t=e,n=i},d:function(){return(255&(t%=65521))<<24|(65280&t)<<8|(255&(n%=65521))<<8|n>>8}}},O=function(s,a,o,h,u){if(!u&&(u={l:1},a.dictionary)){var c=a.dictionary.subarray(-32768),v=new t(c.length+s.length);v.set(c),v.set(s,c.length),s=v,u.w=c.length}return function(s,a,o,h,u,c){var v=c.z||s.length,d=new t(h+v+5*(1+Math.ceil(v/7e3))+u),p=d.subarray(h,d.length-u),g=c.l,w=7&(c.r||0);if(a){w&&(p[0]=c.r>>3);for(var y=C[a-1],M=y>>13,E=8191&y,z=(1<<o)-1,_=c.p||new n(32768),x=c.h||new n(z+1),A=Math.ceil(o/3),D=2*A,T=function(t){return(s[t]^s[t+1]<<A^s[t+2]<<D)&z},F=new r(25e3),I=new n(288),S=new n(32),L=0,O=0,j=c.i||0,q=0,B=c.w||0,G=0;j+2<v;++j){var H=T(j),J=32767&j,K=x[H];if(_[J]=K,x[H]=J,B<=j){var N=v-j;if((L>7e3||q>24576)&&(N>423||!g)){w=U(s,p,0,F,I,S,O,q,G,j-G,w),q=L=O=0,G=j;for(var P=0;P<286;++P)I[P]=0;for(P=0;P<30;++P)S[P]=0}var Q=2,R=0,V=E,W=J-K&32767;if(N>2&&H==T(j-W))for(var X=Math.min(M,N)-1,Y=Math.min(32767,j),Z=Math.min(258,N);W<=Y&&--V&&J!=K;){if(s[j+Q]==s[j+Q-W]){for(var $=0;$<Z&&s[j+$]==s[j+$-W];++$);if($>Q){if(Q=$,R=W,$>X)break;var tt=Math.min(W,$-2),nt=0;for(P=0;P<tt;++P){var rt=j-W+P&32767,et=rt-_[rt]&32767;et>nt&&(nt=et,K=rt)}}}W+=(J=K)-(K=_[J])&32767}if(R){F[q++]=268435456|f[Q]<<18|l[R];var it=31&f[Q],st=31&l[R];O+=e[it]+i[st],++I[257+it],++S[st],B=j+Q,++L}else F[q++]=s[j],++I[s[j]]}}for(j=Math.max(j,B);j<v;++j)F[q++]=s[j],++I[s[j]];w=U(s,p,g,F,I,S,O,q,G,j-G,w),g||(c.r=7&w|p[w/8|0]<<3,w-=7,c.h=x,c.p=_,c.i=j,c.w=B)}else{for(j=c.w||0;j<v+g;j+=65535){var at=j+65535;at>=v&&(p[w/8|0]=g,at=v),w=k(p,w+1,s.subarray(j,at))}c.i=v}return b(d,0,h+m(w)+u)}(s,null==a.level?6:a.level,null==a.mem?u.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):20:12+a.mem,o,h,u)},j=function(t,n,r){for(;r;++n)t[n]=r,r>>>=8},q=function(t,n){var r=n.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=n.level<2?4:9==n.level?2:0,t[9]=3,0!=n.mtime&&j(t,4,Math.floor(new Date(n.mtime||Date.now())/1e3)),r){t[3]=8;for(var e=0;e<=r.length;++e)t[e+10]=r.charCodeAt(e)}},B=function(t){return 10+(t.filename?t.filename.length+1:0)},G=function(){function n(n,r){if("function"==typeof n&&(r=n,n={}),this.ondata=r,this.o=n||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new t(98304),this.o.dictionary){var e=this.o.dictionary.subarray(-32768);this.b.set(e,32768-e.length),this.s.i=32768-e.length}}return n.prototype.p=function(t,n){this.ondata(O(t,this.o,0,0,this.s),n)},n.prototype.push=function(n,r){this.ondata||E(5),this.s.l&&E(4);var e=n.length+this.s.z;if(e>this.b.length){if(e>2*this.b.length-32768){var i=new t(-32768&e);i.set(this.b.subarray(0,this.s.z)),this.b=i}var s=this.b.length-this.s.z;this.b.set(n.subarray(0,s),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(n.subarray(s),32768),this.s.z=n.length-s+32768,this.s.i=32766,this.s.w=32768}else this.b.set(n,this.s.z),this.s.z+=n.length;this.s.l=1&r,(this.s.z>this.s.w+8191||r)&&(this.p(this.b,r||!1),this.s.w=this.s.i,this.s.i-=2)},n.prototype.flush=function(){this.ondata||E(5),this.s.l&&E(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},n}();var H=function(){function t(t,n){this.c=L(),this.v=1,G.call(this,t,n)}return t.prototype.push=function(t,n){this.c.p(t),G.prototype.push.call(this,t,n)},t.prototype.p=function(t,n){var r=O(t,this.o,this.v&&(this.o.dictionary?6:2),n&&4,this.s);this.v&&(function(t,n){var r=n.level,e=0==r?0:r<6?1:9==r?3:2;if(t[0]=120,t[1]=e<<6|(n.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,n.dictionary){var i=L();i.p(n.dictionary),j(t,2,i.d())}}(r,this.o),this.v=0),n&&j(r,r.length-4,this.c.d()),this.ondata(r,n)},t.prototype.flush=function(){G.prototype.flush.call(this)},t}(),J="undefined"!=typeof TextEncoder&&new TextEncoder,K="undefined"!=typeof TextDecoder&&new TextDecoder;try{K.decode(F,{stream:!0})}catch(t){}var N=function(){function t(t){this.ondata=t}return t.prototype.push=function(t,n){this.ondata||E(5),this.d&&E(4),this.ondata(P(t),this.d=n||!1)},t}();function P(n,r){if(J)return J.encode(n);for(var e=n.length,i=new t(n.length+(n.length>>1)),s=0,a=function(t){i[s++]=t},o=0;o<e;++o){if(s+5>i.length){var h=new t(s+8+(e-o<<1));h.set(i),i=h}var f=n.charCodeAt(o);f<128||r?a(f):f<2048?(a(192|f>>6),a(128|63&f)):f>55295&&f<57344?(a(240|(f=65536+(1047552&f)|1023&n.charCodeAt(++o))>>18),a(128|f>>12&63),a(128|f>>6&63),a(128|63&f)):(a(224|f>>12),a(128|f>>6&63),a(128|63&f))}return b(i,0,s)}function Q(t){return function(t,n){n||(n={});var r=S(),e=t.length;r.p(t);var i=O(t,n,B(n),8),s=i.length;return q(i,n),j(i,s-8,r.d()),j(i,s-4,e),i}(P(t))}const R=new class{constructor(){this._init()}clear(){this._init()}addEvent(t){if(!t)throw new Error("Adding invalid event");const n=this._hasEvents?",":"";this.stream.push(n+t),this._hasEvents=!0}finish(){this.stream.push("]",!0);const t=function(t){let n=0;for(const r of t)n+=r.length;const r=new Uint8Array(n);for(let n=0,e=0,i=t.length;n<i;n++){const i=t[n];r.set(i,e),e+=i.length}return r}(this._deflatedData);return this._init(),t}_init(){this._hasEvents=!1,this._deflatedData=[],this.deflate=new H,this.deflate.ondata=(t,n)=>{this._deflatedData.push(t)},this.stream=new N(((t,n)=>{this.deflate.push(t,n)})),this.stream.push("[")}},V={clear:()=>{R.clear()},addEvent:t=>R.addEvent(t),finish:()=>R.finish(),compress:t=>Q(t)};addEventListener("message",(function(t){const n=t.data.method,r=t.data.id,e=t.data.arg;if(n in V&&"function"==typeof V[n])try{const t=V[n](e);postMessage({id:r,method:n,success:!0,response:t})}catch(t){postMessage({id:r,method:n,success:!1,response:t.message}),console.error(t)}})),postMessage({id:void 0,method:"init",success:!0,response:void 0});';function L4(){const t=new Blob([O4]);return URL.createObjectURL(t)}const DE=["info","warn","error","log"],Wl="[Replay] ";function rg(t,e="info"){Br({category:"console",data:{logger:"replay"},level:e,message:`${Wl}${t}`},{level:e})}function D4(){let t=!1,e=!1;const n={exception:()=>{},infoTick:()=>{},setConfig:r=>{t=!!r.captureExceptions,e=!!r.traceInternals}};return _e?(DE.forEach(r=>{n[r]=(...i)=>{L[r](Wl,...i),e&&rg(i.join(""),lp(r))}}),n.exception=(r,...i)=>{i.length&&n.error&&n.error(...i),L.error(Wl,r),t?ll(r):e&&rg(r,"error")},n.infoTick=(...r)=>{L.info(Wl,...r),e&&setTimeout(()=>rg(r[0]),0)}):DE.forEach(r=>{n[r]=()=>{}}),n}const ye=D4();class ig extends Error{constructor(){super(`Event buffer exceeded maximum size of ${jp}.`)}}class NE{constructor(){this.events=[],this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return this.events.length>0}get type(){return"sync"}destroy(){this.events=[]}async addEvent(e){const n=JSON.stringify(e).length;if(this._totalSize+=n,this._totalSize>jp)throw new ig;this.events.push(e)}finish(){return new Promise(e=>{const n=this.events;this.clear(),e(JSON.stringify(n))})}clear(){this.events=[],this._totalSize=0,this.hasCheckout=!1}getEarliestTimestamp(){const e=this.events.map(n=>n.timestamp).sort()[0];return e?eg(e):null}}class N4{constructor(e){this._worker=e,this._id=0}ensureReady(){return this._ensureReadyPromise?this._ensureReadyPromise:(this._ensureReadyPromise=new Promise((e,n)=>{this._worker.addEventListener("message",({data:r})=>{r.success?e():n()},{once:!0}),this._worker.addEventListener("error",r=>{n(r)},{once:!0})}),this._ensureReadyPromise)}destroy(){_e&&ye.info("Destroying compression worker"),this._worker.terminate()}postMessage(e,n){const r=this._getAndIncrementId();return new Promise((i,s)=>{const o=({data:a})=>{const c=a;if(c.method===e&&c.id===r){if(this._worker.removeEventListener("message",o),!c.success){_e&&ye.error("Error in compression worker: ",c.response),s(new Error("Error in compression worker"));return}i(c.response)}};this._worker.addEventListener("message",o),this._worker.postMessage({id:r,method:e,arg:n})})}_getAndIncrementId(){return this._id++}}class F4{constructor(e){this._worker=new N4(e),this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this.waitForCheckout=!1}get hasEvents(){return!!this._earliestTimestamp}get type(){return"worker"}ensureReady(){return this._worker.ensureReady()}destroy(){this._worker.destroy()}addEvent(e){const n=eg(e.timestamp);(!this._earliestTimestamp||n<this._earliestTimestamp)&&(this._earliestTimestamp=n);const r=JSON.stringify(e);return this._totalSize+=r.length,this._totalSize>jp?Promise.reject(new ig):this._sendEventToWorker(r)}finish(){return this._finishRequest()}clear(){this._earliestTimestamp=null,this._totalSize=0,this.hasCheckout=!1,this._worker.postMessage("clear").then(null,e=>{_e&&ye.exception(e,'Sending "clear" message to worker failed',e)})}getEarliestTimestamp(){return this._earliestTimestamp}_sendEventToWorker(e){return this._worker.postMessage("addEvent",e)}async _finishRequest(){const e=await this._worker.postMessage("finish");return this._earliestTimestamp=null,this._totalSize=0,e}}class $4{constructor(e){this._fallback=new NE,this._compression=new F4(e),this._used=this._fallback,this._ensureWorkerIsLoadedPromise=this._ensureWorkerIsLoaded()}get waitForCheckout(){return this._used.waitForCheckout}get type(){return this._used.type}get hasEvents(){return this._used.hasEvents}get hasCheckout(){return this._used.hasCheckout}set hasCheckout(e){this._used.hasCheckout=e}set waitForCheckout(e){this._used.waitForCheckout=e}destroy(){this._fallback.destroy(),this._compression.destroy()}clear(){return this._used.clear()}getEarliestTimestamp(){return this._used.getEarliestTimestamp()}addEvent(e){return this._used.addEvent(e)}async finish(){return await this.ensureWorkerIsLoaded(),this._used.finish()}ensureWorkerIsLoaded(){return this._ensureWorkerIsLoadedPromise}async _ensureWorkerIsLoaded(){try{await this._compression.ensureReady()}catch(e){_e&&ye.exception(e,"Failed to load the compression worker, falling back to simple buffer");return}await this._switchToCompressionWorker()}async _switchToCompressionWorker(){const{events:e,hasCheckout:n,waitForCheckout:r}=this._fallback,i=[];for(const s of e)i.push(this._compression.addEvent(s));this._compression.hasCheckout=n,this._compression.waitForCheckout=r,this._used=this._compression;try{await Promise.all(i),this._fallback.clear()}catch(s){_e&&ye.exception(s,"Failed to add events when switching buffers.")}}}function U4({useCompression:t,workerUrl:e}){if(t&&window.Worker){const n=B4(e);if(n)return n}return _e&&ye.info("Using simple buffer"),new NE}function B4(t){try{const e=t||j4();if(!e)return;_e&&ye.info(`Using compression worker${t?` from ${t}`:""}`);const n=new Worker(e);return new $4(n)}catch(e){_e&&ye.exception(e,"Failed to create compression worker")}}function j4(){return typeof __SENTRY_EXCLUDE_REPLAY_WORKER__>"u"||!__SENTRY_EXCLUDE_REPLAY_WORKER__?L4():""}function sg(){try{return"sessionStorage"in tt&&!!tt.sessionStorage}catch{return!1}}function H4(t){q4(),t.session=void 0}function q4(){if(sg())try{tt.sessionStorage.removeItem(Up)}catch{}}function FE(t){return t===void 0?!1:Math.random()<t}function $E(t){const e=Date.now(),n=t.id||nn(),r=t.started||e,i=t.lastActivity||e,s=t.segmentId||0,o=t.sampled,a=t.previousSessionId;return{id:n,started:r,lastActivity:i,segmentId:s,sampled:o,previousSessionId:a}}function og(t){if(sg())try{tt.sessionStorage.setItem(Up,JSON.stringify(t))}catch{}}function W4(t,e){return FE(t)?"session":e?"buffer":!1}function UE({sessionSampleRate:t,allowBuffering:e,stickySession:n=!1},{previousSessionId:r}={}){const i=W4(t,e),s=$E({sampled:i,previousSessionId:r});return n&&og(s),s}function z4(){if(!sg())return null;try{const t=tt.sessionStorage.getItem(Up);if(!t)return null;const e=JSON.parse(t);return _e&&ye.infoTick("Loading existing session"),$E(e)}catch{return null}}function ag(t,e,n=+new Date){return t===null||e===void 0||e<0?!0:e===0?!1:t+e<=n}function BE(t,{maxReplayDuration:e,sessionIdleExpire:n,targetTime:r=Date.now()}){return ag(t.started,e,r)||ag(t.lastActivity,n,r)}function jE(t,{sessionIdleExpire:e,maxReplayDuration:n}){return!(!BE(t,{sessionIdleExpire:e,maxReplayDuration:n})||t.sampled==="buffer"&&t.segmentId===0)}function cg({sessionIdleExpire:t,maxReplayDuration:e,previousSessionId:n},r){const i=r.stickySession&&z4();return i?jE(i,{sessionIdleExpire:t,maxReplayDuration:e})?(_e&&ye.infoTick("Session in sessionStorage is expired, creating new one..."),UE(r,{previousSessionId:i.id})):i:(_e&&ye.infoTick("Creating new session"),UE(r,{previousSessionId:n}))}function V4(t){return t.type===Oe.Custom}function ug(t,e,n){return qE(t,e)?(HE(t,e,n),!0):!1}function K4(t,e,n){return qE(t,e)?HE(t,e,n):Promise.resolve(null)}async function HE(t,e,n){const{eventBuffer:r}=t;if(!r||r.waitForCheckout&&!n)return null;const i=t.recordingMode==="buffer";try{n&&i&&r.clear(),n&&(r.hasCheckout=!0,r.waitForCheckout=!1);const s=t.getOptions(),o=G4(e,s.beforeAddRecordingEvent);return o?await r.addEvent(o):void 0}catch(s){const o=s&&s instanceof ig,a=o?"addEventSizeExceeded":"addEvent";if(o&&i)return r.clear(),r.waitForCheckout=!0,null;t.handleException(s),await t.stop({reason:a});const c=oe();c&&c.recordDroppedEvent("internal_sdk_error","replay")}}function qE(t,e){if(!t.eventBuffer||t.isPaused()||!t.isEnabled())return!1;const n=eg(e.timestamp);return n+t.timeouts.sessionIdlePause<Date.now()?!1:n>t.getContext().initialTimestamp+t.getOptions().maxReplayDuration?(_e&&ye.infoTick(`Skipping event with timestamp ${n} because it is after maxReplayDuration`),!1):!0}function G4(t,e){try{if(typeof e=="function"&&V4(t))return e(t)}catch(n){return _e&&ye.exception(n,"An error occurred in the `beforeAddRecordingEvent` callback, skipping the event..."),null}return t}function lg(t){return!t.type}function dg(t){return t.type==="transaction"}function Y4(t){return t.type==="replay_event"}function WE(t){return t.type==="feedback"}function Z4(t){return(e,n)=>{if(!t.isEnabled()||!lg(e)&&!dg(e))return;const r=n==null?void 0:n.statusCode;if(!(!r||r<200||r>=300)){if(dg(e)){X4(t,e);return}J4(t,e)}}}function X4(t,e){var r,i;const n=t.getContext();(i=(r=e.contexts)==null?void 0:r.trace)!=null&&i.trace_id&&n.traceIds.size<100&&n.traceIds.add(e.contexts.trace.trace_id)}function J4(t,e){const n=t.getContext();if(e.event_id&&n.errorIds.size<100&&n.errorIds.add(e.event_id),t.recordingMode!=="buffer"||!e.tags||!e.tags.replayId)return;const{beforeErrorSampling:r}=t.getOptions();typeof r=="function"&&!r(e)||ao(async()=>{try{await t.sendBufferedReplayOrFlush()}catch(i){t.handleException(i)}})}function Q4(t){return e=>{!t.isEnabled()||!lg(e)||e5(t,e)}}function e5(t,e){var r,i,s;const n=(s=(i=(r=e.exception)==null?void 0:r.values)==null?void 0:i[0])==null?void 0:s.value;if(typeof n=="string"&&(n.match(/(reactjs\.org\/docs\/error-decoder\.html\?invariant=|react\.dev\/errors\/)(418|419|422|423|425)/)||n.match(/(does not match server-rendered HTML|Hydration failed because)/i))){const o=dr({category:"replay.hydrate-error",data:{url:Qi()}});ac(t,o)}}function t5(t){const e=oe();e&&e.on("beforeAddBreadcrumb",n=>n5(t,n))}function n5(t,e){if(!t.isEnabled()||!zE(e))return;const n=r5(e);n&&ac(t,n)}function r5(t){return!zE(t)||["fetch","xhr","sentry.event","sentry.transaction"].includes(t.category)||t.category.startsWith("ui.")?null:t.category==="console"?i5(t):dr(t)}function i5(t){var i;const e=(i=t.data)==null?void 0:i.arguments;if(!Array.isArray(e)||e.length===0)return dr(t);let n=!1;const r=e.map(s=>{if(!s)return s;if(typeof s=="string")return s.length>Rl?(n=!0,`${s.slice(0,Rl)}…`):s;if(typeof s=="object")try{const o=Pn(s,7);return JSON.stringify(o).length>Rl?(n=!0,`${JSON.stringify(o,null,2).slice(0,Rl)}…`):o}catch{}return s});return dr({...t,data:{...t.data,arguments:r,...n?{_meta:{warnings:["CONSOLE_ARG_TRUNCATED"]}}:{}}})}function zE(t){return!!t.category}function s5(t,e){var n;return t.type||!t.exception||!t.exception.values||!t.exception.values.length?!1:!!((n=e.originalException)!=null&&n.__rrweb__)}function VE(){const t=Be().getPropagationContext().dsc;t&&delete t.replay_id;const e=$t();if(e){const n=Yn(e);delete n.replay_id}}function o5(t,e){t.triggerUserActivity(),t.addUpdate(()=>e.timestamp?(t.throttledAddEvent({type:Oe.Custom,timestamp:e.timestamp*1e3,data:{tag:"breadcrumb",payload:{timestamp:e.timestamp,type:"default",category:"sentry.feedback",data:{feedbackId:e.event_id}}}}),!1):!0)}function a5(t,e){return t.recordingMode!=="buffer"||e.message===Bp||!e.exception||e.type?!1:FE(t.getOptions().errorSampleRate)}function c5(t){return Object.assign((e,n)=>!t.isEnabled()||t.isPaused()?e:Y4(e)?(delete e.breadcrumbs,e):!lg(e)&&!dg(e)&&!WE(e)?e:t.checkAndHandleExpiredSession()?WE(e)?(t.flush(),e.contexts.feedback.replay_id=t.getSessionId(),o5(t,e),e):s5(e,n)&&!t.getOptions()._experiments.captureExceptions?(_e&&ye.log("Ignoring error from rrweb internals",e),null):((a5(t,e)||t.recordingMode==="session")&&(e.tags={...e.tags,replayId:t.getSessionId()}),e):(VE(),e),{id:"Replay"})}function zl(t,e){return e.map(({type:n,start:r,end:i,name:s,data:o})=>{const a=t.throttledAddEvent({type:Oe.Custom,timestamp:r,data:{tag:"performanceSpan",payload:{op:n,description:s,startTimestamp:r,endTimestamp:i,data:o}}});return typeof a=="string"?Promise.resolve(null):a})}function u5(t){const{from:e,to:n}=t,r=Date.now()/1e3;return{type:"navigation.push",start:r,end:r,name:n,data:{previous:e}}}function l5(t){return e=>{if(!t.isEnabled())return;const n=u5(e);n!==null&&(t.getContext().urls.push(n.name),t.triggerUserActivity(),t.addUpdate(()=>(zl(t,[n]),!1)))}}function d5(t,e){return _e&&t.getOptions()._experiments.traceInternals?!1:fw(e,oe())}function KE(t,e){t.isEnabled()&&e!==null&&(d5(t,e.name)||t.addUpdate(()=>(zl(t,[e]),!0)))}function Vl(t){if(!t)return;const e=new TextEncoder;try{if(typeof t=="string")return e.encode(t).length;if(t instanceof URLSearchParams)return e.encode(t.toString()).length;if(t instanceof FormData){const n=pS(t);return e.encode(n).length}if(t instanceof Blob)return t.size;if(t instanceof ArrayBuffer)return t.byteLength}catch{}}function GE(t){if(!t)return;const e=parseInt(t,10);return isNaN(e)?void 0:e}function Kl(t,e){if(!t)return{headers:{},size:void 0,_meta:{warnings:[e]}};const n={...t._meta},r=n.warnings||[];return n.warnings=[...r,e],t._meta=n,t}function YE(t,e){if(!e)return null;const{startTimestamp:n,endTimestamp:r,url:i,method:s,statusCode:o,request:a,response:c}=e;return{type:t,start:n/1e3,end:r/1e3,name:i,data:{method:s,statusCode:o,request:a,response:c}}}function cc(t){return{headers:{},size:t,_meta:{warnings:["URL_SKIPPED"]}}}function Ei(t,e,n){if(!e&&Object.keys(t).length===0)return;if(!e)return{headers:t};if(!n)return{headers:t,size:e};const r={headers:t,size:e},{body:i,warnings:s}=f5(n);return r.body=i,s!=null&&s.length&&(r._meta={warnings:s}),r}function fg(t,e){return Object.entries(t).reduce((n,[r,i])=>{const s=r.toLowerCase();return e.includes(s)&&t[r]&&(n[s]=i),n},{})}function f5(t){if(!t||typeof t!="string")return{body:t};const e=t.length>WS,n=h5(t);if(e){const r=t.slice(0,WS);return n?{body:r,warnings:["MAYBE_JSON_TRUNCATED"]}:{body:`${r}…`,warnings:["TEXT_TRUNCATED"]}}if(n)try{return{body:JSON.parse(t)}}catch{}return{body:t}}function h5(t){const e=t[0],n=t[t.length-1];return e==="["&&n==="]"||e==="{"&&n==="}"}function Gl(t,e){const n=p5(t);return lr(n,e)}function p5(t,e=tt.document.baseURI){if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith(tt.location.origin))return t;const n=new URL(t,e);if(n.origin!==new URL(e).origin)return t;const r=n.href;return!t.endsWith("/")&&r.endsWith("/")?r.slice(0,-1):r}async function g5(t,e,n){try{const r=await v5(t,e,n),i=YE("resource.fetch",r);KE(n.replay,i)}catch(r){_e&&ye.exception(r,"Failed to capture fetch breadcrumb")}}function m5(t,e){const{input:n,response:r}=e,i=n?Lp(n):void 0,s=Vl(i),o=r?GE(r.headers.get("content-length")):void 0;s!==void 0&&(t.data.request_body_size=s),o!==void 0&&(t.data.response_body_size=o)}async function v5(t,e,n){const r=Date.now(),{startTimestamp:i=r,endTimestamp:s=r}=e,{url:o,method:a,status_code:c=0,request_body_size:u,response_body_size:d}=t.data,l=Gl(o,n.networkDetailAllowUrls)&&!Gl(o,n.networkDetailDenyUrls),h=l?_5(n,e.input,u):cc(u),f=await y5(l,n,e.response,d);return{startTimestamp:i,endTimestamp:s,url:o,method:a,statusCode:c,request:h,response:f}}function _5({networkCaptureBodies:t,networkRequestHeaders:e},n,r){const i=n?S5(n,e):{};if(!t)return Ei(i,r,void 0);const s=Lp(n),[o,a]=Tl(s,ye),c=Ei(i,r,o);return a?Kl(c,a):c}async function y5(t,{networkCaptureBodies:e,networkResponseHeaders:n},r,i){if(!t&&i!==void 0)return cc(i);const s=r?ZE(r.headers,n):{};if(!r||!e&&i!==void 0)return Ei(s,i,void 0);const[o,a]=await w5(r),c=b5(o,{networkCaptureBodies:e,responseBodySize:i,captureDetails:t,headers:s});return a?Kl(c,a):c}function b5(t,{networkCaptureBodies:e,responseBodySize:n,captureDetails:r,headers:i}){try{const s=t!=null&&t.length&&n===void 0?Vl(t):n;return r?e?Ei(i,s,t):Ei(i,s,void 0):cc(s)}catch(s){return _e&&ye.exception(s,"Failed to serialize response body"),Ei(i,n,void 0)}}async function w5(t){const e=E5(t);if(!e)return[void 0,"BODY_PARSE_ERROR"];try{return[await k5(e)]}catch(n){return n instanceof Error&&n.message.indexOf("Timeout")>-1?(_e&&ye.warn("Parsing text body from response timed out"),[void 0,"BODY_PARSE_TIMEOUT"]):(_e&&ye.exception(n,"Failed to get text body from response"),[void 0,"BODY_PARSE_ERROR"])}}function ZE(t,e){const n={};return e.forEach(r=>{t.get(r)&&(n[r]=t.get(r))}),n}function S5(t,e){return t.length===1&&typeof t[0]!="string"?XE(t[0],e):t.length===2?XE(t[1],e):{}}function XE(t,e){if(!t)return{};const n=t.headers;return n?n instanceof Headers?ZE(n,e):Array.isArray(n)?{}:fg(n,e):{}}function E5(t){try{return t.clone()}catch(e){_e&&ye.exception(e,"Failed to clone response body")}}function k5(t){return new Promise((e,n)=>{const r=ao(()=>n(new Error("Timeout while trying to read response body")),500);C5(t).then(i=>e(i),i=>n(i)).finally(()=>clearTimeout(r))})}async function C5(t){return await t.text()}async function T5(t,e,n){try{const r=x5(t,e,n),i=YE("resource.xhr",r);KE(n.replay,i)}catch(r){_e&&ye.exception(r,"Failed to capture xhr breadcrumb")}}function I5(t,e){const{xhr:n,input:r}=e;if(!n)return;const i=Vl(r),s=n.getResponseHeader("content-length")?GE(n.getResponseHeader("content-length")):M5(n.response,n.responseType);i!==void 0&&(t.data.request_body_size=i),s!==void 0&&(t.data.response_body_size=s)}function x5(t,e,n){const r=Date.now(),{startTimestamp:i=r,endTimestamp:s=r,input:o,xhr:a}=e,{url:c,method:u,status_code:d=0,request_body_size:l,response_body_size:h}=t.data;if(!c)return null;if(!a||!Gl(c,n.networkDetailAllowUrls)||Gl(c,n.networkDetailDenyUrls)){const E=cc(l),I=cc(h);return{startTimestamp:i,endTimestamp:s,url:c,method:u,statusCode:d,request:E,response:I}}const f=a[qr],p=f?fg(f.request_headers,n.networkRequestHeaders):{},g=fg(R5(a),n.networkResponseHeaders),[v,m]=n.networkCaptureBodies?Tl(o,ye):[void 0],[_,w]=n.networkCaptureBodies?A5(a):[void 0],T=Ei(p,l,v),C=Ei(g,h,_);return{startTimestamp:i,endTimestamp:s,url:c,method:u,statusCode:d,request:m?Kl(T,m):T,response:w?Kl(C,w):C}}function R5(t){const e=t.getAllResponseHeaders();return e?e.split(`\r
`).reduce((n,r)=>{const[i,s]=r.split(": ");return s&&(n[i.toLowerCase()]=s),n},{}):{}}function A5(t){const e=[];try{return[t.responseText]}catch(n){e.push(n)}try{return P5(t.response,t.responseType)}catch(n){e.push(n)}return _e&&ye.warn("Failed to get xhr response body",...e),[void 0]}function P5(t,e){try{if(typeof t=="string")return[t];if(t instanceof Document)return[t.body.outerHTML];if(e==="json"&&t&&typeof t=="object")return[JSON.stringify(t)];if(!t)return[void 0]}catch(n){return _e&&ye.exception(n,"Failed to serialize body",t),[void 0,"BODY_PARSE_ERROR"]}return _e&&ye.info("Skipping network body because of body type",t),[void 0,"UNPARSEABLE_BODY_TYPE"]}function M5(t,e){try{const n=e==="json"&&t&&typeof t=="object"?JSON.stringify(t):t;return Vl(n)}catch{return}}function O5(t){const e=oe();try{const{networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:i,networkRequestHeaders:s,networkResponseHeaders:o}=t.getOptions(),a={replay:t,networkDetailAllowUrls:n,networkDetailDenyUrls:r,networkCaptureBodies:i,networkRequestHeaders:s,networkResponseHeaders:o};e&&e.on("beforeAddBreadcrumb",(c,u)=>L5(a,c,u))}catch{}}function L5(t,e,n){if(e.data)try{D5(e)&&F5(n)&&(I5(e,n),T5(e,n,t)),N5(e)&&$5(n)&&(m5(e,n),g5(e,n,t))}catch(r){_e&&ye.exception(r,"Error when enriching network breadcrumb")}}function D5(t){return t.category==="xhr"}function N5(t){return t.category==="fetch"}function F5(t){return t==null?void 0:t.xhr}function $5(t){return t==null?void 0:t.response}function U5(t,{autoFlushOnFeedback:e}){const n=oe();dS(p4(t)),kl(l5(t)),t5(t),O5(t);const r=c5(t);W0(r),n&&(n.on("beforeSendEvent",Q4(t)),n.on("afterSendEvent",Z4(t)),n.on("createDsc",i=>{const s=t.getSessionId();s&&t.isEnabled()&&t.recordingMode==="session"&&t.checkAndHandleExpiredSession()&&(i.replay_id=s)}),n.on("spanStart",i=>{t.lastActiveSpan=i}),n.on("spanEnd",i=>{t.lastActiveSpan=i}),n.on("beforeSendFeedback",async(i,s)=>{var a;const o=t.getSessionId();s!=null&&s.includeReplay&&t.isEnabled()&&o&&((a=i.contexts)!=null&&a.feedback)&&(i.contexts.feedback.source==="api"&&e&&await t.flush(),i.contexts.feedback.replay_id=o)}),e&&n.on("openFeedbackWidget",async()=>{await t.flush()}))}async function B5(t){try{return Promise.all(zl(t,[j5(tt.performance.memory)]))}catch{return[]}}function j5(t){const{jsHeapSizeLimit:e,totalJSHeapSize:n,usedJSHeapSize:r}=t,i=Date.now()/1e3;return{type:"memory",name:"memory",start:i,end:i,data:{memory:{jsHeapSizeLimit:e,totalJSHeapSize:n,usedJSHeapSize:r}}}}function H5(t,e,n){let r,i,s;const o=n!=null&&n.maxWait?Math.max(n.maxWait,e):0;function a(){return c(),r=t(),r}function c(){i!==void 0&&clearTimeout(i),s!==void 0&&clearTimeout(s),i=s=void 0}function u(){return i!==void 0||s!==void 0?a():r}function d(){return i&&clearTimeout(i),i=ao(a,e),o&&s===void 0&&(s=ao(a,o)),r}return d.cancel=c,d.flush=u,d}const Mn=ke.navigator;function q5(){return/iPhone|iPad|iPod/i.test((Mn==null?void 0:Mn.userAgent)??"")||/Macintosh/i.test((Mn==null?void 0:Mn.userAgent)??"")&&(Mn!=null&&Mn.maxTouchPoints)&&(Mn==null?void 0:Mn.maxTouchPoints)>1?{sampling:{mousemove:!1}}:{}}function W5(t){let e=!1;return(n,r)=>{if(!t.checkAndHandleExpiredSession()){_e&&ye.warn("Received replay event after session expired.");return}const i=r||!e;e=!0,t.clickDetector&&u4(t.clickDetector,n),t.addUpdate(()=>{if(t.recordingMode==="buffer"&&i&&t.setInitialState(),!ug(t,n,i))return!0;if(!i)return!1;const s=t.session;if(V5(t,i),t.recordingMode==="buffer"&&s&&t.eventBuffer){const o=t.eventBuffer.getEarliestTimestamp();o&&(_e&&ye.info(`Updating session start time to earliest event in buffer to ${new Date(o)}`),s.started=o,t.getOptions().stickySession&&og(s))}return s!=null&&s.previousSessionId||t.recordingMode==="session"&&t.flush(),!0})}}function z5(t){const e=t.getOptions();return{type:Oe.Custom,timestamp:Date.now(),data:{tag:"options",payload:{shouldRecordCanvas:t.isRecordingCanvas(),sessionSampleRate:e.sessionSampleRate,errorSampleRate:e.errorSampleRate,useCompressionOption:e.useCompression,blockAllMedia:e.blockAllMedia,maskAllText:e.maskAllText,maskAllInputs:e.maskAllInputs,useCompression:t.eventBuffer?t.eventBuffer.type==="worker":!1,networkDetailHasUrls:e.networkDetailAllowUrls.length>0,networkCaptureBodies:e.networkCaptureBodies,networkRequestHasHeaders:e.networkRequestHeaders.length>0,networkResponseHasHeaders:e.networkResponseHeaders.length>0}}}}function V5(t,e){!e||!t.session||t.session.segmentId!==0||ug(t,z5(t),!1)}function K5(t,e,n,r){return Ur(R0(t,Kh(t),r,n),[[{type:"replay_event"},t],[{type:"replay_recording",length:typeof e=="string"?new TextEncoder().encode(e).length:e.length},e]])}function G5({recordingData:t,headers:e}){let n;const r=`${JSON.stringify(e)}
`;if(typeof t=="string")n=`${r}${t}`;else{const s=new TextEncoder().encode(r);n=new Uint8Array(s.length+t.length),n.set(s),n.set(t,s.length)}return n}async function Y5({client:t,scope:e,replayId:n,event:r}){const i=typeof t._integrations=="object"&&t._integrations!==null&&!Array.isArray(t._integrations)?Object.keys(t._integrations):void 0,s={event_id:n,integrations:i};t.emit("preprocessEvent",r,s);const o=await j0(t.getOptions(),r,s,e,t,Pt());if(!o)return null;t.emit("postprocessEvent",o,s),o.platform=o.platform||"javascript";const a=t.getSdkMetadata(),{name:c,version:u}=(a==null?void 0:a.sdk)||{};return o.sdk={...o.sdk,name:c||"sentry.javascript.unknown",version:u||"0.0.0"},o}async function Z5({recordingData:t,replayId:e,segmentId:n,eventContext:r,timestamp:i,session:s}){const o=G5({recordingData:t,headers:{segment_id:n}}),{urls:a,errorIds:c,traceIds:u,initialTimestamp:d}=r,l=oe(),h=Be(),f=l==null?void 0:l.getTransport(),p=l==null?void 0:l.getDsn();if(!l||!f||!p||!s.sampled)return Dr({});const g={type:I3,replay_start_timestamp:d/1e3,timestamp:i/1e3,error_ids:c,trace_ids:u,urls:a,replay_id:e,segment_id:n,replay_type:s.sampled},v=await Y5({scope:h,client:l,replayId:e,event:g});if(!v)return l.recordDroppedEvent("event_processor","replay"),_e&&ye.info("An event processor returned `null`, will not send event."),Dr({});delete v.sdkProcessingMetadata;const m=K5(v,o,p,l.getOptions().tunnel);let _;try{_=await f.send(m)}catch(T){const C=new Error(Bp);try{C.cause=T}catch{}throw C}if(typeof _.statusCode=="number"&&(_.statusCode<200||_.statusCode>=300))throw new JE(_.statusCode);const w=uw({},_);if(cw(w,"replay"))throw new hg(w);return _}class JE extends Error{constructor(e){super(`Transport returned status code ${e}`)}}class hg extends Error{constructor(e){super("Rate limit hit"),this.rateLimits=e}}async function QE(t,e={count:0,interval:O3}){const{recordingData:n,onError:r}=t;if(n.length)try{return await Z5(t),!0}catch(i){if(i instanceof JE||i instanceof hg)throw i;if(H0("Replays",{_retryCount:e.count}),r&&r(i),e.count>=L3){const s=new Error(`${Bp} - max retries exceeded`);try{s.cause=i}catch{}throw s}return e.interval*=++e.count,new Promise((s,o)=>{ao(async()=>{try{await QE(t,e),s(!0)}catch(a){o(a)}},e.interval)})}}const ek="__THROTTLED",X5="__SKIPPED";function J5(t,e,n){const r=new Map,i=a=>{const c=a-n;r.forEach((u,d)=>{d<c&&r.delete(d)})},s=()=>[...r.values()].reduce((a,c)=>a+c,0);let o=!1;return(...a)=>{const c=Math.floor(Date.now()/1e3);if(i(c),s()>=e){const d=o;return o=!0,d?X5:ek}o=!1;const u=r.get(c)||0;return r.set(c,u+1),t(...a)}}class Q5{constructor({options:e,recordingOptions:n}){this.eventBuffer=null,this.performanceEntries=[],this.replayPerformanceEntries=[],this.recordingMode="session",this.timeouts={sessionIdlePause:x3,sessionIdleExpire:R3},this._lastActivity=Date.now(),this._isEnabled=!1,this._isPaused=!1,this._requiresManualStart=!1,this._hasInitializedCoreListeners=!1,this._context={errorIds:new Set,traceIds:new Set,urls:[],initialTimestamp:Date.now(),initialUrl:""},this._recordingOptions=n,this._options=e,this._debouncedFlush=H5(()=>this._flush(),this._options.flushMinDelay,{maxWait:this._options.flushMaxDelay}),this._throttledAddEvent=J5((o,a)=>K4(this,o,a),300,5);const{slowClickTimeout:r,slowClickIgnoreSelectors:i}=this.getOptions(),s=r?{threshold:Math.min(D3,r),timeout:r,scrollTimeout:N3,ignoreSelector:i?i.join(","):""}:void 0;if(s&&(this.clickDetector=new s4(this,s)),_e){const o=e._experiments;ye.setConfig({captureExceptions:!!o.captureExceptions,traceInternals:!!o.traceInternals})}this._handleVisibilityChange=()=>{tt.document.visibilityState==="visible"?this._doChangeToForegroundTasks():this._doChangeToBackgroundTasks()},this._handleWindowBlur=()=>{const o=dr({category:"ui.blur"});this._doChangeToBackgroundTasks(o)},this._handleWindowFocus=()=>{const o=dr({category:"ui.focus"});this._doChangeToForegroundTasks(o)},this._handleKeyboardEvent=o=>{_4(this,o)}}getContext(){return this._context}isEnabled(){return this._isEnabled}isPaused(){return this._isPaused}isRecordingCanvas(){return!!this._canvas}getOptions(){return this._options}handleException(e){_e&&ye.exception(e),this._options.onError&&this._options.onError(e)}initializeSampling(e){const{errorSampleRate:n,sessionSampleRate:r}=this._options,i=n<=0&&r<=0;if(this._requiresManualStart=i,!i){if(this._initializeSessionForSampling(e),!this.session){_e&&ye.exception(new Error("Unable to initialize and create session"));return}this.session.sampled!==!1&&(this.recordingMode=this.session.sampled==="buffer"&&this.session.segmentId===0?"buffer":"session",_e&&ye.infoTick(`Starting replay in ${this.recordingMode} mode`),this._initializeRecording())}}start(){if(this._isEnabled&&this.recordingMode==="session"){_e&&ye.info("Recording is already in progress");return}if(this._isEnabled&&this.recordingMode==="buffer"){_e&&ye.info("Buffering is in progress, call `flush()` to save the replay");return}_e&&ye.infoTick("Starting replay in session mode"),this._updateUserActivity();const e=cg({maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire},{stickySession:this._options.stickySession,sessionSampleRate:1,allowBuffering:!1});this.session=e,this._initializeRecording()}startBuffering(){if(this._isEnabled){_e&&ye.info("Buffering is in progress, call `flush()` to save the replay");return}_e&&ye.infoTick("Starting replay in buffer mode");const e=cg({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration},{stickySession:this._options.stickySession,sessionSampleRate:0,allowBuffering:!0});this.session=e,this.recordingMode="buffer",this._initializeRecording()}startRecording(){try{const e=this._canvas;this._stopRecording=zr({...this._recordingOptions,...this.recordingMode==="buffer"?{checkoutEveryNms:M3}:this._options._experiments.continuousCheckout&&{checkoutEveryNms:Math.max(36e4,this._options._experiments.continuousCheckout)},emit:W5(this),...q5(),onMutation:this._onMutationHandler.bind(this),...e?{recordCanvas:e.recordCanvas,getCanvasManager:e.getCanvasManager,sampling:e.sampling,dataURLOptions:e.dataURLOptions}:{}})}catch(e){this.handleException(e)}}stopRecording(){try{return this._stopRecording&&(this._stopRecording(),this._stopRecording=void 0),!0}catch(e){return this.handleException(e),!1}}async stop({forceFlush:e=!1,reason:n}={}){var r;if(this._isEnabled){this._isEnabled=!1;try{_e&&ye.info(`Stopping Replay${n?` triggered by ${n}`:""}`),VE(),this._removeListeners(),this.stopRecording(),this._debouncedFlush.cancel(),e&&await this._flush({force:!0}),(r=this.eventBuffer)==null||r.destroy(),this.eventBuffer=null,H4(this)}catch(i){this.handleException(i)}}}pause(){this._isPaused||(this._isPaused=!0,this.stopRecording(),_e&&ye.info("Pausing replay"))}resume(){!this._isPaused||!this._checkSession()||(this._isPaused=!1,this.startRecording(),_e&&ye.info("Resuming replay"))}async sendBufferedReplayOrFlush({continueRecording:e=!0}={}){if(this.recordingMode==="session")return this.flushImmediate();const n=Date.now();_e&&ye.info("Converting buffer to session"),await this.flushImmediate();const r=this.stopRecording();!e||!r||this.recordingMode!=="session"&&(this.recordingMode="session",this.session&&(this._updateUserActivity(n),this._updateSessionActivity(n),this._maybeSaveSession()),this.startRecording())}addUpdate(e){const n=e();this.recordingMode!=="buffer"&&n!==!0&&this._debouncedFlush()}triggerUserActivity(){if(this._updateUserActivity(),!this._stopRecording){if(!this._checkSession())return;this.resume();return}this.checkAndHandleExpiredSession(),this._updateSessionActivity()}updateUserActivity(){this._updateUserActivity(),this._updateSessionActivity()}conditionalFlush(){return this.recordingMode==="buffer"?Promise.resolve():this.flushImmediate()}flush(){return this._debouncedFlush()}flushImmediate(){return this._debouncedFlush(),this._debouncedFlush.flush()}cancelFlush(){this._debouncedFlush.cancel()}getSessionId(){var e;return(e=this.session)==null?void 0:e.id}checkAndHandleExpiredSession(){if(this._lastActivity&&ag(this._lastActivity,this.timeouts.sessionIdlePause)&&this.session&&this.session.sampled==="session"){this.pause();return}return!!this._checkSession()}setInitialState(){const e=`${tt.location.pathname}${tt.location.hash}${tt.location.search}`,n=`${tt.location.origin}${e}`;this.performanceEntries=[],this.replayPerformanceEntries=[],this._clearContext(),this._context.initialUrl=n,this._context.initialTimestamp=Date.now(),this._context.urls.push(n)}throttledAddEvent(e,n){const r=this._throttledAddEvent(e,n);if(r===ek){const i=dr({category:"replay.throttled"});this.addUpdate(()=>!ug(this,{type:JU,timestamp:i.timestamp||0,data:{tag:"breadcrumb",payload:i,metric:!0}}))}return r}getCurrentRoute(){const e=this.lastActiveSpan||$t(),n=e&&xt(e),i=(n&&Re(n).data||{})[An];if(!(!n||!i||!["route","custom"].includes(i)))return Re(n).description}_initializeRecording(){this.setInitialState(),this._updateSessionActivity(),this.eventBuffer=U4({useCompression:this._options.useCompression,workerUrl:this._options.workerUrl}),this._removeListeners(),this._addListeners(),this._isEnabled=!0,this._isPaused=!1,this.startRecording()}_initializeSessionForSampling(e){const n=this._options.errorSampleRate>0,r=cg({sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration,previousSessionId:e},{stickySession:this._options.stickySession,sessionSampleRate:this._options.sessionSampleRate,allowBuffering:n});this.session=r}_checkSession(){if(!this.session)return!1;const e=this.session;return jE(e,{sessionIdleExpire:this.timeouts.sessionIdleExpire,maxReplayDuration:this._options.maxReplayDuration})?(this._refreshSession(e),!1):!0}async _refreshSession(e){this._isEnabled&&(await this.stop({reason:"refresh session"}),this.initializeSampling(e.id))}_addListeners(){try{tt.document.addEventListener("visibilitychange",this._handleVisibilityChange),tt.addEventListener("blur",this._handleWindowBlur),tt.addEventListener("focus",this._handleWindowFocus),tt.addEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.addListeners(),this._hasInitializedCoreListeners||(U5(this,{autoFlushOnFeedback:this._options._experiments.autoFlushOnFeedback}),this._hasInitializedCoreListeners=!0)}catch(e){this.handleException(e)}this._performanceCleanupCallback=M4(this)}_removeListeners(){try{tt.document.removeEventListener("visibilitychange",this._handleVisibilityChange),tt.removeEventListener("blur",this._handleWindowBlur),tt.removeEventListener("focus",this._handleWindowFocus),tt.removeEventListener("keydown",this._handleKeyboardEvent),this.clickDetector&&this.clickDetector.removeListeners(),this._performanceCleanupCallback&&this._performanceCleanupCallback()}catch(e){this.handleException(e)}}_doChangeToBackgroundTasks(e){!this.session||BE(this.session,{maxReplayDuration:this._options.maxReplayDuration,sessionIdleExpire:this.timeouts.sessionIdleExpire})||(e&&this._createCustomBreadcrumb(e),this.conditionalFlush())}_doChangeToForegroundTasks(e){if(!this.session)return;if(!this.checkAndHandleExpiredSession()){_e&&ye.info("Document has become active, but session has expired");return}e&&this._createCustomBreadcrumb(e)}_updateUserActivity(e=Date.now()){this._lastActivity=e}_updateSessionActivity(e=Date.now()){this.session&&(this.session.lastActivity=e,this._maybeSaveSession())}_createCustomBreadcrumb(e){this.addUpdate(()=>{this.throttledAddEvent({type:Oe.Custom,timestamp:e.timestamp||0,data:{tag:"breadcrumb",payload:e}})})}_addPerformanceEntries(){let e=S4(this.performanceEntries).concat(this.replayPerformanceEntries);if(this.performanceEntries=[],this.replayPerformanceEntries=[],this._requiresManualStart){const n=this._context.initialTimestamp/1e3;e=e.filter(r=>r.start>=n)}return Promise.all(zl(this,e))}_clearContext(){this._context.errorIds.clear(),this._context.traceIds.clear(),this._context.urls=[]}_updateInitialTimestampFromEventBuffer(){const{session:e,eventBuffer:n}=this;if(!e||!n||this._requiresManualStart||e.segmentId)return;const r=n.getEarliestTimestamp();r&&r<this._context.initialTimestamp&&(this._context.initialTimestamp=r)}_popEventContext(){const e={initialTimestamp:this._context.initialTimestamp,initialUrl:this._context.initialUrl,errorIds:Array.from(this._context.errorIds),traceIds:Array.from(this._context.traceIds),urls:this._context.urls};return this._clearContext(),e}async _runFlush(){var n;const e=this.getSessionId();if(!this.session||!this.eventBuffer||!e){_e&&ye.error("No session or eventBuffer found to flush.");return}if(await this._addPerformanceEntries(),!!((n=this.eventBuffer)!=null&&n.hasEvents)&&(await B5(this),!!this.eventBuffer&&e===this.getSessionId()))try{this._updateInitialTimestampFromEventBuffer();const r=Date.now();if(r-this._context.initialTimestamp>this._options.maxReplayDuration+3e4)throw new Error("Session is too long, not sending replay");const i=this._popEventContext(),s=this.session.segmentId++;this._maybeSaveSession();const o=await this.eventBuffer.finish();await QE({replayId:e,recordingData:o,segmentId:s,eventContext:i,session:this.session,timestamp:r,onError:a=>this.handleException(a)})}catch(r){this.handleException(r),this.stop({reason:"sendReplay"});const i=oe();if(i){const s=r instanceof hg?"ratelimit_backoff":"send_error";i.recordDroppedEvent(s,"replay")}}}async _flush({force:e=!1}={}){if(!this._isEnabled&&!e)return;if(!this.checkAndHandleExpiredSession()){_e&&ye.error("Attempting to finish replay event after session expired.");return}if(!this.session)return;const n=this.session.started,i=Date.now()-n;this._debouncedFlush.cancel();const s=i<this._options.minReplayDuration,o=i>this._options.maxReplayDuration+5e3;if(s||o){_e&&ye.info(`Session duration (${Math.floor(i/1e3)}s) is too ${s?"short":"long"}, not sending replay.`),s&&this._debouncedFlush();return}const a=this.eventBuffer;a&&this.session.segmentId===0&&!a.hasCheckout&&_e&&ye.info("Flushing initial segment without checkout.");const c=!!this._flushLock;this._flushLock||(this._flushLock=this._runFlush());try{await this._flushLock}catch(u){this.handleException(u)}finally{this._flushLock=void 0,c&&this._debouncedFlush()}}_maybeSaveSession(){this.session&&this._options.stickySession&&og(this.session)}_onMutationHandler(e){const n=e.length,r=this._options.mutationLimit,i=this._options.mutationBreadcrumbLimit,s=r&&n>r;if(n>i||s){const o=dr({category:"replay.mutations",data:{count:n,limit:s}});this._createCustomBreadcrumb(o)}return s?(this.stop({reason:"mutationLimit",forceFlush:this.recordingMode==="session"}),!1):!0}}function uc(t,e){return[...t,...e].join(",")}function eB({mask:t,unmask:e,block:n,unblock:r,ignore:i}){const s=["base","iframe[srcdoc]:not([src])"],o=uc(t,[".sentry-mask","[data-sentry-mask]"]),a=uc(e,[]);return{maskTextSelector:o,unmaskTextSelector:a,blockSelector:uc(n,[".sentry-block","[data-sentry-block]",...s]),unblockSelector:uc(r,[]),ignoreSelector:uc(i,[".sentry-ignore","[data-sentry-ignore]",'input[type="file"]'])}}function tB({el:t,key:e,maskAttributes:n,maskAllText:r,privacyOptions:i,value:s}){return!r||i.unmaskTextSelector&&t.matches(i.unmaskTextSelector)?s:n.includes(e)||e==="value"&&t.tagName==="INPUT"&&["submit","button"].includes(t.getAttribute("type")||"")?s.replace(/[\S]/g,"*"):s}const tk='img,image,svg,video,object,picture,embed,map,audio,link[rel="icon"],link[rel="apple-touch-icon"]',nB=["content-length","content-type","accept"];let nk=!1;const rB=t=>new iB(t);class iB{constructor({flushMinDelay:e=A3,flushMaxDelay:n=P3,minReplayDuration:r=F3,maxReplayDuration:i=zS,stickySession:s=!0,useCompression:o=!0,workerUrl:a,_experiments:c={},maskAllText:u=!0,maskAllInputs:d=!0,blockAllMedia:l=!0,mutationBreadcrumbLimit:h=750,mutationLimit:f=1e4,slowClickTimeout:p=7e3,slowClickIgnoreSelectors:g=[],networkDetailAllowUrls:v=[],networkDetailDenyUrls:m=[],networkCaptureBodies:_=!0,networkRequestHeaders:w=[],networkResponseHeaders:T=[],mask:C=[],maskAttributes:E=["title","placeholder"],unmask:I=[],block:y=[],unblock:b=[],ignore:k=[],maskFn:x,beforeAddRecordingEvent:R,beforeErrorSampling:F,onError:z}={}){this.name="Replay";const J=eB({mask:C,unmask:I,block:y,unblock:b,ignore:k});if(this._recordingOptions={maskAllInputs:d,maskAllText:u,maskInputOptions:{password:!0},maskTextFn:x,maskInputFn:x,maskAttributeFn:(U,q,V)=>tB({maskAttributes:E,maskAllText:u,privacyOptions:J,key:U,value:q,el:V}),...J,slimDOMOptions:"all",inlineStylesheet:!0,inlineImages:!1,collectFonts:!0,errorHandler:U=>{try{U.__rrweb__=!0}catch{}},recordCrossOriginIframes:!!c.recordCrossOriginIframes},this._initialOptions={flushMinDelay:e,flushMaxDelay:n,minReplayDuration:Math.min(r,$3),maxReplayDuration:Math.min(i,zS),stickySession:s,useCompression:o,workerUrl:a,blockAllMedia:l,maskAllInputs:d,maskAllText:u,mutationBreadcrumbLimit:h,mutationLimit:f,slowClickTimeout:p,slowClickIgnoreSelectors:g,networkDetailAllowUrls:v,networkDetailDenyUrls:m,networkCaptureBodies:_,networkRequestHeaders:rk(w),networkResponseHeaders:rk(T),beforeAddRecordingEvent:R,beforeErrorSampling:F,onError:z,_experiments:c},this._initialOptions.blockAllMedia&&(this._recordingOptions.blockSelector=this._recordingOptions.blockSelector?`${this._recordingOptions.blockSelector},${tk}`:tk),this._isInitialized&&gp())throw new Error("Multiple Sentry Session Replay instances are not supported");this._isInitialized=!0}get _isInitialized(){return nk}set _isInitialized(e){nk=e}afterAllSetup(e){!gp()||this._replay||(this._setup(e),this._initialize(e))}start(){this._replay&&this._replay.start()}startBuffering(){this._replay&&this._replay.startBuffering()}stop(){return this._replay?this._replay.stop({forceFlush:this._replay.recordingMode==="session"}):Promise.resolve()}flush(e){return this._replay?this._replay.isEnabled()?this._replay.sendBufferedReplayOrFlush(e):(this._replay.start(),Promise.resolve()):Promise.resolve()}getReplayId(){var e;if((e=this._replay)!=null&&e.isEnabled())return this._replay.getSessionId()}getRecordingMode(){var e;if((e=this._replay)!=null&&e.isEnabled())return this._replay.recordingMode}_initialize(e){this._replay&&(this._maybeLoadFromReplayCanvasIntegration(e),this._replay.initializeSampling())}_setup(e){const n=sB(this._initialOptions,e);this._replay=new Q5({options:n,recordingOptions:this._recordingOptions})}_maybeLoadFromReplayCanvasIntegration(e){try{const n=e.getIntegrationByName("ReplayCanvas");if(!n)return;this._replay._canvas=n.getOptions()}catch{}}}function sB(t,e){const n=e.getOptions(),r={sessionSampleRate:0,errorSampleRate:0,...t},i=ns(n.replaysSessionSampleRate),s=ns(n.replaysOnErrorSampleRate);return i==null&&s==null&&Ji(()=>{console.warn("Replay is disabled because neither `replaysSessionSampleRate` nor `replaysOnErrorSampleRate` are set.")}),i!=null&&(r.sessionSampleRate=i),s!=null&&(r.errorSampleRate=s),r}function rk(t){return[...nB,...t.map(e=>e.toLowerCase())]}function oB(){const t=oe();return t==null?void 0:t.getIntegrationByName("Replay")}var aB=Object.defineProperty,cB=(t,e,n)=>e in t?aB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ik=(t,e,n)=>cB(t,typeof e!="symbol"?e+"":e,n);class uB{constructor(){ik(this,"idNodeMap",new Map),ik(this,"nodeMetaMap",new WeakMap)}getId(e){var r;return e?((r=this.getMeta(e))==null?void 0:r.id)??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,n){const r=n.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,n)}replace(e,n){const r=this.getNode(e);if(r){const i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(n,i)}this.idNodeMap.set(e,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function lB(){return new uB}function dB(t,e){for(let n=t.classList.length;n--;){const r=t.classList[n];if(e.test(r))return!0}return!1}function pg(t,e,n=1/0,r=0){return!t||t.nodeType!==t.ELEMENT_NODE||r>n?-1:e(t)?r:pg(t.parentNode,e,n,r+1)}function sk(t,e){return n=>{const r=n;if(r===null)return!1;try{if(t){if(typeof t=="string"){if(r.matches(`.${t}`))return!0}else if(dB(r,t))return!0}return!!(e&&r.matches(e))}catch{return!1}}}const wo=`Please stop import mirror directly. Instead of that,\r
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
or you can use record.mirror to access the mirror instance during recording.`;let ok={map:{},getId(){return console.error(wo),-1},getNode(){return console.error(wo),null},removeNodeFromMap(){console.error(wo)},has(){return console.error(wo),!1},reset(){console.error(wo)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(ok=new Proxy(ok,{get(t,e,n){return e==="map"&&console.error(wo),Reflect.get(t,e,n)}}));function gg(t,e,n,r,i=window){const s=i.Object.getOwnPropertyDescriptor(t,e);return i.Object.defineProperty(t,e,r?n:{set(o){uk(()=>{n.set.call(this,o)},0),s&&s.set&&s.set.call(this,o)}}),()=>gg(t,e,s||{},!0)}function mg(t,e,n){try{if(!(e in t))return()=>{};const r=t[e],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=i,()=>{t[e]=r}}catch{return()=>{}}}Date.now().toString();function fB(t){if(!t)return null;try{return t.nodeType===t.ELEMENT_NODE?t:t.parentElement}catch{return null}}function Yl(t,e,n,r,i){if(!t)return!1;const s=fB(t);if(!s)return!1;const o=sk(e,n),a=pg(s,o);let c=-1;return a<0?!1:(r&&(c=pg(s,sk(null,r))),a>-1&&c<0?!0:a<c)}const ak={};function ck(t){const e=ak[t];if(e)return e;const n=window.document;let r=window[t];if(n&&typeof n.createElement=="function")try{const i=n.createElement("iframe");i.hidden=!0,n.head.appendChild(i);const s=i.contentWindow;s&&s[t]&&(r=s[t]),n.head.removeChild(i)}catch{}return ak[t]=r.bind(window)}function ds(...t){return ck("requestAnimationFrame")(...t)}function uk(...t){return ck("setTimeout")(...t)}var So=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(So||{});let Zl;function hB(t){Zl=t}const vg=t=>Zl?(...n)=>{try{return t(...n)}catch(r){if(Zl&&Zl(r)===!0)return()=>{};throw r}}:t;for(var Eo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pB=typeof Uint8Array>"u"?[]:new Uint8Array(256),Xl=0;Xl<Eo.length;Xl++)pB[Eo.charCodeAt(Xl)]=Xl;var gB=function(t){var e=new Uint8Array(t),n,r=e.length,i="";for(n=0;n<r;n+=3)i+=Eo[e[n]>>2],i+=Eo[(e[n]&3)<<4|e[n+1]>>4],i+=Eo[(e[n+1]&15)<<2|e[n+2]>>6],i+=Eo[e[n+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};const lk=new Map;function mB(t,e){let n=lk.get(t);return n||(n=new Map,lk.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}const dk=(t,e,n)=>{if(!t||!(hk(t,e)||typeof t=="object"))return;const r=t.constructor.name,i=mB(n,r);let s=i.indexOf(t);return s===-1&&(s=i.length,i.push(t)),s};function Jl(t,e,n){if(t instanceof Array)return t.map(r=>Jl(r,e,n));if(t===null)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){const r=t.constructor.name,i=gB(t);return{rr_type:r,base64:i}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Jl(t.buffer,e,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const r=t.constructor.name,{src:i}=t;return{rr_type:r,src:i}}else if(t instanceof HTMLCanvasElement){const r="HTMLImageElement",i=t.toDataURL();return{rr_type:r,src:i}}else{if(t instanceof ImageData)return{rr_type:t.constructor.name,args:[Jl(t.data,e,n),t.width,t.height]};if(hk(t,e)||typeof t=="object"){const r=t.constructor.name,i=dk(t,e,n);return{rr_type:r,index:i}}}}return t}const fk=(t,e,n)=>t.map(r=>Jl(r,e,n)),hk=(t,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>t instanceof e[i]);function vB(t,e,n,r,i){const s=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const a of o)try{if(typeof e.CanvasRenderingContext2D.prototype[a]!="function")continue;const c=mg(e.CanvasRenderingContext2D.prototype,a,function(u){return function(...d){return Yl(this.canvas,n,r,i,!0)||uk(()=>{const l=fk(d,e,this);t(this.canvas,{type:So["2D"],property:a,args:l})},0),u.apply(this,d)}});s.push(c)}catch{const c=gg(e.CanvasRenderingContext2D.prototype,a,{set(u){t(this.canvas,{type:So["2D"],property:a,args:[u],setter:!0})}});s.push(c)}return()=>{s.forEach(a=>a())}}function _B(t){return t==="experimental-webgl"?"webgl":t}function pk(t,e,n,r,i){const s=[];try{const o=mg(t.HTMLCanvasElement.prototype,"getContext",function(a){return function(c,...u){if(!Yl(this,e,n,r,!0)){const d=_B(c);if("__context"in this||(this.__context=d),i&&["webgl","webgl2"].includes(d))if(u[0]&&typeof u[0]=="object"){const l=u[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0)}else u.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[c,...u])}});s.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(o=>o())}}function gk(t,e,n,r,i,s,o,a){const c=[],u=Object.getOwnPropertyNames(t);for(const d of u)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(d))try{if(typeof t[d]!="function")continue;const l=mg(t,d,function(h){return function(...f){const p=h.apply(this,f);if(dk(p,a,this),"tagName"in this.canvas&&!Yl(this.canvas,r,i,s,!0)){const g=fk(f,a,this),v={type:e,property:d,args:g};n(this.canvas,v)}return p}});c.push(l)}catch{const l=gg(t,d,{set(h){n(this.canvas,{type:e,property:d,args:[h],setter:!0})}});c.push(l)}return c}function yB(t,e,n,r,i,s){const o=[];return o.push(...gk(e.WebGLRenderingContext.prototype,So.WebGL,t,n,r,i,s,e)),typeof e.WebGL2RenderingContext<"u"&&o.push(...gk(e.WebGL2RenderingContext.prototype,So.WebGL2,t,n,r,i,s,e)),()=>{o.forEach(a=>a())}}const bB='for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),a=0;a<64;a++)t[e.charCodeAt(a)]=a;var n=function(t){var a,n=new Uint8Array(t),r=n.length,s="";for(a=0;a<r;a+=3)s+=e[n[a]>>2],s+=e[(3&n[a])<<4|n[a+1]>>4],s+=e[(15&n[a+1])<<2|n[a+2]>>6],s+=e[63&n[a+2]];return r%3==2?s=s.substring(0,s.length-1)+"=":r%3==1&&(s=s.substring(0,s.length-2)+"=="),s};const r=new Map,s=new Map;const i=self;i.onmessage=async function(e){if(!("OffscreenCanvas"in globalThis))return i.postMessage({id:e.data.id});{const{id:t,bitmap:a,width:o,height:f,maxCanvasSize:c,dataURLOptions:g}=e.data,u=async function(e,t,a){const r=e+"-"+t;if("OffscreenCanvas"in globalThis){if(s.has(r))return s.get(r);const i=new OffscreenCanvas(e,t);i.getContext("2d");const o=await i.convertToBlob(a),f=await o.arrayBuffer(),c=n(f);return s.set(r,c),c}return""}(o,f,g),[h,d]=function(e,t,a){if(!a)return[e,t];const[n,r]=a;if(e<=n&&t<=r)return[e,t];let s=e,i=t;return s>n&&(i=Math.floor(n*t/e),s=n),i>r&&(s=Math.floor(r*e/t),i=r),[s,i]}(o,f,c),l=new OffscreenCanvas(h,d),w=l.getContext("bitmaprenderer"),p=h===o&&d===f?a:await createImageBitmap(a,{resizeWidth:h,resizeHeight:d,resizeQuality:"low"});w.transferFromImageBitmap(p),a.close();const y=await l.convertToBlob(g),v=y.type,b=await y.arrayBuffer(),m=n(b);if(p.close(),!r.has(t)&&await u===m)return r.set(t,m),i.postMessage({id:t});if(r.get(t)===m)return i.postMessage({id:t});i.postMessage({id:t,type:v,base64:m,width:o,height:f}),r.set(t,m)}};';function wB(){const t=new Blob([bB]);return URL.createObjectURL(t)}class SB{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.shadowDoms=new Set,this.windowsSet=new WeakSet,this.windows=[],this.restoreHandlers=[],this.frozen=!1,this.locked=!1,this.snapshotInProgressMap=new Map,this.worker=null,this.lastSnapshotTime=0,this.processMutation=(l,h)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(h)};const{sampling:n="all",win:r,blockClass:i,blockSelector:s,unblockSelector:o,maxCanvasSize:a,recordCanvas:c,dataURLOptions:u,errorHandler:d}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,this.options=e,d&&hB(d),(c&&typeof n=="number"||e.enableManualSnapshot)&&(this.worker=this.initFPSWorker()),this.addWindow(r),!e.enableManualSnapshot&&vg(()=>{c&&n==="all"&&(this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher()),c&&typeof n=="number"&&this.initCanvasFPSObserver(n,i,s,o,a,{dataURLOptions:u})})()}reset(){var e;this.pendingCanvasMutations.clear(),this.restoreHandlers.forEach(n=>{try{n()}catch{}}),this.restoreHandlers=[],this.windowsSet=new WeakSet,this.windows=[],this.shadowDoms=new Set,(e=this.worker)==null||e.terminate(),this.worker=null,this.snapshotInProgressMap=new Map}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}addWindow(e){const{sampling:n="all",blockClass:r,blockSelector:i,unblockSelector:s,recordCanvas:o,enableManualSnapshot:a}=this.options;if(!this.windowsSet.has(e)){if(a){this.windowsSet.add(e),this.windows.push(new WeakRef(e));return}vg(()=>{if(o&&n==="all"&&this.initCanvasMutationObserver(e,r,i,s),o&&typeof n=="number"){const c=pk(e,r,i,s,!0);this.restoreHandlers.push(()=>{c()})}})(),this.windowsSet.add(e),this.windows.push(new WeakRef(e))}}addShadowRoot(e){this.shadowDoms.add(new WeakRef(e))}resetShadowRoots(){this.shadowDoms=new Set}initFPSWorker(){const e=new Worker(wB());return e.onmessage=n=>{const r=n.data,{id:i}=r;if(this.snapshotInProgressMap.set(i,!1),!("base64"in r))return;const{base64:s,type:o,width:a,height:c}=r;this.mutationCb({id:i,type:So["2D"],commands:[{property:"clearRect",args:[0,0,a,c]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:s}],type:o}]},0,0,a,c]}]})},e}initCanvasFPSObserver(e,n,r,i,s,o){const a=this.takeSnapshot(!1,e,n,r,i,s,o.dataURLOptions);this.restoreHandlers.push(()=>{cancelAnimationFrame(a)})}initCanvasMutationObserver(e,n,r,i){const s=pk(e,n,r,i,!1),o=vB(this.processMutation.bind(this),e,n,r,i),a=yB(this.processMutation.bind(this),e,n,r,i,this.mirror);this.restoreHandlers.push(()=>{s(),o(),a()})}snapshot(e){const{options:n}=this,r=this.takeSnapshot(!0,n.sampling==="all"?2:n.sampling||2,n.blockClass,n.blockSelector,n.unblockSelector,n.maxCanvasSize,n.dataURLOptions,e);this.restoreHandlers.push(()=>{cancelAnimationFrame(r)})}takeSnapshot(e,n,r,i,s,o,a,c){const u=1e3/n;let d;const l=f=>{if(f)return[f];const p=[],g=v=>{v.querySelectorAll("canvas").forEach(m=>{Yl(m,r,i,s)||p.push(m)})};for(const v of this.windows){const m=v.deref();let _;try{_=m&&m.document}catch{}_&&g(_)}for(const v of this.shadowDoms){const m=v.deref();m&&g(m)}return p},h=f=>{if(this.windows.length){if(this.lastSnapshotTime&&f-this.lastSnapshotTime<u){d=ds(h);return}this.lastSnapshotTime=f,l(c).forEach(p=>{var v;if(!this.mirror.hasNode(p))return;const g=this.mirror.getId(p);if(!this.snapshotInProgressMap.get(g)&&!(!p.width||!p.height)){if(this.snapshotInProgressMap.set(g,!0),!e&&["webgl","webgl2"].includes(p.__context)){const m=p.getContext(p.__context);((v=m==null?void 0:m.getContextAttributes())==null?void 0:v.preserveDrawingBuffer)===!1&&m.clear(m.COLOR_BUFFER_BIT)}createImageBitmap(p).then(m=>{var _;(_=this.worker)==null||_.postMessage({id:g,bitmap:m,width:p.width,height:p.height,dataURLOptions:a,maxCanvasSize:o},[m])}).catch(m=>{vg(()=>{throw m})()})}}),e||(d=ds(h))}};return d=ds(h),d}startPendingCanvasMutationFlusher(){ds(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=n=>{this.rafStamps.latestId=n,ds(e)};ds(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,n)=>{const r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),ds(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,n){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(e);if(!r||n===-1)return;const i=r.map(o=>{const{type:a,...c}=o;return c}),{type:s}=r[0];this.mutationCb({id:n,type:s,commands:i}),this.pendingCanvasMutations.delete(e)}}try{if(Array.from([1],t=>t*2)[0]!==2){const t=document.createElement("iframe");document.body.appendChild(t),Array.from=((nT=t.contentWindow)==null?void 0:nT.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}lB();var mk;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(mk||(mk={}));const vk={low:{sampling:{canvas:1},dataURLOptions:{type:"image/webp",quality:.25}},medium:{sampling:{canvas:2},dataURLOptions:{type:"image/webp",quality:.4}},high:{sampling:{canvas:4},dataURLOptions:{type:"image/webp",quality:.5}}},EB="ReplayCanvas",Ql=1280,kB=(t={})=>{const[e,n]=t.maxCanvasSize||[],r={quality:t.quality||"medium",enableManualSnapshot:t.enableManualSnapshot,maxCanvasSize:[e?Math.min(e,Ql):Ql,n?Math.min(n,Ql):Ql]};let i;const s=new Promise(o=>i=o);return{name:EB,getOptions(){const{quality:o,enableManualSnapshot:a,maxCanvasSize:c}=r;return{enableManualSnapshot:a,recordCanvas:!0,getCanvasManager:u=>{const d=new SB({...u,enableManualSnapshot:a,maxCanvasSize:c,errorHandler:l=>{try{typeof l=="object"&&(l.__rrweb__=!0)}catch{}}});return i(d),d},...vk[o]||vk.medium}},async snapshot(o){(await s).snapshot(o)}}},On=ke,qe=On.document,lc=On.navigator,_k="Report a Bug",CB="Cancel",TB="Send Bug Report",IB="Confirm",xB="Report a Bug",RB="your.email@example.org",AB="Email",PB="What's the bug? What did you expect?",MB="Description",OB="Your Name",LB="Name",DB="Thank you for your report!",NB="(required)",FB="Add a screenshot",$B="Remove screenshot",UB="widget",BB="api",jB=5e3,yk=(t,e={includeReplay:!0})=>{if(!t.message)throw new Error("Unable to submit feedback with empty message");const n=oe();if(!n)throw new Error("No client setup, cannot send feedback.");t.tags&&Object.keys(t.tags).length&&Be().setTags(t.tags);const r=Fw({source:BB,url:Qi(),...t},e);return new Promise((i,s)=>{const o=setTimeout(()=>s("Unable to determine if Feedback was correctly sent."),5e3),a=n.on("afterSendEvent",(c,u)=>{if(c.event_id===r)return clearTimeout(o),a(),u&&typeof u.statusCode=="number"&&u.statusCode>=200&&u.statusCode<300?i(r):u&&typeof u.statusCode=="number"&&u.statusCode===0?s("Unable to send Feedback. This is because of network issues, or because you are using an ad-blocker."):u&&typeof u.statusCode=="number"&&u.statusCode===403?s("Unable to send Feedback. This could be because this domain is not in your list of allowed domains."):s("Unable to send Feedback. This could be because of network issues, or because you are using an ad-blocker")})})},ed=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function HB(){return!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(lc.userAgent)||/Macintosh/i.test(lc.userAgent)&&lc.maxTouchPoints&&lc.maxTouchPoints>1||!isSecureContext)}function td(t,e){return{...t,...e,tags:{...t.tags,...e.tags},onFormOpen:()=>{var n,r;(n=e.onFormOpen)==null||n.call(e),(r=t.onFormOpen)==null||r.call(t)},onFormClose:()=>{var n,r;(n=e.onFormClose)==null||n.call(e),(r=t.onFormClose)==null||r.call(t)},onSubmitSuccess:n=>{var r,i;(r=e.onSubmitSuccess)==null||r.call(e,n),(i=t.onSubmitSuccess)==null||i.call(t,n)},onSubmitError:n=>{var r,i;(r=e.onSubmitError)==null||r.call(e,n),(i=t.onSubmitError)==null||i.call(t,n)},onFormSubmitted:()=>{var n,r;(n=e.onFormSubmitted)==null||n.call(e),(r=t.onFormSubmitted)==null||r.call(t)},themeDark:{...t.themeDark,...e.themeDark},themeLight:{...t.themeLight,...e.themeLight}}}function qB(t){const e=qe.createElement("style");return e.textContent=`
.widget__actor {
position: fixed;
z-index: var(--z-index);
margin: var(--page-margin);
inset: var(--actor-inset);
display: flex;
align-items: center;
gap: 8px;
padding: 16px;
font-family: inherit;
font-size: var(--font-size);
font-weight: 600;
line-height: 1.14em;
text-decoration: none;
background: var(--actor-background, var(--background));
border-radius: var(--actor-border-radius, 1.7em/50%);
border: var(--actor-border, var(--border));
box-shadow: var(--actor-box-shadow, var(--box-shadow));
color: var(--actor-color, var(--foreground));
fill: var(--actor-color, var(--foreground));
cursor: pointer;
opacity: 1;
transition: transform 0.2s ease-in-out;
transform: translate(0, 0) scale(1);
}
.widget__actor[aria-hidden="true"] {
opacity: 0;
pointer-events: none;
visibility: hidden;
transform: translate(0, 16px) scale(0.98);
}
.widget__actor:hover {
background: var(--actor-hover-background, var(--background));
filter: var(--interactive-filter);
}
.widget__actor svg {
width: 1.14em;
height: 1.14em;
}
@media (max-width: 600px) {
.widget__actor span {
display: none;
}
}
`,t&&e.setAttribute("nonce",t),e}function wn(t,e){return Object.entries(e).forEach(([n,r])=>{t.setAttributeNS(null,n,r)}),t}const ko=20,WB="http://www.w3.org/2000/svg";function zB(){const t=a=>On.document.createElementNS(WB,a),e=wn(t("svg"),{width:`${ko}`,height:`${ko}`,viewBox:`0 0 ${ko} ${ko}`,fill:"var(--actor-color, var(--foreground))"}),n=wn(t("g"),{clipPath:"url(#clip0_57_80)"}),r=wn(t("path"),{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.6622 15H12.3997C12.2129 14.9959 12.031 14.9396 11.8747 14.8375L8.04965 12.2H7.49956V19.1C7.4875 19.3348 7.3888 19.5568 7.22256 19.723C7.05632 19.8892 6.83435 19.9879 6.59956 20H2.04956C1.80193 19.9968 1.56535 19.8969 1.39023 19.7218C1.21511 19.5467 1.1153 19.3101 1.11206 19.0625V12.2H0.949652C0.824431 12.2017 0.700142 12.1783 0.584123 12.1311C0.468104 12.084 0.362708 12.014 0.274155 11.9255C0.185602 11.8369 0.115689 11.7315 0.0685419 11.6155C0.0213952 11.4995 -0.00202913 11.3752 -0.00034808 11.25V3.75C-0.00900498 3.62067 0.0092504 3.49095 0.0532651 3.36904C0.0972798 3.24712 0.166097 3.13566 0.255372 3.04168C0.344646 2.94771 0.452437 2.87327 0.571937 2.82307C0.691437 2.77286 0.82005 2.74798 0.949652 2.75H8.04965L11.8747 0.1625C12.031 0.0603649 12.2129 0.00407221 12.3997 0H15.6622C15.9098 0.00323746 16.1464 0.103049 16.3215 0.278167C16.4966 0.453286 16.5964 0.689866 16.5997 0.9375V3.25269C17.3969 3.42959 18.1345 3.83026 18.7211 4.41679C19.5322 5.22788 19.9878 6.32796 19.9878 7.47502C19.9878 8.62209 19.5322 9.72217 18.7211 10.5333C18.1345 11.1198 17.3969 11.5205 16.5997 11.6974V14.0125C16.6047 14.1393 16.5842 14.2659 16.5395 14.3847C16.4948 14.5035 16.4268 14.6121 16.3394 14.7042C16.252 14.7962 16.147 14.8698 16.0307 14.9206C15.9144 14.9714 15.7891 14.9984 15.6622 15ZM1.89695 10.325H1.88715V4.625H8.33715C8.52423 4.62301 8.70666 4.56654 8.86215 4.4625L12.6872 1.875H14.7247V13.125H12.6872L8.86215 10.4875C8.70666 10.3835 8.52423 10.327 8.33715 10.325H2.20217C2.15205 10.3167 2.10102 10.3125 2.04956 10.3125C1.9981 10.3125 1.94708 10.3167 1.89695 10.325ZM2.98706 12.2V18.1625H5.66206V12.2H2.98706ZM16.5997 9.93612V5.01393C16.6536 5.02355 16.7072 5.03495 16.7605 5.04814C17.1202 5.13709 17.4556 5.30487 17.7425 5.53934C18.0293 5.77381 18.2605 6.06912 18.4192 6.40389C18.578 6.73866 18.6603 7.10452 18.6603 7.47502C18.6603 7.84552 18.578 8.21139 18.4192 8.54616C18.2605 8.88093 18.0293 9.17624 17.7425 9.41071C17.4556 9.64518 17.1202 9.81296 16.7605 9.90191C16.7072 9.91509 16.6536 9.9265 16.5997 9.93612Z"});e.appendChild(n).appendChild(r);const i=t("defs"),s=wn(t("clipPath"),{id:"clip0_57_80"}),o=wn(t("rect"),{width:`${ko}`,height:`${ko}`,fill:"white"});return s.appendChild(o),i.appendChild(s),e.appendChild(i).appendChild(s).appendChild(o),e}function VB({triggerLabel:t,triggerAriaLabel:e,shadow:n,styleNonce:r}){const i=qe.createElement("button");if(i.type="button",i.className="widget__actor",i.ariaHidden="false",i.ariaLabel=e||t||_k,i.appendChild(zB()),t){const o=qe.createElement("span");o.appendChild(qe.createTextNode(t)),i.appendChild(o)}const s=qB(r);return{el:i,appendToDom(){n.appendChild(s),n.appendChild(i)},removeFromDom(){n.removeChild(i),n.removeChild(s)},show(){i.ariaHidden="false"},hide(){i.ariaHidden="true"}}}const bk="rgba(88, 74, 192, 1)",KB={foreground:"#2b2233",background:"#ffffff",accentForeground:"white",accentBackground:bk,successColor:"#268d75",errorColor:"#df3338",border:"1.5px solid rgba(41, 35, 47, 0.13)",boxShadow:"0px 4px 24px 0px rgba(43, 34, 51, 0.12)",outline:"1px auto var(--accent-background)",interactiveFilter:"brightness(95%)"},wk={foreground:"#ebe6ef",background:"#29232f",accentForeground:"white",accentBackground:bk,successColor:"#2da98c",errorColor:"#f55459",border:"1.5px solid rgba(235, 230, 239, 0.15)",boxShadow:"0px 4px 24px 0px rgba(43, 34, 51, 0.12)",outline:"1px auto var(--accent-background)",interactiveFilter:"brightness(150%)"};function Sk(t){return`
--foreground: ${t.foreground};
--background: ${t.background};
--accent-foreground: ${t.accentForeground};
--accent-background: ${t.accentBackground};
--success-color: ${t.successColor};
--error-color: ${t.errorColor};
--border: ${t.border};
--box-shadow: ${t.boxShadow};
--outline: ${t.outline};
--interactive-filter: ${t.interactiveFilter};
`}function GB({colorScheme:t,themeDark:e,themeLight:n,styleNonce:r}){const i=qe.createElement("style");return i.textContent=`
:host {
--font-family: system-ui, 'Helvetica Neue', Arial, sans-serif;
--font-size: 14px;
--z-index: 100000;
--page-margin: 16px;
--inset: auto 0 0 auto;
--actor-inset: var(--inset);
font-family: var(--font-family);
font-size: var(--font-size);
${t!=="system"?"color-scheme: only light;":""}
${Sk(t==="dark"?{...wk,...e}:{...KB,...n})}
}
${t==="system"?`
@media (prefers-color-scheme: dark) {
:host {
${Sk({...wk,...e})}
}
}`:""}
}
`,r&&i.setAttribute("nonce",r),i}const Ek=({lazyLoadIntegration:t,getModalIntegration:e,getScreenshotIntegration:n})=>({id:i="sentry-feedback",autoInject:s=!0,showBranding:o=!0,isEmailRequired:a=!1,isNameRequired:c=!1,showEmail:u=!0,showName:d=!0,enableScreenshot:l=!0,useSentryUser:h={email:"email",name:"username"},_experiments:f={},tags:p,styleNonce:g,scriptNonce:v,colorScheme:m="system",themeLight:_={},themeDark:w={},addScreenshotButtonLabel:T=FB,cancelButtonLabel:C=CB,confirmButtonLabel:E=IB,emailLabel:I=AB,emailPlaceholder:y=RB,formTitle:b=xB,isRequiredLabel:k=NB,messageLabel:x=MB,messagePlaceholder:R=PB,nameLabel:F=LB,namePlaceholder:z=OB,removeScreenshotButtonLabel:J=$B,submitButtonLabel:U=TB,successMessageText:q=DB,triggerLabel:V=_k,triggerAriaLabel:j="",onFormOpen:S,onFormClose:P,onSubmitSuccess:N,onSubmitError:O,onFormSubmitted:W}={})=>{const te={id:i,autoInject:s,showBranding:o,isEmailRequired:a,isNameRequired:c,showEmail:u,showName:d,enableScreenshot:l,useSentryUser:h,tags:p,styleNonce:g,scriptNonce:v,colorScheme:m,themeDark:w,themeLight:_,triggerLabel:V,triggerAriaLabel:j,cancelButtonLabel:C,submitButtonLabel:U,confirmButtonLabel:E,formTitle:b,emailLabel:I,emailPlaceholder:y,messageLabel:x,messagePlaceholder:R,nameLabel:F,namePlaceholder:z,successMessageText:q,isRequiredLabel:k,addScreenshotButtonLabel:T,removeScreenshotButtonLabel:J,onFormClose:P,onFormOpen:S,onSubmitError:O,onSubmitSuccess:N,onFormSubmitted:W,_experiments:f};let K=null,Ue=[];const ee=ue=>{if(!K){const Ce=qe.createElement("div");Ce.id=String(ue.id),qe.body.appendChild(Ce),K=Ce.attachShadow({mode:"open"}),K.appendChild(GB(ue))}return K},Se=async ue=>{const Ce=ue.enableScreenshot&&HB();let pe,fe;try{pe=(e?e():await t("feedbackModalIntegration",v))(),rp(pe)}catch{throw ed&&L.error("[Feedback] Error when trying to load feedback integrations. Try using `feedbackSyncIntegration` in your `Sentry.init`."),new Error("[Feedback] Missing feedback modal integration!")}try{const We=Ce?n?n():await t("feedbackScreenshotIntegration",v):void 0;We&&(fe=We(),rp(fe))}catch{ed&&L.error("[Feedback] Missing feedback screenshot integration. Proceeding without screenshots.")}const ne=pe.createDialog({options:{...ue,onFormClose:()=>{var We;ne==null||ne.close(),(We=ue.onFormClose)==null||We.call(ue)},onFormSubmitted:()=>{var We;ne==null||ne.close(),(We=ue.onFormSubmitted)==null||We.call(ue)}},screenshotIntegration:fe,sendFeedback:yk,shadow:ee(ue)});return ne},be=(ue,Ce={})=>{const pe=td(te,Ce),fe=typeof ue=="string"?qe.querySelector(ue):typeof ue.addEventListener=="function"?ue:null;if(!fe)throw ed&&L.error("[Feedback] Unable to attach to target element"),new Error("Unable to attach to target element");let ne=null;const We=async()=>{ne||(ne=await Se({...pe,onFormSubmitted:()=>{var ze;ne==null||ne.removeFromDom(),(ze=pe.onFormSubmitted)==null||ze.call(pe)}})),ne.appendToDom(),ne.open()};fe.addEventListener("click",We);const ge=()=>{Ue=Ue.filter(ze=>ze!==ge),ne==null||ne.removeFromDom(),ne=null,fe.removeEventListener("click",We)};return Ue.push(ge),ge},le=(ue={})=>{const Ce=td(te,ue),pe=ee(Ce),fe=VB({triggerLabel:Ce.triggerLabel,triggerAriaLabel:Ce.triggerAriaLabel,shadow:pe,styleNonce:g});return be(fe.el,{...Ce,onFormOpen(){fe.hide()},onFormClose(){fe.show()},onFormSubmitted(){fe.show()}}),fe};return{name:"Feedback",setupOnce(){!gp()||!te.autoInject||(qe.readyState==="loading"?qe.addEventListener("DOMContentLoaded",()=>le().appendToDom()):le().appendToDom())},attachTo:be,createWidget(ue={}){const Ce=le(td(te,ue));return Ce.appendToDom(),Ce},async createForm(ue={}){return Se(td(te,ue))},remove(){var ue;K&&((ue=K.parentElement)==null||ue.remove(),K=null),Ue.forEach(Ce=>Ce()),Ue=[]}}};function YB(){const t=oe();return t==null?void 0:t.getIntegrationByName("Feedback")}var nd,Ze,kk,fs,Ck,Tk,_g,dc={},yg=[],ZB=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,bg=Array.isArray;function ki(t,e){for(var n in e)t[n]=e[n];return t}function Ik(t){var e=t.parentNode;e&&e.removeChild(t)}function Le(t,e,n){var r,i,s,o={};for(s in e)s=="key"?r=e[s]:s=="ref"?i=e[s]:o[s]=e[s];if(arguments.length>2&&(o.children=arguments.length>3?nd.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(s in t.defaultProps)o[s]===void 0&&(o[s]=t.defaultProps[s]);return rd(t,o,r,i,null)}function rd(t,e,n,r,i){var s={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i??++kk,__i:-1,__u:0};return i==null&&Ze.vnode!=null&&Ze.vnode(s),s}function fc(t){return t.children}function id(t,e){this.props=t,this.context=e}function Co(t,e){if(e==null)return t.__?Co(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?Co(t):null}function XB(t,e,n){var r,i=t.__v,s=i.__e,o=t.__P;if(o)return(r=ki({},i)).__v=i.__v+1,Ze.vnode&&Ze.vnode(r),wg(o,r,i,t.__n,o.ownerSVGElement!==void 0,32&i.__u?[s]:null,e,s??Co(i),!!(32&i.__u),n),r.__.__k[r.__i]=r,r.__d=void 0,r.__e!=s&&xk(r),r}function xk(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return xk(t)}}function Rk(t){(!t.__d&&(t.__d=!0)&&fs.push(t)&&!sd.__r++||Ck!==Ze.debounceRendering)&&((Ck=Ze.debounceRendering)||Tk)(sd)}function sd(){var t,e,n,r=[],i=[];for(fs.sort(_g);t=fs.shift();)t.__d&&(n=fs.length,e=XB(t,r,i)||e,n===0||fs.length>n?(Sg(r,e,i),i.length=r.length=0,e=void 0,fs.sort(_g)):e&&Ze.__c&&Ze.__c(e,yg));e&&Sg(r,e,i),sd.__r=0}function Ak(t,e,n,r,i,s,o,a,c,u,d){var l,h,f,p,g,v=r&&r.__k||yg,m=e.length;for(n.__d=c,JB(n,e,v),c=n.__d,l=0;l<m;l++)(f=n.__k[l])!=null&&typeof f!="boolean"&&typeof f!="function"&&(h=f.__i===-1?dc:v[f.__i]||dc,f.__i=l,wg(t,f,h,i,s,o,a,c,u,d),p=f.__e,f.ref&&h.ref!=f.ref&&(h.ref&&Eg(h.ref,null,f),d.push(f.ref,f.__c||p,f)),g==null&&p!=null&&(g=p),65536&f.__u||h.__k===f.__k?c=Pk(f,c,t):typeof f.type=="function"&&f.__d!==void 0?c=f.__d:p&&(c=p.nextSibling),f.__d=void 0,f.__u&=-196609);n.__d=c,n.__e=g}function JB(t,e,n){var r,i,s,o,a,c=e.length,u=n.length,d=u,l=0;for(t.__k=[],r=0;r<c;r++)(i=t.__k[r]=(i=e[r])==null||typeof i=="boolean"||typeof i=="function"?null:typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?rd(null,i,null,null,i):bg(i)?rd(fc,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?rd(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)!=null?(i.__=t,i.__b=t.__b+1,a=QB(i,n,o=r+l,d),i.__i=a,s=null,a!==-1&&(d--,(s=n[a])&&(s.__u|=131072)),s==null||s.__v===null?(a==-1&&l--,typeof i.type!="function"&&(i.__u|=65536)):a!==o&&(a===o+1?l++:a>o?d>c-o?l+=a-o:l--:l=a<o&&a==o-1?a-o:0,a!==r+l&&(i.__u|=65536))):(s=n[r])&&s.key==null&&s.__e&&(s.__e==t.__d&&(t.__d=Co(s)),kg(s,s,!1),n[r]=null,d--);if(d)for(r=0;r<u;r++)(s=n[r])!=null&&(131072&s.__u)==0&&(s.__e==t.__d&&(t.__d=Co(s)),kg(s,s))}function Pk(t,e,n){var r,i;if(typeof t.type=="function"){for(r=t.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=t,e=Pk(r[i],e,n));return e}t.__e!=e&&(n.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType===8);return e}function QB(t,e,n,r){var i=t.key,s=t.type,o=n-1,a=n+1,c=e[n];if(c===null||c&&i==c.key&&s===c.type)return n;if(r>(c!=null&&(131072&c.__u)==0?1:0))for(;o>=0||a<e.length;){if(o>=0){if((c=e[o])&&(131072&c.__u)==0&&i==c.key&&s===c.type)return o;o--}if(a<e.length){if((c=e[a])&&(131072&c.__u)==0&&i==c.key&&s===c.type)return a;a++}}return-1}function Mk(t,e,n){e[0]==="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||ZB.test(e)?n:n+"px"}function od(t,e,n,r,i){var s;e:if(e==="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||Mk(t.style,e,"");if(n)for(e in n)r&&n[e]===r[e]||Mk(t.style,e,n[e])}else if(e[0]==="o"&&e[1]==="n")s=e!==(e=e.replace(/(PointerCapture)$|Capture$/i,"$1")),e=e.toLowerCase()in t?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+s]=n,n?r?n.u=r.u:(n.u=Date.now(),t.addEventListener(e,s?Lk:Ok,s)):t.removeEventListener(e,s?Lk:Ok,s);else{if(i)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="width"&&e!=="height"&&e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e!=="rowSpan"&&e!=="colSpan"&&e!=="role"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!=="-"?t.removeAttribute(e):t.setAttribute(e,n))}}function Ok(t){if(this.l){var e=this.l[t.type+!1];if(t.t){if(t.t<=e.u)return}else t.t=Date.now();return e(Ze.event?Ze.event(t):t)}}function Lk(t){if(this.l)return this.l[t.type+!0](Ze.event?Ze.event(t):t)}function wg(t,e,n,r,i,s,o,a,c,u){var d,l,h,f,p,g,v,m,_,w,T,C,E,I,y,b=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),s=[a=e.__e=n.__e]),(d=Ze.__b)&&d(e);e:if(typeof b=="function")try{if(m=e.props,_=(d=b.contextType)&&r[d.__c],w=d?_?_.props.value:d.__:r,n.__c?v=(l=e.__c=n.__c).__=l.__E:("prototype"in b&&b.prototype.render?e.__c=l=new b(m,w):(e.__c=l=new id(m,w),l.constructor=b,l.render=t6),_&&_.sub(l),l.props=m,l.state||(l.state={}),l.context=w,l.__n=r,h=l.__d=!0,l.__h=[],l._sb=[]),l.__s==null&&(l.__s=l.state),b.getDerivedStateFromProps!=null&&(l.__s==l.state&&(l.__s=ki({},l.__s)),ki(l.__s,b.getDerivedStateFromProps(m,l.__s))),f=l.props,p=l.state,l.__v=e,h)b.getDerivedStateFromProps==null&&l.componentWillMount!=null&&l.componentWillMount(),l.componentDidMount!=null&&l.__h.push(l.componentDidMount);else{if(b.getDerivedStateFromProps==null&&m!==f&&l.componentWillReceiveProps!=null&&l.componentWillReceiveProps(m,w),!l.__e&&(l.shouldComponentUpdate!=null&&l.shouldComponentUpdate(m,l.__s,w)===!1||e.__v===n.__v)){for(e.__v!==n.__v&&(l.props=m,l.state=l.__s,l.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.forEach(function(k){k&&(k.__=e)}),T=0;T<l._sb.length;T++)l.__h.push(l._sb[T]);l._sb=[],l.__h.length&&o.push(l);break e}l.componentWillUpdate!=null&&l.componentWillUpdate(m,l.__s,w),l.componentDidUpdate!=null&&l.__h.push(function(){l.componentDidUpdate(f,p,g)})}if(l.context=w,l.props=m,l.__P=t,l.__e=!1,C=Ze.__r,E=0,"prototype"in b&&b.prototype.render){for(l.state=l.__s,l.__d=!1,C&&C(e),d=l.render(l.props,l.state,l.context),I=0;I<l._sb.length;I++)l.__h.push(l._sb[I]);l._sb=[]}else do l.__d=!1,C&&C(e),d=l.render(l.props,l.state,l.context),l.state=l.__s;while(l.__d&&++E<25);l.state=l.__s,l.getChildContext!=null&&(r=ki(ki({},r),l.getChildContext())),h||l.getSnapshotBeforeUpdate==null||(g=l.getSnapshotBeforeUpdate(f,p)),Ak(t,bg(y=d!=null&&d.type===fc&&d.key==null?d.props.children:d)?y:[y],e,n,r,i,s,o,a,c,u),l.base=e.__e,e.__u&=-161,l.__h.length&&o.push(l),v&&(l.__E=l.__=null)}catch(k){e.__v=null,c||s!=null?(e.__e=a,e.__u|=c?160:32,s[s.indexOf(a)]=null):(e.__e=n.__e,e.__k=n.__k),Ze.__e(k,e,n)}else s==null&&e.__v===n.__v?(e.__k=n.__k,e.__e=n.__e):e.__e=e6(n.__e,e,n,r,i,s,o,c,u);(d=Ze.diffed)&&d(e)}function Sg(t,e,n){for(var r=0;r<n.length;r++)Eg(n[r],n[++r],n[++r]);Ze.__c&&Ze.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(s){s.call(i)})}catch(s){Ze.__e(s,i.__v)}})}function e6(t,e,n,r,i,s,o,a,c){var u,d,l,h,f,p,g,v=n.props,m=e.props,_=e.type;if(_==="svg"&&(i=!0),s!=null){for(u=0;u<s.length;u++)if((f=s[u])&&"setAttribute"in f==!!_&&(_?f.localName===_:f.nodeType===3)){t=f,s[u]=null;break}}if(t==null){if(_===null)return document.createTextNode(m);t=i?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,m.is&&m),s=null,a=!1}if(_===null)v===m||a&&t.data===m||(t.data=m);else{if(s=s&&nd.call(t.childNodes),v=n.props||dc,!a&&s!=null)for(v={},u=0;u<t.attributes.length;u++)v[(f=t.attributes[u]).name]=f.value;for(u in v)f=v[u],u=="children"||(u=="dangerouslySetInnerHTML"?l=f:u==="key"||u in m||od(t,u,null,f,i));for(u in m)f=m[u],u=="children"?h=f:u=="dangerouslySetInnerHTML"?d=f:u=="value"?p=f:u=="checked"?g=f:u==="key"||a&&typeof f!="function"||v[u]===f||od(t,u,f,v[u],i);if(d)a||l&&(d.__html===l.__html||d.__html===t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(l&&(t.innerHTML=""),Ak(t,bg(h)?h:[h],e,n,r,i&&_!=="foreignObject",s,o,s?s[0]:n.__k&&Co(n,0),a,c),s!=null)for(u=s.length;u--;)s[u]!=null&&Ik(s[u]);a||(u="value",p!==void 0&&(p!==t[u]||_==="progress"&&!p||_==="option"&&p!==v[u])&&od(t,u,p,v[u],!1),u="checked",g!==void 0&&g!==t[u]&&od(t,u,g,v[u],!1))}return t}function Eg(t,e,n){try{typeof t=="function"?t(e):t.current=e}catch(r){Ze.__e(r,n)}}function kg(t,e,n){var r,i;if(Ze.unmount&&Ze.unmount(t),(r=t.ref)&&(r.current&&r.current!==t.__e||Eg(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){Ze.__e(s,e)}r.base=r.__P=null,t.__c=void 0}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&kg(r[i],e,n||typeof t.type!="function");n||t.__e==null||Ik(t.__e),t.__=t.__e=t.__d=void 0}function t6(t,e,n){return this.constructor(t,n)}function n6(t,e,n){var r,i,s,o;Ze.__&&Ze.__(t,e),i=(r=!1)?null:e.__k,s=[],o=[],wg(e,t=e.__k=Le(fc,null,[t]),i||dc,dc,e.ownerSVGElement!==void 0,i?null:e.firstChild?nd.call(e.childNodes):null,s,i?i.__e:e.firstChild,r,o),t.__d=void 0,Sg(s,t,o)}nd=yg.slice,Ze={__e:function(t,e,n,r){for(var i,s,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(t)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,r||{}),o=i.__d),o)return i.__E=i}catch(a){t=a}throw t}},kk=0,id.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=ki({},this.state),typeof t=="function"&&(t=t(ki({},n),this.props)),t&&ki(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),Rk(this))},id.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Rk(this))},id.prototype.render=fc,fs=[],Tk=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_g=function(t,e){return t.__v.__b-e.__v.__b},sd.__r=0;var Vr,Xe,Cg,Dk,To=0,Nk=[],ad=[],at=Ze,Fk=at.__b,$k=at.__r,Uk=at.diffed,Bk=at.__c,jk=at.unmount,Hk=at.__;function hs(t,e){at.__h&&at.__h(Xe,t,To||e),To=0;var n=Xe.__H||(Xe.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({__V:ad}),n.__[t]}function ps(t){return To=1,qk(Vk,t)}function qk(t,e,n){var r=hs(Vr++,2);if(r.t=t,!r.__c&&(r.__=[n?n(e):Vk(void 0,e),function(a){var c=r.__N?r.__N[0]:r.__[0],u=r.t(c,a);c!==u&&(r.__N=[u,r.__[1]],r.__c.setState({}))}],r.__c=Xe,!Xe.u)){var i=function(a,c,u){if(!r.__c.__H)return!0;var d=r.__c.__H.__.filter(function(h){return!!h.__c});if(d.every(function(h){return!h.__N}))return!s||s.call(this,a,c,u);var l=!1;return d.forEach(function(h){if(h.__N){var f=h.__[0];h.__=h.__N,h.__N=void 0,f!==h.__[0]&&(l=!0)}}),!(!l&&r.__c.props===a)&&(!s||s.call(this,a,c,u))};Xe.u=!0;var s=Xe.shouldComponentUpdate,o=Xe.componentWillUpdate;Xe.componentWillUpdate=function(a,c,u){if(this.__e){var d=s;s=void 0,i(a,c,u),s=d}o&&o.call(this,a,c,u)},Xe.shouldComponentUpdate=i}return r.__N||r.__}function r6(t,e){var n=hs(Vr++,3);!at.__s&&Ig(n.__H,e)&&(n.__=t,n.i=e,Xe.__H.__h.push(n))}function Wk(t,e){var n=hs(Vr++,4);!at.__s&&Ig(n.__H,e)&&(n.__=t,n.i=e,Xe.__h.push(n))}function i6(t){return To=5,hc(function(){return{current:t}},[])}function s6(t,e,n){To=6,Wk(function(){return typeof t=="function"?(t(e()),function(){return t(null)}):t?(t.current=e(),function(){return t.current=null}):void 0},n==null?n:n.concat(t))}function hc(t,e){var n=hs(Vr++,7);return Ig(n.__H,e)?(n.__V=t(),n.i=e,n.__h=t,n.__V):n.__}function Io(t,e){return To=8,hc(function(){return t},e)}function o6(t){var e=Xe.context[t.__c],n=hs(Vr++,9);return n.c=t,e?(n.__==null&&(n.__=!0,e.sub(Xe)),e.props.value):t.__}function a6(t,e){at.useDebugValue&&at.useDebugValue(e?e(t):t)}function c6(t){var e=hs(Vr++,10),n=ps();return e.__=t,Xe.componentDidCatch||(Xe.componentDidCatch=function(r,i){e.__&&e.__(r,i),n[1](r)}),[n[0],function(){n[1](void 0)}]}function u6(){var t=hs(Vr++,11);if(!t.__){for(var e=Xe.__v;e!==null&&!e.__m&&e.__!==null;)e=e.__;var n=e.__m||(e.__m=[0,0]);t.__="P"+n[0]+"-"+n[1]++}return t.__}function l6(){for(var t;t=Nk.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(cd),t.__H.__h.forEach(Tg),t.__H.__h=[]}catch(e){t.__H.__h=[],at.__e(e,t.__v)}}at.__b=function(t){Xe=null,Fk&&Fk(t)},at.__=function(t,e){e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Hk&&Hk(t,e)},at.__r=function(t){$k&&$k(t),Vr=0;var e=(Xe=t.__c).__H;e&&(Cg===Xe?(e.__h=[],Xe.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=ad,n.__N=n.i=void 0})):(e.__h.forEach(cd),e.__h.forEach(Tg),e.__h=[],Vr=0)),Cg=Xe},at.diffed=function(t){Uk&&Uk(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Nk.push(e)!==1&&Dk===at.requestAnimationFrame||((Dk=at.requestAnimationFrame)||d6)(l6)),e.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==ad&&(n.__=n.__V),n.i=void 0,n.__V=ad})),Cg=Xe=null},at.__c=function(t,e){e.some(function(n){try{n.__h.forEach(cd),n.__h=n.__h.filter(function(r){return!r.__||Tg(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],at.__e(r,n.__v)}}),Bk&&Bk(t,e)},at.unmount=function(t){jk&&jk(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{cd(r)}catch(i){e=i}}),n.__H=void 0,e&&at.__e(e,n.__v))};var zk=typeof requestAnimationFrame=="function";function d6(t){var e,n=function(){clearTimeout(r),zk&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,100);zk&&(e=requestAnimationFrame(n))}function cd(t){var e=Xe,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),Xe=e}function Tg(t){var e=Xe;t.__c=t.__(),Xe=e}function Ig(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}function Vk(t,e){return typeof e=="function"?e(t):e}const f6=Object.defineProperty({__proto__:null,useCallback:Io,useContext:o6,useDebugValue:a6,useEffect:r6,useErrorBoundary:c6,useId:u6,useImperativeHandle:s6,useLayoutEffect:Wk,useMemo:hc,useReducer:qk,useRef:i6,useState:ps},Symbol.toStringTag,{value:"Module"}),h6="http://www.w3.org/2000/svg";function p6(){const t=r=>qe.createElementNS(h6,r),e=wn(t("svg"),{width:"32",height:"30",viewBox:"0 0 72 66",fill:"inherit"}),n=wn(t("path"),{transform:"translate(11, 11)",d:"M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z"});return e.appendChild(n),e}function g6({options:t}){const e=hc(()=>({__html:p6().outerHTML}),[]);return Le("h2",{class:"dialog__header"},Le("span",{class:"dialog__title"},t.formTitle),t.showBranding?Le("a",{class:"brand-link",target:"_blank",href:"https://sentry.io/welcome/",title:"Powered by Sentry",rel:"noopener noreferrer",dangerouslySetInnerHTML:e}):null)}function m6(t,e){const n=[];return e.isNameRequired&&!t.name&&n.push(e.nameLabel),e.isEmailRequired&&!t.email&&n.push(e.emailLabel),t.message||n.push(e.messageLabel),n}function xg(t,e){const n=t.get(e);return typeof n=="string"?n.trim():""}function v6({options:t,defaultEmail:e,defaultName:n,onFormClose:r,onSubmit:i,onSubmitSuccess:s,onSubmitError:o,showEmail:a,showName:c,screenshotInput:u}){const{tags:d,addScreenshotButtonLabel:l,removeScreenshotButtonLabel:h,cancelButtonLabel:f,emailLabel:p,emailPlaceholder:g,isEmailRequired:v,isNameRequired:m,messageLabel:_,messagePlaceholder:w,nameLabel:T,namePlaceholder:C,submitButtonLabel:E,isRequiredLabel:I}=t,[y,b]=ps(!1),[k,x]=ps(null),[R,F]=ps(!1),z=u==null?void 0:u.input,[J,U]=ps(null),q=Io(S=>{U(S),F(!1)},[]),V=Io(S=>{const P=m6(S,{emailLabel:p,isEmailRequired:v,isNameRequired:m,messageLabel:_,nameLabel:T});return P.length>0?x(`Please enter in the following required fields: ${P.join(", ")}`):x(null),P.length===0},[p,v,m,_,T]),j=Io(async S=>{b(!0);try{if(S.preventDefault(),!(S.target instanceof HTMLFormElement))return;const P=new FormData(S.target),N=await(u&&R?u.value():void 0),O={name:xg(P,"name"),email:xg(P,"email"),message:xg(P,"message"),attachments:N?[N]:void 0};if(!V(O))return;try{await i({name:O.name,email:O.email,message:O.message,source:UB,tags:d},{attachments:O.attachments}),s(O)}catch(W){ed&&L.error(W),x(W),o(W)}}finally{b(!1)}},[u&&R,s,o]);return Le("form",{class:"form",onSubmit:j},z&&R?Le(z,{onError:q}):null,Le("fieldset",{class:"form__right","data-sentry-feedback":!0,disabled:y},Le("div",{class:"form__top"},k?Le("div",{class:"form__error-container"},k):null,c?Le("label",{for:"name",class:"form__label"},Le(Rg,{label:T,isRequiredLabel:I,isRequired:m}),Le("input",{class:"form__input",defaultValue:n,id:"name",name:"name",placeholder:C,required:m,type:"text"})):Le("input",{"aria-hidden":!0,value:n,name:"name",type:"hidden"}),a?Le("label",{for:"email",class:"form__label"},Le(Rg,{label:p,isRequiredLabel:I,isRequired:v}),Le("input",{class:"form__input",defaultValue:e,id:"email",name:"email",placeholder:g,required:v,type:"email"})):Le("input",{"aria-hidden":!0,value:e,name:"email",type:"hidden"}),Le("label",{for:"message",class:"form__label"},Le(Rg,{label:_,isRequiredLabel:I,isRequired:!0}),Le("textarea",{autoFocus:!0,class:"form__input form__input--textarea",id:"message",name:"message",placeholder:w,required:!0,rows:5})),z?Le("label",{for:"screenshot",class:"form__label"},Le("button",{class:"btn btn--default",disabled:y,type:"button",onClick:()=>{U(null),F(S=>!S)}},R?h:l),J?Le("div",{class:"form__error-container"},J.message):null):null),Le("div",{class:"btn-group"},Le("button",{class:"btn btn--primary",disabled:y,type:"submit"},E),Le("button",{class:"btn btn--default",disabled:y,type:"button",onClick:r},f))))}function Rg({label:t,isRequired:e,isRequiredLabel:n}){return Le("span",{class:"form__label__text"},t,e&&Le("span",{class:"form__label__text--required"},n))}const ud=16,Kk=17,_6="http://www.w3.org/2000/svg";function y6(){const t=c=>On.document.createElementNS(_6,c),e=wn(t("svg"),{width:`${ud}`,height:`${Kk}`,viewBox:`0 0 ${ud} ${Kk}`,fill:"inherit"}),n=wn(t("g"),{clipPath:"url(#clip0_57_156)"}),r=wn(t("path"),{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.55544 15.1518C4.87103 16.0308 6.41775 16.5 8 16.5C10.1217 16.5 12.1566 15.6571 13.6569 14.1569C15.1571 12.6566 16 10.6217 16 8.5C16 6.91775 15.5308 5.37103 14.6518 4.05544C13.7727 2.73985 12.5233 1.71447 11.0615 1.10897C9.59966 0.503466 7.99113 0.34504 6.43928 0.653721C4.88743 0.962403 3.46197 1.72433 2.34315 2.84315C1.22433 3.96197 0.462403 5.38743 0.153721 6.93928C-0.15496 8.49113 0.00346625 10.0997 0.608967 11.5615C1.21447 13.0233 2.23985 14.2727 3.55544 15.1518ZM4.40546 3.1204C5.46945 2.40946 6.72036 2.03 8 2.03C9.71595 2.03 11.3616 2.71166 12.575 3.92502C13.7883 5.13838 14.47 6.78405 14.47 8.5C14.47 9.77965 14.0905 11.0306 13.3796 12.0945C12.6687 13.1585 11.6582 13.9878 10.476 14.4775C9.29373 14.9672 7.99283 15.0953 6.73777 14.8457C5.48271 14.596 4.32987 13.9798 3.42502 13.075C2.52018 12.1701 1.90397 11.0173 1.65432 9.76224C1.40468 8.50718 1.5328 7.20628 2.0225 6.02404C2.5122 4.8418 3.34148 3.83133 4.40546 3.1204Z"}),i=wn(t("path"),{d:"M6.68775 12.4297C6.78586 12.4745 6.89218 12.4984 7 12.5C7.11275 12.4955 7.22315 12.4664 7.32337 12.4145C7.4236 12.3627 7.51121 12.2894 7.58 12.2L12 5.63999C12.0848 5.47724 12.1071 5.28902 12.0625 5.11098C12.0178 4.93294 11.9095 4.77744 11.7579 4.67392C11.6064 4.57041 11.4221 4.52608 11.24 4.54931C11.0579 4.57254 10.8907 4.66173 10.77 4.79999L6.88 10.57L5.13 8.56999C5.06508 8.49566 4.98613 8.43488 4.89768 8.39111C4.80922 8.34735 4.713 8.32148 4.61453 8.31498C4.51605 8.30847 4.41727 8.32147 4.32382 8.35322C4.23038 8.38497 4.14413 8.43484 4.07 8.49999C3.92511 8.63217 3.83692 8.81523 3.82387 9.01092C3.81083 9.2066 3.87393 9.39976 4 9.54999L6.43 12.24C6.50187 12.3204 6.58964 12.385 6.68775 12.4297Z"});e.appendChild(n).append(i,r);const s=t("defs"),o=wn(t("clipPath"),{id:"clip0_57_156"}),a=wn(t("rect"),{width:`${ud}`,height:`${ud}`,fill:"white",transform:"translate(0 0.5)"});return o.appendChild(a),s.appendChild(o),e.appendChild(s).appendChild(o).appendChild(a),e}function b6({open:t,onFormSubmitted:e,...n}){const r=n.options,i=hc(()=>({__html:y6().outerHTML}),[]),[s,o]=ps(null),a=Io(()=>{s&&(clearTimeout(s),o(null)),e()},[s]),c=Io(u=>{n.onSubmitSuccess(u),o(setTimeout(()=>{e(),o(null)},jB))},[e]);return Le(fc,null,s?Le("div",{class:"success__position",onClick:a},Le("div",{class:"success__content"},r.successMessageText,Le("span",{class:"success__icon",dangerouslySetInnerHTML:i}))):Le("dialog",{class:"dialog",onClick:r.onFormClose,open:t},Le("div",{class:"dialog__position"},Le("div",{class:"dialog__content",onClick:u=>{u.stopPropagation()}},Le(g6,{options:r}),Le(v6,{...n,onSubmitSuccess:c})))))}const w6=`
.dialog {
position: fixed;
z-index: var(--z-index);
margin: 0;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
height: 100vh;
width: 100vw;
color: var(--dialog-color, var(--foreground));
fill: var(--dialog-color, var(--foreground));
line-height: 1.75em;
background-color: rgba(0, 0, 0, 0.05);
border: none;
inset: 0;
opacity: 1;
transition: opacity 0.2s ease-in-out;
}
.dialog__position {
position: fixed;
z-index: var(--z-index);
inset: var(--dialog-inset);
padding: var(--page-margin);
display: flex;
max-height: calc(100vh - (2 * var(--page-margin)));
}
@media (max-width: 600px) {
.dialog__position {
inset: var(--page-margin);
padding: 0;
}
}
.dialog__position:has(.editor) {
inset: var(--page-margin);
padding: 0;
}
.dialog:not([open]) {
opacity: 0;
pointer-events: none;
visibility: hidden;
}
.dialog:not([open]) .dialog__content {
transform: translate(0, -16px) scale(0.98);
}
.dialog__content {
display: flex;
flex-direction: column;
gap: 16px;
padding: var(--dialog-padding, 24px);
max-width: 100%;
width: 100%;
max-height: 100%;
overflow: auto;
background: var(--dialog-background, var(--background));
border-radius: var(--dialog-border-radius, 20px);
border: var(--dialog-border, var(--border));
box-shadow: var(--dialog-box-shadow, var(--box-shadow));
transform: translate(0, 0) scale(1);
transition: transform 0.2s ease-in-out;
}
`,S6=`
.dialog__header {
display: flex;
gap: 4px;
justify-content: space-between;
font-weight: var(--dialog-header-weight, 600);
margin: 0;
}
.dialog__title {
align-self: center;
width: var(--form-width, 272px);
}
@media (max-width: 600px) {
.dialog__title {
width: auto;
}
}
.dialog__position:has(.editor) .dialog__title {
width: auto;
}
.brand-link {
display: inline-flex;
}
.brand-link:focus-visible {
outline: var(--outline);
}
`,E6=`
.form {
display: flex;
overflow: auto;
flex-direction: row;
gap: 16px;
flex: 1 0;
}
.form fieldset {
border: none;
margin: 0;
padding: 0;
}
.form__right {
flex: 0 0 auto;
display: flex;
overflow: auto;
flex-direction: column;
justify-content: space-between;
gap: 20px;
width: var(--form-width, 100%);
}
.dialog__position:has(.editor) .form__right {
width: var(--form-width, 272px);
}
.form__top {
display: flex;
flex-direction: column;
gap: 8px;
}
.form__error-container {
color: var(--error-color);
fill: var(--error-color);
}
.form__label {
display: flex;
flex-direction: column;
gap: 4px;
margin: 0px;
}
.form__label__text {
display: flex;
gap: 4px;
align-items: center;
}
.form__label__text--required {
font-size: 0.85em;
}
.form__input {
font-family: inherit;
line-height: inherit;
background: transparent;
box-sizing: border-box;
border: var(--input-border, var(--border));
border-radius: var(--input-border-radius, 6px);
color: var(--input-color, inherit);
fill: var(--input-color, inherit);
font-size: var(--input-font-size, inherit);
font-weight: var(--input-font-weight, 500);
padding: 6px 12px;
}
.form__input::placeholder {
opacity: 0.65;
color: var(--input-placeholder-color, inherit);
filter: var(--interactive-filter);
}
.form__input:focus-visible {
outline: var(--input-focus-outline, var(--outline));
}
.form__input--textarea {
font-family: inherit;
resize: vertical;
}
.error {
color: var(--error-color);
fill: var(--error-color);
}
`,k6=`
.btn-group {
display: grid;
gap: 8px;
}
.btn {
line-height: inherit;
border: var(--button-border, var(--border));
border-radius: var(--button-border-radius, 6px);
cursor: pointer;
font-family: inherit;
font-size: var(--button-font-size, inherit);
font-weight: var(--button-font-weight, 600);
padding: var(--button-padding, 6px 16px);
}
.btn[disabled] {
opacity: 0.6;
pointer-events: none;
}
.btn--primary {
color: var(--button-primary-color, var(--accent-foreground));
fill: var(--button-primary-color, var(--accent-foreground));
background: var(--button-primary-background, var(--accent-background));
border: var(--button-primary-border, var(--border));
border-radius: var(--button-primary-border-radius, 6px);
font-weight: var(--button-primary-font-weight, 500);
}
.btn--primary:hover {
color: var(--button-primary-hover-color, var(--accent-foreground));
fill: var(--button-primary-hover-color, var(--accent-foreground));
background: var(--button-primary-hover-background, var(--accent-background));
filter: var(--interactive-filter);
}
.btn--primary:focus-visible {
background: var(--button-primary-hover-background, var(--accent-background));
filter: var(--interactive-filter);
outline: var(--button-primary-focus-outline, var(--outline));
}
.btn--default {
color: var(--button-color, var(--foreground));
fill: var(--button-color, var(--foreground));
background: var(--button-background, var(--background));
border: var(--button-border, var(--border));
border-radius: var(--button-border-radius, 6px);
font-weight: var(--button-font-weight, 500);
}
.btn--default:hover {
color: var(--button-color, var(--foreground));
fill: var(--button-color, var(--foreground));
background: var(--button-hover-background, var(--background));
filter: var(--interactive-filter);
}
.btn--default:focus-visible {
background: var(--button-hover-background, var(--background));
filter: var(--interactive-filter);
outline: var(--button-focus-outline, var(--outline));
}
`,C6=`
.success__position {
position: fixed;
inset: var(--dialog-inset);
padding: var(--page-margin);
z-index: var(--z-index);
}
.success__content {
background: var(--success-background, var(--background));
border: var(--success-border, var(--border));
border-radius: var(--success-border-radius, 1.7em/50%);
box-shadow: var(--success-box-shadow, var(--box-shadow));
font-weight: var(--success-font-weight, 600);
color: var(--success-color);
fill: var(--success-color);
padding: 12px 24px;
line-height: 1.75em;
display: grid;
align-items: center;
grid-auto-flow: column;
gap: 6px;
cursor: default;
}
.success__icon {
display: flex;
}
`;function T6(t){const e=qe.createElement("style");return e.textContent=`
:host {
--dialog-inset: var(--inset);
}
${w6}
${S6}
${E6}
${k6}
${C6}
`,t&&e.setAttribute("nonce",t),e}function I6(){const t=Be().getUser(),e=Pt().getUser(),n=Lh().getUser();return t&&Object.keys(t).length?t:e&&Object.keys(e).length?e:n}const x6=()=>({name:"FeedbackModal",setupOnce(){},createDialog:({options:t,screenshotIntegration:e,sendFeedback:n,shadow:r})=>{const i=r,s=t.useSentryUser,o=I6(),a=qe.createElement("div"),c=T6(t.styleNonce);let u="";const d={get el(){return a},appendToDom(){!i.contains(c)&&!i.contains(a)&&(i.appendChild(c),i.appendChild(a))},removeFromDom(){i.removeChild(a),i.removeChild(c),qe.body.style.overflow=u},open(){var f,p;h(!0),(f=t.onFormOpen)==null||f.call(t),(p=oe())==null||p.emit("openFeedbackWidget"),u=qe.body.style.overflow,qe.body.style.overflow="hidden"},close(){h(!1),qe.body.style.overflow=u}},l=e==null?void 0:e.createInput({h:Le,hooks:f6,dialog:d,options:t}),h=f=>{n6(Le(b6,{options:t,screenshotInput:l,showName:t.showName||t.isNameRequired,showEmail:t.showEmail||t.isEmailRequired,defaultName:s&&o&&o[s.name]||"",defaultEmail:s&&o&&o[s.email]||"",onFormClose:()=>{var p;h(!1),(p=t.onFormClose)==null||p.call(t)},onSubmit:n,onSubmitSuccess:p=>{var g;h(!1),(g=t.onSubmitSuccess)==null||g.call(t,p)},onSubmitError:p=>{var g;(g=t.onSubmitError)==null||g.call(t,p)},onFormSubmitted:()=>{var p;(p=t.onFormSubmitted)==null||p.call(t)},open:f}),a)};return d}});function R6({h:t}){return function({action:n,imageBuffer:r,annotatingRef:i}){const s=()=>{if(n!=="annotate")return;const a=u=>{const d=i.current;if(d){const l=d.getBoundingClientRect(),h=u.clientX-l.x,f=u.clientY-l.y,p=d.getContext("2d");p&&(p.lineTo(h,f),p.stroke(),p.beginPath(),p.moveTo(h,f))}},c=()=>{var d;const u=(d=i.current)==null?void 0:d.getContext("2d");u&&u.beginPath(),o(),qe.removeEventListener("mousemove",a),qe.removeEventListener("mouseup",c)};qe.addEventListener("mousemove",a),qe.addEventListener("mouseup",c)},o=()=>{const a=r.getContext("2d"),c=i.current;if(a&&c){a.drawImage(c,0,0,c.width,c.height,0,0,r.width,r.height);const u=c.getContext("2d");u&&u.clearRect(0,0,c.width,c.height)}};return t("canvas",{class:`editor__annotation ${n==="annotate"?"editor__annotation--active":""}`,onMouseDown:s,ref:i})}}function A6({h:t}){return function({top:n,left:r,corner:i,onGrabButton:s}){return t("button",{class:`editor__crop-corner editor__crop-corner--${i} `,style:{top:n,left:r},onMouseDown:o=>{o.preventDefault(),s(o,i)},onClick:o=>{o.preventDefault()}})}}const pc=30,Kr=3,Ci=pc+Kr,fr=On.devicePixelRatio,Gk=t=>({x:Math.min(t.startX,t.endX),y:Math.min(t.startY,t.endY),width:Math.abs(t.startX-t.endX),height:Math.abs(t.startY-t.endY)}),Yk=t=>{const e=t.clientHeight,n=t.clientWidth,r=t.width/t.height;let i=e*r,s=e;i>n&&(i=n,s=n/r);const o=(n-i)/2,a=(e-s)/2;return{x:o,y:a,width:i,height:s}};function P6({h:t,hooks:e,options:n}){const r=A6({h:t});return function({action:s,imageBuffer:o,croppingRef:a,cropContainerRef:c,croppingRect:u,setCroppingRect:d,resize:l}){const h=e.useRef({initialX:0,initialY:0}),[f,p]=e.useState(!1),[g,v]=e.useState(!1);e.useEffect(()=>{const C=a.current;if(!C)return;const E=C.getContext("2d");if(!E)return;const I=Yk(o),y=Gk(u);E.clearRect(0,0,I.width,I.height),s==="crop"&&(E.fillStyle="rgba(0, 0, 0, 0.5)",E.fillRect(0,0,I.width,I.height),E.clearRect(y.x,y.y,y.width,y.height),E.strokeStyle="#ffffff",E.lineWidth=3,E.strokeRect(y.x+1,y.y+1,y.width-2,y.height-2),E.strokeStyle="#000000",E.lineWidth=1,E.strokeRect(y.x+3,y.y+3,y.width-6,y.height-6))},[u,s]);const m=e.useCallback(C=>E=>{if(!a.current)return;const I=a.current,y=I.getBoundingClientRect(),b=E.clientX-y.x,k=E.clientY-y.y;switch(C){case"top-left":d(x=>({...x,startX:Math.min(Math.max(0,b),x.endX-Ci),startY:Math.min(Math.max(0,k),x.endY-Ci)}));break;case"top-right":d(x=>({...x,endX:Math.max(Math.min(b,I.width/fr),x.startX+Ci),startY:Math.min(Math.max(0,k),x.endY-Ci)}));break;case"bottom-left":d(x=>({...x,startX:Math.min(Math.max(0,b),x.endX-Ci),endY:Math.max(Math.min(k,I.height/fr),x.startY+Ci)}));break;case"bottom-right":d(x=>({...x,endX:Math.max(Math.min(b,I.width/fr),x.startX+Ci),endY:Math.max(Math.min(k,I.height/fr),x.startY+Ci)}));break}},[]),_=C=>{if(f)return;h.current={initialX:C.clientX,initialY:C.clientY};const E=y=>{const b=a.current;if(!b)return;const k=y.clientX-h.current.initialX,x=y.clientY-h.current.initialY;d(R=>{const F=Math.max(0,Math.min(R.startX+k,b.width/fr-(R.endX-R.startX))),z=Math.max(0,Math.min(R.startY+x,b.height/fr-(R.endY-R.startY))),J=F+(R.endX-R.startX),U=z+(R.endY-R.startY);return h.current.initialX=y.clientX,h.current.initialY=y.clientY,{startX:F,startY:z,endX:J,endY:U}})},I=()=>{qe.removeEventListener("mousemove",E),qe.removeEventListener("mouseup",I)};qe.addEventListener("mousemove",E),qe.addEventListener("mouseup",I)},w=(C,E)=>{p(!0);const I=m(E),y=()=>{qe.removeEventListener("mousemove",I),qe.removeEventListener("mouseup",y),v(!0),p(!1)};qe.addEventListener("mouseup",y),qe.addEventListener("mousemove",I)};function T(){const C=qe.createElement("canvas"),E=Yk(o),I=Gk(u);C.width=I.width*fr,C.height=I.height*fr;const y=C.getContext("2d");y&&o&&y.drawImage(o,I.x/E.width*o.width,I.y/E.height*o.height,I.width/E.width*o.width,I.height/E.height*o.height,0,0,C.width,C.height);const b=o.getContext("2d");b&&(b.clearRect(0,0,o.width,o.height),o.width=C.width,o.height=C.height,o.style.width=`${I.width}px`,o.style.height=`${I.height}px`,b.drawImage(C,0,0),l())}return t("div",{class:`editor__crop-container ${s==="crop"?"":"editor__crop-container--inactive"}
${g?"editor__crop-container--move":""}`,ref:c},t("canvas",{onMouseDown:_,ref:a}),s==="crop"&&t("div",null,t(r,{left:u.startX-Kr,top:u.startY-Kr,onGrabButton:w,corner:"top-left"}),t(r,{left:u.endX-pc+Kr,top:u.startY-Kr,onGrabButton:w,corner:"top-right"}),t(r,{left:u.startX-Kr,top:u.endY-pc+Kr,onGrabButton:w,corner:"bottom-left"}),t(r,{left:u.endX-pc+Kr,top:u.endY-pc+Kr,onGrabButton:w,corner:"bottom-right"})),s==="crop"&&t("div",{style:{left:Math.max(0,u.endX-191),top:Math.max(0,u.endY+8)},class:`editor__crop-btn-group ${g?"editor__crop-btn-group--active":""}`},t("button",{onClick:C=>{C.preventDefault(),a.current&&d({startX:0,startY:0,endX:a.current.width/fr,endY:a.current.height/fr}),v(!1)},class:"btn btn--default"},n.cancelButtonLabel),t("button",{onClick:C=>{C.preventDefault(),T(),v(!1)},class:"btn btn--primary"},n.confirmButtonLabel)))}}function M6(t){const e=qe.createElement("style"),n="#1A141F",r="#302735";return e.textContent=`
.editor {
display: flex;
flex-grow: 1;
flex-direction: column;
}
.editor__image-container {
padding: 10px;
padding-top: 65px;
padding-bottom: 65px;
position: relative;
height: 100%;
border-radius: var(--menu-border-radius, 6px);
background-color: ${n};
background-image: repeating-linear-gradient(
-145deg,
transparent,
transparent 8px,
${n} 8px,
${n} 11px
),
repeating-linear-gradient(
-45deg,
transparent,
transparent 15px,
${r} 15px,
${r} 16px
);
}
.editor__annotation {
z-index: 1;
}
.editor__annotation--active {
z-index: 2;
}
.editor__canvas-container {
width: 100%;
height: 100%;
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
.editor__canvas-container canvas {
object-fit: contain;
position: absolute;
}
.editor__crop-container {
custor: auto;
position: absolute;
z-index: 2;
}
.editor__crop-container--inactive {
z-index: 1;
}
.editor__crop-container--move {
cursor: move;
}
.editor__crop-btn-group {
padding: 8px;
gap: 8px;
border-radius: var(--menu-border-radius, 6px);
background: var(--button-background, var(--background));
width: 175px;
position: absolute;
display: none;
}
.editor__crop-btn-group--active {
display: flex;
}
.editor__crop-corner {
width: 30px;
height: 30px;
position: absolute;
background: none;
border: 3px solid #ffffff;
}
.editor__crop-corner--top-left {
cursor: nwse-resize;
border-right: none;
border-bottom: none;
}
.editor__crop-corner--top-right {
cursor: nesw-resize;
border-left: none;
border-bottom: none;
}
.editor__crop-corner--bottom-left {
cursor: nesw-resize;
border-right: none;
border-top: none;
}
.editor__crop-corner--bottom-right {
cursor: nwse-resize;
border-left: none;
border-top: none;
}
.editor__tool-container {
padding-top: 8px;
display: flex;
justify-content: space-between;
}
.editor__tool-bar {
display: flex;
gap: 8px;
}
.editor__tool {
display: flex;
padding: 8px 12px;
justify-content: center;
align-items: center;
border: var(--button-border, var(--border));
border-radius: var(--button-border-radius, 6px);
background: var(--button-background, var(--background));
color: var(--button-foreground, var(--foreground));
}
.editor__tool--active {
background: var(--button-primary-background, var(--accent-background));
color: var(--button-primary-foreground, var(--accent-foreground));
}
`,t&&e.setAttribute("nonce",t),e}function O6({h:t}){return function(){return t("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{d:"M15.25 12.5H12.5M12.5 12.5H4.50001C3.94773 12.5 3.50001 12.0523 3.50001 11.5V3.50002M12.5 12.5L12.5 4.50002C12.5 3.94773 12.0523 3.50002 11.5 3.50002H3.50001M12.5 12.5L12.5 15.25M3.50001 3.50002V0.750031M3.50001 3.50002H0.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))}}function L6({h:t}){return function(){return t("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{d:"M8.5 12L12 8.5L14 11L11 14L8.5 12Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M12 8.5L11 3.5L2 2L3.5 11L8.5 12L12 8.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t("path",{d:"M2 2L7.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))}}function D6({h:t}){return function({action:n,setAction:r}){const i=L6({h:t}),s=O6({h:t});return t("div",{class:"editor__tool-container"},t("div",null),t("div",{class:"editor__tool-bar"},t("button",{type:"button",class:`editor__tool ${n==="crop"?"editor__tool--active":""}`,onClick:()=>{r(n==="crop"?"":"crop")}},t(s,null)),t("button",{type:"button",class:`editor__tool ${n==="annotate"?"editor__tool--active":""}`,onClick:()=>{r(n==="annotate"?"":"annotate")}},t(i,null))),t("div",null))}}function N6({hooks:t}){return function({onBeforeScreenshot:n,onScreenshot:r,onAfterScreenshot:i,onError:s}){t.useEffect(()=>{(async()=>{n();const a=await lc.mediaDevices.getDisplayMedia({video:{width:On.innerWidth*On.devicePixelRatio,height:On.innerHeight*On.devicePixelRatio},audio:!1,monitorTypeSurfaces:"exclude",preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"}),c=qe.createElement("video");await new Promise((u,d)=>{c.srcObject=a,c.onloadedmetadata=()=>{r(c),a.getTracks().forEach(l=>l.stop()),u()},c.play().catch(d)}),i()})().catch(s)},[])}}const ld=On.devicePixelRatio,F6=t=>{const e=t.clientHeight,n=t.clientWidth,r=t.width/t.height;let i=e*r,s=e;i>n&&(i=n,s=n/r);const o=(n-i)/2,a=(e-s)/2;return{x:o,y:a,width:i,height:s}};function $6({h:t,hooks:e,imageBuffer:n,dialog:r,options:i}){const s=N6({hooks:e}),o=D6({h:t}),a=R6({h:t}),c=P6({h:t,hooks:e,options:i});return function({onError:d}){const l=e.useMemo(()=>({__html:M6(i.styleNonce).innerText}),[]),h=e.useRef(null),f=e.useRef(null),p=e.useRef(null),g=e.useRef(null),[v,m]=e.useState("crop"),[_,w]=e.useState({startX:0,startY:0,endX:0,endY:0});e.useEffect(()=>(On.addEventListener("resize",C),()=>{On.removeEventListener("resize",C)}),[]);function T(E,I){const y=E.current;if(!y)return;y.width=I.width*ld,y.height=I.height*ld,y.style.width=`${I.width}px`,y.style.height=`${I.height}px`;const b=y.getContext("2d");b&&b.scale(ld,ld)}function C(){const E=F6(n);T(g,E),T(p,E);const I=f.current;I&&(I.style.width=`${E.width}px`,I.style.height=`${E.height}px`),w({startX:0,startY:0,endX:E.width,endY:E.height})}return s({onBeforeScreenshot:e.useCallback(()=>{r.el.style.display="none"},[]),onScreenshot:e.useCallback(E=>{const I=n.getContext("2d");if(!I)throw new Error("Could not get canvas context");n.width=E.videoWidth,n.height=E.videoHeight,n.style.width="100%",n.style.height="100%",I.drawImage(E,0,0)},[n]),onAfterScreenshot:e.useCallback(()=>{r.el.style.display="block";const E=h.current;E==null||E.appendChild(n),C()},[]),onError:e.useCallback(E=>{r.el.style.display="block",d(E)},[])}),t("div",{class:"editor"},t("style",{nonce:i.styleNonce,dangerouslySetInnerHTML:l}),t("div",{class:"editor__image-container"},t("div",{class:"editor__canvas-container",ref:h},t(c,{action:v,imageBuffer:n,croppingRef:g,cropContainerRef:f,croppingRect:_,setCroppingRect:w,resize:C}),t(a,{action:v,imageBuffer:n,annotatingRef:p}))),i._experiments.annotations&&t(o,{action:v,setAction:m}))}}const U6=()=>({name:"FeedbackScreenshot",setupOnce(){},createInput:({h:t,hooks:e,dialog:n,options:r})=>{const i=qe.createElement("canvas");return{input:$6({h:t,hooks:e,imageBuffer:i,dialog:n,options:r}),value:async()=>{const s=await new Promise(o=>{i.toBlob(o,"image/png")});if(s)return{data:new Uint8Array(await s.arrayBuffer()),filename:"screenshot.png",contentType:"application/png"}}}}}),B6=Ek({lazyLoadIntegration:OS}),Zk=Ek({getModalIntegration:()=>x6,getScreenshotIntegration:()=>U6}),Xk=new WeakMap,Ag=new Map,gc={traceFetch:!0,traceXHR:!0,enableHTTPTimings:!0,trackFetchStreamPerformance:!1};function Jk(t,e){const{traceFetch:n,traceXHR:r,trackFetchStreamPerformance:i,shouldCreateSpanForRequest:s,enableHTTPTimings:o,tracePropagationTargets:a}={traceFetch:gc.traceFetch,traceXHR:gc.traceXHR,trackFetchStreamPerformance:gc.trackFetchStreamPerformance,...e},c=typeof s=="function"?s:l=>!0,u=l=>q6(l,a),d={};n&&(t.addEventProcessor(l=>(l.type==="transaction"&&l.spans&&l.spans.forEach(h=>{if(h.op==="http.client"){const f=Ag.get(h.span_id);f&&(h.timestamp=f/1e3,Ag.delete(h.span_id))}}),l)),i&&bF(l=>{if(l.response){const h=Xk.get(l.response);h&&l.endTimestamp&&Ag.set(h,l.endTimestamp)}}),hp(l=>{const h=hF(l,c,u,d);if(l.response&&l.fetchData.__span&&Xk.set(l.response,l.fetchData.__span),h){const f=eC(l.fetchData.url),p=f?cs(f).host:void 0;h.setAttributes({"http.url":f,"server.address":p})}o&&h&&Qk(h)})),r&&Op(l=>{const h=W6(l,c,u,d);o&&h&&Qk(h)})}function j6(t){return t.entryType==="resource"&&"initiatorType"in t&&typeof t.nextHopProtocol=="string"&&(t.initiatorType==="fetch"||t.initiatorType==="xmlhttprequest")}function Qk(t){const{url:e}=Re(t).data;if(!e||typeof e!="string")return;const n=io("resource",({entries:r})=>{r.forEach(i=>{j6(i)&&i.name.endsWith(e)&&(H6(i).forEach(o=>t.setAttribute(...o)),setTimeout(n))})})}function hr(t=0){return((dn()||performance.timeOrigin)+t)/1e3}function H6(t){const{name:e,version:n}=cS(t.nextHopProtocol),r=[];return r.push(["network.protocol.version",n],["network.protocol.name",e]),dn()?[...r,["http.request.redirect_start",hr(t.redirectStart)],["http.request.fetch_start",hr(t.fetchStart)],["http.request.domain_lookup_start",hr(t.domainLookupStart)],["http.request.domain_lookup_end",hr(t.domainLookupEnd)],["http.request.connect_start",hr(t.connectStart)],["http.request.secure_connection_start",hr(t.secureConnectionStart)],["http.request.connection_end",hr(t.connectEnd)],["http.request.request_start",hr(t.requestStart)],["http.request.response_start",hr(t.responseStart)],["http.request.response_end",hr(t.responseEnd)]]:r}function q6(t,e){const n=Qi();if(n){let r,i;try{r=new URL(t,n),i=new URL(n).origin}catch{return!1}const s=r.origin===i;return e?lr(r.toString(),e)||s&&lr(r.pathname,e):s}else{const r=!!t.match(/^\/(?!\/)/);return e?lr(t,e):r}}function W6(t,e,n,r){const i=t.xhr,s=i==null?void 0:i[qr];if(!i||i.__sentry_own_request__||!s)return;const{url:o,method:a}=s,c=bi()&&e(o);if(t.endTimestamp&&c){const g=i.__sentry_xhr_span_id__;if(!g)return;const v=r[g];v&&s.status_code!==void 0&&(Uh(v,s.status_code),v.end(),delete r[g]);return}const u=eC(o),d=cs(u||o),l=dp(o),h=!!$t(),f=c&&h?Js({name:`${a} ${l}`,attributes:{url:o,type:"xhr","http.method":a,"http.url":u,"server.address":d==null?void 0:d.host,[It]:"auto.http.browser",[Fr]:"http.client",...(d==null?void 0:d.search)&&{"http.query":d==null?void 0:d.search},...(d==null?void 0:d.hash)&&{"http.fragment":d==null?void 0:d.hash}}}):new $r;i.__sentry_xhr_span_id__=f.spanContext().spanId,r[i.__sentry_xhr_span_id__]=f,n(o)&&z6(i,bi()&&h?f:void 0);const p=oe();return p&&p.emit("beforeOutgoingRequestSpan",f,t),f}function z6(t,e){const{"sentry-trace":n,baggage:r}=gw({span:e});n&&V6(t,n,r)}function V6(t,e,n){try{t.setRequestHeader("sentry-trace",e),n&&t.setRequestHeader("baggage",n)}catch{}}function eC(t){try{return new URL(t,ce.location.origin).href}catch{return}}function K6(){ce.document?ce.document.addEventListener("visibilitychange",()=>{const t=$t();if(!t)return;const e=xt(t);if(ce.document.hidden&&e){const n="cancelled",{op:r,status:i}=Re(e);Ae&&L.log(`[Tracing] Transaction: ${n} -> since tab moved to the background, op: ${r}`),i||e.setStatus({code:Ct,message:n}),e.setAttribute("sentry.cancellation_reason","document.hidden"),e.end()}}):Ae&&L.warn("[Tracing] Could not set up background tab detection due to lack of global document")}const G6=3600,tC="sentry_previous_trace";function nC(t,e){const n=Re(e);return t?t.spanContext.traceId===n.trace_id?t:(Date.now()/1e3-t.startTimestamp<=G6&&(Ae&&L.info(`Adding previous_trace ${t.spanContext} link to span ${{op:n.op,...e.spanContext()}}`),e.addLink({context:t.spanContext,attributes:{[gL]:"previous_trace"}})),{spanContext:e.spanContext(),startTimestamp:Re(e).start_timestamp}):{spanContext:e.spanContext(),startTimestamp:n.start_timestamp}}function Y6(t){try{ce.sessionStorage.setItem(tC,JSON.stringify(t))}catch(e){Ae&&L.warn("Could not store previous trace in sessionStorage",e)}}function Z6(){var t;try{const e=(t=ce.sessionStorage)==null?void 0:t.getItem(tC);return JSON.parse(e)}catch{return}}const X6="BrowserTracing",J6={...ol,instrumentNavigation:!0,instrumentPageLoad:!0,markBackgroundSpan:!0,enableLongTask:!0,enableLongAnimationFrame:!0,enableInp:!0,linkPreviousTrace:"in-memory",_experiments:{},...gc},Q6=(t={})=>{const e=ce.document;y0();const{enableInp:n,enableLongTask:r,enableLongAnimationFrame:i,_experiments:{enableInteractions:s,enableStandaloneClsSpans:o},beforeStartSpan:a,idleTimeout:c,finalTimeout:u,childSpanTimeout:d,markBackgroundSpan:l,traceFetch:h,traceXHR:f,trackFetchStreamPerformance:p,shouldCreateSpanForRequest:g,enableHTTPTimings:v,instrumentPageLoad:m,instrumentNavigation:_,linkPreviousTrace:w}={...J6,...t},T=S2({recordClsStandaloneSpans:o||!1});n&&K2(),i&&ke.PerformanceObserver&&PerformanceObserver.supportedEntryTypes&&PerformanceObserver.supportedEntryTypes.includes("long-animation-frame")?k2():r&&E2(),s&&C2();const C={name:void 0,source:void 0};function E(I,y){const b=y.op==="pageload",k=a?a(y):y,x=k.attributes||{};y.name!==k.name&&(x[An]="custom",k.attributes=x),C.name=k.name,C.source=x[An];const R=F0(k,{idleTimeout:c,finalTimeout:u,childSpanTimeout:d,disableAutoFinish:b,beforeSpanEnd:z=>{T(),A2(z,{recordClsOnPageloadSpan:!o}),aC(I,void 0);const J=Be(),U=J.getPropagationContext();J.setPropagationContext({...U,traceId:R.spanContext().traceId,sampled:is(R),dsc:Yn(z)})}});aC(I,R);function F(){e&&["interactive","complete"].includes(e.readyState)&&I.emit("idleSpanEnableAutoFinish",R)}b&&e&&(e.addEventListener("readystatechange",()=>{F()}),F())}return{name:X6,afterAllSetup(I){let y=Qi();function b(){const k=dd(I);k&&!Re(k).timestamp&&(Ae&&L.log(`[Tracing] Finishing current active span with op: ${Re(k).op}`),k.end())}if(I.on("startNavigationSpan",k=>{oe()===I&&(b(),Pt().setPropagationContext({traceId:Nr(),sampleRand:Math.random()}),Be().setPropagationContext({traceId:Nr(),sampleRand:Math.random()}),E(I,{op:"navigation",...k}))}),I.on("startPageLoadSpan",(k,x={})=>{if(oe()!==I)return;b();const R=x.sentryTrace||sC("sentry-trace"),F=x.baggage||sC("baggage"),z=c0(R,F);Be().setPropagationContext(z),E(I,{op:"pageload",...k})}),w!=="off"){let k;I.on("spanStart",x=>{if(xt(x)===x)if(w==="session-storage"){const R=nC(Z6(),x);Y6(R)}else k=nC(k,x)})}if(ce.location){if(m){const k=dn();rC(I,{name:ce.location.pathname,startTime:k?k/1e3:void 0,attributes:{[An]:"url",[It]:"auto.pageload.browser"}})}_&&kl(({to:k,from:x})=>{if(x===void 0&&(y==null?void 0:y.indexOf(k))!==-1){y=void 0;return}x!==k&&(y=void 0,iC(I,{name:ce.location.pathname,attributes:{[An]:"url",[It]:"auto.navigation.browser"}}))})}l&&K6(),s&&ej(I,c,u,d,C),n&&Y2(),Jk(I,{traceFetch:h,traceXHR:f,trackFetchStreamPerformance:p,tracePropagationTargets:I.getOptions().tracePropagationTargets,shouldCreateSpanForRequest:g,enableHTTPTimings:v})}}};function rC(t,e,n){return t.emit("startPageLoadSpan",e,n),Be().setTransactionName(e.name),dd(t)}function iC(t,e){return t.emit("startNavigationSpan",e),Be().setTransactionName(e.name),dd(t)}function sC(t){const e=ce.document,n=e==null?void 0:e.querySelector(`meta[name=${t}]`);return(n==null?void 0:n.getAttribute("content"))||void 0}function ej(t,e,n,r,i){const s=ce.document;let o;const a=()=>{const c="ui.action.click",u=dd(t);if(u){const d=Re(u).op;if(["navigation","pageload"].includes(d)){Ae&&L.warn(`[Tracing] Did not create ${c} span because a pageload or navigation span is in progress.`);return}}if(o&&(o.setAttribute(Nh,"interactionInterrupted"),o.end(),o=void 0),!i.name){Ae&&L.warn(`[Tracing] Did not create ${c} transaction because _latestRouteName is missing.`);return}o=F0({name:i.name,op:c,attributes:{[An]:i.source||"url"}},{idleTimeout:e,finalTimeout:n,childSpanTimeout:r})};s&&addEventListener("click",a,{once:!1,capture:!0})}const oC="_sentry_idleSpan";function dd(t){return t[oC]}function aC(t,e){fn(t,oC,e)}function xo(t){return new Promise((e,n)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>n(t.error)})}function tj(t,e){const n=indexedDB.open(t);n.onupgradeneeded=()=>n.result.createObjectStore(e);const r=xo(n);return i=>r.then(s=>i(s.transaction(e,"readwrite").objectStore(e)))}function Pg(t){return xo(t.getAllKeys())}function nj(t,e,n){return t(r=>Pg(r).then(i=>{if(!(i.length>=n))return r.put(e,Math.max(...i,0)+1),xo(r.transaction)}))}function rj(t,e,n){return t(r=>Pg(r).then(i=>{if(!(i.length>=n))return r.put(e,Math.min(...i,0)-1),xo(r.transaction)}))}function ij(t){return t(e=>Pg(e).then(n=>{const r=n[0];if(r!=null)return xo(e.get(r)).then(i=>(e.delete(r),xo(e.transaction).then(()=>i)))}))}function sj(t){let e;function n(){return e==null&&(e=tj(t.dbName||"sentry-offline",t.storeName||"queue")),e}return{push:async r=>{try{const i=await sl(r);await nj(n(),i,t.maxQueueSize||30)}catch{}},unshift:async r=>{try{const i=await sl(r);await rj(n(),i,t.maxQueueSize||30)}catch{}},shift:async()=>{try{const r=await ij(n());if(r)return zL(r)}catch{}}}}function oj(t){return e=>{const n=t({...e,createStore:sj});return ce.addEventListener("online",async r=>{await n.flush()}),n}}function aj(t=Np){return oj(lN(t))}const cC=1e6,fd=String(0),cj="main",Ln=ce.navigator;let uC="",lC="",dC="",Mg=(Ln==null?void 0:Ln.userAgent)||"",fC="";const uj=(Ln==null?void 0:Ln.language)||((rT=Ln==null?void 0:Ln.languages)==null?void 0:rT[0])||"";function lj(t){return typeof t=="object"&&t!==null&&"getHighEntropyValues"in t}const hC=Ln==null?void 0:Ln.userAgentData;lj(hC)&&hC.getHighEntropyValues(["architecture","model","platform","platformVersion","fullVersionList"]).then(t=>{var e;if(uC=t.platform||"",dC=t.architecture||"",fC=t.model||"",lC=t.platformVersion||"",(e=t.fullVersionList)!=null&&e.length){const n=t.fullVersionList[t.fullVersionList.length-1];Mg=`${n.brand} ${n.version}`}}).catch(t=>{});function dj(t){return!("thread_metadata"in t)}function fj(t){return dj(t)?gj(t):t}function hj(t){var n,r;const e=(r=(n=t.contexts)==null?void 0:n.trace)==null?void 0:r.trace_id;return typeof e=="string"&&e.length!==32&&Ae&&L.log(`[Profiling] Invalid traceId: ${e} on profiled event`),typeof e!="string"?"":e}function pj(t,e,n,r){if(r.type!=="transaction")throw new TypeError("Profiling events may only be attached to transactions, this should never occur.");if(n==null)throw new TypeError(`Cannot construct profiling event envelope without a valid profile. Got ${n} instead.`);const i=hj(r),s=fj(n),o=e||(typeof r.start_timestamp=="number"?r.start_timestamp*1e3:At()*1e3),a=typeof r.timestamp=="number"?r.timestamp*1e3:At()*1e3;return{event_id:t,timestamp:new Date(o).toISOString(),platform:"javascript",version:"1",release:r.release||"",environment:r.environment||nl,runtime:{name:"javascript",version:ce.navigator.userAgent},os:{name:uC,version:lC,build_number:Mg},device:{locale:uj,model:fC,manufacturer:Mg,architecture:dC,is_emulator:!1},debug_meta:{images:_j(n.resources)},profile:s,transactions:[{name:r.transaction||"",id:r.event_id||nn(),trace_id:i,active_thread_id:fd,relative_start_ns:"0",relative_end_ns:((a-o)*1e6).toFixed(0)}]}}function pC(t){return Re(t).op==="pageload"}function gj(t){let e,n=0;const r={samples:[],stacks:[],frames:[],thread_metadata:{[fd]:{name:cj}}},i=t.samples[0];if(!i)return r;const s=i.timestamp,o=dn(),a=typeof performance.timeOrigin=="number"?performance.timeOrigin:o||0,c=a-(o||a);return t.samples.forEach((u,d)=>{if(u.stackId===void 0){e===void 0&&(e=n,r.stacks[e]=[],n++),r.samples[d]={elapsed_since_start_ns:((u.timestamp+c-s)*cC).toFixed(0),stack_id:e,thread_id:fd};return}let l=t.stacks[u.stackId];const h=[];for(;l;){h.push(l.frameId);const p=t.frames[l.frameId];p&&r.frames[l.frameId]===void 0&&(r.frames[l.frameId]={function:p.name,abs_path:typeof p.resourceId=="number"?t.resources[p.resourceId]:void 0,lineno:p.line,colno:p.column}),l=l.parentId===void 0?void 0:t.stacks[l.parentId]}const f={elapsed_since_start_ns:((u.timestamp+c-s)*cC).toFixed(0),stack_id:n,thread_id:fd};r.stacks[n]=h,r.samples[d]=f,n++}),r}function mj(t,e){if(!e.length)return t;for(const n of e)t[1].push([{type:"profile"},n]);return t}function vj(t){const e=[];return as(t,(n,r)=>{if(r==="transaction")for(let i=1;i<n.length;i++){const s=n[i];s!=null&&s.contexts&&s.contexts.profile&&s.contexts.profile.profile_id&&e.push(n[i])}}),e}function _j(t){const e=oe(),n=e==null?void 0:e.getOptions(),r=n==null?void 0:n.stackParser;return r?fD(r,t):[]}function yj(t){return typeof t!="number"&&typeof t!="boolean"||typeof t=="number"&&isNaN(t)?(Ae&&L.warn(`[Profiling] Invalid sample rate. Sample rate must be a boolean or a number between 0 and 1. Got ${JSON.stringify(t)} of type ${JSON.stringify(typeof t)}.`),!1):t===!0||t===!1?!0:t<0||t>1?(Ae&&L.warn(`[Profiling] Invalid sample rate. Sample rate must be between 0 and 1. Got ${t}.`),!1):!0}function bj(t){return t.samples.length<2?(Ae&&L.log("[Profiling] Discarding profile because it contains less than 2 samples"),!1):t.frames.length?!0:(Ae&&L.log("[Profiling] Discarding profile because it contains no frames"),!1)}let gC=!1;const mC=3e4;function wj(t){return typeof t=="function"}function Sj(){const t=ce.Profiler;if(!wj(t)){Ae&&L.log("[Profiling] Profiling is not supported by this browser, Profiler interface missing on window object.");return}const e=10,n=Math.floor(mC/e);try{return new t({sampleInterval:e,maxBufferSize:n})}catch{Ae&&(L.log("[Profiling] Failed to initialize the Profiling constructor, this is likely due to a missing 'Document-Policy': 'js-profiling' header."),L.log("[Profiling] Disabling profiling for current user session.")),gC=!0}}function vC(t){if(gC)return Ae&&L.log("[Profiling] Profiling has been disabled for the duration of the current user session."),!1;if(!t.isRecording())return Ae&&L.log("[Profiling] Discarding profile because transaction was not sampled."),!1;const e=oe(),n=e==null?void 0:e.getOptions();if(!n)return Ae&&L.log("[Profiling] Profiling disabled, no options found."),!1;const r=n.profilesSampleRate;return yj(r)?r?(r===!0?!0:Math.random()<r)?!0:(Ae&&L.log(`[Profiling] Discarding profile because it's not included in the random sample (sampling rate = ${Number(r)})`),!1):(Ae&&L.log("[Profiling] Discarding profile because a negative sampling decision was inherited or profileSampleRate is set to 0"),!1):(Ae&&L.warn("[Profiling] Discarding profile because of invalid sample rate."),!1)}function Ej(t,e,n,r){return bj(n)?pj(t,e,n,r):null}const gs=new Map;function kj(){return gs.size}function Cj(t){const e=gs.get(t);return e&&gs.delete(t),e}function Tj(t,e){if(gs.set(t,e),gs.size>30){const n=gs.keys().next().value;gs.delete(n)}}function _C(t){let e;pC(t)&&(e=At()*1e3);const n=Sj();if(!n)return;Ae&&L.log(`[Profiling] started profiling span: ${Re(t).description}`);const r=nn();Be().setContext("profile",{profile_id:r,start_timestamp:e});async function i(){if(t&&n)return n.stop().then(c=>{if(s&&(ce.clearTimeout(s),s=void 0),Ae&&L.log(`[Profiling] stopped profiling of span: ${Re(t).description}`),!c){Ae&&L.log(`[Profiling] profiler returned null profile for: ${Re(t).description}`,"this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started");return}Tj(r,c)}).catch(c=>{Ae&&L.log("[Profiling] error while stopping profiler:",c)})}let s=ce.setTimeout(()=>{Ae&&L.log("[Profiling] max profile duration elapsed, stopping profiling for:",Re(t).description),i()},mC);const o=t.end.bind(t);function a(){return t?(i().then(()=>{o()},()=>{o()}),t):o()}t.end=a}const Ij="BrowserProfiling",xj=()=>({name:Ij,setup(t){const e=$t(),n=e&&xt(e);n&&pC(n)&&vC(n)&&_C(n),t.on("spanStart",r=>{r===xt(r)&&vC(r)&&_C(r)}),t.on("beforeEnvelope",r=>{var o,a;if(!kj())return;const i=vj(r);if(!i.length)return;const s=[];for(const c of i){const u=c==null?void 0:c.contexts,d=(o=u==null?void 0:u.profile)==null?void 0:o.profile_id,l=(a=u==null?void 0:u.profile)==null?void 0:a.start_timestamp;if(typeof d!="string"){Ae&&L.log("[Profiling] cannot find profile for a span without a profile context");continue}if(!d){Ae&&L.log("[Profiling] cannot find profile for a span without a profile context");continue}u!=null&&u.profile&&delete u.profile;const h=Cj(d);if(!h){Ae&&L.log(`[Profiling] Could not retrieve profile for span: ${d}`);continue}const f=Ej(d,l,h,c);f&&s.push(f)}mj(r,s)})}}),Rj="SpotlightBrowser",Aj=(t={})=>{const e=t.sidecarUrl||"http://localhost:8969/stream";return{name:Rj,setup:()=>{Ae&&L.log("Using Sidecar URL",e)},processEvent:n=>Oj(n)?null:n,afterAllSetup:n=>{Pj(n,e)}}};function Pj(t,e){const n=Mp("fetch");let r=0;t.on("beforeEnvelope",i=>{if(r>3){L.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests:",r);return}n(e,{method:"POST",body:sl(i),headers:{"Content-Type":"application/x-sentry-envelope"},mode:"cors"}).then(s=>{s.status>=200&&s.status<400&&(r=0)},s=>{r++,L.error("Sentry SDK can't connect to Sidecar is it running? See: https://spotlightjs.com/sidecar/npx/",s)})})}const Mj=Aj;function Oj(t){return!!(t.type==="transaction"&&t.spans&&t.contexts&&t.contexts.trace&&t.contexts.trace.op==="ui.action.click"&&t.spans.some(({description:e})=>e==null?void 0:e.includes("#sentry-spotlight")))}const Lj=100;function mc(t){const n=Be().getScopeData().contexts.flags,r=n?n.values:[];return r.length&&(t.contexts===void 0&&(t.contexts={}),t.contexts.flags={values:[...r]}),t}function Ro(t,e,n=Lj){const r=Be().getScopeData().contexts;r.flags||(r.flags={values:[]});const i=r.flags.values;Dj(i,t,e,n)}function Dj(t,e,n,r){if(typeof n!="boolean")return;if(t.length>r){Ae&&L.error(`[Feature Flags] insertToFlagBuffer called on a buffer larger than maxSize=${r}`);return}const i=t.findIndex(s=>s.flag===e);i!==-1&&t.splice(i,1),t.length===r&&t.shift(),t.push({flag:e,result:n})}const Nj=()=>({name:"FeatureFlags",processEvent(t,e,n){return mc(t)},addFeatureFlag(t,e){Ro(t,e)}}),Fj=()=>({name:"LaunchDarkly",processEvent(t,e,n){return mc(t)}});function $j(){return{name:"sentry-flag-auditor",type:"flag-used",synchronous:!0,method:(t,e,n)=>{Ro(t,e.value)}}}const Uj=()=>({name:"OpenFeature",processEvent(t,e,n){return mc(t)}});class Bj{after(e,n){Ro(n.flagKey,n.value)}error(e,n,r){Ro(e.flagKey,e.defaultValue)}}const jj=({featureFlagClientClass:t})=>({name:"Unleash",processEvent(e,n,r){return mc(e)},setupOnce(){const e=t.prototype;tn(e,"isEnabled",Hj)}});function Hj(t){return function(...e){const n=e[0],r=t.apply(this,e);return typeof n=="string"&&typeof r=="boolean"?Ro(n,r):Ae&&L.error(`[Feature Flags] UnleashClient.isEnabled does not match expected signature. arg0: ${n} (${typeof n}), result: ${r} (${typeof r})`),r}}const qj=({featureFlagClient:t})=>({name:"Statsig",processEvent(e,n,r){return mc(e)},setup(){t.on("gate_evaluation",e=>{Ro(e.gate.name,e.gate.value)})}});async function Wj(){const t=oe();if(!t)return"no-client-active";if(!t.getDsn())return"no-dsn-configured";try{await fetch("https://o447951.ingest.sentry.io/api/1337/envelope/?sentry_version=7&sentry_key=1337&sentry_client=sentry.javascript.browser%2F1.33.7",{body:"{}",method:"POST",mode:"cors",credentials:"omit"})}catch{return"sentry-unreachable"}}const zj=Object.freeze(Object.defineProperty({__proto__:null,BrowserClient:Kw,OpenFeatureIntegrationHook:Bj,SDK_VERSION:xr,SEMANTIC_ATTRIBUTE_SENTRY_OP:Fr,SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN:It,SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE:Dh,SEMANTIC_ATTRIBUTE_SENTRY_SOURCE:An,Scope:Kn,WINDOW:ce,addBreadcrumb:Br,addEventProcessor:W0,addIntegration:rp,breadcrumbsIntegration:wS,browserApiErrorsIntegration:SS,browserProfilingIntegration:xj,browserSessionIntegration:kS,browserTracingIntegration:Q6,buildLaunchDarklyFlagUsedHandler:$j,captureConsoleIntegration:UN,captureEvent:Va,captureException:ll,captureFeedback:Fw,captureMessage:dl,captureSession:np,chromeStackLineParser:mS,close:DD,contextLinesIntegration:_3,continueTrace:rD,createTransport:lw,createUserFeedbackEnvelope:f$,dedupeIntegration:Rw,defaultRequestInstrumentationOptions:gc,defaultStackLineParsers:_S,defaultStackParser:yS,diagnoseSdkConnectivity:Wj,endSession:tp,eventFiltersIntegration:yw,eventFromException:zw,eventFromMessage:Vw,exceptionFromError:ml,extraErrorDataIntegration:VN,featureFlagsIntegration:Nj,feedbackAsyncIntegration:B6,feedbackIntegration:Zk,feedbackSyncIntegration:Zk,flush:LD,forceLoad:j$,functionToStringIntegration:_w,geckoStackLineParser:vS,getActiveSpan:$t,getClient:oe,getCurrentScope:Be,getDefaultIntegrations:AS,getFeedback:YB,getGlobalScope:Lh,getIsolationScope:Pt,getReplay:oB,getRootSpan:xt,getSpanDescendants:qa,getSpanStatusFromHttpCode:t0,globalHandlersIntegration:CS,graphqlClientIntegration:T3,httpClientIntegration:s3,httpContextIntegration:xS,inboundFiltersIntegration:bw,init:PS,instrumentOutgoingRequests:Jk,isInitialized:ND,lastEventId:q0,launchDarklyIntegration:Fj,lazyLoadIntegration:OS,linkedErrorsIntegration:RS,logger:e3,makeBrowserOfflineTransport:aj,makeFetchTransport:Np,makeMultiplexedTransport:hN,moduleMetadataIntegration:NN,onLoad:H$,openFeatureIntegration:Uj,opera10StackLineParser:u$,opera11StackLineParser:d$,parameterize:pw,registerSpanErrorInstrumentation:y0,replayCanvasIntegration:kB,replayIntegration:rB,reportingObserverIntegration:r3,rewriteFramesIntegration:tF,sendFeedback:yk,setContext:H0,setCurrentClient:sw,setExtra:AD,setExtras:RD,setHttpStatus:Uh,setMeasurement:A0,setTag:MD,setTags:PD,setUser:OD,showReportDialog:B$,spanToBaggageHeader:RL,spanToJSON:Re,spanToTraceHeader:h0,spotlightBrowserIntegration:Mj,startBrowserTracingNavigationSpan:iC,startBrowserTracingPageLoadSpan:rC,startInactiveSpan:Js,startNewTrace:sD,startSession:ep,startSpan:tD,startSpanManual:nD,statsigIntegration:qj,suppressTracing:iD,thirdPartyErrorFilterIntegration:dF,unleashIntegration:jj,updateSpanName:xL,winjsStackLineParser:a$,withActiveSpan:Wa,withIsolationScope:fL,withScope:Gn,zodErrorsIntegration:lF},Symbol.toStringTag,{value:"Module"})),Vj={name:"Browser MCP"};mn.sentry.enabled&&Kj();function Kj(){const t=Vj.name.toLocaleLowerCase().replace(/\s+/g,"-"),e=chrome.runtime.getManifest().version,n=`${t}@${e}`;PS({dsn:mn.sentry.dsn,release:n,environment:Dd,ignoreErrors:["An unexpected error occurred","can't access dead object","Extension context invalidated","Network Error","Failed to get document because the client is offline."],beforeSend:async r=>{var s;const i=!!((s=r.extra)!=null&&s.componentStack);return dT()&&!i?null:r}})}function yC(t){try{return new URL(t)}catch{return new URL(`http://${t}`)}}function Gj(t){return yC(t).protocol.startsWith("http")}function Yj(t){return yC(t).host==="chromewebstore.google.com"}function Og(t){return Gj(t)&&!Yj(t)}function Lg(t){return typeof t<"u"}function Zj(t){throw new Error(`Unreachable assertion failure: ${t}`)}async function Ti(t){return new Promise(e=>{setTimeout(()=>e(),t)})}async function Xj(){const t=await chrome.tabs.query({});return Promise.all(t.map(e=>{const n=e.id;if(!(!Lg(n)||!e.url||!Og(e.url)))return Jj(n)}))}async function Jj(t){try{await chrome.scripting.executeScript({target:{tabId:t},files:["content-scripts/content.js"],injectImmediately:!0})}catch(e){const n=Ui(e);console.warn(`Unable to inject tab ${t}: ${n}`)}}const bC={baseUrl:{development:"http://localhost:3001",production:"https://app.browsermcp.io",test:"http://localhost:3001"}[Dd],paths:{onboarding:{welcome:"/welcome"}}},{logEvent:wC}=Hu();Ss.defineItem("local:installDate",{init:()=>new Date().toISOString()});function SC(t,e){const[n,...r]=EC(t),[i,...s]=EC(e);return n===i&&r.length===0&&s.length===0?0:n!==i?n<i?-1:1:SC(r.join("."),s.join("."))}function EC(t){return t.split(".").map(e=>e.length>0?Number(e):0)}function Qj(t,e){return SC(t,e)===-1}const{logEvent:eH}=Hu(),kC=Ss.defineItem("local:versionUpdate",{fallback:{showAlert:!1}});async function tH(){(await kC.getValue()).showAlert||(await kC.setValue({showAlert:!0}),eH("show version update"))}const nH="1.3.4";async function rH(t){Qj(t,nH)&&await tH()}function iH(){mn.uninstallUrl&&chrome.runtime.setUninstallURL(mn.uninstallUrl);const t=async e=>{const{reason:n,previousVersion:r}=e;n==="install"?(await chrome.tabs.create({url:`${bC.baseUrl}${bC.paths.onboarding.welcome}`}),wC("install extension")):n==="update"&&r&&(await rH(r),await sH())};return chrome.runtime.onInstalled.addListener(t),()=>chrome.runtime.onInstalled.removeListener(t)}async function sH(){const t=await chrome.windows.getAll({populate:!0,windowTypes:["popup"]});await Promise.all(t.map(e=>{if(!e.tabs||e.tabs.length===0)throw new Error("Unable to get popup window tabs");return Promise.all(e.tabs.map(n=>{if(!Lg(n.id))throw new Error("Unable to get tab ID");return chrome.tabs.reload(n.id)}))}))}const oH="messageResponse";function CC(t){function e(n,r){const i=async s=>{const o=JSON.parse(s.data);if(o.type!==n)return;let a,c;try{a=await r(o)}catch(u){c=Ui(u)}aH(t,{requestId:o.id,result:a,error:c})};return t.addEventListener("message",i),()=>t.removeEventListener("message",i)}return{addSocketMessageListener:e}}async function aH(t,e){const r={id:crypto.randomUUID(),type:oH,payload:e};t.send(JSON.stringify(r))}async function cH(t,e){const{timeoutMs:n}=e,r=e.errorMessage??`Timeout of ${n} ms exceeded`;if(n<=0||n===Number.POSITIVE_INFINITY)return t();const i=async()=>{await Ti(n);const s=typeof r=="function"?r():r;throw new uH(s)};return Promise.race([t(),i()])}class uH extends Error{constructor(e){super(e),this.name="TimeoutError"}}const{createMessageSender:lH}=ir(),dH=lH("ping");async function fH(t){try{return await dH(void 0,t),!0}catch{return!1}}const{addMessageListener:hH}=ir();async function pH(t){await fH(t)||await new Promise(e=>{const n=hH("ready",async(r,i)=>{var s;((s=i.tab)==null?void 0:s.id)===t&&(n(),e())})})}class TC extends Error{constructor(e){super(e),this.name="MissingTabPermission"}}const gH={BAD_CONNECTION:"Could not establish connection. Receiving end does not exist."};async function mH(t){const e=await chrome.tabs.get(t);if(!e.url)throw new Error("Unable to get tab URL");return e.url}async function vH(t){const e=await chrome.tabs.get(t);if(!e.title)throw new Error("Unable to get tab title");return e.title}const _H=30;async function hd(t,e={}){const{timeoutMs:n=_H*1e3}=e;await cH(async()=>{const i=await yH(t);if(!i.url)throw new TC("Unable to get tab URL");Og(i.url)&&await pH(t)},{timeoutMs:n,errorMessage:`Navigation timed out after ${n}ms`})}async function yH(t){return new Promise(e=>{async function n(r,i){if(r!==t||i.status!=="complete")return;chrome.tabs.onUpdated.removeListener(n);const s=await chrome.tabs.get(r);e(s)}chrome.tabs.onUpdated.addListener(n)})}async function IC(t){if(t===-1)return!1;const e=await chrome.tabs.get(t);return e.url?Og(e.url):!1}async function xC(t){try{return await chrome.tabs.get(t),!0}catch{return!1}}const RC={defaultWsPort:9009,errors:{noConnectedTab:"No tab is connected"}},pd=Ss.defineItem("local:selectedTabId",{fallback:null});async function gd(){const t=await pd.getValue();if(!t)throw new Error("No selected tab ID");return t}const bH=100;let Ao=[];function wH(){return Ao}function SH(){Ao=[]}function EH(){const t=async(e,n,r)=>{var s;const i=await gd();if(e.tabId===i){if(n==="Runtime.consoleAPICalled"){const{type:o,timestamp:a,args:c}=r,u=c.map(d=>kH(d)).join(" ");Ao.push({type:o,timestamp:a,message:u})}else if(n==="Runtime.exceptionThrown"){const{timestamp:o,exceptionDetails:a}=r;Ao.push({type:"exception",timestamp:o,message:((s=a.exception)==null?void 0:s.description)||JSON.stringify(a)})}Ao.length>bH&&Ao.shift()}};return chrome.debugger.onEvent.addListener(t),()=>{chrome.debugger.onEvent.removeListener(t)}}function kH(t){return typeof t.value<"u"?typeof t.value=="string"?t.value:JSON.stringify(t.value):typeof t.preview<"u"?JSON.stringify(t.preview):t.description||JSON.stringify(t)}const{createMessageSender:CH}=ir(),TH=CH("removeExtensionFrames"),IH={DIALOG_OPENED:"Page.javascriptDialogOpening"},md={NOT_ATTACHED:"Debugger is not attached to the tab with id",ALREADY_ATTACHED:"Another debugger is already attached to the tab with id",OTHER_EXTENSION:"Cannot access a chrome-extension:// URL of different extension",DEBUGGER_DETACHED:"Detached while handling command."};function vc(t){return t.includes(md.NOT_ATTACHED)?"notAttached":t.includes(md.ALREADY_ATTACHED)?"alreadyAttached":t===md.OTHER_EXTENSION?"otherExtension":t===md.DEBUGGER_DETACHED?"debuggerDetached":"unknown"}async function AC(t,e){const n=vc(t.message);if(n==="notAttached")await Dg(e,"1.3");else if(n!=="alreadyAttached")if(n==="otherExtension"||n==="debuggerDetached"){const{tabId:r}=e;if(!Lg(r))throw new Error("Unable to get tab id");await TH(void 0,r),await Dg(e,"1.3")}else{if(n==="unknown")throw t;Zj(n)}}async function _c(t){const e={tabId:t};try{await Dg(e,"1.3")}catch(n){if(!(n instanceof Error))throw n;await AC(n,e)}}async function xH(t){await RH({tabId:t})}async function Dg(t,e){try{await chrome.debugger.attach(t,e)}catch(n){const r=Ui(n);if(!(!!r&&vc(r)==="alreadyAttached"))throw n}}async function RH(t){try{await chrome.debugger.detach(t)}catch(e){const n=Ui(e);if(!(!!n&&(vc(n)==="notAttached"||vc(n)==="otherExtension")))throw e}}const pr=async(t,e,n)=>{try{return await chrome.debugger.sendCommand(t,e,n)}catch(r){if(!(r instanceof Error))throw r;if(await AC(r,t),!(vc(r.message)==="debuggerDetached"))return chrome.debugger.sendCommand(t,e,n)}};async function PC(t){await _c(t),await pr({tabId:t},"Runtime.enable")}async function AH(t){await xH(t)}chrome.tabs.onUpdated.addListener(async(t,e)=>{const n=await gd();t===n&&e.status==="complete"&&SH()});const{createMessageSender:MC}=ir(),OC=MC("setCursorPosition"),PH=MC("hideCursor");class LC{constructor(e,n){Sn(this,"_target");Sn(this,"_sendCommand");this._target=e,this._sendCommand=n}async send(e,...n){return this._sendCommand(this._target,e,...n)}}/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class MH{constructor(){}}const Bt=Object.freeze({Left:"left",Right:"right",Middle:"middle",Back:"back",Forward:"forward"});class OH{constructor(){}}/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/const DC={0:{keyCode:48,key:"0",code:"Digit0"},1:{keyCode:49,key:"1",code:"Digit1"},2:{keyCode:50,key:"2",code:"Digit2"},3:{keyCode:51,key:"3",code:"Digit3"},4:{keyCode:52,key:"4",code:"Digit4"},5:{keyCode:53,key:"5",code:"Digit5"},6:{keyCode:54,key:"6",code:"Digit6"},7:{keyCode:55,key:"7",code:"Digit7"},8:{keyCode:56,key:"8",code:"Digit8"},9:{keyCode:57,key:"9",code:"Digit9"},Power:{key:"Power",code:"Power"},Eject:{key:"Eject",code:"Eject"},Abort:{keyCode:3,code:"Abort",key:"Cancel"},Help:{keyCode:6,code:"Help",key:"Help"},Backspace:{keyCode:8,code:"Backspace",key:"Backspace"},Tab:{keyCode:9,code:"Tab",key:"Tab"},Numpad5:{keyCode:12,shiftKeyCode:101,key:"Clear",code:"Numpad5",shiftKey:"5",location:3},NumpadEnter:{keyCode:13,code:"NumpadEnter",key:"Enter",text:"\r",location:3},Enter:{keyCode:13,code:"Enter",key:"Enter",text:"\r"},"\r":{keyCode:13,code:"Enter",key:"Enter",text:"\r"},"\n":{keyCode:13,code:"Enter",key:"Enter",text:"\r"},ShiftLeft:{keyCode:16,code:"ShiftLeft",key:"Shift",location:1},ShiftRight:{keyCode:16,code:"ShiftRight",key:"Shift",location:2},ControlLeft:{keyCode:17,code:"ControlLeft",key:"Control",location:1},ControlRight:{keyCode:17,code:"ControlRight",key:"Control",location:2},AltLeft:{keyCode:18,code:"AltLeft",key:"Alt",location:1},AltRight:{keyCode:18,code:"AltRight",key:"Alt",location:2},Pause:{keyCode:19,code:"Pause",key:"Pause"},CapsLock:{keyCode:20,code:"CapsLock",key:"CapsLock"},Escape:{keyCode:27,code:"Escape",key:"Escape"},Convert:{keyCode:28,code:"Convert",key:"Convert"},NonConvert:{keyCode:29,code:"NonConvert",key:"NonConvert"},Space:{keyCode:32,code:"Space",key:" "},Numpad9:{keyCode:33,shiftKeyCode:105,key:"PageUp",code:"Numpad9",shiftKey:"9",location:3},PageUp:{keyCode:33,code:"PageUp",key:"PageUp"},Numpad3:{keyCode:34,shiftKeyCode:99,key:"PageDown",code:"Numpad3",shiftKey:"3",location:3},PageDown:{keyCode:34,code:"PageDown",key:"PageDown"},End:{keyCode:35,code:"End",key:"End"},Numpad1:{keyCode:35,shiftKeyCode:97,key:"End",code:"Numpad1",shiftKey:"1",location:3},Home:{keyCode:36,code:"Home",key:"Home"},Numpad7:{keyCode:36,shiftKeyCode:103,key:"Home",code:"Numpad7",shiftKey:"7",location:3},ArrowLeft:{keyCode:37,code:"ArrowLeft",key:"ArrowLeft"},Numpad4:{keyCode:37,shiftKeyCode:100,key:"ArrowLeft",code:"Numpad4",shiftKey:"4",location:3},Numpad8:{keyCode:38,shiftKeyCode:104,key:"ArrowUp",code:"Numpad8",shiftKey:"8",location:3},ArrowUp:{keyCode:38,code:"ArrowUp",key:"ArrowUp"},ArrowRight:{keyCode:39,code:"ArrowRight",key:"ArrowRight"},Numpad6:{keyCode:39,shiftKeyCode:102,key:"ArrowRight",code:"Numpad6",shiftKey:"6",location:3},Numpad2:{keyCode:40,shiftKeyCode:98,key:"ArrowDown",code:"Numpad2",shiftKey:"2",location:3},ArrowDown:{keyCode:40,code:"ArrowDown",key:"ArrowDown"},Select:{keyCode:41,code:"Select",key:"Select"},Open:{keyCode:43,code:"Open",key:"Execute"},PrintScreen:{keyCode:44,code:"PrintScreen",key:"PrintScreen"},Insert:{keyCode:45,code:"Insert",key:"Insert"},Numpad0:{keyCode:45,shiftKeyCode:96,key:"Insert",code:"Numpad0",shiftKey:"0",location:3},Delete:{keyCode:46,code:"Delete",key:"Delete"},NumpadDecimal:{keyCode:46,shiftKeyCode:110,code:"NumpadDecimal",key:"\0",shiftKey:".",location:3},Digit0:{keyCode:48,code:"Digit0",shiftKey:")",key:"0"},Digit1:{keyCode:49,code:"Digit1",shiftKey:"!",key:"1"},Digit2:{keyCode:50,code:"Digit2",shiftKey:"@",key:"2"},Digit3:{keyCode:51,code:"Digit3",shiftKey:"#",key:"3"},Digit4:{keyCode:52,code:"Digit4",shiftKey:"$",key:"4"},Digit5:{keyCode:53,code:"Digit5",shiftKey:"%",key:"5"},Digit6:{keyCode:54,code:"Digit6",shiftKey:"^",key:"6"},Digit7:{keyCode:55,code:"Digit7",shiftKey:"&",key:"7"},Digit8:{keyCode:56,code:"Digit8",shiftKey:"*",key:"8"},Digit9:{keyCode:57,code:"Digit9",shiftKey:"(",key:"9"},KeyA:{keyCode:65,code:"KeyA",shiftKey:"A",key:"a"},KeyB:{keyCode:66,code:"KeyB",shiftKey:"B",key:"b"},KeyC:{keyCode:67,code:"KeyC",shiftKey:"C",key:"c"},KeyD:{keyCode:68,code:"KeyD",shiftKey:"D",key:"d"},KeyE:{keyCode:69,code:"KeyE",shiftKey:"E",key:"e"},KeyF:{keyCode:70,code:"KeyF",shiftKey:"F",key:"f"},KeyG:{keyCode:71,code:"KeyG",shiftKey:"G",key:"g"},KeyH:{keyCode:72,code:"KeyH",shiftKey:"H",key:"h"},KeyI:{keyCode:73,code:"KeyI",shiftKey:"I",key:"i"},KeyJ:{keyCode:74,code:"KeyJ",shiftKey:"J",key:"j"},KeyK:{keyCode:75,code:"KeyK",shiftKey:"K",key:"k"},KeyL:{keyCode:76,code:"KeyL",shiftKey:"L",key:"l"},KeyM:{keyCode:77,code:"KeyM",shiftKey:"M",key:"m"},KeyN:{keyCode:78,code:"KeyN",shiftKey:"N",key:"n"},KeyO:{keyCode:79,code:"KeyO",shiftKey:"O",key:"o"},KeyP:{keyCode:80,code:"KeyP",shiftKey:"P",key:"p"},KeyQ:{keyCode:81,code:"KeyQ",shiftKey:"Q",key:"q"},KeyR:{keyCode:82,code:"KeyR",shiftKey:"R",key:"r"},KeyS:{keyCode:83,code:"KeyS",shiftKey:"S",key:"s"},KeyT:{keyCode:84,code:"KeyT",shiftKey:"T",key:"t"},KeyU:{keyCode:85,code:"KeyU",shiftKey:"U",key:"u"},KeyV:{keyCode:86,code:"KeyV",shiftKey:"V",key:"v"},KeyW:{keyCode:87,code:"KeyW",shiftKey:"W",key:"w"},KeyX:{keyCode:88,code:"KeyX",shiftKey:"X",key:"x"},KeyY:{keyCode:89,code:"KeyY",shiftKey:"Y",key:"y"},KeyZ:{keyCode:90,code:"KeyZ",shiftKey:"Z",key:"z"},MetaLeft:{keyCode:91,code:"MetaLeft",key:"Meta",location:1},MetaRight:{keyCode:92,code:"MetaRight",key:"Meta",location:2},ContextMenu:{keyCode:93,code:"ContextMenu",key:"ContextMenu"},NumpadMultiply:{keyCode:106,code:"NumpadMultiply",key:"*",location:3},NumpadAdd:{keyCode:107,code:"NumpadAdd",key:"+",location:3},NumpadSubtract:{keyCode:109,code:"NumpadSubtract",key:"-",location:3},NumpadDivide:{keyCode:111,code:"NumpadDivide",key:"/",location:3},F1:{keyCode:112,code:"F1",key:"F1"},F2:{keyCode:113,code:"F2",key:"F2"},F3:{keyCode:114,code:"F3",key:"F3"},F4:{keyCode:115,code:"F4",key:"F4"},F5:{keyCode:116,code:"F5",key:"F5"},F6:{keyCode:117,code:"F6",key:"F6"},F7:{keyCode:118,code:"F7",key:"F7"},F8:{keyCode:119,code:"F8",key:"F8"},F9:{keyCode:120,code:"F9",key:"F9"},F10:{keyCode:121,code:"F10",key:"F10"},F11:{keyCode:122,code:"F11",key:"F11"},F12:{keyCode:123,code:"F12",key:"F12"},F13:{keyCode:124,code:"F13",key:"F13"},F14:{keyCode:125,code:"F14",key:"F14"},F15:{keyCode:126,code:"F15",key:"F15"},F16:{keyCode:127,code:"F16",key:"F16"},F17:{keyCode:128,code:"F17",key:"F17"},F18:{keyCode:129,code:"F18",key:"F18"},F19:{keyCode:130,code:"F19",key:"F19"},F20:{keyCode:131,code:"F20",key:"F20"},F21:{keyCode:132,code:"F21",key:"F21"},F22:{keyCode:133,code:"F22",key:"F22"},F23:{keyCode:134,code:"F23",key:"F23"},F24:{keyCode:135,code:"F24",key:"F24"},NumLock:{keyCode:144,code:"NumLock",key:"NumLock"},ScrollLock:{keyCode:145,code:"ScrollLock",key:"ScrollLock"},AudioVolumeMute:{keyCode:173,code:"AudioVolumeMute",key:"AudioVolumeMute"},AudioVolumeDown:{keyCode:174,code:"AudioVolumeDown",key:"AudioVolumeDown"},AudioVolumeUp:{keyCode:175,code:"AudioVolumeUp",key:"AudioVolumeUp"},MediaTrackNext:{keyCode:176,code:"MediaTrackNext",key:"MediaTrackNext"},MediaTrackPrevious:{keyCode:177,code:"MediaTrackPrevious",key:"MediaTrackPrevious"},MediaStop:{keyCode:178,code:"MediaStop",key:"MediaStop"},MediaPlayPause:{keyCode:179,code:"MediaPlayPause",key:"MediaPlayPause"},Semicolon:{keyCode:186,code:"Semicolon",shiftKey:":",key:";"},Equal:{keyCode:187,code:"Equal",shiftKey:"+",key:"="},NumpadEqual:{keyCode:187,code:"NumpadEqual",key:"=",location:3},Comma:{keyCode:188,code:"Comma",shiftKey:"<",key:","},Minus:{keyCode:189,code:"Minus",shiftKey:"_",key:"-"},Period:{keyCode:190,code:"Period",shiftKey:">",key:"."},Slash:{keyCode:191,code:"Slash",shiftKey:"?",key:"/"},Backquote:{keyCode:192,code:"Backquote",shiftKey:"~",key:"`"},BracketLeft:{keyCode:219,code:"BracketLeft",shiftKey:"{",key:"["},Backslash:{keyCode:220,code:"Backslash",shiftKey:"|",key:"\\"},BracketRight:{keyCode:221,code:"BracketRight",shiftKey:"}",key:"]"},Quote:{keyCode:222,code:"Quote",shiftKey:'"',key:"'"},AltGraph:{keyCode:225,code:"AltGraph",key:"AltGraph"},Props:{keyCode:247,code:"Props",key:"CrSel"},Cancel:{keyCode:3,key:"Cancel",code:"Abort"},Clear:{keyCode:12,key:"Clear",code:"Numpad5",location:3},Shift:{keyCode:16,key:"Shift",code:"ShiftLeft",location:1},Control:{keyCode:17,key:"Control",code:"ControlLeft",location:1},Alt:{keyCode:18,key:"Alt",code:"AltLeft",location:1},Accept:{keyCode:30,key:"Accept"},ModeChange:{keyCode:31,key:"ModeChange"}," ":{keyCode:32,key:" ",code:"Space"},Print:{keyCode:42,key:"Print"},Execute:{keyCode:43,key:"Execute",code:"Open"},"\0":{keyCode:46,key:"\0",code:"NumpadDecimal",location:3},a:{keyCode:65,key:"a",code:"KeyA"},b:{keyCode:66,key:"b",code:"KeyB"},c:{keyCode:67,key:"c",code:"KeyC"},d:{keyCode:68,key:"d",code:"KeyD"},e:{keyCode:69,key:"e",code:"KeyE"},f:{keyCode:70,key:"f",code:"KeyF"},g:{keyCode:71,key:"g",code:"KeyG"},h:{keyCode:72,key:"h",code:"KeyH"},i:{keyCode:73,key:"i",code:"KeyI"},j:{keyCode:74,key:"j",code:"KeyJ"},k:{keyCode:75,key:"k",code:"KeyK"},l:{keyCode:76,key:"l",code:"KeyL"},m:{keyCode:77,key:"m",code:"KeyM"},n:{keyCode:78,key:"n",code:"KeyN"},o:{keyCode:79,key:"o",code:"KeyO"},p:{keyCode:80,key:"p",code:"KeyP"},q:{keyCode:81,key:"q",code:"KeyQ"},r:{keyCode:82,key:"r",code:"KeyR"},s:{keyCode:83,key:"s",code:"KeyS"},t:{keyCode:84,key:"t",code:"KeyT"},u:{keyCode:85,key:"u",code:"KeyU"},v:{keyCode:86,key:"v",code:"KeyV"},w:{keyCode:87,key:"w",code:"KeyW"},x:{keyCode:88,key:"x",code:"KeyX"},y:{keyCode:89,key:"y",code:"KeyY"},z:{keyCode:90,key:"z",code:"KeyZ"},Meta:{keyCode:91,key:"Meta",code:"MetaLeft",location:1},"*":{keyCode:106,key:"*",code:"NumpadMultiply",location:3},"+":{keyCode:107,key:"+",code:"NumpadAdd",location:3},"-":{keyCode:109,key:"-",code:"NumpadSubtract",location:3},"/":{keyCode:111,key:"/",code:"NumpadDivide",location:3},";":{keyCode:186,key:";",code:"Semicolon"},"=":{keyCode:187,key:"=",code:"Equal"},",":{keyCode:188,key:",",code:"Comma"},".":{keyCode:190,key:".",code:"Period"},"`":{keyCode:192,key:"`",code:"Backquote"},"[":{keyCode:219,key:"[",code:"BracketLeft"},"\\":{keyCode:220,key:"\\",code:"Backslash"},"]":{keyCode:221,key:"]",code:"BracketRight"},"'":{keyCode:222,key:"'",code:"Quote"},Attn:{keyCode:246,key:"Attn"},CrSel:{keyCode:247,key:"CrSel",code:"Props"},ExSel:{keyCode:248,key:"ExSel"},EraseEof:{keyCode:249,key:"EraseEof"},Play:{keyCode:250,key:"Play"},ZoomOut:{keyCode:251,key:"ZoomOut"},")":{keyCode:48,key:")",code:"Digit0"},"!":{keyCode:49,key:"!",code:"Digit1"},"@":{keyCode:50,key:"@",code:"Digit2"},"#":{keyCode:51,key:"#",code:"Digit3"},$:{keyCode:52,key:"$",code:"Digit4"},"%":{keyCode:53,key:"%",code:"Digit5"},"^":{keyCode:54,key:"^",code:"Digit6"},"&":{keyCode:55,key:"&",code:"Digit7"},"(":{keyCode:57,key:"(",code:"Digit9"},A:{keyCode:65,key:"A",code:"KeyA"},B:{keyCode:66,key:"B",code:"KeyB"},C:{keyCode:67,key:"C",code:"KeyC"},D:{keyCode:68,key:"D",code:"KeyD"},E:{keyCode:69,key:"E",code:"KeyE"},F:{keyCode:70,key:"F",code:"KeyF"},G:{keyCode:71,key:"G",code:"KeyG"},H:{keyCode:72,key:"H",code:"KeyH"},I:{keyCode:73,key:"I",code:"KeyI"},J:{keyCode:74,key:"J",code:"KeyJ"},K:{keyCode:75,key:"K",code:"KeyK"},L:{keyCode:76,key:"L",code:"KeyL"},M:{keyCode:77,key:"M",code:"KeyM"},N:{keyCode:78,key:"N",code:"KeyN"},O:{keyCode:79,key:"O",code:"KeyO"},P:{keyCode:80,key:"P",code:"KeyP"},Q:{keyCode:81,key:"Q",code:"KeyQ"},R:{keyCode:82,key:"R",code:"KeyR"},S:{keyCode:83,key:"S",code:"KeyS"},T:{keyCode:84,key:"T",code:"KeyT"},U:{keyCode:85,key:"U",code:"KeyU"},V:{keyCode:86,key:"V",code:"KeyV"},W:{keyCode:87,key:"W",code:"KeyW"},X:{keyCode:88,key:"X",code:"KeyX"},Y:{keyCode:89,key:"Y",code:"KeyY"},Z:{keyCode:90,key:"Z",code:"KeyZ"},":":{keyCode:186,key:":",code:"Semicolon"},"<":{keyCode:188,key:"<",code:"Comma"},_:{keyCode:189,key:"_",code:"Minus"},">":{keyCode:190,key:">",code:"Period"},"?":{keyCode:191,key:"?",code:"Slash"},"~":{keyCode:192,key:"~",code:"Backquote"},"{":{keyCode:219,key:"{",code:"BracketLeft"},"|":{keyCode:220,key:"|",code:"Backslash"},"}":{keyCode:221,key:"}",code:"BracketRight"},'"':{keyCode:222,key:'"',code:"Quote"},SoftLeft:{key:"SoftLeft",code:"SoftLeft",location:4},SoftRight:{key:"SoftRight",code:"SoftRight",location:4},Camera:{keyCode:44,key:"Camera",code:"Camera",location:4},Call:{key:"Call",code:"Call",location:4},EndCall:{keyCode:95,key:"EndCall",code:"EndCall",location:4},VolumeDown:{keyCode:182,key:"VolumeDown",code:"VolumeDown",location:4},VolumeUp:{keyCode:183,key:"VolumeUp",code:"VolumeUp",location:4}},LH=(t,e)=>{if(!t)throw new Error(e)};/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class NC extends MH{constructor(n){super();Me(this,Oi);Me(this,Mi);Me(this,Ho,new Set);Sn(this,"_modifiers",0);ve(this,Mi,n)}updateClient(n){ve(this,Mi,n)}async down(n,r={text:void 0,commands:[]}){const i=st(this,Oi,jg).call(this,n),s=A(this,Ho).has(i.code);A(this,Ho).add(i.code),this._modifiers|=st(this,Oi,Bg).call(this,i.key);const o=r.text===void 0?i.text:r.text;await A(this,Mi).send("Input.dispatchKeyEvent",{type:o?"keyDown":"rawKeyDown",modifiers:this._modifiers,windowsVirtualKeyCode:i.keyCode,code:i.code,key:i.key,text:o,unmodifiedText:o,autoRepeat:s,location:i.location,isKeypad:i.location===3,commands:r.commands})}async up(n){const r=st(this,Oi,jg).call(this,n);this._modifiers&=~st(this,Oi,Bg).call(this,r.key),A(this,Ho).delete(r.code),await A(this,Mi).send("Input.dispatchKeyEvent",{type:"keyUp",modifiers:this._modifiers,key:r.key,windowsVirtualKeyCode:r.keyCode,code:r.code,location:r.location})}async sendCharacter(n){await A(this,Mi).send("Input.insertText",{text:n})}charIsKey(n){return!!DC[n]}async type(n,r={}){const i=r.delay||void 0;for(const s of n)this.charIsKey(s)?await this.press(s,{delay:i}):(i&&await new Promise(o=>setTimeout(o,i)),await this.sendCharacter(s))}async press(n,r={}){const{delay:i=null}=r;await this.down(n,r),i&&await new Promise(s=>setTimeout(s,r.delay)),await this.up(n)}}Mi=new WeakMap,Ho=new WeakMap,Oi=new WeakSet,Bg=function(n){return n==="Alt"?1:n==="Control"?2:n==="Meta"?4:n==="Shift"?8:0},jg=function(n){const r=this._modifiers&8,i={key:"",keyCode:0,code:"",text:"",location:0},s=DC[n];return LH(s,`Unknown key: "${n}"`),s.key&&(i.key=s.key),r&&s.shiftKey&&(i.key=s.shiftKey),s.keyCode&&(i.keyCode=s.keyCode),r&&s.shiftKeyCode&&(i.keyCode=s.shiftKeyCode),s.code&&(i.code=s.code),s.location&&(i.location=s.location),i.key.length===1&&(i.text=i.key),s.text&&(i.text=s.text),r&&s.shiftText&&(i.text=s.shiftText),this._modifiers&-9&&(i.text=""),i};const FC=t=>{switch(t){case Bt.Left:return 1;case Bt.Right:return 2;case Bt.Middle:return 4;case Bt.Back:return 8;case Bt.Forward:return 16}},DH=t=>t&1?Bt.Left:t&2?Bt.Right:t&4?Bt.Middle:t&8?Bt.Back:t&16?Bt.Forward:"none";class $C extends OH{constructor(n,r){super();Me(this,vt);Me(this,Nn);Me(this,Qn);Me(this,qo,{position:{x:0,y:0},buttons:0});Me(this,ws,[]);ve(this,Nn,n),ve(this,Qn,r)}updateClient(n){ve(this,Nn,n)}async reset(){const n=[];for(const[r,i]of[[1,Bt.Left],[4,Bt.Middle],[2,Bt.Right],[16,Bt.Forward],[8,Bt.Back]])A(this,vt,En).buttons&r&&n.push(this.up({button:i}));(A(this,vt,En).position.x!==0||A(this,vt,En).position.y!==0)&&n.push(this.move(0,0)),await Promise.all(n)}async move(n,r,i={}){const{steps:s=1}=i,o=A(this,vt,En).position,a={x:n,y:r};for(let c=1;c<=s;c++)await st(this,vt,wd).call(this,u=>{u({position:{x:o.x+(a.x-o.x)*(c/s),y:o.y+(a.y-o.y)*(c/s)}});const{buttons:d,position:l}=A(this,vt,En);return A(this,Nn).send("Input.dispatchMouseEvent",{type:"mouseMoved",modifiers:A(this,Qn)._modifiers,buttons:d,button:DH(d),...l})})}async down(n={}){const{button:r=Bt.Left,clickCount:i=1}=n,s=FC(r);if(!s)throw new Error(`Unsupported mouse button: ${r}`);if(A(this,vt,En).buttons&s)throw new Error(`'${r}' is already pressed.`);await st(this,vt,wd).call(this,o=>{o({buttons:A(this,vt,En).buttons|s});const{buttons:a,position:c}=A(this,vt,En);return A(this,Nn).send("Input.dispatchMouseEvent",{type:"mousePressed",modifiers:A(this,Qn)._modifiers,clickCount:i,buttons:a,button:r,...c})})}async up(n={}){const{button:r=Bt.Left,clickCount:i=1}=n,s=FC(r);if(!s)throw new Error(`Unsupported mouse button: ${r}`);if(!(A(this,vt,En).buttons&s))throw new Error(`'${r}' is not pressed.`);await st(this,vt,wd).call(this,o=>{o({buttons:A(this,vt,En).buttons&~s});const{buttons:a,position:c}=A(this,vt,En);return A(this,Nn).send("Input.dispatchMouseEvent",{type:"mouseReleased",modifiers:A(this,Qn)._modifiers,clickCount:i,buttons:a,button:r,...c})})}async click(n,r,i={}){const{delay:s,count:o=1,clickCount:a=o}=i;if(o<1)throw new Error("Click must occur a positive number of times.");const c=[this.move(n,r)];if(a===o)for(let u=1;u<o;++u)c.push(this.down({...i,clickCount:u}),this.up({...i,clickCount:u}));c.push(this.down({...i,clickCount:a})),typeof s=="number"&&(await Promise.all(c),c.length=0,await new Promise(u=>{setTimeout(u,s)})),c.push(this.up({...i,clickCount:a})),await Promise.all(c)}async wheel(n={}){const{deltaX:r=0,deltaY:i=0}=n,{position:s,buttons:o}=A(this,vt,En);await A(this,Nn).send("Input.dispatchMouseEvent",{type:"mouseWheel",pointerType:"mouse",modifiers:A(this,Qn)._modifiers,deltaY:i,deltaX:r,buttons:o,...s})}async drag(n,r){const i=new Promise(s=>{s({})});return await this.move(n.x,n.y),await this.down(),await this.move(r.x,r.y),await i}async dragEnter(n,r){await A(this,Nn).send("Input.dispatchDragEvent",{type:"dragEnter",x:n.x,y:n.y,modifiers:A(this,Qn)._modifiers,data:r})}async dragOver(n,r){await A(this,Nn).send("Input.dispatchDragEvent",{type:"dragOver",x:n.x,y:n.y,modifiers:A(this,Qn)._modifiers,data:r})}async drop(n,r){await A(this,Nn).send("Input.dispatchDragEvent",{type:"drop",x:n.x,y:n.y,modifiers:A(this,Qn)._modifiers,data:r})}async dragAndDrop(n,r,i={}){const{delay:s=null}=i,o=await this.drag(n,r);await this.dragEnter(r,o),await this.dragOver(r,o),s&&await new Promise(a=>setTimeout(a,s)),await this.drop(r,o),await this.up()}}Nn=new WeakMap,Qn=new WeakMap,qo=new WeakMap,vt=new WeakSet,En=function(){return Object.assign({...A(this,qo)},...A(this,ws))},ws=new WeakMap,uT=function(){const n={};A(this,ws).push(n);const r=()=>{A(this,ws).splice(A(this,ws).indexOf(n),1)};return{update:i=>{Object.assign(n,i)},commit:()=>{ve(this,qo,{...A(this,qo),...n}),r()},rollback:r}},wd=async function(n){const{update:r,commit:i,rollback:s}=st(this,vt,uT).call(this);try{await n(r),i()}catch(o){throw s(),o}};class NH{constructor(e){Sn(this,"tabId");Sn(this,"debuggee");Sn(this,"mouse");Sn(this,"keyboard");this.tabId=e,this.debuggee={tabId:e};const n=new LC(this.debuggee,pr);this.keyboard=new NC(n),this.mouse=new $C(n,this.keyboard)}async attachDebugger(){await _c(this.tabId)}async moveMouse(e){await this.attachDebugger();const{x:n,y:r}=await yc(this.tabId,e);await this.mouse.move(n,r)}async click(e,n){await this.attachDebugger();const{x:r,y:i}=await yc(this.tabId,e);await this.mouse.click(r,i,n)}async wheel({deltaX:e,deltaY:n}){await this.attachDebugger(),await this.mouse.wheel({deltaX:e,deltaY:n})}async dragAndDrop(e,n){await this.attachDebugger();const{x:r,y:i}=await yc(this.tabId,e),{x:s,y:o}=await yc(this.tabId,n);await this.mouse.move(r,i),await this.mouse.down(),await this.mouse.move(s,o),await this.mouse.up()}async resetMouseCoordinates(){await this.attachDebugger(),await this.mouse.move(-1,-1)}async hover(e){await this.attachDebugger();const{x:n,y:r}=await yc(this.tabId,e);await this.mouse.move(n,r)}async fill(e){await this.attachDebugger(),await pr(this.debuggee,"Input.insertText",{text:e})}async type(e){await this.attachDebugger(),await this.keyboard.type(e)}async pressKey(e){await this.attachDebugger();const n=e.split("+");for(const i of n)await this.keyboard.down(i);const r=[...n].reverse();for(const i of r)await this.keyboard.up(i)}async waitForDialog(){return new Promise(e=>{const n=async(r,i)=>{r.tabId!==this.tabId||i!==IH.DIALOG_OPENED||(chrome.debugger.onEvent.removeListener(n),e())};chrome.debugger.onEvent.addListener(n)})}async acceptDialog(e){await this.attachDebugger(),await pr(this.debuggee,"Page.handleJavaScriptDialog",{accept:!0,promptText:e})}async dismissDialog(){await this.attachDebugger(),await pr(this.debuggee,"Page.handleJavaScriptDialog",{accept:!1})}}async function yc(t,e){const n=await FH(t);return{x:e.x*n,y:e.y*n}}async function FH(t){const e={tabId:t},{visualViewport:n}=await pr(e,"Page.getLayoutMetrics"),{zoom:r}=n;return r??1}const{createMessageSender:bc}=ir(),$H=bc("getSelectorForCoordinates"),UH=bc("selectText"),BH=bc("waitForStableDOM"),jH=bc("getInputType"),HH=bc("setInputValue");class qH{constructor(e){Sn(this,"tabId");Sn(this,"input");this.tabId=e,this.input=new NH(e)}async moveMouse(e){await this.input.moveMouse(e),await Ti(1e3)}async click(e,n){await this.moveMouse(e),await this.waitForTabIfNavigationStarted(async()=>{await this.input.click(e,n),await Ti(1e3)})}async scroll({viewportCoord:e,deltaX:n,deltaY:r}){await this.moveMouse(e),await this.input.wheel({deltaX:n,deltaY:r})}async drag({startViewportCoord:e,endViewportCoord:n}){await this.moveMouse(e),await this.input.dragAndDrop(e,n)}async pressKey(e){e==="Enter"?await this.waitForTabIfNavigationStarted(async()=>{await this.input.pressKey(e),await Ti(1e3)}):(await this.input.pressKey(e),e==="PageDown"&&await Ti(1e3))}async type(e,n){if(n){const r=await jH({selector:n},this.tabId);zH(r)?await HH({selector:n,value:e},this.tabId):(await UH({selector:n},this.tabId),await this.input.pressKey("Backspace"))}await this.input.type(e)}async holdKey({keyCombo:e,durationSeconds:n}){await this.input.attachDebugger();const r=e.split("+");for(const s of r)await this.input.keyboard.down(s);await Ti(n*1e3);const i=[...r].reverse();for(const s of i)await this.input.keyboard.up(s)}async waitForTabIfNavigationStarted(e){let n=null;const r=i=>{i.tabId!==this.tabId||i.frameId!==0||(n=(async()=>{await hd(this.tabId),await IC(this.tabId)&&await this.input.moveMouse({x:-1,y:-1})})())};chrome.webNavigation.onBeforeNavigate.addListener(r),await e(),chrome.webNavigation.onBeforeNavigate.removeListener(r),await n}}const WH=H.enum(["color","date","time","datetime-local","month","range","week"]);function zH(t){return!!t&&WH.options.includes(t)}const VH=3e3;class KH extends qH{constructor(n){super(n);Sn(this,"cursorPosition");Sn(this,"hideCursorTimeoutId");this.cursorPosition={x:-1,y:-1},this.hideCursorTimeoutId=void 0}async moveMouse(n){this.hideCursorTimeoutId&&(globalThis.clearTimeout(this.hideCursorTimeoutId),this.hideCursorTimeoutId=void 0),!(this.cursorPosition.x===n.x&&this.cursorPosition.y===n.y)&&(this.cursorPosition=n,await OC(n,this.tabId),await Ti(1e3),await super.moveMouse(n))}async click(n,r){await super.click(n,r),this.hideCursor()}async scroll({viewportCoord:n,deltaX:r,deltaY:i}){await super.scroll({viewportCoord:n,deltaX:r,deltaY:i}),this.hideCursor()}async drag({startViewportCoord:n,endViewportCoord:r}){await super.drag({startViewportCoord:n,endViewportCoord:r}),this.cursorPosition=r,await OC(r,this.tabId),this.hideCursor()}async type(n,r){let i=r;i||(i=await $H({coordinates:this.cursorPosition,targetOptions:{editable:!0}},this.tabId)??void 0),await super.type(n,i)}hideCursor(){const n=globalThis.setTimeout(()=>{PH(void 0,this.tabId)},VH);this.hideCursorTimeoutId=n}}async function GH(t,e){const n=await chrome.tabs.get(e);if(!n.url)throw new TC("Unable to get current URL for tab");const r=n.url===t?chrome.tabs.reload(e):chrome.tabs.update(e,{url:t});await Promise.all([hd(e,{timeoutMs:0}),r]),await Ng(e)}async function YH(t){await Promise.all([hd(t,{timeoutMs:0}),chrome.tabs.goBack(t)]),await Ng(t)}async function ZH(t){await Promise.all([hd(t,{timeoutMs:0}),chrome.tabs.goForward(t)]),await Ng(t)}async function Ng(t){await IC(t)&&await XH(t)}async function XH(t){await _c(t);const e={tabId:t},n=new LC(e,pr),r=new NC(n);await new $C(n,r).move(-1,-1)}const UC=t=>{let e;const n=new Set,r=(u,d)=>{const l=typeof u=="function"?u(e):u;if(!Object.is(l,e)){const h=e;e=d??(typeof l!="object"||l===null)?l:Object.assign({},e,l),n.forEach(f=>f(e,h))}},i=()=>e,a={setState:r,getState:i,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u))},c=e=t(r,i,a);return a},JH=t=>t?UC(t):UC,QH=t=>t;function eq(t,e=QH){const n=am.useSyncExternalStore(t.subscribe,()=>e(t.getState()),()=>e(t.getInitialState()));return am.useDebugValue(n),n}const BC=t=>{const e=JH(t),n=r=>eq(e,r);return Object.assign(n,e),n},tq=(t=>t?BC(t):BC)(t=>({viewportSizeOnScreenshot:{width:-1,height:-1},setViewportSizeOnScreenshot:e=>t({viewportSizeOnScreenshot:e})}));var vd={exports:{}};/* @license
Papa Parse
v5.5.2
https://github.com/mholt/PapaParse
License: MIT
*/var nq=vd.exports,jC;function rq(){return jC||(jC=1,function(t,e){((n,r)=>{t.exports=r()})(nq,function n(){var r=typeof self<"u"?self:typeof window<"u"?window:r!==void 0?r:{},i,s=!r.document&&!!r.postMessage,o=r.IS_PAPA_WORKER||!1,a={},c=0,u={};function d(y){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(b){var k=C(b);k.chunkSize=parseInt(k.chunkSize),b.step||b.chunk||(k.chunkSize=null),this._handle=new g(k),(this._handle.streamer=this)._config=k}).call(this,y),this.parseChunk=function(b,k){var x=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<x){let F=this._config.newline;F||(R=this._config.quoteChar||'"',F=this._handle.guessLineEndings(b,R)),b=[...b.split(F).slice(x)].join(F)}this.isFirstChunk&&I(this._config.beforeFirstChunk)&&(R=this._config.beforeFirstChunk(b))!==void 0&&(b=R),this.isFirstChunk=!1,this._halted=!1;var x=this._partialLine+b,R=(this._partialLine="",this._handle.parse(x,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(b=R.meta.cursor,x=(this._finished||(this._partialLine=x.substring(b-this._baseIndex),this._baseIndex=b),R&&R.data&&(this._rowCount+=R.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),o)r.postMessage({results:R,workerId:u.WORKER_ID,finished:x});else if(I(this._config.chunk)&&!k){if(this._config.chunk(R,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=R=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(R.data),this._completeResults.errors=this._completeResults.errors.concat(R.errors),this._completeResults.meta=R.meta),this._completed||!x||!I(this._config.complete)||R&&R.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),x||R&&R.meta.paused||this._nextChunk(),R}this._halted=!0},this._sendError=function(b){I(this._config.error)?this._config.error(b):o&&this._config.error&&r.postMessage({workerId:u.WORKER_ID,error:b,finished:!1})}}function l(y){var b;(y=y||{}).chunkSize||(y.chunkSize=u.RemoteChunkSize),d.call(this,y),this._nextChunk=s?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(k){this._input=k,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(b=new XMLHttpRequest,this._config.withCredentials&&(b.withCredentials=this._config.withCredentials),s||(b.onload=E(this._chunkLoaded,this),b.onerror=E(this._chunkError,this)),b.open(this._config.downloadRequestBody?"POST":"GET",this._input,!s),this._config.downloadRequestHeaders){var k,x=this._config.downloadRequestHeaders;for(k in x)b.setRequestHeader(k,x[k])}var R;this._config.chunkSize&&(R=this._start+this._config.chunkSize-1,b.setRequestHeader("Range","bytes="+this._start+"-"+R));try{b.send(this._config.downloadRequestBody)}catch(F){this._chunkError(F.message)}s&&b.status===0&&this._chunkError()}},this._chunkLoaded=function(){b.readyState===4&&(b.status<200||400<=b.status?this._chunkError():(this._start+=this._config.chunkSize||b.responseText.length,this._finished=!this._config.chunkSize||this._start>=(k=>(k=k.getResponseHeader("Content-Range"))!==null?parseInt(k.substring(k.lastIndexOf("/")+1)):-1)(b),this.parseChunk(b.responseText)))},this._chunkError=function(k){k=b.statusText||k,this._sendError(new Error(k))}}function h(y){(y=y||{}).chunkSize||(y.chunkSize=u.LocalChunkSize),d.call(this,y);var b,k,x=typeof FileReader<"u";this.stream=function(R){this._input=R,k=R.slice||R.webkitSlice||R.mozSlice,x?((b=new FileReader).onload=E(this._chunkLoaded,this),b.onerror=E(this._chunkError,this)):b=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var R=this._input,F=(this._config.chunkSize&&(F=Math.min(this._start+this._config.chunkSize,this._input.size),R=k.call(R,this._start,F)),b.readAsText(R,this._config.encoding));x||this._chunkLoaded({target:{result:F}})},this._chunkLoaded=function(R){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(R.target.result)},this._chunkError=function(){this._sendError(b.error)}}function f(y){var b;d.call(this,y=y||{}),this.stream=function(k){return b=k,this._nextChunk()},this._nextChunk=function(){var k,x;if(!this._finished)return k=this._config.chunkSize,b=k?(x=b.substring(0,k),b.substring(k)):(x=b,""),this._finished=!b,this.parseChunk(x)}}function p(y){d.call(this,y=y||{});var b=[],k=!0,x=!1;this.pause=function(){d.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){d.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(R){this._input=R,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){x&&b.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),b.length?this.parseChunk(b.shift()):k=!0},this._streamData=E(function(R){try{b.push(typeof R=="string"?R:R.toString(this._config.encoding)),k&&(k=!1,this._checkIsFinished(),this.parseChunk(b.shift()))}catch(F){this._streamError(F)}},this),this._streamError=E(function(R){this._streamCleanUp(),this._sendError(R)},this),this._streamEnd=E(function(){this._streamCleanUp(),x=!0,this._streamData("")},this),this._streamCleanUp=E(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function g(y){var b,k,x,R,F=Math.pow(2,53),z=-F,J=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,U=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,q=this,V=0,j=0,S=!1,P=!1,N=[],O={data:[],errors:[],meta:{}};function W(ee){return y.skipEmptyLines==="greedy"?ee.join("").trim()==="":ee.length===1&&ee[0].length===0}function te(){if(O&&x&&(Ue("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),x=!1),y.skipEmptyLines&&(O.data=O.data.filter(function(le){return!W(le)})),K()){let le=function(ue,Ce){I(y.transformHeader)&&(ue=y.transformHeader(ue,Ce)),N.push(ue)};if(O)if(Array.isArray(O.data[0])){for(var ee=0;K()&&ee<O.data.length;ee++)O.data[ee].forEach(le);O.data.splice(0,1)}else O.data.forEach(le)}function Se(le,ue){for(var Ce=y.header?{}:[],pe=0;pe<le.length;pe++){var fe=pe,ne=le[pe],ne=((We,ge)=>(ze=>(y.dynamicTypingFunction&&y.dynamicTyping[ze]===void 0&&(y.dynamicTyping[ze]=y.dynamicTypingFunction(ze)),(y.dynamicTyping[ze]||y.dynamicTyping)===!0))(We)?ge==="true"||ge==="TRUE"||ge!=="false"&&ge!=="FALSE"&&((ze=>{if(J.test(ze)&&(ze=parseFloat(ze),z<ze&&ze<F))return 1})(ge)?parseFloat(ge):U.test(ge)?new Date(ge):ge===""?null:ge):ge)(fe=y.header?pe>=N.length?"__parsed_extra":N[pe]:fe,ne=y.transform?y.transform(ne,fe):ne);fe==="__parsed_extra"?(Ce[fe]=Ce[fe]||[],Ce[fe].push(ne)):Ce[fe]=ne}return y.header&&(pe>N.length?Ue("FieldMismatch","TooManyFields","Too many fields: expected "+N.length+" fields but parsed "+pe,j+ue):pe<N.length&&Ue("FieldMismatch","TooFewFields","Too few fields: expected "+N.length+" fields but parsed "+pe,j+ue)),Ce}var be;O&&(y.header||y.dynamicTyping||y.transform)&&(be=1,!O.data.length||Array.isArray(O.data[0])?(O.data=O.data.map(Se),be=O.data.length):O.data=Se(O.data,0),y.header&&O.meta&&(O.meta.fields=N),j+=be)}function K(){return y.header&&N.length===0}function Ue(ee,Se,be,le){ee={type:ee,code:Se,message:be},le!==void 0&&(ee.row=le),O.errors.push(ee)}I(y.step)&&(R=y.step,y.step=function(ee){O=ee,K()?te():(te(),O.data.length!==0&&(V+=ee.data.length,y.preview&&V>y.preview?k.abort():(O.data=O.data[0],R(O,q))))}),this.parse=function(ee,Se,be){var le=y.quoteChar||'"',le=(y.newline||(y.newline=this.guessLineEndings(ee,le)),x=!1,y.delimiter?I(y.delimiter)&&(y.delimiter=y.delimiter(ee),O.meta.delimiter=y.delimiter):((le=((ue,Ce,pe,fe,ne)=>{var We,ge,ze,Pe;ne=ne||[","," ","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var Ot=0;Ot<ne.length;Ot++){for(var Ee,Lt=ne[Ot],Je=0,Ne=0,pt=0,pn=(ze=void 0,new m({comments:fe,delimiter:Lt,newline:Ce,preview:10}).parse(ue)),Zr=0;Zr<pn.data.length;Zr++)pe&&W(pn.data[Zr])?pt++:(Ee=pn.data[Zr].length,Ne+=Ee,ze===void 0?ze=Ee:0<Ee&&(Je+=Math.abs(Ee-ze),ze=Ee));0<pn.data.length&&(Ne/=pn.data.length-pt),(ge===void 0||Je<=ge)&&(Pe===void 0||Pe<Ne)&&1.99<Ne&&(ge=Je,We=Lt,Pe=Ne)}return{successful:!!(y.delimiter=We),bestDelimiter:We}})(ee,y.newline,y.skipEmptyLines,y.comments,y.delimitersToGuess)).successful?y.delimiter=le.bestDelimiter:(x=!0,y.delimiter=u.DefaultDelimiter),O.meta.delimiter=y.delimiter),C(y));return y.preview&&y.header&&le.preview++,b=ee,k=new m(le),O=k.parse(b,Se,be),te(),S?{meta:{paused:!0}}:O||{meta:{paused:!1}}},this.paused=function(){return S},this.pause=function(){S=!0,k.abort(),b=I(y.chunk)?"":b.substring(k.getCharIndex())},this.resume=function(){q.streamer._halted?(S=!1,q.streamer.parseChunk(b,!0)):setTimeout(q.resume,3)},this.aborted=function(){return P},this.abort=function(){P=!0,k.abort(),O.meta.aborted=!0,I(y.complete)&&y.complete(O),b=""},this.guessLineEndings=function(ue,le){ue=ue.substring(0,1048576);var le=new RegExp(v(le)+"([^]*?)"+v(le),"gm"),be=(ue=ue.replace(le,"")).split("\r"),le=ue.split(`
`),ue=1<le.length&&le[0].length<be[0].length;if(be.length===1||ue)return`
`;for(var Ce=0,pe=0;pe<be.length;pe++)be[pe][0]===`
`&&Ce++;return Ce>=be.length/2?`\r
`:"\r"}}function v(y){return y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(y){var b=(y=y||{}).delimiter,k=y.newline,x=y.comments,R=y.step,F=y.preview,z=y.fastMode,J=null,U=!1,q=y.quoteChar==null?'"':y.quoteChar,V=q;if(y.escapeChar!==void 0&&(V=y.escapeChar),(typeof b!="string"||-1<u.BAD_DELIMITERS.indexOf(b))&&(b=","),x===b)throw new Error("Comment character same as delimiter");x===!0?x="#":(typeof x!="string"||-1<u.BAD_DELIMITERS.indexOf(x))&&(x=!1),k!==`
`&&k!=="\r"&&k!==`\r
`&&(k=`
`);var j=0,S=!1;this.parse=function(P,N,O){if(typeof P!="string")throw new Error("Input must be a string");var W=P.length,te=b.length,K=k.length,Ue=x.length,ee=I(R),Se=[],be=[],le=[],ue=j=0;if(!P)return Je();if(z||z!==!1&&P.indexOf(q)===-1){for(var Ce=P.split(k),pe=0;pe<Ce.length;pe++){if(le=Ce[pe],j+=le.length,pe!==Ce.length-1)j+=k.length;else if(O)return Je();if(!x||le.substring(0,Ue)!==x){if(ee){if(Se=[],Pe(le.split(b)),Ne(),S)return Je()}else Pe(le.split(b));if(F&&F<=pe)return Se=Se.slice(0,F),Je(!0)}}return Je()}for(var fe=P.indexOf(b,j),ne=P.indexOf(k,j),We=new RegExp(v(V)+v(q),"g"),ge=P.indexOf(q,j);;)if(P[j]===q)for(ge=j,j++;;){if((ge=P.indexOf(q,ge+1))===-1)return O||be.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Se.length,index:j}),Ee();if(ge===W-1)return Ee(P.substring(j,ge).replace(We,q));if(q===V&&P[ge+1]===V)ge++;else if(q===V||ge===0||P[ge-1]!==V){fe!==-1&&fe<ge+1&&(fe=P.indexOf(b,ge+1));var ze=Ot((ne=ne!==-1&&ne<ge+1?P.indexOf(k,ge+1):ne)===-1?fe:Math.min(fe,ne));if(P.substr(ge+1+ze,te)===b){le.push(P.substring(j,ge).replace(We,q)),P[j=ge+1+ze+te]!==q&&(ge=P.indexOf(q,j)),fe=P.indexOf(b,j),ne=P.indexOf(k,j);break}if(ze=Ot(ne),P.substring(ge+1+ze,ge+1+ze+K)===k){if(le.push(P.substring(j,ge).replace(We,q)),Lt(ge+1+ze+K),fe=P.indexOf(b,j),ge=P.indexOf(q,j),ee&&(Ne(),S))return Je();if(F&&Se.length>=F)return Je(!0);break}be.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Se.length,index:j}),ge++}}else if(x&&le.length===0&&P.substring(j,j+Ue)===x){if(ne===-1)return Je();j=ne+K,ne=P.indexOf(k,j),fe=P.indexOf(b,j)}else if(fe!==-1&&(fe<ne||ne===-1))le.push(P.substring(j,fe)),j=fe+te,fe=P.indexOf(b,j);else{if(ne===-1)break;if(le.push(P.substring(j,ne)),Lt(ne+K),ee&&(Ne(),S))return Je();if(F&&Se.length>=F)return Je(!0)}return Ee();function Pe(pt){Se.push(pt),ue=j}function Ot(pt){var pn=0;return pn=pt!==-1&&(pt=P.substring(ge+1,pt))&&pt.trim()===""?pt.length:pn}function Ee(pt){return O||(pt===void 0&&(pt=P.substring(j)),le.push(pt),j=W,Pe(le),ee&&Ne()),Je()}function Lt(pt){j=pt,Pe(le),le=[],ne=P.indexOf(k,j)}function Je(pt){if(y.header&&!N&&Se.length&&!U){var pn=Se[0],Zr={},$g=new Set(pn);let oT=!1;for(let Wo=0;Wo<pn.length;Wo++){let _r=pn[Wo];if(Zr[_r=I(y.transformHeader)?y.transformHeader(_r,Wo):_r]){let Ec,aT=Zr[_r];for(;Ec=_r+"_"+aT,aT++,$g.has(Ec););$g.add(Ec),pn[Wo]=Ec,Zr[_r]++,oT=!0,(J=J===null?{}:J)[Ec]=_r}else Zr[_r]=1,pn[Wo]=_r;$g.add(_r)}oT&&console.warn("Duplicate headers found and renamed."),U=!0}return{data:Se,errors:be,meta:{delimiter:b,linebreak:k,aborted:S,truncated:!!pt,cursor:ue+(N||0),renamedHeaders:J}}}function Ne(){R(Je()),Se=[],be=[]}},this.abort=function(){S=!0},this.getCharIndex=function(){return j}}function _(y){var b=y.data,k=a[b.workerId],x=!1;if(b.error)k.userError(b.error,b.file);else if(b.results&&b.results.data){var R={abort:function(){x=!0,w(b.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:T,resume:T};if(I(k.userStep)){for(var F=0;F<b.results.data.length&&(k.userStep({data:b.results.data[F],errors:b.results.errors,meta:b.results.meta},R),!x);F++);delete b.results}else I(k.userChunk)&&(k.userChunk(b.results,R,b.file),delete b.results)}b.finished&&!x&&w(b.workerId,b.results)}function w(y,b){var k=a[y];I(k.userComplete)&&k.userComplete(b),k.terminate(),delete a[y]}function T(){throw new Error("Not implemented.")}function C(y){if(typeof y!="object"||y===null)return y;var b,k=Array.isArray(y)?[]:{};for(b in y)k[b]=C(y[b]);return k}function E(y,b){return function(){y.apply(b,arguments)}}function I(y){return typeof y=="function"}return u.parse=function(y,b){var k=(b=b||{}).dynamicTyping||!1;if(I(k)&&(b.dynamicTypingFunction=k,k={}),b.dynamicTyping=k,b.transform=!!I(b.transform)&&b.transform,!b.worker||!u.WORKERS_SUPPORTED)return k=null,u.NODE_STREAM_INPUT,typeof y=="string"?(y=(x=>x.charCodeAt(0)!==65279?x:x.slice(1))(y),k=new(b.download?l:f)(b)):y.readable===!0&&I(y.read)&&I(y.on)?k=new p(b):(r.File&&y instanceof File||y instanceof Object)&&(k=new h(b)),k.stream(y);(k=(()=>{var x;return!!u.WORKERS_SUPPORTED&&(x=(()=>{var R=r.URL||r.webkitURL||null,F=n.toString();return u.BLOB_URL||(u.BLOB_URL=R.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",F,")();"],{type:"text/javascript"})))})(),(x=new r.Worker(x)).onmessage=_,x.id=c++,a[x.id]=x)})()).userStep=b.step,k.userChunk=b.chunk,k.userComplete=b.complete,k.userError=b.error,b.step=I(b.step),b.chunk=I(b.chunk),b.complete=I(b.complete),b.error=I(b.error),delete b.worker,k.postMessage({input:y,config:b,workerId:k.id})},u.unparse=function(y,b){var k=!1,x=!0,R=",",F=`\r
`,z='"',J=z+z,U=!1,q=null,V=!1,j=((()=>{if(typeof b=="object"){if(typeof b.delimiter!="string"||u.BAD_DELIMITERS.filter(function(N){return b.delimiter.indexOf(N)!==-1}).length||(R=b.delimiter),typeof b.quotes!="boolean"&&typeof b.quotes!="function"&&!Array.isArray(b.quotes)||(k=b.quotes),typeof b.skipEmptyLines!="boolean"&&typeof b.skipEmptyLines!="string"||(U=b.skipEmptyLines),typeof b.newline=="string"&&(F=b.newline),typeof b.quoteChar=="string"&&(z=b.quoteChar),typeof b.header=="boolean"&&(x=b.header),Array.isArray(b.columns)){if(b.columns.length===0)throw new Error("Option columns is empty");q=b.columns}b.escapeChar!==void 0&&(J=b.escapeChar+z),b.escapeFormulae instanceof RegExp?V=b.escapeFormulae:typeof b.escapeFormulae=="boolean"&&b.escapeFormulae&&(V=/^[=+\-@\t\r].*$/)}})(),new RegExp(v(z),"g"));if(typeof y=="string"&&(y=JSON.parse(y)),Array.isArray(y)){if(!y.length||Array.isArray(y[0]))return S(null,y,U);if(typeof y[0]=="object")return S(q||Object.keys(y[0]),y,U)}else if(typeof y=="object")return typeof y.data=="string"&&(y.data=JSON.parse(y.data)),Array.isArray(y.data)&&(y.fields||(y.fields=y.meta&&y.meta.fields||q),y.fields||(y.fields=Array.isArray(y.data[0])?y.fields:typeof y.data[0]=="object"?Object.keys(y.data[0]):[]),Array.isArray(y.data[0])||typeof y.data[0]=="object"||(y.data=[y.data])),S(y.fields||[],y.data||[],U);throw new Error("Unable to serialize unrecognized input");function S(N,O,W){var te="",K=(typeof N=="string"&&(N=JSON.parse(N)),typeof O=="string"&&(O=JSON.parse(O)),Array.isArray(N)&&0<N.length),Ue=!Array.isArray(O[0]);if(K&&x){for(var ee=0;ee<N.length;ee++)0<ee&&(te+=R),te+=P(N[ee],ee);0<O.length&&(te+=F)}for(var Se=0;Se<O.length;Se++){var be=(K?N:O[Se]).length,le=!1,ue=K?Object.keys(O[Se]).length===0:O[Se].length===0;if(W&&!K&&(le=W==="greedy"?O[Se].join("").trim()==="":O[Se].length===1&&O[Se][0].length===0),W==="greedy"&&K){for(var Ce=[],pe=0;pe<be;pe++){var fe=Ue?N[pe]:pe;Ce.push(O[Se][fe])}le=Ce.join("").trim()===""}if(!le){for(var ne=0;ne<be;ne++){0<ne&&!ue&&(te+=R);var We=K&&Ue?N[ne]:ne;te+=P(O[Se][We],ne)}Se<O.length-1&&(!W||0<be&&!ue)&&(te+=F)}}return te}function P(N,O){var W,te;return N==null?"":N.constructor===Date?JSON.stringify(N).slice(1,25):(te=!1,V&&typeof N=="string"&&V.test(N)&&(N="'"+N,te=!0),W=N.toString().replace(j,J),(te=te||k===!0||typeof k=="function"&&k(N,O)||Array.isArray(k)&&k[O]||((K,Ue)=>{for(var ee=0;ee<Ue.length;ee++)if(-1<K.indexOf(Ue[ee]))return!0;return!1})(W,u.BAD_DELIMITERS)||-1<W.indexOf(R)||W.charAt(0)===" "||W.charAt(W.length-1)===" ")?z+W+z:W)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
`,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!s&&!!r.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=m,u.ParserHandle=g,u.NetworkStreamer=l,u.FileStreamer=h,u.StringStreamer=f,u.ReadableStreamStreamer=p,r.jQuery&&((i=r.jQuery).fn.parse=function(y){var b=y.config||{},k=[];return this.each(function(F){if(!(i(this).prop("tagName").toUpperCase()==="INPUT"&&i(this).attr("type").toLowerCase()==="file"&&r.FileReader)||!this.files||this.files.length===0)return!0;for(var z=0;z<this.files.length;z++)k.push({file:this.files[z],inputElem:this,instanceConfig:i.extend({},b)})}),x(),this;function x(){if(k.length===0)I(y.complete)&&y.complete();else{var F,z,J,U,q=k[0];if(I(y.before)){var V=y.before(q.file,q.inputElem);if(typeof V=="object"){if(V.action==="abort")return F="AbortError",z=q.file,J=q.inputElem,U=V.reason,void(I(y.error)&&y.error({name:F},z,J,U));if(V.action==="skip")return void R();typeof V.config=="object"&&(q.instanceConfig=i.extend(q.instanceConfig,V.config))}else if(V==="skip")return void R()}var j=q.instanceConfig.complete;q.instanceConfig.complete=function(S){I(j)&&j(S,q.file,q.inputElem),R()},u.parse(q.file,q.instanceConfig)}}function R(){k.splice(0,1),x()}}),o&&(r.onmessage=function(y){y=y.data,u.WORKER_ID===void 0&&y&&(u.WORKER_ID=y.workerId),typeof y.input=="string"?r.postMessage({workerId:u.WORKER_ID,results:u.parse(y.input,y.config),finished:!0}):(r.File&&y.input instanceof File||y.input instanceof Object)&&(y=u.parse(y.input,y.config))&&r.postMessage({workerId:u.WORKER_ID,results:y,finished:!0})}),(l.prototype=Object.create(d.prototype)).constructor=l,(h.prototype=Object.create(d.prototype)).constructor=h,(f.prototype=Object.create(f.prototype)).constructor=f,(p.prototype=Object.create(d.prototype)).constructor=p,u})}(vd)),vd.exports}rq();const HC="data:image/png;base64,";function iq(t){return`${HC}${t}`}function sq(t){return t.replace(HC,"")}async function oq(t){const e=await chrome.tabs.get(t),{windowId:n}=e;if(!n)throw new Error("Unable to get window ID");if((await chrome.tabs.query({active:!0,windowId:n}))[0].id===t)return chrome.tabs.captureVisibleTab(n,{format:"png"});await _c(t);const o={tabId:t},a=await pr(o,"Page.getLayoutMetrics"),{clientWidth:c,clientHeight:u}=a.cssVisualViewport,d={x:0,y:0,width:Math.ceil(c),height:Math.ceil(u),scale:1},h=(await pr(o,"Page.captureScreenshot",{clip:d,captureBeyondViewport:!0})).data;return iq(h)}async function aq(t){await _c(t);const n=await pr({tabId:t},"Page.getLayoutMetrics"),{clientWidth:r,clientHeight:i}=n.cssVisualViewport;return{width:Math.round(r),height:Math.round(i)}}const{createMessageSender:cq}=ir(),uq=cq("resizeImage"),lq=1024,dq=768;async function fq(t){const e=await oq(t),n=await uq({imageUrl:e,maxWidth:lq,maxHeight:dq},t),r=await aq(t);return tq.getState().setViewportSizeOnScreenshot(r),n.dataUrl}const{createMessageSender:qC}=ir(),hq=qC("generateAriaSnapshot"),Po=qC("getSelectorForAriaRef"),_d=H.object({element:H.string().describe("Human-readable element description used to obtain permission to interact with the element"),ref:H.string().describe("Exact target element reference from the page snapshot")}),pq=H.object({name:H.literal("browser_navigate"),description:H.literal("Navigate to a URL"),arguments:H.object({url:H.string().describe("The URL to navigate to")})}),gq=H.object({name:H.literal("browser_go_back"),description:H.literal("Go back to the previous page"),arguments:H.object({})}),mq=H.object({name:H.literal("browser_go_forward"),description:H.literal("Go forward to the next page"),arguments:H.object({})}),vq=H.object({name:H.literal("browser_wait"),description:H.literal("Wait for a specified time in seconds"),arguments:H.object({time:H.number().describe("The time to wait in seconds")})}),_q=H.object({name:H.literal("browser_press_key"),description:H.literal("Press a key on the keyboard"),arguments:H.object({key:H.string().describe("Name of the key to press or a character to generate, such as `ArrowLeft` or `a`")})}),yq=H.object({name:H.literal("browser_snapshot"),description:H.literal("Capture accessibility snapshot of the current page. Use this for getting references to elements to interact with."),arguments:H.object({})}),bq=H.object({name:H.literal("browser_click"),description:H.literal("Perform click on a web page"),arguments:_d}),wq=H.object({name:H.literal("browser_drag"),description:H.literal("Perform drag and drop between two elements"),arguments:H.object({startElement:H.string().describe("Human-readable source element description used to obtain the permission to interact with the element"),startRef:H.string().describe("Exact source element reference from the page snapshot"),endElement:H.string().describe("Human-readable target element description used to obtain the permission to interact with the element"),endRef:H.string().describe("Exact target element reference from the page snapshot")})}),Sq=H.object({name:H.literal("browser_hover"),description:H.literal("Hover over element on page"),arguments:_d}),Eq=H.object({name:H.literal("browser_type"),description:H.literal("Type text into editable element"),arguments:_d.extend({text:H.string().describe("Text to type into the element"),submit:H.boolean().describe("Whether to submit entered text (press Enter after)")})}),kq=H.object({name:H.literal("browser_select_option"),description:H.literal("Select an option in a dropdown"),arguments:_d.extend({values:H.array(H.string()).describe("Array of values to select in the dropdown. This can be a single value or multiple values.")})}),Cq=H.object({name:H.literal("browser_screenshot"),description:H.literal("Take a screenshot of the current page"),arguments:H.object({})}),Tq=H.object({name:H.literal("browser_get_console_logs"),description:H.literal("Get the console logs from the browser"),arguments:H.object({})}),Iq=H.discriminatedUnion("name",[pq,gq,mq,vq,_q,yq,bq,wq,Sq,Eq,kq,Cq,Tq]);function xq(){function t(e,n){return chrome.i18n.getMessage(e,n)}return{getMessage:t}}const{getMessage:Rq}=xq(),{sendMessage:Gr}=ir(),WC=Ss.defineItem("local:usageStats",{fallback:{toolCalls:0}});async function Aq(t){const e=await WC.getValue();await WC.setValue({...e,toolCalls:e.toolCalls+1}),wC("mcp tool",{tool:t})}class Pq{constructor(e){Sn(this,"computer");this.computer=new KH(e??-1)}get tabId(){return this.computer.tabId}set tabId(e){this.computer.tabId=e}}function Mq(t,e){const{addSocketMessageListener:n}=CC(t),r=[];return Iq.options.forEach(i=>{const s=i.shape.name.value,o=n(s,async a=>{if(e.tabId===-1)throw new Error(RC.errors.noConnectedTab);Aq(s);try{return await Oq(s,a.payload,e)}catch(c){throw Ui(c)===gH.BAD_CONNECTION?new Error(Rq("invalidTab")):c}});r.push(o)}),()=>{r.forEach(i=>i())}}async function Oq(t,e,n){return Lq[t](e,n)}const Lq={browser_navigate:async({url:t},e)=>{const{tabId:n}=e;await GH(t,n)},browser_go_back:async(t,e)=>{const{tabId:n}=e;await YH(n)},browser_go_forward:async(t,e)=>{const{tabId:n}=e;await ZH(n)},browser_wait:async({time:t},e)=>{await Ti(t*1e3)},browser_press_key:async({key:t},e)=>{const{computer:n}=e;await n.pressKey(t),await Mo(e.tabId)},browser_snapshot:async(t,e)=>{const{tabId:n}=e;return hq(void 0,n)},browser_click:async({ref:t},e)=>{const{tabId:n,computer:r}=e,i=await Po({ariaRef:t},n);await Gr("scrollIntoView",{selector:i},n);const s=await Gr("getElementCoordinates",{selector:i,options:{clickable:!0}},n);if(!s)throw new Error("No coordinates found for selector");await r.click(s),await Mo(n)},browser_drag:async({startRef:t,endRef:e},n)=>{const{tabId:r,computer:i}=n,s=await Po({ariaRef:t},r),o=await Po({ariaRef:e},r);await Gr("scrollIntoView",{selector:s},r);const a=await Gr("getElementCoordinates",{selector:s,options:{clickable:!0}},r),c=await Gr("getElementCoordinates",{selector:o},r);await i.drag({startViewportCoord:a,endViewportCoord:c}),await Mo(r)},browser_hover:async({ref:t},e)=>{const{tabId:n,computer:r}=e,i=await Po({ariaRef:t},n);await Gr("scrollIntoView",{selector:i},n);const s=await Gr("getElementCoordinates",{selector:i},n);await r.moveMouse(s),await Mo(n)},browser_type:async({ref:t,text:e,submit:n},r)=>{const{tabId:i,computer:s}=r,o=await Po({ariaRef:t},i);await Gr("scrollIntoView",{selector:o},i),await s.type(e,o),n&&await s.pressKey("Enter"),await Mo(i)},browser_select_option:async({values:t,ref:e},n)=>{const{tabId:r}=n,i=await Po({ariaRef:e},r);await Gr("selectOption",{selector:i,values:t,selectMethod:"value"},r),await Mo(r)},browser_screenshot:async(t,e)=>{const{tabId:n}=e,r=await fq(n);return sq(r)},browser_get_console_logs:async(t,e)=>wH()};async function Mo(t){await BH({minStableMs:1e3,maxMutations:0,maxWaitMs:3e3},t)}function Dq(){let t=null;const e=setInterval(async()=>{let n=await pd.getValue();if(n&&!await xC(n)&&(pd.setValue(null),n=null),t||!n)return;const r=RC.defaultWsPort;t=new WebSocket(`ws://localhost:${r}`);const i=Nq({ws:t,selectedTabId:n,onClose:()=>{t=null,i()}})},1e3);return()=>{clearInterval(e)}}function Nq({ws:t,selectedTabId:e,onClose:n}){const r=async()=>{console.log("WebSocket opened"),e&&await PC(e)},i=f=>{console.error("WebSocket error:",f)},s=()=>{console.log("WebSocket closed"),n()};t.addEventListener("open",r),t.addEventListener("error",i),t.addEventListener("close",s);const{addSocketMessageListener:o}=CC(t),a=o("getTitle",async()=>{const f=await gd();return vH(f)}),c=o("getUrl",async()=>{const f=await gd();return mH(f)}),u=EH(),d=new Pq(e),l=Mq(t,d),h=pd.watch(async(f,p)=>{p&&(d.tabId=-1,await xC(p)&&await AH(p)),f&&(d.tabId=f,await PC(f))});return()=>{t.removeEventListener("open",r),t.removeEventListener("error",i),t.removeEventListener("close",s),a(),c(),u(),l(),h()}}const Fq=Ke(()=>{zj.setTag("page","background"),Uq(),Bq()}),{addAnalyticsListener:$q}=Hu();function Uq(){Xj();const t=[iH(),NO(),$q(),Dq(),CO()];return()=>{t.forEach(e=>e())}}function Bq(){setInterval(chrome.runtime.getPlatformInfo,25e3)}function S8(){}(sT=(iT=globalThis.browser)==null?void 0:iT.runtime)!=null&&sT.id?globalThis.browser:globalThis.chrome;function yd(t,...e){}const jq={debug:(...t)=>yd(console.debug,...t),log:(...t)=>yd(console.log,...t),warn:(...t)=>yd(console.warn,...t),error:(...t)=>yd(console.error,...t)};let Fg;try{Fg=Fq.main(),Fg instanceof Promise&&console.warn("The background's main() function return a promise, but it must be synchronous")}catch(t){throw jq.error("The background crashed on startup!"),t}return Fg}();
background;