@tscircuit/runframe 0.0.2941 → 0.0.2943

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -236,8 +236,8 @@ Learn more: https://react.dev/warnings/version-mismatch`))})(),typeof Map=="func
236
236
  You might need to use a local HTTP server (instead of file://): https://react.dev/link/react-devtools-faq`:""),"font-weight:bold")}xz.createRoot=function(b,v){if(!_(b))throw Error("Target container is not a DOM element.");hm(b);var L=!1,W="",se=F4,fe=J0,Ve=Tp,st=null;return v!=null&&(v.hydrate?console.warn("hydrate through createRoot is deprecated. Use ReactDOMClient.hydrateRoot(container, <App />) instead."):typeof v=="object"&&v!==null&&v.$$typeof===qd&&console.error(`You passed a JSX element to createRoot. You probably meant to call root.render instead. Example usage:
237
237
 
238
238
  let root = createRoot(domContainer);
239
- root.render(<App />);`),v.unstable_strictMode===!0&&(L=!0),v.identifierPrefix!==void 0&&(W=v.identifierPrefix),v.onUncaughtError!==void 0&&(se=v.onUncaughtError),v.onCaughtError!==void 0&&(fe=v.onCaughtError),v.onRecoverableError!==void 0&&(Ve=v.onRecoverableError),v.unstable_transitionCallbacks!==void 0&&(st=v.unstable_transitionCallbacks)),v=kt(b,1,!1,null,null,L,W,se,fe,Ve,st,null),b[X0]=v.current,m5(b),new Z1(v)},xz.hydrateRoot=function(b,v,L){if(!_(b))throw Error("Target container is not a DOM element.");hm(b),v===void 0&&console.error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var W=!1,se="",fe=F4,Ve=J0,st=Tp,Mt=null,Jt=null;return L!=null&&(L.unstable_strictMode===!0&&(W=!0),L.identifierPrefix!==void 0&&(se=L.identifierPrefix),L.onUncaughtError!==void 0&&(fe=L.onUncaughtError),L.onCaughtError!==void 0&&(Ve=L.onCaughtError),L.onRecoverableError!==void 0&&(st=L.onRecoverableError),L.unstable_transitionCallbacks!==void 0&&(Mt=L.unstable_transitionCallbacks),L.formState!==void 0&&(Jt=L.formState)),v=kt(b,1,!0,v,L??null,W,se,fe,Ve,st,Mt,Jt),v.context=gn(null),L=v.current,W=Vd(L),W=rt(W),se=im(W),se.callback=null,I0(L,se,W),L=W,v.current.lanes=L,Le(v,L),Eu(v),b[X0]=v.current,m5(b),new K_(v)},xz.version="19.1.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})(),xz}var Cst;function Lbn(){if(Cst)return Cne.exports;Cst=1;var t={env:{}};function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(t.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}}return t.env.NODE_ENV==="production"?(e(),Cne.exports=kbn()):Cne.exports=Fbn(),Cne.exports}var Hbn=Lbn(),ee=Y3();const ks=BC(ee),P5=mx({__proto__:null,default:ks},[ee]);var Obn=Object.defineProperty,Vk=(t,e)=>Obn(t,"name",{value:e,configurable:!0}),yst=!!(typeof window<"u"&&window.document&&window.document.createElement);function _r(t,e,{checkForDefaultPrevented:n=!0}={}){return Vk(function(i){if(t?.(i),n===!1||!i||!i.defaultPrevented)return e?.(i)},"handleEvent")}Vk(_r,"composeEventHandlers");function Gbn(t){if(!yst)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}Vk(Gbn,"getOwnerWindow");function _2e(t){if(!yst)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}Vk(_2e,"getOwnerDocument");function xst(t,e=!1){const{activeElement:n}=_2e(t);if(!n?.nodeName)return null;if(Est(n)&&n.contentDocument)return xst(n.contentDocument.body,e);if(e){const o=n.getAttribute("aria-activedescendant");if(o){const i=_2e(n).getElementById(o);if(i)return i}}return n}Vk(xst,"getActiveElement");function Est(t){return t.tagName==="IFRAME"}Vk(Est,"isFrame");var Ybn=Object.defineProperty,M5=(t,e)=>Ybn(t,"name",{value:e,configurable:!0});function Ubn(t,e){const n=ee.createContext(e);n.displayName=t+"Context";const o=M5(r=>{const{children:s,...a}=r,A=ee.useMemo(()=>a,Object.values(a));return z.jsx(n.Provider,{value:A,children:s})},"Provider");o.displayName=t+"Provider";function i(r,s={}){const{optional:a=!1}=s,A=ee.useContext(n);if(A)return A;if(e!==void 0)return e;if(!a)throw new Error(`\`${r}\` must be used within \`${t}\``)}return M5(i,"useContext"),[o,i]}M5(Ubn,"createContext");function U3(t,e=[]){let n=[];function o(r,s){const a=ee.createContext(s);a.displayName=r+"Context";const A=n.length;n=[...n,s];const c=M5(g=>{const{scope:u,children:h,...d}=g,m=u?.[t]?.[A]||a,p=ee.useMemo(()=>d,Object.values(d));return z.jsx(m.Provider,{value:p,children:h})},"Provider");c.displayName=r+"Provider";function l(g,u,h={}){const{optional:d=!1}=h,m=u?.[t]?.[A]||a,p=ee.useContext(m);if(p)return p;if(s!==void 0)return s;if(!d)throw new Error(`\`${g}\` must be used within \`${r}\``)}return M5(l,"useContext"),[c,l]}M5(o,"createContext");const i=M5(()=>{const r=n.map(s=>ee.createContext(s));return M5(function(a){const A=a?.[t]||r;return ee.useMemo(()=>({[`__scope${t}`]:{...a,[t]:A}}),[a,A])},"useScope")},"createScope");return i.scopeName=t,[o,Bst(i,...e)]}M5(U3,"createContextScope");function Bst(...t){const e=t[0];if(t.length===1)return e;const n=M5(()=>{const o=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return M5(function(r){const s=o.reduce((a,{useScope:A,scopeName:c})=>{const g=A(r)[`__scope${c}`];return{...a,...g}},{});return ee.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}M5(Bst,"composeContextScopes");var Kbn=Object.defineProperty,f2e=(t,e)=>Kbn(t,"name",{value:e,configurable:!0});function I2e(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}f2e(I2e,"setRef");function bst(...t){return e=>{let n=!1;const o=t.map(i=>{const r=I2e(i,e);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let i=0;i<o.length;i++){const r=o[i];typeof r=="function"?r():I2e(t[i],null)}}}}f2e(bst,"composeRefs");function lc(...t){return ee.useCallback(bst(...t),t)}f2e(lc,"useComposedRefs");var zbn=Object.defineProperty,D5=(t,e)=>zbn(t,"name",{value:e,configurable:!0});function G9(t){const e=ee.forwardRef((n,o)=>{let{children:i,...r}=n,s=null,a=!1;const A=[];C2e(i)&&typeof Bne=="function"&&(i=Bne(i._payload)),ee.Children.forEach(i,u=>{if(Pst(u)){a=!0;const h=u;let d="child"in h.props?h.props.child:h.props.children;C2e(d)&&typeof Bne=="function"&&(d=Bne(d._payload)),s=Jbn(h,d),A.push(s?.props?.children)}else A.push(u)}),s?s=ee.cloneElement(s,void 0,A):!a&&ee.Children.count(i)===1&&ee.isValidElement(i)&&(s=i);const c=s?wst(s):void 0,l=lc(o,c);if(!s){if(i||i===0)throw new Error(a?qbn(t):jbn(t));return i}const g=vst(r,s.props??{});return s.type!==ee.Fragment&&(g.ref=o?l:c),ee.cloneElement(s,g)});return e.displayName=`${t}.Slot`,e}D5(G9,"createSlot");var Vbn=G9("Slot"),Sst=Symbol.for("radix.slottable");function Qst(t){const e=D5(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=Sst,e}D5(Qst,"createSlottable");var Jbn=D5((t,e)=>{if("child"in t.props){const n=t.props.child;return ee.isValidElement(n)?ee.cloneElement(n,void 0,t.props.children(n.props.children)):null}return ee.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function vst(t,e){const n={...e};for(const o in e){const i=t[o],r=e[o];/^on[A-Z]/.test(o)?i&&r?n[o]=(...a)=>{const A=r(...a);return i(...a),A}:i&&(n[o]=i):o==="style"?n[o]={...i,...r}:o==="className"?n[o]=[i,r].filter(Boolean).join(" "):o==="aria-describedby"&&(n[o]=Dst(r,i))}return{...t,...n}}D5(vst,"mergeProps");function wst(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}D5(wst,"getElementRef");function Pst(t){return ee.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Sst}D5(Pst,"isSlottable");var Wbn=Symbol.for("react.lazy");function C2e(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===Wbn&&"_payload"in t&&Mst(t._payload)}D5(C2e,"isLazyComponent");function Mst(t){return typeof t=="object"&&t!==null&&"then"in t}D5(Mst,"isPromiseLike");function Dst(...t){const e=new Set;for(const n of t)if(typeof n=="string")for(const o of String(n).trim().split(/\s+/))o&&e.add(o);return e.size>0?Array.from(e).join(" "):void 0}D5(Dst,"concatAriaDescribedby");var jbn=D5(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),qbn=D5(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Bne=P5[" use ".trim().toString()],$bn=Object.defineProperty,i1=(t,e)=>$bn(t,"name",{value:e,configurable:!0});function bne(t){const e=t+"CollectionProvider",[n,o]=U3(e),[i,r]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=i1(m=>{const{scope:p,children:_}=m,f=ee.useRef(null),I=ee.useRef(new Map).current;return z.jsx(i,{scope:p,itemMap:I,collectionRef:f,children:_})},"CollectionProvider");s.displayName=e;const a=t+"CollectionSlot",A=G9(a),c=ee.forwardRef((m,p)=>{const{scope:_,children:f}=m,I=r(a,_),C=lc(p,I.collectionRef);return z.jsx(A,{ref:C,children:f})});c.displayName=a;const l=t+"CollectionItemSlot",g="data-radix-collection-item",u=G9(l),h=ee.forwardRef((m,p)=>{const{scope:_,children:f,...I}=m,C=ee.useRef(null),y=lc(p,C),x=r(l,_);return ee.useEffect(()=>(x.itemMap.set(C,{ref:C,...I}),()=>{x.itemMap.delete(C)})),z.jsx(u,{[g]:"",ref:y,children:f})});h.displayName=l;function d(m){const p=r(t+"CollectionConsumer",m);return ee.useCallback(()=>{const f=p.collectionRef.current;if(!f)return[];const I=Array.from(f.querySelectorAll(`[${g}]`));return Array.from(p.itemMap.values()).sort((x,E)=>I.indexOf(x.ref.current)-I.indexOf(E.ref.current))},[p.collectionRef,p.itemMap])}return i1(d,"useCollection"),[{Provider:s,Slot:c,ItemSlot:h},d,o]}i1(bne,"createCollection");var Nst=new WeakMap,y2e=(JE=class extends Map{constructor(n){super(n);Ort(this,Q_);one(this,Q_,[...super.keys()]),Nst.set(this,!0)}set(n,o){return Nst.get(this)&&(this.has(n)?Q0(this,Q_)[Q0(this,Q_).indexOf(n)]=n:Q0(this,Q_).push(n)),super.set(n,o),this}insert(n,o,i){const r=this.has(o),s=Q0(this,Q_).length,a=x2e(n);let A=a>=0?a:s+a;const c=A<0||A>=s?-1:A;if(c===this.size||r&&c===this.size-1||c===-1)return this.set(o,i),this;const l=this.size+(r?0:1);a<0&&A++;const g=[...Q0(this,Q_)];let u,h=!1;for(let d=A;d<l;d++)if(A===d){let m=g[d];g[d]===o&&(m=g[d+1]),r&&this.delete(o),u=this.get(m),this.set(o,i)}else{!h&&g[d-1]===o&&(h=!0);const m=g[h?d:d-1],p=u;u=this.get(m),this.delete(m),this.set(m,p)}return this}with(n,o,i){const r=new JE(this);return r.insert(n,o,i),r}before(n){const o=Q0(this,Q_).indexOf(n)-1;if(!(o<0))return this.entryAt(o)}setBefore(n,o,i){const r=Q0(this,Q_).indexOf(n);return r===-1?this:this.insert(r,o,i)}after(n){let o=Q0(this,Q_).indexOf(n);if(o=o===-1||o===this.size-1?-1:o+1,o!==-1)return this.entryAt(o)}setAfter(n,o,i){const r=Q0(this,Q_).indexOf(n);return r===-1?this:this.insert(r+1,o,i)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return one(this,Q_,[]),super.clear()}delete(n){const o=super.delete(n);return o&&Q0(this,Q_).splice(Q0(this,Q_).indexOf(n),1),o}deleteAt(n){const o=this.keyAt(n);return o!==void 0?this.delete(o):!1}at(n){const o=Sne(Q0(this,Q_),n);if(o!==void 0)return this.get(o)}entryAt(n){const o=Sne(Q0(this,Q_),n);if(o!==void 0)return[o,this.get(o)]}indexOf(n){return Q0(this,Q_).indexOf(n)}keyAt(n){return Sne(Q0(this,Q_),n)}from(n,o){const i=this.indexOf(n);if(i===-1)return;let r=i+o;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(n,o){const i=this.indexOf(n);if(i===-1)return;let r=i+o;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(n,o){let i=0;for(const r of this){if(Reflect.apply(n,o,[r,i,this]))return r;i++}}findIndex(n,o){let i=0;for(const r of this){if(Reflect.apply(n,o,[r,i,this]))return i;i++}return-1}filter(n,o){const i=[];let r=0;for(const s of this)Reflect.apply(n,o,[s,r,this])&&i.push(s),r++;return new JE(i)}map(n,o){const i=[];let r=0;for(const s of this)i.push([s[0],Reflect.apply(n,o,[s,r,this])]),r++;return new JE(i)}reduce(...n){const[o,i]=n;let r=0,s=i??this.at(0);for(const a of this)r===0&&n.length===1?s=a:s=Reflect.apply(o,this,[s,a,r,this]),r++;return s}reduceRight(...n){const[o,i]=n;let r=i??this.at(-1);for(let s=this.size-1;s>=0;s--){const a=this.at(s);s===this.size-1&&n.length===1?r=a:r=Reflect.apply(o,this,[r,a,s,this])}return r}toSorted(n){const o=[...this.entries()].sort(n);return new JE(o)}toReversed(){const n=new JE;for(let o=this.size-1;o>=0;o--){const i=this.keyAt(o),r=this.get(i);n.set(i,r)}return n}toSpliced(...n){const o=[...this.entries()];return o.splice(...n),new JE(o)}slice(n,o){const i=new JE;let r=this.size-1;if(n===void 0)return i;n<0&&(n=n+this.size),o!==void 0&&o>0&&(r=o-1);for(let s=n;s<=r;s++){const a=this.keyAt(s),A=this.get(a);i.set(a,A)}return i}every(n,o){let i=0;for(const r of this){if(!Reflect.apply(n,o,[r,i,this]))return!1;i++}return!0}some(n,o){let i=0;for(const r of this){if(Reflect.apply(n,o,[r,i,this]))return!0;i++}return!1}},Q_=new WeakMap,i1(JE,"OrderedDict"),JE);function Sne(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=Rst(t,e);return n===-1?void 0:t[n]}i1(Sne,"at");function Rst(t,e){const n=t.length,o=x2e(e),i=o>=0?o:n+o;return i<0||i>=n?-1:i}i1(Rst,"toSafeIndex");function x2e(t){return t!==t||t===0?0:Math.trunc(t)}i1(x2e,"toSafeInteger");function Xbn(t){const e=t+"CollectionProvider",[n,o]=U3(e),[i,r]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new y2e,setItemMap:i1(()=>{},"setItemMap")}),s=i1(({state:I,...C})=>I?z.jsx(A,{...C,state:I}):z.jsx(a,{...C}),"CollectionProvider");s.displayName=e;const a=i1(I=>{const C=p();return z.jsx(A,{...I,state:C})},"CollectionInit");a.displayName=e+"Init";const A=i1(I=>{const{scope:C,children:y,state:x}=I,E=ee.useRef(null),[B,S]=ee.useState(null),Q=lc(E,S),[w,M]=x;return ee.useEffect(()=>{if(!B)return;const T=Fst(()=>{});return T.observe(B,{childList:!0,subtree:!0}),()=>{T.disconnect()}},[B]),z.jsx(i,{scope:C,itemMap:w,setItemMap:M,collectionRef:Q,collectionRefObject:E,collectionElement:B,children:y})},"CollectionProviderImpl");A.displayName=e+"Impl";const c=t+"CollectionSlot",l=G9(c),g=ee.forwardRef((I,C)=>{const{scope:y,children:x}=I,E=r(c,y),B=lc(C,E.collectionRef);return z.jsx(l,{ref:B,children:x})});g.displayName=c;const u=t+"CollectionItemSlot",h="data-radix-collection-item",d=G9(u),m=ee.forwardRef((I,C)=>{const{scope:y,children:x,...E}=I,B=ee.useRef(null),[S,Q]=ee.useState(null),w=lc(C,B,Q),M=r(u,y),{setItemMap:T}=M,R=ee.useRef(E);Tst(R.current,E)||(R.current=E);const F=R.current;return ee.useEffect(()=>{const O=F;return T(U=>S?U.has(S)?U.set(S,{...O,element:S}).toSorted(E2e):(U.set(S,{...O,element:S}),U.toSorted(E2e)):U),()=>{T(U=>!S||!U.has(S)?U:(U.delete(S),new y2e(U)))}},[S,F,T]),z.jsx(d,{[h]:"",ref:w,children:x})});m.displayName=u;function p(){return ee.useState(new y2e)}i1(p,"useInitCollection");function _(I){const{itemMap:C}=r(t+"CollectionConsumer",I);return C}return i1(_,"useCollection"),[{Provider:s,Slot:g,ItemSlot:m},{createCollectionScope:o,useCollection:_,useInitCollection:p}]}i1(Xbn,"createCollection");function Tst(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;const n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(e,i)||t[i]!==e[i])return!1;return!0}i1(Tst,"shallowEqual");function kst(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}i1(kst,"isElementPreceding");function E2e(t,e){return!t[1].element||!e[1].element?0:kst(t[1].element,e[1].element)?-1:1}i1(E2e,"sortByDocumentPosition");function Fst(t){return new MutationObserver(n=>{for(const o of n)if(o.type==="childList"){t();return}})}i1(Fst,"getChildListObserver");var Cm=globalThis?.document?ee.useLayoutEffect:()=>{},Zbn=Object.defineProperty,eSn=(t,e)=>Zbn(t,"name",{value:e,configurable:!0}),tSn=P5[" useId ".trim().toString()]||(()=>{}),nSn=0;function K3(t){const[e,n]=ee.useState(tSn());return Cm(()=>{t||n(o=>o??String(nSn++))},[t]),t||(e?`radix-${e}`:"")}eSn(K3,"useId");var Y9=p2e();const Lst=BC(Y9);var oSn=Object.defineProperty,iSn=(t,e)=>oSn(t,"name",{value:e,configurable:!0}),rSn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],gc=rSn.reduce((t,e)=>{const n=G9(`Primitive.${e}`),o=ee.forwardRef((i,r)=>{const{asChild:s,...a}=i,A=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),z.jsx(A,{...a,ref:r})});return o.displayName=`Primitive.${e}`,{...t,[e]:o}},{});function B2e(t,e){t&&Y9.flushSync(()=>t.dispatchEvent(e))}iSn(B2e,"dispatchDiscreteCustomEvent");var sSn=Object.defineProperty,aSn=(t,e)=>sSn(t,"name",{value:e,configurable:!0});function z3(t){const e=ee.useRef(t);return ee.useEffect(()=>{e.current=t}),ee.useMemo(()=>((...n)=>e.current?.(...n)),[])}aSn(z3,"useCallbackRef");var ASn=Object.defineProperty,cSn=(t,e)=>ASn(t,"name",{value:e,configurable:!0}),Hst=P5[" useEffectEvent ".trim().toString()],Ost=P5[" useInsertionEffect ".trim().toString()];function Gst(t){if(typeof Hst=="function")return Hst(t);const e=ee.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Ost=="function"?Ost(()=>{e.current=t}):Cm(()=>{e.current=t}),ee.useMemo(()=>((...n)=>e.current?.(...n)),[])}cSn(Gst,"useEffectEvent");var lSn=Object.defineProperty,Ez=(t,e)=>lSn(t,"name",{value:e,configurable:!0}),gSn=P5[" useInsertionEffect ".trim().toString()]||Cm;function U9({prop:t,defaultProp:e,onChange:n=Ez(()=>{},"onChange"),caller:o}){const[i,r,s]=Yst({defaultProp:e,onChange:n}),a=t!==void 0,A=a?t:i,c=ee.useCallback(l=>{if(a){const g=Ust(l)?l(t):l;g!==t&&s.current?.(g)}else r(l)},[a,t,r,s]);return[A,c]}Ez(U9,"useControllableState");function Yst({defaultProp:t,onChange:e}){const[n,o]=ee.useState(t),i=ee.useRef(n),r=ee.useRef(e);return gSn(()=>{r.current=e},[e]),ee.useEffect(()=>{i.current!==n&&(r.current?.(n),i.current=n)},[n,i]),[n,o,r]}Ez(Yst,"useUncontrolledState");function Ust(t){return typeof t=="function"}Ez(Ust,"isFunction");var Kst=Symbol("RADIX:SYNC_STATE");function uSn(t,e,n,o){const{prop:i,defaultProp:r,onChange:s,caller:a}=e,A=i!==void 0,c=Gst(s),l=[{...n,state:r}];o&&l.push(o);const[g,u]=ee.useReducer((p,_)=>{if(_.type===Kst)return{...p,state:_.state};const f=t(p,_);return A&&!Object.is(f.state,p.state)&&c(f.state),f},...l),h=g.state,d=ee.useRef(h);ee.useEffect(()=>{d.current!==h&&(d.current=h,A||c(h))},[h,d,A]);const m=ee.useMemo(()=>i!==void 0?{...g,state:i}:g,[g,i]);return ee.useEffect(()=>{A&&!Object.is(i,g.state)&&u({type:Kst,state:i})},[i,g.state,A]),[m,u]}Ez(uSn,"useControllableStateReducer");var dSn=Object.defineProperty,hSn=(t,e)=>dSn(t,"name",{value:e,configurable:!0}),mSn={LTR:"ltr"},pSn=ee.createContext(void 0);function Bz(t){const e=ee.useContext(pSn);return t||e||mSn.LTR}hSn(Bz,"useDirection");var _Sn=Object.defineProperty,b2e=(t,e)=>_Sn(t,"name",{value:e,configurable:!0}),S2e=!1;function zst(){const[t,e]=ee.useState(S2e);return ee.useEffect(()=>{S2e||(S2e=!0,e(!0))},[]),t}b2e(zst,"useIsHydrated");var Vst=P5[" useSyncExternalStore ".trim().toString()];function Jst(){return()=>{}}b2e(Jst,"subscribe");function Wst(){return Vst(Jst,()=>!0,()=>!1)}b2e(Wst,"useIsHydratedModern");var fSn=typeof Vst=="function"?Wst:zst,ISn=Object.defineProperty,ZM=(t,e)=>ISn(t,"name",{value:e,configurable:!0}),Q2e="rovingFocusGroup.onEntryFocus",CSn={bubbles:!1,cancelable:!0},Qne="RovingFocusGroup",[v2e,jst,ySn]=bne(Qne),[xSn,vne]=U3(Qne,[ySn]),qst={Vertical:"vertical",Horizontal:"horizontal"},ESn={RTL:"rtl"},[BSn,bSn]=xSn(Qne),$st=ee.forwardRef(ZM(function(e,n){return z.jsx(v2e.Provider,{scope:e.__scopeRovingFocusGroup,children:z.jsx(v2e.Slot,{scope:e.__scopeRovingFocusGroup,children:z.jsx(SSn,{...e,ref:n})})})},"RovingFocusGroup")),SSn=ee.forwardRef(ZM(function(e,n){const{__scopeRovingFocusGroup:o,orientation:i,loop:r=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:A,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:g=!1,...u}=e,h=ee.useRef(null),d=lc(n,h),m=Bz(s),[p,_]=U9({prop:a,defaultProp:A??null,onChange:c,caller:Qne}),[f,I]=ee.useState(!1),C=z3(l),y=jst(o),x=ee.useRef(!1),[E,B]=ee.useState(0);return ee.useEffect(()=>{const S=h.current;if(S)return S.addEventListener(Q2e,C),()=>S.removeEventListener(Q2e,C)},[C]),z.jsx(BSn,{scope:o,orientation:i,dir:m,loop:r,currentTabStopId:p,onItemFocus:ee.useCallback(S=>_(S),[_]),onItemShiftTab:ee.useCallback(()=>I(!0),[]),onFocusableItemAdd:ee.useCallback(()=>B(S=>S+1),[]),onFocusableItemRemove:ee.useCallback(()=>B(S=>S-1),[]),children:z.jsx(gc.div,{tabIndex:f||E===0?-1:0,"data-orientation":i,...u,ref:d,style:{outline:"none",...e.style},onMouseDown:_r(e.onMouseDown,()=>{x.current=!0}),onFocus:_r(e.onFocus,S=>{const Q=!x.current;if(S.target===S.currentTarget&&Q&&!f){const w=new CustomEvent(Q2e,CSn);if(S.currentTarget.dispatchEvent(w),!w.defaultPrevented){const M=y().filter(U=>U.focusable),T=M.find(U=>U.active),R=M.find(U=>U.id===p),O=[T,R,...M].filter(Boolean).map(U=>U.ref.current);w2e(O,g)}}x.current=!1}),onBlur:_r(e.onBlur,()=>I(!1))})})},"RovingFocusGroupImpl")),QSn="RovingFocusGroupItem",Xst=ee.forwardRef(ZM(function(e,n){const{__scopeRovingFocusGroup:o,focusable:i=!0,active:r=!1,tabStopId:s,children:a,...A}=e,c=K3(),l=s||c,g=bSn(QSn,o),u=g.currentTabStopId===l,h=jst(o),{onFocusableItemAdd:d,onFocusableItemRemove:m,currentTabStopId:p}=g,_=fSn();return Cm(()=>{if(!(!_||!i))return d(),()=>m()},[_,i,d,m]),ee.useEffect(()=>{if(!(_||!i))return d(),()=>m()},[_,i,d,m]),z.jsx(v2e.ItemSlot,{scope:o,id:l,focusable:i,active:r,children:z.jsx(gc.span,{tabIndex:u?0:-1,"data-orientation":g.orientation,...A,ref:n,onMouseDown:_r(e.onMouseDown,f=>{i?g.onItemFocus(l):f.preventDefault()}),onFocus:_r(e.onFocus,()=>g.onItemFocus(l)),onKeyDown:_r(e.onKeyDown,f=>{if(f.key==="Tab"&&f.shiftKey){g.onItemShiftTab();return}if(f.target!==f.currentTarget)return;const I=eat(f,g.orientation,g.dir);if(I!==void 0){if(f.metaKey||f.ctrlKey||f.altKey||f.shiftKey)return;f.preventDefault();let y=h().filter(x=>x.focusable).map(x=>x.ref.current);if(I==="last")y.reverse();else if(I==="prev"||I==="next"){I==="prev"&&y.reverse();const x=y.indexOf(f.currentTarget);y=g.loop?tat(y,x+1):y.slice(x+1)}setTimeout(()=>w2e(y))}}),children:typeof a=="function"?a({isCurrentTabStop:u,hasTabStop:p!=null}):a})})},"RovingFocusGroupItem")),vSn={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Zst(t,e){return e!==ESn.RTL?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}ZM(Zst,"getDirectionAwareKey");function eat(t,e,n){const o=Zst(t.key,n);if(!(e===qst.Vertical&&["ArrowLeft","ArrowRight"].includes(o))&&!(e===qst.Horizontal&&["ArrowUp","ArrowDown"].includes(o)))return vSn[o]}ZM(eat,"getFocusIntent");function w2e(t,e=!1){const n=document.activeElement;for(const o of t)if(o===n||(o.focus({preventScroll:e}),document.activeElement!==n))return}ZM(w2e,"focusFirst");function tat(t,e){return t.map((n,o)=>t[(e+o)%t.length])}ZM(tat,"wrapArray");var wSn=Object.defineProperty,O8=(t,e)=>wSn(t,"name",{value:e,configurable:!0});function nat(t,e){return ee.useReducer((n,o)=>e[n][o]??n,t)}O8(nat,"useStateMachine");var $4=O8(t=>{const{present:e,children:n}=t,o=oat(e),i=typeof n=="function"?n({present:o.isPresent}):ee.Children.only(n),r=iat(o.ref,rat(i));return typeof n=="function"||o.isPresent?ee.cloneElement(i,{ref:r}):null},"Presence");function oat(t){const[e,n]=ee.useState(),o=ee.useRef(null),i=ee.useRef(t),r=ee.useRef("none"),s=ee.useRef(void 0),a=t?"mounted":"unmounted",[A,c]=nat(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return ee.useEffect(()=>{A==="mounted"?(r.current=s.current??Jk(o.current),s.current=void 0):r.current="none"},[A]),Cm(()=>{const l=o.current,g=i.current;if(g!==t){const h=r.current,d=Jk(l);t?(s.current=d,c("MOUNT")):d==="none"||l?.display==="none"?c("UNMOUNT"):c(g&&h!==d?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,c]),Cm(()=>{if(e){let l;const g=e.ownerDocument.defaultView??window,u=O8(d=>{const p=Jk(o.current).includes(CSS.escape(d.animationName));if(d.target===e&&p&&(c("ANIMATION_END"),!i.current)){const _=e.style.animationFillMode;e.style.animationFillMode="forwards",l=g.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=_)})}},"handleAnimationEnd"),h=O8(d=>{d.target===e&&(r.current=Jk(o.current))},"handleAnimationStart");return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",u),e.addEventListener("animationend",u),()=>{g.clearTimeout(l),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",u),e.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(A),ref:ee.useCallback(l=>{if(l){const g=getComputedStyle(l);o.current=g,s.current=Jk(g)}else o.current=null;n(l)},[])}}O8(oat,"usePresence");function P2e(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}O8(P2e,"setRef");function iat(...t){const e=ee.useRef(t);return e.current=t,ee.useCallback(n=>{const o=e.current;let i=!1;const r=o.map(s=>{const a=P2e(s,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let s=0;s<r.length;s++){const a=r[s];typeof a=="function"?a():P2e(o[s],null)}}},[])}O8(iat,"useStableComposedRefs");function Jk(t){return t?.animationName||"none"}O8(Jk,"getAnimationName");function rat(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}O8(rat,"getElementRef");var PSn=Object.defineProperty,Wk=(t,e)=>PSn(t,"name",{value:e,configurable:!0}),sat={Automatic:"automatic",Manual:"manual"},M2e="Tabs",[MSn,N1r]=U3(M2e,[vne]),aat=vne(),[DSn,D2e]=MSn(M2e),NSn=ee.forwardRef(Wk(function(e,n){const{__scopeTabs:o,value:i,onValueChange:r,defaultValue:s,orientation:a="horizontal",dir:A,activationMode:c=sat.Automatic,...l}=e,g=Bz(A),[u,h]=U9({prop:i,onChange:r,defaultProp:s??"",caller:M2e});return z.jsx(DSn,{scope:o,baseId:K3(),value:u,onValueChange:h,orientation:a,dir:g,activationMode:c,children:z.jsx(gc.div,{dir:g,"data-orientation":a,...l,ref:n})})},"Tabs")),RSn="TabsList",Aat=ee.forwardRef(Wk(function(e,n){const{__scopeTabs:o,loop:i=!0,...r}=e,s=D2e(RSn,o),a=aat(o);return z.jsx($st,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:i,children:z.jsx(gc.div,{role:"tablist","aria-orientation":s.orientation,...r,ref:n})})},"TabsList")),TSn="TabsTrigger",cat=ee.forwardRef(Wk(function(e,n){const{__scopeTabs:o,value:i,disabled:r=!1,...s}=e,a=D2e(TSn,o),A=aat(o),c=N2e(a.baseId,i),l=R2e(a.baseId,i),g=i===a.value;return z.jsx(Xst,{asChild:!0,...A,focusable:!r,active:g,children:z.jsx(gc.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":l,"data-state":g?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:c,...s,ref:n,onMouseDown:_r(e.onMouseDown,u=>{!r&&u.button===0&&u.ctrlKey===!1?(u.currentTarget.focus(),a.onValueChange(i)):u.preventDefault()}),onKeyDown:_r(e.onKeyDown,u=>{r||u.target!==u.currentTarget||[" ","Enter"].includes(u.key)&&a.onValueChange(i)}),onFocus:_r(e.onFocus,()=>{const u=a.activationMode!==sat.Manual;!g&&!r&&u&&a.onValueChange(i)})})})},"TabsTrigger")),kSn="TabsContent",lat=ee.forwardRef(Wk(function(e,n){const{__scopeTabs:o,value:i,forceMount:r,children:s,...a}=e,A=D2e(kSn,o),c=N2e(A.baseId,i),l=R2e(A.baseId,i),g=i===A.value,u=ee.useRef(g);return ee.useEffect(()=>{const h=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(h)},[]),z.jsx($4,{present:r||g,children:({present:h})=>z.jsx(gc.div,{"data-state":g?"active":"inactive","data-orientation":A.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:l,tabIndex:0,...a,ref:n,style:{...e.style,animationDuration:u.current?"0s":void 0},children:h&&s})})},"TabsContent"));function N2e(t,e){return`${t}-trigger-${e}`}Wk(N2e,"makeTriggerId");function R2e(t,e){return`${t}-content-${e}`}Wk(R2e,"makeContentId");function gat(t){var e,n,o="";if(typeof t=="string"||typeof t=="number")o+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=gat(t[e]))&&(o&&(o+=" "),o+=n)}else for(n in t)t[n]&&(o&&(o+=" "),o+=n);return o}function X4(){for(var t,e,n=0,o="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=gat(t))&&(o&&(o+=" "),o+=e);return o}const T2e="-",FSn=t=>{const e=HSn(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=t;return{getClassGroupId:s=>{const a=s.split(T2e);return a[0]===""&&a.length!==1&&a.shift(),uat(a,e)||LSn(s)},getConflictingClassGroupIds:(s,a)=>{const A=n[s]||[];return a&&o[s]?[...A,...o[s]]:A}}},uat=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],o=e.nextPart.get(n),i=o?uat(t.slice(1),o):void 0;if(i)return i;if(e.validators.length===0)return;const r=t.join(T2e);return e.validators.find(({validator:s})=>s(r))?.classGroupId},dat=/^\[(.+)\]$/,LSn=t=>{if(dat.test(t)){const e=dat.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},HSn=t=>{const{theme:e,prefix:n}=t,o={nextPart:new Map,validators:[]};return GSn(Object.entries(t.classGroups),n).forEach(([r,s])=>{k2e(s,o,r,e)}),o},k2e=(t,e,n,o)=>{t.forEach(i=>{if(typeof i=="string"){const r=i===""?e:hat(e,i);r.classGroupId=n;return}if(typeof i=="function"){if(OSn(i)){k2e(i(o),e,n,o);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([r,s])=>{k2e(s,hat(e,r),n,o)})})},hat=(t,e)=>{let n=t;return e.split(T2e).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},OSn=t=>t.isThemeGetter,GSn=(t,e)=>e?t.map(([n,o])=>{const i=o.map(r=>typeof r=="string"?e+r:typeof r=="object"?Object.fromEntries(Object.entries(r).map(([s,a])=>[e+s,a])):r);return[n,i]}):t,YSn=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,o=new Map;const i=(r,s)=>{n.set(r,s),e++,e>t&&(e=0,o=n,n=new Map)};return{get(r){let s=n.get(r);if(s!==void 0)return s;if((s=o.get(r))!==void 0)return i(r,s),s},set(r,s){n.has(r)?n.set(r,s):i(r,s)}}},mat="!",USn=t=>{const{separator:e,experimentalParseClassName:n}=t,o=e.length===1,i=e[0],r=e.length,s=a=>{const A=[];let c=0,l=0,g;for(let p=0;p<a.length;p++){let _=a[p];if(c===0){if(_===i&&(o||a.slice(p,p+r)===e)){A.push(a.slice(l,p)),l=p+r;continue}if(_==="/"){g=p;continue}}_==="["?c++:_==="]"&&c--}const u=A.length===0?a:a.substring(l),h=u.startsWith(mat),d=h?u.substring(1):u,m=g&&g>l?g-l:void 0;return{modifiers:A,hasImportantModifier:h,baseClassName:d,maybePostfixModifierPosition:m}};return n?a=>n({className:a,parseClassName:s}):s},KSn=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(o=>{o[0]==="["?(e.push(...n.sort(),o),n=[]):n.push(o)}),e.push(...n.sort()),e},zSn=t=>({cache:YSn(t.cacheSize),parseClassName:USn(t),...FSn(t)}),VSn=/\s+/,JSn=(t,e)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:i}=e,r=[],s=t.trim().split(VSn);let a="";for(let A=s.length-1;A>=0;A-=1){const c=s[A],{modifiers:l,hasImportantModifier:g,baseClassName:u,maybePostfixModifierPosition:h}=n(c);let d=!!h,m=o(d?u.substring(0,h):u);if(!m){if(!d){a=c+(a.length>0?" "+a:a);continue}if(m=o(u),!m){a=c+(a.length>0?" "+a:a);continue}d=!1}const p=KSn(l).join(":"),_=g?p+mat:p,f=_+m;if(r.includes(f))continue;r.push(f);const I=i(m,d);for(let C=0;C<I.length;++C){const y=I[C];r.push(_+y)}a=c+(a.length>0?" "+a:a)}return a};function WSn(){let t=0,e,n,o="";for(;t<arguments.length;)(e=arguments[t++])&&(n=pat(e))&&(o&&(o+=" "),o+=n);return o}const pat=t=>{if(typeof t=="string")return t;let e,n="";for(let o=0;o<t.length;o++)t[o]&&(e=pat(t[o]))&&(n&&(n+=" "),n+=e);return n};function jSn(t,...e){let n,o,i,r=s;function s(A){const c=e.reduce((l,g)=>g(l),t());return n=zSn(c),o=n.cache.get,i=n.cache.set,r=a,a(A)}function a(A){const c=o(A);if(c)return c;const l=JSn(A,n);return i(A,l),l}return function(){return r(WSn.apply(null,arguments))}}const cd=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},_at=/^\[(?:([a-z-]+):)?(.+)\]$/i,qSn=/^\d+\/\d+$/,$Sn=new Set(["px","full","screen"]),XSn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ZSn=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,eQn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tQn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,nQn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,G8=t=>jk(t)||$Sn.has(t)||qSn.test(t),wQ=t=>qk(t,"length",lQn),jk=t=>!!t&&!Number.isNaN(Number(t)),F2e=t=>qk(t,"number",jk),bz=t=>!!t&&Number.isInteger(Number(t)),oQn=t=>t.endsWith("%")&&jk(t.slice(0,-1)),RA=t=>_at.test(t),PQ=t=>XSn.test(t),iQn=new Set(["length","size","percentage"]),rQn=t=>qk(t,iQn,fat),sQn=t=>qk(t,"position",fat),aQn=new Set(["image","url"]),AQn=t=>qk(t,aQn,uQn),cQn=t=>qk(t,"",gQn),Sz=()=>!0,qk=(t,e,n)=>{const o=_at.exec(t);return o?o[1]?typeof e=="string"?o[1]===e:e.has(o[1]):n(o[2]):!1},lQn=t=>ZSn.test(t)&&!eQn.test(t),fat=()=>!1,gQn=t=>tQn.test(t),uQn=t=>nQn.test(t),dQn=jSn(()=>{const t=cd("colors"),e=cd("spacing"),n=cd("blur"),o=cd("brightness"),i=cd("borderColor"),r=cd("borderRadius"),s=cd("borderSpacing"),a=cd("borderWidth"),A=cd("contrast"),c=cd("grayscale"),l=cd("hueRotate"),g=cd("invert"),u=cd("gap"),h=cd("gradientColorStops"),d=cd("gradientColorStopPositions"),m=cd("inset"),p=cd("margin"),_=cd("opacity"),f=cd("padding"),I=cd("saturate"),C=cd("scale"),y=cd("sepia"),x=cd("skew"),E=cd("space"),B=cd("translate"),S=()=>["auto","contain","none"],Q=()=>["auto","hidden","clip","visible","scroll"],w=()=>["auto",RA,e],M=()=>[RA,e],T=()=>["",G8,wQ],R=()=>["auto",jk,RA],F=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],O=()=>["solid","dashed","dotted","double","none"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>["start","end","center","between","around","evenly","stretch"],j=()=>["","0",RA],Z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],J=()=>[jk,RA];return{cacheSize:500,separator:":",theme:{colors:[Sz],spacing:[G8,wQ],blur:["none","",PQ,RA],brightness:J(),borderColor:[t],borderRadius:["none","","full",PQ,RA],borderSpacing:M(),borderWidth:T(),contrast:J(),grayscale:j(),hueRotate:J(),invert:j(),gap:M(),gradientColorStops:[t],gradientColorStopPositions:[oQn,wQ],inset:w(),margin:w(),opacity:J(),padding:M(),saturate:J(),scale:J(),sepia:j(),skew:J(),space:M(),translate:M()},classGroups:{aspect:[{aspect:["auto","square","video",RA]}],container:["container"],columns:[{columns:[PQ]}],"break-after":[{"break-after":Z()}],"break-before":[{"break-before":Z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...F(),RA]}],overflow:[{overflow:Q()}],"overflow-x":[{"overflow-x":Q()}],"overflow-y":[{"overflow-y":Q()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",bz,RA]}],basis:[{basis:w()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",RA]}],grow:[{grow:j()}],shrink:[{shrink:j()}],order:[{order:["first","last","none",bz,RA]}],"grid-cols":[{"grid-cols":[Sz]}],"col-start-end":[{col:["auto",{span:["full",bz,RA]},RA]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[Sz]}],"row-start-end":[{row:["auto",{span:[bz,RA]},RA]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",RA]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",RA]}],gap:[{gap:[u]}],"gap-x":[{"gap-x":[u]}],"gap-y":[{"gap-y":[u]}],"justify-content":[{justify:["normal",...Y()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Y(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Y(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[f]}],px:[{px:[f]}],py:[{py:[f]}],ps:[{ps:[f]}],pe:[{pe:[f]}],pt:[{pt:[f]}],pr:[{pr:[f]}],pb:[{pb:[f]}],pl:[{pl:[f]}],m:[{m:[p]}],mx:[{mx:[p]}],my:[{my:[p]}],ms:[{ms:[p]}],me:[{me:[p]}],mt:[{mt:[p]}],mr:[{mr:[p]}],mb:[{mb:[p]}],ml:[{ml:[p]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",RA,e]}],"min-w":[{"min-w":[RA,e,"min","max","fit"]}],"max-w":[{"max-w":[RA,e,"none","full","min","max","fit","prose",{screen:[PQ]},PQ]}],h:[{h:[RA,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[RA,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[RA,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[RA,e,"auto","min","max","fit"]}],"font-size":[{text:["base",PQ,wQ]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",F2e]}],"font-family":[{font:[Sz]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",RA]}],"line-clamp":[{"line-clamp":["none",jk,F2e]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",G8,RA]}],"list-image":[{"list-image":["none",RA]}],"list-style-type":[{list:["none","disc","decimal",RA]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",G8,wQ]}],"underline-offset":[{"underline-offset":["auto",G8,RA]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",RA]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",RA]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...F(),sQn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",rQn]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},AQn]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[d]}],"gradient-via-pos":[{via:[d]}],"gradient-to-pos":[{to:[d]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[r]}],"rounded-s":[{"rounded-s":[r]}],"rounded-e":[{"rounded-e":[r]}],"rounded-t":[{"rounded-t":[r]}],"rounded-r":[{"rounded-r":[r]}],"rounded-b":[{"rounded-b":[r]}],"rounded-l":[{"rounded-l":[r]}],"rounded-ss":[{"rounded-ss":[r]}],"rounded-se":[{"rounded-se":[r]}],"rounded-ee":[{"rounded-ee":[r]}],"rounded-es":[{"rounded-es":[r]}],"rounded-tl":[{"rounded-tl":[r]}],"rounded-tr":[{"rounded-tr":[r]}],"rounded-br":[{"rounded-br":[r]}],"rounded-bl":[{"rounded-bl":[r]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...O(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:O()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...O()]}],"outline-offset":[{"outline-offset":[G8,RA]}],"outline-w":[{outline:[G8,wQ]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:T()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[G8,wQ]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",PQ,cQn]}],"shadow-color":[{shadow:[Sz]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...U(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":U()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[o]}],contrast:[{contrast:[A]}],"drop-shadow":[{"drop-shadow":["","none",PQ,RA]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[l]}],invert:[{invert:[g]}],saturate:[{saturate:[I]}],sepia:[{sepia:[y]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[A]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[l]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[I]}],"backdrop-sepia":[{"backdrop-sepia":[y]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",RA]}],duration:[{duration:J()}],ease:[{ease:["linear","in","out","in-out",RA]}],delay:[{delay:J()}],animate:[{animate:["none","spin","ping","pulse","bounce",RA]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[bz,RA]}],"translate-x":[{"translate-x":[B]}],"translate-y":[{"translate-y":[B]}],"skew-x":[{"skew-x":[x]}],"skew-y":[{"skew-y":[x]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",RA]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",RA]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",RA]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[G8,wQ,F2e]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}),jn="u">typeof window?window:void 0,QC="u">typeof globalThis?globalThis:jn,X_=QC?.navigator,qo=QC?.document,qg=QC?.location,Qz=QC?.fetch,L2e=QC?.XMLHttpRequest&&"withCredentials"in new QC.XMLHttpRequest?QC.XMLHttpRequest:void 0,Iat=QC?.AbortController,hQn=QC?.CompressionStream,Py=X_?.userAgent,vz=typeof globalThis<"u"?globalThis:jn;vz&&typeof self>"u"&&(vz.self=vz),vz&&typeof File>"u"&&(vz.File=function(){});const Yr=jn??{},mQn="0.9.2",Y8={DEBUG:!1,LIB_VERSION:mQn,LIB_NAME:"browser-common"};var K9=(function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t})({}),H2e=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({});const pQn=["$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"],_Qn=["token"];function jr(t,e){return t.indexOf(e)!==-1}const $k=function(t){return t.trim()},O2e=function(t){return t.replace(/^\$/,"")};function Cat(t){var e;const n=[];return(e=JSON.stringify(t,function(o,i){if(typeof i=="bigint")return i.toString();if(typeof i!="function"&&typeof i!="symbol"){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&typeof i=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(i))return"[Circular]";n.push(i)}return i}}))!==null&&e!==void 0?e:"null"}const yat=Object.prototype,G2e=yat.hasOwnProperty,wne=yat.toString,qr=Array.isArray||function(t){return wne.call(t)==="[object Array]"},ap=t=>typeof t=="function",Ea=t=>t===Object(t)&&!qr(t),px=t=>{if(Ea(t)){for(const e in t)if(G2e.call(t,e))return!1;return!0}return!1},Eo=t=>t===void 0,$a=t=>wne.call(t)=="[object String]",wz=t=>$a(t)&&t.trim().length===0,ld=t=>t===null,Fs=t=>Eo(t)||ld(t),eh=t=>wne.call(t)=="[object Number]"&&t==t,U8=t=>eh(t)&&t>0,My=t=>wne.call(t)==="[object Boolean]",fQn=t=>jr(pQn,t),IQn=t=>jr(_Qn,t);function xat(t){return t===null||typeof t!="object"}function Pne(t,e){return{}.toString.call(t)===`[object ${e}]`}function Xk(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Eat(t,Error)}}function Y2e(t){return"u">typeof Event&&Eat(t,Event)}function Eat(t,e){try{return t instanceof e}catch{return!1}}const CQn=[!0,"true",1,"1","yes"],U2e=t=>jr(CQn,t),yQn=[!1,"false",0,"0","no"];function Bat(t,e,n,o,i,r,s){try{var a=t[r](s),A=a.value}catch(c){return void n(c)}a.done?e(A):Promise.resolve(A).then(o,i)}function $g(t){return function(){var e=this,n=arguments;return new Promise(function(o,i){var r=t.apply(e,n);function s(A){Bat(r,o,i,s,a,"next",A)}function a(A){Bat(r,o,i,s,a,"throw",A)}s(void 0)})}}const xQn=["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","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","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","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Mne=new Map,bat=function(t,e=[]){if(!t)return!1;const n=(function(s,a){let A="";for(let c=0;a.length>c;c++){const l=a[c];A+=l.length+":"+l}return s.length+":"+s+"|"+a.length+":"+A})(t,e),o=Mne.get(n);if(o!==void 0)return o;const i=t.toLowerCase(),r=xQn.concat(e).some(s=>i.indexOf(s.toLowerCase())!==-1);return 256>Mne.size||Mne.clear(),Mne.set(n,r),r};function z9(t,e,n,o,i){return e>n&&(o.warn("min cannot be greater than max."),e=n),eh(t)?t>n?(o.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(o.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(o.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),z9(i??n,e,n,o))}var EQn=class{constructor(e){this.C={},this.I=e.I,this.R=z9(e.bucketSize,0,100,e.A),this.$=z9(e.refillRate,0,this.R,e.A),this.O=z9(e.refillInterval,0,864e5,e.A)}F(e,n){const o=Math.floor((n-e.lastAccess)/this.O);o>0&&(e.tokens=Math.min(e.tokens+o*this.$,this.R),e.lastAccess=e.lastAccess+o*this.O)}consumeRateLimit(e){var n;const o=Date.now(),i=String(e);let r=this.C[i];return r?this.F(r,o):(r={tokens:this.R,lastAccess:o},this.C[i]=r),r.tokens===0||(r.tokens--,r.tokens===0&&((n=this.I)===null||n===void 0||n.call(this,e)),r.tokens===0)}stop(){this.C={}}};const Zk="Mobile",Pz="Android",Dne="Tablet",Sat="Android Tablet",Qat="iPad",vat="Apple Watch",Nne="Safari",Rne="BlackBerry",wat="Samsung Internet",Tne="Chrome",Pat="Chrome iOS",Mat="Internet Explorer",Dat="Internet Explorer Mobile",Nat="Opera",Rat="Microsoft Edge",kne="Firefox",Tat="Firefox iOS",Fne="Nintendo",Lne="PlayStation",Hne="Xbox",kat="Android Mobile",Fat="Mobile Safari",K2e="Windows",Lat="Windows Phone",Hat="Nokia",z2e="Ouya",BQn="Generic "+Zk.toLowerCase(),Oat="Generic "+Dne.toLowerCase(),V2e="Konqueror",Gat="Oculus Browser",Yat="Vivaldi",Uat="Yandex",Kat="Whale",zat="DuckDuckGo",Vat="Pale Moon",Jat="Waterfox",J2e="Brave",Wat="Claude",jat="Codex",qat="ChatGPT",$at="Google Search App",W2e=new RegExp("Version/(\\d+(\\.\\d+)?)"),j2e=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),bQn=new RegExp(Hne,"i"),SQn=new RegExp("PlayStation \\w+","i"),QQn=new RegExp("Nintendo \\w+","i"),q2e=new RegExp("BlackBerry|PlayBook|BB10","i"),vQn={"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"},Xat=function(t,e,n,o){return e=e||"",(function(r){return r?.brave?J2e:null})(n)||(o?.detectGoogleSearchApp&&jr(t,"GSA/")?$at:jr(t," OPR/")&&jr(t,"Mini")?"Opera Mini":jr(t," OPR/")?Nat:q2e.test(t)?Rne:jr(t,"IEMobile")||jr(t,"WPDesktop")?Dat:jr(t,"OculusBrowser")?Gat:jr(t,"SamsungBrowser")?wat:jr(t,"Edge")||jr(t,"Edg/")?Rat:jr(t,"Vivaldi/")?Yat:jr(t,"YaBrowser/")?Uat:jr(t,"Whale/")?Kat:jr(t,"DuckDuckGo/")||jr(t,"Ddg/")?zat:jr(t,"Claude/")?Wat:jr(t,"Codex/")?jat:jr(t,"ChatGPT/")?qat:jr(t,"FBIOS")?"Facebook Mobile":jr(t,"UCWEB")||jr(t,"UCBrowser")?"UC Browser":jr(t,"CriOS")?Pat:jr(t,"CrMo")||jr(t,Tne)?Tne:jr(t,Pz)&&jr(t,Nne)?kat:jr(t,"FxiOS")?Tat:jr(t.toLowerCase(),V2e.toLowerCase())?V2e:jr(t,"Brave/")?J2e:((r,s)=>s&&jr(s,"Apple")||(function(a){return jr(a,Nne)&&!jr(a,Tne)&&!jr(a,Pz)})(r))(t,e)?jr(t,Zk)?Fat:Nne:jr(t,"PaleMoon/")?Vat:jr(t,"Waterfox/")?Jat:jr(t,kne)?kne:jr(t,"MSIE")||jr(t,"Trident/")?Mat:jr(t,"Gecko")?kne:"")},wQn={[Dat]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Rat]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Tne]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Pat]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Nne]:[W2e],[Fat]:[W2e],[Nat]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[kne]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[Tat]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[V2e]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Rne]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),W2e],[kat]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[wat]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Gat]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Yat]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Uat]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Kat]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[J2e]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Wat]:[j2e],[jat]:[j2e],[qat]:[j2e],[zat]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Vat]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Jat]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[$at]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Mat]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},PQn=function(t,e,n,o){const i=Xat(t,e,n,o),r=wQn[i];if(Eo(r))return null;for(let s=0;r.length>s;s++){const a=t.match(r[s]);if(a)return parseFloat(a[a.length-2])}return null},Zat=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[Hne,t&&t[1]||""]],[new RegExp(Fne,"i"),[Fne,""]],[new RegExp(Lne,"i"),[Lne,""]],[q2e,[Rne,""]],[new RegExp(K2e,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Lat,""];if(new RegExp(Zk).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){let o=vQn[n[1]]||"";return/arm/i.test(e)&&(o="RT"),[K2e,o]}return[K2e,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let e="";return t&&t.length>=3&&(e=Eo(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Pz,[t[2],t[3],t[4]||"0"].join(".")]:[Pz,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],eAt=function(t){for(let e=0;Zat.length>e;e++){const[n,o]=Zat[e],i=n.exec(t),r=i&&(ap(o)?o(i,t):o);if(r)return r}return["",""]},tAt=function(t){return QQn.test(t)?Fne:SQn.test(t)?Lne:bQn.test(t)?Hne:new RegExp(z2e,"i").test(t)?z2e:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?Lat:/iPad/.test(t)?Qat:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?vat:q2e.test(t)?Rne:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Hat,"i").test(t)?Hat:/(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(Zk).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)?Pz:Sat:new RegExp("(pda|Mobile)","i").test(t)?BQn:new RegExp(Dne,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?Oat:""},MQn=function(t,e){var n;const o=tAt(t);return o===Qat||o===Sat||o==="Kobo"||o==="Kindle Fire"||o===Oat?Dne:o===Fne||o===Hne||o===Lne||o===z2e?"Console":o===vat?"Wearable":o?Zk:e?.userAgentDataPlatform==="Android"&&((n=e?.maxTouchPoints)!==null&&n!==void 0?n:0)>0?600>Math.min((i=e?.screenWidth)!==null&&i!==void 0?i:0,(r=e?.screenHeight)!==null&&r!==void 0?r:0)/((s=e?.devicePixelRatio)!==null&&s!==void 0?s:1)?Zk:Dne:"Desktop";var i,r,s},$2e=/\bFBAV\/(\d+(?:\.\d+)*)/i,nAt=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",$2e],[/\bFBAN\/EMA\b/i,"Facebook Lite",$2e],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",$2e],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],X2e="[Truncated]",Mz="[Unserializable]";function eF(t){let e="";for(let n=0;t.length>n;n++){const o=t.charCodeAt(n);if(55296>o||o>56319)e+=56320>o||o>57343?t[n]:"�";else{const i=t.charCodeAt(n+1);56320>i||i>57343?e+="�":(e+=t[n]+t[n+1],n++)}}return e}function oAt(t,e){if(!e)return t;let n=[];try{n=Object.keys(e)}catch{n=[]}for(const o of n){let i;try{i=e[o]}catch{i=Mz}Object.defineProperty(t,o,{value:i,enumerable:!0,writable:!0,configurable:!0})}return t}const One=3e5;var iAt=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const n=this.isOpen(),o=Date.now(),i=Math.min(e.retryAfterMs,One);if(!n)return this.ts=o,void(this.es=o+i);this.es=Math.max(this.es,Math.min(o+i,this.ts+One))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const n=Math.min(One,Math.max(0,this.es-e));return n===0&&this.reset(),n}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const DQn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function rAt(t,e){return typeof(n=t)=="string"&&DQn.test(n)?t:e();var n}function sAt(t,e){const n=new Error(e);try{Object.defineProperty(n,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function MQ(t){return t&&t.split("#")[0]}function aAt(t){try{return t()}catch{return}}function AAt(t,e){const n=setTimeout(t,e);return n!=null&&n.unref&&n?.unref(),n}function cAt(t,e,n){return lAt.apply(this,arguments)}function lAt(){return(lAt=$g(function*(t,e,n){let o;try{return yield Promise.race([t,new Promise((i,r)=>{o=AAt(()=>{try{n?.(),i()}catch(s){r(s)}},e)})])}finally{clearTimeout(o)}})).apply(this,arguments)}let Gne,gAt,Z2e;function NQn(t){const e=globalThis._posthogChunkIds;if(!e)return;const n=Object.keys(e);return Z2e&&n.length===gAt||(gAt=n.length,Z2e=n.reduce((o,i)=>{Gne||(Gne={});const r=Gne[i];if(r)o[r[0]]=r[1];else{const s=t(i);for(let a=s.length-1;a>=0;a--){const A=s[a],c=A?.filename,l=e[i];if(c&&l){o[c]=l,Gne[i]=[c,l];break}}}return o},{})),Z2e}function Dz(t){return Dz=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Dz(t)}function RQn(t,e,n){return(e=(function(o){var i=(function(r){if(Dz(r)!="object"||!r)return r;var s=r[Symbol.toPrimitive];if(s!==void 0){var a=s.call(r,"string");if(Dz(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)})(o);return Dz(i)=="symbol"?i:i+""})(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uAt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,o)}return n}function Zt(t){for(var e=1;arguments.length>e;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?uAt(Object(n),!0).forEach(function(o){RQn(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):uAt(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}var TQn=class{constructor(e,n,o=[]){this.coercers=e,this.stackParser=n,this.modifiers=o}buildFromUnknown(e,n={}){const o=n&&n.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(o,n,0).apply(e),r=this.buildParsingContext(n),s=this.parseStacktrace(i,r);return{$exception_list:this.convertToExceptionList(s,o),$exception_level:"error"}}modifyFrames(e){var n=this;return $g(function*(){for(const o of e)o.stacktrace&&o.stacktrace.frames&&qr(o.stacktrace.frames)&&(o.stacktrace.frames=yield n.applyModifiers(o.stacktrace.frames));return e})()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var o;let i,r;if(e.cause!=null&&(i=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null)try{r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)}catch{}return Zt(Zt({},e),{},{cause:i,stack:r,errors:(o=e.errors)===null||o===void 0?void 0:o.map(s=>this.parseStacktrace(s,n))})}applyChunkIds(e,n){return e.map(o=>(o.filename&&n&&(o.chunk_id=n[o.filename]),o))}applyCoercers(e,n){for(const o of this.coercers)if(o.match(e))return o.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return $g(function*(){let o=e;for(const i of n.modifiers)o=yield i(o);return o})()}convertToExceptionList(e,n){const o=[],i=(r,s,a)=>{var A;const c=o.length,l=s===void 0?Zt(Zt({type:typeof n.type=="string"&&n.type.length>0?n.type:"generic"},typeof n.handled=="boolean"?{handled:n.handled}:n.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof n.synthetic=="boolean"?n.synthetic:r.synthetic,exception_id:c}):{type:"chained",source:a,synthetic:r.synthetic,exception_id:c,parent_id:s},g={type:r.type,value:r.value,mechanism:l};r.stack&&(g.stacktrace={type:"raw",frames:r.stack}),o.push(g),r.cause&&i(r.cause,c,"cause");for(const u of(A=r.errors)!==null&&A!==void 0?A:[])i(u,c,"member")};return i(e),o}buildParsingContext(e){var n;return{chunkIdMap:NQn(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}getAggregateErrors(e){try{if(Xk(e)){let o=Object.getPrototypeOf(e);for(let i=0;o&&100>i;i++){var n;const r=(n=Object.getOwnPropertyDescriptor(o,"constructor"))===null||n===void 0?void 0:n.value;if(typeof r=="function"&&r.name==="AggregateError"){const s=e.errors;return qr(s)?s:void 0}o=Object.getPrototypeOf(o)}}}catch{}}buildCoercingContext(e,n,o=0){let i=0,r=0,s=!1;const a=new Set,A=[],c={},l=(h,d,m=0)=>{const p=g(d,m),_=p.apply;if(p.apply=E=>{A.push(h);try{return _(E)}finally{A.pop()}},m>4||m>0&&A.indexOf(h)!==-1)return this.coerceFallback(p);const f=typeof h=="object"&&h!==null||typeof h=="function";if(m===0&&i>=50||f&&a.has(h))return;f&&a.add(h),m===0&&i++;const I=this.getAggregateErrors(h);let C,y;s||(s=!!I);try{if(C=this.applyCoercers(h,p),!C)throw c}catch(E){if(E===c)return void(m===0&&i--);if(!s)throw E;C=this.coerceFallback(p)}if(!I||i>=50)return C;try{y=I.length}catch{return C}if(!Number.isInteger(y)||0>y||y>4294967295)return C;const x=[];for(let E=0;50>i&&1e3>r&&y>E;E++){let B;r++;try{B=p.next(I[E])}catch{i++,B=this.coerceFallback(g(d+1))}B&&x.push(B)}return Zt(Zt({},C),{},{errors:x})},g=(h,d=0)=>Zt(Zt({},n),{},{syntheticException:h==0?n.syntheticException:void 0,mechanism:h==0?e:{},apply(m){const p=l(m,h,d+1);if(!p)throw c;return p},next:m=>l(m,h+1)}),u=g(o);return Zt(Zt({},u),{},{apply:h=>{var d;return(d=l(h,o))!==null&&d!==void 0?d:this.coerceFallback(u)}})}};const kQn=/^([a-z][a-z0-9.+-]+):/i,FQn=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function LQn(t){if(!t||t==="<anonymous>")return!1;const e=kQn.exec(t);return!e||FQn.includes(e[1].toLowerCase())}function exe(t,e,n,o,i){const r={platform:t,filename:e,function:n==="<anonymous>"?"?":n,in_app:LQn(e)};return Eo(o)||(r.lineno=o),Eo(i)||(r.colno=i),r}const dAt=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,o=t.indexOf("safari-web-extension")!==-1;return n||o?[t.indexOf("@")!==-1?t.split("@")[0]:"?",n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},HQn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,OQn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,GQn=/\((\S*)(?::(\d+))(?::(\d+))\)/,YQn=(t,e)=>{const n=HQn.exec(t);if(n){const[,i,r,s]=n;return exe(e,i,"?",+r,+s)}const o=OQn.exec(t);if(o){if(o[2]&&o[2].indexOf("eval")===0){const s=GQn.exec(o[2]);s&&(o[2]=s[1],o[3]=s[2],o[4]=s[3])}const[i,r]=dAt(o[1]||"?",o[2]);return exe(e,r,i,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},UQn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,KQn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,zQn=(t,e)=>{const n=UQn.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){const r=KQn.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}let o=n[3],i=n[1]||"?";return[i,o]=dAt(i,o),exe(e,o,i,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},hAt=/\(error: (.*)\)/;function txe(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function VQn(t){for(let e=1;10>=e;e++){const n=t.length-2*e;if(0>n)break;let o=!0;for(let i=0;e>i;i++)if(!txe(t[n+i],t[n+e+i])){o=!1;break}if(o){for(let i=0;e>i;i++)t[n+i]=t[n+e+i];return t.length=n+e,{start:n,length:e}}}}function JQn(t,e){const n=e.start+e.length,o=pAt(t,e);o&&t.splice(n+o===t.length?n:e.start,o)}function mAt(t,e){let n=e.start;for(;n>0&&txe(t[n-1],t[n-1+e.length]);)n--;return e.start-n}function pAt(t,e){const n=e.start+e.length;let o=n;for(;t.length>o&&txe(t[o],t[o-e.length]);)o++;return o-n}function WQn(t,e){const n=e[0];let o=t.length-(n?mAt(t,n):0);for(const i of e)o-=pAt(t,i);return o}function jQn(t,e,n){for(let o=0;t.length>o;o++){const i=t[(e+o)%t.length],r=t[(n+o)%t.length];if(i!==r)return r>i}return!1}var qQn=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){const o=$a(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:o?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${n}: ${e.message}`:n}isDOMException(e){return Pne(e,"DOMException")}isDOMError(e){return Pne(e,"DOMError")}},$Qn=class{match(e){return Xk(e)}coerce(e,n){var o;const i=this.getStack(e),r=i===void 0?(o=n.syntheticException)===null||o===void 0?void 0:o.stack:void 0,s=!!r;return{type:this.getType(e),value:this.getMessage(e,n),stack:i??r,cause:e.cause?n.next(e.cause):void 0,synthetic:s}}getType(e){return e.name||e.constructor.name}getMessage(e,n){const o=e.message;return String(o.error&&typeof o.error.message=="string"?o.error.message:o)}getStack(e){try{const n=e.stacktrace;if(typeof n=="string"&&n.length>0)return n;const o=e.stack;return typeof o=="string"&&o.length>0?o:void 0}catch{return}}},XQn=class{match(e){return!!Pne(e,"ErrorEvent")&&(e.error!=null||this.ar(e))}coerce(e,n){var o;if(e.error!=null)return n.apply(e.error);const i=n.apply(e.message);return Zt(Zt({},i),{},{stack:(o=this.lr(e))!==null&&o!==void 0?o:i.stack,synthetic:!0})}ar(e){return $a(e.message)&&e.message.length>0}lr(e){var n,o;const i=e,r=(n=i.lineno)!==null&&n!==void 0?n:0,s=(o=i.colno)!==null&&o!==void 0?o:0;if($a(i.filename)&&i.filename.length!==0&&r!==0)return`Error
240
- at ${i.filename}:${r}:${s}`}};const ZQn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var evn=class{match(e){return typeof e=="string"}coerce(e,n){var o;const[i,r]=this.getInfos(e);return{type:i??"Error",value:r??e,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}getInfos(e){let n="Error",o=e;const i=e.match(ZQn);return i&&(n=i[1],o=i[2]),[n,o]}};const tvn=["fatal","error","warning","log","info","debug"];function _At(t,e=40){const n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(let o=n.length;o>0;o--){const i=n.slice(0,o).join(", ");if(e>=i.length)return o===n.length?i:i.length>e?`${i.slice(0,e)}...`:i}return""}var nvn=class{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var o,i;const r=this.getErrorPropertyFromObject(e);return r?n.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(o=this.getStack(e))!==null&&o!==void 0?o:(i=n.syntheticException)===null||i===void 0?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Y2e(e))return e.constructor.name;const n="name"in e?e.name:void 0;return $a(n)&&!wz(n)?n:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let o=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(o+=` with message: '${e.message}'`),o}if("message"in e&&typeof e.message=="string")return e.message;const n=this.getObjectClassName(e);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${_At(e)}`}isSeverityLevel(e){return $a(e)&&!wz(e)&&tvn.indexOf(e)>=0}getStack(e){try{return $a(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:$a(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const n in e)if({}.hasOwnProperty.call(e,n)){const o=e[n];if(Xk(o))return o}}getObjectClassName(e){try{const n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}},ovn=class{match(e){return Y2e(e)}coerce(e,n){var o;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${_At(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},ivn=class{match(e){return xat(e)}coerce(e,n){var o;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},rvn=class{match(e){return Pne(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Y2e(e))return!1;try{const n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var o;const i=this.getUnhandledRejectionReason(e);return xat(i)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}:n.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}};const Yne="$message",Une="$timestamp",svn=new Set([Yne,Une]),nxe={enabled:!0,max_bytes:32768};function Kne(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:nxe.enabled,max_bytes:Avn(t.max_bytes,nxe.max_bytes)}:Zt({},nxe)}var avn=class{constructor(e){this.ns=[],this.ss=0,this.Mr=Kne(e)}setConfig(e){this.Mr=Kne(e),this.rs()}add(e){const n=(function(i){let r;try{r=Cat(i)}catch{return}try{const s=JSON.parse(r);if(!Ea(s))return;const a=s,A=a[Yne],c=a[Une];return!$a(A)||A.trim().length===0||!$a(c)&&!eh(c)?void 0:{step:a,json:r}}catch{return}})(e);if(!n)return;const o=(function(i){if("u">typeof TextEncoder)return new TextEncoder().encode(i).length;const r=encodeURIComponent(i);let s=0;for(let a=0;r.length>a;a++)r[a]==="%"?(s+=1,a+=2):s+=1;return s})(n.json);o>this.Mr.max_bytes||(this.ns.push({step:n.step,bytes:o}),this.ss+=o,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Mr.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function Avn(t,e){if(!eh(t)||t===1/0||t===-1/0)return e;const n=Math.floor(t);return 0>n?e:n}const fAt=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function IAt(t){return typeof t=="string"||t}function CAt(t){return typeof t=="string"?t:void 0}const cvn=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server","$react_native_version"],yAt="NativeGzipValidationError",oxe=t=>t.length>=2&&t[0]===31&&t[1]===139,xAt=(t,e)=>t===H2e.GZipJS||e===H2e.GZipJS||e==="gzip",EAt=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError";let Nz;const zne=t=>{throw sAt(yAt,`Native gzip produced invalid output: ${t}`)},lvn=(BAt=$g(function*(t,e){18>t.size&&zne("too-short");const n=new Uint8Array(yield t.slice(0,10).arrayBuffer());oxe(n)&&n[2]===8||zne("invalid-header");const o=new DataView(yield t.slice(t.size-8).arrayBuffer());o.getUint32(0,!0)!==(r=>{const s=(()=>{if(Nz)return Nz;Nz=[];for(let A=0;256>A;A++){let c=A;for(let l=0;8>l;l++)c=1&c?3988292384^c>>>1:c>>>1;Nz[A]=c>>>0}return Nz})();let a=4294967295;for(let A=0;r.length>A;A++)a=s[255&(a^r[A])]^a>>>8;return(4294967295^a)>>>0})(e)&&zne("invalid-crc");const i=e.length>>>0;o.getUint32(4,!0)!==i&&zne("invalid-size")}),function(t,e){return BAt.apply(this,arguments)});var BAt;function ixe(){return ixe=$g(function*(t,e=!0,n){try{const i=new TextEncoder().encode(t),r=new globalThis.CompressionStream("gzip"),s=r.writable.getWriter(),a=s.write(i).then(()=>s.close()).catch((o=$g(function*(l){try{yield s.abort(l)}catch{}throw l}),function(l){return o.apply(this,arguments)})),A=new Response(r.readable).blob(),[c]=yield Promise.all([A,a]);return yield lvn(c,i),c}catch(i){if(n?.rethrow)throw i;return e&&console.error("Failed to gzip compress data",i),null}var o}),ixe.apply(this,arguments)}function bAt(t,e){if(t==null)return{};var n,o,i=(function(s,a){if(s==null)return{};var A={};for(var c in s)if({}.hasOwnProperty.call(s,c)){if(a.includes(c))continue;A[c]=s[c]}return A})(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;r.length>o;o++)e.includes(n=r[o])||{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}const vC="[redacted]",gvn=/^[A-Za-z0-9+/\n\r]+=*$/,uvn=/^[A-Za-z0-9_-]+={0,2}$/,dvn=/[-_]/,hvn=/^data:[^,\s]*;base64,/i,mvn=/^[A-Za-z0-9+/_-]+={0,2}$/,pvn=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,_vn=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,SAt=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,fvn=/[\s<>"]/,QAt=new RegExp(SAt.source,"i"),vAt=/[a-z][a-z0-9+.-]{0,63}:\/\//i,Ivn=new RegExp(`^${vAt.source}`,"i"),Cvn=new RegExp(vAt.source,"gi"),yvn=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,xvn=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,Evn=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,Bvn=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,bvn=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,Svn=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){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}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,Qvn=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,vvn=/\b\d(?:[ ./-]?\d){12,}\b/g,wAt=/\d+/g,wvn=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,Pvn=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function rxe(t){return(function(e){return _vn.test(e)})(t)||yvn.test(t)||xvn.test(t)}function sxe(t){return t.split("&",129).length>128}function Mvn(t,e,n){return rxe(t)||e.includes(";")&&(function(o){return o.split(";").some(i=>rxe(i.split("=",1)[0]))})(e)?vC:QAt.test(e)?n?Axe(e,{allowNestedUrls:!1,stripPunctuation:!0}):vC:e}function PAt(t,e){const n=new URLSearchParams;let o=!1,i=!1;for(const[r,s]of new URLSearchParams(t)){const a=Vne(r),A=Vne(s);o||(o=a!==r||A!==s);const c=Mvn(a,A,e);o||(o=c!==A),i=rxe(a)||c!==A,n.append(a,c)}return{changed:o,lastFieldSensitive:i,serialized:n.toString()}}function MAt(t,e){if(!t.includes("="))return{value:Dvn(t,e),lastFieldSensitive:!1};const n=PAt(t,e);return{value:n.changed?n.serialized:t,lastFieldSensitive:n.lastFieldSensitive}}function Dvn(t,e){return e?Axe(t,{allowNestedUrls:!1,stripPunctuation:!0}):QAt.test(t)?vC:t}function Nvn(t,e,n){return t==="#"?!e.fragment&&(e.fragment=!0):t==="?"&&(e.fragment?n!=="="&&!e.fragmentQuery&&(e.fragmentQuery=!0):!e.query&&(e.query=!0))}function axe(t,e){var n;if(t.length>8192&&Ivn.test(t))return vC;const{address:o,suffix:i}=e.stripPunctuation?(function(p){let _=p.length;for(;_>0&&".,;:!?)]}'".includes(p[_-1]);)_--;return{address:p.slice(0,_),suffix:p.slice(_)}})(t):{address:t,suffix:""};let r;try{r=new URL(o)}catch{return vC+i}const s=r.search.slice(1),a=r.hash!=="",A=(function(p){const _=p.slice(1),f=_.indexOf("?");return 0>f?{head:_,tail:null}:{head:_.slice(0,f),tail:_.slice(f+1)}})(r.hash);if(sxe(s)||sxe(A.head)||sxe((n=A.tail)!==null&&n!==void 0?n:""))return vC+i;let c=!1;(r.username||r.password)&&(r.username=vC,r.password="",c=!0);const l=PAt(s,e.allowNestedUrls);l.changed&&(r.search=l.serialized,c=!0);const g=MAt(A.head,e.allowNestedUrls),u=A.tail===null?null:(h=A.tail,g.lastFieldSensitive?{value:h===""?"":vC,lastFieldSensitive:!0}:MAt(h,e.allowNestedUrls));var h;const d=u===null?g.value:`${g.value}?${u.value}`;d!==r.hash.slice(1)&&(r.hash=d,c=!0);const m=a?u??g:l;return(c?Vne(r.toString()):o)+(m.lastFieldSensitive?"":i)}function Axe(t,e){return t.replace(SAt,n=>(function(o,i){const r=(function(A){if(!A.includes("://"))return[];const c=[...A.matchAll(Cvn)].map(m=>m.index),l=[],g={query:!1,fragment:!1,fragmentQuery:!1};let u=0,h=!1,d="";for(let m=0;A.length>m&&c.length>u;m++){c[u]===m&&(m>0&&d!=="="&&l.push(m),u++);const p=A[m];Nvn(p,g,d)?(d=p,h=!0):h&&"=&".includes(p)&&(d=p)}return l})(o);if(r.length===0)return axe(o,i);let s="",a=0;for(const A of r)s+=axe(o.slice(a,A),Zt(Zt({},i),{},{stripPunctuation:!1})),a=A;return s+axe(o.slice(a),i)})(n,Zt(Zt({},e),{},{stripPunctuation:e.stripPunctuation&&n.length!==t.length})))}function Vne(t){return t.replace(pvn,vC)}function Rvn(t,e){return(function(n){return n.length>=10240&&(gvn.test(n)||(function(o){const i=hvn.exec(o);if(!i)return!1;let r;try{r=decodeURIComponent(o.slice(i[0].length))}catch{return!1}return mvn.test(r.replace(/[\r\n]/g,""))})(n)||dvn.test(n)&&uvn.test(n))})(t)?"[binary data redacted - not supported by PostHog MCP analytics]":(function(n,o,i){const r=4*i.maxStringLength;if(n.length>r){const s=o(n.slice(0,(function(a,A){let c=A;for(;c>0&&!fvn.test(a[c-1]);)c--;return c})(n,r)));if(s.length>=2*i.maxStringLength)return s+i.truncationSuffix}return o(n)})(t,n=>(function(o){return Axe(o,{allowNestedUrls:!0,stripPunctuation:!0})})((function(o){let i=o.replace(Evn," ");return i=i.replace(Bvn,vC),i=i.replace(bvn,vC),i=i.replace(Svn,`$1${vC}`),i=i.replace(vvn,kvn),i=i.replace(Qvn,vC),i=i.replace(wvn,`$1${vC}`),i=i.replace(Pvn,`$1${vC}`),i})(Vne(n))),e)}function Tvn(t){let e=0,n=!1;for(let o=t.length-1;o>=0;o--){let i=t.charCodeAt(o)-48;if(0>i||i>9)return!1;n&&(i*=2,i>9&&(i-=9)),e+=i,n=!n}return e%10==0}function kvn(t){const e=[];for(let r=wAt.exec(t);r!==null;r=wAt.exec(t))e.push({digits:r[0],start:r.index,end:r.index+r[0].length});let n="",o=0,i=0;for(;e.length>i;){let r="",s=-1;for(let a=i;e.length>a&&(r+=e[a].digits,19>=r.length);a++)r.length>=13&&Tvn(r)&&(s=a);0>s?i++:(n+=t.slice(o,e[i].start)+vC,o=e[s].end,i=s+1)}return n+t.slice(o)}const Fvn={}.propertyIsEnumerable;function Jne(t,e){try{return DAt(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function cxe(t,e,n,o){if(0>=n.remainingNodes)return{stringValue:X2e};if(n.remainingNodes--,My(t))return{boolValue:t};if(typeof t=="bigint")return(function(i,r){const s=i.toString(),a=BigInt("9223372036854775808");return i>=a||-a>i?(r?.debug(`Attribute ${s} is outside the int64 range; encoding it as a string`),{stringValue:s}):{intValue:s}})(t,e);if(typeof t=="number"){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const i=BigInt(t).toString();return t>=9223372036854776e3||-9223372036854776e3>t?(e?.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:t}}if(typeof t=="string")return{stringValue:eF(t)};if(typeof t=="function")return{stringValue:"[Function]"};if(typeof t=="symbol")return{stringValue:String(t)};if(typeof t=="object"&&t!==null){if(n.ancestors.has(t))return{stringValue:"[Circular]"};if(o>=20)return{stringValue:X2e};if(t instanceof Date){const i=t.getTime(),r=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:typeof r=="string"?eF(r):String(r)}}n.ancestors.add(t);try{try{const i=t.toJSON;if(typeof i=="function")return cxe(i.call(t),e,n,o+1)}catch{}return qr(t)?{arrayValue:{values:Lvn(t,e,n,o+1)}}:{kvlistValue:{values:DAt(t,e,n,o+1)}}}finally{n.ancestors.delete(t)}}return{stringValue:eF(String(t))}}function Lvn(t,e,n,o){const i=[],r=Math.min(t.length,1e3);let s=0;for(;r>s&&n.remainingNodes>0;s++)try{const a=s in t?t[s]:void 0;if(Fs(a))continue;i.push(cxe(a,e,n,o))}catch{i.push({stringValue:Mz})}return t.length>s&&i.push({stringValue:X2e}),i}function DAt(t,e,n,o){const i=[];for(const r in t)if(Fvn.call(t,r)){if(!r){e?.debug("Dropping an attribute with an empty key");continue}if(i.length>=1e3||0>=n.remainingNodes){e?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const s=t[r];if(ld(s)||Eo(s))continue;i.push({key:eF(r),value:cxe(s,e,n,o)})}catch{i.push({key:eF(r),value:{stringValue:Mz}})}}return i}function NAt(t,e,n){return Zt(Zt(Zt(Zt({},oAt({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":e,"telemetry.sdk.version":n})}const Hvn=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function RAt(t,e){const n=oAt({},t),o={};for(const i of Hvn)({}).hasOwnProperty.call(n,i)&&(o[i]=n[i],delete n[i]);return[...Jne(n,e),...Jne(o,e)]}const TAt={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},kAt={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Ovn=kAt.info;function Gvn(t){try{return eF(String(t))}catch{return Mz}}function Yvn(t,e,n,o){const i=t.level||"info",{text:r,number:s}=kAt[i]||Ovn,a=(function(u=Date.now()){return String(u)+"000000"})(eh(o)?o:void 0),A={};e.distinctId&&(A.posthogDistinctId=e.distinctId),e.sessionId&&(A.sessionId=e.sessionId),e.windowId&&(A["window.id"]=e.windowId),Fs(e.sessionStartTimestamp)||(A.sessionStartTimestamp=String(e.sessionStartTimestamp)),Fs(e.lastActivityTimestamp)||(A.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(A["url.full"]=e.currentUrl),e.screenName&&(A["screen.name"]=e.screenName),e.appState&&(A["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(A.feature_flags=e.activeFeatureFlags);const c=Zt({},A),l=t.attributes;if(l){let u=[];try{u=Object.keys(l)}catch{u=[]}for(const h of u){let d;try{d=l[h]}catch{d=Mz}Object.defineProperty(c,h,{value:d,enumerable:!0,writable:!0,configurable:!0})}}const g={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:s,severityText:r,body:{stringValue:Gvn(t.body)},attributes:Jne(c,n)};return t.trace_id&&(g.traceId=t.trace_id),t.span_id&&(g.spanId=t.span_id),Eo(t.trace_flags)||(g.flags=t.trace_flags),g}function FAt(t,e,n){return NAt(t,e,n)}function LAt(t,e,n,o){return{resourceLogs:[{resource:{attributes:RAt(e)},scopeLogs:[{scope:{name:n,version:o},logRecords:t}]}]}}var HAt=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.cs}arm(e){this.clear(),this.us=Date.now()+e,this.cs=AAt(()=>{this.cs=void 0,this.ls()},e)}armNoEarlierThan(e){this.cs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function OAt(){return .75+.5*Math.random()}function GAt(t,e,n,o){const i=Math.min(Math.max(0,e-1),6),r=t*Math.pow(2,i);return Math.round(Math.min(r,Math.max(o,t))*n)}var Uvn=class{constructor(e,n,o,i,r,s=()=>Promise.resolve(),a){var A;this._instance=e,this.Mr=n,this.A=o,this.hs=i,this.ds=r,this.vs=s,this.fs=a,this.ps=new HAt(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new iAt,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=n.maxBufferSize,this.Is=Math.max((A=n.maxQueueSize)!==null&&A!==void 0?A:n.maxBufferSize,n.maxBufferSize),this.Ms=n.flushIntervalMs,this.Es=n.maxBatchRecordsPerPost,this.Ps=n.rateCapWindowMs,this.Rs=n.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(K9.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.$s=0,this.Cs=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,n){var o;if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;const i=this.Os(e);if(i===null)return;if(!i.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;const r={record:Yvn(i,(o=n?.context)!==null&&o!==void 0?o:this.hs(),this.A,n?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){const n=this.Mr.beforeSend;if(!n)return e;const o=qr(n)?n:[n];let i=e;for(const r of o)try{const s=r(i);if(!s)return this.A.info("Log was rejected in beforeSend function"),null;i=s}catch(s){return this.A.error("Error in beforeSend function for log:",s),null}return i}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),n=e-this.xs;return this.Ps>n&&n>=0||(this.xs=e,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.Cs=!0),!1)}flush(){var e=this;return $g(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return $g(function*(){var n;e.ps.clear();let o=(n=e._instance.getPersistedProperty(K9.LogsQueue))!==null&&n!==void 0?n:[];if(o.length===0)return;const i=o.length;let r=0;for(;o.length>0&&i>r;){var s,a;const A=e._s;e.bs=0;const c=Math.min(o.length,e.Es),l=o.slice(0,c),g=LAt(l.map(h=>h.record),e.qs(),(s=e.fs)!==null&&s!==void 0?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),u=yield e._instance.js(g);if(e._s!==A)return;if(u.kind==="too-large"&&l.length>1)e.Es=Math.max(1,Math.floor(l.length/2)),e.A.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(u),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),u.kind==="retry-later"||(u.kind==="too-large"?e.A.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):u.kind==="ok"&&e.Mr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Mr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(l.length),o=(a=e._instance.getPersistedProperty(K9.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,u.kind==="fatal"))throw u.error}})()}Bs(e){var n=this;return $g(function*(){var o;const i=Math.max(0,e-n.bs),r=(o=n._instance.getPersistedProperty(K9.LogsQueue))!==null&&o!==void 0?o:[];n._instance.setPersistedProperty(K9.LogsQueue,r.slice(i)),yield n.vs()})()}qs(){return FAt(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var n;if(this._instance.optedOut)return;const o=(n=this._instance.getPersistedProperty(K9.LogsQueue))!==null&&n!==void 0?n:[];this.Is>o.length||(o.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),o.push(e),this._instance.setPersistedProperty(K9.LogsQueue,o),this.Ts>o.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}zs(){return Math.max(GAt(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(K9.LogsQueue);return!!e&&e.length>0}shutdown(e){var n=this;return $g(function*(){n.ps.clear();const o=n.flush().catch(()=>{});e!==void 0?yield cAt(o,e):yield o})()}flushWithTimeout(e){var n=this;return $g(function*(){const o=n.flush();yield cAt(o,e,()=>{o.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=OAt(),this.A.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.zs())})}};const lxe=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function YAt(t){return String(t)+"000000"}function UAt(t,e,n,o){let i="";return o&&(i=Object.keys(o).sort().map(r=>`${JSON.stringify(r)}:${JSON.stringify(o[r])}`).join(",")),`${t}\0${e}\0${n??""}\0${i}`}var Kvn=class{constructor(e,n,o){this._instance=e,this.Mr=n,this.A=o,this.Hs=new Map,this.ps=new HAt(()=>this.flush().catch(i=>{this.A.error("Metrics flush failed:",i)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new iAt,this.ks=0,this.Ss=1,this.Gs=0}count(e,n=1,o){this.Qs({name:e,type:"count",value:n,unit:o?.unit,attributes:o?.attributes})}gauge(e,n,o){this.Qs({name:e,type:"gauge",value:n,unit:o?.unit,attributes:o?.attributes})}histogram(e,n,o){this.Qs({name:e,type:"histogram",value:n,unit:o?.unit,attributes:o?.attributes})}flush(){var e=this;const n=this.ys,o=(function(){var i=$g(function*(){n&&(yield n.catch(()=>{})),yield e.Zs()});return function(){return i.apply(this,arguments)}})()().finally(()=>{this.ys===o&&(this.ys=null)});return this.ys=o,o}drainWindow(){if(this.Hs.size===0)return null;const e=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.Hs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Qs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const n=this.Os(e);if(n===null)return;if(!n.name||typeof n.name!="string")return void this.A.warn("Dropping metric with empty name");if(typeof n.value!="number"||!Number.isFinite(n.value))return void this.A.warn(`Dropping metric '${n.name}': value must be a finite number`);if(n.type==="count"&&0>n.value)return void this.A.warn(`Dropping count '${n.name}': counters are monotonic, value must be >= 0`);let o,i;try{o=n.attributes?Zt({},n.attributes):void 0,i=UAt(n.type,n.name,n.unit,o)}catch(a){return void this.A.warn(`Dropping metric '${n.name}': attributes could not be serialized`,a)}let r=this.Hs.get(i);if(!r){if(!this.Ks())return;r={name:n.name,type:n.type,unit:n.unit,attributes:o,windowStartMs:Date.now()},this.Hs.set(i,r)}const s=this.Ws.get(n.name);s===void 0?this.Ws.set(n.name,n.type):s===n.type||this.Vs.has(n.name)||(this.Vs.add(n.name),this.A.warn(`Metric name '${n.name}' is already used as a ${s}; recording it as a ${n.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(r,n.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.A.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,n){switch(e.type){case"count":var o;e.total=((o=e.total)!==null&&o!==void 0?o:0)+n;break;case"gauge":e.last=n;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:n,max:n,bucketCounts:new Array(lxe.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=n,i.min=Math.min(i.min,n),i.max=Math.max(i.max,n),i.bucketCounts[(function(r,s){for(let a=0;s.length>a;a++)if(s[a]>=r)return a;return s.length})(n,lxe)]+=1;break}}}Os(e){const n=this.Mr.beforeSend;if(!n)return e;const o=qr(n)?n:[n];let i=e;for(const r of o)try{const s=r(i);if(!s)return this.A.info("Metric was rejected in beforeSend function"),null;i=s}catch(s){return this.A.error("Error in beforeSend function for metric:",s),null}return i}Fs(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(GAt(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Zs(){var e=this;return $g(function*(){if(e.ps.clear(),e.Hs.size===0)return;const n=e.Hs;e.Hs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const o=e.Gs,i=yield e._instance.Ys(e.Js(n));if(o===e.Gs)switch(e.ws.record(i),i.kind==="retry-later"?(e.ks++,e.Ss=OAt()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.zs()),i.kind){case"ok":return;case"retry-later":return e.co(n),void e.ps.armNoEarlierThan(e.zs());case"too-large":return void e.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.A.error("Failed to send metrics batch:",i.error)}})()}Js(e){return n=this.ho(e),o=(function(s,a,A){return NAt(s,a,A)})(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:RAt(o)},scopeMetrics:[{scope:{name:i,version:r},metrics:n}]}]};var n,o,i,r}ho(e){const n=YAt(Date.now()),o=new Map;for(const a of e.values()){var i;const A=UAt(a.type,a.name,a.unit,void 0);let c=o.get(A);c||(c=Zt({name:a.name},a.unit&&{unit:a.unit}),a.type==="count"?c.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:a.type==="gauge"?c.gauge={dataPoints:[]}:c.histogram={aggregationTemporality:1,dataPoints:[]},o.set(A,c));const l=Jne((i=a.attributes)!==null&&i!==void 0?i:{},this.A),g=YAt(a.windowStartMs);if(a.type==="count"){var r;const u={attributes:l,startTimeUnixNano:g,timeUnixNano:n,asDouble:(r=a.total)!==null&&r!==void 0?r:0};c.sum.dataPoints.push(u)}else if(a.type==="gauge"){var s;const u={attributes:l,timeUnixNano:n,asDouble:(s=a.last)!==null&&s!==void 0?s:0};c.gauge.dataPoints.push(u)}else a.hist&&c.histogram.dataPoints.push({attributes:l,startTimeUnixNano:g,timeUnixNano:n,count:a.hist.count,sum:a.hist.sum,min:a.hist.min,max:a.hist.max,bucketCounts:a.hist.bucketCounts,explicitBounds:lxe})}return Array.from(o.values())}co(e){for(const[i,r]of e){const s=this.Hs.get(i);if(s)switch(s.windowStartMs=Math.min(s.windowStartMs,r.windowStartMs),s.type){case"count":var n,o;s.total=((n=s.total)!==null&&n!==void 0?n:0)+((o=r.total)!==null&&o!==void 0?o:0);break;case"gauge":break;case"histogram":if(r.hist)if(s.hist){s.hist.count+=r.hist.count,s.hist.sum+=r.hist.sum,s.hist.min=Math.min(s.hist.min,r.hist.min),s.hist.max=Math.max(s.hist.max,r.hist.max);for(let a=0;s.hist.bucketCounts.length>a;a++)s.hist.bucketCounts[a]+=r.hist.bucketCounts[a]}else s.hist=r.hist}else this.Ks()&&this.Hs.set(i,r)}}};const KAt=(t,{debugEnabled:e}={})=>{const n={N(o,...i){let r;try{r=typeof window>"u"?void 0:window}catch{return}r&&(Y8.DEBUG||r.POSTHOG_DEBUG||e)&&!Eo(r.console)&&r.console&&("__rrweb_original__"in r.console[o]?r.console[o].__rrweb_original__:r.console[o])(t,...i)},debug(...o){n.N("debug",...o)},info(...o){n.N("log",...o)},warn(...o){n.N("warn",...o)},error(...o){n.N("error",...o)},critical(...o){console.error(t,...o)},uninitializedWarning(o){n.error(`You must initialize PostHog before calling ${o}`)},createLogger:(o,i)=>KAt(`${t} ${o}`,i)};return n},li=KAt("[PostHog.js]"),gd=li.createLogger,zvn=gd("[ExternalScriptsLoader]"),Wne=t=>{const e=qo?.querySelectorAll("script");if(e){for(let n=0;e.length>n;n++)if(e[n].src===t||e[n].getAttribute("src")===t)return e[n]}},eD=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return zvn.warn(`${e} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const o=Wne(e);if(o){if(o.__posthog_loading_callback_fired)return n();const r=o.__posthog_loading_error;return r?n(r):(o.addEventListener("load",s=>{o.__posthog_loading_callback_fired=!0,n(void 0,s)}),void o.addEventListener("error",s=>{o.__posthog_loading_error=s,n(s)}))}const i=()=>{if(!qo)return n("document not found");if(Wne(e))return eD(t,e,n);let r=qo.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=a=>{r.__posthog_loading_callback_fired=!0,n(void 0,a)},r.onerror=a=>{r.__posthog_loading_error=a,n(a)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")qo.head.appendChild(r);else{const a=qo.querySelectorAll("body > script");var s;a.length>0?(s=a[0].parentNode)===null||s===void 0||s.insertBefore(r,a[0]):qo.body.appendChild(r)}};qo?.body?i():qo?.addEventListener("DOMContentLoaded",i)},gxe={},zAt=(t,e)=>{let n=`/static/${e}.js?v=${t.version}`;return e==="toolbar"&&(n=`${n}&t=${Math.floor(Date.now()/3e5)*3e5}`),t.requestRouter.endpointFor("assets",n)};Yr.__PosthogExtensions__=Yr.__PosthogExtensions__||{},Yr.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e==="remote-config"){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void eD(t,i,n)}const o=t.config.strict_script_versioning;if(o){const i=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=gxe[i];if(o==="fallback"&&r){if(Wne(r))return void eD(t,r,n);delete gxe[i]}return void eD(t,i,o==="fallback"?(s,a)=>{if(s)if(typeof s=="string")n(s);else{var A;const c=zAt(t,e);gxe[i]=c;const l=Wne(i);l==null||(A=l.parentNode)===null||A===void 0||A.removeChild(l),eD(t,c,n)}else n(void 0,a)}:n)}eD(t,zAt(t,e),n)},Yr.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{const o=t.requestRouter.endpointFor("api",e);eD(t,o,n)},Y8.DEBUG=!1,Y8.LIB_VERSION="1.438.3",Y8.LIB_NAME="web";var Xp=Y8;const uxe="$early_access_features",K8="$active_feature_flags",tD="$feature_flag_details",Rz="$feature_flag_errors",DQ="$feature_flag_evaluated_at",nD="$feature_flag_request_id",Tz="$minimal_flag_called_events",Z4="$enabled_feature_flags",NQ="$stored_group_properties",RQ="$stored_person_properties",TQ="$flag_call_reported",kz="$flag_call_reported_session_id",kQ="$feature_flag_payloads",V9="$override_feature_flags",oD="$override_feature_flag_payloads",Fz="visibilitychange",Vvn="$people_distinct_id",eB="distinct_id",dxe="$device_id",hxe="$device_model",jne="__alias",Jvn="__cmpns",VAt="$fbc",tF="$fbc_persistence",JAt="$fbp",Lz="$fbp_persistence",mxe="__timers",WAt="$autocapture_disabled_server_side",pxe="$heatmaps_enabled_server_side",_xe="$exception_capture_enabled_server_side",jAt="$error_tracking_suppression_rules",fxe="$error_tracking_capture_extension_exceptions",Ixe="$web_vitals_enabled_server_side",Cxe="$dead_clicks_enabled_server_side",yxe="$product_tours_enabled_server_side",qAt="$logs_capture_enabled_server_side",$At="$web_vitals_allowed_metrics",Hz="$session_recording_remote_config",Wvn="$session_recording_enabled_server_side",jvn="$replay_sample_rate",qvn="$replay_override_sampling",$vn="$replay_override_linked_flag",Xvn="$replay_override_url_trigger",Zvn="$replay_override_event_trigger",nF="$sesid",XAt="$session_is_sampled",ewn="$session_past_minimum_duration",twn="$session_recording_url_trigger_activated_session",nwn="$session_recording_event_trigger_activated_session",own="$debug_first_full_snapshot_timestamp",iwn="$sess_rec_flush_size",ZAt="$groups",Oz="$surveys",qne="$surveys_loaded_at",ect="$surveys_activated",tct="$surveys_activated_session",nct="$surveys_activated_timestamps",xxe="ph_product_tours",rwn="$product_tours_activated",swn="$product_tours_activated_session",awn="$conversations_widget_session_id",Awn="$conversations_ticket_id",cwn="$conversations_widget_state",lwn="$conversations_user_traits",Dy="$user_state",Exe="$client_session_props",gwn="$capture_rate_limit",oct="$initial_campaign_params",ict="$initial_referrer_info",oF="$initial_person_info",Bxe="$epp",bxe="$posthog_cookieless",rct="$cookieless_mode",sct="$sdk_debug_extensions_init_method",act="$sdk_debug_extensions_init_time_ms",Sxe="$sdk_debug_recording_script_not_loaded",Qxe="$sdk_debug_replay_stale_config",Act="$sdk_debug_replay_event_trigger_status",cct="$sdk_debug_replay_linked_flag_trigger_status",lct="$sdk_debug_replay_matched_recording_trigger_groups",gct="$sdk_debug_replay_pending_trigger_conditions",uct="$sdk_debug_replay_remote_trigger_matching_config",dct="$sdk_debug_replay_trigger_groups_count",hct="$sdk_debug_replay_url_trigger_status",uwn="$session_recording_start_reason",vxe="PostHog loadExternalDependency extension not found.",z8="anonymous",$ne="identified",mct="identified_only",Xne="beforeunload",wxe="$pageview",pct="$pageleave",_ct="$identify",fct="$groupidentify";function iF(t,e){qr(t)&&t.forEach(e)}function pl(t,e){if(!Fs(t))if(qr(t))t.forEach(e);else if((n=>n instanceof FormData)(t))t.forEach((n,o)=>e(n,o));else for(const n in t)G2e.call(t,n)&&e(t[n],n)}const Xg=function(t,...e){for(const n of e)for(const o in n)n[o]!==void 0&&(t[o]=n[o]);return t};function Zne(t){const e=Object.keys(t);let n=e.length;const o=new Array(n);for(;n--;)o[n]=[e[n],t[e[n]]];return o}const dwn=function(t){return function(...e){try{return t.apply(this,e)}catch(n){li.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),li.critical(n)}}},Pxe=function(t){const e={};return pl(t,function(n,o){($a(n)&&n.length>0||eh(n))&&(e[o]=n)}),e};function Ict(t){const e=Zt({},t);for(const n of["name","message","stack","cause","errors"])try{n in t&&(e[n]=t[n])}catch{}return e}const hwn=["herokuapp.com","vercel.app","netlify.app"];function mwn(t){const e=t?.hostname;if(!$a(e))return!1;const n=e.split(".").slice(-2).join(".");for(const o of hwn)if(n===o)return!1;return!0}function Wc(t,e,n,o){const{capture:i=!1,passive:r=!0}=o??{};t?.addEventListener(e,n,{capture:i,passive:r})}function Mxe(t){return t.name==="ph_toolbar_internal"}const Gz=t=>{if(qo){try{const e=t+"=",n=qo.cookie.split(";").filter(o=>o.length);for(let o=0;n.length>o;o++){let i=n[o];for(;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}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return eh(t)&&isFinite(t)&&Math.floor(t)===t});var pwn=class Grt{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,o,i){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(o)||!Number.isInteger(i)||0>e||0>n||0>o||0>i||e>0xffffffffffff||n>4095||o>1073741823||i>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|n>>>8,r[7]=n,r[8]=128|o>>>24,r[9]=o>>>16,r[10]=o>>>8,r[11]=o,r[12]=i>>>24,r[13]=i>>>16,r[14]=i>>>8,r[15]=i,new Grt(r)}toString(){let e="";for(let n=0;this.bytes.length>n;n++)e=e+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),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 Grt(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(let n=0;16>n;n++){const o=this.bytes[n]-e.bytes[n];if(o!==0)return Math.sign(o)}return 0}},_wn=class{generate(){const e=this.generateOrAbort();if(!Eo(e))return e;{this.Ct=0;const n=this.generateOrAbort();if(Eo(n))throw new Error("Could not generate UUID after timestamp reset");return n}}generateOrAbort(){const e=(()=>{const n=Date.now();return eh(n)&&isFinite(n)?Math.min(Math.max(Math.floor(n),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.It();else{if(this.Ct>=e+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Ct++,this.It())}return pwn.fromFieldsV7(this.Ct,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.Tt.nextUint32())}It(){this.Mt=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.Mt=0,this.Tt=new fwn}};let Cct=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};jn&&!Eo(jn.crypto)&&crypto.getRandomValues&&(Cct=t=>crypto.getRandomValues(t));var fwn=class{nextUint32(){return this.Rt.length>this.Et||(Cct(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}};let yct;const tB=()=>Iwn().toString(),Iwn=()=>(yct||(yct=new _wn)).generate();let Yz="";const Cwn=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let rF=null;const ud={At(){if(!ld(rF))return rF;if(rF=!1,qo)try{const t=`__ph_cookie_support_${tB()}`;ud.$t(t,"xyz"),rF=Gz(t)==='"xyz"',ud.Pt(t)}catch{rF=!1}return rF},Dt(t){li.error("cookieStore error: "+t)},Ot:Gz,Ft(t){let e;try{e=JSON.parse(ud.Ot(t))||{}}catch{}return e},$t(t,e,n,o,i){if(!qo)return!1;try{let r="",s="";const a=(function(c,l){if(l){let g=(function(u,h=qo){if(Yz)return Yz;if(!h||["localhost","127.0.0.1"].includes(u))return"";const d=u.split(".");let m=Math.min(d.length,8);const p="dmn_chk_"+tB();for(;!Yz&&m--;){const _=d.slice(m).join("."),f=p+"=1;domain=."+_+";path=/";h.cookie=f+";max-age=3",h.cookie.includes(p)&&(h.cookie=f+";max-age=0",Yz=_)}return Yz})(c);if(!g){const u=(h=>{const d=h.match(Cwn);return d?d[0]:""})(c);u!==g&&li.info("Warning: cookie subdomain discovery mismatch",u,g),g=u}return g?"; domain=."+g:""}return""})(qo.location.hostname,o);if(n){const c=new Date;c.setTime(c.getTime()+864e5*n),r="; expires="+c.toUTCString()}i&&(s="; secure");const A=t+"="+encodeURIComponent(JSON.stringify(e))+r+"; SameSite=Lax; path=/"+a+s;return A.length>3686.4&&li.warn("cookieStore warning: large cookie, len="+A.length),qo.cookie=A,!0}catch{return!1}},Pt(t,e){if(qo?.cookie&&(!e||!ld(Gz(t))))try{ud.$t(t,"",-1,e)}catch{return}}};let Dxe=null;const uc={At(){if(!ld(Dxe))return Dxe;let t=!0;if(Eo(jn))t=!1;else try{const e="__mplssupport__";uc.$t(e,"xyz"),uc.Ot(e)!=='"xyz"'&&(t=!1),uc.Pt(e)}catch{t=!1}return t||li.error("localStorage unsupported; falling back to cookie store"),Dxe=t,t},Dt(t){li.error("localStorage error: "+t)},Ot(t){try{return jn?.localStorage.getItem(t)}catch(e){uc.Dt(e)}return null},Ft(t){try{return JSON.parse(uc.Ot(t))||{}}catch{}return null},$t(t,e){try{return jn?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){uc.Dt(n)}return!1},Pt(t){try{jn?.localStorage.removeItem(t)}catch(e){uc.Dt(e)}}},Nxe=[RQ,K8,Z4,tD,kQ,nD,DQ,Rz,TQ],iD=[dxe,eB,nF,XAt,Bxe,oF,tF,Dy],eoe=t=>t+"_cpm",ywn=["__proto__","constructor","prototype"],Rxe=t=>{if(!Ea(t))return{};const e={};return Object.keys(t).forEach(n=>{ywn.indexOf(n)===-1&&(e[n]=t[n])}),e},Txe=(t,e=[])=>{const n={};return[...iD,...e].forEach(o=>{const i=t[o];Eo(i)||ld(i)||i===""||(n[o]=i)}),n},xct=t=>{let e=5381,n=2166136261;for(let o=0;t.length>o;o++){const i=t.charCodeAt(o);e=33*e^i,n=Math.imul(n^i,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(n>>>0).toString(36)},Ect=(t,e)=>({p:e,f:xct(JSON.stringify(t))}),Bct=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const n=ud.Ft(eoe(t)),o=n?.f===xct(e)&&qr(n.p);return{properties:o?n.p:[],isValid:o}}catch{return{properties:[],isValid:!1}}},kxe=(t,e)=>e+"|"+(ud.Ot(eoe(t))||""),sF={},Fxe={At:()=>!0,Dt(t){li.error("memoryStorage error: "+t)},Ot:t=>t in sF?sF[t]:null,Ft:t=>t in sF?sF[t]:null,$t:(t,e)=>(sF[t]=e,!0),Pt(t){delete sF[t]}};let rD=null;const eg={At(){if(!ld(rD))return rD;if(rD=!0,Eo(jn))rD=!1;else try{const t="__support__";eg.$t(t,"xyz"),eg.Ot(t)!=='"xyz"'&&(rD=!1),eg.Pt(t)}catch{rD=!1}return rD},Dt(t){li.error("sessionStorage error: ",t)},Ot(t){try{return jn?.sessionStorage.getItem(t)}catch(e){eg.Dt(e)}return null},Ft(t){try{return JSON.parse(eg.Ot(t))||null}catch{}return null},$t(t,e){try{return jn?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){eg.Dt(n)}return!1},Pt(t){try{jn?.sessionStorage.removeItem(t)}catch(e){eg.Dt(e)}}};var xwn=class{constructor(e){this._instance=e}get Mr(){return this._instance.config}get consent(){return this.Do()?0:this.Lo}isOptedOut(){return this.Mr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Mr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Mr.opt_out_capturing_by_default}optInOut(e){this.No.$t(this.qo,e?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.No.Pt(this.qo,this.Mr.cross_subdomain_cookie)}get qo(){const{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:o}=this._instance.config;return o||(n?n+e:"__ph_opt_in_out_"+e)}get Lo(){const e=this.No.Ot(this.qo);return U2e(e)?1:jr(yQn,e)?0:-1}get No(){const e=this.Mr.opt_out_capturing_persistence_type,n=e==="localStorage"?uc:ud,o=n.At()?n:Fxe;if(!this.jo||this.jo!==o){this.jo=o;const i=e==="localStorage"?ud:uc;i.Ot(this.qo)&&(this.jo.Ot(this.qo)||this.optInOut(U2e(i.Ot(this.qo))),i.Pt(this.qo,this.Mr.cross_subdomain_cookie))}return this.jo}Do(){return!!this.Mr.respect_dnt&&[X_?.doNotTrack,X_?.msDoNotTrack,Yr.doNotTrack,X_?.globalPrivacyControl].some(e=>U2e(e))}};function bct(t,e){var n;const o=t==null||(n=t.config)===null||n===void 0?void 0:n.get_current_url;if(!ap(o))return e;try{const i=o(e);return $a(i)&&i?i:e}catch(i){return li.error("Error in get_current_url, falling back to window.location.href",i),e}}function Sct(t){var e;return t instanceof Element&&(t.id==="__POSTHOG_TOOLBAR__"||!!(!((e=t.closest)===null||e===void 0)&&e.call(t,".toolbar-global-fade-container")))}function nB(t){return!!t&&t.nodeType===1}function gI(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Qct(t){return!!t&&t.nodeType===3}function Lxe(t){return!!t&&t.nodeType===11&&nB(t.host)}function Hxe(t){return t?$k(t).split(/\s+/):[]}function vct(t,e){const n=(function(o){var i;const r=jn==null||(i=jn.location)===null||i===void 0?void 0:i.href;return Eo(r)?void 0:bct(o,r)})(e);return!!(n&&t&&t.some(o=>n.match(o)))}function aF(t){let 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 Hxe(e)}function wct(t){return Fs(t)?null:$k(t).split(/(\s+)/).filter(e=>cF(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Uz(t){let e="";return sD(t)&&!AF(t)&&t.childNodes&&t.childNodes.length&&pl(t.childNodes,function(n){var o;Qct(n)&&n.textContent&&(e+=(o=wct(n.textContent))!==null&&o!==void 0?o:"")}),$k(e)}function Kz(t){var e;return Eo(t.target)?t.srcElement||null:!((e=t.target)===null||e===void 0)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}const Oxe=["a","button","form","input","select","textarea","label"];function Gxe(t,e){const n=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!n&&n.call(t,e)}catch{return!1}}function Yxe(t,e){if(Eo(e))return!0;for(const n of t)if(e.some(o=>Gxe(n,o)))return!0;return!1}function Pct(t){const e=t.parentNode;return!(!e||!nB(e))&&e}const Uxe=[".ph-no-autocapture","[data-ph-no-autocapture]"],Mct=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],Kxe=[...Mct,"+","-","−","–"],Dct=Kxe.length+10,Ewn=["button","a","input","select","textarea","label"],Bwn=["button","link","tab","menuitem","option"],Nct=(t,e)=>/[a-z0-9]/i.test(e)?jr(Kxe,e)?new RegExp(`\\b${e}\\b`).test(t):t.includes(e):t===e,bwn=t=>jr(Ewn,t.tagName.toLowerCase())||jr(Bwn,(t.getAttribute("role")||"").toLowerCase());function zxe(t){let e="",n="";const o=s=>{nB(s)&&sD(s)&&!AF(s)&&(e+=` ${Uz(s)}`,n=n||s.getAttribute("aria-label")||"",pl(s.childNodes,o))};o(t),e=$k(e.replace(/\s+/g," "));const i=(cF(e)?e:"").toLowerCase(),r=t.getAttribute("aria-label")||(i?"":n);return{safeText:i,ariaLabel:$k(r).toLowerCase()}}const Rct=[".ph-no-rageclick",".ph-no-capture"],Swn=["","text","search","email","password","url","tel","number"];function Tct(t,e){if(!jn||Vxe(t))return!1;let n,o,i;var r,s;if(My(e)?(n=!!e&&Rct,o=void 0,i=!1):(n=(r=e?.css_selector_ignorelist)!==null&&r!==void 0?r:Rct,o=e?.content_ignorelist,i=(s=e?.ignore_text_selection)!==null&&s!==void 0&&s),n===!1||i&&(function(A){return!(!A||!nB(A))&&(!!gI(A,"textarea")||(gI(A,"input")?jr(Swn,(A.getAttribute("type")||"").toLowerCase()):(function(c){var l;if(c.isContentEditable)return!0;const g=(l=c.getAttribute)===null||l===void 0?void 0:l.call(c,"contenteditable");return g==="true"||g===""})(A)))})(t))return!1;const{targetElementList:a}=kct(t,!1);return!(o&&(function(A,{safeText:c,ariaLabel:l}){let g;if(A===!0)g=Mct;else{if(!qr(A))return!1;if(A.length>Dct)return li.error(`[PostHog] content_ignorelist array cannot exceed ${Dct} items. Use css_selector_ignorelist for more complex matching.`),!1;g=A.map(u=>u.toLowerCase())}return g.some(u=>Nct(c,u)||Nct(l,u))})(o,(function(A,c){for(const l of c)if(bwn(l))return zxe(l);for(const l of c){try{if(jn?.getComputedStyle(l).getPropertyValue("cursor")!=="pointer")break}catch{break}const g=zxe(l);if(g.safeText||g.ariaLabel)return g}return zxe(A)})(t,a))||Yxe(a,n))}const Vxe=t=>!t||gI(t,"html")||!nB(t),kct=(t,e)=>{if(!jn||Vxe(t))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const o=[t];let i=t;for(;i.parentNode&&!gI(i,"body");){if(Lxe(i.parentNode)){o.push(i.parentNode.host),i=i.parentNode.host;continue}const r=Pct(i);if(!r)break;if(e||Oxe.indexOf(r.tagName.toLowerCase())>-1)n=!0;else try{const s=jn.getComputedStyle(r);s&&s.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}o.push(r),i=r}return{parentIsUsefulElement:n,targetElementList:o}};function sD(t){const e=new Set;let n=0;for(let r=t;r.parentNode&&!gI(r,"body");r=r.parentNode){if(n++>=1e3||e.has(r))return!1;e.add(r);const s=aF(r);if(jr(s,"ph-sensitive")||jr(s,"ph-no-capture"))return!1}if(jr(aF(t),"ph-include"))return!0;const o=t.type||"";if($a(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}const i=t.name||t.id||"";return!$a(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 AF(t){return!!(gI(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||gI(t,"select")||gI(t,"textarea")||t.getAttribute("contenteditable")==="true")}const Fct=new RegExp("^(?:(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}))$"),Lct=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Qwn=[16,15,14,13],vwn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Hct=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Oct=/[0-9A-Za-z_]/;function wwn(t){let e=0,n=!1;for(let o=t.length-1;o>=0;o--){let i=t.charCodeAt(o)-48;n&&(i*=2,i>9&&(i-=9)),e+=i,n=!n}return e%10==0}function cF(t,e=!0){return!(Fs(t)||$a(t)&&(t=$k(t),(e?Fct.test((t||"").replace(/[- ]/g,"")):(function(n){let o;for(Lct.lastIndex=0;o=Lct.exec(n);){const i=o[2];if(!i)continue;const r=i.replace(/[- ]/g,"");for(let s=0;r.length>s;s++)for(const a of Qwn){const A=s+a;if(r.length>=A){const c=r.slice(s,A);if(Fct.test(c)&&wwn(c))return!0}}}return!1})(t))||(e?vwn.test(t):(function(n){let o;for(Hct.lastIndex=0;o=Hct.exec(n);){const i=o[1],r=o[3];if(!(i&&r&&Oct.test(i)&&Oct.test(r)))return!0}return!1})(t))))}function Gct(t){let e=Uz(t);return e=`${e} ${Yct(t)}`.trim(),cF(e)?e:""}function Yct(t){let e="";return t&&t.childNodes&&t.childNodes.length&&pl(t.childNodes,function(n){var o;if(n&&((o=n.tagName)===null||o===void 0?void 0:o.toLowerCase())==="span")try{const i=Uz(n);e=`${e} ${i}`.trim(),n.childNodes&&n.childNodes.length&&(e=`${e} ${Yct(n)}`.trim())}catch(i){li.error("[AutoCapture]",i)}}),e}function Uct(t){return t.replace(/"|\\"/g,'\\"')}function Pwn(t){const e=t.attr__class;if(e)return qr(e)?e:Hxe(e)}const toe=gd("[Dead Clicks]"),Mwn=()=>!0,Dwn=t=>{var e;const n=!!(!((e=t.instance.persistence)===null||e===void 0)&&e.get_property(Cxe)),o=t.instance.config.capture_dead_clicks;return My(o)?o:!!Ea(o)||n};var Kct=class{get lazyLoadedDeadClicksAutocapture(){return this.Bo}constructor(e,n,o){this.instance=e,this.isEnabled=n,this.onCapture=o,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const n=e.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[Cxe]:n.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Ho()}):this.stop()}zo(e){var n,o,i;!((n=Yr.__PosthogExtensions__)===null||n===void 0)&&n.initDeadClicksAutocapture?e():(o=Yr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this.instance,"dead-clicks-autocapture",r=>{r?toe.error("failed to load script",r):e()})}Ho(){var e;if(qo){if(!this.Bo&&(!((e=Yr.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const n=Ea(this.instance.config.capture_dead_clicks)?Zt({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Bo=Yr.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Bo.start(qo),toe.info("starting...")}}else toe.error("`document` not found. Cannot start.")}stop(){this.Bo&&(this.Bo.stop(),this.Bo=void 0,toe.info("stopping..."))}};const zz=gd("[SegmentIntegration]");function zct(t,e,n=!0){const o=t.config.segment;if(!o)return e();const{analytics:i,filterProperties:r}=(a=>ap(a.register))(s=o)?{analytics:s}:s;var s;(function(a,A,c,l){const g=h=>{const d=()=>h.anonymousId()||tB();a.config.get_device_id=d,l&&h.id()&&(a.register({distinct_id:h.id(),$device_id:d()}),a.persistence.set_property(Dy,$ne)),c(l?void 0:h.anonymousId()||void 0)},u=A.user();"then"in u&&ap(u.then)?u.then(g):g(u)})(t,i,a=>{i.register(((A,c,{filterProperties:l}={})=>{typeof Promise<"u"&&Promise.resolve||zz.warn("This browser does not have Promise support, and can not use the segment integration");const g=(u,h)=>{if(!h)return u;const d=!!c&&u.event.anonymousId===c&&!u.event.userId;d||u.event.userId||u.event.anonymousId===A.get_distinct_id()||(zz.info("No userId set, resetting PostHog"),A.reset()),d||(c=void 0),u.event.userId&&u.event.userId!==A.get_distinct_id()&&(zz.info("UserId set, identifying with PostHog"),A.identify(u.event.userId));let m=A.calculateEventProperties(h,u.event.properties);if(!Fs(l)){const p=u.event.properties||{},_={};for(const I of Object.keys(m))G2e.call(p,I)||(_[I]=m[I]);const f=((I,C)=>{const y=qr(I)?I:[I];let x=Zt({},C);for(const E of y)try{if(x=E(x),Fs(x))return null}catch(B){return zz.error("Error in Segment filterProperties:",B),null}return x})(l,_);if(Fs(f))return u;m=f}return u.event.properties=Object.assign({},m,u.event.properties),u};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(u){return g(u,u.event.event)},page(u){return g(u,wxe)},identify(u){return g(u,_ct)},screen(u){return g(u,"$screen")}}})(t,a,{filterProperties:r})).then(()=>{e()},A=>{zz.error("Failed to register the Segment integration",A),e()})},n)}const Vct="posthog-js";function Jct(t,{organization:e,projectId:n,prefix:o,severityAllowList:i=["error"],sendExceptionsToPostHog:r=!0}={}){return s=>{var a,A,c,l,g;if(i!=="*"&&!i.includes(s.level)||!t.__loaded)return s;s.tags||(s.tags={});const u=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);s.tags["PostHog Person URL"]=u,t.sessionRecordingStarted()&&(s.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const h=((a=s.exception)===null||a===void 0?void 0:a.values)||[],d=h.map(_=>Zt(Zt({},_),{},{stacktrace:_.stacktrace?Zt(Zt({},_.stacktrace),{},{type:"raw",frames:(_.stacktrace.frames||[]).map(f=>Zt(Zt({},f),{},{platform:"web:javascript"}))}):void 0})),m={$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_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:((l=h[0])===null||l===void 0?void 0:l.value)||s.message,$sentry_exception_type:(g=h[0])===null||g===void 0?void 0:g.type,$sentry_tags:s.tags};var p;return e&&n&&(m.$sentry_url=(o||"https://sentry.io/organizations/")+e+"/issues/?project="+n+"&query="+s.event_id),r&&((p=t.exceptions)===null||p===void 0||p.sendExceptionEvent(m)),s}}var Nwn=class{constructor(e,n,o,i,r,s){this.name=Vct,this.setupOnce=function(a){a(Jct(e,{organization:n,projectId:o,prefix:i,severityAllowList:r,sendExceptionsToPostHog:s==null||s}))}}},Wct=class{constructor(e){this.Uo=(n,o,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(li.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:i}),this.Wo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Vo()}Vo(){var e;this.Go=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Uo)}destroy(){var e;(e=this.Go)===null||e===void 0||e.call(this),this.Go=void 0}doPageView(e,n){var o;const i=this.Qo(e,n);return this.Wo={pathname:(o=jn?.location.pathname)!==null&&o!==void 0?o:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var n;return this.Qo(e,(n=this.Wo)===null||n===void 0?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Wo)===null||e===void 0?void 0:e.pageViewId}}Qo(e,n){const o=this.Wo;if(!o)return{$pageview_id:n};let i={$pageview_id:n,$prev_pageview_id:o.pageViewId};const r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:s,lastScrollY:a,maxScrollY:A,maxContentHeight:c,lastContentY:l,maxContentY:g}=r;if(!(Eo(s)||Eo(a)||Eo(A)||Eo(c)||Eo(l)||Eo(g))){s=Math.ceil(s),a=Math.ceil(a),A=Math.ceil(A),c=Math.ceil(c),l=Math.ceil(l),g=Math.ceil(g);const u=s>1?z9(a/s,0,1,li):1,h=s>1?z9(A/s,0,1,li):1,d=c>1?z9(l/c,0,1,li):1,m=c>1?z9(g/c,0,1,li):1;i=Xg(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:u,$prev_pageview_max_scroll:A,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:d,$prev_pageview_max_content:g,$prev_pageview_max_content_percentage:m})}}return o.pathname&&(i.$prev_pageview_pathname=o.pathname),o.timestamp&&(i.$prev_pageview_duration=(e.getTime()-o.timestamp.getTime())/1e3),i}};const Vz=["flags","surveys"],Rwn={[Vvn]:{exposure:"hidden"},[jne]:{exposure:"hidden"},[Jvn]:{exposure:"hidden"},[mxe]:{exposure:"hidden"},[tF]:{exposure:"hidden"},[Lz]:{exposure:"hidden"},[WAt]:{exposure:"event"},[pxe]:{exposure:"hidden"},[qAt]:{exposure:"hidden"},[_xe]:{exposure:"event"},[jAt]:{exposure:"hidden"},[fxe]:{exposure:"event"},[Ixe]:{exposure:"event"},[Cxe]:{exposure:"event"},[yxe]:{exposure:"hidden"},[$At]:{exposure:"event"},[Hz]:{exposure:"hidden"},[Wvn]:{exposure:"hidden"},[nF]:{exposure:"hidden"},[XAt]:{exposure:"event"},[jvn]:{exposure:"event",shouldSkipFromEventProperties:t=>ld(t)},[ewn]:{exposure:"event"},[twn]:{exposure:"event"},[nwn]:{exposure:"event"},[own]:{exposure:"event"},[iwn]:{exposure:"hidden"},[Z4]:{exposure:"hidden",storageGroup:"flags"},[K8]:{exposure:"hidden",storageGroup:"flags"},[uxe]:{exposure:"hidden"},[tD]:{exposure:"hidden",storageGroup:"flags"},[kQ]:{exposure:"hidden",storageGroup:"flags"},[nD]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Tz]:{exposure:"hidden",storageGroup:"flags"},[V9]:{exposure:"hidden"},[oD]:{exposure:"hidden"},[RQ]:{exposure:"hidden"},[NQ]:{exposure:"hidden"},[Oz]:{exposure:"hidden",storageGroup:"surveys"},[qne]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ect]:{exposure:"event"},[tct]:{exposure:"hidden"},[nct]:{exposure:"hidden"},[xxe]:{exposure:"hidden"},[rwn]:{exposure:"hidden"},[swn]:{exposure:"hidden"},[awn]:{exposure:"event"},[Awn]:{exposure:"event"},[cwn]:{exposure:"event"},[lwn]:{exposure:"event"},[TQ]:{exposure:"hidden"},[kz]:{exposure:"hidden"},[ZAt]:{exposure:"event"},[Rz]:{exposure:"hidden"},[DQ]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Dy]:{exposure:"hidden"},[Exe]:{exposure:"hidden"},[gwn]:{exposure:"hidden"},[oct]:{exposure:"hidden"},[ict]:{exposure:"hidden"},[oF]:{exposure:"hidden"},[Bxe]:{exposure:"hidden"},[qvn]:{exposure:"event"},[$vn]:{exposure:"event"},[Xvn]:{exposure:"event"},[Zvn]:{exposure:"event"},[sct]:{exposure:"event"},[act]:{exposure:"event"},[Sxe]:{exposure:"hidden"},[Qxe]:{exposure:"hidden"},[Act]:{exposure:"hidden"},[cct]:{exposure:"hidden"},[lct]:{exposure:"hidden"},[gct]:{exposure:"hidden"},[uct]:{exposure:"hidden"},[dct]:{exposure:"hidden"},[hct]:{exposure:"hidden"},[uwn]:{exposure:"event"}},Twn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],r1=t=>{const e=Rwn[t];if(e)return e;for(const[n,o]of Twn)if(t.indexOf(n)===0)return o};function jct(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}const qct=()=>{try{return"u">typeof window&&window.navigator.onLine!==!1}catch{return!1}},$ct=(t,e)=>t>=e&&qct(),Xct=(t,e,n,o)=>{if(t===0){if(qct()){const i=e+1;return i===n&&o(),i}return e}return 0},lF=(t,e)=>{try{let n;return JSON.stringify(t,(o,i)=>{var r;return Xk(i)?((r=n)!==null&&r!==void 0||(n=new WeakMap),n.has(i)||n.set(i,Ict(i)),n.get(i)):typeof i=="bigint"?i.toString():i},e)}catch{return Cat(t)}},V8=t=>{const e=qo?.createElement("a");return Eo(e)?null:(e.href=t,e)},gF=function(t,e){const n=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let o;for(let i=0;n.length>i;i++){const r=n[i].split("=");if(r[0]===e){o=r;break}}if(!qr(o)||2>o.length)return"";{let i=o[1];try{i=decodeURIComponent(i)}catch{li.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")}},Jz=function(t,e,n){if(!t||!e||!e.length)return t;const o=t.split("#"),i=o[1],r=(o[0]||"").split("?"),s=r[1],a=r[0],A=(s||"").split("&"),c=[];for(let g=0;A.length>g;g++){const u=A[g].split("=");qr(u)&&(e.includes(u[0])?c.push(u[0]+"="+n):c.push(A[g]))}let l=a;return s!=null&&(l+="?"+c.join("&")),i!=null&&(l+="#"+i),l},noe=function(t,e){const n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},uF=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx"],kwn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...uF],Wz="<masked>",Fwn=["li_fat_id"];function Zct(t,e,n){if(!qo)return{};const o=e?[...uF,...n||[]]:[],i=elt(Jz(qo.URL,o,Wz),t),r=(function(){const s={};return pl(Fwn,function(a){const A=Gz(a);s[a]=A||null}),s})();return Xg(r,i)}function elt(t,e){const n=kwn.concat(e||[]),o={};return pl(n,function(i){const r=gF(t,i);o[i]=r||null}),o}function tlt(t){const e=(function(i){return i?i.search("https?://(.*)google.([^/?]*)")===0?"google":i.search("https?://(.*)bing.com")===0?"bing":i.search("https?://(.*)yahoo.com")===0?"yahoo":i.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(t),n=e!="yahoo"?"q":"p",o={};if(!ld(e)){o.$search_engine=e;const i=qo?gF(qo.referrer,n):"";i.length&&(o.ph_keyword=i)}return o}function nlt(){return navigator.language||navigator.userLanguage}function Lwn(){const t=nlt();return typeof t=="string"?t.split("-")[0]:void 0}const ooe="$direct";function olt(){return qo?.referrer||ooe}function ilt(t,e,n=!1){const o=t?[...uF,...e||[]]:[],i=n?MQ(qg?.href):qg?.href,r=i?.substring(0,1e3);return{r:olt().substring(0,1e3),u:r?Jz(r,o,Wz):void 0}}function rlt(t,e=!1){var n;const{r:o,u:i}=t,r=e?MQ(i):i,s={$referrer:o,$referring_domain:o==null?void 0:o==ooe?ooe:(n=V8(o))===null||n===void 0?void 0:n.host};if(r){s.$current_url=r;const a=V8(r);s.$host=a?.host,s.$pathname=a?.pathname;const A=elt(r);Xg(s,A)}if(o){const a=tlt(o);Xg(s,a)}return s}function Hwn(){try{return new Date().getTimezoneOffset()}catch{return}}const Own={flags:DQ,surveys:qne},Gwn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ioe=t=>`${t}_cookie_identity_change_pending`,roe=t=>{let e="",n=0;for(const o of t){const i=encodeURIComponent(JSON.stringify(o).slice(1,-1)).length;if(n+i>1e3)break;e+=o,n+=i}return e},Zp="main",J8=[Z4,K8,tD,kQ,nD,DQ,Tz,RQ],Jxe=t=>J8.indexOf(t)!==-1,slt=[tF,Lz],alt=t=>slt.indexOf(t)!==-1,FQ=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch{return t===e}},dF=t=>{if(!t)return{};const e=JSON.parse(t);return Ea(e)?e:{}},Alt=(t,e)=>{pl(t,(n,o)=>{const i=r1(o);i&&i.exposure!=="event"||{}.hasOwnProperty.call(e,o)||delete t[o]})};var Wxe=class{constructor(e,n,o=!0,i=!e.cookieless_mode){if(this.Zo={},this.Jo=!1,this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=new Map,this.ia=!1,this.na=!1,this.sa=!1,this.ra=new Set,this.oa=new Set,this.Mr=e,this.aa=o,this.props={},this.la=void 0,this.ua=(r=>{let s="";return r.token&&(s=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+s+"_posthog"})(e),this.hi=e.disable_persistence||!!n,this.No=this.ca(e),this.Xo=this.ha(e),this.load(i),this.da(),e.debug&&li.info("Persistence loaded",e.persistence,Zt({},this.props)),this.update_config(e,e,n),this.save(),jn){const r=()=>this.flush();Wc(jn,"beforeunload",r,{capture:!1}),Wc(jn,"pagehide",r,{capture:!1}),this.va=s=>{if(this.Jo&&(!s.storageArea||s.storageArea===jn?.localStorage)&&s.key)if(s.key!==this.ua){if(this.Xo){const a=Vz.find(A=>s.key===this.fa(A));a&&this.pa(s.key,a)}}else this.pa(s.key,Zp)},Wc(jn,"storage",this.va)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([n,o])=>{const i=this.ea.get(n);if(!Jxe(n)||i===!0)return;if(o===!0)return void this.ga(n,!0);const r=new Set(i||[]);o.forEach(s=>r.add(s)),r.size&&this.ga(n,r)})}onCrossTabFeatureFlagChange(e){return this.oa.add(e),()=>this.oa.delete(e)}destroy(){this.va&&jn&&(jn.removeEventListener("storage",this.va),this.va=void 0),this.oa.clear()}pa(e,n,o=!0){if(this.hi)return!1;let i,r;try{if(r=uc.Ot(e),ld(r)){const A=this.ma(n);return A.storageValue=null,n!==Zp&&(A.persisted=!1),!1}i=dF(r)}catch{return!1}const s=n===Zp?i:uc.Ft(this.ua);if(s&&this.ya(s))return!1;const a=this.ba(i,n,o);return n===Zp&&this.Xo&&!FQ(this._a().main,i)||this.wa(i,n,!0,r),a}ya(e){const n=this.props[eB],o=e[eB];return!Eo(n)&&!Eo(o)&&n!==o}wa(e,n,o,i){const r=this.ma(n);r.storageValue=i,n!==Zp&&(r.persisted=o);try{r.fingerprint=this.ka(e,n)}catch{r.fingerprint=void 0}}ba(e,n,o){let i=!1;return J8.forEach(r=>{var s;const a=(s=r1(r))===null||s===void 0?void 0:s.storageGroup;if(n===Zp&&this.Xo&&a||n!==Zp&&a!==n)return;const A=r in e,c=this.Sa(r,A?e[r]:void 0),l=this.ea.has(r)?r in this.props:A;l===r in this.props&&FQ(c,this.props[r])||(l?this.xa(r,c,!1):this.$a(r,!1),i=!0)}),i&&o&&this.oa.forEach(r=>r()),i}Ca(){if(!this.Jo)return!1;try{this.sa=!1;const e=uc.Ot(this.ua),n=this.ma(Zp);let o,i=!1,r=!1;if(e!==n.storageValue)if(ld(e))n.storageValue=null;else{if(o=dF(e),this.sa=!this.na&&this.ya(o),this.sa)return!1;r=this.ba(o,Zp,!1),!this.Xo||FQ(this._a().main,o)?this.wa(o,Zp,!0,e):n.storageValue=e,i=!0}return this.Xo&&Vz.forEach(s=>{const a=uc.Ot(this.fa(s)),A=this.ma(s),c=o||{},l=i&&J8.some(u=>{var h;return((h=r1(u))===null||h===void 0?void 0:h.storageGroup)===s&&u in c});if(a===A.storageValue&&!l)return;if(ld(a))return A.storageValue=null,A.persisted=!1,void(l&&(r=this.ba(c,s,!1)||r));const g=dF(a);r=this.ba(g,s,!1)||r,this.wa(g,s,!0,a)}),r}catch{return!1}}ga(e,n){this.ea.set(e,n);const o=r1(e);o?.volatile||(this.ma((this.Xo?o?.storageGroup:void 0)||Zp).fingerprint=void 0,this.Ta(e))}Ia(){J8.forEach(e=>this.ea.set(e,!0))}da(){if(this.Jo)try{const e=uc.Ot(this.ua),n=dF(e);this.ma(Zp).storageValue=e,J8.forEach(o=>{var i;const r=this.Xo?(i=r1(o))===null||i===void 0?void 0:i.storageGroup:void 0,s=r?uc.Ot(this.fa(r)):null;if(r){const A=this.ma(r);A.storageValue=s,A.persisted=!ld(s)}const a=r&&!ld(s)?dF(s):n;o in this.props?this.Ma(o,a[o],this.props[o]):o in a&&this.ga(o,!0)})}catch{}}Sa(e,n){const o=this.ea.get(e);if(!o)return n;if(o===!0)return this.props[e];if(e==="$active_feature_flags"){const s=new Set(qr(n)?n:[]),a=new Set(qr(this.props[e])?this.props[e]:[]);return o.forEach(A=>a.has(A)?s.add(A):s.delete(A)),Array.from(s)}const i=Ea(n)?Zt({},n):{},r=Ea(this.props[e])?this.props[e]:{};return o.forEach(s=>{s in r?i[s]=r[s]:delete i[s]}),i}Ma(e,n,o){if(!Jxe(e))return;const i=this.ea.get(e);if(i===!0)return;let r=n;if(this.Jo)try{var s;const A=this.Xo?(s=r1(e))===null||s===void 0?void 0:s.storageGroup:void 0,c=A?this.fa(A):this.ua;r=dF(uc.Ot(c))[e]}catch{}const a=new Set(i||[]);if(e==="$active_feature_flags"){if(!Eo(n)&&!qr(n)||!Eo(r)&&!qr(r)||!qr(o))return void this.ga(e,!0);const A=new Set(n||[]),c=new Set(r||[]),l=new Set(o);new Set([...A,...l]).forEach(g=>{A.has(g)!==l.has(g)&&a.add(g)}),a.forEach(g=>{c.has(g)===l.has(g)&&a.delete(g)})}else{if(!Ea(o))return void(FQ(r,o)?this.ea.delete(e):this.ga(e,!0));{if(!Eo(n)&&!Ea(n)||Eo(n)&&px(o)&&Eo(r))return void this.ga(e,!0);const A=Ea(n)?n:{},c=Ea(r)?r:{};new Set([...Object.keys(A),...Object.keys(o)]).forEach(l=>{l in A==l in o&&FQ(A[l],o[l])||a.add(l)}),a.forEach(l=>{l in c==l in o&&FQ(c[l],o[l])&&a.delete(l)})}}a.size?this.ga(e,a):this.ea.delete(e)}Ea(){var e;const n=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return eh(n)&&n>0?n:0}Pa(e){if(this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const n=Txe(e,this.Mr.cookie_persisted_properties||[]),o=Ect(n,this.Mr.cookie_persisted_properties||[]),i=JSON.stringify(n)+"|"+JSON.stringify(o),r=ud.Ot(this.ua)||void 0;r&&kxe(this.ua,r)===i&&(this.Ra=i,this.Aa=r)}catch{}else try{const n=ud.Ot(this.ua)||void 0;this.Ra=n?kxe(this.ua,n):void 0,this.Aa=n}catch{}}syncCookieProperties(){return this.Fa(this.Mr)}Fa(e,n=!1){if(this.hi&&!n||this.ta||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let o;try{o=ud.Ot(this.ua)||void 0}catch{}if(!o||o===this.Aa)return!1;const i=kxe(this.ua,o);let r;try{r=Rxe(JSON.parse(o))}catch{return!1}if((ud.Ot(this.ua)||void 0)!==o)return!1;this.Ra=i,this.Aa=o;const s=Bct(this.ua,o),a=[...iD,...s.properties],A={};if(Object.keys(r).forEach(p=>{const _=r[p];(Eo(_)||ld(_)||_===""||p==="$user_state"&&_!=="anonymous"&&_!=="identified")&&(A[p]=!0,delete r[p])}),px(r))return!1;const c="distinct_id"in r||r.$user_state==="anonymous"||r.$user_state==="identified",l=this.props,g=l[eB],u=l[Dy],h=Xg({},l);[...iD,...e.cookie_persisted_properties||[]].forEach(p=>{if(a.indexOf(p)!==-1&&!(p in r)&&!A[p]&&(c||p!=="distinct_id"&&p!=="$user_state")){const _=h[p];(s.isValid||iD.indexOf(p)===-1||_!==!1&&_!==0)&&delete h[p]}}),this.props=Xg(h,r),J8.forEach(p=>{const _=p in this.props;p in l===_&&FQ(l[p],this.props[p])||(_?this.Ma(p,l[p],this.props[p]):this.ga(p,!0))}),!c||"$user_state"in r||"$user_state"in this.props||this.xa(Dy,z8);const d=this.props[eB],m=this.props[Dy];return!c||d===g&&m===u||(this.na=!0,this.Yo=!0,eg.$t(ioe(this.ua),!0),this.$a(RQ),this.$a(K8),this.$a(Z4),this.$a(tD),this.$a(kQ),this.$a(nD),this.$a(DQ),this.$a(Rz),this.$a(TQ),m!=="anonymous"||u!=="identified"&&r.$user_state!=="anonymous"&&(Eo(g)||d===g)||(Alt(this.props,r),this.$a(NQ)),m==="identified"?this.props.$user_id=d:delete this.props.$user_id,this.$a(jne)),!0}consumeCookieIdentityChange(){const e=ioe(this.ua),n=this.Yo||!!eg.Ot(e);return this.Yo=!1,n&&eg.Pt(e),n}Oa(e=!1){return!(this.ta||this.hi&&!e||!this.Mr.cookieWinsOnConflict||this.Mr.persistence.toLowerCase()!=="localstorage+cookie"||(this.ta=!0,0))}Da(){this.ta&&(Eo(this.La)||(clearTimeout(this.La),this.La=void 0),delete this.Zo[Zp],this.Na(!0))}qa(e=!0){if(this.ta)try{e?this.Da():Eo(this.La)||(clearTimeout(this.La),this.La=void 0)}finally{this.ta=!1}}isDisabled(){return!!this.hi}ca(e){Gwn.indexOf(e.persistence.toLowerCase())===-1&&(li.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const n=((a=[],A=!1,c=()=>!1)=>{const l=[...iD,...a];return Zt(Zt({},uc),{},{Ft(g){try{let h,d={};try{h=ud.Ot(g)||void 0,d=h?Rxe(JSON.parse(h)):{}}catch{}const m=JSON.parse(uc.Ot(g)||"{}");let p;if(A){const _=Bct(g,h),f=[...iD,..._.properties],I={};Object.keys(d).forEach(y=>{const x=d[y];ld(x)||x===""||y==="$user_state"&&x!=="anonymous"&&x!=="identified"||(I[y]=x)});const C="distinct_id"in I||I.$user_state==="anonymous"||I.$user_state==="identified";if(Object.keys(I).length>0){var u;const y=m[eB],x=(u=m.$user_state)!==null&&u!==void 0?u:z8;l.forEach(E=>{if(f.indexOf(E)!==-1&&!(E in d)&&(C||E!=="distinct_id"&&E!=="$user_state")){const B=m[E];(_.isValid||iD.indexOf(E)===-1||B!==!1&&B!==0)&&delete m[E]}}),!C||"$user_state"in d||"$user_state"in m||(m[Dy]=z8),!C||("distinct_id"in I?I[eB]:m[eB])===y&&("$user_state"in I?I[Dy]:m[Dy])===x||(Nxe.forEach(E=>delete m[E]),I.$user_state==="identified"&&"distinct_id"in I?m.$user_id=I[eB]:delete m.$user_id,I.$user_state!=="identified"&&(delete m[ZAt],delete m[NQ]),delete m.__alias)}p=Xg(m,I)}else p=Xg(d,m);return c()||uc.$t(g,p),p}catch{}return null},$t(g,u,h,d,m,p){const _=uc.$t(g,u,void 0,void 0,p);try{const f=Txe(u,a);if(Object.keys(f).length){if(A){const I=eoe(g),C=Ect(f,a);if(ud.$t(I,C,h,d,m,p),ud.Ot(I)!==JSON.stringify(C)){ud.Pt(I,d);const y=Txe(u);return ud.$t(g,y,h,d,m,p),_}}ud.$t(g,f,h,d,m,p)}}catch(f){uc.Dt(f)}return _},Pt(g,u){try{jn?.localStorage.removeItem(g),ud.Pt(g,u),ud.Pt(eoe(g),u)}catch(h){uc.Dt(h)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict,()=>!!this.hi);let o,i=!1,r=!1;const s=e.persistence.toLowerCase();return s==="localstorage"&&uc.At()?(o=uc,r=!0):s==="localstorage+cookie"&&n.At()?(o=n,r=!0,i=!0):s==="sessionstorage"&&eg.At()?o=eg:s==="memory"?o=Fxe:s==="cookie"&&ud.At()?(o=ud,i=!0):n.At()?(o=n,r=!0,i=!0):ud.At()?(o=ud,i=!0):o=Fxe,this.Jo=r,this.Ko=i,o}fa(e){return`${this.ua}__${e}`}ha(e){return this.Jo&&!!e.split_storage}properties(){const e={};return pl(this.props,(n,o)=>{const i=r1(o);if(!i||i.exposure==="event"){var r;if(!(i==null||(r=i.shouldSkipFromEventProperties)===null||r===void 0)&&r.call(i,n))return;e[o]=n}}),e}load(e=!1){if(this.hi&&!e)return;const n=this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie",o=n?uc.Ft(this.ua):null;let i={};if(n)try{i=Rxe(ud.Ft(this.ua)),pl(i,(A,c)=>{(Eo(A)||ld(A)||A==="")&&delete i[c]})}catch{}const r=this.No.Ft(this.ua);if(r&&(this.props=Xg({},r)),this.Xo&&this.ja(),n&&r){var s,a;const A=o?.[eB],c=(s=o?.$user_state)!==null&&s!==void 0?s:z8,l=r[eB],g=(a=r.$user_state)!==null&&a!==void 0?a:z8;if(l!==A||g!==c){this.Yo=!0,this.hi||eg.$t(ioe(this.ua),!0);const u=Xg({},this.props);Nxe.forEach(d=>delete u[d]),g!=="anonymous"||c!=="identified"&&i.$user_state!=="anonymous"&&(Eo(A)||l===A)||(Alt(u,i),delete u[NQ]),this.props=u;const h=new Set;Nxe.forEach(d=>{var m;const p=(m=r1(d))===null||m===void 0?void 0:m.storageGroup;p&&h.add(p)}),h.forEach(d=>{if(this.hi)return;const m={};pl(this.props,(p,_)=>{var f;((f=r1(_))===null||f===void 0?void 0:f.storageGroup)===d&&(m[_]=p)}),px(m)?(uc.Pt(this.fa(d)),this.Zo[d]={}):uc.$t(this.fa(d),m)&&(this.Zo[d]={persisted:!0,fingerprint:this.ka(m,d)})})}}eg.Ot(ioe(this.ua))&&(this.Yo=!0)}ja(){for(const e of Vz){const n=uc.Ft(this.fa(e));if(n&&!px(n)){const o=this.ma(e);o.persisted=!0,this.Ba(e)||(o.fingerprint=this.ka(n,e)),this.za(e,n)||Xg(this.props,n)}}}Ba(e){return Object.keys(this.props).some(n=>{var o;return((o=r1(n))===null||o===void 0?void 0:o.storageGroup)===e})}za(e,n){const o=Own[e];if(!o)return!1;const i=n[o],r=this.props[o];return eh(i)&&eh(r)&&r>i}refreshKey(e){var n;if(this.hi||this.ra.has(e))return;const o=this.Xo?(n=r1(e))===null||n===void 0?void 0:n.storageGroup:void 0,i=o?uc.Ft(this.fa(o)):this.No.Ft(this.ua);if(i&&e in i)this.xa(e,i[e],!1);else{if(o){const r=this.No.Ft(this.ua);if(r&&e in r)return void this.xa(e,r[e],!1)}this.$a(e,!1)}}save(){if(this.hi)return;const e=this.Ea();e>0?Eo(this.La)&&(this.La=setTimeout(()=>{this.La=void 0,this.Na()},e)):this.Na()}flush(){Eo(this.La)||(clearTimeout(this.La),this.La=void 0,this.Na())}Na(e=!1){if(this.hi||this.ta&&!e)return;e||(this.syncCookieProperties(),this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie"||slt.forEach(r=>this.refreshKey(r)));const n=!e&&!this.ia;n||(this.sa=!1);const o=!!n&&this.Ca();if(this.sa)return void(this.Mr.debug&&li.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Xo)return this.Ha(),void(o&&this.oa.forEach(r=>r()));const i=this.Ua(this.No,this.ua,this.props,Zp);i==="written"&&this.Pa(this.props),i!=="failed"&&(this.ea.clear(),this.na=!1,this.ra.clear()),o&&this.oa.forEach(r=>r())}Ha(){const{main:e,groups:n}=this._a(),o=this.Ua(this.No,this.ua,e,Zp);o==="written"&&this.Pa(e),o!=="failed"&&(this.na=!1,this.ra.clear(),J8.forEach(r=>{var s;!((s=r1(r))===null||s===void 0)&&s.storageGroup||this.ea.delete(r)}));for(const r of Vz){var i;const s=n[r];if(px(s)&&!(!((i=this.Zo[r])===null||i===void 0)&&i.persisted)){J8.forEach(A=>{var c;((c=r1(A))===null||c===void 0?void 0:c.storageGroup)===r&&this.ea.delete(A)});continue}const a=this.Ua(uc,this.fa(r),s,r);a!=="failed"&&J8.forEach(A=>{const c=r1(A);c?.storageGroup!==r||a!=="written"&&c.volatile||this.ea.delete(A)})}}_a(){const e={},n={flags:{},surveys:{}};return pl(this.props,(o,i)=>{var r;const s=(r=r1(i))===null||r===void 0?void 0:r.storageGroup;s?n[s][i]=o:e[i]=o}),{main:e,groups:n}}ka(e,n){if(n===Zp)return JSON.stringify(e)+"|"+this.Wa+"|"+this.Va+"|"+this.Ga;const o={};return pl(e,(i,r)=>{var s;o[r]=!((s=r1(r))===null||s===void 0)&&s.volatile?"__volatile__":i}),JSON.stringify(o)}Ua(e,n,o,i){const r=this.ma(i);if(i!==Zp&&!r.dirty&&!Eo(r.fingerprint))return"skipped";let s;try{if(s=this.ka(o,i),s===r.fingerprint)return r.dirty=!1,"skipped"}catch{s=void 0}return e.$t(n,o,this.Wa,this.Va,this.Ga,this.Mr.debug)?(r.dirty=!1,i!==Zp&&(r.persisted=!0),Eo(s)||(r.fingerprint=s),this.Jo&&(r.storageValue=uc.Ot(n)),"written"):(this.Mr.debug&&li.warn(`failed to persist storage entry "${n}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ia(),Eo(this.La)||(clearTimeout(this.La),this.La=void 0),this.No.Pt(this.ua,!1),this.No.Pt(this.ua,!0),!e&&this.aa)for(const n of Vz)uc.Pt(this.fa(n));e?delete this.Zo[Zp]:this.Zo={},this.Ra=void 0,this.Aa=void 0}clear(){this.remove(),this.props={}}register_once(e,n,o){if(Ea(e)){this.syncCookieProperties(),Eo(n)&&(n="None"),this.Wa=Eo(o)?this.Qa:o;let i=!1;if(pl(e,(r,s)=>{this.props.hasOwnProperty(s)&&this.props[s]!==n||(this.xa(s,r),i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(Ea(e)){this.syncCookieProperties(),this.Wa=Eo(n)?this.Qa:n;let o=!1;if(pl(e,(i,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==i||Ea(i)||qr(i))&&(this.xa(r,i),o=!0)}),o)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const n=typeof e=="string"?[e]:e;let o=!1;for(const i of n)i in this.props&&(this.$a(i),o=!0);o&&this.save()}update_campaign_params(){const e=qo?.URL;if(e===this.la)return;const n=Zct(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),o=!px(Pxe(n));return o&&this.register(n),this.la=e,o?n:void 0}update_search_keyword(){this.register((function(){const e=qo?.referrer;return e?tlt(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:olt(),$referring_domain:qo?.referrer&&((e=V8(qo.referrer))===null||e===void 0?void 0:e.host)||ooe},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=ilt(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[oF]:this.Ko?{r:roe(e.r),u:e.u?roe(e.u):void 0}:e},void 0)}get_initial_props(){const e={};pl([ict,oct],o=>{const i=this.props[o];i&&pl(i,function(r,s){e["$initial_"+O2e(s)]=r})});const n=this.props[oF];if(n){const o=(function(i,r=!1){const s=rlt(i,r),a={};return pl(s,function(A,c){a[`$initial_${O2e(c)}`]=A}),a})(n,this.Mr.disable_capture_url_hashes);Xg(e,o)}return e}safe_merge(e){return pl(this.props,function(n,o){o in e||(e[o]=n)}),e}update_config(e,n,o){const i=e.persistence!==n.persistence,r=!((d,m)=>{if(d.length!==m.length)return!1;const p=[...d].sort(),_=[...m].sort();return p.every((f,I)=>f===_[I])})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),s=i||r,a=e.cookieWinsOnConflict!==n.cookieWinsOnConflict,A=e.disable_persistence||!!o,c=!!this.hi&&!A;A||this.Fa(n,c),this.Mr=e,!A&&(i||r||a)&&(this.Ra=void 0,this.Aa=void 0,this.Fa(Zt(Zt({},e),{},{cookie_persisted_properties:n.cookie_persisted_properties}),c));const l=s||a?this.ca(e):this.No;this.Za();const g=this.ha(e),u=s||g!==this.Xo,h=!A&&(u||e.cross_subdomain_cookie!==this.Va||e.secure_cookie!==this.Ga)&&this.Oa(c);this.ia=u;try{if(this.Qa=this.Wa=e.cookie_expiration,this.set_disabled(A),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),u){const d=this.props;this.clear(),this.No=l,this.Xo=g,this.props=d,this.save()}else a&&(this.No=l,A||(delete this.Zo[Zp],this.Na()))}finally{this.ia=!1,h&&this.qa()}}Za(){const e=this.props[oF];if(!this.Ko||!Ea(e)||typeof e.r!="string")return;const n=roe(e.r),o=typeof e.u=="string"?roe(e.u):e.u;n===e.r&&o===e.u||this.xa(oF,Zt(Zt({},e),{},{r:n,u:o}))}set_disabled(e){this.hi=e,this.hi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Va&&(this.Va=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,n){const o=this.props.__timers||{};o[e]=n,this.xa(mxe,o),this.save()}remove_event_timer(e){const n=this.props.__timers||{},o=n[e];return Eo(o)||(delete n[e],this.xa(mxe,n),this.save()),o}get_property(e){return this.props[e]}set_property(e,n){this.xa(e,n),this.save()}xa(e,n,o=!0){var i;const r=this.props[e];this.props[e]=n,o&&(e!=="distinct_id"&&e!=="$user_state"||r===n||(this.na=!0),alt(e)&&!FQ(r,n)&&this.ra.add(e),this.Ma(e,r,n),!((i=r1(e))===null||i===void 0)&&i.volatile||this.Ta(e))}$a(e,n=!0){delete this.props[e],n&&(Jxe(e)&&this.ga(e,!0),alt(e)&&this.ra.add(e),this.Ta(e))}Ta(e){var n;const o=(n=r1(e))===null||n===void 0?void 0:n.storageGroup;o&&(this.ma(o).dirty=!0)}ma(e){return this.Zo[e]||(this.Zo[e]={})}};const V3={GZipJS:"gzip-js",Base64:"base64"},jz={Activation:"events",Cancellation:"cancelEvents"},jxe={Popover:"popover",API:"api",Widget:"widget"},J3={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},qxe={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},$xe={Popover:"popover",Inline:"inline"};function soe(t){let e=!0;return{dispose(){if(e){e=!1;const n=t();n&&ap(n.then)&&n.then(void 0,()=>{})}}}}const Ywn={SHOWN:"product tour shown"},clt={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},llt=gd("[RateLimiter]");var Uwn=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{const o=n.text;if(o&&o.length)try{(JSON.parse(o).quota_limited||[]).forEach(i=>{llt.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void llt.warn(`could not rate limit - continuing. Error: "${i?.message}"`,{text:o})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var n,o,i;const{captureEventsBurstLimit:r,captureEventsPerSecond:s}=this,a=new Date().getTime(),A=(n=(o=this.instance.persistence)===null||o===void 0?void 0:o.get_property("$capture_rate_limit"))!==null&&n!==void 0?n:{tokens:r,last:a};A.tokens+=(a-A.last)/1e3*s,A.last=a,A.tokens>r&&(A.tokens=r);const c=1>A.tokens;if(c||e||(A.tokens=Math.max(0,A.tokens-1)),c&&!e){const l=(eh(A.dropped)?A.dropped:0)+1;A.dropped=l,!this.lastEventRateLimited&&this.Ja(l)&&(A.dropped=0)}return this.lastEventRateLimited=c,(i=this.instance.persistence)===null||i===void 0||i.set_property("$capture_rate_limit",A),{isRateLimited:c,remainingTokens:A.tokens}}Ka(e){const n=this.instance.config.property_denylist;return!qr(n)||!n.includes(e)}Xa(){var e;if(this.Ka("$current_url")&&this.Ka("$pathname")&&qg?.pathname)return`${(e=qg.origin)!==null&&e!==void 0?e:""}${qg.pathname}`}Ja(e){var n,o;const{captureEventsBurstLimit:i,captureEventsPerSecond:r}=this,s=this.Xa(),a=this.Ka("$session_id")?(n=(o=this.instance).get_session_id)===null||n===void 0?void 0:n.call(o):void 0,A=[`${e} event(s) dropped since the last warning`,s?`triggered on ${s}`:void 0,a?`session ${a}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${A}. Config is set to ${r} events per second and ${i} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}};const LQ=gd("[RemoteConfig]");var glt=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Yr._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}Ya(e){var n,o,i;!((n=Yr.__PosthogExtensions__)===null||n===void 0)&&n.loadExternalDependency?(o=Yr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}tl(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return LQ.info("Using preloaded remote config",this.remoteConfig),void this.el(this.remoteConfig);if(this._instance.il())return void LQ.warn("Remote config is disabled. Falling back to local config.");this.Ya(e=>{if(!e)return LQ.info("No config found after loading remote JS config. Falling back to JSON."),void this.tl(n=>{this.el(n.json,n)});this.el(e)})}catch(e){LQ.error("Error loading remote config",e),this.el()}}el(e,n){!e&&n&&(n.statusCode===0?n.error||LQ.warn("Failed to fetch remote config from PostHog."):LQ.error("Failed to fetch remote config from PostHog."));try{this._instance.el(e?{ok:!0,config:e}:{ok:!1})}catch(i){LQ.error("Error applying remote config",i)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var o;(o=this._instance.featureFlags)===null||o===void 0||o.ensureFlagsLoaded()}catch(i){LQ.error("Error loading feature flags",i)}}},N5=Uint8Array,_x=Uint16Array,hF=Uint32Array,Xxe=new N5([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]),Zxe=new N5([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]),ult=new N5([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),dlt=function(t,e){for(var n=new _x(31),o=0;31>o;++o)n[o]=e+=1<<t[o-1];var i=new hF(n[30]);for(o=1;30>o;++o)for(var r=n[o];n[o+1]>r;++r)i[r]=r-n[o]<<5|o;return[n,i]},hlt=dlt(Xxe,2),e3e=hlt[1];hlt[0][28]=258,e3e[258]=28;for(var mlt=dlt(Zxe,0)[1],plt=new _x(32768),dd=0;32768>dd;++dd){var mF=(43690&dd)>>>1|(21845&dd)<<1;plt[dd]=((65280&(mF=(61680&(mF=(52428&mF)>>>2|(13107&mF)<<2))>>>4|(3855&mF)<<4))>>>8|(255&mF)<<8)>>>1}var qz=function(t,e,n){for(var o=t.length,i=0,r=new _x(e);o>i;++i)++r[t[i]-1];var s,a=new _x(e);for(i=0;e>i;++i)a[i]=a[i-1]+r[i-1]<<1;for(s=new _x(o),i=0;o>i;++i)s[i]=plt[a[t[i]-1]++]>>>15-t[i];return s},aD=new N5(288);for(dd=0;144>dd;++dd)aD[dd]=8;for(dd=144;256>dd;++dd)aD[dd]=9;for(dd=256;280>dd;++dd)aD[dd]=7;for(dd=280;288>dd;++dd)aD[dd]=8;var aoe=new N5(32);for(dd=0;32>dd;++dd)aoe[dd]=5;var Kwn=qz(aD,9),zwn=qz(aoe,5),_lt=function(t){return(t/8|0)+(7&t&&1)},flt=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var o=new(t instanceof _x?_x:t instanceof hF?hF:N5)(n-e);return o.set(t.subarray(e,n)),o},W8=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8},$z=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8,t[o+2]|=n>>>16},t3e=function(t,e){for(var n=[],o=0;t.length>o;++o)t[o]&&n.push({s:o,f:t[o]});var i=n.length,r=n.slice();if(!i)return[new N5(0),0];if(i==1){var s=new N5(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort(function(y,x){return y.f-x.f}),n.push({s:-1,f:25001});var a=n[0],A=n[1],c=0,l=1,g=2;for(n[0]={s:-1,f:a.f+A.f,l:a,r:A};l!=i-1;)a=n[n[g].f>n[c].f?c++:g++],A=n[c!=l&&n[g].f>n[c].f?c++:g++],n[l++]={s:-1,f:a.f+A.f,l:a,r:A};var u=r[0].s;for(o=1;i>o;++o)r[o].s>u&&(u=r[o].s);var h=new _x(u+1),d=n3e(n[l-1],h,0);if(d>e){o=0;var m=0,p=d-e,_=1<<p;for(r.sort(function(y,x){return h[x.s]-h[y.s]||y.f-x.f});i>o;++o){var f=r[o].s;if(e>=h[f])break;m+=_-(1<<d-h[f]),h[f]=e}for(m>>>=p;m>0;){var I=r[o].s;e>h[I]?m-=1<<e-h[I]++-1:++o}for(;o>=0&&m;--o){var C=r[o].s;h[C]==e&&(--h[C],++m)}d=e}return[new N5(h),d]},n3e=function(t,e,n){return t.s==-1?Math.max(n3e(t.l,e,n+1),n3e(t.r,e,n+1)):e[t.s]=n},Ilt=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new _x(++e),o=0,i=t[0],r=1,s=function(A){n[o++]=A},a=1;e>=a;++a)if(t[a]==i&&a!=e)++r;else{if(!i&&r>2){for(;r>138;r-=138)s(32754);r>2&&(s(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(s(i),--r;r>6;r-=6)s(8304);r>2&&(s(r-3<<5|8208),r=0)}for(;r--;)s(i);r=1,i=t[a]}return[n.subarray(0,o),e]},Xz=function(t,e){for(var n=0,o=0;e.length>o;++o)n+=t[o]*e[o];return n},o3e=function(t,e,n){var o=n.length,i=_lt(e+2);t[i]=255&o,t[i+1]=o>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var r=0;o>r;++r)t[i+r+4]=n[r];return 8*(i+4+o)},Clt=function(t,e,n,o,i,r,s,a,A,c,l){W8(e,l++,n),++i[256];for(var g=t3e(i,15),u=g[0],h=g[1],d=t3e(r,15),m=d[0],p=d[1],_=Ilt(u),f=_[0],I=_[1],C=Ilt(m),y=C[0],x=C[1],E=new _x(19),B=0;f.length>B;++B)E[31&f[B]]++;for(B=0;y.length>B;++B)E[31&y[B]]++;for(var S=t3e(E,7),Q=S[0],w=S[1],M=19;M>4&&!Q[ult[M-1]];--M);var T,R,F,O,U=c+5<<3,Y=Xz(i,aD)+Xz(r,aoe)+s,j=Xz(i,u)+Xz(r,m)+s+14+3*M+Xz(E,Q)+(2*E[16]+3*E[17]+7*E[18]);if(Y>=U&&j>=U)return o3e(e,l,t.subarray(A,A+c));if(W8(e,l,1+(Y>j)),l+=2,Y>j){T=qz(u,h),R=u,F=qz(m,p),O=m;var Z=qz(Q,w);for(W8(e,l,I-257),W8(e,l+5,x-1),W8(e,l+10,M-4),l+=14,B=0;M>B;++B)W8(e,l+3*B,Q[ult[B]]);l+=3*M;for(var J=[f,y],X=0;2>X;++X){var te=J[X];for(B=0;te.length>B;++B)W8(e,l,Z[ae=31&te[B]]),l+=Q[ae],ae>15&&(W8(e,l,te[B]>>>5&127),l+=te[B]>>>12)}}else T=Kwn,R=aD,F=zwn,O=aoe;for(B=0;a>B;++B)if(o[B]>255){var ae;$z(e,l,T[257+(ae=o[B]>>>18&31)]),l+=R[ae+257],ae>7&&(W8(e,l,o[B]>>>23&31),l+=Xxe[ae]);var ie=31&o[B];$z(e,l,F[ie]),l+=O[ie],ie>3&&($z(e,l,o[B]>>>5&8191),l+=Zxe[ie])}else $z(e,l,T[o[B]]),l+=R[o[B]];return $z(e,l,T[256]),l+R[256]},Vwn=new hF([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Jwn=(function(){for(var t=new hF(256),e=0;256>e;++e){for(var n=e,o=9;--o;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),i3e=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function Wwn(t,e){e===void 0&&(e={});var n=(function(){var g=4294967295;return{p(u){for(var h=g,d=0;u.length>d;++d)h=Jwn[255&h^u[d]]^h>>>8;g=h},d(){return 4294967295^g}}})(),o=t.length;n.p(t);var i,r,s,a,A,c=(a=10+((i=e).filename&&i.filename.length+1||0),A=8,(function(g,u,h,d,m,p){var _=g.length,f=new N5(d+_+5*(1+Math.floor(_/7e3))+m),I=f.subarray(d,f.length-m),C=0;if(!u||8>_)for(var y=0;_>=y;y+=65535){var x=y+65535;_>x?C=o3e(I,C,g.subarray(y,x)):(I[y]=p,C=o3e(I,C,g.subarray(y,_)))}else{for(var E=Vwn[u-1],B=E>>>13,S=8191&E,Q=(1<<h)-1,w=new _x(32768),M=new _x(Q+1),T=Math.ceil(h/3),R=2*T,F=function(Ie){return(g[Ie]^g[Ie+1]<<T^g[Ie+2]<<R)&Q},O=new hF(25e3),U=new _x(288),Y=new _x(32),j=0,Z=0,J=(y=0,0),X=0,te=0;_>y;++y){var ae=F(y),ie=32767&y,le=M[ae];if(w[ie]=le,M[ae]=ie,y>=X){var he=_-y;if((j>7e3||J>24576)&&he>423){C=Clt(g,I,0,O,U,Y,Z,J,te,y-te,C),J=j=Z=0,te=y;for(var Ce=0;286>Ce;++Ce)U[Ce]=0;for(Ce=0;30>Ce;++Ce)Y[Ce]=0}var ce=2,_e=0,ue=S,pe=ie-le&32767;if(he>2&&ae==F(y-pe))for(var Me=Math.min(B,he)-1,ve=Math.min(32767,y),me=Math.min(258,he);ve>=pe&&--ue&&ie!=le;){if(g[y+ce]==g[y+ce-pe]){for(var Pe=0;me>Pe&&g[y+Pe]==g[y+Pe-pe];++Pe);if(Pe>ce){if(ce=Pe,_e=pe,Pe>Me)break;var Qe=Math.min(pe,Pe-2),we=0;for(Ce=0;Qe>Ce;++Ce){var Re=y-pe+Ce+32768&32767,Ne=Re-w[Re]+32768&32767;Ne>we&&(we=Ne,le=Re)}}}pe+=(ie=le)-(le=w[ie])+32768&32767}if(_e){O[J++]=268435456|e3e[ce]<<18|mlt[_e];var Be=31&e3e[ce],Te=31&mlt[_e];Z+=Xxe[Be]+Zxe[Te],++U[257+Be],++Y[Te],X=y+ce,++j}else O[J++]=g[y],++U[g[y]]}}C=Clt(g,I,p,O,U,Y,Z,J,te,y-te,C)}return flt(f,0,d+_lt(C)+m)})(r=t,(s=e).level==null?6:s.level,s.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+s.mem,a,A,!0)),l=c.length;return(function(g,u){var h=u.filename;if(g[0]=31,g[1]=139,g[2]=8,g[8]=2>u.level?4:u.level==9?2:0,g[9]=3,u.mtime!=0&&i3e(g,4,Math.floor(new Date(u.mtime||Date.now())/1e3)),h){g[3]=8;for(var d=0;h.length>=d;++d)g[d+10]=h.charCodeAt(d)}})(c,e),i3e(c,l-8,n.d()),i3e(c,l-4,o),c}const jwn=!!L2e||!!Qz,ylt=new WeakMap,xlt="text/plain";let r3e=0,Aoe=!1;const Elt=(t,e)=>{const[n,o]=t.split("#"),[i,r]=n.split("?");if(!r)return t;const s=r.split("&").filter(a=>a.split("=")[0]!==e).join("&");return`${i}${s?`?${s}`:""}${o?`#${o}`:""}`},Zz=(t,e,n=!0)=>{var o;const[i,r]=t.split("?"),s=Zt({},e),a=(o=r?.split("&").map(c=>{var l;const[g,u]=c.split("="),h=n&&(l=s[g])!==null&&l!==void 0?l:u;return delete s[g],`${g}=${h}`}))!==null&&o!==void 0?o:[],A=(function(c,l="&"){let g,u;const h=[];return pl(c,function(d,m){Eo(d)||Eo(m)||m==="undefined"||(g=encodeURIComponent((p=>p instanceof File)(d)?d.name:d.toString()),u=encodeURIComponent(m),h[h.length]=u+"="+g)}),h.join(l)})(s);return A&&a.push(A),a.length>0?`${i}?${a.join("&")}`:i},s3e=t=>{if(t.nl)return t.nl;const{data:e,compression:n}=t;if(!e)return;if(n===V3.GZipJS){const i=Wwn((function(r){var s=r.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(r);for(var a=new N5(r.length+(r.length>>>1)),A=0,c=function(h){a[A++]=h},l=0;s>l;++l){if(A+5>a.length){var g=new N5(A+8+(s-l<<1));g.set(a),a=g}var u=r.charCodeAt(l);128>u?c(u):2048>u?(c(192|u>>>6),c(128|63&u)):u>55295&&57344>u?(c(240|(u=65536+(1047552&u)|1023&r.charCodeAt(++l))>>>18),c(128|u>>>12&63),c(128|u>>>6&63),c(128|63&u)):(c(224|u>>>12),c(128|u>>>6&63),c(128|63&u))}return flt(a,0,A)})(lF(e)),{mtime:0});return{contentType:xlt,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===V3.Base64){const i=(function(s){return s&&btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g,(a,A)=>String.fromCharCode(parseInt(A,16))))})(lF(e)),r=(s=>"data="+encodeURIComponent(typeof s=="string"?s:lF(s)))(i);return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}const o=lF(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}},Blt=t=>{const e=()=>t.transport==="sendBeacon"?{url:Zz(t.url,{compression:V3.Base64}),encodedBody:s3e(Zt(Zt({},t),{},{compression:V3.Base64,nl:void 0}))}:{url:Elt(t.url,"compression"),encodedBody:s3e(Zt(Zt({},t),{},{compression:void 0,nl:void 0}))};let n;try{n=s3e(t)}catch(i){if(xAt(t.compression,gF(t.url,"compression")))return li.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return n&&xAt(t.compression,gF(t.url,"compression"))&&!((o=n.body)instanceof ArrayBuffer?oxe(new Uint8Array(o)):ArrayBuffer.isView(o)&&oxe(new Uint8Array(o.buffer,o.byteOffset,o.byteLength)))?(Aoe=!0,e()):{url:t.url,encodedBody:n};var o},blt=t=>{try{return Blt(t)}catch(n){var e;return li.error(n),void((e=t.callback)===null||e===void 0||e.call(t,{statusCode:0,error:n}))}},qwn=(function(){var t=$g(function*(e){const n=yield(function(i){return ixe.apply(this,arguments)})(lF(e.data),Xp.DEBUG,{rethrow:!0});if(!n)return e;const o=yield n.arrayBuffer();return Zt(Zt({},e),{},{nl:{contentType:xlt,body:o,estimatedSize:o.byteLength}})});return function(e){return t.apply(this,arguments)}})(),$wn=/Failed to fetch|NetworkError|Load failed/i,Slt=t=>t?.name==="TypeError"&&$wn.test(t?.message||""),Qlt=t=>{try{const e=(function(n,o=Date.now()){if(typeof n!="string"||!n)return;const i=n.trim(),r=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(r)){const A=1e3*Math.min(Number(r),300);return A>0?A:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r))return;const s=/^\w{3} \w{3} /.test(r)?r+" GMT":r,a=Date.parse(s)-o;return Number.isFinite(a)&&a>0?Math.min(a,One):void 0})(t());return Eo(e)?void 0:Math.min(e,3e4)}catch{return}},vlt=t=>{const e=blt(t);if(!e)return;const n=new L2e;ylt.set(n,!0);const{url:o,encodedBody:i}=e;n.open(t.method||"GET",o,!0);const{contentType:r,body:s}=i??{};pl(t.headers,function(a,A){n.setRequestHeader(A,a)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var a;const A={statusCode:n.status,text:n.responseText};if(n.status===200)try{A.json=JSON.parse(n.responseText)}catch{}(a=t.callback)===null||a===void 0||a.call(t,A,Qlt(()=>n.getResponseHeader("Retry-After")))}},n.send(s)},wlt=t=>{const e=blt(t);if(!e)return;const{url:n,encodedBody:o}=e,{contentType:i,body:r,estimatedSize:s}=o??{},a=new Headers;pl(t.headers,function(d,m){a.append(m,d)}),i&&a.append("Content-Type",i);let A=null,c=!1;if(Iat){const d=new Iat;A={signal:d.signal,timeout:setTimeout(()=>{c=!0;try{d.abort(sAt("AbortError","PostHog request timed out"+((m=t.timeout)?` after ${m}ms`:"")))}catch(p){g(p)}var m},t.timeout)}}let l=!1;const g=d=>{var m;l||(l=!0,c&&d?.name==="AbortError"||Slt(d)?li.warn(d):li.error(d),(m=t.callback)===null||m===void 0||m.call(t,{statusCode:0,error:d}))};let u=0;const h=()=>{r3e-=u,u=0,A&&clearTimeout(A.timeout)};try{const d=Zt({method:t?.method||"GET",headers:a,referrerPolicy:"strict-origin",body:r,signal:A?.signal},t.fetchOptions),m=s??(Eo(r)?0:void 0);d.keepalive=d.method==="POST"&&!t.sl&&d.keepalive!==!1&&d.body===r&&!Eo(m)&&m>=0&&52428.8>r3e+m,d.keepalive&&(u=m,r3e+=u),Qz(n,d).then(p=>p.text().then(_=>{var f;if(l)return;const I={statusCode:p.status,text:_};if(p.status===200)try{I.json=JSON.parse(_)}catch(C){li.error(C)}l=!0,h(),(f=t.callback)===null||f===void 0||f.call(t,I,Qlt(()=>p.headers.get("Retry-After")))})).catch(p=>{h(),g(p)}).finally(h)}catch(d){h(),g(d)}},a3e=t=>{try{var e;const{url:n,encodedBody:o}=Blt(t),{contentType:i,body:r,estimatedSize:s}=o??{};if(!r)return;const a=r instanceof Blob?r:new Blob([r],{type:i});if(X_.sendBeacon(n,a))return;const A=qr(t.data)?t.data:(e=t.data)===null||e===void 0?void 0:e.batch;if(qr(A)&&A.length>1&&(s??0)>16384){const c=Math.ceil(A.length/2),l=g=>qr(t.data)?g:Zt(Zt({},t.data),{},{batch:g});return a3e(Zt(Zt({},t),{},{data:l(A.slice(0,c))})),void a3e(Zt(Zt({},t),{},{data:l(A.slice(c))}))}li.warn(`Beacon of ~${s??0} bytes was rejected by the browser, falling back to ${Qz?"fetch":"XHR"}`),Qz?wlt(Zt(Zt({},t),{},{sl:!0})):vlt(t)}catch(n){li.warn("Beacon send failed",n)}},Plt=(t,e,n,o)=>{const i=o==="query"?e==="POST"?"sent_at":"_":void 0;return Zz(n===V3.GZipJS?Elt(t,"compression"):t,Zt(Zt({},i?{[i]:Date.now().toString()}:{}),n===V3.GZipJS?{}:{compression:n}))},Xwn=(()=>{const t=[];return Qz&&t.push({transport:"fetch",method:wlt}),L2e&&t.push({transport:"XHR",method:vlt}),X_?.sendBeacon&&t.push({transport:"sendBeacon",method:a3e}),t})();let Mlt=!jwn&&Py?.indexOf("MSIE")===-1&&Py?.indexOf("Mozilla")===-1;function Dlt(t,e,n){var o,i,r;n&&(e=Zt(Zt({},e),{},{callback:s=>n(s)})),t.__loaded?Mlt?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&((i=e.callback)===null||i===void 0||i.call(e,{statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=Zt(Zt({},t.config.request_headers),e.headers),e.compression=e.compression==="best-available"?(o=t.compression)!==null&&o!==void 0?o:e.compressionFallback:e.compression,(Eo(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((s,a)=>{var A,c,l;const g=Zt(Zt({},s),{},{callback:a??(p=>{var _;return(_=s.callback)===null||_===void 0?void 0:_.call(s,p)})});g.timeout=g.timeout||6e4;const u=(A=g.transport)!==null&&A!==void 0?A:"fetch";u==="sendBeacon"&&Eo(g.compression)&&g.data&&(g.compression=V3.Base64),g.method==="POST"&&g.data&&(g.timestampMode==="capture-body"?g.data=(p=>{var _,f;const I=(qr(p)?p:[p]).map(y=>Zt(Zt({},y),y.timestamp instanceof Date&&!isNaN(y.timestamp.getTime())?{timestamp:y.timestamp.toISOString()}:{})),C=I[0];return{api_key:(_=C==null||(f=C.properties)===null||f===void 0?void 0:f.token)!==null&&_!==void 0?_:C?.token,batch:I,sent_at:new Date().toISOString()}})(g.data):g.timestampMode==="body"&&(g.data=((p,_=new Date().toISOString())=>qr(p)?p.map(f=>Zt(Zt({},f),{},{sent_at:_})):Zt(Zt({},p),{},{sent_at:_}))(g.data))),g.url=Plt(g.url,g.method,g.compression,g.timestampMode);const h=Xwn.filter(p=>!g.disableTransport||!p.transport||!g.disableTransport.includes(p.transport)),d=(c=(l=(function(p,_){for(let f=0;p.length>f;f++)if(_(p[f]))return p[f]})(h,p=>p.transport===u))===null||l===void 0?void 0:l.method)!==null&&c!==void 0?c:h[0].method;if(!d)throw new Error("No available transport method");const m=p=>{try{d(p)}catch(f){var _;Slt(f)?li.warn(f):li.error(f),(_=g.callback)===null||_===void 0||_.call(g,{statusCode:0,error:f})}};u!=="sendBeacon"&&!g.preferSyncCompression&&g.data&&g.compression===V3.GZipJS&&hQn&&typeof Promise<"u"&&!Aoe?qwn(g).then(p=>{m(p)}).catch(p=>{if(EAt(p))return Aoe=!0,void m(Zt(Zt({},g),{},{compression:void 0,url:Plt(s.url,s.method,void 0,s.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;const f="name"in _?String(_.name):"";return EAt(_)||f===yAt})(p)&&(Aoe=!0),m(g)}):m(g)})(e,(s,a)=>{var A,c,l;t.rateLimiter.checkForLimiting(s),400>s.statusCode||(A=(c=t.config).on_request_error)===null||A===void 0||A.call(c,s),n?n(s,a):(l=e.callback)===null||l===void 0||l.call(e,s)})):e.fireCallbackOnDrop&&((r=e.callback)===null||r===void 0||r.call(e,{statusCode:0}))}var Zwn=class{constructor(e,n){this.rl=!0,this.ol=[],this.al=z9(n?.flush_interval_ms||3e3,250,5e3,li.createLogger("flush interval"),3e3),this.ll=e}enqueue(e){this.ol.push(e),this.ul||this.cl()}unload(){this.hl();const e=this.ol.length>0?this.dl():{},n=Object.values(e);[...n.filter(o=>o.url.indexOf("/e")===0),...n.filter(o=>o.url.indexOf("/e")!==0)].map(o=>{this.vl(Zt(Zt({},o),{},{callback:void 0}),"sendBeacon")})}enable(){this.rl=!1,this.cl()}cl(){this.rl||(this.ul=setTimeout(()=>{this.hl(),this.fl()},this.al))}fl(){if(this.ol.length>0){const e=this.dl();for(const n in e)this.vl(e[n])}}vl(e,n){try{this.ll(e,n)}catch(o){li.error(o)}}hl(){clearTimeout(this.ul),this.ul=void 0}dl(){const e={},n={};pl(this.ol,o=>{var i;const r=o,s=((r?r.batchKey:null)||r.url)+(r.batchGroup?`:${r.batchGroup}`:"");Eo(e[s])&&(e[s]=Zt(Zt({},r),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),n[s]=[]),(i=e[s].data)===null||i===void 0||i.push(r.data),r.callback&&n[s].push(r.callback)});for(const o in n){const i=n[o];i.length&&(e[o].callback=r=>{for(const s of i)s(r)})}return this.ol=[],e}};const ePn=["retriesPerformedSoFar"];var tPn=class{constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.ol=[],this.ol=[],this.ml=!0,this.resume()}resume(){if(!Eo(jn)&&"onLine"in jn.navigator){if(this.ml=jn.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.fl()},this.bl=()=>{this.ml=!1},Wc(jn,"online",this.yl),Wc(jn,"offline",this.bl)}}get length(){return this.ol.length}retriableRequest(e,n){let{retriesPerformedSoFar:o}=e,i=bAt(e,ePn);U8(o)&&(i.url=Zz(i.url,{retry_count:o})),Dlt(this._instance,n?Zt(Zt({},i),{},{transport:n}):i,(r,s)=>{var a;if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(o??0))return void this.Ls(Zt({retriesPerformedSoFar:o},i),s);r.statusCode===0&&li.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${o??0} retries.`)}(a=i.callback)===null||a===void 0||a.call(i,r)})}Ls(e,n){const o=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=o+1;const i=Math.max((function(a){const A=3e3*Math.pow(2,a),c=A/2,l=Math.min(18e5,A),g=(Math.random()-.5)*(l-c);return Math.ceil(l+g)})(o),n??0),r=Date.now()+i;this.ol.push({retryAt:r,requestOptions:e});let s=`Enqueued failed request for retry in ${i}`;navigator.onLine||(s+=" (Browser is offline)"),li.warn(s),this.pl||(this.pl=!0,this._l())}_l(){if(this.wl&&clearTimeout(this.wl),this.ol.length===0)return this.pl=!1,void(this.wl=void 0);this.wl=setTimeout(()=>{this.ml&&this.ol.length>0&&this.fl(),this._l()},this.gl)}fl(){const e=Date.now(),n=[],o=this.ol.filter(i=>e>i.retryAt||(n.push(i),!1));if(this.ol=n,o.length>0)for(const{requestOptions:i}of o)this.retriableRequest(i)}unload(){this.wl&&(clearTimeout(this.wl),this.wl=void 0),this.pl=!1,Eo(jn)||(this.yl&&(jn.removeEventListener("online",this.yl),this.yl=void 0),this.bl&&(jn.removeEventListener("offline",this.bl),this.bl=void 0));for(const{requestOptions:e}of this.ol)try{this._instance._send_request(Zt(Zt({},e),{},{callback:qr(e.data)?void 0:e.callback,transport:"sendBeacon"}))}catch(n){li.error(n)}this.ol=[]}},nPn=class{constructor(e){this._instance=e,this.kl=()=>{var n,o,i,r;this.Sl||(this.Sl={});const s=this.scrollElement(),a=this.scrollY(),A=s?Math.max(0,s.scrollHeight-s.clientHeight):0,c=a+(s?.clientHeight||0),l=s?.scrollHeight||0;this.Sl.lastScrollY=Math.ceil(a),this.Sl.maxScrollY=Math.max(a,(n=this.Sl.maxScrollY)!==null&&n!==void 0?n:0),this.Sl.maxScrollHeight=Math.max(A,(o=this.Sl.maxScrollHeight)!==null&&o!==void 0?o:0),this.Sl.lastContentY=c,this.Sl.maxContentY=Math.max(c,(i=this.Sl.maxContentY)!==null&&i!==void 0?i:0),this.Sl.maxContentHeight=Math.max(l,(r=this.Sl.maxContentHeight)!==null&&r!==void 0?r:0)}}get xl(){return this._instance.config.scroll_root_selector}getContext(){return this.Sl}resetContext(){const e=this.Sl;return this.Sl=void 0,setTimeout(this.kl,0),e}startMeasuringScrollPosition(){Wc(jn,"scroll",this.kl,{capture:!0}),Wc(jn,"scrollend",this.kl,{capture:!0}),Wc(jn,"resize",this.kl)}scrollElement(){if(this.xl){const o=qr(this.xl)?this.xl:[this.xl];for(const i of o){var e;const r=jn==null||(e=jn.document)===null||e===void 0?void 0:e.querySelector(i);if(r)return r}return}var n;return jn==null||(n=jn.document)===null||n===void 0?void 0:n.documentElement}$l(e){var n,o;const i=e==="y"?"scrollTop":"scrollLeft";if(this.xl){const r=this.scrollElement();return r&&r[i]||0}return jn?e==="y"?jn.scrollY||jn.pageYOffset||((n=jn.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.scrollTop)||0:jn.scrollX||jn.pageXOffset||((o=jn.document)===null||o===void 0||(o=o.documentElement)===null||o===void 0?void 0:o.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}};const oPn=t=>ilt(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes);var Nlt=class{constructor(e,n,o,i){this.qe=r=>{const s=this.Cl();if(s&&s.sessionId===r)return;const a={sessionId:r,props:this.Tl(this._instance)};this.Il.register({[Exe]:a})},this._instance=e,this.Ml=n,this.Il=o,this.Tl=i||oPn,this.Ml.onSessionId(this.qe)}Cl(){return this.Il.props[Exe]}getSetOnceProps(){var e;const n=(e=this.Cl())===null||e===void 0?void 0:e.props;return n?"r"in n?rlt(n,this._instance.config.disable_capture_url_hashes):{$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(){const e={};return pl(Pxe(this.getSetOnceProps()),(n,o)=>{o==="$current_url"&&(o="url"),e[`$session_entry_${O2e(o)}`]=n}),e}},coe=class{on(e,n){return this.El[e]||(this.El[e]=[]),this.El[e].push(n),()=>{this.El[e]=this.El[e].filter(o=>o!==n)}}emit(e,n){for(const o of this.El[e]||[])o(n);for(const o of this.El["*"]||[])o(e,n)}constructor(){this.El={}}};const pF=gd("[SessionId]"),Rlt=864e5;var Tlt=class{on(e,n){return this.Pl.on(e,n)}constructor(e,n,o){var i;if(this.Rl=null,this.Al=null,this.Fl=[],this.Ol=void 0,this.Dl=!1,this.Pl=new coe,this.Ll=(s,a)=>!(!U8(s)||!U8(a))&&Math.abs(s-a)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=e.config,this.Il=e.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Nl=void 0,this._sessionActivityTimestamp=null,this.ql=n||tB,this.jl=o||tB;const r=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*z9(this.Mr.session_idle_timeout_seconds||1800,60,36e3,pF.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Bl(),this.zl="ph_"+r+"_window_id",this.Hl="ph_"+r+"_primary_window_exists",this.Ul()){const s=eg.Ft(this.zl),a=eg.Ft(this.Hl);s&&!a?this.je=s:eg.Pt(this.zl),eg.$t(this.Hl,!0)}!((i=this.Mr.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Wl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Eo(this.Fl)&&(this.Fl=[]),this.Fl.push(e),this.Xt&&e(this.Xt,this.je),()=>{this.Fl=this.Fl.filter(n=>n!==e)}}Ul(){return this.Mr.persistence!=="memory"&&!this.Il.hi&&eg.At()}Vl(e){e!==this.je&&(this.je=e,this.Ul()&&eg.$t(this.zl,e))}Gl(){return this.je?this.je:this.Ul()?eg.Ft(this.zl):null}Ql(e){const n=this.Rl;return!ld(n)&&!ld(e)&&5e3>Math.abs(e-n)}Zl(e,n,o){const i=n!==this._sessionActivityTimestamp,r=!(e!==this.Xt||o!==this._sessionStartTimestamp);this._sessionStartTimestamp=o,this._sessionActivityTimestamp=n,this.Xt=e,r&&!i||r&&this.Ql(n)||(this.Rl=n,this.Il.register({[nF]:[n,e,o]}))}Jl(){var e;const n=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return U8(n)&&n>0}Kl(){this.Jl()?this.Il.refreshKey(nF):(this.Il.flush(),this.Il.load())}Xl(){var e;if(ld(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Rl)return;this.Kl();const[,n,o]=this.Yl();n===this.Xt&&o===this._sessionStartTimestamp&&(this.Rl=this._sessionActivityTimestamp,this.Il.register({[nF]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Il.flush())}tu(){const[e]=this.Yl(),n=U8(e)?e:0,o=U8(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,o)}eu(e){return this.Kl(),this.Ll(e,this.tu())}Yl(){const e=this.Il.props[nF];return qr(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Rl=null,this.Nl=void 0,clearTimeout(this.iu),this.iu=void 0,this.Zl(null,null,null)}setBootstrapSessionId(e,n=!1){const o=((i,r=new Date().getTime())=>{try{const s=(a=>{const A=a.replace(/-/g,"");if(A.length!==32)throw new Error("Not a valid UUID");if(A[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(A.substring(0,12),16)})(i);return s>r+6e4?void pF.error("Bootstrap sessionID cannot be in the future"):s}catch(s){return void pF.error("Invalid sessionID in bootstrap",s)}})(e);return!Eo(o)&&(n?this.Nl={sessionId:e,sessionStartTimestamp:o}:this.Zl(e,new Date().getTime(),o),!0)}destroy(){this.Dl=!0,this.Xl(),clearTimeout(this.iu),this.iu=void 0,this.Ol&&jn&&(jn.removeEventListener(Xne,this.Ol,{capture:!1}),this.Ol=void 0),this.Fl=[]}Wl(){this.Ol=()=>{this.Xl(),this.Ul()&&eg.Pt(this.Hl)},Wc(jn,Xne,this.Ol,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,n=null,o=!1){if(this.Mr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const i=n||new Date().getTime(),r=this.Xt;if(o)this.Al=i;else if(ld(this.Al)||this.Al>i||i-this.Al>=1e3){var s,a;(s=(a=this.Il).syncCookieProperties)===null||s===void 0||s.call(a),this.Al=i}let[,A,c]=this.Yl();const l=!Eo(r)&&A!==r,g=this.tu();let u=this.Gl();const h=this.Nl,d=!!h&&(h.sessionStartTimestamp>i+6e4||i-h.sessionStartTimestamp>Rlt),m=h?d:U8(c)&&Math.abs(i-c)>Rlt;let p=!1,_=l,f=!A||!!h;const I=A;let C=!f&&!e&&this.Ll(i,g);if(C&&(C=this.eu(i),C||pF.info("cross-tab refresh kept the session alive",{sessionId:A}),[,A,c]=this.Yl(),C||(f=!A||!!h)),f||C||m){_=!1;const B=h&&!d;A=B?h.sessionId:this.ql(),u=this.jl(),pF.info("new session ID assigned",{sessionId:A,windowId:u,bootstrapped:!!B,changeReason:{noSessionId:f,activityTimeout:C,sessionPastMaximumLength:m}}),c=B?h.sessionStartTimestamp:i,this.Nl=void 0,p=!0}else u||(u=this.jl(),p=!0),_=_||A!==I,_&&(pF.info("adopted cross-tab session id",{sessionId:A,windowId:u}),p=!0);const y=U8(g)&&e&&!m?g:i,x=U8(c)?c:new Date().getTime();this.Vl(u),this.Zl(A,y,x),e||this.Bl();const E={noSessionId:f,activityTimeout:C,sessionPastMaximumLength:m,crossTabAdoption:_};return p&&this.Fl.forEach(B=>B(A,u,E)),{sessionId:A,windowId:u,sessionStartTimestamp:x,changeReason:p?E:void 0,lastActivityTimestamp:g}}Bl(){this.Dl||(clearTimeout(this.iu),this.iu=setTimeout(()=>{if(!this.Dl)if(this.eu(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Pl.emit("forcedIdleReset",{idleSessionId:e})}else this.Bl()},1.1*this.sessionTimeoutMs))}};const klt=function(t,e){if(!t)return!1;const n=t.userAgent;if(n&&bat(n,e))return!0;try{const o=t?.userAgentData;if(o?.brands&&o.brands.some(i=>bat(i?.brand,e)))return!0}catch{}return!!t.webdriver};function Flt(){return(Flt=$g(function*(){const t=X_?.userAgentData;if(t?.getHighEntropyValues)try{const e=yield t.getHighEntropyValues(["model"]),n=e?.model;return $a(n)&&n.length>0?n:void 0}catch(e){return void li.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function iPn(t,e){let n=`$survey_${e}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(n=`$survey_${e}/${t.id}/${t.current_iteration}`),n}function Llt(t){var e;return!!(!((e=t.conditions)===null||e===void 0||(e=e.events)===null||e===void 0||(e=e.values)===null||e===void 0)&&e.length)}const loe=(t,e)=>{if(!(n=>{try{new RegExp(n)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}},goe=t=>t.toLowerCase(),Hlt={exact:(t,e)=>e.some(n=>t.some(o=>n===o)),is_not:(t,e)=>e.every(n=>t.every(o=>n!==o)),regex:(t,e)=>e.some(n=>t.some(o=>loe(n,o))),not_regex:(t,e)=>e.every(n=>t.every(o=>!loe(n,o))),icontains:(t,e)=>e.map(goe).some(n=>t.map(goe).some(o=>n.includes(o))),not_icontains:(t,e)=>e.map(goe).every(n=>t.map(goe).every(o=>!n.includes(o))),gt:(t,e)=>e.some(n=>{const o=parseFloat(n);return!isNaN(o)&&t.some(i=>o>parseFloat(i))}),lt:(t,e)=>e.some(n=>{const o=parseFloat(n);return!isNaN(o)&&t.some(i=>o<parseFloat(i))})};function Olt(t,e){return!t||Object.entries(t).every(([n,o])=>{const i=e?.[n];if(i==null)return!1;const r=Hlt[o.operator];return!!r&&r(o.values.map(String),[String(i)])})}function A3e(t,e,n){return lF({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}const c3e="custom",Glt="i.posthog.com",rPn=/^\/static\//,sPn=["/s/","/e/","/i/"];var aPn=class{constructor(e){this.nu={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let n=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace(`.${Glt}`,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.nu[this.apiHost]||(this.nu[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":c3e),this.nu[this.apiHost]}su(e){if(!rPn.test(e))return;const n=this.instance.config.asset_host;return typeof n=="string"&&n.trim().replace(/\/$/,"")||void 0}ru(e){const n=V8(e);return n?n.protocol+"//"+n.host+n.pathname:void 0}ou(e,n,o){if(e==="ui")return o;let i=o;const r=this.instance.config.rewriteRequestPath;if(r){var s;const a=((s=V8(o))===null||s===void 0?void 0:s.href)||o;i=r(new URL(a)).toString()}if(r&&e==="api"&&sPn.some(a=>n.indexOf(a)===0)){const a=this.ru(i);if(a){const A=this.apiHost;let c=this.au;c?.apiHost===A&&c.rewriteRequestPath===r||(c={apiHost:A,rewriteRequestPath:r,urls:new Set},this.au=c),c.urls.add(a)}}return i}isIngestionEndpoint(e){const n=this.au,o=this.ru(e);return n?.apiHost===this.apiHost&&n.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!o&&n.urls.has(o)}endpointFor(e,n=""){if(n&&(n=n[0]==="/"?n:`/${n}`),e==="ui")return this.ou(e,n,this.uiHost+n);if(e==="flags")return this.ou(e,n,this.flagsApiHost+n);if(e==="assets"){const i=this.su(n);if(i)return this.ou(e,n,`${i}${n}`)}if(this.region===c3e)return this.ou(e,n,this.apiHost+n);const o=Glt+n;switch(e){case"assets":return this.ou(e,n,`https://${this.region}-assets.${o}`);case"api":return this.ou(e,n,`https://${this.region}.${o}`)}}};const _l=gd("[Surveys]"),Ylt=t=>{try{const e=(n=>((o,i)=>`seenSurvey_${(function(r){return r.current_iteration&&r.current_iteration>0?`${r.id}_${r.current_iteration}`:r.id})(i)}`)(0,n))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(e){_l.error("Failed to persist survey seen state",e)}},APn=[jxe.Popover,jxe.Widget,jxe.API],cPn={ignoreConditions:!1,ignoreDelay:!1,displayType:$xe.Popover},lPn=gd("[PostHog ExternalIntegrations]"),gPn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var uPn=class{constructor(e){this._instance=e}zo(e,n){var o,i;(o=Yr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,e,r=>{if(r)return lPn.error("failed to load script",r);n()})}startIfEnabledOrStop(){var e;for(const[r,s]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var n,o,i;s&&!(!((n=Yr.__PosthogExtensions__)===null||n===void 0||(n=n.integrations)===null||n===void 0)&&n[r])&&this.zo(gPn[r],()=>{var a;(a=Yr.__PosthogExtensions__)===null||a===void 0||(a=a.integrations)===null||a===void 0||(a=a[r])===null||a===void 0||a.start(this._instance)}),!s&&(!((o=Yr.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0)&&o[r])&&((i=Yr.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0||(i=i[r])===null||i===void 0||i.stop())}}},dPn=class{constructor(e,n){this.A=e,this.bo=n,this.lu=new Map,this.To=!1}add(e){var n=this;return $g(function*(){if(n.To)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.lu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);n.lu.set(e.name,e);try{const o=e.setup(n.bo);o&&(yield o)}catch(o){const i=n.lu.get(e.name)===e;i&&n.lu.delete(e.name),n.A.error(`Failed to set up browser extension "${e.name}"`,o),i&&n.uu(e)}})()}getExtension(e){return this.lu.get(e)}dispose(){if(this.To)return;this.To=!0;const e=Array.from(this.lu.values()).reverse();this.lu.clear();for(const n of e)this.uu(n)}uu(e){try{var n;const o=(n=e.dispose)===null||n===void 0?void 0:n.call(e);o&&ap(o.then)&&o.then(void 0,i=>{this.A.error(`Failed to dispose browser extension "${e.name}"`,i)})}catch(o){this.A.error(`Failed to dispose browser extension "${e.name}"`,o)}}},hPn=class{constructor(e){this._instance=e}initialize(){}get(e){const n=this._instance.persistence;if(typeof e=="string")return n?.get_property(e);const o={};for(const i of e){const r=n?.get_property(i);Eo(r)||(o[i]=r)}return o}set(e,n){var o;(o=this._instance.persistence)===null||o===void 0||o.register(typeof e=="string"?{[e]:n}:e)}remove(e){var n;(n=this._instance.persistence)===null||n===void 0||n.unregister(e)}};const Ult="extensionsRemoteConfig";var mPn=class{constructor(e){this.instance=e,this.To=!1,this.A=li,this.cu=e.hu,this.kv=new hPn(e),this.onEvent=n=>soe(this.instance.on("eventCaptured",o=>{try{n({event:o.event,properties:o.properties})}catch(i){this.A.error("Browser extension event listener failed",i)}})),this.onRemoteConfig=n=>{if(this.To)return soe(()=>{});const o=r=>{try{n(r)}catch(s){this.A.error("Browser extension remote config listener failed",s)}},i=this.instance.du.on(Ult,o);return this.cu&&o(this.cu),soe(i)},this.vu=new dPn(li.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property(dxe);return typeof e=="string"?e:void 0}get library(){return{name:Xp.LIB_NAME,version:Xp.LIB_VERSION}}get initialPersonProperties(){var e,n;return(e=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,n,o,i;const r=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=r?.sessionId)!==null&&n!==void 0?n:"",windowId:(o=r?.windowId)!==null&&o!==void 0?o:"",sessionStartTimestamp:(i=r?.sessionStartTimestamp)!==null&&i!==void 0?i:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.vu.add(e)}getExtension(e){return this.vu.getExtension(e)}capture(e,n,o){o?this.instance.capture(e,n,{timestamp:o.timestamp,uuid:o.uuid,$set:o.set,$set_once:o.setOnce}):this.instance.capture(e,n)}registerDynamicEventProperties(e){return soe(this.instance.fu(e))}handleRemoteConfig(e){this.To||(this.cu=e,this.instance.du.emit(Ult,e))}sendRequest(e){var n=this;return $g(function*(o,i={}){var r;const s=n.instance.requestRouter.endpointFor((r=i.target)!==null&&r!==void 0?r:"api",o),a={method:i.method,url:i.query?Zz(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:i.target==="flags"&&i.compression==="best-available"?H2e.Base64:void 0,timestampMode:i.sentAt};return i.transport==="sendBeacon"?(n.instance._send_request(a),{statusCode:202}):new Promise(A=>{a.callback=A,n.instance._send_request(a)})}).apply(this,arguments)}dispose(){this.To||(this.To=!0,this.vu.dispose())}};const eV={};let l3e=0;const tV=()=>{},Klt='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',_F="Surveys module not available",zlt="sanitize_properties is deprecated. Use before_send instead",Vlt="Invalid value for property_denylist config: ",pPn=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],_Pn=["$feature_flag_called","$$heatmap","$snapshot"],Jlt=t=>t.charAt(0)==="$"&&!jr(_Pn,t),fPn=/^[A-Za-z0-9_-]{1,400}$/,Wlt=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,jlt=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,IPn=["token","distinct_id",rct],nV="posthog",CPn=t=>{const e={};return t&&t!=="unset"&&("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0)),e},g3e=t=>{var e;return Zt({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:mwn(qo?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:tV,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_replay_sync_fetch:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:qg&&$a(qg?.search)&&qg.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_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(jn==null||(e=jn.location)===null||e===void 0?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,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,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(n){li.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:mct,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:tV},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:Kxe,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:CPn(n),external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n),cookieWinsOnConflict:!(!n||n==="unset"||"2026-08-29">n)}))(t))},yPn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],qlt=t=>{const e={};for(const[i,r]of yPn)Eo(t[i])||(e[r]=t[i]);const n=Xg({},e,t),o=t.__preview_external_dependency_versioned_paths;return Eo(o)||(Eo(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),$a(o)&&Eo(t.asset_host)&&(n.asset_host=o)),qr(t.property_blacklist)&&(Eo(t.property_denylist)?n.property_denylist=t.property_blacklist:qr(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:li.error(Vlt+t.property_denylist)),n};var xPn=class{constructor(){this.__forceAllowLocalhost=!1}get pu(){return this.__forceAllowLocalhost}set pu(e){li.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},oV=class WM{gu(e){if(!e)return;const n=this.lu.indexOf(e);n!==-1&&this.lu.splice(n,1)}mu(e,n){var o;return this.gu(e),this.lu.push(n),(o=n.initialize)===null||o===void 0||o.call(n),n}yu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}bu(){if(this._u||this.config.reuseAnonymousId||this.config.segment||this.yu())return;const e=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!e&&!this.config.disable_persistence||this.wu)return;let n,o,i;e?(n=`persistence is set to '${this.config.persistence}'`,o=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(n="persistence is disabled (disable_persistence is true)",o="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._u=!0,console.warn("[PostHog.js]",`${n} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${o}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${i}`)}ku(){const e=this.persistence;if(!e||this.Su)return;if(this.yu())return void(this.config.cookieless_mode==="on_reject"&&this.get_distinct_id()!=="$posthog_cookieless"&&(this.xu(),this.$u()));if(this.get_distinct_id()!=="$posthog_cookieless")return;this.Cu()||e.load(!0);const n=this.get_distinct_id();if(!n||n==="$posthog_cookieless"){const o=this.config.get_device_id(tB());this.register({distinct_id:o,$device_id:o}),e.set_property(Dy,z8)}this.xu()}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.Tu=!1,this.Iu=!1,this.webPerformance=new xPn,this.Mu=!1,this.version=Xp.LIB_VERSION,this.Eu=new Set,this.Pu="",this.du=new coe,this.lu=[],this.Ru=[],this.Au=!1,this.wu=!1,this._u=!1,this.Su=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=g3e(),this.SentryIntegration=Nwn,this.sentryIntegration=o=>(function(i,r){const s=Jct(i,r);return{name:Vct,processEvent:a=>s(a)}})(this,o),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fu=!1,this.Ou=null,this.Du=null,this.Lu=null,this.scrollManager=new nPn(this),this.pageViewManager=new Wct(this),this.rateLimiter=new Uwn(this),this.requestRouter=new aPn(this),this.consent=new xwn(this),this.externalIntegrations=new uPn(this);const n=(e=WM.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(o,i,r)=>{const s=$a(o)?{[o]:i}:o;this.setPersonProperties(s),r?.({})},set_once:(o,i,r)=>{const s=$a(o)?{[o]:i}:o;this.setPersonProperties(void 0,s),r?.({})}},this.on("eventCaptured",o=>li.info(`send "${o?.event}"`,o))}init(e,n,o){if(o&&o!==nV){var i;const r=(i=eV[o])!==null&&i!==void 0?i:new WM;return r._init(e,n,o),eV[o]=r,eV[nV][o]=r,r}return this._init(e,n,o)}_init(e,n={},o){var i,r,s;const a=$a(e)?e.trim():"";if(!a)return li.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var A;if(this.__loaded)return a!==((A=this.config)===null||A===void 0?void 0:A.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=g3e(n.defaults),n.debug=this.Nu(n.debug),this.qu=n,this.ju=[],n.person_profiles?this.Du=n.person_profiles:n.process_person&&(this.Du=n.process_person);const c=g3e(n.defaults),l=qlt(n),g=Xg({},c,l,{name:o,token:a});Ea(c.rageclick)&&Ea(l.rageclick)&&(g.rageclick=Xg({},c.rageclick,l.rageclick)),Ea(c.session_recording)&&Ea(l.session_recording)&&(g.session_recording=Xg({},c.session_recording,l.session_recording)),this.set_config(g),this.config.on_xhr_error&&li.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:V3.GZipJS;const u=this.Cu(),h=!this.yu();if(this.persistence=new Wxe(this.config,u,!0,h),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Wxe(Zt(Zt({},this.config),{},{persistence:"sessionStorage"}),u,!1,h),this.Pu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!u&&eg.At()){const f=eg.Ft(this.Pu);qr(f)&&f.forEach(I=>{$a(I)&&this.Eu.add(I)})}else eg.Pt(this.Pu);const d=Zt({},this.persistence.props),m=Zt({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Bu=new Zwn((f,I)=>this.zu(f,I),this.config.request_queue_config),this.Hu=new tPn(this),this.__request_queue=[];const p=this.yu();p||(this.sessionManager=new Tlt(this),this.sessionPropsManager=new Nlt(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((f,I,C)=>{(C?.activityTimeout||C?.sessionPastMaximumLength||C?.crossTabAdoption)&&this.Uu()})),this.Wu(),this.config.__preview_deferred_init_extensions?(li.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Vu(p)},0)):(li.info("Initializing extensions synchronously"),this.Vu(p)),Xp.DEBUG=Xp.DEBUG||this.config.debug,Xp.DEBUG&&li.info("Starting in debug mode",{this:this,config:n,thisC:Zt({},this.config),p:d,s:m}),this.config.identity_distinct_id&&!(!((i=n.bootstrap)===null||i===void 0)&&i.distinctID)&&(n.bootstrap=Zt(Zt({},n.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const _=(r=n.bootstrap)===null||r===void 0?void 0:r.distinctID;if(this.wu=!!_&&!wz(_),(s=n.bootstrap)===null||s===void 0?void 0:s.distinctID){const f=n.bootstrap.distinctID,I=this.get_distinct_id(),C=this.persistence.get_property(Dy);if(n.bootstrap.isIdentifiedID&&I!=null&&I!==f&&C==="anonymous")this.identify(f);else if(n.bootstrap.isIdentifiedID&&I!=null&&I!==f&&C==="identified")li.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const y=this.config.get_device_id(tB()),x=n.bootstrap.isIdentifiedID?y:f;this.persistence.set_property(Dy,n.bootstrap.isIdentifiedID?$ne:z8),this.register({distinct_id:f,$device_id:x})}}if(p)this.register_once({distinct_id:bxe,$device_id:null},"");else if(!this.get_distinct_id()){const f=this.config.get_device_id(tB());this.register_once({distinct_id:f,$device_id:f},""),this.persistence.set_property(Dy,z8)}return Wc(jn,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Wc(jn,"pageshow",()=>{var f;this.Tu=!1,this.Iu||(f=this.Hu)===null||f===void 0||f.resume()}),n.segment?zct(this,()=>this.Gu()):this.Gu(),ap(this.config._onCapture)&&this.config._onCapture!==tV&&(li.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",f=>this.config._onCapture(f.event,f))),this.config.ip&&li.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return Flt.apply(this,arguments)})().then(f=>{f&&this.register({[hxe]:f})}).catch(tV),this}Qu(e){const n=e;return $a(n.name)&&ap(n.setup)}Zu(e,n){this.Qu(e)?n.push(()=>{this.Ju().add(e).catch(()=>{var o;return(o=e.dispose)===null||o===void 0?void 0:o.call(e)}).catch(o=>{li.error(`Failed to dispose browser extension "${e.name}"`,o)})}):this.lu.push(e)}Wu(){var e,n,o;const i=(e=(n=this.config.__extensionClasses)===null||n===void 0?void 0:n.featureFlags)!==null&&e!==void 0?e:(o=WM.__defaultExtensionClasses)===null||o===void 0?void 0:o.featureFlags;var r,s,a;i&&(this.featureFlags&&this.featureFlags instanceof i||((r=this.Ku)===null||r===void 0||r.call(this),this.Ku=void 0,this.featureFlags=new i(this)),ap(this.featureFlags.onReloading)&&ap(this.featureFlags.setup)?this.Ku||(this.Ku=this.featureFlags.onReloading(()=>{this.du.emit("featureFlagsReloading",!0)}),this.Ju().add(this.featureFlags)):(s=(a=this.featureFlags).initialize)===null||s===void 0||s.call(a))}Vu(e){const n=performance.now(),o=Zt(Zt({},WM.__defaultExtensionClasses),this.config.__extensionClasses),i=[];var r,s,a,A,c,l,g,u;o.exceptions&&this.lu.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new o.exceptions(this)),o.historyAutocapture&&this.lu.push(this.historyAutocapture=new o.historyAutocapture(this)),o.tracingHeaders&&this.lu.push(this.tracingHeaders=new o.tracingHeaders(this)),o.siteApps&&this.lu.push(this.siteApps=new o.siteApps(this)),o.sessionRecording&&!e&&this.lu.push(this.sessionRecording=new o.sessionRecording(this)),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),o.autocapture&&this.Zu(this.autocapture=new o.autocapture(this),i),o.surveys&&this.Zu(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new o.surveys(this),i),o.logs&&this.Zu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new o.logs(this),i),o.metrics&&this.lu.push(this.metrics=(A=this.metrics)!==null&&A!==void 0?A:new o.metrics(this)),o.conversations&&this.lu.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new o.conversations(this)),o.productTours&&this.lu.push(this.productTours=new o.productTours(this)),o.heatmaps&&this.lu.push(this.heatmaps=new o.heatmaps(this)),o.webVitalsAutocapture&&this.lu.push(this.webVitalsAutocapture=new o.webVitalsAutocapture(this)),o.exceptionObserver&&this.lu.push(this.exceptionObserver=new o.exceptionObserver(this)),o.deadClicksAutocapture&&this.lu.push(this.deadClicksAutocapture=new o.deadClicksAutocapture(this,Dwn)),o.toolbar&&this.lu.push(this.toolbar=(l=this.toolbar)!==null&&l!==void 0?l:new o.toolbar(this)),o.experiments&&this.lu.push(this.experiments=(g=this.experiments)!==null&&g!==void 0?g:new o.experiments(this)),o.webMCP&&this.lu.push(this.webMCP=(u=this.webMCP)!==null&&u!==void 0?u:new o.webMCP(this)),this.lu.forEach(h=>{h.initialize&&i.push(()=>{var d;(d=h.initialize)===null||d===void 0||d.call(h)})}),i.push(()=>{if(this.Xu){const h=this.Xu;this.Xu=void 0,this.lu.forEach(d=>{var m;return(m=d.onRemoteConfig)===null||m===void 0?void 0:m.call(d,h)})}}),this.Yu(i,n)}Yu(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout(()=>{this.Yu(e,n)},0);const i=e.shift();if(i)try{i()}catch(r){li.error("Error initializing extension:",r)}}const o=Math.round(performance.now()-n);this.register_for_session({[sct]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[act]:o}),this.config.__preview_deferred_init_extensions&&li.info(`PostHog extensions initialized (${o}ms)`)}el(e){var n;if(!qo||!qo.body)return li.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.el(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Xu=e),this.hu=e,this.compression=void 0,e.ok){var o;const i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=jr(i.supportedCompression,V3.GZipJS)?V3.GZipJS:jr(i.supportedCompression,V3.Base64)?V3.Base64:void 0),!((o=i.analytics)===null||o===void 0)&&o.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.Du?this.Du:mct}),(n=this.tc)===null||n===void 0||n.handleRemoteConfig(e),this.lu.forEach(i=>{var r;return(r=i.onRemoteConfig)===null||r===void 0?void 0:r.call(i,e)})}Gu(){try{this.config.loaded(this)}catch(e){li.critical("`loaded` function failed",e)}if(this.ec(),this.config.internal_or_test_user_hostname&&qg?.hostname){const e=qg.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?e===n:n.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.yu())&&this.nc()},1),this.sc=new glt(this),this.sc.load()}ec(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Bu)===null||e===void 0||e.enable())}_dom_loaded(){this.is_capturing()&&iF(this.__request_queue,e=>this.zu(e)),this.__request_queue=[],this.ec()}_handle_unload(){var e,n,o,i,r,s;this.Tu=!0,(e=this.surveys)===null||e===void 0||(n=e.handlePageUnload)===null||n===void 0||n.call(e),(o=this.metrics)===null||o===void 0||o.flush("sendBeacon"),this.config.request_batching?(this.rc()&&this.capture(pct),(i=this.logs)===null||i===void 0||i.flushLogs("sendBeacon"),(r=this.Bu)===null||r===void 0||r.unload(),(s=this.Hu)===null||s===void 0||s.unload()):this.rc()&&this.capture(pct,null,{transport:"sendBeacon"})}_send_request(e){Dlt(this,e)}zu(e,n){this.Hu?this.Hu.retriableRequest(e,n):this._send_request(n?Zt(Zt({},e),{},{transport:n}):e)}_execute_array(e){l3e++;try{let n;const o=[],i=[],r=[];iF(e,a=>{if(a)if(n=a[0],qr(n))r.push(a);else if(ap(a))try{a.call(this)}catch(A){li.error("Error executing queued PostHog call",a,A)}else qr(a)&&n==="alias"?o.push(a):qr(a)&&n.indexOf("capture")!==-1&&ap(this[n])?r.push(a):i.push(a)});const s=function(a,A){iF(a,function(c){try{if(qr(c[0])){let l=A;pl(c,function(g){l=l[g[0]].apply(l,g.slice(1))})}else A[c[0]].apply(A,c.slice(1))}catch(l){li.error("Error executing queued PostHog call",c,l)}})};s(o,this),s(i,this),s(r,this)}finally{l3e--}}push(e){if(l3e>0&&qr(e)&&$a(e[0])){const n=WM.prototype[e[0]];return void(ap(n)&&n.apply(this,e.slice(1)))}this._execute_array([e])}get oc(){return{property:VAt,persistenceKey:tF,cookieName:"_fbc",pattern:Wlt,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[tF]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(tF)}}}get ac(){return{property:JAt,persistenceKey:Lz,cookieName:"_fbp",pattern:jlt,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[Lz]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(Lz)}}}lc(e){var n;const o=(n=this.persistence)===null||n===void 0?void 0:n.get_property(e.persistenceKey);return $a(o)&&e.pattern.test(o)?{value:o,delivered:!1}:Ea(o)&&$a(o.value)&&e.pattern.test(o.value)?{value:o.value,delivered:o.delivered===!0}:void 0}uc(e,n,o){return n===o?.value?{value:n,pending:!o.delivered}:(e.register(n,!1),{value:n,pending:!0})}cc(e){if(!this.config.save_campaign_params||this.yu())return;const n=Gz(e.cookieName);return $a(n)&&e.pattern.test(n)?n:void 0}hc(e,n,o,i){if(!this.persistence)return;const r=this.oc;this.persistence.refreshKey(r.persistenceKey);const s=this.lc(r);if(i)return void r.unregister();if(o)return $a(n)&&Wlt.test(n)?this.uc(r,n,s):void r.unregister();const a=$a(e)&&fPn.test(e)?e:void 0,A=this.cc(r);return A&&((c,l,g)=>{const u=c.split(".");if(l)return u[3]===l;if(!g)return!0;const h=g.value.split(".");return u[3]===h[3]||Number(u[2])>Number(h[2])})(A,a,s)?this.uc(r,A,s):a?s?.value.split(".")[3]===a?{value:s.value,pending:!s.delivered}:this.uc(r,`fb.1.${Date.now()}.${a}`,s):s?{value:s.value,pending:!s.delivered}:void 0}dc(e,n,o){if(!this.persistence)return;const i=this.ac;this.persistence.refreshKey(i.persistenceKey);const r=this.lc(i);if(o)return void i.unregister();if(n)return $a(e)&&jlt.test(e)?this.uc(i,e,r):void i.unregister();const s=this.cc(i);return s?this.uc(i,s,r):r?{value:r.value,pending:!r.delivered}:void 0}vc(e,n){if(!this.persistence)return;this.persistence.refreshKey(e.persistenceKey);const o=this.lc(e);o?.value!==n||o.delivered||e.register(n,!0)}capture(e,n,o){var i,r;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Bu))return void li.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Eo(e)||!$a(e))return void li.error("No event name provided to posthog.capture");if(this.ku(),e==="$snapshot"&&this.yu())return;const s=!this.config.opt_out_useragent_filter&&this._is_bot();if(s&&!this.config.__preview_capture_bot_pageviews)return;const a=o?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a?.isRateLimited)return void li.critical("This capture call is ignored due to client rate limiting.");let A;n?.$current_url&&!$a(n?.$current_url)&&(li.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),e!=="$exception"||o?.fc||li.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(A=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();const c=new Date,l=o?.timestamp||c,g=rAt(o?.uuid,tB);let u={uuid:g,event:e,properties:this.calculateEventProperties(e,n||{},l,g)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&s&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),a&&(u.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);const h=e==="$feature_flag_called"&&u.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;o?.$set&&!h&&(u.$set=o?.$set);const d=Ea(n?.$set)?n.$set:void 0,m=qr(n?.$unset)?n.$unset:[],p=o?.$unset||[],_=R=>{var F;const O=!!o?.$set&&R in o.$set;return{hasProvided:O||!!d&&R in d,provided:O?o==null||(F=o.$set)===null||F===void 0?void 0:F[R]:d?.[R],unset:m.indexOf(R)!==-1||p.indexOf(R)!==-1}},f=_(VAt),I=_(JAt),C=[{channel:this.oc,hasProvided:f.hasProvided,update:this.hc(A?.fbclid,f.provided,f.hasProvided,f.unset)},{channel:this.ac,hasProvided:I.hasProvided,update:this.dc(I.provided,I.hasProvided,I.unset)}];for(const{channel:R,hasProvided:F,update:O}of C)O&&u.properties.$process_person_profile===!0&&O.pending&&!F&&!h&&(u.$set=Zt({[R.property]:O.value},u.$set));const y=o?.$unset;y&&(u.$unset=y);const x=h?void 0:this.gc(o?.$set_once,e!==fct,e===_ct);if(x&&(u.$set_once=x),o?._noTruncate||(E=this.config.properties_string_max_length,u=(function(R,F){const O=new Set;return(function U(Y,j){if(Y!==Object(Y))return F?F(Y):Y;if(O.has(Y))return;let Z;if(O.add(Y),qr(Y))Z=[],iF(Y,J=>{Z.push(U(J))});else{const J={};pl(Xk(Y)?Ict(Y):Y,(X,te)=>{O.has(X)||(J[te]=U(X))}),Z=J}return Z})(R)})(u,R=>$a(R)?R.slice(0,E):R)),u.timestamp=l,Eo(o?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=c),h&&(u.properties=((R,F=[])=>{const O={},U=Y=>{R[Y]!==void 0&&(O[Y]=R[Y])};return cvn.forEach(U),F.forEach(U),O})(u.properties,IPn)),e===J3.DISMISSED||e===J3.SENT){const R=n?.[qxe.SURVEY_ID],F=n?.[qxe.SURVEY_ITERATION];Ylt({id:R,current_iteration:F}),u.$set=Zt(Zt({},u.$set),{},{[iPn({id:R,current_iteration:F},e===J3.SENT?"responded":"dismissed")]:!0})}else e===J3.SHOWN&&(u.$set=Zt(Zt({},u.$set),{},{[qxe.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var E;if(e===Ywn.SHOWN){const R=n?.[clt.TOUR_TYPE];R&&(u.$set=Zt(Zt({},u.$set),{},{[`${clt.TOUR_LAST_SEEN_DATE}/${R}`]:new Date().toISOString()}))}const B=Zt(Zt({},u.properties.$set),u.$set);if(px(B)||this.setPersonPropertiesForFlags(B),!Fs(this.config.before_send)){const R=this.Os(u);if(!R)return;u=R,u.uuid=rAt(u.uuid,tB)}this.sessionRecording&&!this.Au&&Jlt(e)&&(this.Au=!0,setTimeout(()=>this.Au=!1,3e4));const S=C.filter(({channel:R,update:F})=>{var O,U,Y;const j=(O=(U=u.$set)===null||U===void 0?void 0:U[R.property])!==null&&O!==void 0?O:Ea((Y=u.properties)===null||Y===void 0?void 0:Y.$set)?u.properties.$set[R.property]:void 0;return F?.pending&&j===F.value});this.du.emit("eventCaptured",u);const Q=(i=o?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),w=o?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(Q),M=Zt(Zt(Zt({method:"POST",url:Q,data:u,compression:"best-available",preferSyncCompression:o?.send_instantly,timestampMode:w?"body":"capture-body",batchKey:o?._batchKey},w&&(!((r=u.properties)===null||r===void 0)&&r.$session_id)?{batchGroup:u.properties.$session_id+(u.properties.$window_id?`-${u.properties.$window_id}`:"")}:{}),o?.transport?{transport:o.transport}:{}),S.length?{fireCallbackOnDrop:!0,callback:R=>{if(R.statusCode>=200&&300>R.statusCode)for(const{channel:F,update:O}of S)this.vc(F,O.value)}}:{});if(!this.config.request_batching||o&&!o?._batchKey||o?.send_instantly){var T;let R;!M.transport&&!M.callback&&px((T=this.config.request_headers)!==null&&T!==void 0?T:{})&&this.Tu&&(R="sendBeacon"),this.zu(M,R)}else this.Bu.enqueue(M);return u}_addCaptureHook(e){return this.on("eventCaptured",n=>e(n.event,n))}getExtension(e){var n;return(n=this.tc)===null||n===void 0?void 0:n.getExtension(e)}Ju(){var e;return(e=this.tc)!==null&&e!==void 0?e:this.tc=new mPn(this)}fu(e){this.Ru.push(e);let n=!0;return()=>{if(!n)return;n=!1;const o=this.Ru.indexOf(e);o!==-1&&this.Ru.splice(o,1)}}mc(e=!0){var n,o,i;return!!(!((n=this.persistence)===null||n===void 0)&&n.consumeCookieIdentityChange())&&(this.Lu=null,this.persistence.get_property("$user_state")==="anonymous"&&((i=this.sessionPersistence)===null||i===void 0||i.clear(),this.Eu.clear(),this.yc()),(o=this.featureFlags)===null||o===void 0||o.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,n,o,i,r){if(o=o||new Date,!this.persistence||!this.sessionPersistence)return n;this.ku(),this.persistence.syncCookieProperties(),this.mc();const s=r?void 0:this.persistence.remove_event_timer(e);let a=Zt({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.yu()&&(a[rct]=!0),e==="$snapshot"){const f=Zt(Zt({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=f.distinct_id,(!$a(a.distinct_id)&&!eh(a.distinct_id)||wz(a.distinct_id))&&li.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}const A=(function(f,I,C,y=!1){var x,E,B,S;if(!Py)return{};const Q=f?[...uF,...I||[]]:[],[w,M]=eAt(Py),[T,R]=(function(ae){for(let ie=0;nAt.length>ie;ie++){const[le,he,Ce]=nAt[ie],ce=ae.match(le);if(ce){const _e=Ce&&ae.match(Ce)||ce;return[he,_e?.[1]||""]}}return["",""]})(Py),F=(function(){const ae="u">typeof navigator?navigator:void 0;return ae?.brave?{brave:!0}:{}})(),O={};Eo(C)||(O.detectGoogleSearchApp=C);const U={},Y=(x=navigator)===null||x===void 0||(x=x.userAgentData)===null||x===void 0?void 0:x.platform,j=(E=navigator)===null||E===void 0?void 0:E.maxTouchPoints,Z=jn==null||(B=jn.screen)===null||B===void 0?void 0:B.width,J=jn==null||(S=jn.screen)===null||S===void 0?void 0:S.height,X=jn?.devicePixelRatio;Eo(Y)||(U.userAgentDataPlatform=Y),Eo(j)||(U.maxTouchPoints=j),Eo(Z)||(U.screenWidth=Z),Eo(J)||(U.screenHeight=J),Eo(X)||(U.devicePixelRatio=X);const te=Xg(Pxe({$os:w,$os_version:M,$browser:Xat(Py,navigator.vendor,F,O),$webview_app:T,$webview_app_version:R,$device:tAt(Py),$device_type:MQn(Py,U),$timezone:jct(),$timezone_offset:Hwn()}),{$current_url:Jz(y?MQ(qg?.href):qg?.href,Q,Wz),$host:qg?.host,$pathname:qg?.pathname,$raw_user_agent:Py.length>1e3?Py.substring(0,997)+"...":Py,$browser_version:PQn(Py,navigator.vendor,F,O),$browser_language:nlt(),$browser_language_prefix:Lwn(),$screen_height:jn?.screen.height,$screen_width:jn?.screen.width,$viewport_height:jn?.innerHeight,$viewport_width:jn?.innerWidth,$lib:Y8.LIB_NAME,$lib_version:Y8.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Y8.SDK_DIST_CHANNEL&&(te.$sdk_dist_channel=Y8.SDK_DIST_CHANNEL),te})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:f,windowId:I}=this.sessionManager.checkAndGetSessionAndWindowId(r,o.getTime(),!0);a.$session_id=f,a.$window_id=I}this.sessionPropsManager&&Xg(a,this.sessionPropsManager.getSessionProps());try{var c;if(this.sessionRecording){const f=this.sessionRecording.sdkDebugProperties,I=!this.Au&&Jlt(e);for(const C in f)(I||jr(pPn,C))&&(a[C]=f[C])}a.$sdk_debug_retry_queue_size=(c=this.Hu)===null||c===void 0?void 0:c.length}catch(f){a.$sdk_debug_error_capturing_properties=String(f)}let l;if(this.requestRouter.region===c3e&&(a.$lib_custom_api_host=this.config.api_host),l=e!=="$pageview"||r?e!=="$pageleave"||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(o):this.pageViewManager.doPageView(o,i),a=Xg(a,l),e==="$pageview"&&qo&&(a.title=qo.title),!Eo(s)){const f=o.getTime()-s;a.$duration=parseFloat((f/1e3).toFixed(3))}Py&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");const g=this.persistence.properties(),u=this.sessionPersistence.properties(),h=a.$groups,d=g.$groups;Ea(h)&&!px(h)&&(a.$groups=Zt(Zt({},Ea(d)?d:{}),h)),pl(["$referrer","$referring_domain"],f=>{f in g&&delete u[f]});const m={};if(this.Ru.length>0)for(const f of this.Ru.slice())try{Xg(m,f())}catch(I){li.error("Failed to produce browser extension event properties",I)}a=Xg({},A,g,u,Zt(Zt({},m),a)),a.$is_identified=this._isIdentified(),qr(this.config.property_denylist)?pl(this.config.property_denylist,function(f){delete a[f]}):li.error(Vlt+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const p=this.config.sanitize_properties;p&&(li.error(zlt),a=p(a,e));const _=this.bc();return a.$process_person_profile=_,_&&!r&&this._c("_calculate_event_properties"),a}gc(e,n=!0,o=!1){var i;if(!this.persistence||!this.bc()||this.Mu&&!o)return e;const r=this.persistence.get_initial_props(),s=(i=this.sessionPropsManager)===null||i===void 0?void 0:i.getSetOnceProps();let a=Xg({},r,s||{},e||{});const A=this.config.sanitize_properties;return A&&(li.error(zlt),a=A(a,"$set_once")),n&&(this.Mu=!0),px(a)?void 0:a}register(e,n){var o;(o=this.persistence)===null||o===void 0||o.register(e,n)}register_once(e,n,o){var i;(i=this.persistence)===null||i===void 0||i.register_once(e,n,o)}register_for_session(e){var n,o;(n=this.persistence)===null||n===void 0||n.syncCookieProperties(),this.mc(),(o=this.sessionPersistence)===null||o===void 0||o.register(e),Object.keys(e).forEach(i=>this.Eu.add(i)),this.yc()}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),this.Eu.delete(e),this.yc()}wc(e,n){this.register({[e]:n})}Uu(){this.Eu.forEach(e=>{var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(e)}),this.Eu.clear(),this.yc()}yc(){var e;if(!this.Pu)return;if(this.config.persistence==="memory"||!((e=this.sessionPersistence)===null||e===void 0)&&e.hi||!eg.At())return void eg.Pt(this.Pu);const n=[];this.Eu.forEach(o=>n.push(o)),n.length>0?eg.$t(this.Pu,n):eg.Pt(this.Pu)}getFeatureFlag(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlagResult(e,n)}getAllFeatureFlags(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,n){var o,i;return(o=(i=this.featureFlags)===null||i===void 0?void 0:i.isFeatureEnabled(e,n))!==null&&o!==void 0?o:n?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)===null||e===void 0||e.reloadFeatureFlags()}updateFlags(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateFlags(e,n,o)}updateEarlyAccessFeatureEnrollment(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateEarlyAccessFeatureEnrollment(e,n,o)}getEarlyAccessFeatures(e,n=!1,o){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getEarlyAccessFeatures(e,n,o)}on(e,n){return this.du.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:_F}),()=>{})}onSessionId(e){var n,o;return(n=(o=this.sessionManager)===null||o===void 0?void 0:o.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n=!1){this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:_F})}getActiveMatchingSurveys(e,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:_F})}onActiveMatchingSurveysChanged(e){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(e):(e([],{isLoaded:!1,error:_F}),()=>{})}renderSurvey(e,n){var o;(o=this.surveys)===null||o===void 0||o.renderSurvey(e,n)}displaySurvey(e,n=cPn){var o;(o=this.surveys)===null||o===void 0||o.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)===null||n===void 0||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,o;return(n=(o=this.surveys)===null||o===void 0?void 0:o.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:_F}}canRenderSurveyAsync(e,n=!1){var o,i;return(o=(i=this.surveys)===null||i===void 0?void 0:i.canRenderSurveyAsync(e,n))!==null&&o!==void 0?o:Promise.resolve({visible:!1,disabledReason:_F})}kc(e){return!e||wz(e)?(li.critical("Unique user id has not been set in posthog.identify"),!1):e==="$posthog_cookieless"?(li.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(li.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(e,n,o){if(!this.__loaded||!this.persistence)return li.uninitializedWarning("posthog.identify");if(eh(e)&&(e=e.toString(),li.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.kc(e)||!this._c("posthog.identify"))return;this.ku();const i=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,s=this.mc(!1),a=this.persistence.Oa();let A=!1;try{const l=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property("__alias")&&(this.unregister(jne),this.register({distinct_id:e}));const g=(this.persistence.get_property("$user_state")||"anonymous")===z8,u=e!==l,h=!u&&g;if(u&&g){var c;const d=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:l};this.persistence.set_property(Dy,$ne),this.setPersonPropertiesForFlags({$set:n||{},$set_once:o||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$identify",d,{$set:n||{},$set_once:o||{}})&&(this.Lu=A3e(e,n,o)),(c=this.featureFlags)===null||c===void 0||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(h){this.persistence.set_property(Dy,$ne);const d=n||{},m=o||{};this.setPersonPropertiesForFlags({$set:d,$set_once:m},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$set",{$set:d,$set_once:m})&&(this.Lu=A3e(e,n,o))}else(n||o)&&this.setPersonProperties(n,o);u||r||s?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(TQ)):h&&(n||o)&&this.reloadFeatureFlags(),A=!0}finally{a&&this.persistence.qa(A)}}setPersonProperties(e,n){if(!e&&!n||!this._c("posthog.setPersonProperties"))return;const o=A3e(this.get_distinct_id(),e,n);this.Lu!==o?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:n||{}},!0),this.capture("$set",{$set:e||{},$set_once:n||{}})&&(this.Lu=o)):li.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var n;const o=(qr(e)?e:[e]).filter(i=>$a(i)&&i.length>0);o.length!==0&&this._c("posthog.unsetPersonProperties")&&((n=this.featureFlags)===null||n===void 0||n.unsetPersonPropertiesForFlags(o,!0),this.capture("$set",{$unset:o}),this.Lu=null)}group(e,n,o){var i;if(!e||!n)return void li.error("posthog.group requires a group type and group key");(i=this.persistence)===null||i===void 0||i.syncCookieProperties(),this.mc();const r=this.getGroups(),s=r[e]!==n;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:Zt(Zt({},r),{},{[e]:n})}),(s||o)&&this.bc()){const a={$group_type:e,$group_key:n};o&&(a.$group_set=o),this.capture(fct,a)}o&&this.setGroupPropertiesForFlags({[e]:o}),s&&!o&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n=!0){var o;(o=this.featureFlags)===null||o===void 0||o.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(e=!0){var n;(n=this.featureFlags)===null||n===void 0||n.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,n=!0){var o;this._c("posthog.setGroupPropertiesForFlags")&&((o=this.featureFlags)===null||o===void 0||o.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)===null||n===void 0||n.resetGroupPropertiesForFlags(e)}reset(e){const n=My(e)?e:e?.resetDeviceID,o=My(e)||e==null?void 0:e.bootstrap;this.Sc(n,!1,o)}Sc(e,n=!1,o){var i,r,s,a,A,c;if(li.info("reset"),!this.__loaded)return li.uninitializedWarning("posthog.reset");const l=o?.sessionID;this.config.bootstrap=o||((i=this.qu)===null||i===void 0?void 0:i.bootstrap)||{},(r=this.featureFlags)===null||r===void 0||(s=r.updateConfig)===null||s===void 0||s.call(r,this.config,this.il());const g=this.get_property(dxe),u=this.get_property(hxe),h=this.get_property(Hz);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();const d=this.is_capturing();n||this.consent.reset(),n||!d||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const m=(A=this.persistence)===null||A===void 0||(c=A.Oa)===null||c===void 0?void 0:c.call(A),p=this.Su;this.Su=p||n;let _=!1;try{var f,I,C,y,x,E,B,S,Q,w,M,T,R;if((f=this.persistence)===null||f===void 0||f.clear(),(I=this.sessionPersistence)===null||I===void 0||I.clear(),this.Eu.clear(),this.yc(),Eo(h)||(w=this.persistence)===null||w===void 0||w.register({$session_recording_remote_config:h}),(C=this.surveys)===null||C===void 0||C.reset(),(y=this.featureFlags)===null||y===void 0||y.reset(),(x=this.conversations)===null||x===void 0||x.reset(),(E=this.logs)===null||E===void 0||E.reset(),(B=this.metrics)===null||B===void 0||B.reset(),(S=this.persistence)===null||S===void 0||S.set_property("$user_state","anonymous"),(Q=this.sessionManager)===null||Q===void 0||Q.resetSessionId(),this.Lu=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:bxe,$device_id:null},"");else{const U=this.config.get_device_id(tB());this.register_once({distinct_id:U,$device_id:e?U:g},""),e||Eo(u)||this.register({[hxe]:u})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),o&&(o.distinctID&&!this.yu()&&((R=this.persistence)===null||R===void 0||R.set_property("$user_state",o.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.distinctID})),(M=this.featureFlags)===null||M===void 0||M.initialize(),!Fs(l)&&!(!((T=this.sessionManager)===null||T===void 0)&&T.setBootstrapSessionId(l,!0)))){const U=Zt({},o);delete U.sessionID,this.config.bootstrap=U}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0}finally{var F,O;this.Su=p,m&&((F=this.persistence)===null||F===void 0||(O=F.qa)===null||O===void 0||O.call(F,_))}this.reloadFeatureFlags()}shutdown(e){var n=this;return $g(function*(){var o,i,r,s,a,A,c,l;if(n.__loaded){n.Iu=!0,n.Ju().dispose(),(o=n.sessionRecording)===null||o===void 0||o.dispose(),(i=n.logs)===null||i===void 0||i.flushLogs("sendBeacon"),(r=n.metrics)===null||r===void 0||r.flush("sendBeacon"),(s=n.metrics)===null||s===void 0||s.dispose(),(a=n.Bu)===null||a===void 0||a.unload(),(A=n.Hu)===null||A===void 0||A.unload();try{var g;(g=n.featureFlags)===null||g===void 0||g.destroy()}catch(u){li.error("Error while destroying feature flags",u)}(c=n.persistence)===null||c===void 0||c.destroy(),(l=n.sessionPersistence)===null||l===void 0||l.destroy()}else li.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,n){var o;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=n,this.alias(e),(o=this.conversations)===null||o===void 0||o.xc()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(e=this.conversations)===null||e===void 0||e.$c()}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"";const{sessionId:n,sessionStartTimestamp:o}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let i=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${n}`);if(e?.withTimestamp&&o){var r;const s=(r=e.timestampLookBack)!==null&&r!==void 0?r:10;if(!o)return i;i+=`?t=${Math.max(Math.floor((new Date().getTime()-o)/1e3)-s,0)}`}return i}alias(e,n){return e===this.get_property("$people_distinct_id")?(li.critical("Attempting to create alias for existing People user - aborting."),-2):this._c("posthog.alias")?(Eo(n)&&(n=this.get_distinct_id()),e!==n?(this.wc(jne,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(li.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const n=Zt({},this.config);if(Ea(e)){var o,i,r,s,a,A,c,l,g,u,h,d,m,p;Xg(this.config,qlt(e));const y=this.Cu();if(this.persistence){const E=this.config.persistence==="sessionStorage"||this.config.persistence==="memory";var _,f;if(E&&this.sessionPersistence!==this.persistence&&((_=this.sessionPersistence)===null||_===void 0||_.remove(),(f=this.sessionPersistence)===null||f===void 0||f.destroy()),this.persistence.update_config(this.config,n,y),E)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new Wxe(Zt(Zt({},this.config),{},{persistence:"sessionStorage"}),y,!1);else{var I;(I=this.sessionPersistence)===null||I===void 0||I.update_config(Zt(Zt({},this.config),{},{persistence:"sessionStorage"}),Zt(Zt({},n),{},{persistence:"sessionStorage"}),y)}}const x=this.Nu(this.config.debug);var C;My(x)&&(this.config.debug=x),My(this.config.debug)&&(this.config.debug?(Xp.DEBUG=!0,uc.At()&&uc.$t("ph_debug",!0),li.info("set_config",{config:e,oldConfig:n,newConfig:Zt({},this.config)})):(Xp.DEBUG=!1,uc.At()&&uc.Pt("ph_debug"))),(o=this.featureFlags)===null||o===void 0||(i=o.updateConfig)===null||i===void 0||i.call(o,this.config,this.il()),(r=this.exceptionObserver)===null||r===void 0||r.onConfigChange(),(s=this.exceptions)===null||s===void 0||s.onConfigChange(),(a=this.metrics)===null||a===void 0||a.onConfigChange(),(A=this.webMCP)===null||A===void 0||A.startIfEnabled(),(c=this.sessionRecording)===null||c===void 0||c.startIfEnabledOrStop(),(l=this.tracingHeaders)===null||l===void 0||l.startIfEnabledOrStop(),(g=this.autocapture)===null||g===void 0||g.startIfEnabled(),(u=this.heatmaps)===null||u===void 0||u.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&((C=this.historyAutocapture)===null||C===void 0||C.startIfEnabledOrStop()),(h=this.exceptionObserver)===null||h===void 0||h.startIfEnabledOrStop(),(d=this.deadClicksAutocapture)===null||d===void 0||d.startIfEnabledOrStop(),(m=this.surveys)===null||m===void 0||m.loadIfEnabled(),this.xu(),(p=this.externalIntegrations)===null||p===void 0||p.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&zct(this,tV,!1)}}_overrideSDKInfo(e,n){Xp.LIB_NAME=e,Xp.LIB_VERSION=n}startSessionRecording(e){const n=e===!0,o={sampling:n||!!e?.sampling,linked_flag:n||!!e?.linked_flag,url_trigger:n||!!e?.url_trigger,event_trigger:n||!!e?.event_trigger};var i,r,s,a,A;Object.values(o).some(Boolean)&&((i=this.sessionManager)===null||i===void 0||i.checkAndGetSessionAndWindowId(),o.sampling&&((r=this.sessionRecording)===null||r===void 0||r.overrideSampling()),o.linked_flag&&((s=this.sessionRecording)===null||s===void 0||s.overrideLinkedFlag()),o.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),o.event_trigger&&((A=this.sessionRecording)===null||A===void 0||A.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){try{if(!this.exceptions)return;const o=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(Zt(Zt({},o),n))}catch{return}}addExceptionStep(e,n){var o;(o=this.exceptions)===null||o===void 0||o.addExceptionStep(e,n)}captureLog(e){var n;(n=this.logs)===null||n===void 0||n.captureLog(e)}get logger(){var e,n;return(e=(n=this.logs)===null||n===void 0?void 0:n.logger)!==null&&e!==void 0?e:WM.Cc}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,o;return(n=(o=this.toolbar)===null||o===void 0?void 0:o.loadToolbar(e))!==null&&n!==void 0&&n}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;let n=(e=this.config.name)!==null&&e!==void 0?e:nV;return n!==nV&&(n="posthog."+n),n}_isIdentified(){var e,n;return((e=this.persistence)===null||e===void 0?void 0:e.get_property("$user_state"))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property("$user_state"))==="identified"}bc(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&px(this.getGroups())&&!(!((e=this.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e.__alias)&&!(!((n=this.persistence)===null||n===void 0||(n=n.props)===null||n===void 0)&&n.$epp))}rc(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.bc()||this._c("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._c("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_c(e){return this.config.person_profiles==="never"?(li.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.bu(),this.wc(Bxe,!0),!0)}Cu(){if(this.config.cookieless_mode==="always")return!0;const e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}xu(){var e,n;const o=this.Cu();var i,r,s;return this.is_capturing()||(i=this.logs)===null||i===void 0||i.Tc(),((e=this.persistence)===null||e===void 0?void 0:e.hi)!==o&&((r=this.persistence)===null||r===void 0||r.set_disabled(o)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.hi)!==o&&((s=this.sessionPersistence)===null||s===void 0||s.set_disabled(o)),this.yc(),o}opt_in_capturing(e){var n;if(this.config.cookieless_mode!=="always"){if(this.yu()){var o,i,r,s,a,A;(o=this.sessionRecording)===null||o===void 0||o.dispose({discardBufferedEvents:!0}),this.Sc(!0,!0),(i=this.sessionManager)===null||i===void 0||i.destroy(),(r=this.pageViewManager)===null||r===void 0||r.destroy(),this.sessionManager=new Tlt(this),this.pageViewManager=new Wct(this),this.persistence&&(this.sessionPropsManager=new Nlt(this,this.sessionManager,this.persistence));const h=(s=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&s!==void 0?s:(A=WM.__defaultExtensionClasses)===null||A===void 0?void 0:A.sessionRecording;var c,l;h&&(this.sessionRecording=this.mu(this.sessionRecording,new h(this)),this.hu&&((c=this.sessionRecording)===null||c===void 0||(l=c.onRemoteConfig)===null||l===void 0||l.call(c,this.hu)))}var g,u;this.consent.optInOut(!0),this.xu(),this.ec(),(n=this.sessionRecording)===null||n===void 0||n.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((g=this.surveys)===null||g===void 0||g.loadIfEnabled()),(Eo(e?.captureEventName)||e?.captureEventName)&&this.capture((u=e?.captureEventName)!==null&&u!==void 0?u:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.nc()}else li.warn(Klt)}opt_out_capturing(){this.config.cookieless_mode!=="always"?(this.consent.optInOut(!1),this.xu(),this.config.cookieless_mode==="on_reject"&&this.$u()):li.warn(Klt)}$u(){var e,n;const o=this.sessionRecording;o?.dispose({discardBufferedEvents:!0}),this.get_distinct_id()!=="$posthog_cookieless"&&this.Sc(!0,!0),this.register({distinct_id:bxe,$device_id:null}),this.gu(o),this.sessionRecording=void 0,(e=this.sessionManager)===null||e===void 0||e.destroy(),(n=this.pageViewManager)===null||n===void 0||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.nc(),this.ec()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return!this.Su&&(this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing()))}clear_opt_in_out_capturing(){this.consent.reset(),this.xu()}_is_bot(){return X_?klt(X_,this.config.custom_blocked_useragents):void 0}nc(){qo&&(qo.visibilityState==="visible"?this.Fu||(this.Fu=!0,this.capture(wxe,{title:qo.title},{send_instantly:!0}),this.Ou&&(qo.removeEventListener(Fz,this.Ou),this.Ou=null)):this.Ou||(this.Ou=this.nc.bind(this),Wc(qo,Fz,this.Ou)))}debug(e){e===!1?(jn?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(jn?.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)`."),this.set_config({debug:!0}))}il(){const e=this.qu||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(li.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(n,o,i,r,s){const a=o in n&&!Fs(n[o]),A=i in n&&!Fs(n[i]);return a?n[o]:!!A&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${o}' instead. The old field will be removed in a future major version.`),n[i])})(e,"advanced_disable_flags","advanced_disable_decide",0,li)}Os(e){var n;if(Fs(this.config.before_send))return e;const o=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(IQn),i=qr(this.config.before_send)?this.config.before_send:[this.config.before_send];let r=e;for(const s of i)try{if(r=s(r),Fs(r)){const a=`Event '${e.event}' was rejected in beforeSend function`;return fQn(e.event)?li.warn(`${a}. This can cause unexpected behavior.`):li.info(a),null}r.properties&&!px(r.properties)||li.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return li.error(`Error in beforeSend function for event '${e.event}':`,a),null}for(const s of o)if(r.properties&&Fs(r.properties[s]))return li.warn(`Event '${e.event}' had its '${s}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){var e;return(e=this.pageViewManager.Wo)===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,o){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(o)})}Nu(e){const n=My(e)&&!e,o=uc.At()&&uc.Ot("ph_debug")==="true";return!n&&(!!o||e)}};oV.__defaultExtensionClasses={},oV.Cc=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),(function(t,e){for(let n=0;e.length>n;n++)t.prototype[e[n]]=dwn(t.prototype[e[n]])})(oV,["identify"]);var $lt=class{constructor(e){this.disabled=e===!1;const n=Ea(e)?e:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(e,n,o){if(this.disabled)return!1;const i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(n-i.y)<this.thresholdPx&&this.timeoutMs>o-i.timestamp){if(this.clicks.push({x:e,y:n,timestamp:o}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:o}];return!1}};const u3e="$copy_autocapture",d3e=gd("[AutoCapture]");function h3e(t,e){return e.length>t?e.slice(0,t)+"...":e}function EPn(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do e=e.previousSibling;while(e&&!nB(e));return e}function BPn(t,{e,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:i,elementsChainAsString:r,disableCaptureUrlHashes:s}){var a,A;if(!nB(t))return{props:{}};const c=[t],l=new Set([t]);let g=t;for(;g.parentNode&&!gI(g,"body")&&1e3>c.length;){if(Lxe(g.parentNode)){const x=g.parentNode.host;if(l.has(x))break;l.add(x),c.push(x),g=x;continue}if(!nB(g.parentNode)||l.has(g.parentNode))break;l.add(g.parentNode),c.push(g.parentNode),g=g.parentNode}const u=e.type==="click"&&t.namespaceURI==="http://www.w3.org/2000/svg"?c.findIndex(x=>gI(x,"button")||gI(x,"a")):-1;u>0&&(o=o||c.slice(0,u+1).some(x=>!sD(x)||AF(x)));const h=[],d={};let m,p=!1,_=!1;if(pl(c,x=>{const E=sD(x);if(gI(x,"a")&&!n&&!i?.includes("href")){const B=x.getAttribute("href");p=!!(E&&B&&cF(B))&&(s?MQ(B):B)}jr(aF(x),"ph-no-capture")&&(_=!0),h.push((function(B,S,Q,w,M=!1){const T=B.tagName.toLowerCase(),R={tag_name:T};Oxe.indexOf(T)>-1&&!Q&&(R.$el_text=T.toLowerCase()==="a"||T.toLowerCase()==="button"?h3e(1024,Gct(B)):h3e(1024,Uz(B)));const F=aF(B);S||w?.includes("class")||0>=F.length||(R.classes=F.filter(function(j){return j!==""})),pl(B.attributes,function(j){var Z;if((!AF(B)||["name","id","class","aria-label"].indexOf(j.name)!==-1)&&!w?.includes(j.name)&&!S&&cF(j.value)&&(!$a(Z=j.name)||Z.substring(0,10)!=="_ngcontent"&&Z.substring(0,7)!=="_nghost")){let J=j.value;j.name==="class"&&(J=Hxe(J).join(" ")),R["attr__"+j.name]=h3e(1024,j.name==="href"&&M?MQ(J):J)}});let O=1,U=1,Y=B;for(;Y=EPn(Y);)O++,Y.tagName===B.tagName&&U++;return R.nth_child=O,R.nth_of_type=U,R})(x,n,o,i,s)),pl((function(B){if(!sD(B))return{};const S={};return pl(B.attributes,function(Q){if(Q.name&&Q.name.indexOf("data-ph-capture-attribute")===0){const w=Q.name.replace("data-ph-capture-attribute-",""),M=Q.value;w&&M&&cF(M)&&(S[w]=M)}}),S})(x),(B,S)=>{({}).hasOwnProperty.call(d,S)||(d[S]=B)})}),_)return{props:{},explicitNoCapture:_};if(u>0&&(t=c[u],h.splice(0,u)),o||(h[0].$el_text=gI(t,"a")||gI(t,"button")?Gct(t):Uz(t)),p){var f,I;h[0].attr__href=p;const x=(f=V8(p))===null||f===void 0?void 0:f.host,E=jn==null||(I=jn.location)===null||I===void 0?void 0:I.host;x&&E&&x!==E&&(m=p)}return{props:Xg((y=e.type,{$event_type:y,$ce_version:1}),r?{}:{$elements:h},{$elements_chain:(C=h,qr(C)?(function(x){return x.map(E=>{var B,S;let Q="";if(E.tag_name&&(Q+=E.tag_name),E.attr_class){E.attr_class.sort();for(const T of E.attr_class)Q+=`.${T.replace(/"/g,"")}`}const w=Zt(Zt(Zt(Zt({},E.text?{text:E.text}:{}),{},{"nth-child":(B=E.nth_child)!==null&&B!==void 0?B:0,"nth-of-type":(S=E.nth_of_type)!==null&&S!==void 0?S:0},E.href?{href:E.href}:{}),E.attr_id?{attr_id:E.attr_id}:{}),E.attributes),M={};return Zne(w).sort(([T],[R])=>(function(F,O){return O>F?-1:F>O?1:0})(T,R)).forEach(([T,R])=>M[Uct(T.toString())]=Uct(R.toString())),Q+=":",Q+=Zne(M).map(([T,R])=>`${T}="${R}"`).join(""),Q}).join(";")})((function(x){return x.map(E=>{var B,S;const Q={text:(B=E.$el_text)===null||B===void 0?void 0:B.slice(0,400),tag_name:E.tag_name,href:(S=E.attr__href)===null||S===void 0?void 0:S.slice(0,2048),attr_class:Pwn(E),attr_id:E.attr__id,nth_child:E.nth_child,nth_of_type:E.nth_of_type,attributes:{}};return Zne(E).filter(([w])=>w.indexOf("attr__")===0).forEach(([w,M])=>Q.attributes[w]=M),Q})})(C)):"")},!((a=h[0])===null||a===void 0)&&a.$el_text?{$el_text:(A=h[0])===null||A===void 0?void 0:A.$el_text}:{},m&&e.type==="click"?{$external_click_url:m}:{},d),target:t};var C,y}var bPn=class{do(){this.vo=void 0,clearTimeout(this.fo),this.fo=void 0}po(e){var n;if(!sD(e))return!0;const o=(n=this.mo().css_selector_ignorelist)!==null&&n!==void 0?n:Uxe,i=new Set;let r=e;for(;r;){if(i.size>=1e3||i.has(r))return!0;i.add(r);const s=r,a=aF(s);if(jr(a,"ph-no-capture")||jr(a,"ph-sensitive")||AF(s)||o.some(c=>Gxe(s,c)))return!0;const A=r.parentNode;r=Lxe(A)?A.host:A&&nB(A)?A:null}return!1}yo(e){if(!this.isEnabled||e.type==="pointercancel")return void this.do();if(e.type==="pointerdown"){this.do();const i=Kz(e);var n;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&nB(i)&&(this.vo={target:i,excluded:this.po(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(n=this.bo)===null||n===void 0?void 0:n.distinctId}))}const o=this.vo;o&&(e.pointerId!==o.id||Math.abs(e.clientX-o.x)>5||Math.abs(e.clientY-o.y)>5?this.do():e.type==="pointerup"&&(o.released=!0,this.fo=setTimeout(()=>this.do(),0)))}_o(e){var n;const o=this.vo;this.do();const i=Kz(e);if(o?.released&&o.target.isConnected&&o.distinctId===((n=this.bo)===null||n===void 0?void 0:n.distinctId)&&e.pointerId===o.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-o.x)&&5>=Math.abs(e.clientY-o.y)&&i&&(gI(i,"html")||gI(i,"body"))){var r;if(o.excluded)return null;const s=(r=this.mo().css_selector_ignorelist)!==null&&r!==void 0?r:Uxe;return[i,qo?.documentElement,qo?.body].some(a=>{if(!a)return!1;const A=aF(a);return jr(A,"ph-no-capture")||jr(A,"ph-sensitive")||!sD(a)||AF(a)||s.some(c=>Gxe(a,c))})?null:o.target}}constructor(e){this.wo=e,this.name="autocapture",this.ko=!1,this.So=null,this.xo=!1,this.$o=new Map,this.Co=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.To=!1,this.wo.refresh(this.Mr),this.rageclicks=new $lt(this.Mr.rageclick),this.Io=null}setup(e){this.Mo(),this.bo=e;const n=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.To?n.dispose():(this.Eo=n,this.startIfEnabled())}dispose(){var e;this.To||(this.To=!0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.$o.clear(),this.Io=null,this.Po())}mo(){return this.wo.refresh(this.Mr),this.Mr}Mo(){var e,n;return this.mo(),this.Mr.url_allowlist=(e=this.Mr.url_allowlist)===null||e===void 0?void 0:e.map(o=>new RegExp(o)),this.Mr.url_ignorelist=(n=this.Mr.url_ignorelist)===null||n===void 0?void 0:n.map(o=>new RegExp(o)),this.Mr}Ro(){if(!this.isBrowserSupported())return void d3e.info("Disabling Automatic Event Collection because this browser is not supported");if(!jn||!qo)return;const e=this.Ao=n=>{n=n||jn?.event;try{if(n.type==="blur")return void this.do();if(n.type.indexOf("pointer")===0)return void this.yo(n);const o=n.type==="click"?this._o(n):void 0;if(ld(o))return;this.Fo(n,"$autocapture",o)}catch(o){d3e.error("Failed to capture event",o)}};if(Wc(jn,"blur",e),Wc(qo,"submit",e,{capture:!0}),Wc(qo,"change",e,{capture:!0}),Wc(qo,"click",e,{capture:!0}),pl(["pointerdown","pointermove","pointerup","pointercancel"],n=>{Wc(qo,n,e,{capture:!0})}),this.mo().capture_copied_text){const n=this.Oo=o=>{o=o||jn?.event;try{this.Fo(o,u3e)}catch(i){d3e.error("Failed to capture clipboard event",i)}};Wc(qo,"copy",n,{capture:!0}),Wc(qo,"cut",n,{capture:!0}),Wc(qo,"paste",n,{capture:!0})}}Po(){this.do(),this.Ao&&(jn?.removeEventListener("blur",this.Ao),pl(["pointerdown","pointermove","pointerup","pointercancel"],e=>{qo?.removeEventListener(e,this.Ao,!0)}),qo?.removeEventListener("submit",this.Ao,!0),qo?.removeEventListener("change",this.Ao,!0),qo?.removeEventListener("click",this.Ao,!0),this.Ao=void 0),this.Oo&&(qo?.removeEventListener("copy",this.Oo,!0),qo?.removeEventListener("cut",this.Oo,!0),qo?.removeEventListener("paste",this.Oo,!0),this.Oo=void 0),this.ko=!1}startIfEnabled(){this.isEnabled||this.do(),!this.To&&this.bo&&this.isEnabled&&!this.ko&&(this.Ro(),this.ko=!0)}onRemoteConfig(e){if(this.To)return;if(this.xo=!0,!e.ok)return void this.startIfEnabled();const n=e.config;n.elementsChainAsString&&(this.Co=n.elementsChainAsString);const o=n.autocapture_opt_out;var i;My(o)&&((i=this.bo)===null||i===void 0||i.kv.set("$autocapture_disabled_server_side",o),this.So=o),this.startIfEnabled()}setElementSelectors(e,n=this){if(this.To)return;e.size?this.$o.set(n,new Set(e)):this.$o.delete(n);const o=new Set;this.$o.forEach(i=>{i.forEach(r=>o.add(r))}),this.Io=o}getElementSelectors(e,n){var o;const i=[];return(o=this.Io)===null||o===void 0||o.forEach(r=>{const s=qo?.querySelectorAll(r);s?.forEach(a=>{e!==a&&n!==a||jr(i,r)||i.push(r)})}),i}get isEnabled(){var e,n;if(this.To)return!1;const o=(e=this.bo)===null||e===void 0?void 0:e.kv.get(WAt),i=this.So,r=this.mo();if(!r.remoteRequestsDisabled&&!this.xo)return!1;const s=r.remoteRequestsDisabled&&!this.xo;if(ld(i)&&!My(o)&&!s)return!1;const a=(n=this.So)!==null&&n!==void 0?n:!!o;return!!r.enabled&&!a}Fo(e,n="$autocapture",o){if(!this.isEnabled)return void this.do();let i=o||Kz(e);Qct(i)&&(i=i.parentNode||null);const r=this.Mo();var s;n==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&r.rageclick&&(!((s=this.rageclicks)===null||s===void 0)&&s.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&Tct(i,r.rageclick)&&this.Fo(e,"$rageclick",o);const a=n===u3e,A=a?Zt(Zt({},r),{},{dom_event_allowlist:void 0}):r;if(i&&(function(u,h,d,m,p,_){var f;if(!jn||Vxe(u)||d?.url_allowlist&&!vct(d.url_allowlist,_)||d?.url_ignorelist&&vct(d.url_ignorelist,_))return!1;if(d?.dom_event_allowlist){const x=d.dom_event_allowlist;if(x&&!x.some(E=>h.type===E))return!1}const{parentIsUsefulElement:I,targetElementList:C}=kct(u,m);if(!(function(x,E){const B=E?.element_allowlist;if(Eo(B))return!0;for(const S of x)if(B.some(Q=>S.tagName.toLowerCase()===Q))return!0;return!1})(C,d)||!Yxe(C,d?.css_selector_allowlist)||Yxe(C,(f=d?.css_selector_ignorelist)!==null&&f!==void 0?f:Uxe))return!1;try{const x=jn.getComputedStyle(u);if(x&&x.getPropertyValue("cursor")==="pointer"&&h.type==="click")return!0}catch{}const y=u.tagName.toLowerCase();switch(y){case"html":return!1;case"form":return(p||["submit"]).indexOf(h.type)>=0;case"input":case"select":case"textarea":return(p||["change","click"]).indexOf(h.type)>=0;default:return I?(p||["click"]).indexOf(h.type)>=0:(p||["click"]).indexOf(h.type)>=0&&(Oxe.indexOf(y)>-1||u.getAttribute("contenteditable")==="true")}})(i,e,A,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var c;const{props:u,explicitNoCapture:h,target:d}=BPn(i,{e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.Co,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(h)return!1;const m=this.getElementSelectors(i,d);if(m&&m.length>0&&(u.$element_selectors=m),n===u3e){const p=e.type||"clipboard";if(p!=="paste"){var l,g;const _=jn==null||(l=jn.getSelection())===null||l===void 0?void 0:l.toString(),f=wct(_);if(!f)return!1;u.$selected_content=f,u.$clipboard_text_length=(g=_?.length)!==null&&g!==void 0?g:0}u.$copy_type=p}return(c=this.bo)===null||c===void 0||c.capture(n,u),!0}}isBrowserSupported(){return ap(qo?.querySelectorAll)}},SPn=class{constructor(e){this._instance=e}refresh(e){const n=this._instance.config,o=Ea(n.autocapture)?n.autocapture:void 0;e.enabled=!!n.autocapture,e.rageclick=n.rageclick,e.maskAllElementAttributes=n.mask_all_element_attributes,e.maskAllText=n.mask_all_text,e.disableCaptureUrlHashes=n.disable_capture_url_hashes,e.getCurrentUrl=n.get_current_url,e.remoteRequestsDisabled=this._instance.il(),e.url_allowlist=o?.url_allowlist,e.url_ignorelist=o?.url_ignorelist,e.dom_event_allowlist=o?.dom_event_allowlist,e.element_allowlist=o?.element_allowlist,e.css_selector_allowlist=o?.css_selector_allowlist,e.css_selector_ignorelist=o?.css_selector_ignorelist,e.element_attribute_ignorelist=o?.element_attribute_ignorelist,e.capture_copied_text=o?.capture_copied_text}};const iV=gd("[ExceptionAutocapture]"),Xlt=()=>{},Zlt=t=>{var e;if(ap(t))return(e=t.__posthog_layer__)!==null&&e!==void 0?e:t.__rrweb_layer__};function fF(t,e,n){try{if(!(e in t))return Xlt;const o={next:t[e]},i=n(function(...r){return o.next.apply(this,r)});return ap(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:o}})),t[e]=i,()=>{if(t[e]===i)return void(t[e]=o.next);let r=t[e],s=Zlt(r);for(;s;){if(s.next===i)return void(s.next=o.next);r=s.next,s=Zlt(r)}}}catch{return Xlt}}const QPn=gd("[TracingHeaders]"),AD=gd("[Web Vitals]"),e0t=9e5,t0t=["CLS","FCP","INP","LCP"],vPn=["INP","LCP"],wPn=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],m3e="disabled",n0t="lazy_loading",j8=gd("[SessionRecording]"),PPn=[Sxe,Qxe,Act,cct,lct,gct,uct,dct,hct],MPn=gd("[Heatmaps]");function p3e(t){return Ea(t)&&"clientX"in t&&"clientY"in t&&eh(t.clientX)&&eh(t.clientY)}const uoe=gd("[Product Tours]"),_3e=t=>{var e;return!t.config.disable_product_tours&&!!(!((e=t.persistence)===null||e===void 0)&&e.get_property(yxe))},DPn=["$set_once","$set"],J9=gd("[SiteApps]"),o0t="Error while initializing PostHog app with config id ",i0t=(t,e)=>t?.then?t.then(e):e(t),IF="SDK is not enabled or survey functionality is not yet loaded",r0t="Disabled. Not loading surveys.";var NPn=class{constructor(e,n){this.wo=e,this.Ic=n,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Mc=!1,this.Ec=!1,this.Pc=[],this.Rc=[],this.Ac=null,this.Fc=null,this.To=!1,this.Oc=new Set,this.onRemoteConfig=o=>{if(this.To||this.Mr.disableSurveys)return;if(!o.ok)return this.Ec=!0,this.Dc({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),_l.warn("Remote config unavailable. Not loading surveys.");const i=o.config.surveys;if(Fs(i))return _l.warn("Flags not loaded yet. Not loading surveys.");this.Lc=My(i)?i:i.length>0,_l.info(`flags response received, isSurveysEnabled: ${this.Lc}`),this.loadIfEnabled()},this.Dc=o=>{this.Rc.slice().forEach(i=>this.Nc(i,o))}}setup(e){if(!this.To)return this.qc=e,i0t(e.kv.initialize(),()=>{if(this.qc!==e||this.To)return;this.qc=void 0,this.bo=e;const n=e.onRemoteConfig(this.onRemoteConfig);this.To?n.dispose():(this.Eo=n,this.loadIfEnabled())})}dispose(){var e,n,o,i,r;this.To||(this.To=!0,this.qc=void 0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,(n=this._surveyEventReceiver)===null||n===void 0||n.dispose(),this._surveyEventReceiver=null,(o=this._surveyManager)===null||o===void 0||(i=o.dispose)===null||i===void 0||i.call(o),this._surveyManager=null,this.Pc=[],this.Rc.forEach(s=>{s.active=!1}),this.Rc=[],(r=this.jc)===null||r===void 0||r.call(this),this.jc=void 0,this.Ac=null,this.Oc.forEach(s=>clearTimeout(s)),this.Oc.clear())}get Mr(){return this.wo.get()}initialize(){this.loadIfEnabled()}reset(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.clearInMemoryInProgressSurveyState)===null||n===void 0||n.call(e);try{var o;(o=this._surveyEventReceiver)===null||o===void 0||o.reset(),localStorage.removeItem("lastSeenSurveyDate");const i=[];for(let r=0;r<localStorage.length;r++){const s=localStorage.key(r);(s?.startsWith("seenSurvey_")||s?.startsWith("inProgressSurvey_"))&&i.push(s)}i.forEach(r=>localStorage.removeItem(r))}catch{}this.Dc()}loadIfEnabled(){if(this.To||!this.bo)return;const e=this.Mr;if(this._surveyManager)return;if(this.Mc)return void _l.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void _l.info(r0t);if(e.cookielessMode&&this.wo.isOptedOut())return void _l.info("Not loading surveys in cookieless mode without consent.");const n=this.wo.getExtensions();if(!n)return void this.Bc("PostHog Extensions not found.");if(Eo(this.Lc)&&!e.advancedEnableSurveys)return;const o=this.Lc||e.advancedEnableSurveys;this.Mc=!0,this.Ec=!1;try{const i=n.generateSurveys;if(i)return this.zc(i,o),void(this.Mc=!1);const r=n.loadExternalDependency;if(!r)return this.Bc(vxe),void(this.Mc=!1);r(s=>{try{if(this.To)return;const a=this.wo.getExtensions();s||!a?.generateSurveys?this.Bc("Could not load surveys script",s):this.zc(a.generateSurveys,o)}finally{this.Mc=!1}})}catch(i){throw this.Mc=!1,this.Bc("Error initializing surveys",i),i}}zc(e,n){var o,i;if(this.To)return;this._surveyManager=e(n),this._surveyEventReceiver=this.wo.createEventReceiver(this.Dc);const r=(o=(i=this.bo)!==null&&i!==void 0?i:this.Ic)===null||o===void 0?void 0:o.kv.get(Oz);r&&this.Hc(r),_l.info("Surveys loaded successfully"),this.Uc(),this.Dc(),this.Wc({isLoaded:!0})}Bc(e,n){this.Ec=!0,_l.error(e,n),this.Dc({isLoaded:!1,error:e}),this.Wc({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Pc.push(e),this._surveyManager&&this.Wc({isLoaded:!0}),()=>{this.Pc=this.Pc.filter(n=>n!==e)}}getSurveys(e,n=!1){var o;const i=(o=this.bo)!==null&&o!==void 0?o:this.Ic;if(!i||this.To)return;if(this.Mr.disableSurveys)return _l.info(r0t),e([]);const r=i.kv.get(Oz);if(r&&!n)return e(r,{isLoaded:!0}),void(this.Vc()&&this.getSurveys(()=>{},!0));if(this.Ac)return void this.Ac.then(({surveys:A,context:c})=>{this.To||e(A,c)}).catch(A=>_l.error("Error in survey callback",A));const s=this.Gc("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(A=>{try{return this.Qc(i,A)}catch(c){return _l.error("Error processing surveys response",c),this.Qc(i,{statusCode:0,error:c})}},A=>this.Qc(i,{statusCode:0,error:A}));this.Ac=s;const a=()=>{this.Ac===s&&(this.Ac=null)};s.then(A=>{a(),this.To||(this.Dc(A.context),e(A.surveys,A.context))},a).catch(A=>_l.error("Error in survey callback",A))}Gc(e,n){const o=this.bo;return o?o.sendRequest(e,n):new Promise(i=>i({statusCode:0,error:new Error(IF)}))}Qc(e,n){if(this.To)return{surveys:[],context:{isLoaded:!1,error:IF}};const o=n.statusCode;if(o!==200||!n.json){const r=`Surveys API could not be loaded, status: ${o}`;return o!==0?_l.error(r):n.error||_l.warn(r),this.Fc=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Fc=null;const i=n.json.surveys||[];return e.kv.set({[Oz]:i,[qne]:Date.now()}),this.Hc(i),{surveys:i,context:{isLoaded:!0}}}Hc(e){var n;const o=e.filter(i=>(function(r){return!(!r.start_date||r.end_date)})(i)&&(Llt(i)||(function(r){var s;return!!(!((s=r.conditions)===null||s===void 0||(s=s.actions)===null||s===void 0||(s=s.values)===null||s===void 0)&&s.length)})(i)));(n=this._surveyEventReceiver)===null||n===void 0||n.replace(o)}Vc(){return this.Zc()&&!this.Ac&&!this.Jc()}Zc(){var e,n;const o=(e=(n=this.bo)!==null&&n!==void 0?n:this.Ic)===null||e===void 0?void 0:e.kv.get(qne);return eh(o)&&Date.now()-o>3e5}Jc(){return eh(this.Fc)&&3e5>Date.now()-this.Fc}markSurveyAsSeen(e,n){var o;const i={id:e,current_iteration:(o=n?.iteration)!==null&&o!==void 0?o:null};Ylt(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this.Dc()}Wc(e){for(const n of this.Pc)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(o){_l.error("Error in survey callback",o)}}getActiveMatchingSurveys(e,n=!1){if(!Fs(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);_l.warn("init was not called")}onActiveMatchingSurveysChanged(e){var n,o;if(this.To)return()=>{};const i={callback:e,active:!0,revision:0};this.Rc.push(i),this.Uc();const r=(n=(o=this.bo)!==null&&o!==void 0?o:this.Ic)===null||n===void 0?void 0:n.kv.get(Oz);return this.Mr.disableSurveys||!this._surveyManager&&this.Ec&&!this.Mc||!r&&!Fs(this.Fc)&&!this.Ac?this.Nc(i,{isLoaded:!1}):this._surveyManager&&this.Nc(i),()=>{var s;i.active=!1,this.Rc=this.Rc.filter(a=>a!==i),this.Rc.length===0&&((s=this.jc)===null||s===void 0||s.call(this),this.jc=void 0)}}Uc(){var e,n,o;this._surveyManager&&this.Rc.length>0&&((e=this.jc)!==null&&e!==void 0||(this.jc=(n=(o=this.wo).onMatchingConditionsChanged)===null||n===void 0?void 0:n.call(o,this.Dc)))}Nc(e,n){if(this.To||!e.active)return;const o=++e.revision,i=r=>{if(!this.To&&e.active&&o===e.revision)try{const s=n??{isLoaded:!0},a=JSON.stringify([r,s]);if(a===e.lastResult)return;e.lastResult=a,e.callback(r,s)}catch(s){_l.error("Error in active matching surveys callback",s)}};try{n&&!n.isLoaded?i([]):this.getActiveMatchingSurveys(i)}catch(r){_l.error("Error in active matching surveys callback",r)}}Kc(e){let n=null;return this.getSurveys(o=>{var i;n=(i=o.find(r=>r.id===e))!==null&&i!==void 0?i:null}),n}Xc(e){if(Fs(this._surveyManager))return{eligible:!1,reason:IF};const n=typeof e=="string"?this.Kc(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}Yc(e){if(!this.wo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(Fs(this._surveyManager))return{eligible:!1,reason:IF};const n=typeof e=="string"?this.Kc(e):e;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Fs(this._surveyManager))return _l.warn("init was not called"),{visible:!1,disabledReason:IF};const n=this.Yc(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return Fs(this._surveyManager)?(_l.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:IF})):new Promise(o=>{this.getSurveys(i=>{var r;const s=(r=i.find(a=>a.id===e))!==null&&r!==void 0?r:null;if(s){const a=this.Yc(s);o({visible:a.eligible,disabledReason:a.reason})}else o({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(e,n,o){var i;if(!this.wo.isCapturing())return;if(Fs(this._surveyManager))return void _l.warn("init was not called");const r=typeof e=="string"?this.Kc(e):e;if(!r?.id)return void _l.warn("Survey not found");if(!APn.includes(r.type))return void _l.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const s=qo?.querySelector(n);if(s){if(!((i=r.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds){_l.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const a=setTimeout(()=>{var A,c;this.Oc.delete(a),!this.To&&this.wo.isCapturing()&&(_l.info(`Rendering survey ${r.id} with delay of ${(A=r.appearance)===null||A===void 0?void 0:A.surveyPopupDelaySeconds} seconds`),(c=this._surveyManager)===null||c===void 0||c.renderSurvey(r,s,o),_l.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Oc.add(a)}this._surveyManager.renderSurvey(r,s,o)}else _l.warn("Survey element not found")}displaySurvey(e,n){var o;if(!this.wo.isCapturing())return;if(Fs(this._surveyManager))return void _l.warn("init was not called");const i=this.Kc(e);if(!i)return void _l.warn("Survey not found");let r=i;if(!((o=i.appearance)===null||o===void 0)&&o.surveyPopupDelaySeconds&&n.ignoreDelay&&(r=Zt(Zt({},i),{},{appearance:Zt(Zt({},i.appearance),{},{surveyPopupDelaySeconds:0})})),n.displayType!==$xe.Popover&&n.initialResponses&&_l.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){const s=this.Xc(i);if(!s.eligible)return void _l.warn("Survey is not eligible to be displayed: ",s.reason)}n.displayType!==$xe.Inline?this._surveyManager.handlePopoverSurvey(r,n):this.renderSurvey(r,n.selector,n.properties)}cancelPendingSurvey(e){Fs(this._surveyManager)?_l.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.handlePageUnload)===null||n===void 0||n.call(e)}};function CF(t,e,n){if(Fs(t))return!1;switch(n){case"exact":return t===e;case"contains":{const o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(o,"i").test(t)}case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}var RPn=class{constructor(e){this._instance=e,this.th=new Set,this.eh=new Set,this.ih=new coe,this.nh=(n,o)=>this.sh(n,o)&&this.rh(n,o)&&this.oh(n,o)&&this.ah(n,o),this.sh=(n,o)=>!o?.event||n?.event===o?.event}init(){var e,n;Eo((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.uh=(n=this._instance)===null||n===void 0?void 0:n._addCaptureHook((o,i)=>{this.on(o,i)}))}dispose(){var e,n;(e=this.uh)===null||e===void 0||e.call(this),this.uh=void 0,(n=this._instance)===null||n===void 0||(n=n.autocapture)===null||n===void 0||n.setElementSelectors(new Set,this),this.ih=new coe}register(e){var n,o;if(!Eo((n=this._instance)===null||n===void 0?void 0:n._addCaptureHook)&&(e.forEach(i=>{var r;this.th.add(i),(r=i.steps)===null||r===void 0||r.forEach(s=>{this.eh.add(s?.event||"")})}),(o=this._instance)===null||o===void 0?void 0:o.autocapture)){const i=new Set;this.th.forEach(r=>{var s;(s=r.steps)===null||s===void 0||s.forEach(a=>{a?.selector&&i.add(a.selector)})}),this._instance.autocapture.setElementSelectors(i,this)}}replace(e){this.th.clear(),this.eh.clear(),this.register(e)}on(e,n){n!=null&&e.length!=0&&(this.eh.has(e)||this.eh.has(n.event))&&this.th.forEach(o=>{this.hh(n,o)&&this.ih.emit("actionCaptured",o.name)})}dh(e){this.onAction("actionCaptured",n=>e(n))}hh(e,n){if(n?.steps==null)return!1;for(const o of n.steps)if(this.nh(e,o))return!0;return!1}onAction(e,n){return this.ih.on(e,n)}rh(e,n){if(n?.url){var o;const i=e==null||(o=e.properties)===null||o===void 0?void 0:o.$current_url;if(!i||typeof i!="string"||!CF(i,n.url,n.url_matching||"contains"))return!1}return!0}oh(e,n){return!!this.fh(e,n)&&!!this.ph(e,n)&&!!this.gh(e,n)}fh(e,n){var o;if(!n?.href)return!0;const i=this.mh(e);if(i.length>0)return i.some(s=>CF(s.href,n.href,n.href_matching||"exact"));const r=(e==null||(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)||"";return!!r&&CF((function(s){const a=s.match(/(?::|")href="(.*?)"/);return a?a[1]:""})(r),n.href,n.href_matching||"exact")}ph(e,n){var o;if(!n?.text)return!0;const i=this.mh(e);if(i.length>0)return i.some(c=>CF(c.text,n.text,n.text_matching||"exact")||CF(c.$el_text,n.text,n.text_matching||"exact"));const r=(e==null||(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)||"";return!!r&&(s=(function(c){const l=[],g=/(?::|")text="(.*?)"/g;let u;for(;!Fs(u=g.exec(c));)l.includes(u[1])||l.push(u[1]);return l})(r),a=n.text,A=n.text_matching||"exact",s.some(c=>CF(c,a,A)));var s,a,A}gh(e,n){var o,i;if(!n?.selector)return!0;const r=e==null||(o=e.properties)===null||o===void 0?void 0:o.$element_selectors;if(r?.includes(n.selector))return!0;const s=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";if(n.selector_regex&&s)try{return new RegExp(n.selector_regex).test(s)}catch{return!1}return!1}mh(e){var n;return(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements)==null?[]:e?.properties.$elements}ah(e,n){return!n?.properties||n.properties.length===0||Olt(n.properties.reduce((o,i)=>{const r=qr(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return o[i.key]={values:r,operator:i.operator||"exact"},o},{}),e?.properties)}},TPn=class{constructor(e,n){var o,i;this.yh=[],this._instance=e,this.bh=n,this._h=new Map,this.wh=new Map,this.kh=new Map,this.Sh=(o=this._instance)===null||o===void 0||(i=o.onSessionId)===null||i===void 0?void 0:i.call(o,r=>this.xh(r))}$h(e){return!1}Ch(){return null}Th(e){}Ih(){}Mh(e,n){return!!e&&Olt(e.propertyFilters,n?.properties)}Eh(e,n){const o=new Map;return e.forEach(i=>{var r;(r=i.conditions)===null||r===void 0||(r=r[n])===null||r===void 0||(r=r.values)===null||r===void 0||r.forEach(s=>{if(s?.name){const a=o.get(s.name)||[];a.push(i.id),o.set(s.name,a)}})}),o}Ph(e,n,o){const i=(o===jz.Activation?this._h:this.wh).get(e);let r=[];return this.Rh(s=>{r=s.filter(a=>i?.includes(a.id))}),r.filter(s=>{var a;const A=(a=s.conditions)===null||a===void 0||(a=a[o])===null||a===void 0||(a=a.values)===null||a===void 0?void 0:a.find(c=>c.name===e);return this.Mh(A,n)})}register(e){this.Ah(e,!1)}replace(e){this.Ah(e,!0)}Ah(e,n){var o;Eo((o=this._instance)===null||o===void 0?void 0:o._addCaptureHook)||(this.Fh(e,n),this.Oh(e,n))}Oh(e,n){const o=e.filter(s=>{var a;return(a=s.conditions)===null||a===void 0||(a=a.actions)===null||a===void 0||(a=a.values)===null||a===void 0?void 0:a.length});var i;if(n&&this.kh.clear(),o.length===0)return void(n&&((i=this.Dh)===null||i===void 0||i.replace([])));this.Dh||(this.Dh=new RPn(this._instance),this.Dh.init(),this.Dh.dh(s=>this.onAction(s)));const r=[];o.forEach(s=>{var a;(a=s.conditions)===null||a===void 0||(a=a.actions)===null||a===void 0||a.values.forEach(A=>{if(r.push(A),A.name){var c;const l=(c=this.kh.get(A.name))!==null&&c!==void 0?c:[];l.includes(s.id)||l.push(s.id),this.kh.set(A.name,l)}})}),n?this.Dh.replace(r):this.Dh.register(r)}Lh(e,n){n.forEach((o,i)=>{var r;const s=(r=e.get(i))!==null&&r!==void 0?r:[];o.forEach(a=>{s.includes(a)||s.push(a)}),e.set(i,s)})}Fh(e,n){var o,i;const r=e.filter(c=>{var l,g;return((l=c.conditions)===null||l===void 0?void 0:l.events)&&((g=c.conditions)===null||g===void 0||(g=g.events)===null||g===void 0||(g=g.values)===null||g===void 0?void 0:g.length)>0}),s=e.filter(c=>{var l,g;return((l=c.conditions)===null||l===void 0?void 0:l.cancelEvents)&&((g=c.conditions)===null||g===void 0||(g=g.cancelEvents)===null||g===void 0||(g=g.values)===null||g===void 0?void 0:g.length)>0}),a=this.Eh(e,jz.Activation),A=this.Eh(e,jz.Cancellation);n?(this._h=a,this.wh=A):(this.Lh(this._h,a),this.Lh(this.wh,A)),(r.length!==0||s.length!==0||e.some(c=>{var l;return(l=c.conditions)===null||l===void 0||(l=l.actions)===null||l===void 0||(l=l.values)===null||l===void 0?void 0:l.length}))&&((o=this.uh)!==null&&o!==void 0||(this.uh=(i=this._instance)===null||i===void 0?void 0:i._addCaptureHook((c,l)=>{this.onEvent(c,l)})))}onEvent(e,n){var o,i;const r=this.Nh(),s=(n==null||(o=n.properties)===null||o===void 0?void 0:o.$survey_id)||(n==null||(i=n.properties)===null||i===void 0?void 0:i.$product_tour_id);if(s&&this.getActivatedIds().includes(s)){const A=this.qh(e,s,n);if(A==="consume")return r.info("event consumed activated item, removing it",{event:e,itemId:s}),void this.jh([s]);if(A==="persist")return r.info("shown item promoted to persisted activation",{event:e,itemId:s}),this.Bh(s),void this.zh([s])}if(this.wh.has(e)){const A=this.Ph(e,n,jz.Cancellation);A.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:A.map(c=>c.id)}),this.jh(A.map(c=>c.id)),A.forEach(c=>this.Hh(c.id)))}if(!this._h.has(e))return;r.info("event name matched",{event:e,eventPayload:n,items:this._h.get(e)});const a=this.Ph(e,n,jz.Activation);this.Uh(a.map(A=>A.id))}onAction(e){this.kh.has(e)&&this.Uh(this.kh.get(e)||[])}Uh(e){var n,o;if(e.length===0)return;const i=!!(!((n=this._instance)===null||n===void 0||(o=n.get_session_id)===null||o===void 0)&&o.call(n)),r=[];for(const s of e)i&&this.$h(s)?this.Bh(s)&&this.Wh(s):r.push(s);r.length>0&&(this.yh=[...new Set([...this.yh,...r])]),this.Nh().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.Vh()}Bh(e){this.yh=this.yh.filter(o=>o!==e);const n=this.Gh();return!n.includes(e)&&(this.Qh([...n,e]),this.Zh(),!0)}jh(e){const n=new Set(e);this.yh=this.yh.filter(r=>!n.has(r));const o=this.Jh(),i=o.filter(r=>!n.has(r));i.length!==o.length&&(this.Qh(i),i.length===0&&this.Kh()),this.zh(e),this.Vh()}Vh(){try{var e;(e=this.bh)===null||e===void 0||e.call(this)}catch(n){this.Nh().error("Error while handling activated items change",n)}}Xh(){var e;const n=this.Ch();if(!n)return{};const o=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[n];return o&&typeof o=="object"?o:{}}Wh(e){if(!this.Ch())return;const n=this.Xh();this.Th(Zt(Zt({},n),{},{[e]:Date.now()}))}zh(e){if(!this.Ch())return;const n=this.Xh(),o={};let i=!1;for(const[r,s]of Object.entries(n))e.includes(r)?i=!0:o[r]=s;i&&(px(o)?this.Ih():this.Th(o))}Yh(){this.Ch()&&this.Ih()}getActivationTimestamp(e){if(!this.Gh().includes(e))return;const n=this.Xh()[e];return eh(n)?n:void 0}Jh(){var e;const n=this.td();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[n])||[]}Gh(){var e,n,o;const i=this.Jh();if(i.length===0)return[];const r=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.ed()],s=(n=this._instance)===null||n===void 0||(o=n.get_session_id)===null||o===void 0?void 0:o.call(n);return s&&r===s?i:[]}Zh(){var e,n;const o=(e=this._instance)===null||e===void 0||(n=e.get_session_id)===null||n===void 0?void 0:n.call(e);o&&this.nd(o)}Kh(){this.sd()}xh(e){var n;const o=(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0?void 0:n.props[this.ed()];if(o&&o!==e){const i=this.Jh(),r=this.Xh();i.length>0&&(this.Qh([]),i.filter(s=>eh(r[s])).forEach(s=>this.Hh(s))),this.Kh(),this.Yh(),i.length>0&&this.Vh()}}getActivatedIds(){return[...new Set([...this.Gh(),...this.yh])].filter(e=>!this.rd(e))}dispose(){var e,n,o;(e=this.Sh)===null||e===void 0||e.call(this),this.Sh=void 0,(n=this.uh)===null||n===void 0||n.call(this),this.uh=void 0,(o=this.Dh)===null||o===void 0||o.dispose(),this.Dh=void 0}reset(){this.yh=[],this.Jh().length>0&&this.Qh([]),this.Kh(),this.Yh(),this.Vh()}getEventToItemsMap(){return this._h}od(){return this.Dh}},kPn=class extends TPn{constructor(e,n){super(e,n)}td(){return ect}ed(){return tct}Ch(){return nct}Th(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated_timestamps:e})}Ih(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}$h(e){var n;let o;this.Rh(r=>{o=r.find(s=>s.id===e)});const i=o==null||(n=o.appearance)===null||n===void 0?void 0:n.surveyPopupDelaySeconds;return eh(i)&&i>0}ad(){return J3.SHOWN}Rh(e){var n;(n=this._instance)===null||n===void 0||n.getSurveys(e)}Hh(e){var n;(n=this._instance)===null||n===void 0||n.cancelPendingSurvey(e)}Nh(){return _l}Qh(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated:e})}nd(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated_session:e})}sd(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}rd(){return!1}qh(e,n,o){var i;if(e===J3.SENT&&(o==null||(i=o.properties)===null||i===void 0?void 0:i.$survey_completed)===!1)return"ignore";let r;return this.Rh(s=>{r=s.find(a=>a.id===n)}),!r||(function(s){var a;return Llt(s)&&!!(!((a=s.conditions)===null||a===void 0||(a=a.events)===null||a===void 0)&&a.repeatedActivation)||s.schedule==="always"})(r)?e===J3.SHOWN?"consume":"ignore":e===J3.SHOWN?"persist":e===J3.DISMISSED||e===J3.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},FPn=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const n={};for(const o of e){const i=this._instance.get_property(o);Eo(i)||(n[o]=i)}return n}set(e,n){this._instance.register(typeof e=="string"?{[e]:n}:e)}remove(e){typeof e!="string"?e.forEach(n=>this._instance.unregister(n)):this._instance.unregister(e)}},LPn=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=Yr?.__PosthogExtensions__;if(!e)return;const{generateSurveys:n,loadExternalDependency:o}=e;return{generateSurveys:n?i=>n(this._instance,i):void 0,loadExternalDependency:o?i=>o(this._instance,"surveys",i):void 0}}createEventReceiver(e){return new kPn(this._instance,e)}onMatchingConditionsChanged(e){const n=this._instance._addCaptureHook(s=>{s!=="$pageview"&&s!==J3.SHOWN&&s!==J3.DISMISSED&&s!==J3.SENT||e()}),o=()=>e();Wc(jn,"PHSurveyShown",o);let i=!1;const r=this._instance.onFeatureFlags(()=>{i&&e()});return i=!0,()=>{i=!1,n(),r(),jn?.removeEventListener("PHSurveyShown",o)}}};const HPn=jn?.location?noe(jn.location.hash,"__posthog")||noe(location.hash,"state"):null,s0t="_postHogToolbarParams",a0t=gd("[Toolbar]"),A0t=gd("[FeatureFlags]"),cD=gd("[FeatureFlags]",{debugEnabled:!0}),f3e=`" failed. Feature flags didn't load in time.`,OPn=[502,504],c0t=["click","keydown","wheel","touchstart","pointerdown"],l0t="connection_error",g0t=t=>{const e={};for(let n=0;t.length>n;n++)e[t[n]]=!0;return e},u0t=t=>{const e={};for(const[n,o]of Zne(t||{}))o&&(e[n]=o);return e};var GPn=class{constructor(e){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=A0t,this.ud={},this.hd={},this.dd=[],this.vd=new Set,this.fd=new Set,this.pd=!1,this.gd=!1,this.md=0,this.yd=!1,this.bd=!1,this._d=!1,this.wd=!1,this.kd=0,this.Sd=!1,this.rn=()=>{const n=this.xd();this.kd=0,n&&this.reloadFeatureFlags()},this.$d=()=>{var n,o;const i=this.Cd,r=(n=this.Td)!==null&&n!==void 0?n:i;Eo(i)||Eo(r)||this.Mr.remoteRequestsDisabled||!this.Id||this.Id.visibilityState==="hidden"||Date.now()-((o=this.Md)!==null&&o!==void 0?o:0)<r||(this.Td=this.Sd||!this.Mr.idleRefreshBackoff?i:Math.min(2*r,36e5),this.Sd=!1,this.reloadFeatureFlags(),this.Ed())},this.Pd=()=>{this.Sd&&this.Td===this.Cd||this.Rd()},this.sn=()=>{var n;((n=this.Id)===null||n===void 0?void 0:n.visibilityState)==="visible"&&this.Rd()},this.wo=e}get Ad(){}Fd(){this.bo&&this.Od()}setup(e){try{this.Dd=typeof window>"u"?void 0:window,this.Id=typeof document>"u"?void 0:document}catch{this.Dd=void 0,this.Id=void 0}return this.qc=e,this.A=e.logger.createLogger("[FeatureFlags]"),i0t(e.kv.initialize(),()=>{this.qc===e&&(this.qc=void 0,this.bo=e,this.Ld(e))})}Ld(e){var n;if(this.bo===e)return this.Dd&&Wc(this.Dd,"online",this.rn),this.Od(),this.Nd=e.registerDynamicEventProperties(()=>this.qd()?this.ud:this.hd),this.jd=(n=this.Ad)===null||n===void 0?void 0:n.onCrossTabFeatureFlagChange(()=>{this.Bd(),this.zd(),this.Hd()}),this.zd(),this.initialize()}Rd(){this.Sd=!0,this.Td=this.Cd,this.$d()}Od(){var e;const n=this.Mr.refreshIntervalMs,o=!this.Mr.remoteRequestsDisabled&&this.Id&&!Eo(n)&&n>0?n:void 0;this.Mr.idleRefreshBackoff||(this.Td=o),o!==this.Cd&&(this.Ud(),Eo(o)||(this.Cd=o,this.Td=o,this.Ed(),!((e=this.Id)===null||e===void 0)&&e.addEventListener&&(Wc(this.Id,Fz,this.sn),iF(c0t,i=>{Wc(this.Id,i,this.Pd,{capture:!0})}))))}Ed(){Eo(this.Cd)||(Eo(this.Wd)||clearInterval(this.Wd),this.Md=Date.now(),this.Wd=setInterval(this.$d,this.Cd))}Ud(){var e,n;Eo(this.Wd)||(clearInterval(this.Wd),this.Wd=void 0,(e=this.Id)===null||e===void 0||(n=e.removeEventListener)===null||n===void 0||n.call(e,"visibilitychange",this.sn),iF(c0t,o=>{var i,r;(i=this.Id)===null||i===void 0||(r=i.removeEventListener)===null||r===void 0||r.call(i,o,this.Pd,{capture:!0})})),this.Cd=void 0,this.Td=void 0,this.Sd=!1,this.Md=void 0}destroy(){this.Vd()}dispose(){this.Vd()}Vd(){var e,n,o;this.Ud(),this.md++,this.bd=!1,this.qc=void 0,this.Gd(this.vd,"cancelled"),this.Gd(this.fd,"cancelled"),this.bo&&(this.Qd(),(e=this.Nd)===null||e===void 0||e.dispose(),this.Nd=void 0,(n=this.jd)===null||n===void 0||n.call(this),this.jd=void 0,this.dd=[],(o=this.Dd)===null||o===void 0||o.removeEventListener("online",this.rn),this.bo=void 0)}get Mr(){return this.wo.get()}Zd(e){var n;return this.Jd&&e in this.Jd?this.Jd[e]:(n=this.bo)===null||n===void 0?void 0:n.kv.get(e)}Bd(){return!!this.Jd&&(this.Jd=void 0,!0)}Kd(){var e;return!Eo((e=this.bo)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.Bd()}$t(e){this.Xd(()=>{var n;return(n=this.bo)===null||n===void 0?void 0:n.kv.set(e)})}Yd(e,n,o){if(!this.Ad||!e.$enabled_feature_flags)return;const i=this.Zd("$enabled_feature_flags")||{},r=e.$enabled_feature_flags||{},s=n.flags||n.featureFlags,a=n.flags?Object.entries(n.flags).filter(([,_])=>!_?.failed).map(([_])=>_):[],A=!!n.errorsWhileComputingFlags&&!!n.flags,c=A?a:o&&!qr(s)?Object.keys(s||{}):Array.from(new Set([...Object.keys(i),...Object.keys(r)])),l=this.Zd("$feature_flag_payloads")||{},g=e.$feature_flag_payloads||{},u=A||o?c:Array.from(new Set([...Object.keys(l),...Object.keys(g)])),h=!A&&!o,d=!!h||c,m=!!h||u,p={[K8]:d,[Z4]:d,[kQ]:m};e.$feature_flag_details&&(p[tD]=d);for(const _ of[nD,DQ,Tz])Eo(e[_])||(p[_]=!0);this.Ad.markCrossTabFeatureFlagChanges(p)}Pt(e){this.Xd(()=>{var n;return(n=this.bo)===null||n===void 0?void 0:n.kv.remove(e)})}Xd(e){try{e()}catch(n){this.A.error("Failed to update feature flag persistence",n)}}zd(){const e={};for(const i of[K8,kQ,nD,V9]){const r=this.Zd(i);Eo(r)||(e[i]=r)}this.ud=e;const n=Zt({},e),o=this.Zd(Z4);if(o)for(const[i,r]of Object.entries(o))n[`$feature/${i}`]=r;this.hd=n}qd(){const e=this.Mr.cacheTtlMs;if(!e||0>=e)return!1;const n=this.Zd(DQ);return typeof n!="number"||Date.now()-n>e}tv(){return!!this.qd()&&(this.wd||this.gd||(this.wd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ev(){const e=this.Mr.evaluationContexts;return e?.length?e.filter(n=>{const o=n&&typeof n=="string"&&n.trim().length>0;return o||this.A.error("Invalid evaluation context found:",n,"Expected non-empty string"),o}):[]}iv(){const e=this.Mr.flagKeys;if(!Eo(e))return e.filter(n=>{const o=n&&typeof n=="string"&&n.trim().length>0;return o||this.A.error("Invalid flag key found:",n,"Expected non-empty string"),o})}initialize(){var e,n;const o=this.Mr,i=(e=(n=o.bootstrap)===null||n===void 0?void 0:n.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var r,s;const a=(r=(s=o.bootstrap)===null||s===void 0?void 0:s.featureFlagPayloads)!==null&&r!==void 0?r:{},A=Object.keys(i).filter(l=>!Eo(i[l])).reduce((l,g)=>(l[g]=i[g],l),{}),c=Object.keys(a).filter(l=>A[l]).reduce((l,g)=>(l[g]=a[g],l),{});return this.nv({featureFlags:A,featureFlagPayloads:c},void 0,{persist:!1})}}updateFlags(e,n,o){var i,r;const s=o?.merge&&(i=this.Zd("$enabled_feature_flags"))!==null&&i!==void 0?i:{},a=o?.merge&&(r=this.Zd("$feature_flag_payloads"))!==null&&r!==void 0?r:{},A=Zt(Zt({},s),e),c=Zt(Zt({},a),n),l={};for(const[g,u]of Object.entries(A))l[g]={key:g,enabled:IAt(u),variant:CAt(u),reason:void 0,metadata:Eo(c?.[g])?void 0:{id:0,version:void 0,description:void 0,payload:c[g]}};this.nv({flags:l})}get hasLoadedFlags(){return this.pd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.Zd(tD),n=this.Zd(V9),o=this.Zd(oD);if(!o&&!n)return e||{};const i=Xg({},e||{}),r=[...new Set([...Object.keys(o||{}),...Object.keys(n||{})])];for(const A of r){var s,a;const c=i[A],l=n?.[A],g=Eo(l)?(s=c?.enabled)!==null&&s!==void 0&&s:!!l,u=Eo(l)?c?.variant:typeof l=="string"?l:void 0,h=o?.[A],d=Zt(Zt({},c),{},{enabled:g,variant:g?u??c?.variant:void 0});g!==c?.enabled&&(d.original_enabled=c?.enabled),u!==c?.variant&&(d.original_variant=c?.variant),h&&(d.metadata=Zt(Zt({},c?.metadata),{},{payload:h,original_payload:c==null||(a=c.metadata)===null||a===void 0?void 0:a.payload})),i[A]=d}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:o,finalDetails:i}),this.ld=!0),i}getAllFeatureFlags(){const e=this.getFlagVariants(),n=this.getFlagPayloads();return Object.keys(e).map(o=>{const i=e[o];return{key:o,enabled:IAt(i),variant:CAt(i),payload:fAt(n[o])}})}getFlagVariants(){const e=this.Zd(Z4),n=this.Zd(V9);if(!n)return e||{};const o=Xg({},e||{}),i=Object.keys(n);for(let r=0;i.length>r;r++)o[i[r]]=n[i[r]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:n,finalFlags:o}),this.ld=!0),o}getFlagPayloads(){const e=this.Zd(kQ),n=this.Zd(oD);if(!n)return e||{};const o=Xg({},e||{}),i=Object.keys(n);for(let r=0;i.length>r;r++)o[i[r]]=n[i[r]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:n,finalPayloads:o}),this.ld=!0),o}reloadFeatureFlags(){this.yd||this.Mr.featureFlagsDisabled||this.xd()||(this.gd&&(this.bd=!0),this.sv||(this.dd.slice().forEach(e=>{try{e()}catch(n){this.A.error("Error while running feature flags reloading callback",n)}}),this.sv=setTimeout(()=>{this.rv()},5)))}reloadFeatureFlagsAsync(){return!this.bo||this.yd||this.Mr.featureFlagsDisabled||this.Mr.remoteRequestsDisabled||this.xd()?Promise.resolve({status:"skipped"}):new Promise(e=>{this.vd.add(e),this.reloadFeatureFlags()})}Gd(e,n){e.forEach(o=>o({status:n})),e.clear()}Qd(){clearTimeout(this.sv),this.sv=void 0}onReloading(e){return this.dd.push(e),()=>{this.dd=this.dd.filter(n=>n!==e)}}ensureFlagsLoaded(){this.pd||this.gd||this.sv||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.yd=e}resetFlagCallReported(){this.Pt(TQ)}rv(e){var n;this.Qd();const o=this.bo;if(!o||this.Mr.remoteRequestsDisabled||this.xd())return void this.Gd(this.vd,"skipped");if(this.gd)return void(this.bd=!0);const i={token:o.projectToken,distinct_id:o.distinctId,groups:o.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:Zt(Zt(Zt({},o.initialPersonProperties),this.Zd("$stored_person_properties")||{}),{},{$lib:o.library.name,$lib_version:o.library.version}),group_properties:this.Zd(NQ),timezone:jct()};Eo(o.deviceId)||(i.$device_id=o.deviceId),(e?.disableFlags||this.Mr.featureFlagsDisabled)&&(i.disable_flags=!0);const r=this.ev();r.length&&(i.evaluation_contexts=r);const s=this.iv();Eo(s)||(i.flag_keys=s);const a=this.Mr.onlyEvaluateSurveyFeatureFlags,A="/flags/?v=2"+(a?"&only_evaluate_survey_feature_flags=true":""),c=this.md,l=this.vd;this.vd=new Set,this.fd=l,this.gd=!0;const g=()=>{this.bd&&(this.bd=!1,this.rv())},u=_=>{var f,I;const C=(f=_.json)!==null&&f!==void 0?f:{},y=_.statusCode!==200;if(this.gd=!1,c!==this.md)return void g();if(this.ov(_.statusCode),y||this.bd||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.bd)return void this.Gd(l,"skipped");this._d=!y;const x=[];_.error?x.push(_.error instanceof Error&&_.error.name==="AbortError"?"timeout":_.error instanceof Error?l0t:"unknown_error"):_.statusCode!==200&&x.push(`api_error_${_.statusCode}`),C.errorsWhileComputingFlags&&x.push("errors_while_computing_flags");const E=!!(!((I=C.quotaLimited)===null||I===void 0)&&I.includes("feature_flags"));E&&x.push("quota_limited"),this.$t({[Rz]:x}),E?this.A.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."):i.disable_flags||this.nv(C,y,{partialResponse:a}),this.Gd(l,i.disable_flags?"skipped":x.length||!C.flags&&!C.featureFlags?"error":"loaded"),g()},h=_=>{this.gd=!1,c===this.md&&(this.$t({[Rz]:[l0t]}),this.A.error("Feature flag request failed",_),this.Kd()&&this.Hd(!0),this.Gd(l,"error")),g()};let d=(n=this.Mr.requestMaxRetries)!==null&&n!==void 0?n:1;const m=()=>d>0&&c===this.md,p=()=>{if(c!==this.md||!this.bo||this.Mr.remoteRequestsDisabled)return this.gd=!1,this.Gd(l,"skipped"),void g();try{o.sendRequest(A,{target:"flags",method:"POST",body:i,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(_=>{if((f=>OPn.includes(f.statusCode)||(I=>I.statusCode===0&&I.error instanceof Error&&I.error.name==="AbortError")(f))(_)&&m())return d--,void setTimeout(p,500);u(_)}).catch(h)}catch(_){h(_)}};p()}xd(){return $ct(this.kd,3)}ov(e){this.kd=Xct(e,this.kd,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,n={}){var o;if(n.fresh&&!this._d)return;if(!(this.pd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+e+f3e);if(this.tv())return;const i=this.getFeatureFlagResult(e,n);return(o=i?.variant)!==null&&o!==void 0?o:i?.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const n=this.getFeatureFlagResult(e,{send_event:!1});return n?.payload}getFeatureFlagResult(e,n={}){if(n.fresh&&!this._d)return;if(!(this.pd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+e+f3e);if(this.tv())return;const o=this.getFlagVariants(),i=e in o,r=o[e],s=this.getFlagPayloads()[e],a=String(r),A=this.Zd("$feature_flag_request_id")||void 0,c=this.Zd("$feature_flag_evaluated_at")||void 0;let l,g=this.Zd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var u;const Q=(u=this.bo)===null||u===void 0?void 0:u.session.sessionId,w=this.Zd(kz);Q&&Q!==w&&(g={},l=Q)}if(!n.send_event&&"send_event"in n)l&&this.$t({[TQ]:g,[kz]:l});else if(e in g&&g[e].includes(a))l&&this.$t({[TQ]:g,[kz]:l});else{var h,d,m,p,_,f,I,C,y,x,E,B,S;qr(g[e])?g[e].push(a):g[e]=[a],this.$t(Zt({[TQ]:g},l?{[kz]:l}:{}));const Q=this.getFeatureFlagDetails(e),w=[...(h=this.Zd("$feature_flag_errors"))!==null&&h!==void 0?h:[]];Eo(r)&&w.push("flag_missing");const M={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:s??null,$feature_flag_request_id:A,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:(d=(m=this.Mr.bootstrap)===null||m===void 0||(m=m.featureFlags)===null||m===void 0?void 0:m[e])!==null&&d!==void 0?d:null,$feature_flag_bootstrapped_payload:(p=(_=this.Mr.bootstrap)===null||_===void 0||(_=_.featureFlagPayloads)===null||_===void 0?void 0:_[e])!==null&&p!==void 0?p:null,$used_bootstrap_value:!this._d};Eo(Q==null||(f=Q.metadata)===null||f===void 0?void 0:f.has_experiment)||(M.$feature_flag_has_experiment=Q.metadata.has_experiment),Eo(Q==null||(I=Q.metadata)===null||I===void 0?void 0:I.version)||(M.$feature_flag_version=Q.metadata.version);const T=(C=Q==null||(y=Q.reason)===null||y===void 0?void 0:y.description)!==null&&C!==void 0?C:Q==null||(x=Q.reason)===null||x===void 0?void 0:x.code;T&&(M.$feature_flag_reason=T),!(Q==null||(E=Q.metadata)===null||E===void 0)&&E.id&&(M.$feature_flag_id=Q.metadata.id),Eo(Q?.original_variant)&&Eo(Q?.original_enabled)||(M.$feature_flag_original_response=Eo(Q.original_variant)?Q.original_enabled:Q.original_variant),!(Q==null||(B=Q.metadata)===null||B===void 0)&&B.original_payload&&(M.$feature_flag_original_payload=Q==null||(S=Q.metadata)===null||S===void 0?void 0:S.original_payload),w.length&&(M.$feature_flag_error=w.join(",")),this.av(M)}return i?{key:e,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:fAt(s)}:void 0}av(e){try{var n;(n=this.bo)===null||n===void 0||n.capture("$feature_flag_called",e)}catch(o){this.A.error("Failed to capture feature flag call",o)}}getRemoteConfigPayload(e,n){this.lv(e,n)}lv(e,n){var o=this;return $g(function*(){const i=o.bo;if(!i)return;const r={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},s=o.ev();s.length&&(r.evaluation_contexts=s);const a=o.iv();let A;Eo(a)||(r.flag_keys=a);try{var c;const l=(c=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:r,compression:o.Mr.compression,sentAt:"body",timeoutMs:o.Mr.requestTimeoutMs})).json)===null||c===void 0?void 0:c.featureFlagPayloads;A=l?.[e]||void 0}catch(l){return void o.A.error("Remote config feature flag request failed",l)}try{n(A)}catch(l){o.A.error("Remote config feature flag callback failed",l)}})()}isFeatureEnabled(e,n={}){if(n.fresh&&!this._d)return n.defaultValue;if(!(this.pd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+e+f3e),n.defaultValue;const o=this.getFeatureFlag(e,n);return Eo(o)?n.defaultValue:!!o}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(n=>n!==e)}receivedFeatureFlags(e,n,o){this.nv(e,n,o)}nv(e,n,o){if(!this.bo)return;this.pd=!0;const i=((r,s={},a={},A={},c,l=A0t)=>{const g=((C,y)=>{const x=C.flags;if(x){const E=Object.fromEntries(Object.keys(x).map(S=>{var Q;return[S,(Q=x[S].variant)!==null&&Q!==void 0?Q:x[S].enabled]})),B=Object.fromEntries(Object.keys(x).filter(S=>x[S].enabled).filter(S=>{var Q;return!Eo((Q=x[S].metadata)===null||Q===void 0?void 0:Q.payload)}).map(S=>{var Q;return[S,(Q=x[S].metadata)===null||Q===void 0?void 0:Q.payload]}));return Zt(Zt({},C),{},{featureFlags:E,featureFlagPayloads:B})}return C.featureFlags&&y.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),C})(r,l),u=g.flags,h=g.featureFlags,d=g.featureFlagPayloads;if(!h)return;const m=r.requestId,p=r.evaluatedAt;if(qr(h)){l.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const C={};if(h)for(let y=0;h.length>y;y++)C[h[y]]=!0;return{[K8]:h,[Z4]:C,[Tz]:!1}}let _=h,f=d,I=u;if(c?.partialResponse){const C=Object.keys(_),y=f||{};_=Zt(Zt({},s),_),f=Zt(Zt({},a),y),C.forEach(x=>{x in y||f==null||delete f[x]}),I=Zt(Zt({},A),I)}else if(r.errorsWhileComputingFlags)if(u){const C=new Set(Object.keys(u).filter(x=>{var E;return!(!((E=u[x])===null||E===void 0)&&E.failed)}));_=Zt(Zt({},s),Object.fromEntries(Object.entries(_).filter(([x])=>C.has(x))));const y=Object.fromEntries(Object.entries(f||{}).filter(([x])=>C.has(x)));f=Zt(Zt({},a),y),C.forEach(x=>{x in y||f==null||delete f[x]}),I=Zt(Zt({},A),Object.fromEntries(Object.entries(I||{}).filter(([x])=>C.has(x))))}else _=Zt(Zt({},s),_),f=Zt(Zt({},a),f),I=Zt(Zt({},A),I);return Zt(Zt({[K8]:Object.keys(u0t(_)),[Z4]:_||{},[kQ]:f||{},[tD]:I||{},[Tz]:r.minimalFlagCalledEvents===!0},m?{[nD]:m}:{}),p?{[DQ]:p}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),o,this.A);if(i)if(o?.persist===!1){const r=!Eo(this.bo.kv.get(Z4));this.Jd=i,r||this.$t(i)}else this.Bd(),this.Yd(i,e,!!o?.partialResponse),this.$t(i);else n&&this.Kd();n||(this.wd=!1),this.Hd(n)}override(e,n=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:n})}overrideFeatureFlags(e){this.uv(e)}uv(e){if(this.bo){if(e===!1)return this.Pt([V9,oD]),this.Hd(),void cD.info("All overrides cleared");if(qr(e))return this.$t({[V9]:g0t(e)}),this.Hd(),void cD.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n;const o=e;this.ld=!!((n=o.suppressWarning)!==null&&n!==void 0&&n);const i={},r=o.flags,s=o.payloads;return r&&(i[V9]=qr(r)?g0t(r):r),s&&(i[oD]=s),Object.keys(i).length&&this.$t(i),r===!1&&s===!1?this.Pt([V9,oD]):r===!1?this.Pt(V9):s===!1&&this.Pt(oD),this.Hd(),r===!1?cD.info("Flag overrides cleared"):r&&cD.info("Flag overrides set",{flags:r}),void(s===!1?cD.info("Payload overrides cleared"):s&&cD.info("Payload overrides set",{payloads:s}))}if(e&&typeof e=="object")return this.$t({[V9]:e}),this.Hd(),void cD.info("Flag overrides set",{flags:e});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.pd){const{flags:n,flagVariants:o}=this.hv();try{e(n,o)}catch(i){this.A.error("Error while running feature flags callback",i)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,n,o){var i;const r=(this.Zd("$early_access_features")||[]).find(l=>l.flagKey===e),s={[`$feature_enrollment/${e}`]:n},a={$feature_flag:e,$feature_enrollment:n,$set:s};r&&(a.$early_access_feature_name=r.name),o&&(a.$feature_enrollment_stage=o);const A=Zt(Zt({},this.getFlagVariants()),{},{[e]:n});(i=this.Ad)===null||i===void 0||i.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(s)}),this.$t({[K8]:Object.keys(u0t(A)),[Z4]:A,[RQ]:Zt(Zt({},this.Zd("$stored_person_properties")||{}),s)}),this.Hd();try{var c;(c=this.bo)===null||c===void 0||c.capture("$feature_enrollment_update",a)}catch(l){this.A.error("Failed to capture early access feature enrollment",l)}}getEarlyAccessFeatures(e,n=!1,o){const i=this.Zd(uxe);!i||n?this.dv(e,o):e(i)}dv(e,n){var o=this;return $g(function*(){const i=o.bo;if(!i)return;const r=n?`&${n.map(a=>`stage=${a}`).join("&")}`:"";let s;try{const a=yield i.sendRequest(`/api/early_access_features/?token=${i.projectToken}${r}`,{target:"api",method:"GET",sentAt:"query"});if(!a.json)return;s=a.json.earlyAccessFeatures,o.$t({[uxe]:s})}catch(a){return void o.A.error("Early access feature request failed",a)}try{e(s)}catch(a){o.A.error("Early access feature callback failed",a)}})()}hv(){const e=this.getFlags(),n=this.getFlagVariants();return{flags:e.filter(o=>n[o]),flagVariants:Object.keys(n).filter(o=>n[o]).reduce((o,i)=>(o[i]=n[i],o),{})}}Hd(e){this.zd();const{flags:n,flagVariants:o}=this.hv();this.featureFlagEventHandlers.forEach(i=>{try{i(n,o,{errorsLoading:e})}catch(r){this.A.error("Error while running feature flags callback",r)}})}setPersonPropertiesForFlags(e,n=!0){this.vv(e,n)}vv(e,n=!0){const o=this.Zd("$stored_person_properties")||{},i=e?.$set||(e?.$set_once?{}:e),r=e?.$set_once,s={};if(r)for(const a in r)({}).hasOwnProperty.call(r,a)&&(a in o||(s[a]=r[a]));this.$t({[RQ]:Zt(Zt(Zt({},o),s),i)}),n&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,n=!0){const o=Zt({},this.Zd("$stored_person_properties")||{});e.forEach(i=>{delete o[i]}),this.$t({[RQ]:o}),n&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Pt(RQ),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,n=!0){const o=this.Zd("$stored_group_properties")||{},i=Zt({},o);for(const r of Object.keys(e))i[r]=Zt(Zt({},o[r]),e[r]);this.$t({[NQ]:i}),n&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const n=this.Zd("$stored_group_properties")||{};this.$t({[NQ]:Zt(Zt({},n),{},{[e]:{}})})}else this.Pt(NQ)}reset(){this.md++,this.Gd(this.vd,"cancelled"),this.Gd(this.fd,"cancelled"),this.bd=!1,this.ud={},this.hd={},this.Jd=void 0,this.pd=!1,this.yd=!1,this._d=!1,this.$anon_distinct_id=void 0,this.Qd(),this.ld=!1,this.kd=0}};const d0t=gd("[FeatureFlags]");var YPn=class{constructor(e,n=!1){this.fv=!1,this.update(e,n)}update(e,n){this.pv=((o,i)=>{var r,s,a,A,c,l,g,u;return{bootstrap:{featureFlags:(r=(s=o.bootstrap)===null||s===void 0?void 0:s.featureFlags)!==null&&r!==void 0?r:void 0,featureFlagPayloads:(a=(A=o.bootstrap)===null||A===void 0?void 0:A.featureFlagPayloads)!==null&&a!==void 0?a:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!o.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!o.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!o.advanced_feature_flags_dedup_per_session,cacheTtlMs:o.feature_flag_cache_ttl_ms,refreshIntervalMs:(c=o.remote_config_refresh_interval_ms)!==null&&c!==void 0?c:3e5,idleRefreshBackoff:Eo(o.remote_config_refresh_interval_ms),requestTimeoutMs:o.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(l=o.feature_flag_request_max_retries)!==null&&l!==void 0?l:1),compression:o.disable_compression?void 0:"best-available",evaluationContexts:(g=(u=o.evaluation_contexts)!==null&&u!==void 0?u:o.evaluation_environments)!==null&&g!==void 0?g:[],flagKeys:qr(o.flag_keys)?o.flag_keys:void 0}})(e,n),!e.evaluation_environments||e.evaluation_contexts||this.fv||(d0t.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.fv=!0),Eo(e.flag_keys)||qr(e.flag_keys)||d0t.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.pv}};const h0t=t=>Xk(t)&&(t.name==="RangeError"&&t.message.indexOf("Maximum call stack size exceeded")===0||t.name==="InternalError"&&t.message==="too much recursion"),oB=gd("[Error tracking]"),I3e="webkit-masked-url:",UPn=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],KPn=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",I3e],zPn=["__firefox__","__gCrWeb"],m0t="Refusing to render web experiment since the viewer is a likely bot",VPn={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>loe(e,t),not_regex:(t,e)=>!loe(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},R5=gd("[Conversations]"),lD="Conversations not available yet.";function p0t(t,e){var n,o,i,r,s,a,A;const c=(n=t?.flushIntervalMs)!==null&&n!==void 0?n:3e3,l=(o=t?.maxBufferSize)!==null&&o!==void 0?o:100,g=e?.consoleCapture?void 0:(i=t?.maxLogsPerInterval)!==null&&i!==void 0?i:1e3,u=Eo(g)?Math.max(l,2048):Math.max(l,g),h=Zt(Zt({},(function(){let d="",m="";try{const p=X_?.userAgent;p&&([d,m]=eAt(p))}catch{}return(function(p,_){const f=(function(I){if(I)return{}.hasOwnProperty.call(TAt,I)?TAt[I]:I})(p);return Zt(Zt({},f?{"os.name":f}:{}),_?{"os.version":_}:{})})(d,m)})()),t?.resourceAttributes);return{serviceName:(r=(s=h?.["service.name"])!==null&&s!==void 0?s:t?.serviceName)!==null&&r!==void 0?r:e?.serviceNameDefault,serviceVersion:(a=h?.["service.version"])!==null&&a!==void 0?a:t?.serviceVersion,environment:(A=h?.["deployment.environment"])!==null&&A!==void 0?A:t?.environment,resourceAttributes:h,beforeSend:t?.beforeSend,flushIntervalMs:c,maxBufferSize:l,maxQueueSize:u,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:g,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const JPn=["debug","log","warn","error","info"],WPn=t=>{for(;t?.__rrweb_original__;)t=t.__rrweb_original__;return t},_0t="console",f0t="__posthogHandledLogsRequestError",C3e=(t,e)=>{const n=t instanceof Error?t:new Error(e);return n[f0t]=!0,n},I0t=t=>!!t&&typeof t=="object"&&t[f0t]===!0,doe=gd("[NetworkMetrics]"),y3e=()=>{var t;return!(jn==null||(t=jn.performance)===null||t===void 0)&&t.now?jn.performance.now():Date.now()},jPn={"http:":80,"https:":443},qPn=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),C0t=(t,e)=>{var n;const o=String(e);return{method:String(t).toUpperCase(),url:((n=V8(o))===null||n===void 0?void 0:n.href)||o}},x3e=(t,e,n,o,i,r,s=!1)=>{try{var a,A;const c=i();if(!c)return;const l=n||void 0,g=y3e()-o,u=V8(e.url);if(u&&u.protocol!=="http:"&&u.protocol!=="https:")return;const h={url:u?.href||e.url,method:e.method},d=ap(c.name)?c.name(h):$a(c.name)?c.name:"http.client.request.duration";if(!d)return;const m=s&&!l?void 0:((_,f)=>_?400>_?void 0:String(_):f?.name||"_OTHER")(l,r),p=Zt(Zt(Zt(Zt(Zt({},(_=>{const f=qPn.has(_)?_:"_OTHER";return Zt({"http.request.method":f},f==="_OTHER"&&_!==f?{"http.request.method_original":_}:{})})(h.method)),u?(_=>{return{"server.address":_.hostname.startsWith("[")&&_.hostname.endsWith("]")?_.hostname.slice(1,-1):_.hostname,"server.port":Number(_.port)||jPn[_.protocol],"url.scheme":_.protocol.slice(0,-1),"url.template":(f=_.pathname,f.split("/").map(I=>(C=>/^\d+$/.test(C)||C.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(C))(I)?":id":I).join("/"))};var f})(u):{}),l?{"http.response.status_code":l}:{}),m?{"error.type":m}:{}),(a=c.attributes)===null||a===void 0?void 0:a.call(c,h,{status:l,durationMs:g}));(A=t.metrics)===null||A===void 0||A.histogram(d,g,{unit:"ms",attributes:p})}catch(c){doe.error("Failed to record network metric",c)}},y0t=()=>{},$Pn=(t,e)=>ap(jn?.fetch)?fF(jn,"fetch",n=>function(...o){const i=y3e(),r=n.apply(this,o);if(!e())return r;try{var s,a,A;const[c,l]=o,g=C0t((s=(a=l?.method)!==null&&a!==void 0?a:c?.method)!==null&&s!==void 0?s:"GET",(A=c?.url)!==null&&A!==void 0?A:c);return r.then(u=>(x3e(t,g,u?.status,i,e,void 0,!0),u),u=>{throw x3e(t,g,void 0,i,e,u),u})}catch(c){return doe.error("Failed to observe fetch",c),r}}):y0t,XPn=(t,e)=>{var n;const o=jn==null||(n=jn.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!o)return y0t;const i=new WeakMap,r=fF(o,"open",a=>function(...A){try{ylt.has(this)||i.set(this,C0t(A[0],A[1]))}catch(c){doe.error("Failed to observe XHR open",c)}return a.apply(this,A)}),s=fF(o,"send",a=>function(...A){let c;try{const l=i.get(this);if(l&&e()){const g=y3e();c=()=>{this.removeEventListener("loadend",c),x3e(t,l,this.status,g,e)},Wc(this,"loadend",c)}}catch(l){doe.error("Failed to observe XHR send",l)}try{return a.apply(this,A)}catch(l){throw c&&this.removeEventListener("loadend",c),l}});return()=>{r(),s()}},x0t=new WeakMap,ZPn={maxStringLength:2048,truncationSuffix:"..."};function E0t(t){if(t)return t===!0?{intent:!0,model:!0}:{intent:t.intent!==!1,model:t.model!==!1}}function HQ(t,e){return{}.hasOwnProperty.call(t,e)}function E3e(t,e){const n=Object.create(t);return e&&Object.defineProperty(n,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:e}),n}function B0t(t,e,n=!1){if(!$a(t))return;const o=t.trim();return o?(n?Rvn(o,ZPn):o).slice(0,e):void 0}function b0t(t){try{return Ea(t)&&t.isError===!0}catch{return!1}}const hoe={featureFlags:class extends GPn{constructor(t){const e=new YPn(t.config,t.il());super(e),this.name="featureFlags",this._instance=t,this.gv=e}get Ad(){return this._instance.persistence}updateConfig(t,e){this.gv.update(t,e),this.Fd()}}},eMn={sessionRecording:class{get Mr(){return this._instance.config}get Il(){return this._instance.persistence}get started(){var t;return!!(!((t=this.mv)===null||t===void 0)&&t.isStarted)}get status(){var t,e;return this.yv==="awaiting_config"||this.yv==="missing_config"?this.yv:(t=(e=this.mv)===null||e===void 0?void 0:e.status)!==null&&t!==void 0?t:this.yv}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.yv=m3e,this.bv=void 0,this._v=!1,this.Je=(()=>{var e,n;if(!qo?.visibilityState||qo.visibilityState==="visible")return!0;const o=jn==null||(e=jn.performance)===null||e===void 0||(n=e.getEntriesByType)===null||n===void 0?void 0:n.call(e,"visibility-state");return!o?.length||o.some(i=>i.name==="visible")})(),this.sn=()=>{var e,n;qo?.visibilityState==="visible"&&(this.Je=!0,(e=this.mv)===null||e===void 0||(n=e.setDocumentWasEverVisible)===null||n===void 0||n.call(e,!0))},!this._instance.sessionManager)throw j8.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Mr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');qo?.addEventListener&&Wc(qo,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this._v=!0,qo==null||(e=qo.removeEventListener)===null||e===void 0||e.call(qo,"visibilitychange",this.sn),t?this.wv(!0):this.stopRecording()}get Sv(){var t;const e=!!(!((t=this._instance.get_property("$session_recording_remote_config"))===null||t===void 0)&&t.enabled),n=!this.Mr.disable_session_recording,o=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return jn&&e&&n&&!o}startIfEnabledOrStop(t){var e;if(this._v||this.Sv&&(!((e=this.mv)===null||e===void 0)&&e.isStarted))return;const n=!Eo(Object.assign)&&!Eo(Array.from);this.Sv&&n?(this.xv(t),j8.info("starting")):(this.yv=m3e,this.stopRecording())}xv(t){var e,n;if(this.Sv)if(this.yv!=="awaiting_config"&&this.yv!=="missing_config"&&(this.yv=n0t),(Yr==null||(e=Yr.__PosthogExtensions__)===null||e===void 0||(e=e.rrweb)===null||e===void 0?void 0:e.record)&&((n=Yr.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording))this.$v(t);else{var o,i;const r=this._instance.sessionManager;(o=Yr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,this.Cv,s=>{if(!this._v&&this.Sv&&this._instance.sessionManager===r)return s?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),j8.error("could not load recorder",s)):void this.$v(t);this.yv="disabled"})}}stopRecording(){var t,e;(t=this.bv)===null||t===void 0||t.call(this),this.bv=void 0,(e=this.mv)===null||e===void 0||e.stop()}wv(t=!1){var e,n;(e=this.bv)===null||e===void 0||e.call(this),this.bv=void 0,(n=this.mv)===null||n===void 0||n.discard({discardProducerEvents:t})}Tv(){var t,e;(t=this.Il)===null||t===void 0||t.unregister("$session_is_sampled"),(e=this.Il)===null||e===void 0||e.unregister("$replay_sample_rate")}Iv(t,e){if(Fs(t))return null;const n=eh(t)?t:parseFloat(t);return typeof(o=n)!="number"||!Number.isFinite(o)||0>o||o>1?(j8.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):n;var o}Mv(t){if(this.Il){var e,n;const o=this.Il,i=()=>{var r;const s=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.Iv((r=this.Mr.session_recording)===null||r===void 0?void 0:r.sampleRate,"session_recording.sampleRate"),A=this.Iv(s?.sampleRate,"remote config sampleRate"),c=a??A;Fs(c)&&this.Tv();const l=s?.minimumDurationMilliseconds;o.register({[Hz]:Zt(Zt({cache_timestamp:Date.now(),enabled:!!s},s),{},{networkPayloadCapture:Zt({capturePerformance:t.capturePerformance},s?.networkPayloadCapture),canvasRecording:{enabled:s?.recordCanvas,fps:s?.canvasFps,quality:s?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:Eo(l)?null:l,endpoint:s?.endpoint,triggerMatchType:s?.triggerMatchType,masking:s?.masking,urlTriggers:s?.urlTriggers,version:s?.version,triggerGroups:s?.triggerGroups})})};i(),(e=this.bv)===null||e===void 0||e.call(this),this.bv=(n=this._instance.sessionManager)===null||n===void 0?void 0:n.onSessionId(i)}}onRemoteConfig(t){const e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.Mv(e),void this.wv()):(this.Mv(e),void this.startIfEnabledOrStop()):(this.yv==="awaiting_config"&&(this.yv="missing_config",this._instance.register_for_session({[Qxe]:!0}),j8.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var n;!((n=this.mv)===null||n===void 0)&&n.log?this.mv.log(t,e):j8.warn("log called before recorder was ready")}get Cv(){var t,e;const n=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.get_property(Hz);return(n==null||(e=n.scriptConfig)===null||e===void 0?void 0:e.script)||"lazy-recorder"}Ev(){const t=this._instance.get_property(Hz);if(!t)return!1;let e;try{e=typeof t=="object"?t:JSON.parse(t)}catch(n){return j8.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!Fs(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}$v(t){var e,n,o;if(!this._v&&this.Sv&&this._instance.sessionManager){if(!(!((e=Yr.__PosthogExtensions__)===null||e===void 0)&&e.initSessionRecording))return j8.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Sxe]:!0});var i;if(this.mv||(this.mv=(i=Yr.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording(this._instance,this.Je),this.mv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ev())return this.yv==="missing_config"||this.yv==="awaiting_config"?void 0:(this.yv="awaiting_config",j8.info("persisted remote config is stale, requesting fresh config before starting"),void new glt(this._instance).load());this.yv=n0t,(n=(o=this.mv).setDocumentWasEverVisible)===null||n===void 0||n.call(o,this.Je),this.mv.start(t)}else this.yv=m3e}onRRwebEmit(t){var e,n;(e=this.mv)===null||e===void 0||(n=e.onRRwebEmit)===null||n===void 0||n.call(e,t)}overrideLinkedFlag(){var t,e;this.mv||(e=this.Il)===null||e===void 0||e.register({$replay_override_linked_flag:!0}),(t=this.mv)===null||t===void 0||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.mv||(e=this.Il)===null||e===void 0||e.register({$replay_override_sampling:!0}),(t=this.mv)===null||t===void 0||t.overrideSampling()}overrideTrigger(t){var e,n;this.mv||(n=this.Il)===null||n===void 0||n.register({[t==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.mv)===null||e===void 0||e.overrideTrigger(t)}get sdkDebugProperties(){var t;const e={};for(const o of PPn){var n;const i=(n=this._instance.sessionPersistence)===null||n===void 0?void 0:n.get_property(o);Eo(i)||(e[o]=i)}return Zt(Zt({},e),((t=this.mv)===null||t===void 0?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,e){var n;return!!(!((n=this.mv)===null||n===void 0)&&n.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;(t=this.mv)===null||t===void 0||(e=t.flushBeforeIdentityReset)===null||e===void 0||e.call(t)}}},tMn={autocapture:class extends bPn{constructor(t){super(new SPn(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.Pv=!1,this._instance=t,this.Rv=this.Av()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.Fv();return!!(t.path||t.search||this.Ov(t))}startIfEnabled(){this.isEnabled&&(li.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Rv=this.Av(),this.startIfEnabled()}stop(){this.Dv&&this.Dv(),this.Dv=void 0,this.Lv&&this.Lv(),this.Lv=void 0,li.info("History API monitoring stopped")}monitorHistoryChanges(){jn&&jn.history&&(this.Nv("pushState"),this.Nv("replaceState"),this.qv(),this.Ov()&&this.jv())}Nv(t){var e;if(!jn||!((e=jn.history[t])===null||e===void 0)&&e.__posthog_wrapped__)return;const n=this;fF(jn.history,t,o=>function(i,r,s){var a;n.Bv(s)&&n.zv(),o.call(this,i,r,s),n.Hv(t,!n.Pv&&(jn==null||(a=jn.event)===null||a===void 0?void 0:a.type)!=="popstate")})}Av(){const t=jn?.location;if(t?.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}Fv(){const t=this._instance.config.capture_pageview;return t==="history_change"?{path:!0}:Ea(t)?t:{}}Ov(t=this.Fv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Uv(t){const e=this.Fv(),n=this.Rv;return!(!n||!(e.path&&t.pathname!==n.pathname||e.search&&t.search!==n.search||this.Ov(e)&&t.hash!==n.hash))}Hv(t,e=!1){try{e||this.zv();const n=this.Av();if(!n)return;if(this.Uv(n)){const o=()=>this._instance.capture(wxe,{navigation_type:t});e?(this.Wv=o,Promise.resolve().then(()=>this.zv())):o()}this.Rv=n}catch(n){li.error(`Error capturing ${t} pageview`,n)}}Bv(t){var e,n;return!(Fs(t)||!jn)&&((e=V8(String(t)))===null||e===void 0?void 0:e.href)!==((n=jn.location)===null||n===void 0?void 0:n.href)}zv(){const t=this.Wv;if(t){this.Wv=void 0,this.Pv=!0;try{t()}catch(e){li.error("Error capturing deferred pageview",e)}finally{this.Pv=!1}this.Rv=this.Av()}}qv(){if(this.Dv)return;const t=()=>{this.Hv("popstate")};Wc(jn,"popstate",t),this.Dv=()=>{jn&&jn.removeEventListener("popstate",t)}}jv(){if(this.Lv)return;const t=()=>{this.Hv("hashchange")};Wc(jn,"hashchange",t),this.Lv=()=>{jn&&jn.removeEventListener("hashchange",t)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(t){var e;this.Vv=!1,this.ko=!1,this.Gv=null,this.instance=t,this.Vv=!!(!((e=this.instance.persistence)===null||e===void 0)&&e.props[pxe]),this.rageclicks=new $lt(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return Ea(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Mr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Fs(this.Mr.capture_heatmaps)?Fs(this.Mr.enable_heatmaps)?this.Vv:this.Mr.enable_heatmaps:this.Mr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ko)return;MPn.info("starting..."),this.Qv(),this.sn()}else{var t;clearInterval((t=this.Gv)!==null&&t!==void 0?t:void 0),this.Zv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("heatmaps"in e))return;const n=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[pxe]:n}),this.Vv=n,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Jv(t){p3e(t.originalEvent)&&this.Ir(t.originalEvent,"deadclick")}sn(){this.Gv&&clearInterval(this.Gv),this.Gv=qo?.visibilityState==="visible"?setInterval(this.fl.bind(this),this.flushIntervalMilliseconds):null}Qv(){jn&&qo&&(this.Kv=this.fl.bind(this),Wc(jn,Xne,this.Kv),this.Xv=t=>this.Ir(t||jn?.event),Wc(qo,"click",this.Xv,{capture:!0}),this.Yv=t=>this.tf(t||jn?.event),Wc(qo,"mousemove",this.Yv,{capture:!0}),this.ef=new Kct(this.instance,Mwn,this.Jv.bind(this)),this.ef.startIfEnabledOrStop(),this.if=this.sn.bind(this),Wc(qo,Fz,this.if),this.ko=!0)}Zv(){var t;jn&&qo&&(this.Kv&&jn.removeEventListener(Xne,this.Kv),this.Xv&&qo.removeEventListener("click",this.Xv,{capture:!0}),this.Yv&&qo.removeEventListener("mousemove",this.Yv,{capture:!0}),this.if&&qo.removeEventListener(Fz,this.if),clearTimeout(this.nf),(t=this.ef)===null||t===void 0||t.stop(),this.ko=!1)}sf(t,e){const n=this.instance.scrollManager.scrollY(),o=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),r=(function(s,a,A){let c=s;for(;c&&nB(c)&&!gI(c,"body");){if(c===A)return!1;let h;try{var l,g,u;h=(l=(g=(u=c.ownerDocument)===null||u===void 0?void 0:u.defaultView)!==null&&g!==void 0?g:jn)===null||l===void 0?void 0:l.getComputedStyle(c).position}catch{return!1}if(jr(a,h))return!0;c=Pct(c)}return!1})(Kz(t),["fixed","sticky"],i);return{x:t.clientX+(r?0:o),y:t.clientY+(r?0:n),target_fixed:r,type:e}}Ir(t,e="click"){var n;if(Sct(t.target)||!p3e(t))return;const o=this.sf(t,e);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&Tct(Kz(t),this.instance.config.rageclick)&&this.Qs(Zt(Zt({},o),{},{type:"rageclick"})),this.Qs(o)}tf(t){!Sct(t.target)&&p3e(t)&&(clearTimeout(this.nf),this.nf=setTimeout(()=>{this.Qs(this.sf(t,"mousemove"))},500))}Qs(t){if(!jn)return;const e=this.Mr.disable_capture_url_hashes?MQ(jn.location.href):jn.location.href,n=this.Mr.custom_personal_data_properties,o=this.Mr.mask_personal_data_properties?[...uF,...n||[]]:[],i=Jz(e,o,Wz);this.Rt=this.Rt||{},this.Rt[i]||(this.Rt[i]=[]),this.Rt[i].push(t)}fl(){this.Rt&&!px(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Kct,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.Vv=!1,this.ko=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.rf=()=>{clearTimeout(this.af),this.af=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",Zt({$current_url:this.Rt.url},this.Rt.metrics.reduce((n,o)=>Zt(Zt({},n),{},{[`$web_vitals_${o.name}_event`]:Zt({},o),[`$web_vitals_${o.name}_value`]:o.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.lf=n=>{var o;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Fs(n?.name)||Fs(n?.value))return void AD.error("Invalid metric received",n);const i=typeof n.navigationURL=="string"?n.navigationURL:void 0,r=this.uf(i);if(Eo(r))return;const s=eh(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${r}`;if(this.cf&&n.value>=this.cf)return void AD.error("Ignoring metric with value >= "+this.cf,n);this.Rt.navigationKey!==s&&(this.rf(),this.af=setTimeout(this.rf,this.flushToCaptureTimeoutMs)),Eo(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=r),this.Rt.firstMetricTimestamp=Eo(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(o=this._instance.sessionManager)===null||o===void 0?void 0:o.checkAndGetSessionAndWindowId(!0),A=Zt(Zt(Zt({},n),i?{navigationURL:r}:{}),{},{$current_url:r,timestamp:Date.now()});if(delete A.entries,Ea(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){const c={};for(const l of wPn){const g=l==="url"&&typeof n.attribution[l]=="string"?this.uf(n.attribution[l]):n.attribution[l];Eo(g)||(c[l]=g)}A.attribution=c}else delete A.attribution;Eo(a)||(A.$session_id=a.sessionId,A.$window_id=a.windowId),this.Rt.metrics.push(A),this.Rt.metrics.length===this.allowedMetrics.length&&this.rf()},this.hf=()=>{if(this.ko)return;let n,o,i,r,s=!1;const a=Yr.__PosthogExtensions__,A=a?.postHogWebVitalsCallbacksByFlavor,c=A?.[this.df]||(this.df==="web-vitals"&&Eo(A)?a?.postHogWebVitalsCallbacks:void 0);if(!Eo(c)){const u=c.withoutAttribution,h=this.attributionMetrics;s=!Eo(u),n=h.indexOf("LCP")>-1?c.onLCP:u?.onLCP||c.onLCP,o=h.indexOf("CLS")>-1?c.onCLS:u?.onCLS||c.onCLS,i=h.indexOf("FCP")>-1?c.onFCP:u?.onFCP||c.onFCP,r=h.indexOf("INP")>-1?c.onINP:u?.onINP||c.onINP}if(!(n&&o&&i&&r))return void AD.error("web vitals callbacks not loaded - not starting");const l={reportSoftNavs:this.useSoftNavs},g=s&&this.attributionMetrics.indexOf("INP")>-1?Zt(Zt({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&n(this.lf.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&o(this.lf.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.lf.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&r(this.lf.bind(this),g),this.ko=!0},this.Vv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[Ixe]),this.startIfEnabled()}get vf(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const n=Ea(this.vf)?(t=this.vf)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return Fs(n)?((e=this._instance.persistence)===null||e===void 0?void 0:e.props.$web_vitals_allowed_metrics)||t0t:n}get flushToCaptureTimeoutMs(){return(Ea(this.vf)?this.vf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=Ea(this.vf)?this.vf.web_vitals_attribution:void 0;return My(t)?t?t0t:[]:qr(t)?t:vPn}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=Ea(this.vf)?this.vf.__preview_web_vitals_soft_navs:void 0;return t!=null&&t}get cf(){const t=Ea(this.vf)&&eh(this.vf.__web_vitals_max_value)?this.vf.__web_vitals_max_value:e0t;return t>0&&6e4>=t?e0t:t}get isEnabled(){const t=qg?.protocol;if(t!=="http:"&&t!=="https:")return AD.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=Ea(this.vf)?this.vf.web_vitals:My(this.vf)?this.vf:void 0;return My(e)?e:this.Vv}startIfEnabled(){this.isEnabled&&!this.ko&&(AD.info("enabled, starting..."),this.zo(this.hf))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const n=Ea(e.capturePerformance)&&!!e.capturePerformance.web_vitals,o=Ea(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ixe]:n}),this._instance.persistence.register({[$At]:o})),this.Vv=n,this.startIfEnabled()}get df(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(t){var e;const n=Yr.__PosthogExtensions__,o=this.df,i=n?.postHogWebVitalsCallbacksByFlavor;i?.[o]||o==="web-vitals"&&Eo(i)&&n?.postHogWebVitalsCallbacks?t():n==null||(e=n.loadExternalDependency)===null||e===void 0||e.call(n,this._instance,o,r=>{r?AD.error("failed to load script",r):t()})}uf(t){const e=t||jn?.location.href;if(!e)return void AD.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?MQ(e):e,o=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...uF,...o||[]]:[];return Jz(n,i,Wz)}}},nMn={exceptionObserver:class{constructor(t){var e;this.hf=()=>{var n;if(!jn||!this.isEnabled||!(!((n=Yr.__PosthogExtensions__)===null||n===void 0)&&n.errorWrappingFunctions))return;const o=Yr.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Yr.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=Yr.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ff&&this.Mr.capture_unhandled_errors&&(this.ff=o(this.captureException.bind(this))),!this.pf&&this.Mr.capture_unhandled_rejections&&(this.pf=i(this.captureException.bind(this))),!this.gf&&this.Mr.capture_console_errors&&(this.gf=r(this.captureException.bind(this)))}catch(s){iV.error("failed to start",s),this.mf()}},this._instance=t,this.yf=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[_xe]),this.wt=new EQn(Zt(Zt({},(function(n={}){var o,i,r,s;return{refillRate:(o=(i=n.exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:n.__exceptionRateLimiterRefillRate)!==null&&o!==void 0?o:1,bucketSize:(r=(s=n.exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:n.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,A:iV})),this.Mr=this.bf(),this.startIfEnabledOrStop()}bf(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ea(t)?e=Zt(Zt({},e),t):(Eo(t)?this.yf:t)&&(e=Zt(Zt({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(iV.info("enabled"),this.mf(),this.zo(this.hf)):this.mf()}zo(t){var e,n,o;!((e=Yr.__PosthogExtensions__)===null||e===void 0)&&e.errorWrappingFunctions?t():(n=Yr.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"exception-autocapture",i=>{if(i)return iV.error("failed to load script",i);t()})}mf(){var t,e,n;(t=this.ff)===null||t===void 0||t.call(this),this.ff=void 0,(e=this.pf)===null||e===void 0||e.call(this),this.pf=void 0,(n=this.gf)===null||n===void 0||n.call(this),this.gf=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.yf=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[_xe]:this.yf}),this.Mr=this.bf(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.bf()}captureException(t){try{var e,n,o;const i=(e=t==null||(n=t.$exception_list)===null||n===void 0||(n=n[0])===null||n===void 0?void 0:n.type)!==null&&e!==void 0?e:"Exception";if(this.wt.consumeRateLimit(i))return void iV.info("Skipping exception capture because of client rate limiting.",{exception:i});(o=this._instance.exceptions)===null||o===void 0||o.sendExceptionEvent(t)}catch{}}},exceptions:class{constructor(t){var e,n;this._f=[],this.wf=new TQn([new qQn,new rvn,new XQn,new $Qn,new ovn,new nvn,new evn,new ivn],(function(o,...i){return(r,s=0)=>{const a=[],A=r.split(`
239
+ root.render(<App />);`),v.unstable_strictMode===!0&&(L=!0),v.identifierPrefix!==void 0&&(W=v.identifierPrefix),v.onUncaughtError!==void 0&&(se=v.onUncaughtError),v.onCaughtError!==void 0&&(fe=v.onCaughtError),v.onRecoverableError!==void 0&&(Ve=v.onRecoverableError),v.unstable_transitionCallbacks!==void 0&&(st=v.unstable_transitionCallbacks)),v=kt(b,1,!1,null,null,L,W,se,fe,Ve,st,null),b[X0]=v.current,m5(b),new Z1(v)},xz.hydrateRoot=function(b,v,L){if(!_(b))throw Error("Target container is not a DOM element.");hm(b),v===void 0&&console.error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var W=!1,se="",fe=F4,Ve=J0,st=Tp,Mt=null,Jt=null;return L!=null&&(L.unstable_strictMode===!0&&(W=!0),L.identifierPrefix!==void 0&&(se=L.identifierPrefix),L.onUncaughtError!==void 0&&(fe=L.onUncaughtError),L.onCaughtError!==void 0&&(Ve=L.onCaughtError),L.onRecoverableError!==void 0&&(st=L.onRecoverableError),L.unstable_transitionCallbacks!==void 0&&(Mt=L.unstable_transitionCallbacks),L.formState!==void 0&&(Jt=L.formState)),v=kt(b,1,!0,v,L??null,W,se,fe,Ve,st,Mt,Jt),v.context=gn(null),L=v.current,W=Vd(L),W=rt(W),se=im(W),se.callback=null,I0(L,se,W),L=W,v.current.lanes=L,Le(v,L),Eu(v),b[X0]=v.current,m5(b),new K_(v)},xz.version="19.1.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})(),xz}var Cst;function Lbn(){if(Cst)return Cne.exports;Cst=1;var t={env:{}};function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(t.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}}return t.env.NODE_ENV==="production"?(e(),Cne.exports=kbn()):Cne.exports=Fbn(),Cne.exports}var Hbn=Lbn(),ee=Y3();const ks=BC(ee),P5=mx({__proto__:null,default:ks},[ee]);var Obn=Object.defineProperty,Vk=(t,e)=>Obn(t,"name",{value:e,configurable:!0}),yst=!!(typeof window<"u"&&window.document&&window.document.createElement);function _r(t,e,{checkForDefaultPrevented:n=!0}={}){return Vk(function(i){if(t?.(i),n===!1||!i||!i.defaultPrevented)return e?.(i)},"handleEvent")}Vk(_r,"composeEventHandlers");function Gbn(t){if(!yst)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}Vk(Gbn,"getOwnerWindow");function _2e(t){if(!yst)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}Vk(_2e,"getOwnerDocument");function xst(t,e=!1){const{activeElement:n}=_2e(t);if(!n?.nodeName)return null;if(Est(n)&&n.contentDocument)return xst(n.contentDocument.body,e);if(e){const o=n.getAttribute("aria-activedescendant");if(o){const i=_2e(n).getElementById(o);if(i)return i}}return n}Vk(xst,"getActiveElement");function Est(t){return t.tagName==="IFRAME"}Vk(Est,"isFrame");var Ybn=Object.defineProperty,M5=(t,e)=>Ybn(t,"name",{value:e,configurable:!0});function Ubn(t,e){const n=ee.createContext(e);n.displayName=t+"Context";const o=M5(r=>{const{children:s,...a}=r,A=ee.useMemo(()=>a,Object.values(a));return z.jsx(n.Provider,{value:A,children:s})},"Provider");o.displayName=t+"Provider";function i(r,s={}){const{optional:a=!1}=s,A=ee.useContext(n);if(A)return A;if(e!==void 0)return e;if(!a)throw new Error(`\`${r}\` must be used within \`${t}\``)}return M5(i,"useContext"),[o,i]}M5(Ubn,"createContext");function U3(t,e=[]){let n=[];function o(r,s){const a=ee.createContext(s);a.displayName=r+"Context";const A=n.length;n=[...n,s];const c=M5(g=>{const{scope:u,children:h,...d}=g,m=u?.[t]?.[A]||a,p=ee.useMemo(()=>d,Object.values(d));return z.jsx(m.Provider,{value:p,children:h})},"Provider");c.displayName=r+"Provider";function l(g,u,h={}){const{optional:d=!1}=h,m=u?.[t]?.[A]||a,p=ee.useContext(m);if(p)return p;if(s!==void 0)return s;if(!d)throw new Error(`\`${g}\` must be used within \`${r}\``)}return M5(l,"useContext"),[c,l]}M5(o,"createContext");const i=M5(()=>{const r=n.map(s=>ee.createContext(s));return M5(function(a){const A=a?.[t]||r;return ee.useMemo(()=>({[`__scope${t}`]:{...a,[t]:A}}),[a,A])},"useScope")},"createScope");return i.scopeName=t,[o,Bst(i,...e)]}M5(U3,"createContextScope");function Bst(...t){const e=t[0];if(t.length===1)return e;const n=M5(()=>{const o=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return M5(function(r){const s=o.reduce((a,{useScope:A,scopeName:c})=>{const g=A(r)[`__scope${c}`];return{...a,...g}},{});return ee.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}M5(Bst,"composeContextScopes");var Kbn=Object.defineProperty,f2e=(t,e)=>Kbn(t,"name",{value:e,configurable:!0});function I2e(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}f2e(I2e,"setRef");function bst(...t){return e=>{let n=!1;const o=t.map(i=>{const r=I2e(i,e);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let i=0;i<o.length;i++){const r=o[i];typeof r=="function"?r():I2e(t[i],null)}}}}f2e(bst,"composeRefs");function lc(...t){return ee.useCallback(bst(...t),t)}f2e(lc,"useComposedRefs");var zbn=Object.defineProperty,D5=(t,e)=>zbn(t,"name",{value:e,configurable:!0});function G9(t){const e=ee.forwardRef((n,o)=>{let{children:i,...r}=n,s=null,a=!1;const A=[];C2e(i)&&typeof Bne=="function"&&(i=Bne(i._payload)),ee.Children.forEach(i,u=>{if(Pst(u)){a=!0;const h=u;let d="child"in h.props?h.props.child:h.props.children;C2e(d)&&typeof Bne=="function"&&(d=Bne(d._payload)),s=Jbn(h,d),A.push(s?.props?.children)}else A.push(u)}),s?s=ee.cloneElement(s,void 0,A):!a&&ee.Children.count(i)===1&&ee.isValidElement(i)&&(s=i);const c=s?wst(s):void 0,l=lc(o,c);if(!s){if(i||i===0)throw new Error(a?qbn(t):jbn(t));return i}const g=vst(r,s.props??{});return s.type!==ee.Fragment&&(g.ref=o?l:c),ee.cloneElement(s,g)});return e.displayName=`${t}.Slot`,e}D5(G9,"createSlot");var Vbn=G9("Slot"),Sst=Symbol.for("radix.slottable");function Qst(t){const e=D5(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=Sst,e}D5(Qst,"createSlottable");var Jbn=D5((t,e)=>{if("child"in t.props){const n=t.props.child;return ee.isValidElement(n)?ee.cloneElement(n,void 0,t.props.children(n.props.children)):null}return ee.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function vst(t,e){const n={...e};for(const o in e){const i=t[o],r=e[o];/^on[A-Z]/.test(o)?i&&r?n[o]=(...a)=>{const A=r(...a);return i(...a),A}:i&&(n[o]=i):o==="style"?n[o]={...i,...r}:o==="className"?n[o]=[i,r].filter(Boolean).join(" "):o==="aria-describedby"&&(n[o]=Dst(r,i))}return{...t,...n}}D5(vst,"mergeProps");function wst(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}D5(wst,"getElementRef");function Pst(t){return ee.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Sst}D5(Pst,"isSlottable");var Wbn=Symbol.for("react.lazy");function C2e(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===Wbn&&"_payload"in t&&Mst(t._payload)}D5(C2e,"isLazyComponent");function Mst(t){return typeof t=="object"&&t!==null&&"then"in t}D5(Mst,"isPromiseLike");function Dst(...t){const e=new Set;for(const n of t)if(typeof n=="string")for(const o of String(n).trim().split(/\s+/))o&&e.add(o);return e.size>0?Array.from(e).join(" "):void 0}D5(Dst,"concatAriaDescribedby");var jbn=D5(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),qbn=D5(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Bne=P5[" use ".trim().toString()],$bn=Object.defineProperty,i1=(t,e)=>$bn(t,"name",{value:e,configurable:!0});function bne(t){const e=t+"CollectionProvider",[n,o]=U3(e),[i,r]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=i1(m=>{const{scope:p,children:_}=m,f=ee.useRef(null),I=ee.useRef(new Map).current;return z.jsx(i,{scope:p,itemMap:I,collectionRef:f,children:_})},"CollectionProvider");s.displayName=e;const a=t+"CollectionSlot",A=G9(a),c=ee.forwardRef((m,p)=>{const{scope:_,children:f}=m,I=r(a,_),C=lc(p,I.collectionRef);return z.jsx(A,{ref:C,children:f})});c.displayName=a;const l=t+"CollectionItemSlot",g="data-radix-collection-item",u=G9(l),h=ee.forwardRef((m,p)=>{const{scope:_,children:f,...I}=m,C=ee.useRef(null),y=lc(p,C),x=r(l,_);return ee.useEffect(()=>(x.itemMap.set(C,{ref:C,...I}),()=>{x.itemMap.delete(C)})),z.jsx(u,{[g]:"",ref:y,children:f})});h.displayName=l;function d(m){const p=r(t+"CollectionConsumer",m);return ee.useCallback(()=>{const f=p.collectionRef.current;if(!f)return[];const I=Array.from(f.querySelectorAll(`[${g}]`));return Array.from(p.itemMap.values()).sort((x,E)=>I.indexOf(x.ref.current)-I.indexOf(E.ref.current))},[p.collectionRef,p.itemMap])}return i1(d,"useCollection"),[{Provider:s,Slot:c,ItemSlot:h},d,o]}i1(bne,"createCollection");var Nst=new WeakMap,y2e=(JE=class extends Map{constructor(n){super(n);Ort(this,Q_);one(this,Q_,[...super.keys()]),Nst.set(this,!0)}set(n,o){return Nst.get(this)&&(this.has(n)?Q0(this,Q_)[Q0(this,Q_).indexOf(n)]=n:Q0(this,Q_).push(n)),super.set(n,o),this}insert(n,o,i){const r=this.has(o),s=Q0(this,Q_).length,a=x2e(n);let A=a>=0?a:s+a;const c=A<0||A>=s?-1:A;if(c===this.size||r&&c===this.size-1||c===-1)return this.set(o,i),this;const l=this.size+(r?0:1);a<0&&A++;const g=[...Q0(this,Q_)];let u,h=!1;for(let d=A;d<l;d++)if(A===d){let m=g[d];g[d]===o&&(m=g[d+1]),r&&this.delete(o),u=this.get(m),this.set(o,i)}else{!h&&g[d-1]===o&&(h=!0);const m=g[h?d:d-1],p=u;u=this.get(m),this.delete(m),this.set(m,p)}return this}with(n,o,i){const r=new JE(this);return r.insert(n,o,i),r}before(n){const o=Q0(this,Q_).indexOf(n)-1;if(!(o<0))return this.entryAt(o)}setBefore(n,o,i){const r=Q0(this,Q_).indexOf(n);return r===-1?this:this.insert(r,o,i)}after(n){let o=Q0(this,Q_).indexOf(n);if(o=o===-1||o===this.size-1?-1:o+1,o!==-1)return this.entryAt(o)}setAfter(n,o,i){const r=Q0(this,Q_).indexOf(n);return r===-1?this:this.insert(r+1,o,i)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return one(this,Q_,[]),super.clear()}delete(n){const o=super.delete(n);return o&&Q0(this,Q_).splice(Q0(this,Q_).indexOf(n),1),o}deleteAt(n){const o=this.keyAt(n);return o!==void 0?this.delete(o):!1}at(n){const o=Sne(Q0(this,Q_),n);if(o!==void 0)return this.get(o)}entryAt(n){const o=Sne(Q0(this,Q_),n);if(o!==void 0)return[o,this.get(o)]}indexOf(n){return Q0(this,Q_).indexOf(n)}keyAt(n){return Sne(Q0(this,Q_),n)}from(n,o){const i=this.indexOf(n);if(i===-1)return;let r=i+o;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(n,o){const i=this.indexOf(n);if(i===-1)return;let r=i+o;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(n,o){let i=0;for(const r of this){if(Reflect.apply(n,o,[r,i,this]))return r;i++}}findIndex(n,o){let i=0;for(const r of this){if(Reflect.apply(n,o,[r,i,this]))return i;i++}return-1}filter(n,o){const i=[];let r=0;for(const s of this)Reflect.apply(n,o,[s,r,this])&&i.push(s),r++;return new JE(i)}map(n,o){const i=[];let r=0;for(const s of this)i.push([s[0],Reflect.apply(n,o,[s,r,this])]),r++;return new JE(i)}reduce(...n){const[o,i]=n;let r=0,s=i??this.at(0);for(const a of this)r===0&&n.length===1?s=a:s=Reflect.apply(o,this,[s,a,r,this]),r++;return s}reduceRight(...n){const[o,i]=n;let r=i??this.at(-1);for(let s=this.size-1;s>=0;s--){const a=this.at(s);s===this.size-1&&n.length===1?r=a:r=Reflect.apply(o,this,[r,a,s,this])}return r}toSorted(n){const o=[...this.entries()].sort(n);return new JE(o)}toReversed(){const n=new JE;for(let o=this.size-1;o>=0;o--){const i=this.keyAt(o),r=this.get(i);n.set(i,r)}return n}toSpliced(...n){const o=[...this.entries()];return o.splice(...n),new JE(o)}slice(n,o){const i=new JE;let r=this.size-1;if(n===void 0)return i;n<0&&(n=n+this.size),o!==void 0&&o>0&&(r=o-1);for(let s=n;s<=r;s++){const a=this.keyAt(s),A=this.get(a);i.set(a,A)}return i}every(n,o){let i=0;for(const r of this){if(!Reflect.apply(n,o,[r,i,this]))return!1;i++}return!0}some(n,o){let i=0;for(const r of this){if(Reflect.apply(n,o,[r,i,this]))return!0;i++}return!1}},Q_=new WeakMap,i1(JE,"OrderedDict"),JE);function Sne(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=Rst(t,e);return n===-1?void 0:t[n]}i1(Sne,"at");function Rst(t,e){const n=t.length,o=x2e(e),i=o>=0?o:n+o;return i<0||i>=n?-1:i}i1(Rst,"toSafeIndex");function x2e(t){return t!==t||t===0?0:Math.trunc(t)}i1(x2e,"toSafeInteger");function Xbn(t){const e=t+"CollectionProvider",[n,o]=U3(e),[i,r]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new y2e,setItemMap:i1(()=>{},"setItemMap")}),s=i1(({state:I,...C})=>I?z.jsx(A,{...C,state:I}):z.jsx(a,{...C}),"CollectionProvider");s.displayName=e;const a=i1(I=>{const C=p();return z.jsx(A,{...I,state:C})},"CollectionInit");a.displayName=e+"Init";const A=i1(I=>{const{scope:C,children:y,state:x}=I,E=ee.useRef(null),[B,S]=ee.useState(null),Q=lc(E,S),[w,M]=x;return ee.useEffect(()=>{if(!B)return;const T=Fst(()=>{});return T.observe(B,{childList:!0,subtree:!0}),()=>{T.disconnect()}},[B]),z.jsx(i,{scope:C,itemMap:w,setItemMap:M,collectionRef:Q,collectionRefObject:E,collectionElement:B,children:y})},"CollectionProviderImpl");A.displayName=e+"Impl";const c=t+"CollectionSlot",l=G9(c),g=ee.forwardRef((I,C)=>{const{scope:y,children:x}=I,E=r(c,y),B=lc(C,E.collectionRef);return z.jsx(l,{ref:B,children:x})});g.displayName=c;const u=t+"CollectionItemSlot",h="data-radix-collection-item",d=G9(u),m=ee.forwardRef((I,C)=>{const{scope:y,children:x,...E}=I,B=ee.useRef(null),[S,Q]=ee.useState(null),w=lc(C,B,Q),M=r(u,y),{setItemMap:T}=M,R=ee.useRef(E);Tst(R.current,E)||(R.current=E);const F=R.current;return ee.useEffect(()=>{const O=F;return T(U=>S?U.has(S)?U.set(S,{...O,element:S}).toSorted(E2e):(U.set(S,{...O,element:S}),U.toSorted(E2e)):U),()=>{T(U=>!S||!U.has(S)?U:(U.delete(S),new y2e(U)))}},[S,F,T]),z.jsx(d,{[h]:"",ref:w,children:x})});m.displayName=u;function p(){return ee.useState(new y2e)}i1(p,"useInitCollection");function _(I){const{itemMap:C}=r(t+"CollectionConsumer",I);return C}return i1(_,"useCollection"),[{Provider:s,Slot:g,ItemSlot:m},{createCollectionScope:o,useCollection:_,useInitCollection:p}]}i1(Xbn,"createCollection");function Tst(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;const n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(e,i)||t[i]!==e[i])return!1;return!0}i1(Tst,"shallowEqual");function kst(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}i1(kst,"isElementPreceding");function E2e(t,e){return!t[1].element||!e[1].element?0:kst(t[1].element,e[1].element)?-1:1}i1(E2e,"sortByDocumentPosition");function Fst(t){return new MutationObserver(n=>{for(const o of n)if(o.type==="childList"){t();return}})}i1(Fst,"getChildListObserver");var Cm=globalThis?.document?ee.useLayoutEffect:()=>{},Zbn=Object.defineProperty,eSn=(t,e)=>Zbn(t,"name",{value:e,configurable:!0}),tSn=P5[" useId ".trim().toString()]||(()=>{}),nSn=0;function K3(t){const[e,n]=ee.useState(tSn());return Cm(()=>{t||n(o=>o??String(nSn++))},[t]),t||(e?`radix-${e}`:"")}eSn(K3,"useId");var Y9=p2e();const Lst=BC(Y9);var oSn=Object.defineProperty,iSn=(t,e)=>oSn(t,"name",{value:e,configurable:!0}),rSn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],gc=rSn.reduce((t,e)=>{const n=G9(`Primitive.${e}`),o=ee.forwardRef((i,r)=>{const{asChild:s,...a}=i,A=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),z.jsx(A,{...a,ref:r})});return o.displayName=`Primitive.${e}`,{...t,[e]:o}},{});function B2e(t,e){t&&Y9.flushSync(()=>t.dispatchEvent(e))}iSn(B2e,"dispatchDiscreteCustomEvent");var sSn=Object.defineProperty,aSn=(t,e)=>sSn(t,"name",{value:e,configurable:!0});function z3(t){const e=ee.useRef(t);return ee.useEffect(()=>{e.current=t}),ee.useMemo(()=>((...n)=>e.current?.(...n)),[])}aSn(z3,"useCallbackRef");var ASn=Object.defineProperty,cSn=(t,e)=>ASn(t,"name",{value:e,configurable:!0}),Hst=P5[" useEffectEvent ".trim().toString()],Ost=P5[" useInsertionEffect ".trim().toString()];function Gst(t){if(typeof Hst=="function")return Hst(t);const e=ee.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Ost=="function"?Ost(()=>{e.current=t}):Cm(()=>{e.current=t}),ee.useMemo(()=>((...n)=>e.current?.(...n)),[])}cSn(Gst,"useEffectEvent");var lSn=Object.defineProperty,Ez=(t,e)=>lSn(t,"name",{value:e,configurable:!0}),gSn=P5[" useInsertionEffect ".trim().toString()]||Cm;function U9({prop:t,defaultProp:e,onChange:n=Ez(()=>{},"onChange"),caller:o}){const[i,r,s]=Yst({defaultProp:e,onChange:n}),a=t!==void 0,A=a?t:i,c=ee.useCallback(l=>{if(a){const g=Ust(l)?l(t):l;g!==t&&s.current?.(g)}else r(l)},[a,t,r,s]);return[A,c]}Ez(U9,"useControllableState");function Yst({defaultProp:t,onChange:e}){const[n,o]=ee.useState(t),i=ee.useRef(n),r=ee.useRef(e);return gSn(()=>{r.current=e},[e]),ee.useEffect(()=>{i.current!==n&&(r.current?.(n),i.current=n)},[n,i]),[n,o,r]}Ez(Yst,"useUncontrolledState");function Ust(t){return typeof t=="function"}Ez(Ust,"isFunction");var Kst=Symbol("RADIX:SYNC_STATE");function uSn(t,e,n,o){const{prop:i,defaultProp:r,onChange:s,caller:a}=e,A=i!==void 0,c=Gst(s),l=[{...n,state:r}];o&&l.push(o);const[g,u]=ee.useReducer((p,_)=>{if(_.type===Kst)return{...p,state:_.state};const f=t(p,_);return A&&!Object.is(f.state,p.state)&&c(f.state),f},...l),h=g.state,d=ee.useRef(h);ee.useEffect(()=>{d.current!==h&&(d.current=h,A||c(h))},[h,d,A]);const m=ee.useMemo(()=>i!==void 0?{...g,state:i}:g,[g,i]);return ee.useEffect(()=>{A&&!Object.is(i,g.state)&&u({type:Kst,state:i})},[i,g.state,A]),[m,u]}Ez(uSn,"useControllableStateReducer");var dSn=Object.defineProperty,hSn=(t,e)=>dSn(t,"name",{value:e,configurable:!0}),mSn={LTR:"ltr"},pSn=ee.createContext(void 0);function Bz(t){const e=ee.useContext(pSn);return t||e||mSn.LTR}hSn(Bz,"useDirection");var _Sn=Object.defineProperty,b2e=(t,e)=>_Sn(t,"name",{value:e,configurable:!0}),S2e=!1;function zst(){const[t,e]=ee.useState(S2e);return ee.useEffect(()=>{S2e||(S2e=!0,e(!0))},[]),t}b2e(zst,"useIsHydrated");var Vst=P5[" useSyncExternalStore ".trim().toString()];function Jst(){return()=>{}}b2e(Jst,"subscribe");function Wst(){return Vst(Jst,()=>!0,()=>!1)}b2e(Wst,"useIsHydratedModern");var fSn=typeof Vst=="function"?Wst:zst,ISn=Object.defineProperty,ZM=(t,e)=>ISn(t,"name",{value:e,configurable:!0}),Q2e="rovingFocusGroup.onEntryFocus",CSn={bubbles:!1,cancelable:!0},Qne="RovingFocusGroup",[v2e,jst,ySn]=bne(Qne),[xSn,vne]=U3(Qne,[ySn]),qst={Vertical:"vertical",Horizontal:"horizontal"},ESn={RTL:"rtl"},[BSn,bSn]=xSn(Qne),$st=ee.forwardRef(ZM(function(e,n){return z.jsx(v2e.Provider,{scope:e.__scopeRovingFocusGroup,children:z.jsx(v2e.Slot,{scope:e.__scopeRovingFocusGroup,children:z.jsx(SSn,{...e,ref:n})})})},"RovingFocusGroup")),SSn=ee.forwardRef(ZM(function(e,n){const{__scopeRovingFocusGroup:o,orientation:i,loop:r=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:A,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:g=!1,...u}=e,h=ee.useRef(null),d=lc(n,h),m=Bz(s),[p,_]=U9({prop:a,defaultProp:A??null,onChange:c,caller:Qne}),[f,I]=ee.useState(!1),C=z3(l),y=jst(o),x=ee.useRef(!1),[E,B]=ee.useState(0);return ee.useEffect(()=>{const S=h.current;if(S)return S.addEventListener(Q2e,C),()=>S.removeEventListener(Q2e,C)},[C]),z.jsx(BSn,{scope:o,orientation:i,dir:m,loop:r,currentTabStopId:p,onItemFocus:ee.useCallback(S=>_(S),[_]),onItemShiftTab:ee.useCallback(()=>I(!0),[]),onFocusableItemAdd:ee.useCallback(()=>B(S=>S+1),[]),onFocusableItemRemove:ee.useCallback(()=>B(S=>S-1),[]),children:z.jsx(gc.div,{tabIndex:f||E===0?-1:0,"data-orientation":i,...u,ref:d,style:{outline:"none",...e.style},onMouseDown:_r(e.onMouseDown,()=>{x.current=!0}),onFocus:_r(e.onFocus,S=>{const Q=!x.current;if(S.target===S.currentTarget&&Q&&!f){const w=new CustomEvent(Q2e,CSn);if(S.currentTarget.dispatchEvent(w),!w.defaultPrevented){const M=y().filter(U=>U.focusable),T=M.find(U=>U.active),R=M.find(U=>U.id===p),O=[T,R,...M].filter(Boolean).map(U=>U.ref.current);w2e(O,g)}}x.current=!1}),onBlur:_r(e.onBlur,()=>I(!1))})})},"RovingFocusGroupImpl")),QSn="RovingFocusGroupItem",Xst=ee.forwardRef(ZM(function(e,n){const{__scopeRovingFocusGroup:o,focusable:i=!0,active:r=!1,tabStopId:s,children:a,...A}=e,c=K3(),l=s||c,g=bSn(QSn,o),u=g.currentTabStopId===l,h=jst(o),{onFocusableItemAdd:d,onFocusableItemRemove:m,currentTabStopId:p}=g,_=fSn();return Cm(()=>{if(!(!_||!i))return d(),()=>m()},[_,i,d,m]),ee.useEffect(()=>{if(!(_||!i))return d(),()=>m()},[_,i,d,m]),z.jsx(v2e.ItemSlot,{scope:o,id:l,focusable:i,active:r,children:z.jsx(gc.span,{tabIndex:u?0:-1,"data-orientation":g.orientation,...A,ref:n,onMouseDown:_r(e.onMouseDown,f=>{i?g.onItemFocus(l):f.preventDefault()}),onFocus:_r(e.onFocus,()=>g.onItemFocus(l)),onKeyDown:_r(e.onKeyDown,f=>{if(f.key==="Tab"&&f.shiftKey){g.onItemShiftTab();return}if(f.target!==f.currentTarget)return;const I=eat(f,g.orientation,g.dir);if(I!==void 0){if(f.metaKey||f.ctrlKey||f.altKey||f.shiftKey)return;f.preventDefault();let y=h().filter(x=>x.focusable).map(x=>x.ref.current);if(I==="last")y.reverse();else if(I==="prev"||I==="next"){I==="prev"&&y.reverse();const x=y.indexOf(f.currentTarget);y=g.loop?tat(y,x+1):y.slice(x+1)}setTimeout(()=>w2e(y))}}),children:typeof a=="function"?a({isCurrentTabStop:u,hasTabStop:p!=null}):a})})},"RovingFocusGroupItem")),vSn={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Zst(t,e){return e!==ESn.RTL?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}ZM(Zst,"getDirectionAwareKey");function eat(t,e,n){const o=Zst(t.key,n);if(!(e===qst.Vertical&&["ArrowLeft","ArrowRight"].includes(o))&&!(e===qst.Horizontal&&["ArrowUp","ArrowDown"].includes(o)))return vSn[o]}ZM(eat,"getFocusIntent");function w2e(t,e=!1){const n=document.activeElement;for(const o of t)if(o===n||(o.focus({preventScroll:e}),document.activeElement!==n))return}ZM(w2e,"focusFirst");function tat(t,e){return t.map((n,o)=>t[(e+o)%t.length])}ZM(tat,"wrapArray");var wSn=Object.defineProperty,O8=(t,e)=>wSn(t,"name",{value:e,configurable:!0});function nat(t,e){return ee.useReducer((n,o)=>e[n][o]??n,t)}O8(nat,"useStateMachine");var $4=O8(t=>{const{present:e,children:n}=t,o=oat(e),i=typeof n=="function"?n({present:o.isPresent}):ee.Children.only(n),r=iat(o.ref,rat(i));return typeof n=="function"||o.isPresent?ee.cloneElement(i,{ref:r}):null},"Presence");function oat(t){const[e,n]=ee.useState(),o=ee.useRef(null),i=ee.useRef(t),r=ee.useRef("none"),s=ee.useRef(void 0),a=t?"mounted":"unmounted",[A,c]=nat(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return ee.useEffect(()=>{A==="mounted"?(r.current=s.current??Jk(o.current),s.current=void 0):r.current="none"},[A]),Cm(()=>{const l=o.current,g=i.current;if(g!==t){const h=r.current,d=Jk(l);t?(s.current=d,c("MOUNT")):d==="none"||l?.display==="none"?c("UNMOUNT"):c(g&&h!==d?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,c]),Cm(()=>{if(e){let l;const g=e.ownerDocument.defaultView??window,u=O8(d=>{const p=Jk(o.current).includes(CSS.escape(d.animationName));if(d.target===e&&p&&(c("ANIMATION_END"),!i.current)){const _=e.style.animationFillMode;e.style.animationFillMode="forwards",l=g.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=_)})}},"handleAnimationEnd"),h=O8(d=>{d.target===e&&(r.current=Jk(o.current))},"handleAnimationStart");return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",u),e.addEventListener("animationend",u),()=>{g.clearTimeout(l),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",u),e.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(A),ref:ee.useCallback(l=>{if(l){const g=getComputedStyle(l);o.current=g,s.current=Jk(g)}else o.current=null;n(l)},[])}}O8(oat,"usePresence");function P2e(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}O8(P2e,"setRef");function iat(...t){const e=ee.useRef(t);return e.current=t,ee.useCallback(n=>{const o=e.current;let i=!1;const r=o.map(s=>{const a=P2e(s,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let s=0;s<r.length;s++){const a=r[s];typeof a=="function"?a():P2e(o[s],null)}}},[])}O8(iat,"useStableComposedRefs");function Jk(t){return t?.animationName||"none"}O8(Jk,"getAnimationName");function rat(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}O8(rat,"getElementRef");var PSn=Object.defineProperty,Wk=(t,e)=>PSn(t,"name",{value:e,configurable:!0}),sat={Automatic:"automatic",Manual:"manual"},M2e="Tabs",[MSn,N1r]=U3(M2e,[vne]),aat=vne(),[DSn,D2e]=MSn(M2e),NSn=ee.forwardRef(Wk(function(e,n){const{__scopeTabs:o,value:i,onValueChange:r,defaultValue:s,orientation:a="horizontal",dir:A,activationMode:c=sat.Automatic,...l}=e,g=Bz(A),[u,h]=U9({prop:i,onChange:r,defaultProp:s??"",caller:M2e});return z.jsx(DSn,{scope:o,baseId:K3(),value:u,onValueChange:h,orientation:a,dir:g,activationMode:c,children:z.jsx(gc.div,{dir:g,"data-orientation":a,...l,ref:n})})},"Tabs")),RSn="TabsList",Aat=ee.forwardRef(Wk(function(e,n){const{__scopeTabs:o,loop:i=!0,...r}=e,s=D2e(RSn,o),a=aat(o);return z.jsx($st,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:i,children:z.jsx(gc.div,{role:"tablist","aria-orientation":s.orientation,...r,ref:n})})},"TabsList")),TSn="TabsTrigger",cat=ee.forwardRef(Wk(function(e,n){const{__scopeTabs:o,value:i,disabled:r=!1,...s}=e,a=D2e(TSn,o),A=aat(o),c=N2e(a.baseId,i),l=R2e(a.baseId,i),g=i===a.value;return z.jsx(Xst,{asChild:!0,...A,focusable:!r,active:g,children:z.jsx(gc.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":l,"data-state":g?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:c,...s,ref:n,onMouseDown:_r(e.onMouseDown,u=>{!r&&u.button===0&&u.ctrlKey===!1?(u.currentTarget.focus(),a.onValueChange(i)):u.preventDefault()}),onKeyDown:_r(e.onKeyDown,u=>{r||u.target!==u.currentTarget||[" ","Enter"].includes(u.key)&&a.onValueChange(i)}),onFocus:_r(e.onFocus,()=>{const u=a.activationMode!==sat.Manual;!g&&!r&&u&&a.onValueChange(i)})})})},"TabsTrigger")),kSn="TabsContent",lat=ee.forwardRef(Wk(function(e,n){const{__scopeTabs:o,value:i,forceMount:r,children:s,...a}=e,A=D2e(kSn,o),c=N2e(A.baseId,i),l=R2e(A.baseId,i),g=i===A.value,u=ee.useRef(g);return ee.useEffect(()=>{const h=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(h)},[]),z.jsx($4,{present:r||g,children:({present:h})=>z.jsx(gc.div,{"data-state":g?"active":"inactive","data-orientation":A.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:l,tabIndex:0,...a,ref:n,style:{...e.style,animationDuration:u.current?"0s":void 0},children:h&&s})})},"TabsContent"));function N2e(t,e){return`${t}-trigger-${e}`}Wk(N2e,"makeTriggerId");function R2e(t,e){return`${t}-content-${e}`}Wk(R2e,"makeContentId");function gat(t){var e,n,o="";if(typeof t=="string"||typeof t=="number")o+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=gat(t[e]))&&(o&&(o+=" "),o+=n)}else for(n in t)t[n]&&(o&&(o+=" "),o+=n);return o}function X4(){for(var t,e,n=0,o="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=gat(t))&&(o&&(o+=" "),o+=e);return o}const T2e="-",FSn=t=>{const e=HSn(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=t;return{getClassGroupId:s=>{const a=s.split(T2e);return a[0]===""&&a.length!==1&&a.shift(),uat(a,e)||LSn(s)},getConflictingClassGroupIds:(s,a)=>{const A=n[s]||[];return a&&o[s]?[...A,...o[s]]:A}}},uat=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],o=e.nextPart.get(n),i=o?uat(t.slice(1),o):void 0;if(i)return i;if(e.validators.length===0)return;const r=t.join(T2e);return e.validators.find(({validator:s})=>s(r))?.classGroupId},dat=/^\[(.+)\]$/,LSn=t=>{if(dat.test(t)){const e=dat.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},HSn=t=>{const{theme:e,prefix:n}=t,o={nextPart:new Map,validators:[]};return GSn(Object.entries(t.classGroups),n).forEach(([r,s])=>{k2e(s,o,r,e)}),o},k2e=(t,e,n,o)=>{t.forEach(i=>{if(typeof i=="string"){const r=i===""?e:hat(e,i);r.classGroupId=n;return}if(typeof i=="function"){if(OSn(i)){k2e(i(o),e,n,o);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([r,s])=>{k2e(s,hat(e,r),n,o)})})},hat=(t,e)=>{let n=t;return e.split(T2e).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},OSn=t=>t.isThemeGetter,GSn=(t,e)=>e?t.map(([n,o])=>{const i=o.map(r=>typeof r=="string"?e+r:typeof r=="object"?Object.fromEntries(Object.entries(r).map(([s,a])=>[e+s,a])):r);return[n,i]}):t,YSn=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,o=new Map;const i=(r,s)=>{n.set(r,s),e++,e>t&&(e=0,o=n,n=new Map)};return{get(r){let s=n.get(r);if(s!==void 0)return s;if((s=o.get(r))!==void 0)return i(r,s),s},set(r,s){n.has(r)?n.set(r,s):i(r,s)}}},mat="!",USn=t=>{const{separator:e,experimentalParseClassName:n}=t,o=e.length===1,i=e[0],r=e.length,s=a=>{const A=[];let c=0,l=0,g;for(let p=0;p<a.length;p++){let _=a[p];if(c===0){if(_===i&&(o||a.slice(p,p+r)===e)){A.push(a.slice(l,p)),l=p+r;continue}if(_==="/"){g=p;continue}}_==="["?c++:_==="]"&&c--}const u=A.length===0?a:a.substring(l),h=u.startsWith(mat),d=h?u.substring(1):u,m=g&&g>l?g-l:void 0;return{modifiers:A,hasImportantModifier:h,baseClassName:d,maybePostfixModifierPosition:m}};return n?a=>n({className:a,parseClassName:s}):s},KSn=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(o=>{o[0]==="["?(e.push(...n.sort(),o),n=[]):n.push(o)}),e.push(...n.sort()),e},zSn=t=>({cache:YSn(t.cacheSize),parseClassName:USn(t),...FSn(t)}),VSn=/\s+/,JSn=(t,e)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:i}=e,r=[],s=t.trim().split(VSn);let a="";for(let A=s.length-1;A>=0;A-=1){const c=s[A],{modifiers:l,hasImportantModifier:g,baseClassName:u,maybePostfixModifierPosition:h}=n(c);let d=!!h,m=o(d?u.substring(0,h):u);if(!m){if(!d){a=c+(a.length>0?" "+a:a);continue}if(m=o(u),!m){a=c+(a.length>0?" "+a:a);continue}d=!1}const p=KSn(l).join(":"),_=g?p+mat:p,f=_+m;if(r.includes(f))continue;r.push(f);const I=i(m,d);for(let C=0;C<I.length;++C){const y=I[C];r.push(_+y)}a=c+(a.length>0?" "+a:a)}return a};function WSn(){let t=0,e,n,o="";for(;t<arguments.length;)(e=arguments[t++])&&(n=pat(e))&&(o&&(o+=" "),o+=n);return o}const pat=t=>{if(typeof t=="string")return t;let e,n="";for(let o=0;o<t.length;o++)t[o]&&(e=pat(t[o]))&&(n&&(n+=" "),n+=e);return n};function jSn(t,...e){let n,o,i,r=s;function s(A){const c=e.reduce((l,g)=>g(l),t());return n=zSn(c),o=n.cache.get,i=n.cache.set,r=a,a(A)}function a(A){const c=o(A);if(c)return c;const l=JSn(A,n);return i(A,l),l}return function(){return r(WSn.apply(null,arguments))}}const cd=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},_at=/^\[(?:([a-z-]+):)?(.+)\]$/i,qSn=/^\d+\/\d+$/,$Sn=new Set(["px","full","screen"]),XSn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ZSn=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,eQn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tQn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,nQn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,G8=t=>jk(t)||$Sn.has(t)||qSn.test(t),wQ=t=>qk(t,"length",lQn),jk=t=>!!t&&!Number.isNaN(Number(t)),F2e=t=>qk(t,"number",jk),bz=t=>!!t&&Number.isInteger(Number(t)),oQn=t=>t.endsWith("%")&&jk(t.slice(0,-1)),RA=t=>_at.test(t),PQ=t=>XSn.test(t),iQn=new Set(["length","size","percentage"]),rQn=t=>qk(t,iQn,fat),sQn=t=>qk(t,"position",fat),aQn=new Set(["image","url"]),AQn=t=>qk(t,aQn,uQn),cQn=t=>qk(t,"",gQn),Sz=()=>!0,qk=(t,e,n)=>{const o=_at.exec(t);return o?o[1]?typeof e=="string"?o[1]===e:e.has(o[1]):n(o[2]):!1},lQn=t=>ZSn.test(t)&&!eQn.test(t),fat=()=>!1,gQn=t=>tQn.test(t),uQn=t=>nQn.test(t),dQn=jSn(()=>{const t=cd("colors"),e=cd("spacing"),n=cd("blur"),o=cd("brightness"),i=cd("borderColor"),r=cd("borderRadius"),s=cd("borderSpacing"),a=cd("borderWidth"),A=cd("contrast"),c=cd("grayscale"),l=cd("hueRotate"),g=cd("invert"),u=cd("gap"),h=cd("gradientColorStops"),d=cd("gradientColorStopPositions"),m=cd("inset"),p=cd("margin"),_=cd("opacity"),f=cd("padding"),I=cd("saturate"),C=cd("scale"),y=cd("sepia"),x=cd("skew"),E=cd("space"),B=cd("translate"),S=()=>["auto","contain","none"],Q=()=>["auto","hidden","clip","visible","scroll"],w=()=>["auto",RA,e],M=()=>[RA,e],T=()=>["",G8,wQ],R=()=>["auto",jk,RA],F=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],O=()=>["solid","dashed","dotted","double","none"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>["start","end","center","between","around","evenly","stretch"],j=()=>["","0",RA],Z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],J=()=>[jk,RA];return{cacheSize:500,separator:":",theme:{colors:[Sz],spacing:[G8,wQ],blur:["none","",PQ,RA],brightness:J(),borderColor:[t],borderRadius:["none","","full",PQ,RA],borderSpacing:M(),borderWidth:T(),contrast:J(),grayscale:j(),hueRotate:J(),invert:j(),gap:M(),gradientColorStops:[t],gradientColorStopPositions:[oQn,wQ],inset:w(),margin:w(),opacity:J(),padding:M(),saturate:J(),scale:J(),sepia:j(),skew:J(),space:M(),translate:M()},classGroups:{aspect:[{aspect:["auto","square","video",RA]}],container:["container"],columns:[{columns:[PQ]}],"break-after":[{"break-after":Z()}],"break-before":[{"break-before":Z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...F(),RA]}],overflow:[{overflow:Q()}],"overflow-x":[{"overflow-x":Q()}],"overflow-y":[{"overflow-y":Q()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",bz,RA]}],basis:[{basis:w()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",RA]}],grow:[{grow:j()}],shrink:[{shrink:j()}],order:[{order:["first","last","none",bz,RA]}],"grid-cols":[{"grid-cols":[Sz]}],"col-start-end":[{col:["auto",{span:["full",bz,RA]},RA]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[Sz]}],"row-start-end":[{row:["auto",{span:[bz,RA]},RA]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",RA]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",RA]}],gap:[{gap:[u]}],"gap-x":[{"gap-x":[u]}],"gap-y":[{"gap-y":[u]}],"justify-content":[{justify:["normal",...Y()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Y(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Y(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[f]}],px:[{px:[f]}],py:[{py:[f]}],ps:[{ps:[f]}],pe:[{pe:[f]}],pt:[{pt:[f]}],pr:[{pr:[f]}],pb:[{pb:[f]}],pl:[{pl:[f]}],m:[{m:[p]}],mx:[{mx:[p]}],my:[{my:[p]}],ms:[{ms:[p]}],me:[{me:[p]}],mt:[{mt:[p]}],mr:[{mr:[p]}],mb:[{mb:[p]}],ml:[{ml:[p]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",RA,e]}],"min-w":[{"min-w":[RA,e,"min","max","fit"]}],"max-w":[{"max-w":[RA,e,"none","full","min","max","fit","prose",{screen:[PQ]},PQ]}],h:[{h:[RA,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[RA,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[RA,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[RA,e,"auto","min","max","fit"]}],"font-size":[{text:["base",PQ,wQ]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",F2e]}],"font-family":[{font:[Sz]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",RA]}],"line-clamp":[{"line-clamp":["none",jk,F2e]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",G8,RA]}],"list-image":[{"list-image":["none",RA]}],"list-style-type":[{list:["none","disc","decimal",RA]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",G8,wQ]}],"underline-offset":[{"underline-offset":["auto",G8,RA]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",RA]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",RA]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...F(),sQn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",rQn]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},AQn]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[d]}],"gradient-via-pos":[{via:[d]}],"gradient-to-pos":[{to:[d]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[r]}],"rounded-s":[{"rounded-s":[r]}],"rounded-e":[{"rounded-e":[r]}],"rounded-t":[{"rounded-t":[r]}],"rounded-r":[{"rounded-r":[r]}],"rounded-b":[{"rounded-b":[r]}],"rounded-l":[{"rounded-l":[r]}],"rounded-ss":[{"rounded-ss":[r]}],"rounded-se":[{"rounded-se":[r]}],"rounded-ee":[{"rounded-ee":[r]}],"rounded-es":[{"rounded-es":[r]}],"rounded-tl":[{"rounded-tl":[r]}],"rounded-tr":[{"rounded-tr":[r]}],"rounded-br":[{"rounded-br":[r]}],"rounded-bl":[{"rounded-bl":[r]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...O(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:O()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...O()]}],"outline-offset":[{"outline-offset":[G8,RA]}],"outline-w":[{outline:[G8,wQ]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:T()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[G8,wQ]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",PQ,cQn]}],"shadow-color":[{shadow:[Sz]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...U(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":U()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[o]}],contrast:[{contrast:[A]}],"drop-shadow":[{"drop-shadow":["","none",PQ,RA]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[l]}],invert:[{invert:[g]}],saturate:[{saturate:[I]}],sepia:[{sepia:[y]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[A]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[l]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[I]}],"backdrop-sepia":[{"backdrop-sepia":[y]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",RA]}],duration:[{duration:J()}],ease:[{ease:["linear","in","out","in-out",RA]}],delay:[{delay:J()}],animate:[{animate:["none","spin","ping","pulse","bounce",RA]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[bz,RA]}],"translate-x":[{"translate-x":[B]}],"translate-y":[{"translate-y":[B]}],"skew-x":[{"skew-x":[x]}],"skew-y":[{"skew-y":[x]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",RA]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",RA]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",RA]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[G8,wQ,F2e]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}),jn="u">typeof window?window:void 0,QC="u">typeof globalThis?globalThis:jn,X_=QC?.navigator,qo=QC?.document,qg=QC?.location,Qz=QC?.fetch,L2e=QC?.XMLHttpRequest&&"withCredentials"in new QC.XMLHttpRequest?QC.XMLHttpRequest:void 0,Iat=QC?.AbortController,hQn=QC?.CompressionStream,Py=X_?.userAgent,vz=typeof globalThis<"u"?globalThis:jn;vz&&typeof self>"u"&&(vz.self=vz),vz&&typeof File>"u"&&(vz.File=function(){});const Yr=jn??{},mQn="0.9.3",Y8={DEBUG:!1,LIB_VERSION:mQn,LIB_NAME:"browser-common"};var K9=(function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t})({}),H2e=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({});const pQn=["$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"],_Qn=["token"];function jr(t,e){return t.indexOf(e)!==-1}const $k=function(t){return t.trim()},O2e=function(t){return t.replace(/^\$/,"")};function Cat(t){var e;const n=[];return(e=JSON.stringify(t,function(o,i){if(typeof i=="bigint")return i.toString();if(typeof i!="function"&&typeof i!="symbol"){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&typeof i=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(i))return"[Circular]";n.push(i)}return i}}))!==null&&e!==void 0?e:"null"}const yat=Object.prototype,G2e=yat.hasOwnProperty,wne=yat.toString,qr=Array.isArray||function(t){return wne.call(t)==="[object Array]"},ap=t=>typeof t=="function",Ea=t=>t===Object(t)&&!qr(t),px=t=>{if(Ea(t)){for(const e in t)if(G2e.call(t,e))return!1;return!0}return!1},Eo=t=>t===void 0,$a=t=>wne.call(t)=="[object String]",wz=t=>$a(t)&&t.trim().length===0,ld=t=>t===null,Fs=t=>Eo(t)||ld(t),eh=t=>wne.call(t)=="[object Number]"&&t==t,U8=t=>eh(t)&&t>0,My=t=>wne.call(t)==="[object Boolean]",fQn=t=>jr(pQn,t),IQn=t=>jr(_Qn,t);function xat(t){return t===null||typeof t!="object"}function Pne(t,e){return{}.toString.call(t)===`[object ${e}]`}function Xk(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Eat(t,Error)}}function Y2e(t){return"u">typeof Event&&Eat(t,Event)}function Eat(t,e){try{return t instanceof e}catch{return!1}}const CQn=[!0,"true",1,"1","yes"],U2e=t=>jr(CQn,t),yQn=[!1,"false",0,"0","no"];function Bat(t,e,n,o,i,r,s){try{var a=t[r](s),A=a.value}catch(c){return void n(c)}a.done?e(A):Promise.resolve(A).then(o,i)}function $g(t){return function(){var e=this,n=arguments;return new Promise(function(o,i){var r=t.apply(e,n);function s(A){Bat(r,o,i,s,a,"next",A)}function a(A){Bat(r,o,i,s,a,"throw",A)}s(void 0)})}}const xQn=["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","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","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","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Mne=new Map,bat=function(t,e=[]){if(!t)return!1;const n=(function(s,a){let A="";for(let c=0;a.length>c;c++){const l=a[c];A+=l.length+":"+l}return s.length+":"+s+"|"+a.length+":"+A})(t,e),o=Mne.get(n);if(o!==void 0)return o;const i=t.toLowerCase(),r=xQn.concat(e).some(s=>i.indexOf(s.toLowerCase())!==-1);return 256>Mne.size||Mne.clear(),Mne.set(n,r),r};function z9(t,e,n,o,i){return e>n&&(o.warn("min cannot be greater than max."),e=n),eh(t)?t>n?(o.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(o.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(o.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),z9(i??n,e,n,o))}var EQn=class{constructor(e){this.C={},this.I=e.I,this.R=z9(e.bucketSize,0,100,e.A),this.$=z9(e.refillRate,0,this.R,e.A),this.O=z9(e.refillInterval,0,864e5,e.A)}F(e,n){const o=Math.floor((n-e.lastAccess)/this.O);o>0&&(e.tokens=Math.min(e.tokens+o*this.$,this.R),e.lastAccess=e.lastAccess+o*this.O)}consumeRateLimit(e){var n;const o=Date.now(),i=String(e);let r=this.C[i];return r?this.F(r,o):(r={tokens:this.R,lastAccess:o},this.C[i]=r),r.tokens===0||(r.tokens--,r.tokens===0&&((n=this.I)===null||n===void 0||n.call(this,e)),r.tokens===0)}stop(){this.C={}}};const Zk="Mobile",Pz="Android",Dne="Tablet",Sat="Android Tablet",Qat="iPad",vat="Apple Watch",Nne="Safari",Rne="BlackBerry",wat="Samsung Internet",Tne="Chrome",Pat="Chrome iOS",Mat="Internet Explorer",Dat="Internet Explorer Mobile",Nat="Opera",Rat="Microsoft Edge",kne="Firefox",Tat="Firefox iOS",Fne="Nintendo",Lne="PlayStation",Hne="Xbox",kat="Android Mobile",Fat="Mobile Safari",K2e="Windows",Lat="Windows Phone",Hat="Nokia",z2e="Ouya",BQn="Generic "+Zk.toLowerCase(),Oat="Generic "+Dne.toLowerCase(),V2e="Konqueror",Gat="Oculus Browser",Yat="Vivaldi",Uat="Yandex",Kat="Whale",zat="DuckDuckGo",Vat="Pale Moon",Jat="Waterfox",J2e="Brave",Wat="Claude",jat="Codex",qat="ChatGPT",$at="Google Search App",W2e=new RegExp("Version/(\\d+(\\.\\d+)?)"),j2e=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),bQn=new RegExp(Hne,"i"),SQn=new RegExp("PlayStation \\w+","i"),QQn=new RegExp("Nintendo \\w+","i"),q2e=new RegExp("BlackBerry|PlayBook|BB10","i"),vQn={"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"},Xat=function(t,e,n,o){return e=e||"",(function(r){return r?.brave?J2e:null})(n)||(o?.detectGoogleSearchApp&&jr(t,"GSA/")?$at:jr(t," OPR/")&&jr(t,"Mini")?"Opera Mini":jr(t," OPR/")?Nat:q2e.test(t)?Rne:jr(t,"IEMobile")||jr(t,"WPDesktop")?Dat:jr(t,"OculusBrowser")?Gat:jr(t,"SamsungBrowser")?wat:jr(t,"Edge")||jr(t,"Edg/")?Rat:jr(t,"Vivaldi/")?Yat:jr(t,"YaBrowser/")?Uat:jr(t,"Whale/")?Kat:jr(t,"DuckDuckGo/")||jr(t,"Ddg/")?zat:jr(t,"Claude/")?Wat:jr(t,"Codex/")?jat:jr(t,"ChatGPT/")?qat:jr(t,"FBIOS")?"Facebook Mobile":jr(t,"UCWEB")||jr(t,"UCBrowser")?"UC Browser":jr(t,"CriOS")?Pat:jr(t,"CrMo")||jr(t,Tne)?Tne:jr(t,Pz)&&jr(t,Nne)?kat:jr(t,"FxiOS")?Tat:jr(t.toLowerCase(),V2e.toLowerCase())?V2e:jr(t,"Brave/")?J2e:((r,s)=>s&&jr(s,"Apple")||(function(a){return jr(a,Nne)&&!jr(a,Tne)&&!jr(a,Pz)})(r))(t,e)?jr(t,Zk)?Fat:Nne:jr(t,"PaleMoon/")?Vat:jr(t,"Waterfox/")?Jat:jr(t,kne)?kne:jr(t,"MSIE")||jr(t,"Trident/")?Mat:jr(t,"Gecko")?kne:"")},wQn={[Dat]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Rat]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Tne]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Pat]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Nne]:[W2e],[Fat]:[W2e],[Nat]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[kne]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[Tat]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[V2e]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Rne]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),W2e],[kat]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[wat]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Gat]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Yat]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Uat]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Kat]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[J2e]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Wat]:[j2e],[jat]:[j2e],[qat]:[j2e],[zat]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Vat]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Jat]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[$at]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Mat]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},PQn=function(t,e,n,o){const i=Xat(t,e,n,o),r=wQn[i];if(Eo(r))return null;for(let s=0;r.length>s;s++){const a=t.match(r[s]);if(a)return parseFloat(a[a.length-2])}return null},Zat=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[Hne,t&&t[1]||""]],[new RegExp(Fne,"i"),[Fne,""]],[new RegExp(Lne,"i"),[Lne,""]],[q2e,[Rne,""]],[new RegExp(K2e,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Lat,""];if(new RegExp(Zk).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){let o=vQn[n[1]]||"";return/arm/i.test(e)&&(o="RT"),[K2e,o]}return[K2e,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let e="";return t&&t.length>=3&&(e=Eo(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Pz,[t[2],t[3],t[4]||"0"].join(".")]:[Pz,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],eAt=function(t){for(let e=0;Zat.length>e;e++){const[n,o]=Zat[e],i=n.exec(t),r=i&&(ap(o)?o(i,t):o);if(r)return r}return["",""]},tAt=function(t){return QQn.test(t)?Fne:SQn.test(t)?Lne:bQn.test(t)?Hne:new RegExp(z2e,"i").test(t)?z2e:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?Lat:/iPad/.test(t)?Qat:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?vat:q2e.test(t)?Rne:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Hat,"i").test(t)?Hat:/(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(Zk).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)?Pz:Sat:new RegExp("(pda|Mobile)","i").test(t)?BQn:new RegExp(Dne,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?Oat:""},MQn=function(t,e){var n;const o=tAt(t);return o===Qat||o===Sat||o==="Kobo"||o==="Kindle Fire"||o===Oat?Dne:o===Fne||o===Hne||o===Lne||o===z2e?"Console":o===vat?"Wearable":o?Zk:e?.userAgentDataPlatform==="Android"&&((n=e?.maxTouchPoints)!==null&&n!==void 0?n:0)>0?600>Math.min((i=e?.screenWidth)!==null&&i!==void 0?i:0,(r=e?.screenHeight)!==null&&r!==void 0?r:0)/((s=e?.devicePixelRatio)!==null&&s!==void 0?s:1)?Zk:Dne:"Desktop";var i,r,s},$2e=/\bFBAV\/(\d+(?:\.\d+)*)/i,nAt=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",$2e],[/\bFBAN\/EMA\b/i,"Facebook Lite",$2e],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",$2e],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],X2e="[Truncated]",Mz="[Unserializable]";function eF(t){let e="";for(let n=0;t.length>n;n++){const o=t.charCodeAt(n);if(55296>o||o>56319)e+=56320>o||o>57343?t[n]:"�";else{const i=t.charCodeAt(n+1);56320>i||i>57343?e+="�":(e+=t[n]+t[n+1],n++)}}return e}function oAt(t,e){if(!e)return t;let n=[];try{n=Object.keys(e)}catch{n=[]}for(const o of n){let i;try{i=e[o]}catch{i=Mz}Object.defineProperty(t,o,{value:i,enumerable:!0,writable:!0,configurable:!0})}return t}const One=3e5;var iAt=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const n=this.isOpen(),o=Date.now(),i=Math.min(e.retryAfterMs,One);if(!n)return this.ts=o,void(this.es=o+i);this.es=Math.max(this.es,Math.min(o+i,this.ts+One))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const n=Math.min(One,Math.max(0,this.es-e));return n===0&&this.reset(),n}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const DQn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function rAt(t,e){return typeof(n=t)=="string"&&DQn.test(n)?t:e();var n}function sAt(t,e){const n=new Error(e);try{Object.defineProperty(n,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function MQ(t){return t&&t.split("#")[0]}function aAt(t){try{return t()}catch{return}}function AAt(t,e){const n=setTimeout(t,e);return n!=null&&n.unref&&n?.unref(),n}function cAt(t,e,n){return lAt.apply(this,arguments)}function lAt(){return(lAt=$g(function*(t,e,n){let o;try{return yield Promise.race([t,new Promise((i,r)=>{o=AAt(()=>{try{n?.(),i()}catch(s){r(s)}},e)})])}finally{clearTimeout(o)}})).apply(this,arguments)}let Gne,gAt,Z2e;function NQn(t){const e=globalThis._posthogChunkIds;if(!e)return;const n=Object.keys(e);return Z2e&&n.length===gAt||(gAt=n.length,Z2e=n.reduce((o,i)=>{Gne||(Gne={});const r=Gne[i];if(r)o[r[0]]=r[1];else{const s=t(i);for(let a=s.length-1;a>=0;a--){const A=s[a],c=A?.filename,l=e[i];if(c&&l){o[c]=l,Gne[i]=[c,l];break}}}return o},{})),Z2e}function Dz(t){return Dz=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Dz(t)}function RQn(t,e,n){return(e=(function(o){var i=(function(r){if(Dz(r)!="object"||!r)return r;var s=r[Symbol.toPrimitive];if(s!==void 0){var a=s.call(r,"string");if(Dz(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)})(o);return Dz(i)=="symbol"?i:i+""})(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uAt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,o)}return n}function Zt(t){for(var e=1;arguments.length>e;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?uAt(Object(n),!0).forEach(function(o){RQn(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):uAt(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}var TQn=class{constructor(e,n,o=[]){this.coercers=e,this.stackParser=n,this.modifiers=o}buildFromUnknown(e,n={}){const o=n&&n.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(o,n,0).apply(e),r=this.buildParsingContext(n),s=this.parseStacktrace(i,r);return{$exception_list:this.convertToExceptionList(s,o),$exception_level:"error"}}modifyFrames(e){var n=this;return $g(function*(){for(const o of e)o.stacktrace&&o.stacktrace.frames&&qr(o.stacktrace.frames)&&(o.stacktrace.frames=yield n.applyModifiers(o.stacktrace.frames));return e})()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var o;let i,r;if(e.cause!=null&&(i=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null)try{r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)}catch{}return Zt(Zt({},e),{},{cause:i,stack:r,errors:(o=e.errors)===null||o===void 0?void 0:o.map(s=>this.parseStacktrace(s,n))})}applyChunkIds(e,n){return e.map(o=>(o.filename&&n&&(o.chunk_id=n[o.filename]),o))}applyCoercers(e,n){for(const o of this.coercers)if(o.match(e))return o.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return $g(function*(){let o=e;for(const i of n.modifiers)o=yield i(o);return o})()}convertToExceptionList(e,n){const o=[],i=(r,s,a)=>{var A;const c=o.length,l=s===void 0?Zt(Zt({type:typeof n.type=="string"&&n.type.length>0?n.type:"generic"},typeof n.handled=="boolean"?{handled:n.handled}:n.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof n.synthetic=="boolean"?n.synthetic:r.synthetic,exception_id:c}):{type:"chained",source:a,synthetic:r.synthetic,exception_id:c,parent_id:s},g={type:r.type,value:r.value,mechanism:l};r.stack&&(g.stacktrace={type:"raw",frames:r.stack}),o.push(g),r.cause&&i(r.cause,c,"cause");for(const u of(A=r.errors)!==null&&A!==void 0?A:[])i(u,c,"member")};return i(e),o}buildParsingContext(e){var n;return{chunkIdMap:NQn(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}getAggregateErrors(e){try{if(Xk(e)){let o=Object.getPrototypeOf(e);for(let i=0;o&&100>i;i++){var n;const r=(n=Object.getOwnPropertyDescriptor(o,"constructor"))===null||n===void 0?void 0:n.value;if(typeof r=="function"&&r.name==="AggregateError"){const s=e.errors;return qr(s)?s:void 0}o=Object.getPrototypeOf(o)}}}catch{}}buildCoercingContext(e,n,o=0){let i=0,r=0,s=!1;const a=new Set,A=[],c={},l=(h,d,m=0)=>{const p=g(d,m),_=p.apply;if(p.apply=E=>{A.push(h);try{return _(E)}finally{A.pop()}},m>4||m>0&&A.indexOf(h)!==-1)return this.coerceFallback(p);const f=typeof h=="object"&&h!==null||typeof h=="function";if(m===0&&i>=50||f&&a.has(h))return;f&&a.add(h),m===0&&i++;const I=this.getAggregateErrors(h);let C,y;s||(s=!!I);try{if(C=this.applyCoercers(h,p),!C)throw c}catch(E){if(E===c)return void(m===0&&i--);if(!s)throw E;C=this.coerceFallback(p)}if(!I||i>=50)return C;try{y=I.length}catch{return C}if(!Number.isInteger(y)||0>y||y>4294967295)return C;const x=[];for(let E=0;50>i&&1e3>r&&y>E;E++){let B;r++;try{B=p.next(I[E])}catch{i++,B=this.coerceFallback(g(d+1))}B&&x.push(B)}return Zt(Zt({},C),{},{errors:x})},g=(h,d=0)=>Zt(Zt({},n),{},{syntheticException:h==0?n.syntheticException:void 0,mechanism:h==0?e:{},apply(m){const p=l(m,h,d+1);if(!p)throw c;return p},next:m=>l(m,h+1)}),u=g(o);return Zt(Zt({},u),{},{apply:h=>{var d;return(d=l(h,o))!==null&&d!==void 0?d:this.coerceFallback(u)}})}};const kQn=/^([a-z][a-z0-9.+-]+):/i,FQn=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function LQn(t){if(!t||t==="<anonymous>")return!1;const e=kQn.exec(t);return!e||FQn.includes(e[1].toLowerCase())}function exe(t,e,n,o,i){const r={platform:t,filename:e,function:n==="<anonymous>"?"?":n,in_app:LQn(e)};return Eo(o)||(r.lineno=o),Eo(i)||(r.colno=i),r}const dAt=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,o=t.indexOf("safari-web-extension")!==-1;return n||o?[t.indexOf("@")!==-1?t.split("@")[0]:"?",n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},HQn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,OQn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,GQn=/\((\S*)(?::(\d+))(?::(\d+))\)/,YQn=(t,e)=>{const n=HQn.exec(t);if(n){const[,i,r,s]=n;return exe(e,i,"?",+r,+s)}const o=OQn.exec(t);if(o){if(o[2]&&o[2].indexOf("eval")===0){const s=GQn.exec(o[2]);s&&(o[2]=s[1],o[3]=s[2],o[4]=s[3])}const[i,r]=dAt(o[1]||"?",o[2]);return exe(e,r,i,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},UQn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,KQn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,zQn=(t,e)=>{const n=UQn.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){const r=KQn.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}let o=n[3],i=n[1]||"?";return[i,o]=dAt(i,o),exe(e,o,i,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},hAt=/\(error: (.*)\)/;function txe(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function VQn(t){for(let e=1;10>=e;e++){const n=t.length-2*e;if(0>n)break;let o=!0;for(let i=0;e>i;i++)if(!txe(t[n+i],t[n+e+i])){o=!1;break}if(o){for(let i=0;e>i;i++)t[n+i]=t[n+e+i];return t.length=n+e,{start:n,length:e}}}}function JQn(t,e){const n=e.start+e.length,o=pAt(t,e);o&&t.splice(n+o===t.length?n:e.start,o)}function mAt(t,e){let n=e.start;for(;n>0&&txe(t[n-1],t[n-1+e.length]);)n--;return e.start-n}function pAt(t,e){const n=e.start+e.length;let o=n;for(;t.length>o&&txe(t[o],t[o-e.length]);)o++;return o-n}function WQn(t,e){const n=e[0];let o=t.length-(n?mAt(t,n):0);for(const i of e)o-=pAt(t,i);return o}function jQn(t,e,n){for(let o=0;t.length>o;o++){const i=t[(e+o)%t.length],r=t[(n+o)%t.length];if(i!==r)return r>i}return!1}var qQn=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){const o=$a(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:o?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${n}: ${e.message}`:n}isDOMException(e){return Pne(e,"DOMException")}isDOMError(e){return Pne(e,"DOMError")}},$Qn=class{match(e){return Xk(e)}coerce(e,n){var o;const i=this.getStack(e),r=i===void 0?(o=n.syntheticException)===null||o===void 0?void 0:o.stack:void 0,s=!!r;return{type:this.getType(e),value:this.getMessage(e,n),stack:i??r,cause:e.cause?n.next(e.cause):void 0,synthetic:s}}getType(e){return e.name||e.constructor.name}getMessage(e,n){const o=e.message;return String(o.error&&typeof o.error.message=="string"?o.error.message:o)}getStack(e){try{const n=e.stacktrace;if(typeof n=="string"&&n.length>0)return n;const o=e.stack;return typeof o=="string"&&o.length>0?o:void 0}catch{return}}},XQn=class{match(e){return!!Pne(e,"ErrorEvent")&&(e.error!=null||this.ar(e))}coerce(e,n){var o;if(e.error!=null)return n.apply(e.error);const i=n.apply(e.message);return Zt(Zt({},i),{},{stack:(o=this.lr(e))!==null&&o!==void 0?o:i.stack,synthetic:!0})}ar(e){return $a(e.message)&&e.message.length>0}lr(e){var n,o;const i=e,r=(n=i.lineno)!==null&&n!==void 0?n:0,s=(o=i.colno)!==null&&o!==void 0?o:0;if($a(i.filename)&&i.filename.length!==0&&r!==0)return`Error
240
+ at ${i.filename}:${r}:${s}`}};const ZQn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var evn=class{match(e){return typeof e=="string"}coerce(e,n){var o;const[i,r]=this.getInfos(e);return{type:i??"Error",value:r??e,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}getInfos(e){let n="Error",o=e;const i=e.match(ZQn);return i&&(n=i[1],o=i[2]),[n,o]}};const tvn=["fatal","error","warning","log","info","debug"];function _At(t,e=40){const n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(let o=n.length;o>0;o--){const i=n.slice(0,o).join(", ");if(e>=i.length)return o===n.length?i:i.length>e?`${i.slice(0,e)}...`:i}return""}var nvn=class{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var o,i;const r=this.getErrorPropertyFromObject(e);return r?n.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(o=this.getStack(e))!==null&&o!==void 0?o:(i=n.syntheticException)===null||i===void 0?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(Y2e(e))return e.constructor.name;const n="name"in e?e.name:void 0;return $a(n)&&!wz(n)?n:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let o=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(o+=` with message: '${e.message}'`),o}if("message"in e&&typeof e.message=="string")return e.message;const n=this.getObjectClassName(e);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${_At(e)}`}isSeverityLevel(e){return $a(e)&&!wz(e)&&tvn.indexOf(e)>=0}getStack(e){try{return $a(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:$a(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const n in e)if({}.hasOwnProperty.call(e,n)){const o=e[n];if(Xk(o))return o}}getObjectClassName(e){try{const n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}},ovn=class{match(e){return Y2e(e)}coerce(e,n){var o;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${_At(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},ivn=class{match(e){return xat(e)}coerce(e,n){var o;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},rvn=class{match(e){return Pne(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Y2e(e))return!1;try{const n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var o;const i=this.getUnhandledRejectionReason(e);return xat(i)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}:n.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}};const Yne="$message",Une="$timestamp",svn=new Set([Yne,Une]),nxe={enabled:!0,max_bytes:32768};function Kne(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:nxe.enabled,max_bytes:Avn(t.max_bytes,nxe.max_bytes)}:Zt({},nxe)}var avn=class{constructor(e){this.ns=[],this.ss=0,this.Mr=Kne(e)}setConfig(e){this.Mr=Kne(e),this.rs()}add(e){const n=(function(i){let r;try{r=Cat(i)}catch{return}try{const s=JSON.parse(r);if(!Ea(s))return;const a=s,A=a[Yne],c=a[Une];return!$a(A)||A.trim().length===0||!$a(c)&&!eh(c)?void 0:{step:a,json:r}}catch{return}})(e);if(!n)return;const o=(function(i){if("u">typeof TextEncoder)return new TextEncoder().encode(i).length;const r=encodeURIComponent(i);let s=0;for(let a=0;r.length>a;a++)r[a]==="%"?(s+=1,a+=2):s+=1;return s})(n.json);o>this.Mr.max_bytes||(this.ns.push({step:n.step,bytes:o}),this.ss+=o,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Mr.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function Avn(t,e){if(!eh(t)||t===1/0||t===-1/0)return e;const n=Math.floor(t);return 0>n?e:n}const fAt=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function IAt(t){return typeof t=="string"||t}function CAt(t){return typeof t=="string"?t:void 0}const cvn=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],yAt="NativeGzipValidationError",oxe=t=>t.length>=2&&t[0]===31&&t[1]===139,xAt=(t,e)=>t===H2e.GZipJS||e===H2e.GZipJS||e==="gzip",EAt=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError";let Nz;const zne=t=>{throw sAt(yAt,`Native gzip produced invalid output: ${t}`)},lvn=(BAt=$g(function*(t,e){18>t.size&&zne("too-short");const n=new Uint8Array(yield t.slice(0,10).arrayBuffer());oxe(n)&&n[2]===8||zne("invalid-header");const o=new DataView(yield t.slice(t.size-8).arrayBuffer());o.getUint32(0,!0)!==(r=>{const s=(()=>{if(Nz)return Nz;Nz=[];for(let A=0;256>A;A++){let c=A;for(let l=0;8>l;l++)c=1&c?3988292384^c>>>1:c>>>1;Nz[A]=c>>>0}return Nz})();let a=4294967295;for(let A=0;r.length>A;A++)a=s[255&(a^r[A])]^a>>>8;return(4294967295^a)>>>0})(e)&&zne("invalid-crc");const i=e.length>>>0;o.getUint32(4,!0)!==i&&zne("invalid-size")}),function(t,e){return BAt.apply(this,arguments)});var BAt;function ixe(){return ixe=$g(function*(t,e=!0,n){try{const i=new TextEncoder().encode(t),r=new globalThis.CompressionStream("gzip"),s=r.writable.getWriter(),a=s.write(i).then(()=>s.close()).catch((o=$g(function*(l){try{yield s.abort(l)}catch{}throw l}),function(l){return o.apply(this,arguments)})),A=new Response(r.readable).blob(),[c]=yield Promise.all([A,a]);return yield lvn(c,i),c}catch(i){if(n?.rethrow)throw i;return e&&console.error("Failed to gzip compress data",i),null}var o}),ixe.apply(this,arguments)}function bAt(t,e){if(t==null)return{};var n,o,i=(function(s,a){if(s==null)return{};var A={};for(var c in s)if({}.hasOwnProperty.call(s,c)){if(a.includes(c))continue;A[c]=s[c]}return A})(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;r.length>o;o++)e.includes(n=r[o])||{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}const vC="[redacted]",gvn=/^[A-Za-z0-9+/\n\r]+=*$/,uvn=/^[A-Za-z0-9_-]+={0,2}$/,dvn=/[-_]/,hvn=/^data:[^,\s]*;base64,/i,mvn=/^[A-Za-z0-9+/_-]+={0,2}$/,pvn=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,_vn=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,SAt=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,fvn=/[\s<>"]/,QAt=new RegExp(SAt.source,"i"),vAt=/[a-z][a-z0-9+.-]{0,63}:\/\//i,Ivn=new RegExp(`^${vAt.source}`,"i"),Cvn=new RegExp(vAt.source,"gi"),yvn=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,xvn=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,Evn=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,Bvn=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,bvn=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,Svn=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){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}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,Qvn=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,vvn=/\b\d(?:[ ./-]?\d){12,}\b/g,wAt=/\d+/g,wvn=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,Pvn=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function rxe(t){return(function(e){return _vn.test(e)})(t)||yvn.test(t)||xvn.test(t)}function sxe(t){return t.split("&",129).length>128}function Mvn(t,e,n){return rxe(t)||e.includes(";")&&(function(o){return o.split(";").some(i=>rxe(i.split("=",1)[0]))})(e)?vC:QAt.test(e)?n?Axe(e,{allowNestedUrls:!1,stripPunctuation:!0}):vC:e}function PAt(t,e){const n=new URLSearchParams;let o=!1,i=!1;for(const[r,s]of new URLSearchParams(t)){const a=Vne(r),A=Vne(s);o||(o=a!==r||A!==s);const c=Mvn(a,A,e);o||(o=c!==A),i=rxe(a)||c!==A,n.append(a,c)}return{changed:o,lastFieldSensitive:i,serialized:n.toString()}}function MAt(t,e){if(!t.includes("="))return{value:Dvn(t,e),lastFieldSensitive:!1};const n=PAt(t,e);return{value:n.changed?n.serialized:t,lastFieldSensitive:n.lastFieldSensitive}}function Dvn(t,e){return e?Axe(t,{allowNestedUrls:!1,stripPunctuation:!0}):QAt.test(t)?vC:t}function Nvn(t,e,n){return t==="#"?!e.fragment&&(e.fragment=!0):t==="?"&&(e.fragment?n!=="="&&!e.fragmentQuery&&(e.fragmentQuery=!0):!e.query&&(e.query=!0))}function axe(t,e){var n;if(t.length>8192&&Ivn.test(t))return vC;const{address:o,suffix:i}=e.stripPunctuation?(function(p){let _=p.length;for(;_>0&&".,;:!?)]}'".includes(p[_-1]);)_--;return{address:p.slice(0,_),suffix:p.slice(_)}})(t):{address:t,suffix:""};let r;try{r=new URL(o)}catch{return vC+i}const s=r.search.slice(1),a=r.hash!=="",A=(function(p){const _=p.slice(1),f=_.indexOf("?");return 0>f?{head:_,tail:null}:{head:_.slice(0,f),tail:_.slice(f+1)}})(r.hash);if(sxe(s)||sxe(A.head)||sxe((n=A.tail)!==null&&n!==void 0?n:""))return vC+i;let c=!1;(r.username||r.password)&&(r.username=vC,r.password="",c=!0);const l=PAt(s,e.allowNestedUrls);l.changed&&(r.search=l.serialized,c=!0);const g=MAt(A.head,e.allowNestedUrls),u=A.tail===null?null:(h=A.tail,g.lastFieldSensitive?{value:h===""?"":vC,lastFieldSensitive:!0}:MAt(h,e.allowNestedUrls));var h;const d=u===null?g.value:`${g.value}?${u.value}`;d!==r.hash.slice(1)&&(r.hash=d,c=!0);const m=a?u??g:l;return(c?Vne(r.toString()):o)+(m.lastFieldSensitive?"":i)}function Axe(t,e){return t.replace(SAt,n=>(function(o,i){const r=(function(A){if(!A.includes("://"))return[];const c=[...A.matchAll(Cvn)].map(m=>m.index),l=[],g={query:!1,fragment:!1,fragmentQuery:!1};let u=0,h=!1,d="";for(let m=0;A.length>m&&c.length>u;m++){c[u]===m&&(m>0&&d!=="="&&l.push(m),u++);const p=A[m];Nvn(p,g,d)?(d=p,h=!0):h&&"=&".includes(p)&&(d=p)}return l})(o);if(r.length===0)return axe(o,i);let s="",a=0;for(const A of r)s+=axe(o.slice(a,A),Zt(Zt({},i),{},{stripPunctuation:!1})),a=A;return s+axe(o.slice(a),i)})(n,Zt(Zt({},e),{},{stripPunctuation:e.stripPunctuation&&n.length!==t.length})))}function Vne(t){return t.replace(pvn,vC)}function Rvn(t,e){return(function(n){return n.length>=10240&&(gvn.test(n)||(function(o){const i=hvn.exec(o);if(!i)return!1;let r;try{r=decodeURIComponent(o.slice(i[0].length))}catch{return!1}return mvn.test(r.replace(/[\r\n]/g,""))})(n)||dvn.test(n)&&uvn.test(n))})(t)?"[binary data redacted - not supported by PostHog MCP analytics]":(function(n,o,i){const r=4*i.maxStringLength;if(n.length>r){const s=o(n.slice(0,(function(a,A){let c=A;for(;c>0&&!fvn.test(a[c-1]);)c--;return c})(n,r)));if(s.length>=2*i.maxStringLength)return s+i.truncationSuffix}return o(n)})(t,n=>(function(o){return Axe(o,{allowNestedUrls:!0,stripPunctuation:!0})})((function(o){let i=o.replace(Evn," ");return i=i.replace(Bvn,vC),i=i.replace(bvn,vC),i=i.replace(Svn,`$1${vC}`),i=i.replace(vvn,kvn),i=i.replace(Qvn,vC),i=i.replace(wvn,`$1${vC}`),i=i.replace(Pvn,`$1${vC}`),i})(Vne(n))),e)}function Tvn(t){let e=0,n=!1;for(let o=t.length-1;o>=0;o--){let i=t.charCodeAt(o)-48;if(0>i||i>9)return!1;n&&(i*=2,i>9&&(i-=9)),e+=i,n=!n}return e%10==0}function kvn(t){const e=[];for(let r=wAt.exec(t);r!==null;r=wAt.exec(t))e.push({digits:r[0],start:r.index,end:r.index+r[0].length});let n="",o=0,i=0;for(;e.length>i;){let r="",s=-1;for(let a=i;e.length>a&&(r+=e[a].digits,19>=r.length);a++)r.length>=13&&Tvn(r)&&(s=a);0>s?i++:(n+=t.slice(o,e[i].start)+vC,o=e[s].end,i=s+1)}return n+t.slice(o)}const Fvn={}.propertyIsEnumerable;function Jne(t,e){try{return DAt(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function cxe(t,e,n,o){if(0>=n.remainingNodes)return{stringValue:X2e};if(n.remainingNodes--,My(t))return{boolValue:t};if(typeof t=="bigint")return(function(i,r){const s=i.toString(),a=BigInt("9223372036854775808");return i>=a||-a>i?(r?.debug(`Attribute ${s} is outside the int64 range; encoding it as a string`),{stringValue:s}):{intValue:s}})(t,e);if(typeof t=="number"){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const i=BigInt(t).toString();return t>=9223372036854776e3||-9223372036854776e3>t?(e?.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:t}}if(typeof t=="string")return{stringValue:eF(t)};if(typeof t=="function")return{stringValue:"[Function]"};if(typeof t=="symbol")return{stringValue:String(t)};if(typeof t=="object"&&t!==null){if(n.ancestors.has(t))return{stringValue:"[Circular]"};if(o>=20)return{stringValue:X2e};if(t instanceof Date){const i=t.getTime(),r=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:typeof r=="string"?eF(r):String(r)}}n.ancestors.add(t);try{try{const i=t.toJSON;if(typeof i=="function")return cxe(i.call(t),e,n,o+1)}catch{}return qr(t)?{arrayValue:{values:Lvn(t,e,n,o+1)}}:{kvlistValue:{values:DAt(t,e,n,o+1)}}}finally{n.ancestors.delete(t)}}return{stringValue:eF(String(t))}}function Lvn(t,e,n,o){const i=[],r=Math.min(t.length,1e3);let s=0;for(;r>s&&n.remainingNodes>0;s++)try{const a=s in t?t[s]:void 0;if(Fs(a))continue;i.push(cxe(a,e,n,o))}catch{i.push({stringValue:Mz})}return t.length>s&&i.push({stringValue:X2e}),i}function DAt(t,e,n,o){const i=[];for(const r in t)if(Fvn.call(t,r)){if(!r){e?.debug("Dropping an attribute with an empty key");continue}if(i.length>=1e3||0>=n.remainingNodes){e?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const s=t[r];if(ld(s)||Eo(s))continue;i.push({key:eF(r),value:cxe(s,e,n,o)})}catch{i.push({key:eF(r),value:{stringValue:Mz}})}}return i}function NAt(t,e,n){return Zt(Zt(Zt(Zt({},oAt({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":e,"telemetry.sdk.version":n})}const Hvn=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function RAt(t,e){const n=oAt({},t),o={};for(const i of Hvn)({}).hasOwnProperty.call(n,i)&&(o[i]=n[i],delete n[i]);return[...Jne(n,e),...Jne(o,e)]}const TAt={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},kAt={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Ovn=kAt.info;function Gvn(t){try{return eF(String(t))}catch{return Mz}}function Yvn(t,e,n,o){const i=t.level||"info",{text:r,number:s}=kAt[i]||Ovn,a=(function(u=Date.now()){return String(u)+"000000"})(eh(o)?o:void 0),A={};e.distinctId&&(A.posthogDistinctId=e.distinctId),e.sessionId&&(A.sessionId=e.sessionId),e.windowId&&(A["window.id"]=e.windowId),Fs(e.sessionStartTimestamp)||(A.sessionStartTimestamp=String(e.sessionStartTimestamp)),Fs(e.lastActivityTimestamp)||(A.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(A["url.full"]=e.currentUrl),e.screenName&&(A["screen.name"]=e.screenName),e.appState&&(A["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(A.feature_flags=e.activeFeatureFlags);const c=Zt({},A),l=t.attributes;if(l){let u=[];try{u=Object.keys(l)}catch{u=[]}for(const h of u){let d;try{d=l[h]}catch{d=Mz}Object.defineProperty(c,h,{value:d,enumerable:!0,writable:!0,configurable:!0})}}const g={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:s,severityText:r,body:{stringValue:Gvn(t.body)},attributes:Jne(c,n)};return t.trace_id&&(g.traceId=t.trace_id),t.span_id&&(g.spanId=t.span_id),Eo(t.trace_flags)||(g.flags=t.trace_flags),g}function FAt(t,e,n){return NAt(t,e,n)}function LAt(t,e,n,o){return{resourceLogs:[{resource:{attributes:RAt(e)},scopeLogs:[{scope:{name:n,version:o},logRecords:t}]}]}}var HAt=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.cs}arm(e){this.clear(),this.us=Date.now()+e,this.cs=AAt(()=>{this.cs=void 0,this.ls()},e)}armNoEarlierThan(e){this.cs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function OAt(){return .75+.5*Math.random()}function GAt(t,e,n,o){const i=Math.min(Math.max(0,e-1),6),r=t*Math.pow(2,i);return Math.round(Math.min(r,Math.max(o,t))*n)}var Uvn=class{constructor(e,n,o,i,r,s=()=>Promise.resolve(),a){var A;this._instance=e,this.Mr=n,this.A=o,this.hs=i,this.ds=r,this.vs=s,this.fs=a,this.ps=new HAt(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new iAt,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=n.maxBufferSize,this.Is=Math.max((A=n.maxQueueSize)!==null&&A!==void 0?A:n.maxBufferSize,n.maxBufferSize),this.Ms=n.flushIntervalMs,this.Es=n.maxBatchRecordsPerPost,this.Ps=n.rateCapWindowMs,this.Rs=n.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(K9.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.$s=0,this.Cs=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,n){var o;if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;const i=this.Os(e);if(i===null)return;if(!i.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;const r={record:Yvn(i,(o=n?.context)!==null&&o!==void 0?o:this.hs(),this.A,n?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){const n=this.Mr.beforeSend;if(!n)return e;const o=qr(n)?n:[n];let i=e;for(const r of o)try{const s=r(i);if(!s)return this.A.info("Log was rejected in beforeSend function"),null;i=s}catch(s){return this.A.error("Error in beforeSend function for log:",s),null}return i}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),n=e-this.xs;return this.Ps>n&&n>=0||(this.xs=e,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.Cs=!0),!1)}flush(){var e=this;return $g(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return $g(function*(){var n;e.ps.clear();let o=(n=e._instance.getPersistedProperty(K9.LogsQueue))!==null&&n!==void 0?n:[];if(o.length===0)return;const i=o.length;let r=0;for(;o.length>0&&i>r;){var s,a;const A=e._s;e.bs=0;const c=Math.min(o.length,e.Es),l=o.slice(0,c),g=LAt(l.map(h=>h.record),e.qs(),(s=e.fs)!==null&&s!==void 0?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),u=yield e._instance.js(g);if(e._s!==A)return;if(u.kind==="too-large"&&l.length>1)e.Es=Math.max(1,Math.floor(l.length/2)),e.A.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(u),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),u.kind==="retry-later"||(u.kind==="too-large"?e.A.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):u.kind==="ok"&&e.Mr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Mr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(l.length),o=(a=e._instance.getPersistedProperty(K9.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,u.kind==="fatal"))throw u.error}})()}Bs(e){var n=this;return $g(function*(){var o;const i=Math.max(0,e-n.bs),r=(o=n._instance.getPersistedProperty(K9.LogsQueue))!==null&&o!==void 0?o:[];n._instance.setPersistedProperty(K9.LogsQueue,r.slice(i)),yield n.vs()})()}qs(){return FAt(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var n;if(this._instance.optedOut)return;const o=(n=this._instance.getPersistedProperty(K9.LogsQueue))!==null&&n!==void 0?n:[];this.Is>o.length||(o.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),o.push(e),this._instance.setPersistedProperty(K9.LogsQueue,o),this.Ts>o.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}zs(){return Math.max(GAt(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(K9.LogsQueue);return!!e&&e.length>0}shutdown(e){var n=this;return $g(function*(){n.ps.clear();const o=n.flush().catch(()=>{});e!==void 0?yield cAt(o,e):yield o})()}flushWithTimeout(e){var n=this;return $g(function*(){const o=n.flush();yield cAt(o,e,()=>{o.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=OAt(),this.A.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.zs())})}};const lxe=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function YAt(t){return String(t)+"000000"}function UAt(t,e,n,o){let i="";return o&&(i=Object.keys(o).sort().map(r=>`${JSON.stringify(r)}:${JSON.stringify(o[r])}`).join(",")),`${t}\0${e}\0${n??""}\0${i}`}var Kvn=class{constructor(e,n,o){this._instance=e,this.Mr=n,this.A=o,this.Hs=new Map,this.ps=new HAt(()=>this.flush().catch(i=>{this.A.error("Metrics flush failed:",i)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new iAt,this.ks=0,this.Ss=1,this.Gs=0}count(e,n=1,o){this.Qs({name:e,type:"count",value:n,unit:o?.unit,attributes:o?.attributes})}gauge(e,n,o){this.Qs({name:e,type:"gauge",value:n,unit:o?.unit,attributes:o?.attributes})}histogram(e,n,o){this.Qs({name:e,type:"histogram",value:n,unit:o?.unit,attributes:o?.attributes})}flush(){var e=this;const n=this.ys,o=(function(){var i=$g(function*(){n&&(yield n.catch(()=>{})),yield e.Zs()});return function(){return i.apply(this,arguments)}})()().finally(()=>{this.ys===o&&(this.ys=null)});return this.ys=o,o}drainWindow(){if(this.Hs.size===0)return null;const e=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.Hs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Qs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const n=this.Os(e);if(n===null)return;if(!n.name||typeof n.name!="string")return void this.A.warn("Dropping metric with empty name");if(typeof n.value!="number"||!Number.isFinite(n.value))return void this.A.warn(`Dropping metric '${n.name}': value must be a finite number`);if(n.type==="count"&&0>n.value)return void this.A.warn(`Dropping count '${n.name}': counters are monotonic, value must be >= 0`);let o,i;try{o=n.attributes?Zt({},n.attributes):void 0,i=UAt(n.type,n.name,n.unit,o)}catch(a){return void this.A.warn(`Dropping metric '${n.name}': attributes could not be serialized`,a)}let r=this.Hs.get(i);if(!r){if(!this.Ks())return;r={name:n.name,type:n.type,unit:n.unit,attributes:o,windowStartMs:Date.now()},this.Hs.set(i,r)}const s=this.Ws.get(n.name);s===void 0?this.Ws.set(n.name,n.type):s===n.type||this.Vs.has(n.name)||(this.Vs.add(n.name),this.A.warn(`Metric name '${n.name}' is already used as a ${s}; recording it as a ${n.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(r,n.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.A.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,n){switch(e.type){case"count":var o;e.total=((o=e.total)!==null&&o!==void 0?o:0)+n;break;case"gauge":e.last=n;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:n,max:n,bucketCounts:new Array(lxe.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=n,i.min=Math.min(i.min,n),i.max=Math.max(i.max,n),i.bucketCounts[(function(r,s){for(let a=0;s.length>a;a++)if(s[a]>=r)return a;return s.length})(n,lxe)]+=1;break}}}Os(e){const n=this.Mr.beforeSend;if(!n)return e;const o=qr(n)?n:[n];let i=e;for(const r of o)try{const s=r(i);if(!s)return this.A.info("Metric was rejected in beforeSend function"),null;i=s}catch(s){return this.A.error("Error in beforeSend function for metric:",s),null}return i}Fs(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(GAt(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Zs(){var e=this;return $g(function*(){if(e.ps.clear(),e.Hs.size===0)return;const n=e.Hs;e.Hs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const o=e.Gs,i=yield e._instance.Ys(e.Js(n));if(o===e.Gs)switch(e.ws.record(i),i.kind==="retry-later"?(e.ks++,e.Ss=OAt()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.zs()),i.kind){case"ok":return;case"retry-later":return e.co(n),void e.ps.armNoEarlierThan(e.zs());case"too-large":return void e.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.A.error("Failed to send metrics batch:",i.error)}})()}Js(e){return n=this.ho(e),o=(function(s,a,A){return NAt(s,a,A)})(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:RAt(o)},scopeMetrics:[{scope:{name:i,version:r},metrics:n}]}]};var n,o,i,r}ho(e){const n=YAt(Date.now()),o=new Map;for(const a of e.values()){var i;const A=UAt(a.type,a.name,a.unit,void 0);let c=o.get(A);c||(c=Zt({name:a.name},a.unit&&{unit:a.unit}),a.type==="count"?c.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:a.type==="gauge"?c.gauge={dataPoints:[]}:c.histogram={aggregationTemporality:1,dataPoints:[]},o.set(A,c));const l=Jne((i=a.attributes)!==null&&i!==void 0?i:{},this.A),g=YAt(a.windowStartMs);if(a.type==="count"){var r;const u={attributes:l,startTimeUnixNano:g,timeUnixNano:n,asDouble:(r=a.total)!==null&&r!==void 0?r:0};c.sum.dataPoints.push(u)}else if(a.type==="gauge"){var s;const u={attributes:l,timeUnixNano:n,asDouble:(s=a.last)!==null&&s!==void 0?s:0};c.gauge.dataPoints.push(u)}else a.hist&&c.histogram.dataPoints.push({attributes:l,startTimeUnixNano:g,timeUnixNano:n,count:a.hist.count,sum:a.hist.sum,min:a.hist.min,max:a.hist.max,bucketCounts:a.hist.bucketCounts,explicitBounds:lxe})}return Array.from(o.values())}co(e){for(const[i,r]of e){const s=this.Hs.get(i);if(s)switch(s.windowStartMs=Math.min(s.windowStartMs,r.windowStartMs),s.type){case"count":var n,o;s.total=((n=s.total)!==null&&n!==void 0?n:0)+((o=r.total)!==null&&o!==void 0?o:0);break;case"gauge":break;case"histogram":if(r.hist)if(s.hist){s.hist.count+=r.hist.count,s.hist.sum+=r.hist.sum,s.hist.min=Math.min(s.hist.min,r.hist.min),s.hist.max=Math.max(s.hist.max,r.hist.max);for(let a=0;s.hist.bucketCounts.length>a;a++)s.hist.bucketCounts[a]+=r.hist.bucketCounts[a]}else s.hist=r.hist}else this.Ks()&&this.Hs.set(i,r)}}};const KAt=(t,{debugEnabled:e}={})=>{const n={N(o,...i){let r;try{r=typeof window>"u"?void 0:window}catch{return}r&&(Y8.DEBUG||r.POSTHOG_DEBUG||e)&&!Eo(r.console)&&r.console&&("__rrweb_original__"in r.console[o]?r.console[o].__rrweb_original__:r.console[o])(t,...i)},debug(...o){n.N("debug",...o)},info(...o){n.N("log",...o)},warn(...o){n.N("warn",...o)},error(...o){n.N("error",...o)},critical(...o){console.error(t,...o)},uninitializedWarning(o){n.error(`You must initialize PostHog before calling ${o}`)},createLogger:(o,i)=>KAt(`${t} ${o}`,i)};return n},li=KAt("[PostHog.js]"),gd=li.createLogger,zvn=gd("[ExternalScriptsLoader]"),Wne=t=>{const e=qo?.querySelectorAll("script");if(e){for(let n=0;e.length>n;n++)if(e[n].src===t||e[n].getAttribute("src")===t)return e[n]}},eD=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return zvn.warn(`${e} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const o=Wne(e);if(o){if(o.__posthog_loading_callback_fired)return n();const r=o.__posthog_loading_error;return r?n(r):(o.addEventListener("load",s=>{o.__posthog_loading_callback_fired=!0,n(void 0,s)}),void o.addEventListener("error",s=>{o.__posthog_loading_error=s,n(s)}))}const i=()=>{if(!qo)return n("document not found");if(Wne(e))return eD(t,e,n);let r=qo.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=a=>{r.__posthog_loading_callback_fired=!0,n(void 0,a)},r.onerror=a=>{r.__posthog_loading_error=a,n(a)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")qo.head.appendChild(r);else{const a=qo.querySelectorAll("body > script");var s;a.length>0?(s=a[0].parentNode)===null||s===void 0||s.insertBefore(r,a[0]):qo.body.appendChild(r)}};qo?.body?i():qo?.addEventListener("DOMContentLoaded",i)},gxe={},zAt=(t,e)=>{let n=`/static/${e}.js?v=${t.version}`;return e==="toolbar"&&(n=`${n}&t=${Math.floor(Date.now()/3e5)*3e5}`),t.requestRouter.endpointFor("assets",n)};Yr.__PosthogExtensions__=Yr.__PosthogExtensions__||{},Yr.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e==="remote-config"){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void eD(t,i,n)}const o=t.config.strict_script_versioning;if(o){const i=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=gxe[i];if(o==="fallback"&&r){if(Wne(r))return void eD(t,r,n);delete gxe[i]}return void eD(t,i,o==="fallback"?(s,a)=>{if(s)if(typeof s=="string")n(s);else{var A;const c=zAt(t,e);gxe[i]=c;const l=Wne(i);l==null||(A=l.parentNode)===null||A===void 0||A.removeChild(l),eD(t,c,n)}else n(void 0,a)}:n)}eD(t,zAt(t,e),n)},Yr.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{const o=t.requestRouter.endpointFor("api",e);eD(t,o,n)},Y8.DEBUG=!1,Y8.LIB_VERSION="1.438.4",Y8.LIB_NAME="web";var Xp=Y8;const uxe="$early_access_features",K8="$active_feature_flags",tD="$feature_flag_details",Rz="$feature_flag_errors",DQ="$feature_flag_evaluated_at",nD="$feature_flag_request_id",Tz="$minimal_flag_called_events",Z4="$enabled_feature_flags",NQ="$stored_group_properties",RQ="$stored_person_properties",TQ="$flag_call_reported",kz="$flag_call_reported_session_id",kQ="$feature_flag_payloads",V9="$override_feature_flags",oD="$override_feature_flag_payloads",Fz="visibilitychange",Vvn="$people_distinct_id",eB="distinct_id",dxe="$device_id",hxe="$device_model",jne="__alias",Jvn="__cmpns",VAt="$fbc",tF="$fbc_persistence",JAt="$fbp",Lz="$fbp_persistence",mxe="__timers",WAt="$autocapture_disabled_server_side",pxe="$heatmaps_enabled_server_side",_xe="$exception_capture_enabled_server_side",jAt="$error_tracking_suppression_rules",fxe="$error_tracking_capture_extension_exceptions",Ixe="$web_vitals_enabled_server_side",Cxe="$dead_clicks_enabled_server_side",yxe="$product_tours_enabled_server_side",qAt="$logs_capture_enabled_server_side",$At="$web_vitals_allowed_metrics",Hz="$session_recording_remote_config",Wvn="$session_recording_enabled_server_side",jvn="$replay_sample_rate",qvn="$replay_override_sampling",$vn="$replay_override_linked_flag",Xvn="$replay_override_url_trigger",Zvn="$replay_override_event_trigger",nF="$sesid",XAt="$session_is_sampled",ewn="$session_past_minimum_duration",twn="$session_recording_url_trigger_activated_session",nwn="$session_recording_event_trigger_activated_session",own="$debug_first_full_snapshot_timestamp",iwn="$sess_rec_flush_size",ZAt="$groups",Oz="$surveys",qne="$surveys_loaded_at",ect="$surveys_activated",tct="$surveys_activated_session",nct="$surveys_activated_timestamps",xxe="ph_product_tours",rwn="$product_tours_activated",swn="$product_tours_activated_session",awn="$conversations_widget_session_id",Awn="$conversations_ticket_id",cwn="$conversations_widget_state",lwn="$conversations_user_traits",Dy="$user_state",Exe="$client_session_props",gwn="$capture_rate_limit",oct="$initial_campaign_params",ict="$initial_referrer_info",oF="$initial_person_info",Bxe="$epp",bxe="$posthog_cookieless",rct="$cookieless_mode",sct="$sdk_debug_extensions_init_method",act="$sdk_debug_extensions_init_time_ms",Sxe="$sdk_debug_recording_script_not_loaded",Qxe="$sdk_debug_replay_stale_config",Act="$sdk_debug_replay_event_trigger_status",cct="$sdk_debug_replay_linked_flag_trigger_status",lct="$sdk_debug_replay_matched_recording_trigger_groups",gct="$sdk_debug_replay_pending_trigger_conditions",uct="$sdk_debug_replay_remote_trigger_matching_config",dct="$sdk_debug_replay_trigger_groups_count",hct="$sdk_debug_replay_url_trigger_status",uwn="$session_recording_start_reason",vxe="PostHog loadExternalDependency extension not found.",z8="anonymous",$ne="identified",mct="identified_only",Xne="beforeunload",wxe="$pageview",pct="$pageleave",_ct="$identify",fct="$groupidentify";function iF(t,e){qr(t)&&t.forEach(e)}function pl(t,e){if(!Fs(t))if(qr(t))t.forEach(e);else if((n=>n instanceof FormData)(t))t.forEach((n,o)=>e(n,o));else for(const n in t)G2e.call(t,n)&&e(t[n],n)}const Xg=function(t,...e){for(const n of e)for(const o in n)n[o]!==void 0&&(t[o]=n[o]);return t};function Zne(t){const e=Object.keys(t);let n=e.length;const o=new Array(n);for(;n--;)o[n]=[e[n],t[e[n]]];return o}const dwn=function(t){return function(...e){try{return t.apply(this,e)}catch(n){li.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),li.critical(n)}}},Pxe=function(t){const e={};return pl(t,function(n,o){($a(n)&&n.length>0||eh(n))&&(e[o]=n)}),e};function Ict(t){const e=Zt({},t);for(const n of["name","message","stack","cause","errors"])try{n in t&&(e[n]=t[n])}catch{}return e}const hwn=["herokuapp.com","vercel.app","netlify.app"];function mwn(t){const e=t?.hostname;if(!$a(e))return!1;const n=e.split(".").slice(-2).join(".");for(const o of hwn)if(n===o)return!1;return!0}function Wc(t,e,n,o){const{capture:i=!1,passive:r=!0}=o??{};t?.addEventListener(e,n,{capture:i,passive:r})}function Mxe(t){return t.name==="ph_toolbar_internal"}const Gz=t=>{if(qo){try{const e=t+"=",n=qo.cookie.split(";").filter(o=>o.length);for(let o=0;n.length>o;o++){let i=n[o];for(;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}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return eh(t)&&isFinite(t)&&Math.floor(t)===t});var pwn=class Grt{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,o,i){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(o)||!Number.isInteger(i)||0>e||0>n||0>o||0>i||e>0xffffffffffff||n>4095||o>1073741823||i>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|n>>>8,r[7]=n,r[8]=128|o>>>24,r[9]=o>>>16,r[10]=o>>>8,r[11]=o,r[12]=i>>>24,r[13]=i>>>16,r[14]=i>>>8,r[15]=i,new Grt(r)}toString(){let e="";for(let n=0;this.bytes.length>n;n++)e=e+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),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 Grt(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(let n=0;16>n;n++){const o=this.bytes[n]-e.bytes[n];if(o!==0)return Math.sign(o)}return 0}},_wn=class{generate(){const e=this.generateOrAbort();if(!Eo(e))return e;{this.Ct=0;const n=this.generateOrAbort();if(Eo(n))throw new Error("Could not generate UUID after timestamp reset");return n}}generateOrAbort(){const e=(()=>{const n=Date.now();return eh(n)&&isFinite(n)?Math.min(Math.max(Math.floor(n),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.It();else{if(this.Ct>=e+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Ct++,this.It())}return pwn.fromFieldsV7(this.Ct,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.Tt.nextUint32())}It(){this.Mt=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.Mt=0,this.Tt=new fwn}};let Cct=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};jn&&!Eo(jn.crypto)&&crypto.getRandomValues&&(Cct=t=>crypto.getRandomValues(t));var fwn=class{nextUint32(){return this.Rt.length>this.Et||(Cct(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}};let yct;const tB=()=>Iwn().toString(),Iwn=()=>(yct||(yct=new _wn)).generate();let Yz="";const Cwn=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let rF=null;const ud={At(){if(!ld(rF))return rF;if(rF=!1,qo)try{const t=`__ph_cookie_support_${tB()}`;ud.$t(t,"xyz"),rF=Gz(t)==='"xyz"',ud.Pt(t)}catch{rF=!1}return rF},Dt(t){li.error("cookieStore error: "+t)},Ot:Gz,Ft(t){let e;try{e=JSON.parse(ud.Ot(t))||{}}catch{}return e},$t(t,e,n,o,i){if(!qo)return!1;try{let r="",s="";const a=(function(c,l){if(l){let g=(function(u,h=qo){if(Yz)return Yz;if(!h||["localhost","127.0.0.1"].includes(u))return"";const d=u.split(".");let m=Math.min(d.length,8);const p="dmn_chk_"+tB();for(;!Yz&&m--;){const _=d.slice(m).join("."),f=p+"=1;domain=."+_+";path=/";h.cookie=f+";max-age=3",h.cookie.includes(p)&&(h.cookie=f+";max-age=0",Yz=_)}return Yz})(c);if(!g){const u=(h=>{const d=h.match(Cwn);return d?d[0]:""})(c);u!==g&&li.info("Warning: cookie subdomain discovery mismatch",u,g),g=u}return g?"; domain=."+g:""}return""})(qo.location.hostname,o);if(n){const c=new Date;c.setTime(c.getTime()+864e5*n),r="; expires="+c.toUTCString()}i&&(s="; secure");const A=t+"="+encodeURIComponent(JSON.stringify(e))+r+"; SameSite=Lax; path=/"+a+s;return A.length>3686.4&&li.warn("cookieStore warning: large cookie, len="+A.length),qo.cookie=A,!0}catch{return!1}},Pt(t,e){if(qo?.cookie&&(!e||!ld(Gz(t))))try{ud.$t(t,"",-1,e)}catch{return}}};let Dxe=null;const uc={At(){if(!ld(Dxe))return Dxe;let t=!0;if(Eo(jn))t=!1;else try{const e="__mplssupport__";uc.$t(e,"xyz"),uc.Ot(e)!=='"xyz"'&&(t=!1),uc.Pt(e)}catch{t=!1}return t||li.error("localStorage unsupported; falling back to cookie store"),Dxe=t,t},Dt(t){li.error("localStorage error: "+t)},Ot(t){try{return jn?.localStorage.getItem(t)}catch(e){uc.Dt(e)}return null},Ft(t){try{return JSON.parse(uc.Ot(t))||{}}catch{}return null},$t(t,e){try{return jn?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){uc.Dt(n)}return!1},Pt(t){try{jn?.localStorage.removeItem(t)}catch(e){uc.Dt(e)}}},Nxe=[RQ,K8,Z4,tD,kQ,nD,DQ,Rz,TQ],iD=[dxe,eB,nF,XAt,Bxe,oF,tF,Dy],eoe=t=>t+"_cpm",ywn=["__proto__","constructor","prototype"],Rxe=t=>{if(!Ea(t))return{};const e={};return Object.keys(t).forEach(n=>{ywn.indexOf(n)===-1&&(e[n]=t[n])}),e},Txe=(t,e=[])=>{const n={};return[...iD,...e].forEach(o=>{const i=t[o];Eo(i)||ld(i)||i===""||(n[o]=i)}),n},xct=t=>{let e=5381,n=2166136261;for(let o=0;t.length>o;o++){const i=t.charCodeAt(o);e=33*e^i,n=Math.imul(n^i,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(n>>>0).toString(36)},Ect=(t,e)=>({p:e,f:xct(JSON.stringify(t))}),Bct=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const n=ud.Ft(eoe(t)),o=n?.f===xct(e)&&qr(n.p);return{properties:o?n.p:[],isValid:o}}catch{return{properties:[],isValid:!1}}},kxe=(t,e)=>e+"|"+(ud.Ot(eoe(t))||""),sF={},Fxe={At:()=>!0,Dt(t){li.error("memoryStorage error: "+t)},Ot:t=>t in sF?sF[t]:null,Ft:t=>t in sF?sF[t]:null,$t:(t,e)=>(sF[t]=e,!0),Pt(t){delete sF[t]}};let rD=null;const eg={At(){if(!ld(rD))return rD;if(rD=!0,Eo(jn))rD=!1;else try{const t="__support__";eg.$t(t,"xyz"),eg.Ot(t)!=='"xyz"'&&(rD=!1),eg.Pt(t)}catch{rD=!1}return rD},Dt(t){li.error("sessionStorage error: ",t)},Ot(t){try{return jn?.sessionStorage.getItem(t)}catch(e){eg.Dt(e)}return null},Ft(t){try{return JSON.parse(eg.Ot(t))||null}catch{}return null},$t(t,e){try{return jn?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){eg.Dt(n)}return!1},Pt(t){try{jn?.sessionStorage.removeItem(t)}catch(e){eg.Dt(e)}}};var xwn=class{constructor(e){this._instance=e}get Mr(){return this._instance.config}get consent(){return this.Do()?0:this.Lo}isOptedOut(){return this.Mr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Mr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Mr.opt_out_capturing_by_default}optInOut(e){this.No.$t(this.qo,e?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.No.Pt(this.qo,this.Mr.cross_subdomain_cookie)}get qo(){const{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:o}=this._instance.config;return o||(n?n+e:"__ph_opt_in_out_"+e)}get Lo(){const e=this.No.Ot(this.qo);return U2e(e)?1:jr(yQn,e)?0:-1}get No(){const e=this.Mr.opt_out_capturing_persistence_type,n=e==="localStorage"?uc:ud,o=n.At()?n:Fxe;if(!this.jo||this.jo!==o){this.jo=o;const i=e==="localStorage"?ud:uc;i.Ot(this.qo)&&(this.jo.Ot(this.qo)||this.optInOut(U2e(i.Ot(this.qo))),i.Pt(this.qo,this.Mr.cross_subdomain_cookie))}return this.jo}Do(){return!!this.Mr.respect_dnt&&[X_?.doNotTrack,X_?.msDoNotTrack,Yr.doNotTrack,X_?.globalPrivacyControl].some(e=>U2e(e))}};function bct(t,e){var n;const o=t==null||(n=t.config)===null||n===void 0?void 0:n.get_current_url;if(!ap(o))return e;try{const i=o(e);return $a(i)&&i?i:e}catch(i){return li.error("Error in get_current_url, falling back to window.location.href",i),e}}function Sct(t){var e;return t instanceof Element&&(t.id==="__POSTHOG_TOOLBAR__"||!!(!((e=t.closest)===null||e===void 0)&&e.call(t,".toolbar-global-fade-container")))}function nB(t){return!!t&&t.nodeType===1}function gI(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Qct(t){return!!t&&t.nodeType===3}function Lxe(t){return!!t&&t.nodeType===11&&nB(t.host)}function Hxe(t){return t?$k(t).split(/\s+/):[]}function vct(t,e){const n=(function(o){var i;const r=jn==null||(i=jn.location)===null||i===void 0?void 0:i.href;return Eo(r)?void 0:bct(o,r)})(e);return!!(n&&t&&t.some(o=>n.match(o)))}function aF(t){let 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 Hxe(e)}function wct(t){return Fs(t)?null:$k(t).split(/(\s+)/).filter(e=>cF(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Uz(t){let e="";return sD(t)&&!AF(t)&&t.childNodes&&t.childNodes.length&&pl(t.childNodes,function(n){var o;Qct(n)&&n.textContent&&(e+=(o=wct(n.textContent))!==null&&o!==void 0?o:"")}),$k(e)}function Kz(t){var e;return Eo(t.target)?t.srcElement||null:!((e=t.target)===null||e===void 0)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}const Oxe=["a","button","form","input","select","textarea","label"];function Gxe(t,e){const n=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!n&&n.call(t,e)}catch{return!1}}function Yxe(t,e){if(Eo(e))return!0;for(const n of t)if(e.some(o=>Gxe(n,o)))return!0;return!1}function Pct(t){const e=t.parentNode;return!(!e||!nB(e))&&e}const Uxe=[".ph-no-autocapture","[data-ph-no-autocapture]"],Mct=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],Kxe=[...Mct,"+","-","−","–"],Dct=Kxe.length+10,Ewn=["button","a","input","select","textarea","label"],Bwn=["button","link","tab","menuitem","option"],Nct=(t,e)=>/[a-z0-9]/i.test(e)?jr(Kxe,e)?new RegExp(`\\b${e}\\b`).test(t):t.includes(e):t===e,bwn=t=>jr(Ewn,t.tagName.toLowerCase())||jr(Bwn,(t.getAttribute("role")||"").toLowerCase());function zxe(t){let e="",n="";const o=s=>{nB(s)&&sD(s)&&!AF(s)&&(e+=` ${Uz(s)}`,n=n||s.getAttribute("aria-label")||"",pl(s.childNodes,o))};o(t),e=$k(e.replace(/\s+/g," "));const i=(cF(e)?e:"").toLowerCase(),r=t.getAttribute("aria-label")||(i?"":n);return{safeText:i,ariaLabel:$k(r).toLowerCase()}}const Rct=[".ph-no-rageclick",".ph-no-capture"],Swn=["","text","search","email","password","url","tel","number"];function Tct(t,e){if(!jn||Vxe(t))return!1;let n,o,i;var r,s;if(My(e)?(n=!!e&&Rct,o=void 0,i=!1):(n=(r=e?.css_selector_ignorelist)!==null&&r!==void 0?r:Rct,o=e?.content_ignorelist,i=(s=e?.ignore_text_selection)!==null&&s!==void 0&&s),n===!1||i&&(function(A){return!(!A||!nB(A))&&(!!gI(A,"textarea")||(gI(A,"input")?jr(Swn,(A.getAttribute("type")||"").toLowerCase()):(function(c){var l;if(c.isContentEditable)return!0;const g=(l=c.getAttribute)===null||l===void 0?void 0:l.call(c,"contenteditable");return g==="true"||g===""})(A)))})(t))return!1;const{targetElementList:a}=kct(t,!1);return!(o&&(function(A,{safeText:c,ariaLabel:l}){let g;if(A===!0)g=Mct;else{if(!qr(A))return!1;if(A.length>Dct)return li.error(`[PostHog] content_ignorelist array cannot exceed ${Dct} items. Use css_selector_ignorelist for more complex matching.`),!1;g=A.map(u=>u.toLowerCase())}return g.some(u=>Nct(c,u)||Nct(l,u))})(o,(function(A,c){for(const l of c)if(bwn(l))return zxe(l);for(const l of c){try{if(jn?.getComputedStyle(l).getPropertyValue("cursor")!=="pointer")break}catch{break}const g=zxe(l);if(g.safeText||g.ariaLabel)return g}return zxe(A)})(t,a))||Yxe(a,n))}const Vxe=t=>!t||gI(t,"html")||!nB(t),kct=(t,e)=>{if(!jn||Vxe(t))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const o=[t];let i=t;for(;i.parentNode&&!gI(i,"body");){if(Lxe(i.parentNode)){o.push(i.parentNode.host),i=i.parentNode.host;continue}const r=Pct(i);if(!r)break;if(e||Oxe.indexOf(r.tagName.toLowerCase())>-1)n=!0;else try{const s=jn.getComputedStyle(r);s&&s.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}o.push(r),i=r}return{parentIsUsefulElement:n,targetElementList:o}};function sD(t){const e=new Set;let n=0;for(let r=t;r.parentNode&&!gI(r,"body");r=r.parentNode){if(n++>=1e3||e.has(r))return!1;e.add(r);const s=aF(r);if(jr(s,"ph-sensitive")||jr(s,"ph-no-capture"))return!1}if(jr(aF(t),"ph-include"))return!0;const o=t.type||"";if($a(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}const i=t.name||t.id||"";return!$a(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 AF(t){return!!(gI(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||gI(t,"select")||gI(t,"textarea")||t.getAttribute("contenteditable")==="true")}const Fct=new RegExp("^(?:(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}))$"),Lct=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Qwn=[16,15,14,13],vwn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Hct=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Oct=/[0-9A-Za-z_]/;function wwn(t){let e=0,n=!1;for(let o=t.length-1;o>=0;o--){let i=t.charCodeAt(o)-48;n&&(i*=2,i>9&&(i-=9)),e+=i,n=!n}return e%10==0}function cF(t,e=!0){return!(Fs(t)||$a(t)&&(t=$k(t),(e?Fct.test((t||"").replace(/[- ]/g,"")):(function(n){let o;for(Lct.lastIndex=0;o=Lct.exec(n);){const i=o[2];if(!i)continue;const r=i.replace(/[- ]/g,"");for(let s=0;r.length>s;s++)for(const a of Qwn){const A=s+a;if(r.length>=A){const c=r.slice(s,A);if(Fct.test(c)&&wwn(c))return!0}}}return!1})(t))||(e?vwn.test(t):(function(n){let o;for(Hct.lastIndex=0;o=Hct.exec(n);){const i=o[1],r=o[3];if(!(i&&r&&Oct.test(i)&&Oct.test(r)))return!0}return!1})(t))))}function Gct(t){let e=Uz(t);return e=`${e} ${Yct(t)}`.trim(),cF(e)?e:""}function Yct(t){let e="";return t&&t.childNodes&&t.childNodes.length&&pl(t.childNodes,function(n){var o;if(n&&((o=n.tagName)===null||o===void 0?void 0:o.toLowerCase())==="span")try{const i=Uz(n);e=`${e} ${i}`.trim(),n.childNodes&&n.childNodes.length&&(e=`${e} ${Yct(n)}`.trim())}catch(i){li.error("[AutoCapture]",i)}}),e}function Uct(t){return t.replace(/"|\\"/g,'\\"')}function Pwn(t){const e=t.attr__class;if(e)return qr(e)?e:Hxe(e)}const toe=gd("[Dead Clicks]"),Mwn=()=>!0,Dwn=t=>{var e;const n=!!(!((e=t.instance.persistence)===null||e===void 0)&&e.get_property(Cxe)),o=t.instance.config.capture_dead_clicks;return My(o)?o:!!Ea(o)||n};var Kct=class{get lazyLoadedDeadClicksAutocapture(){return this.Bo}constructor(e,n,o){this.instance=e,this.isEnabled=n,this.onCapture=o,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const n=e.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[Cxe]:n.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Ho()}):this.stop()}zo(e){var n,o,i;!((n=Yr.__PosthogExtensions__)===null||n===void 0)&&n.initDeadClicksAutocapture?e():(o=Yr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this.instance,"dead-clicks-autocapture",r=>{r?toe.error("failed to load script",r):e()})}Ho(){var e;if(qo){if(!this.Bo&&(!((e=Yr.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const n=Ea(this.instance.config.capture_dead_clicks)?Zt({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Bo=Yr.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Bo.start(qo),toe.info("starting...")}}else toe.error("`document` not found. Cannot start.")}stop(){this.Bo&&(this.Bo.stop(),this.Bo=void 0,toe.info("stopping..."))}};const zz=gd("[SegmentIntegration]");function zct(t,e,n=!0){const o=t.config.segment;if(!o)return e();const{analytics:i,filterProperties:r}=(a=>ap(a.register))(s=o)?{analytics:s}:s;var s;(function(a,A,c,l){const g=h=>{const d=()=>h.anonymousId()||tB();a.config.get_device_id=d,l&&h.id()&&(a.register({distinct_id:h.id(),$device_id:d()}),a.persistence.set_property(Dy,$ne)),c(l?void 0:h.anonymousId()||void 0)},u=A.user();"then"in u&&ap(u.then)?u.then(g):g(u)})(t,i,a=>{i.register(((A,c,{filterProperties:l}={})=>{typeof Promise<"u"&&Promise.resolve||zz.warn("This browser does not have Promise support, and can not use the segment integration");const g=(u,h)=>{if(!h)return u;const d=!!c&&u.event.anonymousId===c&&!u.event.userId;d||u.event.userId||u.event.anonymousId===A.get_distinct_id()||(zz.info("No userId set, resetting PostHog"),A.reset()),d||(c=void 0),u.event.userId&&u.event.userId!==A.get_distinct_id()&&(zz.info("UserId set, identifying with PostHog"),A.identify(u.event.userId));let m=A.calculateEventProperties(h,u.event.properties);if(!Fs(l)){const p=u.event.properties||{},_={};for(const I of Object.keys(m))G2e.call(p,I)||(_[I]=m[I]);const f=((I,C)=>{const y=qr(I)?I:[I];let x=Zt({},C);for(const E of y)try{if(x=E(x),Fs(x))return null}catch(B){return zz.error("Error in Segment filterProperties:",B),null}return x})(l,_);if(Fs(f))return u;m=f}return u.event.properties=Object.assign({},m,u.event.properties),u};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(u){return g(u,u.event.event)},page(u){return g(u,wxe)},identify(u){return g(u,_ct)},screen(u){return g(u,"$screen")}}})(t,a,{filterProperties:r})).then(()=>{e()},A=>{zz.error("Failed to register the Segment integration",A),e()})},n)}const Vct="posthog-js";function Jct(t,{organization:e,projectId:n,prefix:o,severityAllowList:i=["error"],sendExceptionsToPostHog:r=!0}={}){return s=>{var a,A,c,l,g;if(i!=="*"&&!i.includes(s.level)||!t.__loaded)return s;s.tags||(s.tags={});const u=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);s.tags["PostHog Person URL"]=u,t.sessionRecordingStarted()&&(s.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const h=((a=s.exception)===null||a===void 0?void 0:a.values)||[],d=h.map(_=>Zt(Zt({},_),{},{stacktrace:_.stacktrace?Zt(Zt({},_.stacktrace),{},{type:"raw",frames:(_.stacktrace.frames||[]).map(f=>Zt(Zt({},f),{},{platform:"web:javascript"}))}):void 0})),m={$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_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:((l=h[0])===null||l===void 0?void 0:l.value)||s.message,$sentry_exception_type:(g=h[0])===null||g===void 0?void 0:g.type,$sentry_tags:s.tags};var p;return e&&n&&(m.$sentry_url=(o||"https://sentry.io/organizations/")+e+"/issues/?project="+n+"&query="+s.event_id),r&&((p=t.exceptions)===null||p===void 0||p.sendExceptionEvent(m)),s}}var Nwn=class{constructor(e,n,o,i,r,s){this.name=Vct,this.setupOnce=function(a){a(Jct(e,{organization:n,projectId:o,prefix:i,severityAllowList:r,sendExceptionsToPostHog:s==null||s}))}}},Wct=class{constructor(e){this.Uo=(n,o,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(li.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:i}),this.Wo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Vo()}Vo(){var e;this.Go=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Uo)}destroy(){var e;(e=this.Go)===null||e===void 0||e.call(this),this.Go=void 0}doPageView(e,n){var o;const i=this.Qo(e,n);return this.Wo={pathname:(o=jn?.location.pathname)!==null&&o!==void 0?o:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var n;return this.Qo(e,(n=this.Wo)===null||n===void 0?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Wo)===null||e===void 0?void 0:e.pageViewId}}Qo(e,n){const o=this.Wo;if(!o)return{$pageview_id:n};let i={$pageview_id:n,$prev_pageview_id:o.pageViewId};const r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:s,lastScrollY:a,maxScrollY:A,maxContentHeight:c,lastContentY:l,maxContentY:g}=r;if(!(Eo(s)||Eo(a)||Eo(A)||Eo(c)||Eo(l)||Eo(g))){s=Math.ceil(s),a=Math.ceil(a),A=Math.ceil(A),c=Math.ceil(c),l=Math.ceil(l),g=Math.ceil(g);const u=s>1?z9(a/s,0,1,li):1,h=s>1?z9(A/s,0,1,li):1,d=c>1?z9(l/c,0,1,li):1,m=c>1?z9(g/c,0,1,li):1;i=Xg(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:u,$prev_pageview_max_scroll:A,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:d,$prev_pageview_max_content:g,$prev_pageview_max_content_percentage:m})}}return o.pathname&&(i.$prev_pageview_pathname=o.pathname),o.timestamp&&(i.$prev_pageview_duration=(e.getTime()-o.timestamp.getTime())/1e3),i}};const Vz=["flags","surveys"],Rwn={[Vvn]:{exposure:"hidden"},[jne]:{exposure:"hidden"},[Jvn]:{exposure:"hidden"},[mxe]:{exposure:"hidden"},[tF]:{exposure:"hidden"},[Lz]:{exposure:"hidden"},[WAt]:{exposure:"event"},[pxe]:{exposure:"hidden"},[qAt]:{exposure:"hidden"},[_xe]:{exposure:"event"},[jAt]:{exposure:"hidden"},[fxe]:{exposure:"event"},[Ixe]:{exposure:"event"},[Cxe]:{exposure:"event"},[yxe]:{exposure:"hidden"},[$At]:{exposure:"event"},[Hz]:{exposure:"hidden"},[Wvn]:{exposure:"hidden"},[nF]:{exposure:"hidden"},[XAt]:{exposure:"event"},[jvn]:{exposure:"event",shouldSkipFromEventProperties:t=>ld(t)},[ewn]:{exposure:"event"},[twn]:{exposure:"event"},[nwn]:{exposure:"event"},[own]:{exposure:"event"},[iwn]:{exposure:"hidden"},[Z4]:{exposure:"hidden",storageGroup:"flags"},[K8]:{exposure:"hidden",storageGroup:"flags"},[uxe]:{exposure:"hidden"},[tD]:{exposure:"hidden",storageGroup:"flags"},[kQ]:{exposure:"hidden",storageGroup:"flags"},[nD]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Tz]:{exposure:"hidden",storageGroup:"flags"},[V9]:{exposure:"hidden"},[oD]:{exposure:"hidden"},[RQ]:{exposure:"hidden"},[NQ]:{exposure:"hidden"},[Oz]:{exposure:"hidden",storageGroup:"surveys"},[qne]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ect]:{exposure:"event"},[tct]:{exposure:"hidden"},[nct]:{exposure:"hidden"},[xxe]:{exposure:"hidden"},[rwn]:{exposure:"hidden"},[swn]:{exposure:"hidden"},[awn]:{exposure:"event"},[Awn]:{exposure:"event"},[cwn]:{exposure:"event"},[lwn]:{exposure:"event"},[TQ]:{exposure:"hidden"},[kz]:{exposure:"hidden"},[ZAt]:{exposure:"event"},[Rz]:{exposure:"hidden"},[DQ]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Dy]:{exposure:"hidden"},[Exe]:{exposure:"hidden"},[gwn]:{exposure:"hidden"},[oct]:{exposure:"hidden"},[ict]:{exposure:"hidden"},[oF]:{exposure:"hidden"},[Bxe]:{exposure:"hidden"},[qvn]:{exposure:"event"},[$vn]:{exposure:"event"},[Xvn]:{exposure:"event"},[Zvn]:{exposure:"event"},[sct]:{exposure:"event"},[act]:{exposure:"event"},[Sxe]:{exposure:"hidden"},[Qxe]:{exposure:"hidden"},[Act]:{exposure:"hidden"},[cct]:{exposure:"hidden"},[lct]:{exposure:"hidden"},[gct]:{exposure:"hidden"},[uct]:{exposure:"hidden"},[dct]:{exposure:"hidden"},[hct]:{exposure:"hidden"},[uwn]:{exposure:"event"}},Twn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],r1=t=>{const e=Rwn[t];if(e)return e;for(const[n,o]of Twn)if(t.indexOf(n)===0)return o};function jct(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}const qct=()=>{try{return"u">typeof window&&window.navigator.onLine!==!1}catch{return!1}},$ct=(t,e)=>t>=e&&qct(),Xct=(t,e,n,o)=>{if(t===0){if(qct()){const i=e+1;return i===n&&o(),i}return e}return 0},lF=(t,e)=>{try{let n;return JSON.stringify(t,(o,i)=>{var r;return Xk(i)?((r=n)!==null&&r!==void 0||(n=new WeakMap),n.has(i)||n.set(i,Ict(i)),n.get(i)):typeof i=="bigint"?i.toString():i},e)}catch{return Cat(t)}},V8=t=>{const e=qo?.createElement("a");return Eo(e)?null:(e.href=t,e)},gF=function(t,e){const n=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let o;for(let i=0;n.length>i;i++){const r=n[i].split("=");if(r[0]===e){o=r;break}}if(!qr(o)||2>o.length)return"";{let i=o[1];try{i=decodeURIComponent(i)}catch{li.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")}},Jz=function(t,e,n){if(!t||!e||!e.length)return t;const o=t.split("#"),i=o[1],r=(o[0]||"").split("?"),s=r[1],a=r[0],A=(s||"").split("&"),c=[];for(let g=0;A.length>g;g++){const u=A[g].split("=");qr(u)&&(e.includes(u[0])?c.push(u[0]+"="+n):c.push(A[g]))}let l=a;return s!=null&&(l+="?"+c.join("&")),i!=null&&(l+="#"+i),l},noe=function(t,e){const n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},uF=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx"],kwn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...uF],Wz="<masked>",Fwn=["li_fat_id"];function Zct(t,e,n){if(!qo)return{};const o=e?[...uF,...n||[]]:[],i=elt(Jz(qo.URL,o,Wz),t),r=(function(){const s={};return pl(Fwn,function(a){const A=Gz(a);s[a]=A||null}),s})();return Xg(r,i)}function elt(t,e){const n=kwn.concat(e||[]),o={};return pl(n,function(i){const r=gF(t,i);o[i]=r||null}),o}function tlt(t){const e=(function(i){return i?i.search("https?://(.*)google.([^/?]*)")===0?"google":i.search("https?://(.*)bing.com")===0?"bing":i.search("https?://(.*)yahoo.com")===0?"yahoo":i.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(t),n=e!="yahoo"?"q":"p",o={};if(!ld(e)){o.$search_engine=e;const i=qo?gF(qo.referrer,n):"";i.length&&(o.ph_keyword=i)}return o}function nlt(){return navigator.language||navigator.userLanguage}function Lwn(){const t=nlt();return typeof t=="string"?t.split("-")[0]:void 0}const ooe="$direct";function olt(){return qo?.referrer||ooe}function ilt(t,e,n=!1){const o=t?[...uF,...e||[]]:[],i=n?MQ(qg?.href):qg?.href,r=i?.substring(0,1e3);return{r:olt().substring(0,1e3),u:r?Jz(r,o,Wz):void 0}}function rlt(t,e=!1){var n;const{r:o,u:i}=t,r=e?MQ(i):i,s={$referrer:o,$referring_domain:o==null?void 0:o==ooe?ooe:(n=V8(o))===null||n===void 0?void 0:n.host};if(r){s.$current_url=r;const a=V8(r);s.$host=a?.host,s.$pathname=a?.pathname;const A=elt(r);Xg(s,A)}if(o){const a=tlt(o);Xg(s,a)}return s}function Hwn(){try{return new Date().getTimezoneOffset()}catch{return}}const Own={flags:DQ,surveys:qne},Gwn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ioe=t=>`${t}_cookie_identity_change_pending`,roe=t=>{let e="",n=0;for(const o of t){const i=encodeURIComponent(JSON.stringify(o).slice(1,-1)).length;if(n+i>1e3)break;e+=o,n+=i}return e},Zp="main",J8=[Z4,K8,tD,kQ,nD,DQ,Tz,RQ],Jxe=t=>J8.indexOf(t)!==-1,slt=[tF,Lz],alt=t=>slt.indexOf(t)!==-1,FQ=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch{return t===e}},dF=t=>{if(!t)return{};const e=JSON.parse(t);return Ea(e)?e:{}},Alt=(t,e)=>{pl(t,(n,o)=>{const i=r1(o);i&&i.exposure!=="event"||{}.hasOwnProperty.call(e,o)||delete t[o]})};var Wxe=class{constructor(e,n,o=!0,i=!e.cookieless_mode){if(this.Zo={},this.Jo=!1,this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=new Map,this.ia=!1,this.na=!1,this.sa=!1,this.ra=new Set,this.oa=new Set,this.Mr=e,this.aa=o,this.props={},this.la=void 0,this.ua=(r=>{let s="";return r.token&&(s=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+s+"_posthog"})(e),this.hi=e.disable_persistence||!!n,this.No=this.ca(e),this.Xo=this.ha(e),this.load(i),this.da(),e.debug&&li.info("Persistence loaded",e.persistence,Zt({},this.props)),this.update_config(e,e,n),this.save(),jn){const r=()=>this.flush();Wc(jn,"beforeunload",r,{capture:!1}),Wc(jn,"pagehide",r,{capture:!1}),this.va=s=>{if(this.Jo&&(!s.storageArea||s.storageArea===jn?.localStorage)&&s.key)if(s.key!==this.ua){if(this.Xo){const a=Vz.find(A=>s.key===this.fa(A));a&&this.pa(s.key,a)}}else this.pa(s.key,Zp)},Wc(jn,"storage",this.va)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([n,o])=>{const i=this.ea.get(n);if(!Jxe(n)||i===!0)return;if(o===!0)return void this.ga(n,!0);const r=new Set(i||[]);o.forEach(s=>r.add(s)),r.size&&this.ga(n,r)})}onCrossTabFeatureFlagChange(e){return this.oa.add(e),()=>this.oa.delete(e)}destroy(){this.va&&jn&&(jn.removeEventListener("storage",this.va),this.va=void 0),this.oa.clear()}pa(e,n,o=!0){if(this.hi)return!1;let i,r;try{if(r=uc.Ot(e),ld(r)){const A=this.ma(n);return A.storageValue=null,n!==Zp&&(A.persisted=!1),!1}i=dF(r)}catch{return!1}const s=n===Zp?i:uc.Ft(this.ua);if(s&&this.ya(s))return!1;const a=this.ba(i,n,o);return n===Zp&&this.Xo&&!FQ(this._a().main,i)||this.wa(i,n,!0,r),a}ya(e){const n=this.props[eB],o=e[eB];return!Eo(n)&&!Eo(o)&&n!==o}wa(e,n,o,i){const r=this.ma(n);r.storageValue=i,n!==Zp&&(r.persisted=o);try{r.fingerprint=this.ka(e,n)}catch{r.fingerprint=void 0}}ba(e,n,o){let i=!1;return J8.forEach(r=>{var s;const a=(s=r1(r))===null||s===void 0?void 0:s.storageGroup;if(n===Zp&&this.Xo&&a||n!==Zp&&a!==n)return;const A=r in e,c=this.Sa(r,A?e[r]:void 0),l=this.ea.has(r)?r in this.props:A;l===r in this.props&&FQ(c,this.props[r])||(l?this.xa(r,c,!1):this.$a(r,!1),i=!0)}),i&&o&&this.oa.forEach(r=>r()),i}Ca(){if(!this.Jo)return!1;try{this.sa=!1;const e=uc.Ot(this.ua),n=this.ma(Zp);let o,i=!1,r=!1;if(e!==n.storageValue)if(ld(e))n.storageValue=null;else{if(o=dF(e),this.sa=!this.na&&this.ya(o),this.sa)return!1;r=this.ba(o,Zp,!1),!this.Xo||FQ(this._a().main,o)?this.wa(o,Zp,!0,e):n.storageValue=e,i=!0}return this.Xo&&Vz.forEach(s=>{const a=uc.Ot(this.fa(s)),A=this.ma(s),c=o||{},l=i&&J8.some(u=>{var h;return((h=r1(u))===null||h===void 0?void 0:h.storageGroup)===s&&u in c});if(a===A.storageValue&&!l)return;if(ld(a))return A.storageValue=null,A.persisted=!1,void(l&&(r=this.ba(c,s,!1)||r));const g=dF(a);r=this.ba(g,s,!1)||r,this.wa(g,s,!0,a)}),r}catch{return!1}}ga(e,n){this.ea.set(e,n);const o=r1(e);o?.volatile||(this.ma((this.Xo?o?.storageGroup:void 0)||Zp).fingerprint=void 0,this.Ta(e))}Ia(){J8.forEach(e=>this.ea.set(e,!0))}da(){if(this.Jo)try{const e=uc.Ot(this.ua),n=dF(e);this.ma(Zp).storageValue=e,J8.forEach(o=>{var i;const r=this.Xo?(i=r1(o))===null||i===void 0?void 0:i.storageGroup:void 0,s=r?uc.Ot(this.fa(r)):null;if(r){const A=this.ma(r);A.storageValue=s,A.persisted=!ld(s)}const a=r&&!ld(s)?dF(s):n;o in this.props?this.Ma(o,a[o],this.props[o]):o in a&&this.ga(o,!0)})}catch{}}Sa(e,n){const o=this.ea.get(e);if(!o)return n;if(o===!0)return this.props[e];if(e==="$active_feature_flags"){const s=new Set(qr(n)?n:[]),a=new Set(qr(this.props[e])?this.props[e]:[]);return o.forEach(A=>a.has(A)?s.add(A):s.delete(A)),Array.from(s)}const i=Ea(n)?Zt({},n):{},r=Ea(this.props[e])?this.props[e]:{};return o.forEach(s=>{s in r?i[s]=r[s]:delete i[s]}),i}Ma(e,n,o){if(!Jxe(e))return;const i=this.ea.get(e);if(i===!0)return;let r=n;if(this.Jo)try{var s;const A=this.Xo?(s=r1(e))===null||s===void 0?void 0:s.storageGroup:void 0,c=A?this.fa(A):this.ua;r=dF(uc.Ot(c))[e]}catch{}const a=new Set(i||[]);if(e==="$active_feature_flags"){if(!Eo(n)&&!qr(n)||!Eo(r)&&!qr(r)||!qr(o))return void this.ga(e,!0);const A=new Set(n||[]),c=new Set(r||[]),l=new Set(o);new Set([...A,...l]).forEach(g=>{A.has(g)!==l.has(g)&&a.add(g)}),a.forEach(g=>{c.has(g)===l.has(g)&&a.delete(g)})}else{if(!Ea(o))return void(FQ(r,o)?this.ea.delete(e):this.ga(e,!0));{if(!Eo(n)&&!Ea(n)||Eo(n)&&px(o)&&Eo(r))return void this.ga(e,!0);const A=Ea(n)?n:{},c=Ea(r)?r:{};new Set([...Object.keys(A),...Object.keys(o)]).forEach(l=>{l in A==l in o&&FQ(A[l],o[l])||a.add(l)}),a.forEach(l=>{l in c==l in o&&FQ(c[l],o[l])&&a.delete(l)})}}a.size?this.ga(e,a):this.ea.delete(e)}Ea(){var e;const n=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return eh(n)&&n>0?n:0}Pa(e){if(this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const n=Txe(e,this.Mr.cookie_persisted_properties||[]),o=Ect(n,this.Mr.cookie_persisted_properties||[]),i=JSON.stringify(n)+"|"+JSON.stringify(o),r=ud.Ot(this.ua)||void 0;r&&kxe(this.ua,r)===i&&(this.Ra=i,this.Aa=r)}catch{}else try{const n=ud.Ot(this.ua)||void 0;this.Ra=n?kxe(this.ua,n):void 0,this.Aa=n}catch{}}syncCookieProperties(){return this.Fa(this.Mr)}Fa(e,n=!1){if(this.hi&&!n||this.ta||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let o;try{o=ud.Ot(this.ua)||void 0}catch{}if(!o||o===this.Aa)return!1;const i=kxe(this.ua,o);let r;try{r=Rxe(JSON.parse(o))}catch{return!1}if((ud.Ot(this.ua)||void 0)!==o)return!1;this.Ra=i,this.Aa=o;const s=Bct(this.ua,o),a=[...iD,...s.properties],A={};if(Object.keys(r).forEach(p=>{const _=r[p];(Eo(_)||ld(_)||_===""||p==="$user_state"&&_!=="anonymous"&&_!=="identified")&&(A[p]=!0,delete r[p])}),px(r))return!1;const c="distinct_id"in r||r.$user_state==="anonymous"||r.$user_state==="identified",l=this.props,g=l[eB],u=l[Dy],h=Xg({},l);[...iD,...e.cookie_persisted_properties||[]].forEach(p=>{if(a.indexOf(p)!==-1&&!(p in r)&&!A[p]&&(c||p!=="distinct_id"&&p!=="$user_state")){const _=h[p];(s.isValid||iD.indexOf(p)===-1||_!==!1&&_!==0)&&delete h[p]}}),this.props=Xg(h,r),J8.forEach(p=>{const _=p in this.props;p in l===_&&FQ(l[p],this.props[p])||(_?this.Ma(p,l[p],this.props[p]):this.ga(p,!0))}),!c||"$user_state"in r||"$user_state"in this.props||this.xa(Dy,z8);const d=this.props[eB],m=this.props[Dy];return!c||d===g&&m===u||(this.na=!0,this.Yo=!0,eg.$t(ioe(this.ua),!0),this.$a(RQ),this.$a(K8),this.$a(Z4),this.$a(tD),this.$a(kQ),this.$a(nD),this.$a(DQ),this.$a(Rz),this.$a(TQ),m!=="anonymous"||u!=="identified"&&r.$user_state!=="anonymous"&&(Eo(g)||d===g)||(Alt(this.props,r),this.$a(NQ)),m==="identified"?this.props.$user_id=d:delete this.props.$user_id,this.$a(jne)),!0}consumeCookieIdentityChange(){const e=ioe(this.ua),n=this.Yo||!!eg.Ot(e);return this.Yo=!1,n&&eg.Pt(e),n}Oa(e=!1){return!(this.ta||this.hi&&!e||!this.Mr.cookieWinsOnConflict||this.Mr.persistence.toLowerCase()!=="localstorage+cookie"||(this.ta=!0,0))}Da(){this.ta&&(Eo(this.La)||(clearTimeout(this.La),this.La=void 0),delete this.Zo[Zp],this.Na(!0))}qa(e=!0){if(this.ta)try{e?this.Da():Eo(this.La)||(clearTimeout(this.La),this.La=void 0)}finally{this.ta=!1}}isDisabled(){return!!this.hi}ca(e){Gwn.indexOf(e.persistence.toLowerCase())===-1&&(li.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const n=((a=[],A=!1,c=()=>!1)=>{const l=[...iD,...a];return Zt(Zt({},uc),{},{Ft(g){try{let h,d={};try{h=ud.Ot(g)||void 0,d=h?Rxe(JSON.parse(h)):{}}catch{}const m=JSON.parse(uc.Ot(g)||"{}");let p;if(A){const _=Bct(g,h),f=[...iD,..._.properties],I={};Object.keys(d).forEach(y=>{const x=d[y];ld(x)||x===""||y==="$user_state"&&x!=="anonymous"&&x!=="identified"||(I[y]=x)});const C="distinct_id"in I||I.$user_state==="anonymous"||I.$user_state==="identified";if(Object.keys(I).length>0){var u;const y=m[eB],x=(u=m.$user_state)!==null&&u!==void 0?u:z8;l.forEach(E=>{if(f.indexOf(E)!==-1&&!(E in d)&&(C||E!=="distinct_id"&&E!=="$user_state")){const B=m[E];(_.isValid||iD.indexOf(E)===-1||B!==!1&&B!==0)&&delete m[E]}}),!C||"$user_state"in d||"$user_state"in m||(m[Dy]=z8),!C||("distinct_id"in I?I[eB]:m[eB])===y&&("$user_state"in I?I[Dy]:m[Dy])===x||(Nxe.forEach(E=>delete m[E]),I.$user_state==="identified"&&"distinct_id"in I?m.$user_id=I[eB]:delete m.$user_id,I.$user_state!=="identified"&&(delete m[ZAt],delete m[NQ]),delete m.__alias)}p=Xg(m,I)}else p=Xg(d,m);return c()||uc.$t(g,p),p}catch{}return null},$t(g,u,h,d,m,p){const _=uc.$t(g,u,void 0,void 0,p);try{const f=Txe(u,a);if(Object.keys(f).length){if(A){const I=eoe(g),C=Ect(f,a);if(ud.$t(I,C,h,d,m,p),ud.Ot(I)!==JSON.stringify(C)){ud.Pt(I,d);const y=Txe(u);return ud.$t(g,y,h,d,m,p),_}}ud.$t(g,f,h,d,m,p)}}catch(f){uc.Dt(f)}return _},Pt(g,u){try{jn?.localStorage.removeItem(g),ud.Pt(g,u),ud.Pt(eoe(g),u)}catch(h){uc.Dt(h)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict,()=>!!this.hi);let o,i=!1,r=!1;const s=e.persistence.toLowerCase();return s==="localstorage"&&uc.At()?(o=uc,r=!0):s==="localstorage+cookie"&&n.At()?(o=n,r=!0,i=!0):s==="sessionstorage"&&eg.At()?o=eg:s==="memory"?o=Fxe:s==="cookie"&&ud.At()?(o=ud,i=!0):n.At()?(o=n,r=!0,i=!0):ud.At()?(o=ud,i=!0):o=Fxe,this.Jo=r,this.Ko=i,o}fa(e){return`${this.ua}__${e}`}ha(e){return this.Jo&&!!e.split_storage}properties(){const e={};return pl(this.props,(n,o)=>{const i=r1(o);if(!i||i.exposure==="event"){var r;if(!(i==null||(r=i.shouldSkipFromEventProperties)===null||r===void 0)&&r.call(i,n))return;e[o]=n}}),e}load(e=!1){if(this.hi&&!e)return;const n=this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie",o=n?uc.Ft(this.ua):null;let i={};if(n)try{i=Rxe(ud.Ft(this.ua)),pl(i,(A,c)=>{(Eo(A)||ld(A)||A==="")&&delete i[c]})}catch{}const r=this.No.Ft(this.ua);if(r&&(this.props=Xg({},r)),this.Xo&&this.ja(),n&&r){var s,a;const A=o?.[eB],c=(s=o?.$user_state)!==null&&s!==void 0?s:z8,l=r[eB],g=(a=r.$user_state)!==null&&a!==void 0?a:z8;if(l!==A||g!==c){this.Yo=!0,this.hi||eg.$t(ioe(this.ua),!0);const u=Xg({},this.props);Nxe.forEach(d=>delete u[d]),g!=="anonymous"||c!=="identified"&&i.$user_state!=="anonymous"&&(Eo(A)||l===A)||(Alt(u,i),delete u[NQ]),this.props=u;const h=new Set;Nxe.forEach(d=>{var m;const p=(m=r1(d))===null||m===void 0?void 0:m.storageGroup;p&&h.add(p)}),h.forEach(d=>{if(this.hi)return;const m={};pl(this.props,(p,_)=>{var f;((f=r1(_))===null||f===void 0?void 0:f.storageGroup)===d&&(m[_]=p)}),px(m)?(uc.Pt(this.fa(d)),this.Zo[d]={}):uc.$t(this.fa(d),m)&&(this.Zo[d]={persisted:!0,fingerprint:this.ka(m,d)})})}}eg.Ot(ioe(this.ua))&&(this.Yo=!0)}ja(){for(const e of Vz){const n=uc.Ft(this.fa(e));if(n&&!px(n)){const o=this.ma(e);o.persisted=!0,this.Ba(e)||(o.fingerprint=this.ka(n,e)),this.za(e,n)||Xg(this.props,n)}}}Ba(e){return Object.keys(this.props).some(n=>{var o;return((o=r1(n))===null||o===void 0?void 0:o.storageGroup)===e})}za(e,n){const o=Own[e];if(!o)return!1;const i=n[o],r=this.props[o];return eh(i)&&eh(r)&&r>i}refreshKey(e){var n;if(this.hi||this.ra.has(e))return;const o=this.Xo?(n=r1(e))===null||n===void 0?void 0:n.storageGroup:void 0,i=o?uc.Ft(this.fa(o)):this.No.Ft(this.ua);if(i&&e in i)this.xa(e,i[e],!1);else{if(o){const r=this.No.Ft(this.ua);if(r&&e in r)return void this.xa(e,r[e],!1)}this.$a(e,!1)}}save(){if(this.hi)return;const e=this.Ea();e>0?Eo(this.La)&&(this.La=setTimeout(()=>{this.La=void 0,this.Na()},e)):this.Na()}flush(){Eo(this.La)||(clearTimeout(this.La),this.La=void 0,this.Na())}Na(e=!1){if(this.hi||this.ta&&!e)return;e||(this.syncCookieProperties(),this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie"||slt.forEach(r=>this.refreshKey(r)));const n=!e&&!this.ia;n||(this.sa=!1);const o=!!n&&this.Ca();if(this.sa)return void(this.Mr.debug&&li.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Xo)return this.Ha(),void(o&&this.oa.forEach(r=>r()));const i=this.Ua(this.No,this.ua,this.props,Zp);i==="written"&&this.Pa(this.props),i!=="failed"&&(this.ea.clear(),this.na=!1,this.ra.clear()),o&&this.oa.forEach(r=>r())}Ha(){const{main:e,groups:n}=this._a(),o=this.Ua(this.No,this.ua,e,Zp);o==="written"&&this.Pa(e),o!=="failed"&&(this.na=!1,this.ra.clear(),J8.forEach(r=>{var s;!((s=r1(r))===null||s===void 0)&&s.storageGroup||this.ea.delete(r)}));for(const r of Vz){var i;const s=n[r];if(px(s)&&!(!((i=this.Zo[r])===null||i===void 0)&&i.persisted)){J8.forEach(A=>{var c;((c=r1(A))===null||c===void 0?void 0:c.storageGroup)===r&&this.ea.delete(A)});continue}const a=this.Ua(uc,this.fa(r),s,r);a!=="failed"&&J8.forEach(A=>{const c=r1(A);c?.storageGroup!==r||a!=="written"&&c.volatile||this.ea.delete(A)})}}_a(){const e={},n={flags:{},surveys:{}};return pl(this.props,(o,i)=>{var r;const s=(r=r1(i))===null||r===void 0?void 0:r.storageGroup;s?n[s][i]=o:e[i]=o}),{main:e,groups:n}}ka(e,n){if(n===Zp)return JSON.stringify(e)+"|"+this.Wa+"|"+this.Va+"|"+this.Ga;const o={};return pl(e,(i,r)=>{var s;o[r]=!((s=r1(r))===null||s===void 0)&&s.volatile?"__volatile__":i}),JSON.stringify(o)}Ua(e,n,o,i){const r=this.ma(i);if(i!==Zp&&!r.dirty&&!Eo(r.fingerprint))return"skipped";let s;try{if(s=this.ka(o,i),s===r.fingerprint)return r.dirty=!1,"skipped"}catch{s=void 0}return e.$t(n,o,this.Wa,this.Va,this.Ga,this.Mr.debug)?(r.dirty=!1,i!==Zp&&(r.persisted=!0),Eo(s)||(r.fingerprint=s),this.Jo&&(r.storageValue=uc.Ot(n)),"written"):(this.Mr.debug&&li.warn(`failed to persist storage entry "${n}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ia(),Eo(this.La)||(clearTimeout(this.La),this.La=void 0),this.No.Pt(this.ua,!1),this.No.Pt(this.ua,!0),!e&&this.aa)for(const n of Vz)uc.Pt(this.fa(n));e?delete this.Zo[Zp]:this.Zo={},this.Ra=void 0,this.Aa=void 0}clear(){this.remove(),this.props={}}register_once(e,n,o){if(Ea(e)){this.syncCookieProperties(),Eo(n)&&(n="None"),this.Wa=Eo(o)?this.Qa:o;let i=!1;if(pl(e,(r,s)=>{this.props.hasOwnProperty(s)&&this.props[s]!==n||(this.xa(s,r),i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(Ea(e)){this.syncCookieProperties(),this.Wa=Eo(n)?this.Qa:n;let o=!1;if(pl(e,(i,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==i||Ea(i)||qr(i))&&(this.xa(r,i),o=!0)}),o)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const n=typeof e=="string"?[e]:e;let o=!1;for(const i of n)i in this.props&&(this.$a(i),o=!0);o&&this.save()}update_campaign_params(){const e=qo?.URL;if(e===this.la)return;const n=Zct(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),o=!px(Pxe(n));return o&&this.register(n),this.la=e,o?n:void 0}update_search_keyword(){this.register((function(){const e=qo?.referrer;return e?tlt(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:olt(),$referring_domain:qo?.referrer&&((e=V8(qo.referrer))===null||e===void 0?void 0:e.host)||ooe},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=ilt(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[oF]:this.Ko?{r:roe(e.r),u:e.u?roe(e.u):void 0}:e},void 0)}get_initial_props(){const e={};pl([ict,oct],o=>{const i=this.props[o];i&&pl(i,function(r,s){e["$initial_"+O2e(s)]=r})});const n=this.props[oF];if(n){const o=(function(i,r=!1){const s=rlt(i,r),a={};return pl(s,function(A,c){a[`$initial_${O2e(c)}`]=A}),a})(n,this.Mr.disable_capture_url_hashes);Xg(e,o)}return e}safe_merge(e){return pl(this.props,function(n,o){o in e||(e[o]=n)}),e}update_config(e,n,o){const i=e.persistence!==n.persistence,r=!((d,m)=>{if(d.length!==m.length)return!1;const p=[...d].sort(),_=[...m].sort();return p.every((f,I)=>f===_[I])})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),s=i||r,a=e.cookieWinsOnConflict!==n.cookieWinsOnConflict,A=e.disable_persistence||!!o,c=!!this.hi&&!A;A||this.Fa(n,c),this.Mr=e,!A&&(i||r||a)&&(this.Ra=void 0,this.Aa=void 0,this.Fa(Zt(Zt({},e),{},{cookie_persisted_properties:n.cookie_persisted_properties}),c));const l=s||a?this.ca(e):this.No;this.Za();const g=this.ha(e),u=s||g!==this.Xo,h=!A&&(u||e.cross_subdomain_cookie!==this.Va||e.secure_cookie!==this.Ga)&&this.Oa(c);this.ia=u;try{if(this.Qa=this.Wa=e.cookie_expiration,this.set_disabled(A),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),u){const d=this.props;this.clear(),this.No=l,this.Xo=g,this.props=d,this.save()}else a&&(this.No=l,A||(delete this.Zo[Zp],this.Na()))}finally{this.ia=!1,h&&this.qa()}}Za(){const e=this.props[oF];if(!this.Ko||!Ea(e)||typeof e.r!="string")return;const n=roe(e.r),o=typeof e.u=="string"?roe(e.u):e.u;n===e.r&&o===e.u||this.xa(oF,Zt(Zt({},e),{},{r:n,u:o}))}set_disabled(e){this.hi=e,this.hi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Va&&(this.Va=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,n){const o=this.props.__timers||{};o[e]=n,this.xa(mxe,o),this.save()}remove_event_timer(e){const n=this.props.__timers||{},o=n[e];return Eo(o)||(delete n[e],this.xa(mxe,n),this.save()),o}get_property(e){return this.props[e]}set_property(e,n){this.xa(e,n),this.save()}xa(e,n,o=!0){var i;const r=this.props[e];this.props[e]=n,o&&(e!=="distinct_id"&&e!=="$user_state"||r===n||(this.na=!0),alt(e)&&!FQ(r,n)&&this.ra.add(e),this.Ma(e,r,n),!((i=r1(e))===null||i===void 0)&&i.volatile||this.Ta(e))}$a(e,n=!0){delete this.props[e],n&&(Jxe(e)&&this.ga(e,!0),alt(e)&&this.ra.add(e),this.Ta(e))}Ta(e){var n;const o=(n=r1(e))===null||n===void 0?void 0:n.storageGroup;o&&(this.ma(o).dirty=!0)}ma(e){return this.Zo[e]||(this.Zo[e]={})}};const V3={GZipJS:"gzip-js",Base64:"base64"},jz={Activation:"events",Cancellation:"cancelEvents"},jxe={Popover:"popover",API:"api",Widget:"widget"},J3={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},qxe={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},$xe={Popover:"popover",Inline:"inline"};function soe(t){let e=!0;return{dispose(){if(e){e=!1;const n=t();n&&ap(n.then)&&n.then(void 0,()=>{})}}}}const Ywn={SHOWN:"product tour shown"},clt={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},llt=gd("[RateLimiter]");var Uwn=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{const o=n.text;if(o&&o.length)try{(JSON.parse(o).quota_limited||[]).forEach(i=>{llt.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void llt.warn(`could not rate limit - continuing. Error: "${i?.message}"`,{text:o})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var n,o,i;const{captureEventsBurstLimit:r,captureEventsPerSecond:s}=this,a=new Date().getTime(),A=(n=(o=this.instance.persistence)===null||o===void 0?void 0:o.get_property("$capture_rate_limit"))!==null&&n!==void 0?n:{tokens:r,last:a};A.tokens+=(a-A.last)/1e3*s,A.last=a,A.tokens>r&&(A.tokens=r);const c=1>A.tokens;if(c||e||(A.tokens=Math.max(0,A.tokens-1)),c&&!e){const l=(eh(A.dropped)?A.dropped:0)+1;A.dropped=l,!this.lastEventRateLimited&&this.Ja(l)&&(A.dropped=0)}return this.lastEventRateLimited=c,(i=this.instance.persistence)===null||i===void 0||i.set_property("$capture_rate_limit",A),{isRateLimited:c,remainingTokens:A.tokens}}Ka(e){const n=this.instance.config.property_denylist;return!qr(n)||!n.includes(e)}Xa(){var e;if(this.Ka("$current_url")&&this.Ka("$pathname")&&qg?.pathname)return`${(e=qg.origin)!==null&&e!==void 0?e:""}${qg.pathname}`}Ja(e){var n,o;const{captureEventsBurstLimit:i,captureEventsPerSecond:r}=this,s=this.Xa(),a=this.Ka("$session_id")?(n=(o=this.instance).get_session_id)===null||n===void 0?void 0:n.call(o):void 0,A=[`${e} event(s) dropped since the last warning`,s?`triggered on ${s}`:void 0,a?`session ${a}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${A}. Config is set to ${r} events per second and ${i} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}};const LQ=gd("[RemoteConfig]");var glt=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Yr._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}Ya(e){var n,o,i;!((n=Yr.__PosthogExtensions__)===null||n===void 0)&&n.loadExternalDependency?(o=Yr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}tl(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return LQ.info("Using preloaded remote config",this.remoteConfig),void this.el(this.remoteConfig);if(this._instance.il())return void LQ.warn("Remote config is disabled. Falling back to local config.");this.Ya(e=>{if(!e)return LQ.info("No config found after loading remote JS config. Falling back to JSON."),void this.tl(n=>{this.el(n.json,n)});this.el(e)})}catch(e){LQ.error("Error loading remote config",e),this.el()}}el(e,n){!e&&n&&(n.statusCode===0?n.error||LQ.warn("Failed to fetch remote config from PostHog."):LQ.error("Failed to fetch remote config from PostHog."));try{this._instance.el(e?{ok:!0,config:e}:{ok:!1})}catch(i){LQ.error("Error applying remote config",i)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var o;(o=this._instance.featureFlags)===null||o===void 0||o.ensureFlagsLoaded()}catch(i){LQ.error("Error loading feature flags",i)}}},N5=Uint8Array,_x=Uint16Array,hF=Uint32Array,Xxe=new N5([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]),Zxe=new N5([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]),ult=new N5([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),dlt=function(t,e){for(var n=new _x(31),o=0;31>o;++o)n[o]=e+=1<<t[o-1];var i=new hF(n[30]);for(o=1;30>o;++o)for(var r=n[o];n[o+1]>r;++r)i[r]=r-n[o]<<5|o;return[n,i]},hlt=dlt(Xxe,2),e3e=hlt[1];hlt[0][28]=258,e3e[258]=28;for(var mlt=dlt(Zxe,0)[1],plt=new _x(32768),dd=0;32768>dd;++dd){var mF=(43690&dd)>>>1|(21845&dd)<<1;plt[dd]=((65280&(mF=(61680&(mF=(52428&mF)>>>2|(13107&mF)<<2))>>>4|(3855&mF)<<4))>>>8|(255&mF)<<8)>>>1}var qz=function(t,e,n){for(var o=t.length,i=0,r=new _x(e);o>i;++i)++r[t[i]-1];var s,a=new _x(e);for(i=0;e>i;++i)a[i]=a[i-1]+r[i-1]<<1;for(s=new _x(o),i=0;o>i;++i)s[i]=plt[a[t[i]-1]++]>>>15-t[i];return s},aD=new N5(288);for(dd=0;144>dd;++dd)aD[dd]=8;for(dd=144;256>dd;++dd)aD[dd]=9;for(dd=256;280>dd;++dd)aD[dd]=7;for(dd=280;288>dd;++dd)aD[dd]=8;var aoe=new N5(32);for(dd=0;32>dd;++dd)aoe[dd]=5;var Kwn=qz(aD,9),zwn=qz(aoe,5),_lt=function(t){return(t/8|0)+(7&t&&1)},flt=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var o=new(t instanceof _x?_x:t instanceof hF?hF:N5)(n-e);return o.set(t.subarray(e,n)),o},W8=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8},$z=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8,t[o+2]|=n>>>16},t3e=function(t,e){for(var n=[],o=0;t.length>o;++o)t[o]&&n.push({s:o,f:t[o]});var i=n.length,r=n.slice();if(!i)return[new N5(0),0];if(i==1){var s=new N5(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort(function(y,x){return y.f-x.f}),n.push({s:-1,f:25001});var a=n[0],A=n[1],c=0,l=1,g=2;for(n[0]={s:-1,f:a.f+A.f,l:a,r:A};l!=i-1;)a=n[n[g].f>n[c].f?c++:g++],A=n[c!=l&&n[g].f>n[c].f?c++:g++],n[l++]={s:-1,f:a.f+A.f,l:a,r:A};var u=r[0].s;for(o=1;i>o;++o)r[o].s>u&&(u=r[o].s);var h=new _x(u+1),d=n3e(n[l-1],h,0);if(d>e){o=0;var m=0,p=d-e,_=1<<p;for(r.sort(function(y,x){return h[x.s]-h[y.s]||y.f-x.f});i>o;++o){var f=r[o].s;if(e>=h[f])break;m+=_-(1<<d-h[f]),h[f]=e}for(m>>>=p;m>0;){var I=r[o].s;e>h[I]?m-=1<<e-h[I]++-1:++o}for(;o>=0&&m;--o){var C=r[o].s;h[C]==e&&(--h[C],++m)}d=e}return[new N5(h),d]},n3e=function(t,e,n){return t.s==-1?Math.max(n3e(t.l,e,n+1),n3e(t.r,e,n+1)):e[t.s]=n},Ilt=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new _x(++e),o=0,i=t[0],r=1,s=function(A){n[o++]=A},a=1;e>=a;++a)if(t[a]==i&&a!=e)++r;else{if(!i&&r>2){for(;r>138;r-=138)s(32754);r>2&&(s(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(s(i),--r;r>6;r-=6)s(8304);r>2&&(s(r-3<<5|8208),r=0)}for(;r--;)s(i);r=1,i=t[a]}return[n.subarray(0,o),e]},Xz=function(t,e){for(var n=0,o=0;e.length>o;++o)n+=t[o]*e[o];return n},o3e=function(t,e,n){var o=n.length,i=_lt(e+2);t[i]=255&o,t[i+1]=o>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var r=0;o>r;++r)t[i+r+4]=n[r];return 8*(i+4+o)},Clt=function(t,e,n,o,i,r,s,a,A,c,l){W8(e,l++,n),++i[256];for(var g=t3e(i,15),u=g[0],h=g[1],d=t3e(r,15),m=d[0],p=d[1],_=Ilt(u),f=_[0],I=_[1],C=Ilt(m),y=C[0],x=C[1],E=new _x(19),B=0;f.length>B;++B)E[31&f[B]]++;for(B=0;y.length>B;++B)E[31&y[B]]++;for(var S=t3e(E,7),Q=S[0],w=S[1],M=19;M>4&&!Q[ult[M-1]];--M);var T,R,F,O,U=c+5<<3,Y=Xz(i,aD)+Xz(r,aoe)+s,j=Xz(i,u)+Xz(r,m)+s+14+3*M+Xz(E,Q)+(2*E[16]+3*E[17]+7*E[18]);if(Y>=U&&j>=U)return o3e(e,l,t.subarray(A,A+c));if(W8(e,l,1+(Y>j)),l+=2,Y>j){T=qz(u,h),R=u,F=qz(m,p),O=m;var Z=qz(Q,w);for(W8(e,l,I-257),W8(e,l+5,x-1),W8(e,l+10,M-4),l+=14,B=0;M>B;++B)W8(e,l+3*B,Q[ult[B]]);l+=3*M;for(var J=[f,y],X=0;2>X;++X){var te=J[X];for(B=0;te.length>B;++B)W8(e,l,Z[ae=31&te[B]]),l+=Q[ae],ae>15&&(W8(e,l,te[B]>>>5&127),l+=te[B]>>>12)}}else T=Kwn,R=aD,F=zwn,O=aoe;for(B=0;a>B;++B)if(o[B]>255){var ae;$z(e,l,T[257+(ae=o[B]>>>18&31)]),l+=R[ae+257],ae>7&&(W8(e,l,o[B]>>>23&31),l+=Xxe[ae]);var ie=31&o[B];$z(e,l,F[ie]),l+=O[ie],ie>3&&($z(e,l,o[B]>>>5&8191),l+=Zxe[ie])}else $z(e,l,T[o[B]]),l+=R[o[B]];return $z(e,l,T[256]),l+R[256]},Vwn=new hF([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Jwn=(function(){for(var t=new hF(256),e=0;256>e;++e){for(var n=e,o=9;--o;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),i3e=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function Wwn(t,e){e===void 0&&(e={});var n=(function(){var g=4294967295;return{p(u){for(var h=g,d=0;u.length>d;++d)h=Jwn[255&h^u[d]]^h>>>8;g=h},d(){return 4294967295^g}}})(),o=t.length;n.p(t);var i,r,s,a,A,c=(a=10+((i=e).filename&&i.filename.length+1||0),A=8,(function(g,u,h,d,m,p){var _=g.length,f=new N5(d+_+5*(1+Math.floor(_/7e3))+m),I=f.subarray(d,f.length-m),C=0;if(!u||8>_)for(var y=0;_>=y;y+=65535){var x=y+65535;_>x?C=o3e(I,C,g.subarray(y,x)):(I[y]=p,C=o3e(I,C,g.subarray(y,_)))}else{for(var E=Vwn[u-1],B=E>>>13,S=8191&E,Q=(1<<h)-1,w=new _x(32768),M=new _x(Q+1),T=Math.ceil(h/3),R=2*T,F=function(Ie){return(g[Ie]^g[Ie+1]<<T^g[Ie+2]<<R)&Q},O=new hF(25e3),U=new _x(288),Y=new _x(32),j=0,Z=0,J=(y=0,0),X=0,te=0;_>y;++y){var ae=F(y),ie=32767&y,le=M[ae];if(w[ie]=le,M[ae]=ie,y>=X){var he=_-y;if((j>7e3||J>24576)&&he>423){C=Clt(g,I,0,O,U,Y,Z,J,te,y-te,C),J=j=Z=0,te=y;for(var Ce=0;286>Ce;++Ce)U[Ce]=0;for(Ce=0;30>Ce;++Ce)Y[Ce]=0}var ce=2,_e=0,ue=S,pe=ie-le&32767;if(he>2&&ae==F(y-pe))for(var Me=Math.min(B,he)-1,ve=Math.min(32767,y),me=Math.min(258,he);ve>=pe&&--ue&&ie!=le;){if(g[y+ce]==g[y+ce-pe]){for(var Pe=0;me>Pe&&g[y+Pe]==g[y+Pe-pe];++Pe);if(Pe>ce){if(ce=Pe,_e=pe,Pe>Me)break;var Qe=Math.min(pe,Pe-2),we=0;for(Ce=0;Qe>Ce;++Ce){var Re=y-pe+Ce+32768&32767,Ne=Re-w[Re]+32768&32767;Ne>we&&(we=Ne,le=Re)}}}pe+=(ie=le)-(le=w[ie])+32768&32767}if(_e){O[J++]=268435456|e3e[ce]<<18|mlt[_e];var Be=31&e3e[ce],Te=31&mlt[_e];Z+=Xxe[Be]+Zxe[Te],++U[257+Be],++Y[Te],X=y+ce,++j}else O[J++]=g[y],++U[g[y]]}}C=Clt(g,I,p,O,U,Y,Z,J,te,y-te,C)}return flt(f,0,d+_lt(C)+m)})(r=t,(s=e).level==null?6:s.level,s.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+s.mem,a,A,!0)),l=c.length;return(function(g,u){var h=u.filename;if(g[0]=31,g[1]=139,g[2]=8,g[8]=2>u.level?4:u.level==9?2:0,g[9]=3,u.mtime!=0&&i3e(g,4,Math.floor(new Date(u.mtime||Date.now())/1e3)),h){g[3]=8;for(var d=0;h.length>=d;++d)g[d+10]=h.charCodeAt(d)}})(c,e),i3e(c,l-8,n.d()),i3e(c,l-4,o),c}const jwn=!!L2e||!!Qz,ylt=new WeakMap,xlt="text/plain";let r3e=0,Aoe=!1;const Elt=(t,e)=>{const[n,o]=t.split("#"),[i,r]=n.split("?");if(!r)return t;const s=r.split("&").filter(a=>a.split("=")[0]!==e).join("&");return`${i}${s?`?${s}`:""}${o?`#${o}`:""}`},Zz=(t,e,n=!0)=>{var o;const[i,r]=t.split("?"),s=Zt({},e),a=(o=r?.split("&").map(c=>{var l;const[g,u]=c.split("="),h=n&&(l=s[g])!==null&&l!==void 0?l:u;return delete s[g],`${g}=${h}`}))!==null&&o!==void 0?o:[],A=(function(c,l="&"){let g,u;const h=[];return pl(c,function(d,m){Eo(d)||Eo(m)||m==="undefined"||(g=encodeURIComponent((p=>p instanceof File)(d)?d.name:d.toString()),u=encodeURIComponent(m),h[h.length]=u+"="+g)}),h.join(l)})(s);return A&&a.push(A),a.length>0?`${i}?${a.join("&")}`:i},s3e=t=>{if(t.nl)return t.nl;const{data:e,compression:n}=t;if(!e)return;if(n===V3.GZipJS){const i=Wwn((function(r){var s=r.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(r);for(var a=new N5(r.length+(r.length>>>1)),A=0,c=function(h){a[A++]=h},l=0;s>l;++l){if(A+5>a.length){var g=new N5(A+8+(s-l<<1));g.set(a),a=g}var u=r.charCodeAt(l);128>u?c(u):2048>u?(c(192|u>>>6),c(128|63&u)):u>55295&&57344>u?(c(240|(u=65536+(1047552&u)|1023&r.charCodeAt(++l))>>>18),c(128|u>>>12&63),c(128|u>>>6&63),c(128|63&u)):(c(224|u>>>12),c(128|u>>>6&63),c(128|63&u))}return flt(a,0,A)})(lF(e)),{mtime:0});return{contentType:xlt,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===V3.Base64){const i=(function(s){return s&&btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g,(a,A)=>String.fromCharCode(parseInt(A,16))))})(lF(e)),r=(s=>"data="+encodeURIComponent(typeof s=="string"?s:lF(s)))(i);return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}const o=lF(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}},Blt=t=>{const e=()=>t.transport==="sendBeacon"?{url:Zz(t.url,{compression:V3.Base64}),encodedBody:s3e(Zt(Zt({},t),{},{compression:V3.Base64,nl:void 0}))}:{url:Elt(t.url,"compression"),encodedBody:s3e(Zt(Zt({},t),{},{compression:void 0,nl:void 0}))};let n;try{n=s3e(t)}catch(i){if(xAt(t.compression,gF(t.url,"compression")))return li.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return n&&xAt(t.compression,gF(t.url,"compression"))&&!((o=n.body)instanceof ArrayBuffer?oxe(new Uint8Array(o)):ArrayBuffer.isView(o)&&oxe(new Uint8Array(o.buffer,o.byteOffset,o.byteLength)))?(Aoe=!0,e()):{url:t.url,encodedBody:n};var o},blt=t=>{try{return Blt(t)}catch(n){var e;return li.error(n),void((e=t.callback)===null||e===void 0||e.call(t,{statusCode:0,error:n}))}},qwn=(function(){var t=$g(function*(e){const n=yield(function(i){return ixe.apply(this,arguments)})(lF(e.data),Xp.DEBUG,{rethrow:!0});if(!n)return e;const o=yield n.arrayBuffer();return Zt(Zt({},e),{},{nl:{contentType:xlt,body:o,estimatedSize:o.byteLength}})});return function(e){return t.apply(this,arguments)}})(),$wn=/Failed to fetch|NetworkError|Load failed/i,Slt=t=>t?.name==="TypeError"&&$wn.test(t?.message||""),Qlt=t=>{try{const e=(function(n,o=Date.now()){if(typeof n!="string"||!n)return;const i=n.trim(),r=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(r)){const A=1e3*Math.min(Number(r),300);return A>0?A:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r))return;const s=/^\w{3} \w{3} /.test(r)?r+" GMT":r,a=Date.parse(s)-o;return Number.isFinite(a)&&a>0?Math.min(a,One):void 0})(t());return Eo(e)?void 0:Math.min(e,3e4)}catch{return}},vlt=t=>{const e=blt(t);if(!e)return;const n=new L2e;ylt.set(n,!0);const{url:o,encodedBody:i}=e;n.open(t.method||"GET",o,!0);const{contentType:r,body:s}=i??{};pl(t.headers,function(a,A){n.setRequestHeader(A,a)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var a;const A={statusCode:n.status,text:n.responseText};if(n.status===200)try{A.json=JSON.parse(n.responseText)}catch{}(a=t.callback)===null||a===void 0||a.call(t,A,Qlt(()=>n.getResponseHeader("Retry-After")))}},n.send(s)},wlt=t=>{const e=blt(t);if(!e)return;const{url:n,encodedBody:o}=e,{contentType:i,body:r,estimatedSize:s}=o??{},a=new Headers;pl(t.headers,function(d,m){a.append(m,d)}),i&&a.append("Content-Type",i);let A=null,c=!1;if(Iat){const d=new Iat;A={signal:d.signal,timeout:setTimeout(()=>{c=!0;try{d.abort(sAt("AbortError","PostHog request timed out"+((m=t.timeout)?` after ${m}ms`:"")))}catch(p){g(p)}var m},t.timeout)}}let l=!1;const g=d=>{var m;l||(l=!0,c&&d?.name==="AbortError"||Slt(d)?li.warn(d):li.error(d),(m=t.callback)===null||m===void 0||m.call(t,{statusCode:0,error:d}))};let u=0;const h=()=>{r3e-=u,u=0,A&&clearTimeout(A.timeout)};try{const d=Zt({method:t?.method||"GET",headers:a,referrerPolicy:"strict-origin",body:r,signal:A?.signal},t.fetchOptions),m=s??(Eo(r)?0:void 0);d.keepalive=d.method==="POST"&&!t.sl&&d.keepalive!==!1&&d.body===r&&!Eo(m)&&m>=0&&52428.8>r3e+m,d.keepalive&&(u=m,r3e+=u),Qz(n,d).then(p=>p.text().then(_=>{var f;if(l)return;const I={statusCode:p.status,text:_};if(p.status===200)try{I.json=JSON.parse(_)}catch(C){li.error(C)}l=!0,h(),(f=t.callback)===null||f===void 0||f.call(t,I,Qlt(()=>p.headers.get("Retry-After")))})).catch(p=>{h(),g(p)}).finally(h)}catch(d){h(),g(d)}},a3e=t=>{try{var e;const{url:n,encodedBody:o}=Blt(t),{contentType:i,body:r,estimatedSize:s}=o??{};if(!r)return;const a=r instanceof Blob?r:new Blob([r],{type:i});if(X_.sendBeacon(n,a))return;const A=qr(t.data)?t.data:(e=t.data)===null||e===void 0?void 0:e.batch;if(qr(A)&&A.length>1&&(s??0)>16384){const c=Math.ceil(A.length/2),l=g=>qr(t.data)?g:Zt(Zt({},t.data),{},{batch:g});return a3e(Zt(Zt({},t),{},{data:l(A.slice(0,c))})),void a3e(Zt(Zt({},t),{},{data:l(A.slice(c))}))}li.warn(`Beacon of ~${s??0} bytes was rejected by the browser, falling back to ${Qz?"fetch":"XHR"}`),Qz?wlt(Zt(Zt({},t),{},{sl:!0})):vlt(t)}catch(n){li.warn("Beacon send failed",n)}},Plt=(t,e,n,o)=>{const i=o==="query"?e==="POST"?"sent_at":"_":void 0;return Zz(n===V3.GZipJS?Elt(t,"compression"):t,Zt(Zt({},i?{[i]:Date.now().toString()}:{}),n===V3.GZipJS?{}:{compression:n}))},Xwn=(()=>{const t=[];return Qz&&t.push({transport:"fetch",method:wlt}),L2e&&t.push({transport:"XHR",method:vlt}),X_?.sendBeacon&&t.push({transport:"sendBeacon",method:a3e}),t})();let Mlt=!jwn&&Py?.indexOf("MSIE")===-1&&Py?.indexOf("Mozilla")===-1;function Dlt(t,e,n){var o,i,r;n&&(e=Zt(Zt({},e),{},{callback:s=>n(s)})),t.__loaded?Mlt?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&((i=e.callback)===null||i===void 0||i.call(e,{statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=Zt(Zt({},t.config.request_headers),e.headers),e.compression=e.compression==="best-available"?(o=t.compression)!==null&&o!==void 0?o:e.compressionFallback:e.compression,(Eo(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((s,a)=>{var A,c,l;const g=Zt(Zt({},s),{},{callback:a??(p=>{var _;return(_=s.callback)===null||_===void 0?void 0:_.call(s,p)})});g.timeout=g.timeout||6e4;const u=(A=g.transport)!==null&&A!==void 0?A:"fetch";u==="sendBeacon"&&Eo(g.compression)&&g.data&&(g.compression=V3.Base64),g.method==="POST"&&g.data&&(g.timestampMode==="capture-body"?g.data=(p=>{var _,f;const I=(qr(p)?p:[p]).map(y=>Zt(Zt({},y),y.timestamp instanceof Date&&!isNaN(y.timestamp.getTime())?{timestamp:y.timestamp.toISOString()}:{})),C=I[0];return{api_key:(_=C==null||(f=C.properties)===null||f===void 0?void 0:f.token)!==null&&_!==void 0?_:C?.token,batch:I,sent_at:new Date().toISOString()}})(g.data):g.timestampMode==="body"&&(g.data=((p,_=new Date().toISOString())=>qr(p)?p.map(f=>Zt(Zt({},f),{},{sent_at:_})):Zt(Zt({},p),{},{sent_at:_}))(g.data))),g.url=Plt(g.url,g.method,g.compression,g.timestampMode);const h=Xwn.filter(p=>!g.disableTransport||!p.transport||!g.disableTransport.includes(p.transport)),d=(c=(l=(function(p,_){for(let f=0;p.length>f;f++)if(_(p[f]))return p[f]})(h,p=>p.transport===u))===null||l===void 0?void 0:l.method)!==null&&c!==void 0?c:h[0].method;if(!d)throw new Error("No available transport method");const m=p=>{try{d(p)}catch(f){var _;Slt(f)?li.warn(f):li.error(f),(_=g.callback)===null||_===void 0||_.call(g,{statusCode:0,error:f})}};u!=="sendBeacon"&&!g.preferSyncCompression&&g.data&&g.compression===V3.GZipJS&&hQn&&typeof Promise<"u"&&!Aoe?qwn(g).then(p=>{m(p)}).catch(p=>{if(EAt(p))return Aoe=!0,void m(Zt(Zt({},g),{},{compression:void 0,url:Plt(s.url,s.method,void 0,s.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;const f="name"in _?String(_.name):"";return EAt(_)||f===yAt})(p)&&(Aoe=!0),m(g)}):m(g)})(e,(s,a)=>{var A,c,l;t.rateLimiter.checkForLimiting(s),400>s.statusCode||(A=(c=t.config).on_request_error)===null||A===void 0||A.call(c,s),n?n(s,a):(l=e.callback)===null||l===void 0||l.call(e,s)})):e.fireCallbackOnDrop&&((r=e.callback)===null||r===void 0||r.call(e,{statusCode:0}))}var Zwn=class{constructor(e,n){this.rl=!0,this.ol=[],this.al=z9(n?.flush_interval_ms||3e3,250,5e3,li.createLogger("flush interval"),3e3),this.ll=e}enqueue(e){this.ol.push(e),this.ul||this.cl()}unload(){this.hl();const e=this.ol.length>0?this.dl():{},n=Object.values(e);[...n.filter(o=>o.url.indexOf("/e")===0),...n.filter(o=>o.url.indexOf("/e")!==0)].map(o=>{this.vl(Zt(Zt({},o),{},{callback:void 0}),"sendBeacon")})}enable(){this.rl=!1,this.cl()}cl(){this.rl||(this.ul=setTimeout(()=>{this.hl(),this.fl()},this.al))}fl(){if(this.ol.length>0){const e=this.dl();for(const n in e)this.vl(e[n])}}vl(e,n){try{this.ll(e,n)}catch(o){li.error(o)}}hl(){clearTimeout(this.ul),this.ul=void 0}dl(){const e={},n={};pl(this.ol,o=>{var i;const r=o,s=((r?r.batchKey:null)||r.url)+(r.batchGroup?`:${r.batchGroup}`:"");Eo(e[s])&&(e[s]=Zt(Zt({},r),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),n[s]=[]),(i=e[s].data)===null||i===void 0||i.push(r.data),r.callback&&n[s].push(r.callback)});for(const o in n){const i=n[o];i.length&&(e[o].callback=r=>{for(const s of i)s(r)})}return this.ol=[],e}};const ePn=["retriesPerformedSoFar"];var tPn=class{constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.ol=[],this.ol=[],this.ml=!0,this.resume()}resume(){if(!Eo(jn)&&"onLine"in jn.navigator){if(this.ml=jn.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.fl()},this.bl=()=>{this.ml=!1},Wc(jn,"online",this.yl),Wc(jn,"offline",this.bl)}}get length(){return this.ol.length}retriableRequest(e,n){let{retriesPerformedSoFar:o}=e,i=bAt(e,ePn);U8(o)&&(i.url=Zz(i.url,{retry_count:o})),Dlt(this._instance,n?Zt(Zt({},i),{},{transport:n}):i,(r,s)=>{var a;if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(o??0))return void this.Ls(Zt({retriesPerformedSoFar:o},i),s);r.statusCode===0&&li.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${o??0} retries.`)}(a=i.callback)===null||a===void 0||a.call(i,r)})}Ls(e,n){const o=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=o+1;const i=Math.max((function(a){const A=3e3*Math.pow(2,a),c=A/2,l=Math.min(18e5,A),g=(Math.random()-.5)*(l-c);return Math.ceil(l+g)})(o),n??0),r=Date.now()+i;this.ol.push({retryAt:r,requestOptions:e});let s=`Enqueued failed request for retry in ${i}`;navigator.onLine||(s+=" (Browser is offline)"),li.warn(s),this.pl||(this.pl=!0,this._l())}_l(){if(this.wl&&clearTimeout(this.wl),this.ol.length===0)return this.pl=!1,void(this.wl=void 0);this.wl=setTimeout(()=>{this.ml&&this.ol.length>0&&this.fl(),this._l()},this.gl)}fl(){const e=Date.now(),n=[],o=this.ol.filter(i=>e>i.retryAt||(n.push(i),!1));if(this.ol=n,o.length>0)for(const{requestOptions:i}of o)this.retriableRequest(i)}unload(){this.wl&&(clearTimeout(this.wl),this.wl=void 0),this.pl=!1,Eo(jn)||(this.yl&&(jn.removeEventListener("online",this.yl),this.yl=void 0),this.bl&&(jn.removeEventListener("offline",this.bl),this.bl=void 0));for(const{requestOptions:e}of this.ol)try{this._instance._send_request(Zt(Zt({},e),{},{callback:qr(e.data)?void 0:e.callback,transport:"sendBeacon"}))}catch(n){li.error(n)}this.ol=[]}},nPn=class{constructor(e){this._instance=e,this.kl=()=>{var n,o,i,r;this.Sl||(this.Sl={});const s=this.scrollElement(),a=this.scrollY(),A=s?Math.max(0,s.scrollHeight-s.clientHeight):0,c=a+(s?.clientHeight||0),l=s?.scrollHeight||0;this.Sl.lastScrollY=Math.ceil(a),this.Sl.maxScrollY=Math.max(a,(n=this.Sl.maxScrollY)!==null&&n!==void 0?n:0),this.Sl.maxScrollHeight=Math.max(A,(o=this.Sl.maxScrollHeight)!==null&&o!==void 0?o:0),this.Sl.lastContentY=c,this.Sl.maxContentY=Math.max(c,(i=this.Sl.maxContentY)!==null&&i!==void 0?i:0),this.Sl.maxContentHeight=Math.max(l,(r=this.Sl.maxContentHeight)!==null&&r!==void 0?r:0)}}get xl(){return this._instance.config.scroll_root_selector}getContext(){return this.Sl}resetContext(){const e=this.Sl;return this.Sl=void 0,setTimeout(this.kl,0),e}startMeasuringScrollPosition(){Wc(jn,"scroll",this.kl,{capture:!0}),Wc(jn,"scrollend",this.kl,{capture:!0}),Wc(jn,"resize",this.kl)}scrollElement(){if(this.xl){const o=qr(this.xl)?this.xl:[this.xl];for(const i of o){var e;const r=jn==null||(e=jn.document)===null||e===void 0?void 0:e.querySelector(i);if(r)return r}return}var n;return jn==null||(n=jn.document)===null||n===void 0?void 0:n.documentElement}$l(e){var n,o;const i=e==="y"?"scrollTop":"scrollLeft";if(this.xl){const r=this.scrollElement();return r&&r[i]||0}return jn?e==="y"?jn.scrollY||jn.pageYOffset||((n=jn.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.scrollTop)||0:jn.scrollX||jn.pageXOffset||((o=jn.document)===null||o===void 0||(o=o.documentElement)===null||o===void 0?void 0:o.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}};const oPn=t=>ilt(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes);var Nlt=class{constructor(e,n,o,i){this.qe=r=>{const s=this.Cl();if(s&&s.sessionId===r)return;const a={sessionId:r,props:this.Tl(this._instance)};this.Il.register({[Exe]:a})},this._instance=e,this.Ml=n,this.Il=o,this.Tl=i||oPn,this.Ml.onSessionId(this.qe)}Cl(){return this.Il.props[Exe]}getSetOnceProps(){var e;const n=(e=this.Cl())===null||e===void 0?void 0:e.props;return n?"r"in n?rlt(n,this._instance.config.disable_capture_url_hashes):{$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(){const e={};return pl(Pxe(this.getSetOnceProps()),(n,o)=>{o==="$current_url"&&(o="url"),e[`$session_entry_${O2e(o)}`]=n}),e}},coe=class{on(e,n){return this.El[e]||(this.El[e]=[]),this.El[e].push(n),()=>{this.El[e]=this.El[e].filter(o=>o!==n)}}emit(e,n){for(const o of this.El[e]||[])o(n);for(const o of this.El["*"]||[])o(e,n)}constructor(){this.El={}}};const pF=gd("[SessionId]"),Rlt=864e5;var Tlt=class{on(e,n){return this.Pl.on(e,n)}constructor(e,n,o){var i;if(this.Rl=null,this.Al=null,this.Fl=[],this.Ol=void 0,this.Dl=!1,this.Pl=new coe,this.Ll=(s,a)=>!(!U8(s)||!U8(a))&&Math.abs(s-a)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=e.config,this.Il=e.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Nl=void 0,this._sessionActivityTimestamp=null,this.ql=n||tB,this.jl=o||tB;const r=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*z9(this.Mr.session_idle_timeout_seconds||1800,60,36e3,pF.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Bl(),this.zl="ph_"+r+"_window_id",this.Hl="ph_"+r+"_primary_window_exists",this.Ul()){const s=eg.Ft(this.zl),a=eg.Ft(this.Hl);s&&!a?this.je=s:eg.Pt(this.zl),eg.$t(this.Hl,!0)}!((i=this.Mr.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Wl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Eo(this.Fl)&&(this.Fl=[]),this.Fl.push(e),this.Xt&&e(this.Xt,this.je),()=>{this.Fl=this.Fl.filter(n=>n!==e)}}Ul(){return this.Mr.persistence!=="memory"&&!this.Il.hi&&eg.At()}Vl(e){e!==this.je&&(this.je=e,this.Ul()&&eg.$t(this.zl,e))}Gl(){return this.je?this.je:this.Ul()?eg.Ft(this.zl):null}Ql(e){const n=this.Rl;return!ld(n)&&!ld(e)&&5e3>Math.abs(e-n)}Zl(e,n,o){const i=n!==this._sessionActivityTimestamp,r=!(e!==this.Xt||o!==this._sessionStartTimestamp);this._sessionStartTimestamp=o,this._sessionActivityTimestamp=n,this.Xt=e,r&&!i||r&&this.Ql(n)||(this.Rl=n,this.Il.register({[nF]:[n,e,o]}))}Jl(){var e;const n=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return U8(n)&&n>0}Kl(){this.Jl()?this.Il.refreshKey(nF):(this.Il.flush(),this.Il.load())}Xl(){var e;if(ld(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Rl)return;this.Kl();const[,n,o]=this.Yl();n===this.Xt&&o===this._sessionStartTimestamp&&(this.Rl=this._sessionActivityTimestamp,this.Il.register({[nF]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Il.flush())}tu(){const[e]=this.Yl(),n=U8(e)?e:0,o=U8(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,o)}eu(e){return this.Kl(),this.Ll(e,this.tu())}Yl(){const e=this.Il.props[nF];return qr(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Rl=null,this.Nl=void 0,clearTimeout(this.iu),this.iu=void 0,this.Zl(null,null,null)}setBootstrapSessionId(e,n=!1){const o=((i,r=new Date().getTime())=>{try{const s=(a=>{const A=a.replace(/-/g,"");if(A.length!==32)throw new Error("Not a valid UUID");if(A[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(A.substring(0,12),16)})(i);return s>r+6e4?void pF.error("Bootstrap sessionID cannot be in the future"):s}catch(s){return void pF.error("Invalid sessionID in bootstrap",s)}})(e);return!Eo(o)&&(n?this.Nl={sessionId:e,sessionStartTimestamp:o}:this.Zl(e,new Date().getTime(),o),!0)}destroy(){this.Dl=!0,this.Xl(),clearTimeout(this.iu),this.iu=void 0,this.Ol&&jn&&(jn.removeEventListener(Xne,this.Ol,{capture:!1}),this.Ol=void 0),this.Fl=[]}Wl(){this.Ol=()=>{this.Xl(),this.Ul()&&eg.Pt(this.Hl)},Wc(jn,Xne,this.Ol,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,n=null,o=!1){if(this.Mr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const i=n||new Date().getTime(),r=this.Xt;if(o)this.Al=i;else if(ld(this.Al)||this.Al>i||i-this.Al>=1e3){var s,a;(s=(a=this.Il).syncCookieProperties)===null||s===void 0||s.call(a),this.Al=i}let[,A,c]=this.Yl();const l=!Eo(r)&&A!==r,g=this.tu();let u=this.Gl();const h=this.Nl,d=!!h&&(h.sessionStartTimestamp>i+6e4||i-h.sessionStartTimestamp>Rlt),m=h?d:U8(c)&&Math.abs(i-c)>Rlt;let p=!1,_=l,f=!A||!!h;const I=A;let C=!f&&!e&&this.Ll(i,g);if(C&&(C=this.eu(i),C||pF.info("cross-tab refresh kept the session alive",{sessionId:A}),[,A,c]=this.Yl(),C||(f=!A||!!h)),f||C||m){_=!1;const B=h&&!d;A=B?h.sessionId:this.ql(),u=this.jl(),pF.info("new session ID assigned",{sessionId:A,windowId:u,bootstrapped:!!B,changeReason:{noSessionId:f,activityTimeout:C,sessionPastMaximumLength:m}}),c=B?h.sessionStartTimestamp:i,this.Nl=void 0,p=!0}else u||(u=this.jl(),p=!0),_=_||A!==I,_&&(pF.info("adopted cross-tab session id",{sessionId:A,windowId:u}),p=!0);const y=U8(g)&&e&&!m?g:i,x=U8(c)?c:new Date().getTime();this.Vl(u),this.Zl(A,y,x),e||this.Bl();const E={noSessionId:f,activityTimeout:C,sessionPastMaximumLength:m,crossTabAdoption:_};return p&&this.Fl.forEach(B=>B(A,u,E)),{sessionId:A,windowId:u,sessionStartTimestamp:x,changeReason:p?E:void 0,lastActivityTimestamp:g}}Bl(){this.Dl||(clearTimeout(this.iu),this.iu=setTimeout(()=>{if(!this.Dl)if(this.eu(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Pl.emit("forcedIdleReset",{idleSessionId:e})}else this.Bl()},1.1*this.sessionTimeoutMs))}};const klt=function(t,e){if(!t)return!1;const n=t.userAgent;if(n&&bat(n,e))return!0;try{const o=t?.userAgentData;if(o?.brands&&o.brands.some(i=>bat(i?.brand,e)))return!0}catch{}return!!t.webdriver};function Flt(){return(Flt=$g(function*(){const t=X_?.userAgentData;if(t?.getHighEntropyValues)try{const e=yield t.getHighEntropyValues(["model"]),n=e?.model;return $a(n)&&n.length>0?n:void 0}catch(e){return void li.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function iPn(t,e){let n=`$survey_${e}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(n=`$survey_${e}/${t.id}/${t.current_iteration}`),n}function Llt(t){var e;return!!(!((e=t.conditions)===null||e===void 0||(e=e.events)===null||e===void 0||(e=e.values)===null||e===void 0)&&e.length)}const loe=(t,e)=>{if(!(n=>{try{new RegExp(n)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}},goe=t=>t.toLowerCase(),Hlt={exact:(t,e)=>e.some(n=>t.some(o=>n===o)),is_not:(t,e)=>e.every(n=>t.every(o=>n!==o)),regex:(t,e)=>e.some(n=>t.some(o=>loe(n,o))),not_regex:(t,e)=>e.every(n=>t.every(o=>!loe(n,o))),icontains:(t,e)=>e.map(goe).some(n=>t.map(goe).some(o=>n.includes(o))),not_icontains:(t,e)=>e.map(goe).every(n=>t.map(goe).every(o=>!n.includes(o))),gt:(t,e)=>e.some(n=>{const o=parseFloat(n);return!isNaN(o)&&t.some(i=>o>parseFloat(i))}),lt:(t,e)=>e.some(n=>{const o=parseFloat(n);return!isNaN(o)&&t.some(i=>o<parseFloat(i))})};function Olt(t,e){return!t||Object.entries(t).every(([n,o])=>{const i=e?.[n];if(i==null)return!1;const r=Hlt[o.operator];return!!r&&r(o.values.map(String),[String(i)])})}function A3e(t,e,n){return lF({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}const c3e="custom",Glt="i.posthog.com",rPn=/^\/static\//,sPn=["/s/","/e/","/i/"];var aPn=class{constructor(e){this.nu={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let n=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace(`.${Glt}`,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.nu[this.apiHost]||(this.nu[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":c3e),this.nu[this.apiHost]}su(e){if(!rPn.test(e))return;const n=this.instance.config.asset_host;return typeof n=="string"&&n.trim().replace(/\/$/,"")||void 0}ru(e){const n=V8(e);return n?n.protocol+"//"+n.host+n.pathname:void 0}ou(e,n,o){if(e==="ui")return o;let i=o;const r=this.instance.config.rewriteRequestPath;if(r){var s;const a=((s=V8(o))===null||s===void 0?void 0:s.href)||o;i=r(new URL(a)).toString()}if(r&&e==="api"&&sPn.some(a=>n.indexOf(a)===0)){const a=this.ru(i);if(a){const A=this.apiHost;let c=this.au;c?.apiHost===A&&c.rewriteRequestPath===r||(c={apiHost:A,rewriteRequestPath:r,urls:new Set},this.au=c),c.urls.add(a)}}return i}isIngestionEndpoint(e){const n=this.au,o=this.ru(e);return n?.apiHost===this.apiHost&&n.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!o&&n.urls.has(o)}endpointFor(e,n=""){if(n&&(n=n[0]==="/"?n:`/${n}`),e==="ui")return this.ou(e,n,this.uiHost+n);if(e==="flags")return this.ou(e,n,this.flagsApiHost+n);if(e==="assets"){const i=this.su(n);if(i)return this.ou(e,n,`${i}${n}`)}if(this.region===c3e)return this.ou(e,n,this.apiHost+n);const o=Glt+n;switch(e){case"assets":return this.ou(e,n,`https://${this.region}-assets.${o}`);case"api":return this.ou(e,n,`https://${this.region}.${o}`)}}};const _l=gd("[Surveys]"),Ylt=t=>{try{const e=(n=>((o,i)=>`seenSurvey_${(function(r){return r.current_iteration&&r.current_iteration>0?`${r.id}_${r.current_iteration}`:r.id})(i)}`)(0,n))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(e){_l.error("Failed to persist survey seen state",e)}},APn=[jxe.Popover,jxe.Widget,jxe.API],cPn={ignoreConditions:!1,ignoreDelay:!1,displayType:$xe.Popover},lPn=gd("[PostHog ExternalIntegrations]"),gPn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var uPn=class{constructor(e){this._instance=e}zo(e,n){var o,i;(o=Yr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,e,r=>{if(r)return lPn.error("failed to load script",r);n()})}startIfEnabledOrStop(){var e;for(const[r,s]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var n,o,i;s&&!(!((n=Yr.__PosthogExtensions__)===null||n===void 0||(n=n.integrations)===null||n===void 0)&&n[r])&&this.zo(gPn[r],()=>{var a;(a=Yr.__PosthogExtensions__)===null||a===void 0||(a=a.integrations)===null||a===void 0||(a=a[r])===null||a===void 0||a.start(this._instance)}),!s&&(!((o=Yr.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0)&&o[r])&&((i=Yr.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0||(i=i[r])===null||i===void 0||i.stop())}}},dPn=class{constructor(e,n){this.A=e,this.bo=n,this.lu=new Map,this.To=!1}add(e){var n=this;return $g(function*(){if(n.To)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.lu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);n.lu.set(e.name,e);try{const o=e.setup(n.bo);o&&(yield o)}catch(o){const i=n.lu.get(e.name)===e;i&&n.lu.delete(e.name),n.A.error(`Failed to set up browser extension "${e.name}"`,o),i&&n.uu(e)}})()}getExtension(e){return this.lu.get(e)}dispose(){if(this.To)return;this.To=!0;const e=Array.from(this.lu.values()).reverse();this.lu.clear();for(const n of e)this.uu(n)}uu(e){try{var n;const o=(n=e.dispose)===null||n===void 0?void 0:n.call(e);o&&ap(o.then)&&o.then(void 0,i=>{this.A.error(`Failed to dispose browser extension "${e.name}"`,i)})}catch(o){this.A.error(`Failed to dispose browser extension "${e.name}"`,o)}}},hPn=class{constructor(e){this._instance=e}initialize(){}get(e){const n=this._instance.persistence;if(typeof e=="string")return n?.get_property(e);const o={};for(const i of e){const r=n?.get_property(i);Eo(r)||(o[i]=r)}return o}set(e,n){var o;(o=this._instance.persistence)===null||o===void 0||o.register(typeof e=="string"?{[e]:n}:e)}remove(e){var n;(n=this._instance.persistence)===null||n===void 0||n.unregister(e)}};const Ult="extensionsRemoteConfig";var mPn=class{constructor(e){this.instance=e,this.To=!1,this.A=li,this.cu=e.hu,this.kv=new hPn(e),this.onEvent=n=>soe(this.instance.on("eventCaptured",o=>{try{n({event:o.event,properties:o.properties})}catch(i){this.A.error("Browser extension event listener failed",i)}})),this.onRemoteConfig=n=>{if(this.To)return soe(()=>{});const o=r=>{try{n(r)}catch(s){this.A.error("Browser extension remote config listener failed",s)}},i=this.instance.du.on(Ult,o);return this.cu&&o(this.cu),soe(i)},this.vu=new dPn(li.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property(dxe);return typeof e=="string"?e:void 0}get library(){return{name:Xp.LIB_NAME,version:Xp.LIB_VERSION}}get initialPersonProperties(){var e,n;return(e=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,n,o,i;const r=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=r?.sessionId)!==null&&n!==void 0?n:"",windowId:(o=r?.windowId)!==null&&o!==void 0?o:"",sessionStartTimestamp:(i=r?.sessionStartTimestamp)!==null&&i!==void 0?i:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.vu.add(e)}getExtension(e){return this.vu.getExtension(e)}capture(e,n,o){o?this.instance.capture(e,n,{timestamp:o.timestamp,uuid:o.uuid,$set:o.set,$set_once:o.setOnce}):this.instance.capture(e,n)}registerDynamicEventProperties(e){return soe(this.instance.fu(e))}handleRemoteConfig(e){this.To||(this.cu=e,this.instance.du.emit(Ult,e))}sendRequest(e){var n=this;return $g(function*(o,i={}){var r;const s=n.instance.requestRouter.endpointFor((r=i.target)!==null&&r!==void 0?r:"api",o),a={method:i.method,url:i.query?Zz(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:i.target==="flags"&&i.compression==="best-available"?H2e.Base64:void 0,timestampMode:i.sentAt};return i.transport==="sendBeacon"?(n.instance._send_request(a),{statusCode:202}):new Promise(A=>{a.callback=A,n.instance._send_request(a)})}).apply(this,arguments)}dispose(){this.To||(this.To=!0,this.vu.dispose())}};const eV={};let l3e=0;const tV=()=>{},Klt='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',_F="Surveys module not available",zlt="sanitize_properties is deprecated. Use before_send instead",Vlt="Invalid value for property_denylist config: ",pPn=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],_Pn=["$feature_flag_called","$$heatmap","$snapshot"],Jlt=t=>t.charAt(0)==="$"&&!jr(_Pn,t),fPn=/^[A-Za-z0-9_-]{1,400}$/,Wlt=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,jlt=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,IPn=["token","distinct_id",rct],nV="posthog",CPn=t=>{const e={};return t&&t!=="unset"&&("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0)),e},g3e=t=>{var e;return Zt({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:mwn(qo?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:tV,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_replay_sync_fetch:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:qg&&$a(qg?.search)&&qg.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_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(jn==null||(e=jn.location)===null||e===void 0?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,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,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(n){li.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:mct,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:tV},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:Kxe,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:CPn(n),external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n),cookieWinsOnConflict:!(!n||n==="unset"||"2026-08-29">n)}))(t))},yPn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],qlt=t=>{const e={};for(const[i,r]of yPn)Eo(t[i])||(e[r]=t[i]);const n=Xg({},e,t),o=t.__preview_external_dependency_versioned_paths;return Eo(o)||(Eo(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),$a(o)&&Eo(t.asset_host)&&(n.asset_host=o)),qr(t.property_blacklist)&&(Eo(t.property_denylist)?n.property_denylist=t.property_blacklist:qr(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:li.error(Vlt+t.property_denylist)),n};var xPn=class{constructor(){this.__forceAllowLocalhost=!1}get pu(){return this.__forceAllowLocalhost}set pu(e){li.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},oV=class WM{gu(e){if(!e)return;const n=this.lu.indexOf(e);n!==-1&&this.lu.splice(n,1)}mu(e,n){var o;return this.gu(e),this.lu.push(n),(o=n.initialize)===null||o===void 0||o.call(n),n}yu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}bu(){if(this._u||this.config.reuseAnonymousId||this.config.segment||this.yu())return;const e=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!e&&!this.config.disable_persistence||this.wu)return;let n,o,i;e?(n=`persistence is set to '${this.config.persistence}'`,o=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(n="persistence is disabled (disable_persistence is true)",o="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._u=!0,console.warn("[PostHog.js]",`${n} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${o}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${i}`)}ku(){const e=this.persistence;if(!e||this.Su)return;if(this.yu())return void(this.config.cookieless_mode==="on_reject"&&this.get_distinct_id()!=="$posthog_cookieless"&&(this.xu(),this.$u()));if(this.get_distinct_id()!=="$posthog_cookieless")return;this.Cu()||e.load(!0);const n=this.get_distinct_id();if(!n||n==="$posthog_cookieless"){const o=this.config.get_device_id(tB());this.register({distinct_id:o,$device_id:o}),e.set_property(Dy,z8)}this.xu()}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.Tu=!1,this.Iu=!1,this.webPerformance=new xPn,this.Mu=!1,this.version=Xp.LIB_VERSION,this.Eu=new Set,this.Pu="",this.du=new coe,this.lu=[],this.Ru=[],this.Au=!1,this.wu=!1,this._u=!1,this.Su=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=g3e(),this.SentryIntegration=Nwn,this.sentryIntegration=o=>(function(i,r){const s=Jct(i,r);return{name:Vct,processEvent:a=>s(a)}})(this,o),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fu=!1,this.Ou=null,this.Du=null,this.Lu=null,this.scrollManager=new nPn(this),this.pageViewManager=new Wct(this),this.rateLimiter=new Uwn(this),this.requestRouter=new aPn(this),this.consent=new xwn(this),this.externalIntegrations=new uPn(this);const n=(e=WM.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(o,i,r)=>{const s=$a(o)?{[o]:i}:o;this.setPersonProperties(s),r?.({})},set_once:(o,i,r)=>{const s=$a(o)?{[o]:i}:o;this.setPersonProperties(void 0,s),r?.({})}},this.on("eventCaptured",o=>li.info(`send "${o?.event}"`,o))}init(e,n,o){if(o&&o!==nV){var i;const r=(i=eV[o])!==null&&i!==void 0?i:new WM;return r._init(e,n,o),eV[o]=r,eV[nV][o]=r,r}return this._init(e,n,o)}_init(e,n={},o){var i,r,s;const a=$a(e)?e.trim():"";if(!a)return li.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var A;if(this.__loaded)return a!==((A=this.config)===null||A===void 0?void 0:A.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=g3e(n.defaults),n.debug=this.Nu(n.debug),this.qu=n,this.ju=[],n.person_profiles?this.Du=n.person_profiles:n.process_person&&(this.Du=n.process_person);const c=g3e(n.defaults),l=qlt(n),g=Xg({},c,l,{name:o,token:a});Ea(c.rageclick)&&Ea(l.rageclick)&&(g.rageclick=Xg({},c.rageclick,l.rageclick)),Ea(c.session_recording)&&Ea(l.session_recording)&&(g.session_recording=Xg({},c.session_recording,l.session_recording)),this.set_config(g),this.config.on_xhr_error&&li.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:V3.GZipJS;const u=this.Cu(),h=!this.yu();if(this.persistence=new Wxe(this.config,u,!0,h),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Wxe(Zt(Zt({},this.config),{},{persistence:"sessionStorage"}),u,!1,h),this.Pu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!u&&eg.At()){const f=eg.Ft(this.Pu);qr(f)&&f.forEach(I=>{$a(I)&&this.Eu.add(I)})}else eg.Pt(this.Pu);const d=Zt({},this.persistence.props),m=Zt({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Bu=new Zwn((f,I)=>this.zu(f,I),this.config.request_queue_config),this.Hu=new tPn(this),this.__request_queue=[];const p=this.yu();p||(this.sessionManager=new Tlt(this),this.sessionPropsManager=new Nlt(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((f,I,C)=>{(C?.activityTimeout||C?.sessionPastMaximumLength||C?.crossTabAdoption)&&this.Uu()})),this.Wu(),this.config.__preview_deferred_init_extensions?(li.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Vu(p)},0)):(li.info("Initializing extensions synchronously"),this.Vu(p)),Xp.DEBUG=Xp.DEBUG||this.config.debug,Xp.DEBUG&&li.info("Starting in debug mode",{this:this,config:n,thisC:Zt({},this.config),p:d,s:m}),this.config.identity_distinct_id&&!(!((i=n.bootstrap)===null||i===void 0)&&i.distinctID)&&(n.bootstrap=Zt(Zt({},n.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const _=(r=n.bootstrap)===null||r===void 0?void 0:r.distinctID;if(this.wu=!!_&&!wz(_),(s=n.bootstrap)===null||s===void 0?void 0:s.distinctID){const f=n.bootstrap.distinctID,I=this.get_distinct_id(),C=this.persistence.get_property(Dy);if(n.bootstrap.isIdentifiedID&&I!=null&&I!==f&&C==="anonymous")this.identify(f);else if(n.bootstrap.isIdentifiedID&&I!=null&&I!==f&&C==="identified")li.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const y=this.config.get_device_id(tB()),x=n.bootstrap.isIdentifiedID?y:f;this.persistence.set_property(Dy,n.bootstrap.isIdentifiedID?$ne:z8),this.register({distinct_id:f,$device_id:x})}}if(p)this.register_once({distinct_id:bxe,$device_id:null},"");else if(!this.get_distinct_id()){const f=this.config.get_device_id(tB());this.register_once({distinct_id:f,$device_id:f},""),this.persistence.set_property(Dy,z8)}return Wc(jn,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Wc(jn,"pageshow",()=>{var f;this.Tu=!1,this.Iu||(f=this.Hu)===null||f===void 0||f.resume()}),n.segment?zct(this,()=>this.Gu()):this.Gu(),ap(this.config._onCapture)&&this.config._onCapture!==tV&&(li.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",f=>this.config._onCapture(f.event,f))),this.config.ip&&li.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return Flt.apply(this,arguments)})().then(f=>{f&&this.register({[hxe]:f})}).catch(tV),this}Qu(e){const n=e;return $a(n.name)&&ap(n.setup)}Zu(e,n){this.Qu(e)?n.push(()=>{this.Ju().add(e).catch(()=>{var o;return(o=e.dispose)===null||o===void 0?void 0:o.call(e)}).catch(o=>{li.error(`Failed to dispose browser extension "${e.name}"`,o)})}):this.lu.push(e)}Wu(){var e,n,o;const i=(e=(n=this.config.__extensionClasses)===null||n===void 0?void 0:n.featureFlags)!==null&&e!==void 0?e:(o=WM.__defaultExtensionClasses)===null||o===void 0?void 0:o.featureFlags;var r,s,a;i&&(this.featureFlags&&this.featureFlags instanceof i||((r=this.Ku)===null||r===void 0||r.call(this),this.Ku=void 0,this.featureFlags=new i(this)),ap(this.featureFlags.onReloading)&&ap(this.featureFlags.setup)?this.Ku||(this.Ku=this.featureFlags.onReloading(()=>{this.du.emit("featureFlagsReloading",!0)}),this.Ju().add(this.featureFlags)):(s=(a=this.featureFlags).initialize)===null||s===void 0||s.call(a))}Vu(e){const n=performance.now(),o=Zt(Zt({},WM.__defaultExtensionClasses),this.config.__extensionClasses),i=[];var r,s,a,A,c,l,g,u;o.exceptions&&this.lu.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new o.exceptions(this)),o.historyAutocapture&&this.lu.push(this.historyAutocapture=new o.historyAutocapture(this)),o.tracingHeaders&&this.lu.push(this.tracingHeaders=new o.tracingHeaders(this)),o.siteApps&&this.lu.push(this.siteApps=new o.siteApps(this)),o.sessionRecording&&!e&&this.lu.push(this.sessionRecording=new o.sessionRecording(this)),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),o.autocapture&&this.Zu(this.autocapture=new o.autocapture(this),i),o.surveys&&this.Zu(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new o.surveys(this),i),o.logs&&this.Zu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new o.logs(this),i),o.metrics&&this.lu.push(this.metrics=(A=this.metrics)!==null&&A!==void 0?A:new o.metrics(this)),o.conversations&&this.lu.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new o.conversations(this)),o.productTours&&this.lu.push(this.productTours=new o.productTours(this)),o.heatmaps&&this.lu.push(this.heatmaps=new o.heatmaps(this)),o.webVitalsAutocapture&&this.lu.push(this.webVitalsAutocapture=new o.webVitalsAutocapture(this)),o.exceptionObserver&&this.lu.push(this.exceptionObserver=new o.exceptionObserver(this)),o.deadClicksAutocapture&&this.lu.push(this.deadClicksAutocapture=new o.deadClicksAutocapture(this,Dwn)),o.toolbar&&this.lu.push(this.toolbar=(l=this.toolbar)!==null&&l!==void 0?l:new o.toolbar(this)),o.experiments&&this.lu.push(this.experiments=(g=this.experiments)!==null&&g!==void 0?g:new o.experiments(this)),o.webMCP&&this.lu.push(this.webMCP=(u=this.webMCP)!==null&&u!==void 0?u:new o.webMCP(this)),this.lu.forEach(h=>{h.initialize&&i.push(()=>{var d;(d=h.initialize)===null||d===void 0||d.call(h)})}),i.push(()=>{if(this.Xu){const h=this.Xu;this.Xu=void 0,this.lu.forEach(d=>{var m;return(m=d.onRemoteConfig)===null||m===void 0?void 0:m.call(d,h)})}}),this.Yu(i,n)}Yu(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout(()=>{this.Yu(e,n)},0);const i=e.shift();if(i)try{i()}catch(r){li.error("Error initializing extension:",r)}}const o=Math.round(performance.now()-n);this.register_for_session({[sct]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[act]:o}),this.config.__preview_deferred_init_extensions&&li.info(`PostHog extensions initialized (${o}ms)`)}el(e){var n;if(!qo||!qo.body)return li.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.el(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Xu=e),this.hu=e,this.compression=void 0,e.ok){var o;const i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=jr(i.supportedCompression,V3.GZipJS)?V3.GZipJS:jr(i.supportedCompression,V3.Base64)?V3.Base64:void 0),!((o=i.analytics)===null||o===void 0)&&o.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.Du?this.Du:mct}),(n=this.tc)===null||n===void 0||n.handleRemoteConfig(e),this.lu.forEach(i=>{var r;return(r=i.onRemoteConfig)===null||r===void 0?void 0:r.call(i,e)})}Gu(){try{this.config.loaded(this)}catch(e){li.critical("`loaded` function failed",e)}if(this.ec(),this.config.internal_or_test_user_hostname&&qg?.hostname){const e=qg.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?e===n:n.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.yu())&&this.nc()},1),this.sc=new glt(this),this.sc.load()}ec(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Bu)===null||e===void 0||e.enable())}_dom_loaded(){this.is_capturing()&&iF(this.__request_queue,e=>this.zu(e)),this.__request_queue=[],this.ec()}_handle_unload(){var e,n,o,i,r,s;this.Tu=!0,(e=this.surveys)===null||e===void 0||(n=e.handlePageUnload)===null||n===void 0||n.call(e),(o=this.metrics)===null||o===void 0||o.flush("sendBeacon"),this.config.request_batching?(this.rc()&&this.capture(pct),(i=this.logs)===null||i===void 0||i.flushLogs("sendBeacon"),(r=this.Bu)===null||r===void 0||r.unload(),(s=this.Hu)===null||s===void 0||s.unload()):this.rc()&&this.capture(pct,null,{transport:"sendBeacon"})}_send_request(e){Dlt(this,e)}zu(e,n){this.Hu?this.Hu.retriableRequest(e,n):this._send_request(n?Zt(Zt({},e),{},{transport:n}):e)}_execute_array(e){l3e++;try{let n;const o=[],i=[],r=[];iF(e,a=>{if(a)if(n=a[0],qr(n))r.push(a);else if(ap(a))try{a.call(this)}catch(A){li.error("Error executing queued PostHog call",a,A)}else qr(a)&&n==="alias"?o.push(a):qr(a)&&n.indexOf("capture")!==-1&&ap(this[n])?r.push(a):i.push(a)});const s=function(a,A){iF(a,function(c){try{if(qr(c[0])){let l=A;pl(c,function(g){l=l[g[0]].apply(l,g.slice(1))})}else A[c[0]].apply(A,c.slice(1))}catch(l){li.error("Error executing queued PostHog call",c,l)}})};s(o,this),s(i,this),s(r,this)}finally{l3e--}}push(e){if(l3e>0&&qr(e)&&$a(e[0])){const n=WM.prototype[e[0]];return void(ap(n)&&n.apply(this,e.slice(1)))}this._execute_array([e])}get oc(){return{property:VAt,persistenceKey:tF,cookieName:"_fbc",pattern:Wlt,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[tF]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(tF)}}}get ac(){return{property:JAt,persistenceKey:Lz,cookieName:"_fbp",pattern:jlt,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[Lz]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(Lz)}}}lc(e){var n;const o=(n=this.persistence)===null||n===void 0?void 0:n.get_property(e.persistenceKey);return $a(o)&&e.pattern.test(o)?{value:o,delivered:!1}:Ea(o)&&$a(o.value)&&e.pattern.test(o.value)?{value:o.value,delivered:o.delivered===!0}:void 0}uc(e,n,o){return n===o?.value?{value:n,pending:!o.delivered}:(e.register(n,!1),{value:n,pending:!0})}cc(e){if(!this.config.save_campaign_params||this.yu())return;const n=Gz(e.cookieName);return $a(n)&&e.pattern.test(n)?n:void 0}hc(e,n,o,i){if(!this.persistence)return;const r=this.oc;this.persistence.refreshKey(r.persistenceKey);const s=this.lc(r);if(i)return void r.unregister();if(o)return $a(n)&&Wlt.test(n)?this.uc(r,n,s):void r.unregister();const a=$a(e)&&fPn.test(e)?e:void 0,A=this.cc(r);return A&&((c,l,g)=>{const u=c.split(".");if(l)return u[3]===l;if(!g)return!0;const h=g.value.split(".");return u[3]===h[3]||Number(u[2])>Number(h[2])})(A,a,s)?this.uc(r,A,s):a?s?.value.split(".")[3]===a?{value:s.value,pending:!s.delivered}:this.uc(r,`fb.1.${Date.now()}.${a}`,s):s?{value:s.value,pending:!s.delivered}:void 0}dc(e,n,o){if(!this.persistence)return;const i=this.ac;this.persistence.refreshKey(i.persistenceKey);const r=this.lc(i);if(o)return void i.unregister();if(n)return $a(e)&&jlt.test(e)?this.uc(i,e,r):void i.unregister();const s=this.cc(i);return s?this.uc(i,s,r):r?{value:r.value,pending:!r.delivered}:void 0}vc(e,n){if(!this.persistence)return;this.persistence.refreshKey(e.persistenceKey);const o=this.lc(e);o?.value!==n||o.delivered||e.register(n,!0)}capture(e,n,o){var i,r;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Bu))return void li.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Eo(e)||!$a(e))return void li.error("No event name provided to posthog.capture");if(this.ku(),e==="$snapshot"&&this.yu())return;const s=!this.config.opt_out_useragent_filter&&this._is_bot();if(s&&!this.config.__preview_capture_bot_pageviews)return;const a=o?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a?.isRateLimited)return void li.critical("This capture call is ignored due to client rate limiting.");let A;n?.$current_url&&!$a(n?.$current_url)&&(li.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),e!=="$exception"||o?.fc||li.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(A=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();const c=new Date,l=o?.timestamp||c,g=rAt(o?.uuid,tB);let u={uuid:g,event:e,properties:this.calculateEventProperties(e,n||{},l,g)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&s&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),a&&(u.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);const h=e==="$feature_flag_called"&&u.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;o?.$set&&!h&&(u.$set=o?.$set);const d=Ea(n?.$set)?n.$set:void 0,m=qr(n?.$unset)?n.$unset:[],p=o?.$unset||[],_=R=>{var F;const O=!!o?.$set&&R in o.$set;return{hasProvided:O||!!d&&R in d,provided:O?o==null||(F=o.$set)===null||F===void 0?void 0:F[R]:d?.[R],unset:m.indexOf(R)!==-1||p.indexOf(R)!==-1}},f=_(VAt),I=_(JAt),C=[{channel:this.oc,hasProvided:f.hasProvided,update:this.hc(A?.fbclid,f.provided,f.hasProvided,f.unset)},{channel:this.ac,hasProvided:I.hasProvided,update:this.dc(I.provided,I.hasProvided,I.unset)}];for(const{channel:R,hasProvided:F,update:O}of C)O&&u.properties.$process_person_profile===!0&&O.pending&&!F&&!h&&(u.$set=Zt({[R.property]:O.value},u.$set));const y=o?.$unset;y&&(u.$unset=y);const x=h?void 0:this.gc(o?.$set_once,e!==fct,e===_ct);if(x&&(u.$set_once=x),o?._noTruncate||(E=this.config.properties_string_max_length,u=(function(R,F){const O=new Set;return(function U(Y,j){if(Y!==Object(Y))return F?F(Y):Y;if(O.has(Y))return;let Z;if(O.add(Y),qr(Y))Z=[],iF(Y,J=>{Z.push(U(J))});else{const J={};pl(Xk(Y)?Ict(Y):Y,(X,te)=>{O.has(X)||(J[te]=U(X))}),Z=J}return Z})(R)})(u,R=>$a(R)?R.slice(0,E):R)),u.timestamp=l,Eo(o?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=c),h&&(u.properties=((R,F=[])=>{const O={},U=Y=>{R[Y]!==void 0&&(O[Y]=R[Y])};return cvn.forEach(U),F.forEach(U),O})(u.properties,IPn)),e===J3.DISMISSED||e===J3.SENT){const R=n?.[qxe.SURVEY_ID],F=n?.[qxe.SURVEY_ITERATION];Ylt({id:R,current_iteration:F}),u.$set=Zt(Zt({},u.$set),{},{[iPn({id:R,current_iteration:F},e===J3.SENT?"responded":"dismissed")]:!0})}else e===J3.SHOWN&&(u.$set=Zt(Zt({},u.$set),{},{[qxe.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var E;if(e===Ywn.SHOWN){const R=n?.[clt.TOUR_TYPE];R&&(u.$set=Zt(Zt({},u.$set),{},{[`${clt.TOUR_LAST_SEEN_DATE}/${R}`]:new Date().toISOString()}))}const B=Zt(Zt({},u.properties.$set),u.$set);if(px(B)||this.setPersonPropertiesForFlags(B),!Fs(this.config.before_send)){const R=this.Os(u);if(!R)return;u=R,u.uuid=rAt(u.uuid,tB)}this.sessionRecording&&!this.Au&&Jlt(e)&&(this.Au=!0,setTimeout(()=>this.Au=!1,3e4));const S=C.filter(({channel:R,update:F})=>{var O,U,Y;const j=(O=(U=u.$set)===null||U===void 0?void 0:U[R.property])!==null&&O!==void 0?O:Ea((Y=u.properties)===null||Y===void 0?void 0:Y.$set)?u.properties.$set[R.property]:void 0;return F?.pending&&j===F.value});this.du.emit("eventCaptured",u);const Q=(i=o?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),w=o?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(Q),M=Zt(Zt(Zt({method:"POST",url:Q,data:u,compression:"best-available",preferSyncCompression:o?.send_instantly,timestampMode:w?"body":"capture-body",batchKey:o?._batchKey},w&&(!((r=u.properties)===null||r===void 0)&&r.$session_id)?{batchGroup:u.properties.$session_id+(u.properties.$window_id?`-${u.properties.$window_id}`:"")}:{}),o?.transport?{transport:o.transport}:{}),S.length?{fireCallbackOnDrop:!0,callback:R=>{if(R.statusCode>=200&&300>R.statusCode)for(const{channel:F,update:O}of S)this.vc(F,O.value)}}:{});if(!this.config.request_batching||o&&!o?._batchKey||o?.send_instantly){var T;let R;!M.transport&&!M.callback&&px((T=this.config.request_headers)!==null&&T!==void 0?T:{})&&this.Tu&&(R="sendBeacon"),this.zu(M,R)}else this.Bu.enqueue(M);return u}_addCaptureHook(e){return this.on("eventCaptured",n=>e(n.event,n))}getExtension(e){var n;return(n=this.tc)===null||n===void 0?void 0:n.getExtension(e)}Ju(){var e;return(e=this.tc)!==null&&e!==void 0?e:this.tc=new mPn(this)}fu(e){this.Ru.push(e);let n=!0;return()=>{if(!n)return;n=!1;const o=this.Ru.indexOf(e);o!==-1&&this.Ru.splice(o,1)}}mc(e=!0){var n,o,i;return!!(!((n=this.persistence)===null||n===void 0)&&n.consumeCookieIdentityChange())&&(this.Lu=null,this.persistence.get_property("$user_state")==="anonymous"&&((i=this.sessionPersistence)===null||i===void 0||i.clear(),this.Eu.clear(),this.yc()),(o=this.featureFlags)===null||o===void 0||o.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,n,o,i,r){if(o=o||new Date,!this.persistence||!this.sessionPersistence)return n;this.ku(),this.persistence.syncCookieProperties(),this.mc();const s=r?void 0:this.persistence.remove_event_timer(e);let a=Zt({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.yu()&&(a[rct]=!0),e==="$snapshot"){const f=Zt(Zt({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=f.distinct_id,(!$a(a.distinct_id)&&!eh(a.distinct_id)||wz(a.distinct_id))&&li.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}const A=(function(f,I,C,y=!1){var x,E,B,S;if(!Py)return{};const Q=f?[...uF,...I||[]]:[],[w,M]=eAt(Py),[T,R]=(function(ae){for(let ie=0;nAt.length>ie;ie++){const[le,he,Ce]=nAt[ie],ce=ae.match(le);if(ce){const _e=Ce&&ae.match(Ce)||ce;return[he,_e?.[1]||""]}}return["",""]})(Py),F=(function(){const ae="u">typeof navigator?navigator:void 0;return ae?.brave?{brave:!0}:{}})(),O={};Eo(C)||(O.detectGoogleSearchApp=C);const U={},Y=(x=navigator)===null||x===void 0||(x=x.userAgentData)===null||x===void 0?void 0:x.platform,j=(E=navigator)===null||E===void 0?void 0:E.maxTouchPoints,Z=jn==null||(B=jn.screen)===null||B===void 0?void 0:B.width,J=jn==null||(S=jn.screen)===null||S===void 0?void 0:S.height,X=jn?.devicePixelRatio;Eo(Y)||(U.userAgentDataPlatform=Y),Eo(j)||(U.maxTouchPoints=j),Eo(Z)||(U.screenWidth=Z),Eo(J)||(U.screenHeight=J),Eo(X)||(U.devicePixelRatio=X);const te=Xg(Pxe({$os:w,$os_version:M,$browser:Xat(Py,navigator.vendor,F,O),$webview_app:T,$webview_app_version:R,$device:tAt(Py),$device_type:MQn(Py,U),$timezone:jct(),$timezone_offset:Hwn()}),{$current_url:Jz(y?MQ(qg?.href):qg?.href,Q,Wz),$host:qg?.host,$pathname:qg?.pathname,$raw_user_agent:Py.length>1e3?Py.substring(0,997)+"...":Py,$browser_version:PQn(Py,navigator.vendor,F,O),$browser_language:nlt(),$browser_language_prefix:Lwn(),$screen_height:jn?.screen.height,$screen_width:jn?.screen.width,$viewport_height:jn?.innerHeight,$viewport_width:jn?.innerWidth,$lib:Y8.LIB_NAME,$lib_version:Y8.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Y8.SDK_DIST_CHANNEL&&(te.$sdk_dist_channel=Y8.SDK_DIST_CHANNEL),te})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:f,windowId:I}=this.sessionManager.checkAndGetSessionAndWindowId(r,o.getTime(),!0);a.$session_id=f,a.$window_id=I}this.sessionPropsManager&&Xg(a,this.sessionPropsManager.getSessionProps());try{var c;if(this.sessionRecording){const f=this.sessionRecording.sdkDebugProperties,I=!this.Au&&Jlt(e);for(const C in f)(I||jr(pPn,C))&&(a[C]=f[C])}a.$sdk_debug_retry_queue_size=(c=this.Hu)===null||c===void 0?void 0:c.length}catch(f){a.$sdk_debug_error_capturing_properties=String(f)}let l;if(this.requestRouter.region===c3e&&(a.$lib_custom_api_host=this.config.api_host),l=e!=="$pageview"||r?e!=="$pageleave"||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(o):this.pageViewManager.doPageView(o,i),a=Xg(a,l),e==="$pageview"&&qo&&(a.title=qo.title),!Eo(s)){const f=o.getTime()-s;a.$duration=parseFloat((f/1e3).toFixed(3))}Py&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");const g=this.persistence.properties(),u=this.sessionPersistence.properties(),h=a.$groups,d=g.$groups;Ea(h)&&!px(h)&&(a.$groups=Zt(Zt({},Ea(d)?d:{}),h)),pl(["$referrer","$referring_domain"],f=>{f in g&&delete u[f]});const m={};if(this.Ru.length>0)for(const f of this.Ru.slice())try{Xg(m,f())}catch(I){li.error("Failed to produce browser extension event properties",I)}a=Xg({},A,g,u,Zt(Zt({},m),a)),a.$is_identified=this._isIdentified(),qr(this.config.property_denylist)?pl(this.config.property_denylist,function(f){delete a[f]}):li.error(Vlt+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const p=this.config.sanitize_properties;p&&(li.error(zlt),a=p(a,e));const _=this.bc();return a.$process_person_profile=_,_&&!r&&this._c("_calculate_event_properties"),a}gc(e,n=!0,o=!1){var i;if(!this.persistence||!this.bc()||this.Mu&&!o)return e;const r=this.persistence.get_initial_props(),s=(i=this.sessionPropsManager)===null||i===void 0?void 0:i.getSetOnceProps();let a=Xg({},r,s||{},e||{});const A=this.config.sanitize_properties;return A&&(li.error(zlt),a=A(a,"$set_once")),n&&(this.Mu=!0),px(a)?void 0:a}register(e,n){var o;(o=this.persistence)===null||o===void 0||o.register(e,n)}register_once(e,n,o){var i;(i=this.persistence)===null||i===void 0||i.register_once(e,n,o)}register_for_session(e){var n,o;(n=this.persistence)===null||n===void 0||n.syncCookieProperties(),this.mc(),(o=this.sessionPersistence)===null||o===void 0||o.register(e),Object.keys(e).forEach(i=>this.Eu.add(i)),this.yc()}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),this.Eu.delete(e),this.yc()}wc(e,n){this.register({[e]:n})}Uu(){this.Eu.forEach(e=>{var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(e)}),this.Eu.clear(),this.yc()}yc(){var e;if(!this.Pu)return;if(this.config.persistence==="memory"||!((e=this.sessionPersistence)===null||e===void 0)&&e.hi||!eg.At())return void eg.Pt(this.Pu);const n=[];this.Eu.forEach(o=>n.push(o)),n.length>0?eg.$t(this.Pu,n):eg.Pt(this.Pu)}getFeatureFlag(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlagResult(e,n)}getAllFeatureFlags(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,n){var o,i;return(o=(i=this.featureFlags)===null||i===void 0?void 0:i.isFeatureEnabled(e,n))!==null&&o!==void 0?o:n?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)===null||e===void 0||e.reloadFeatureFlags()}updateFlags(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateFlags(e,n,o)}updateEarlyAccessFeatureEnrollment(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateEarlyAccessFeatureEnrollment(e,n,o)}getEarlyAccessFeatures(e,n=!1,o){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getEarlyAccessFeatures(e,n,o)}on(e,n){return this.du.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:_F}),()=>{})}onSessionId(e){var n,o;return(n=(o=this.sessionManager)===null||o===void 0?void 0:o.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n=!1){this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:_F})}getActiveMatchingSurveys(e,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:_F})}onActiveMatchingSurveysChanged(e){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(e):(e([],{isLoaded:!1,error:_F}),()=>{})}renderSurvey(e,n){var o;(o=this.surveys)===null||o===void 0||o.renderSurvey(e,n)}displaySurvey(e,n=cPn){var o;(o=this.surveys)===null||o===void 0||o.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)===null||n===void 0||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,o;return(n=(o=this.surveys)===null||o===void 0?void 0:o.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:_F}}canRenderSurveyAsync(e,n=!1){var o,i;return(o=(i=this.surveys)===null||i===void 0?void 0:i.canRenderSurveyAsync(e,n))!==null&&o!==void 0?o:Promise.resolve({visible:!1,disabledReason:_F})}kc(e){return!e||wz(e)?(li.critical("Unique user id has not been set in posthog.identify"),!1):e==="$posthog_cookieless"?(li.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(li.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(e,n,o){if(!this.__loaded||!this.persistence)return li.uninitializedWarning("posthog.identify");if(eh(e)&&(e=e.toString(),li.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.kc(e)||!this._c("posthog.identify"))return;this.ku();const i=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,s=this.mc(!1),a=this.persistence.Oa();let A=!1;try{const l=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property("__alias")&&(this.unregister(jne),this.register({distinct_id:e}));const g=(this.persistence.get_property("$user_state")||"anonymous")===z8,u=e!==l,h=!u&&g;if(u&&g){var c;const d=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:l};this.persistence.set_property(Dy,$ne),this.setPersonPropertiesForFlags({$set:n||{},$set_once:o||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$identify",d,{$set:n||{},$set_once:o||{}})&&(this.Lu=A3e(e,n,o)),(c=this.featureFlags)===null||c===void 0||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(h){this.persistence.set_property(Dy,$ne);const d=n||{},m=o||{};this.setPersonPropertiesForFlags({$set:d,$set_once:m},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$set",{$set:d,$set_once:m})&&(this.Lu=A3e(e,n,o))}else(n||o)&&this.setPersonProperties(n,o);u||r||s?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(TQ)):h&&(n||o)&&this.reloadFeatureFlags(),A=!0}finally{a&&this.persistence.qa(A)}}setPersonProperties(e,n){if(!e&&!n||!this._c("posthog.setPersonProperties"))return;const o=A3e(this.get_distinct_id(),e,n);this.Lu!==o?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:n||{}},!0),this.capture("$set",{$set:e||{},$set_once:n||{}})&&(this.Lu=o)):li.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var n;const o=(qr(e)?e:[e]).filter(i=>$a(i)&&i.length>0);o.length!==0&&this._c("posthog.unsetPersonProperties")&&((n=this.featureFlags)===null||n===void 0||n.unsetPersonPropertiesForFlags(o,!0),this.capture("$set",{$unset:o}),this.Lu=null)}group(e,n,o){var i;if(!e||!n)return void li.error("posthog.group requires a group type and group key");(i=this.persistence)===null||i===void 0||i.syncCookieProperties(),this.mc();const r=this.getGroups(),s=r[e]!==n;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:Zt(Zt({},r),{},{[e]:n})}),(s||o)&&this.bc()){const a={$group_type:e,$group_key:n};o&&(a.$group_set=o),this.capture(fct,a)}o&&this.setGroupPropertiesForFlags({[e]:o}),s&&!o&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n=!0){var o;(o=this.featureFlags)===null||o===void 0||o.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(e=!0){var n;(n=this.featureFlags)===null||n===void 0||n.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,n=!0){var o;this._c("posthog.setGroupPropertiesForFlags")&&((o=this.featureFlags)===null||o===void 0||o.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)===null||n===void 0||n.resetGroupPropertiesForFlags(e)}reset(e){const n=My(e)?e:e?.resetDeviceID,o=My(e)||e==null?void 0:e.bootstrap;this.Sc(n,!1,o)}Sc(e,n=!1,o){var i,r,s,a,A,c;if(li.info("reset"),!this.__loaded)return li.uninitializedWarning("posthog.reset");const l=o?.sessionID;this.config.bootstrap=o||((i=this.qu)===null||i===void 0?void 0:i.bootstrap)||{},(r=this.featureFlags)===null||r===void 0||(s=r.updateConfig)===null||s===void 0||s.call(r,this.config,this.il());const g=this.get_property(dxe),u=this.get_property(hxe),h=this.get_property(Hz);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();const d=this.is_capturing();n||this.consent.reset(),n||!d||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const m=(A=this.persistence)===null||A===void 0||(c=A.Oa)===null||c===void 0?void 0:c.call(A),p=this.Su;this.Su=p||n;let _=!1;try{var f,I,C,y,x,E,B,S,Q,w,M,T,R;if((f=this.persistence)===null||f===void 0||f.clear(),(I=this.sessionPersistence)===null||I===void 0||I.clear(),this.Eu.clear(),this.yc(),Eo(h)||(w=this.persistence)===null||w===void 0||w.register({$session_recording_remote_config:h}),(C=this.surveys)===null||C===void 0||C.reset(),(y=this.featureFlags)===null||y===void 0||y.reset(),(x=this.conversations)===null||x===void 0||x.reset(),(E=this.logs)===null||E===void 0||E.reset(),(B=this.metrics)===null||B===void 0||B.reset(),(S=this.persistence)===null||S===void 0||S.set_property("$user_state","anonymous"),(Q=this.sessionManager)===null||Q===void 0||Q.resetSessionId(),this.Lu=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:bxe,$device_id:null},"");else{const U=this.config.get_device_id(tB());this.register_once({distinct_id:U,$device_id:e?U:g},""),e||Eo(u)||this.register({[hxe]:u})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),o&&(o.distinctID&&!this.yu()&&((R=this.persistence)===null||R===void 0||R.set_property("$user_state",o.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.distinctID})),(M=this.featureFlags)===null||M===void 0||M.initialize(),!Fs(l)&&!(!((T=this.sessionManager)===null||T===void 0)&&T.setBootstrapSessionId(l,!0)))){const U=Zt({},o);delete U.sessionID,this.config.bootstrap=U}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0}finally{var F,O;this.Su=p,m&&((F=this.persistence)===null||F===void 0||(O=F.qa)===null||O===void 0||O.call(F,_))}this.reloadFeatureFlags()}shutdown(e){var n=this;return $g(function*(){var o,i,r,s,a,A,c,l;if(n.__loaded){n.Iu=!0,n.Ju().dispose(),(o=n.sessionRecording)===null||o===void 0||o.dispose(),(i=n.logs)===null||i===void 0||i.flushLogs("sendBeacon"),(r=n.metrics)===null||r===void 0||r.flush("sendBeacon"),(s=n.metrics)===null||s===void 0||s.dispose(),(a=n.Bu)===null||a===void 0||a.unload(),(A=n.Hu)===null||A===void 0||A.unload();try{var g;(g=n.featureFlags)===null||g===void 0||g.destroy()}catch(u){li.error("Error while destroying feature flags",u)}(c=n.persistence)===null||c===void 0||c.destroy(),(l=n.sessionPersistence)===null||l===void 0||l.destroy()}else li.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,n){var o;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=n,this.alias(e),(o=this.conversations)===null||o===void 0||o.xc()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(e=this.conversations)===null||e===void 0||e.$c()}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"";const{sessionId:n,sessionStartTimestamp:o}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let i=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${n}`);if(e?.withTimestamp&&o){var r;const s=(r=e.timestampLookBack)!==null&&r!==void 0?r:10;if(!o)return i;i+=`?t=${Math.max(Math.floor((new Date().getTime()-o)/1e3)-s,0)}`}return i}alias(e,n){return e===this.get_property("$people_distinct_id")?(li.critical("Attempting to create alias for existing People user - aborting."),-2):this._c("posthog.alias")?(Eo(n)&&(n=this.get_distinct_id()),e!==n?(this.wc(jne,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(li.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const n=Zt({},this.config);if(Ea(e)){var o,i,r,s,a,A,c,l,g,u,h,d,m,p;Xg(this.config,qlt(e));const y=this.Cu();if(this.persistence){const E=this.config.persistence==="sessionStorage"||this.config.persistence==="memory";var _,f;if(E&&this.sessionPersistence!==this.persistence&&((_=this.sessionPersistence)===null||_===void 0||_.remove(),(f=this.sessionPersistence)===null||f===void 0||f.destroy()),this.persistence.update_config(this.config,n,y),E)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new Wxe(Zt(Zt({},this.config),{},{persistence:"sessionStorage"}),y,!1);else{var I;(I=this.sessionPersistence)===null||I===void 0||I.update_config(Zt(Zt({},this.config),{},{persistence:"sessionStorage"}),Zt(Zt({},n),{},{persistence:"sessionStorage"}),y)}}const x=this.Nu(this.config.debug);var C;My(x)&&(this.config.debug=x),My(this.config.debug)&&(this.config.debug?(Xp.DEBUG=!0,uc.At()&&uc.$t("ph_debug",!0),li.info("set_config",{config:e,oldConfig:n,newConfig:Zt({},this.config)})):(Xp.DEBUG=!1,uc.At()&&uc.Pt("ph_debug"))),(o=this.featureFlags)===null||o===void 0||(i=o.updateConfig)===null||i===void 0||i.call(o,this.config,this.il()),(r=this.exceptionObserver)===null||r===void 0||r.onConfigChange(),(s=this.exceptions)===null||s===void 0||s.onConfigChange(),(a=this.metrics)===null||a===void 0||a.onConfigChange(),(A=this.webMCP)===null||A===void 0||A.startIfEnabled(),(c=this.sessionRecording)===null||c===void 0||c.startIfEnabledOrStop(),(l=this.tracingHeaders)===null||l===void 0||l.startIfEnabledOrStop(),(g=this.autocapture)===null||g===void 0||g.startIfEnabled(),(u=this.heatmaps)===null||u===void 0||u.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&((C=this.historyAutocapture)===null||C===void 0||C.startIfEnabledOrStop()),(h=this.exceptionObserver)===null||h===void 0||h.startIfEnabledOrStop(),(d=this.deadClicksAutocapture)===null||d===void 0||d.startIfEnabledOrStop(),(m=this.surveys)===null||m===void 0||m.loadIfEnabled(),this.xu(),(p=this.externalIntegrations)===null||p===void 0||p.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&zct(this,tV,!1)}}_overrideSDKInfo(e,n){Xp.LIB_NAME=e,Xp.LIB_VERSION=n}startSessionRecording(e){const n=e===!0,o={sampling:n||!!e?.sampling,linked_flag:n||!!e?.linked_flag,url_trigger:n||!!e?.url_trigger,event_trigger:n||!!e?.event_trigger};var i,r,s,a,A;Object.values(o).some(Boolean)&&((i=this.sessionManager)===null||i===void 0||i.checkAndGetSessionAndWindowId(),o.sampling&&((r=this.sessionRecording)===null||r===void 0||r.overrideSampling()),o.linked_flag&&((s=this.sessionRecording)===null||s===void 0||s.overrideLinkedFlag()),o.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),o.event_trigger&&((A=this.sessionRecording)===null||A===void 0||A.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){try{if(!this.exceptions)return;const o=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(Zt(Zt({},o),n))}catch{return}}addExceptionStep(e,n){var o;(o=this.exceptions)===null||o===void 0||o.addExceptionStep(e,n)}captureLog(e){var n;(n=this.logs)===null||n===void 0||n.captureLog(e)}get logger(){var e,n;return(e=(n=this.logs)===null||n===void 0?void 0:n.logger)!==null&&e!==void 0?e:WM.Cc}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,o;return(n=(o=this.toolbar)===null||o===void 0?void 0:o.loadToolbar(e))!==null&&n!==void 0&&n}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;let n=(e=this.config.name)!==null&&e!==void 0?e:nV;return n!==nV&&(n="posthog."+n),n}_isIdentified(){var e,n;return((e=this.persistence)===null||e===void 0?void 0:e.get_property("$user_state"))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property("$user_state"))==="identified"}bc(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&px(this.getGroups())&&!(!((e=this.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e.__alias)&&!(!((n=this.persistence)===null||n===void 0||(n=n.props)===null||n===void 0)&&n.$epp))}rc(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.bc()||this._c("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._c("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_c(e){return this.config.person_profiles==="never"?(li.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.bu(),this.wc(Bxe,!0),!0)}Cu(){if(this.config.cookieless_mode==="always")return!0;const e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}xu(){var e,n;const o=this.Cu();var i,r,s;return this.is_capturing()||(i=this.logs)===null||i===void 0||i.Tc(),((e=this.persistence)===null||e===void 0?void 0:e.hi)!==o&&((r=this.persistence)===null||r===void 0||r.set_disabled(o)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.hi)!==o&&((s=this.sessionPersistence)===null||s===void 0||s.set_disabled(o)),this.yc(),o}opt_in_capturing(e){var n;if(this.config.cookieless_mode!=="always"){if(this.yu()){var o,i,r,s,a,A;(o=this.sessionRecording)===null||o===void 0||o.dispose({discardBufferedEvents:!0}),this.Sc(!0,!0),(i=this.sessionManager)===null||i===void 0||i.destroy(),(r=this.pageViewManager)===null||r===void 0||r.destroy(),this.sessionManager=new Tlt(this),this.pageViewManager=new Wct(this),this.persistence&&(this.sessionPropsManager=new Nlt(this,this.sessionManager,this.persistence));const h=(s=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&s!==void 0?s:(A=WM.__defaultExtensionClasses)===null||A===void 0?void 0:A.sessionRecording;var c,l;h&&(this.sessionRecording=this.mu(this.sessionRecording,new h(this)),this.hu&&((c=this.sessionRecording)===null||c===void 0||(l=c.onRemoteConfig)===null||l===void 0||l.call(c,this.hu)))}var g,u;this.consent.optInOut(!0),this.xu(),this.ec(),(n=this.sessionRecording)===null||n===void 0||n.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((g=this.surveys)===null||g===void 0||g.loadIfEnabled()),(Eo(e?.captureEventName)||e?.captureEventName)&&this.capture((u=e?.captureEventName)!==null&&u!==void 0?u:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.nc()}else li.warn(Klt)}opt_out_capturing(){this.config.cookieless_mode!=="always"?(this.consent.optInOut(!1),this.xu(),this.config.cookieless_mode==="on_reject"&&this.$u()):li.warn(Klt)}$u(){var e,n;const o=this.sessionRecording;o?.dispose({discardBufferedEvents:!0}),this.get_distinct_id()!=="$posthog_cookieless"&&this.Sc(!0,!0),this.register({distinct_id:bxe,$device_id:null}),this.gu(o),this.sessionRecording=void 0,(e=this.sessionManager)===null||e===void 0||e.destroy(),(n=this.pageViewManager)===null||n===void 0||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.nc(),this.ec()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return!this.Su&&(this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing()))}clear_opt_in_out_capturing(){this.consent.reset(),this.xu()}_is_bot(){return X_?klt(X_,this.config.custom_blocked_useragents):void 0}nc(){qo&&(qo.visibilityState==="visible"?this.Fu||(this.Fu=!0,this.capture(wxe,{title:qo.title},{send_instantly:!0}),this.Ou&&(qo.removeEventListener(Fz,this.Ou),this.Ou=null)):this.Ou||(this.Ou=this.nc.bind(this),Wc(qo,Fz,this.Ou)))}debug(e){e===!1?(jn?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(jn?.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)`."),this.set_config({debug:!0}))}il(){const e=this.qu||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(li.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(n,o,i,r,s){const a=o in n&&!Fs(n[o]),A=i in n&&!Fs(n[i]);return a?n[o]:!!A&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${o}' instead. The old field will be removed in a future major version.`),n[i])})(e,"advanced_disable_flags","advanced_disable_decide",0,li)}Os(e){var n;if(Fs(this.config.before_send))return e;const o=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(IQn),i=qr(this.config.before_send)?this.config.before_send:[this.config.before_send];let r=e;for(const s of i)try{if(r=s(r),Fs(r)){const a=`Event '${e.event}' was rejected in beforeSend function`;return fQn(e.event)?li.warn(`${a}. This can cause unexpected behavior.`):li.info(a),null}r.properties&&!px(r.properties)||li.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return li.error(`Error in beforeSend function for event '${e.event}':`,a),null}for(const s of o)if(r.properties&&Fs(r.properties[s]))return li.warn(`Event '${e.event}' had its '${s}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){var e;return(e=this.pageViewManager.Wo)===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,o){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(o)})}Nu(e){const n=My(e)&&!e,o=uc.At()&&uc.Ot("ph_debug")==="true";return!n&&(!!o||e)}};oV.__defaultExtensionClasses={},oV.Cc=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),(function(t,e){for(let n=0;e.length>n;n++)t.prototype[e[n]]=dwn(t.prototype[e[n]])})(oV,["identify"]);var $lt=class{constructor(e){this.disabled=e===!1;const n=Ea(e)?e:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(e,n,o){if(this.disabled)return!1;const i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(n-i.y)<this.thresholdPx&&this.timeoutMs>o-i.timestamp){if(this.clicks.push({x:e,y:n,timestamp:o}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:o}];return!1}};const u3e="$copy_autocapture",d3e=gd("[AutoCapture]");function h3e(t,e){return e.length>t?e.slice(0,t)+"...":e}function EPn(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do e=e.previousSibling;while(e&&!nB(e));return e}function BPn(t,{e,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:i,elementsChainAsString:r,disableCaptureUrlHashes:s}){var a,A;if(!nB(t))return{props:{}};const c=[t],l=new Set([t]);let g=t;for(;g.parentNode&&!gI(g,"body")&&1e3>c.length;){if(Lxe(g.parentNode)){const x=g.parentNode.host;if(l.has(x))break;l.add(x),c.push(x),g=x;continue}if(!nB(g.parentNode)||l.has(g.parentNode))break;l.add(g.parentNode),c.push(g.parentNode),g=g.parentNode}const u=e.type==="click"&&t.namespaceURI==="http://www.w3.org/2000/svg"?c.findIndex(x=>gI(x,"button")||gI(x,"a")):-1;u>0&&(o=o||c.slice(0,u+1).some(x=>!sD(x)||AF(x)));const h=[],d={};let m,p=!1,_=!1;if(pl(c,x=>{const E=sD(x);if(gI(x,"a")&&!n&&!i?.includes("href")){const B=x.getAttribute("href");p=!!(E&&B&&cF(B))&&(s?MQ(B):B)}jr(aF(x),"ph-no-capture")&&(_=!0),h.push((function(B,S,Q,w,M=!1){const T=B.tagName.toLowerCase(),R={tag_name:T};Oxe.indexOf(T)>-1&&!Q&&(R.$el_text=T.toLowerCase()==="a"||T.toLowerCase()==="button"?h3e(1024,Gct(B)):h3e(1024,Uz(B)));const F=aF(B);S||w?.includes("class")||0>=F.length||(R.classes=F.filter(function(j){return j!==""})),pl(B.attributes,function(j){var Z;if((!AF(B)||["name","id","class","aria-label"].indexOf(j.name)!==-1)&&!w?.includes(j.name)&&!S&&cF(j.value)&&(!$a(Z=j.name)||Z.substring(0,10)!=="_ngcontent"&&Z.substring(0,7)!=="_nghost")){let J=j.value;j.name==="class"&&(J=Hxe(J).join(" ")),R["attr__"+j.name]=h3e(1024,j.name==="href"&&M?MQ(J):J)}});let O=1,U=1,Y=B;for(;Y=EPn(Y);)O++,Y.tagName===B.tagName&&U++;return R.nth_child=O,R.nth_of_type=U,R})(x,n,o,i,s)),pl((function(B){if(!sD(B))return{};const S={};return pl(B.attributes,function(Q){if(Q.name&&Q.name.indexOf("data-ph-capture-attribute")===0){const w=Q.name.replace("data-ph-capture-attribute-",""),M=Q.value;w&&M&&cF(M)&&(S[w]=M)}}),S})(x),(B,S)=>{({}).hasOwnProperty.call(d,S)||(d[S]=B)})}),_)return{props:{},explicitNoCapture:_};if(u>0&&(t=c[u],h.splice(0,u)),o||(h[0].$el_text=gI(t,"a")||gI(t,"button")?Gct(t):Uz(t)),p){var f,I;h[0].attr__href=p;const x=(f=V8(p))===null||f===void 0?void 0:f.host,E=jn==null||(I=jn.location)===null||I===void 0?void 0:I.host;x&&E&&x!==E&&(m=p)}return{props:Xg((y=e.type,{$event_type:y,$ce_version:1}),r?{}:{$elements:h},{$elements_chain:(C=h,qr(C)?(function(x){return x.map(E=>{var B,S;let Q="";if(E.tag_name&&(Q+=E.tag_name),E.attr_class){E.attr_class.sort();for(const T of E.attr_class)Q+=`.${T.replace(/"/g,"")}`}const w=Zt(Zt(Zt(Zt({},E.text?{text:E.text}:{}),{},{"nth-child":(B=E.nth_child)!==null&&B!==void 0?B:0,"nth-of-type":(S=E.nth_of_type)!==null&&S!==void 0?S:0},E.href?{href:E.href}:{}),E.attr_id?{attr_id:E.attr_id}:{}),E.attributes),M={};return Zne(w).sort(([T],[R])=>(function(F,O){return O>F?-1:F>O?1:0})(T,R)).forEach(([T,R])=>M[Uct(T.toString())]=Uct(R.toString())),Q+=":",Q+=Zne(M).map(([T,R])=>`${T}="${R}"`).join(""),Q}).join(";")})((function(x){return x.map(E=>{var B,S;const Q={text:(B=E.$el_text)===null||B===void 0?void 0:B.slice(0,400),tag_name:E.tag_name,href:(S=E.attr__href)===null||S===void 0?void 0:S.slice(0,2048),attr_class:Pwn(E),attr_id:E.attr__id,nth_child:E.nth_child,nth_of_type:E.nth_of_type,attributes:{}};return Zne(E).filter(([w])=>w.indexOf("attr__")===0).forEach(([w,M])=>Q.attributes[w]=M),Q})})(C)):"")},!((a=h[0])===null||a===void 0)&&a.$el_text?{$el_text:(A=h[0])===null||A===void 0?void 0:A.$el_text}:{},m&&e.type==="click"?{$external_click_url:m}:{},d),target:t};var C,y}var bPn=class{do(){this.vo=void 0,clearTimeout(this.fo),this.fo=void 0}po(e){var n;if(!sD(e))return!0;const o=(n=this.mo().css_selector_ignorelist)!==null&&n!==void 0?n:Uxe,i=new Set;let r=e;for(;r;){if(i.size>=1e3||i.has(r))return!0;i.add(r);const s=r,a=aF(s);if(jr(a,"ph-no-capture")||jr(a,"ph-sensitive")||AF(s)||o.some(c=>Gxe(s,c)))return!0;const A=r.parentNode;r=Lxe(A)?A.host:A&&nB(A)?A:null}return!1}yo(e){if(!this.isEnabled||e.type==="pointercancel")return void this.do();if(e.type==="pointerdown"){this.do();const i=Kz(e);var n;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&nB(i)&&(this.vo={target:i,excluded:this.po(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(n=this.bo)===null||n===void 0?void 0:n.distinctId}))}const o=this.vo;o&&(e.pointerId!==o.id||Math.abs(e.clientX-o.x)>5||Math.abs(e.clientY-o.y)>5?this.do():e.type==="pointerup"&&(o.released=!0,this.fo=setTimeout(()=>this.do(),0)))}_o(e){var n;const o=this.vo;this.do();const i=Kz(e);if(o?.released&&o.target.isConnected&&o.distinctId===((n=this.bo)===null||n===void 0?void 0:n.distinctId)&&e.pointerId===o.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-o.x)&&5>=Math.abs(e.clientY-o.y)&&i&&(gI(i,"html")||gI(i,"body"))){var r;if(o.excluded)return null;const s=(r=this.mo().css_selector_ignorelist)!==null&&r!==void 0?r:Uxe;return[i,qo?.documentElement,qo?.body].some(a=>{if(!a)return!1;const A=aF(a);return jr(A,"ph-no-capture")||jr(A,"ph-sensitive")||!sD(a)||AF(a)||s.some(c=>Gxe(a,c))})?null:o.target}}constructor(e){this.wo=e,this.name="autocapture",this.ko=!1,this.So=null,this.xo=!1,this.$o=new Map,this.Co=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.To=!1,this.wo.refresh(this.Mr),this.rageclicks=new $lt(this.Mr.rageclick),this.Io=null}setup(e){this.Mo(),this.bo=e;const n=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.To?n.dispose():(this.Eo=n,this.startIfEnabled())}dispose(){var e;this.To||(this.To=!0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.$o.clear(),this.Io=null,this.Po())}mo(){return this.wo.refresh(this.Mr),this.Mr}Mo(){var e,n;return this.mo(),this.Mr.url_allowlist=(e=this.Mr.url_allowlist)===null||e===void 0?void 0:e.map(o=>new RegExp(o)),this.Mr.url_ignorelist=(n=this.Mr.url_ignorelist)===null||n===void 0?void 0:n.map(o=>new RegExp(o)),this.Mr}Ro(){if(!this.isBrowserSupported())return void d3e.info("Disabling Automatic Event Collection because this browser is not supported");if(!jn||!qo)return;const e=this.Ao=n=>{n=n||jn?.event;try{if(n.type==="blur")return void this.do();if(n.type.indexOf("pointer")===0)return void this.yo(n);const o=n.type==="click"?this._o(n):void 0;if(ld(o))return;this.Fo(n,"$autocapture",o)}catch(o){d3e.error("Failed to capture event",o)}};if(Wc(jn,"blur",e),Wc(qo,"submit",e,{capture:!0}),Wc(qo,"change",e,{capture:!0}),Wc(qo,"click",e,{capture:!0}),pl(["pointerdown","pointermove","pointerup","pointercancel"],n=>{Wc(qo,n,e,{capture:!0})}),this.mo().capture_copied_text){const n=this.Oo=o=>{o=o||jn?.event;try{this.Fo(o,u3e)}catch(i){d3e.error("Failed to capture clipboard event",i)}};Wc(qo,"copy",n,{capture:!0}),Wc(qo,"cut",n,{capture:!0}),Wc(qo,"paste",n,{capture:!0})}}Po(){this.do(),this.Ao&&(jn?.removeEventListener("blur",this.Ao),pl(["pointerdown","pointermove","pointerup","pointercancel"],e=>{qo?.removeEventListener(e,this.Ao,!0)}),qo?.removeEventListener("submit",this.Ao,!0),qo?.removeEventListener("change",this.Ao,!0),qo?.removeEventListener("click",this.Ao,!0),this.Ao=void 0),this.Oo&&(qo?.removeEventListener("copy",this.Oo,!0),qo?.removeEventListener("cut",this.Oo,!0),qo?.removeEventListener("paste",this.Oo,!0),this.Oo=void 0),this.ko=!1}startIfEnabled(){this.isEnabled||this.do(),!this.To&&this.bo&&this.isEnabled&&!this.ko&&(this.Ro(),this.ko=!0)}onRemoteConfig(e){if(this.To)return;if(this.xo=!0,!e.ok)return void this.startIfEnabled();const n=e.config;n.elementsChainAsString&&(this.Co=n.elementsChainAsString);const o=n.autocapture_opt_out;var i;My(o)&&((i=this.bo)===null||i===void 0||i.kv.set("$autocapture_disabled_server_side",o),this.So=o),this.startIfEnabled()}setElementSelectors(e,n=this){if(this.To)return;e.size?this.$o.set(n,new Set(e)):this.$o.delete(n);const o=new Set;this.$o.forEach(i=>{i.forEach(r=>o.add(r))}),this.Io=o}getElementSelectors(e,n){var o;const i=[];return(o=this.Io)===null||o===void 0||o.forEach(r=>{const s=qo?.querySelectorAll(r);s?.forEach(a=>{e!==a&&n!==a||jr(i,r)||i.push(r)})}),i}get isEnabled(){var e,n;if(this.To)return!1;const o=(e=this.bo)===null||e===void 0?void 0:e.kv.get(WAt),i=this.So,r=this.mo();if(!r.remoteRequestsDisabled&&!this.xo)return!1;const s=r.remoteRequestsDisabled&&!this.xo;if(ld(i)&&!My(o)&&!s)return!1;const a=(n=this.So)!==null&&n!==void 0?n:!!o;return!!r.enabled&&!a}Fo(e,n="$autocapture",o){if(!this.isEnabled)return void this.do();let i=o||Kz(e);Qct(i)&&(i=i.parentNode||null);const r=this.Mo();var s;n==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&r.rageclick&&(!((s=this.rageclicks)===null||s===void 0)&&s.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&Tct(i,r.rageclick)&&this.Fo(e,"$rageclick",o);const a=n===u3e,A=a?Zt(Zt({},r),{},{dom_event_allowlist:void 0}):r;if(i&&(function(u,h,d,m,p,_){var f;if(!jn||Vxe(u)||d?.url_allowlist&&!vct(d.url_allowlist,_)||d?.url_ignorelist&&vct(d.url_ignorelist,_))return!1;if(d?.dom_event_allowlist){const x=d.dom_event_allowlist;if(x&&!x.some(E=>h.type===E))return!1}const{parentIsUsefulElement:I,targetElementList:C}=kct(u,m);if(!(function(x,E){const B=E?.element_allowlist;if(Eo(B))return!0;for(const S of x)if(B.some(Q=>S.tagName.toLowerCase()===Q))return!0;return!1})(C,d)||!Yxe(C,d?.css_selector_allowlist)||Yxe(C,(f=d?.css_selector_ignorelist)!==null&&f!==void 0?f:Uxe))return!1;try{const x=jn.getComputedStyle(u);if(x&&x.getPropertyValue("cursor")==="pointer"&&h.type==="click")return!0}catch{}const y=u.tagName.toLowerCase();switch(y){case"html":return!1;case"form":return(p||["submit"]).indexOf(h.type)>=0;case"input":case"select":case"textarea":return(p||["change","click"]).indexOf(h.type)>=0;default:return I?(p||["click"]).indexOf(h.type)>=0:(p||["click"]).indexOf(h.type)>=0&&(Oxe.indexOf(y)>-1||u.getAttribute("contenteditable")==="true")}})(i,e,A,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var c;const{props:u,explicitNoCapture:h,target:d}=BPn(i,{e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.Co,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(h)return!1;const m=this.getElementSelectors(i,d);if(m&&m.length>0&&(u.$element_selectors=m),n===u3e){const p=e.type||"clipboard";if(p!=="paste"){var l,g;const _=jn==null||(l=jn.getSelection())===null||l===void 0?void 0:l.toString(),f=wct(_);if(!f)return!1;u.$selected_content=f,u.$clipboard_text_length=(g=_?.length)!==null&&g!==void 0?g:0}u.$copy_type=p}return(c=this.bo)===null||c===void 0||c.capture(n,u),!0}}isBrowserSupported(){return ap(qo?.querySelectorAll)}},SPn=class{constructor(e){this._instance=e}refresh(e){const n=this._instance.config,o=Ea(n.autocapture)?n.autocapture:void 0;e.enabled=!!n.autocapture,e.rageclick=n.rageclick,e.maskAllElementAttributes=n.mask_all_element_attributes,e.maskAllText=n.mask_all_text,e.disableCaptureUrlHashes=n.disable_capture_url_hashes,e.getCurrentUrl=n.get_current_url,e.remoteRequestsDisabled=this._instance.il(),e.url_allowlist=o?.url_allowlist,e.url_ignorelist=o?.url_ignorelist,e.dom_event_allowlist=o?.dom_event_allowlist,e.element_allowlist=o?.element_allowlist,e.css_selector_allowlist=o?.css_selector_allowlist,e.css_selector_ignorelist=o?.css_selector_ignorelist,e.element_attribute_ignorelist=o?.element_attribute_ignorelist,e.capture_copied_text=o?.capture_copied_text}};const iV=gd("[ExceptionAutocapture]"),Xlt=()=>{},Zlt=t=>{var e;if(ap(t))return(e=t.__posthog_layer__)!==null&&e!==void 0?e:t.__rrweb_layer__};function fF(t,e,n){try{if(!(e in t))return Xlt;const o={next:t[e]},i=n(function(...r){return o.next.apply(this,r)});return ap(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:o}})),t[e]=i,()=>{if(t[e]===i)return void(t[e]=o.next);let r=t[e],s=Zlt(r);for(;s;){if(s.next===i)return void(s.next=o.next);r=s.next,s=Zlt(r)}}}catch{return Xlt}}const QPn=gd("[TracingHeaders]"),AD=gd("[Web Vitals]"),e0t=9e5,t0t=["CLS","FCP","INP","LCP"],vPn=["INP","LCP"],wPn=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],m3e="disabled",n0t="lazy_loading",j8=gd("[SessionRecording]"),PPn=[Sxe,Qxe,Act,cct,lct,gct,uct,dct,hct],MPn=gd("[Heatmaps]");function p3e(t){return Ea(t)&&"clientX"in t&&"clientY"in t&&eh(t.clientX)&&eh(t.clientY)}const uoe=gd("[Product Tours]"),_3e=t=>{var e;return!t.config.disable_product_tours&&!!(!((e=t.persistence)===null||e===void 0)&&e.get_property(yxe))},DPn=["$set_once","$set"],J9=gd("[SiteApps]"),o0t="Error while initializing PostHog app with config id ",i0t=(t,e)=>t?.then?t.then(e):e(t),IF="SDK is not enabled or survey functionality is not yet loaded",r0t="Disabled. Not loading surveys.";var NPn=class{constructor(e,n){this.wo=e,this.Ic=n,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Mc=!1,this.Ec=!1,this.Pc=[],this.Rc=[],this.Ac=null,this.Fc=null,this.To=!1,this.Oc=new Set,this.onRemoteConfig=o=>{if(this.To||this.Mr.disableSurveys)return;if(!o.ok)return this.Ec=!0,this.Dc({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),_l.warn("Remote config unavailable. Not loading surveys.");const i=o.config.surveys;if(Fs(i))return _l.warn("Flags not loaded yet. Not loading surveys.");this.Lc=My(i)?i:i.length>0,_l.info(`flags response received, isSurveysEnabled: ${this.Lc}`),this.loadIfEnabled()},this.Dc=o=>{this.Rc.slice().forEach(i=>this.Nc(i,o))}}setup(e){if(!this.To)return this.qc=e,i0t(e.kv.initialize(),()=>{if(this.qc!==e||this.To)return;this.qc=void 0,this.bo=e;const n=e.onRemoteConfig(this.onRemoteConfig);this.To?n.dispose():(this.Eo=n,this.loadIfEnabled())})}dispose(){var e,n,o,i,r;this.To||(this.To=!0,this.qc=void 0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,(n=this._surveyEventReceiver)===null||n===void 0||n.dispose(),this._surveyEventReceiver=null,(o=this._surveyManager)===null||o===void 0||(i=o.dispose)===null||i===void 0||i.call(o),this._surveyManager=null,this.Pc=[],this.Rc.forEach(s=>{s.active=!1}),this.Rc=[],(r=this.jc)===null||r===void 0||r.call(this),this.jc=void 0,this.Ac=null,this.Oc.forEach(s=>clearTimeout(s)),this.Oc.clear())}get Mr(){return this.wo.get()}initialize(){this.loadIfEnabled()}reset(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.clearInMemoryInProgressSurveyState)===null||n===void 0||n.call(e);try{var o;(o=this._surveyEventReceiver)===null||o===void 0||o.reset(),localStorage.removeItem("lastSeenSurveyDate");const i=[];for(let r=0;r<localStorage.length;r++){const s=localStorage.key(r);(s?.startsWith("seenSurvey_")||s?.startsWith("inProgressSurvey_"))&&i.push(s)}i.forEach(r=>localStorage.removeItem(r))}catch{}this.Dc()}loadIfEnabled(){if(this.To||!this.bo)return;const e=this.Mr;if(this._surveyManager)return;if(this.Mc)return void _l.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void _l.info(r0t);if(e.cookielessMode&&this.wo.isOptedOut())return void _l.info("Not loading surveys in cookieless mode without consent.");const n=this.wo.getExtensions();if(!n)return void this.Bc("PostHog Extensions not found.");if(Eo(this.Lc)&&!e.advancedEnableSurveys)return;const o=this.Lc||e.advancedEnableSurveys;this.Mc=!0,this.Ec=!1;try{const i=n.generateSurveys;if(i)return this.zc(i,o),void(this.Mc=!1);const r=n.loadExternalDependency;if(!r)return this.Bc(vxe),void(this.Mc=!1);r(s=>{try{if(this.To)return;const a=this.wo.getExtensions();s||!a?.generateSurveys?this.Bc("Could not load surveys script",s):this.zc(a.generateSurveys,o)}finally{this.Mc=!1}})}catch(i){throw this.Mc=!1,this.Bc("Error initializing surveys",i),i}}zc(e,n){var o,i;if(this.To)return;this._surveyManager=e(n),this._surveyEventReceiver=this.wo.createEventReceiver(this.Dc);const r=(o=(i=this.bo)!==null&&i!==void 0?i:this.Ic)===null||o===void 0?void 0:o.kv.get(Oz);r&&this.Hc(r),_l.info("Surveys loaded successfully"),this.Uc(),this.Dc(),this.Wc({isLoaded:!0})}Bc(e,n){this.Ec=!0,_l.error(e,n),this.Dc({isLoaded:!1,error:e}),this.Wc({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Pc.push(e),this._surveyManager&&this.Wc({isLoaded:!0}),()=>{this.Pc=this.Pc.filter(n=>n!==e)}}getSurveys(e,n=!1){var o;const i=(o=this.bo)!==null&&o!==void 0?o:this.Ic;if(!i||this.To)return;if(this.Mr.disableSurveys)return _l.info(r0t),e([]);const r=i.kv.get(Oz);if(r&&!n)return e(r,{isLoaded:!0}),void(this.Vc()&&this.getSurveys(()=>{},!0));if(this.Ac)return void this.Ac.then(({surveys:A,context:c})=>{this.To||e(A,c)}).catch(A=>_l.error("Error in survey callback",A));const s=this.Gc("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(A=>{try{return this.Qc(i,A)}catch(c){return _l.error("Error processing surveys response",c),this.Qc(i,{statusCode:0,error:c})}},A=>this.Qc(i,{statusCode:0,error:A}));this.Ac=s;const a=()=>{this.Ac===s&&(this.Ac=null)};s.then(A=>{a(),this.To||(this.Dc(A.context),e(A.surveys,A.context))},a).catch(A=>_l.error("Error in survey callback",A))}Gc(e,n){const o=this.bo;return o?o.sendRequest(e,n):new Promise(i=>i({statusCode:0,error:new Error(IF)}))}Qc(e,n){if(this.To)return{surveys:[],context:{isLoaded:!1,error:IF}};const o=n.statusCode;if(o!==200||!n.json){const r=`Surveys API could not be loaded, status: ${o}`;return o!==0?_l.error(r):n.error||_l.warn(r),this.Fc=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Fc=null;const i=n.json.surveys||[];return e.kv.set({[Oz]:i,[qne]:Date.now()}),this.Hc(i),{surveys:i,context:{isLoaded:!0}}}Hc(e){var n;const o=e.filter(i=>(function(r){return!(!r.start_date||r.end_date)})(i)&&(Llt(i)||(function(r){var s;return!!(!((s=r.conditions)===null||s===void 0||(s=s.actions)===null||s===void 0||(s=s.values)===null||s===void 0)&&s.length)})(i)));(n=this._surveyEventReceiver)===null||n===void 0||n.replace(o)}Vc(){return this.Zc()&&!this.Ac&&!this.Jc()}Zc(){var e,n;const o=(e=(n=this.bo)!==null&&n!==void 0?n:this.Ic)===null||e===void 0?void 0:e.kv.get(qne);return eh(o)&&Date.now()-o>3e5}Jc(){return eh(this.Fc)&&3e5>Date.now()-this.Fc}markSurveyAsSeen(e,n){var o;const i={id:e,current_iteration:(o=n?.iteration)!==null&&o!==void 0?o:null};Ylt(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this.Dc()}Wc(e){for(const n of this.Pc)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(o){_l.error("Error in survey callback",o)}}getActiveMatchingSurveys(e,n=!1){if(!Fs(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);_l.warn("init was not called")}onActiveMatchingSurveysChanged(e){var n,o;if(this.To)return()=>{};const i={callback:e,active:!0,revision:0};this.Rc.push(i),this.Uc();const r=(n=(o=this.bo)!==null&&o!==void 0?o:this.Ic)===null||n===void 0?void 0:n.kv.get(Oz);return this.Mr.disableSurveys||!this._surveyManager&&this.Ec&&!this.Mc||!r&&!Fs(this.Fc)&&!this.Ac?this.Nc(i,{isLoaded:!1}):this._surveyManager&&this.Nc(i),()=>{var s;i.active=!1,this.Rc=this.Rc.filter(a=>a!==i),this.Rc.length===0&&((s=this.jc)===null||s===void 0||s.call(this),this.jc=void 0)}}Uc(){var e,n,o;this._surveyManager&&this.Rc.length>0&&((e=this.jc)!==null&&e!==void 0||(this.jc=(n=(o=this.wo).onMatchingConditionsChanged)===null||n===void 0?void 0:n.call(o,this.Dc)))}Nc(e,n){if(this.To||!e.active)return;const o=++e.revision,i=r=>{if(!this.To&&e.active&&o===e.revision)try{const s=n??{isLoaded:!0},a=JSON.stringify([r,s]);if(a===e.lastResult)return;e.lastResult=a,e.callback(r,s)}catch(s){_l.error("Error in active matching surveys callback",s)}};try{n&&!n.isLoaded?i([]):this.getActiveMatchingSurveys(i)}catch(r){_l.error("Error in active matching surveys callback",r)}}Kc(e){let n=null;return this.getSurveys(o=>{var i;n=(i=o.find(r=>r.id===e))!==null&&i!==void 0?i:null}),n}Xc(e){if(Fs(this._surveyManager))return{eligible:!1,reason:IF};const n=typeof e=="string"?this.Kc(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}Yc(e){if(!this.wo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(Fs(this._surveyManager))return{eligible:!1,reason:IF};const n=typeof e=="string"?this.Kc(e):e;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Fs(this._surveyManager))return _l.warn("init was not called"),{visible:!1,disabledReason:IF};const n=this.Yc(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return Fs(this._surveyManager)?(_l.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:IF})):new Promise(o=>{this.getSurveys(i=>{var r;const s=(r=i.find(a=>a.id===e))!==null&&r!==void 0?r:null;if(s){const a=this.Yc(s);o({visible:a.eligible,disabledReason:a.reason})}else o({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(e,n,o){var i;if(!this.wo.isCapturing())return;if(Fs(this._surveyManager))return void _l.warn("init was not called");const r=typeof e=="string"?this.Kc(e):e;if(!r?.id)return void _l.warn("Survey not found");if(!APn.includes(r.type))return void _l.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const s=qo?.querySelector(n);if(s){if(!((i=r.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds){_l.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const a=setTimeout(()=>{var A,c;this.Oc.delete(a),!this.To&&this.wo.isCapturing()&&(_l.info(`Rendering survey ${r.id} with delay of ${(A=r.appearance)===null||A===void 0?void 0:A.surveyPopupDelaySeconds} seconds`),(c=this._surveyManager)===null||c===void 0||c.renderSurvey(r,s,o),_l.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Oc.add(a)}this._surveyManager.renderSurvey(r,s,o)}else _l.warn("Survey element not found")}displaySurvey(e,n){var o;if(!this.wo.isCapturing())return;if(Fs(this._surveyManager))return void _l.warn("init was not called");const i=this.Kc(e);if(!i)return void _l.warn("Survey not found");let r=i;if(!((o=i.appearance)===null||o===void 0)&&o.surveyPopupDelaySeconds&&n.ignoreDelay&&(r=Zt(Zt({},i),{},{appearance:Zt(Zt({},i.appearance),{},{surveyPopupDelaySeconds:0})})),n.displayType!==$xe.Popover&&n.initialResponses&&_l.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){const s=this.Xc(i);if(!s.eligible)return void _l.warn("Survey is not eligible to be displayed: ",s.reason)}n.displayType!==$xe.Inline?this._surveyManager.handlePopoverSurvey(r,n):this.renderSurvey(r,n.selector,n.properties)}cancelPendingSurvey(e){Fs(this._surveyManager)?_l.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.handlePageUnload)===null||n===void 0||n.call(e)}};function CF(t,e,n){if(Fs(t))return!1;switch(n){case"exact":return t===e;case"contains":{const o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(o,"i").test(t)}case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}var RPn=class{constructor(e){this._instance=e,this.th=new Set,this.eh=new Set,this.ih=new coe,this.nh=(n,o)=>this.sh(n,o)&&this.rh(n,o)&&this.oh(n,o)&&this.ah(n,o),this.sh=(n,o)=>!o?.event||n?.event===o?.event}init(){var e,n;Eo((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.uh=(n=this._instance)===null||n===void 0?void 0:n._addCaptureHook((o,i)=>{this.on(o,i)}))}dispose(){var e,n;(e=this.uh)===null||e===void 0||e.call(this),this.uh=void 0,(n=this._instance)===null||n===void 0||(n=n.autocapture)===null||n===void 0||n.setElementSelectors(new Set,this),this.ih=new coe}register(e){var n,o;if(!Eo((n=this._instance)===null||n===void 0?void 0:n._addCaptureHook)&&(e.forEach(i=>{var r;this.th.add(i),(r=i.steps)===null||r===void 0||r.forEach(s=>{this.eh.add(s?.event||"")})}),(o=this._instance)===null||o===void 0?void 0:o.autocapture)){const i=new Set;this.th.forEach(r=>{var s;(s=r.steps)===null||s===void 0||s.forEach(a=>{a?.selector&&i.add(a.selector)})}),this._instance.autocapture.setElementSelectors(i,this)}}replace(e){this.th.clear(),this.eh.clear(),this.register(e)}on(e,n){n!=null&&e.length!=0&&(this.eh.has(e)||this.eh.has(n.event))&&this.th.forEach(o=>{this.hh(n,o)&&this.ih.emit("actionCaptured",o.name)})}dh(e){this.onAction("actionCaptured",n=>e(n))}hh(e,n){if(n?.steps==null)return!1;for(const o of n.steps)if(this.nh(e,o))return!0;return!1}onAction(e,n){return this.ih.on(e,n)}rh(e,n){if(n?.url){var o;const i=e==null||(o=e.properties)===null||o===void 0?void 0:o.$current_url;if(!i||typeof i!="string"||!CF(i,n.url,n.url_matching||"contains"))return!1}return!0}oh(e,n){return!!this.fh(e,n)&&!!this.ph(e,n)&&!!this.gh(e,n)}fh(e,n){var o;if(!n?.href)return!0;const i=this.mh(e);if(i.length>0)return i.some(s=>CF(s.href,n.href,n.href_matching||"exact"));const r=(e==null||(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)||"";return!!r&&CF((function(s){const a=s.match(/(?::|")href="(.*?)"/);return a?a[1]:""})(r),n.href,n.href_matching||"exact")}ph(e,n){var o;if(!n?.text)return!0;const i=this.mh(e);if(i.length>0)return i.some(c=>CF(c.text,n.text,n.text_matching||"exact")||CF(c.$el_text,n.text,n.text_matching||"exact"));const r=(e==null||(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)||"";return!!r&&(s=(function(c){const l=[],g=/(?::|")text="(.*?)"/g;let u;for(;!Fs(u=g.exec(c));)l.includes(u[1])||l.push(u[1]);return l})(r),a=n.text,A=n.text_matching||"exact",s.some(c=>CF(c,a,A)));var s,a,A}gh(e,n){var o,i;if(!n?.selector)return!0;const r=e==null||(o=e.properties)===null||o===void 0?void 0:o.$element_selectors;if(r?.includes(n.selector))return!0;const s=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";if(n.selector_regex&&s)try{return new RegExp(n.selector_regex).test(s)}catch{return!1}return!1}mh(e){var n;return(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements)==null?[]:e?.properties.$elements}ah(e,n){return!n?.properties||n.properties.length===0||Olt(n.properties.reduce((o,i)=>{const r=qr(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return o[i.key]={values:r,operator:i.operator||"exact"},o},{}),e?.properties)}},TPn=class{constructor(e,n){var o,i;this.yh=[],this._instance=e,this.bh=n,this._h=new Map,this.wh=new Map,this.kh=new Map,this.Sh=(o=this._instance)===null||o===void 0||(i=o.onSessionId)===null||i===void 0?void 0:i.call(o,r=>this.xh(r))}$h(e){return!1}Ch(){return null}Th(e){}Ih(){}Mh(e,n){return!!e&&Olt(e.propertyFilters,n?.properties)}Eh(e,n){const o=new Map;return e.forEach(i=>{var r;(r=i.conditions)===null||r===void 0||(r=r[n])===null||r===void 0||(r=r.values)===null||r===void 0||r.forEach(s=>{if(s?.name){const a=o.get(s.name)||[];a.push(i.id),o.set(s.name,a)}})}),o}Ph(e,n,o){const i=(o===jz.Activation?this._h:this.wh).get(e);let r=[];return this.Rh(s=>{r=s.filter(a=>i?.includes(a.id))}),r.filter(s=>{var a;const A=(a=s.conditions)===null||a===void 0||(a=a[o])===null||a===void 0||(a=a.values)===null||a===void 0?void 0:a.find(c=>c.name===e);return this.Mh(A,n)})}register(e){this.Ah(e,!1)}replace(e){this.Ah(e,!0)}Ah(e,n){var o;Eo((o=this._instance)===null||o===void 0?void 0:o._addCaptureHook)||(this.Fh(e,n),this.Oh(e,n))}Oh(e,n){const o=e.filter(s=>{var a;return(a=s.conditions)===null||a===void 0||(a=a.actions)===null||a===void 0||(a=a.values)===null||a===void 0?void 0:a.length});var i;if(n&&this.kh.clear(),o.length===0)return void(n&&((i=this.Dh)===null||i===void 0||i.replace([])));this.Dh||(this.Dh=new RPn(this._instance),this.Dh.init(),this.Dh.dh(s=>this.onAction(s)));const r=[];o.forEach(s=>{var a;(a=s.conditions)===null||a===void 0||(a=a.actions)===null||a===void 0||a.values.forEach(A=>{if(r.push(A),A.name){var c;const l=(c=this.kh.get(A.name))!==null&&c!==void 0?c:[];l.includes(s.id)||l.push(s.id),this.kh.set(A.name,l)}})}),n?this.Dh.replace(r):this.Dh.register(r)}Lh(e,n){n.forEach((o,i)=>{var r;const s=(r=e.get(i))!==null&&r!==void 0?r:[];o.forEach(a=>{s.includes(a)||s.push(a)}),e.set(i,s)})}Fh(e,n){var o,i;const r=e.filter(c=>{var l,g;return((l=c.conditions)===null||l===void 0?void 0:l.events)&&((g=c.conditions)===null||g===void 0||(g=g.events)===null||g===void 0||(g=g.values)===null||g===void 0?void 0:g.length)>0}),s=e.filter(c=>{var l,g;return((l=c.conditions)===null||l===void 0?void 0:l.cancelEvents)&&((g=c.conditions)===null||g===void 0||(g=g.cancelEvents)===null||g===void 0||(g=g.values)===null||g===void 0?void 0:g.length)>0}),a=this.Eh(e,jz.Activation),A=this.Eh(e,jz.Cancellation);n?(this._h=a,this.wh=A):(this.Lh(this._h,a),this.Lh(this.wh,A)),(r.length!==0||s.length!==0||e.some(c=>{var l;return(l=c.conditions)===null||l===void 0||(l=l.actions)===null||l===void 0||(l=l.values)===null||l===void 0?void 0:l.length}))&&((o=this.uh)!==null&&o!==void 0||(this.uh=(i=this._instance)===null||i===void 0?void 0:i._addCaptureHook((c,l)=>{this.onEvent(c,l)})))}onEvent(e,n){var o,i;const r=this.Nh(),s=(n==null||(o=n.properties)===null||o===void 0?void 0:o.$survey_id)||(n==null||(i=n.properties)===null||i===void 0?void 0:i.$product_tour_id);if(s&&this.getActivatedIds().includes(s)){const A=this.qh(e,s,n);if(A==="consume")return r.info("event consumed activated item, removing it",{event:e,itemId:s}),void this.jh([s]);if(A==="persist")return r.info("shown item promoted to persisted activation",{event:e,itemId:s}),this.Bh(s),void this.zh([s])}if(this.wh.has(e)){const A=this.Ph(e,n,jz.Cancellation);A.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:A.map(c=>c.id)}),this.jh(A.map(c=>c.id)),A.forEach(c=>this.Hh(c.id)))}if(!this._h.has(e))return;r.info("event name matched",{event:e,eventPayload:n,items:this._h.get(e)});const a=this.Ph(e,n,jz.Activation);this.Uh(a.map(A=>A.id))}onAction(e){this.kh.has(e)&&this.Uh(this.kh.get(e)||[])}Uh(e){var n,o;if(e.length===0)return;const i=!!(!((n=this._instance)===null||n===void 0||(o=n.get_session_id)===null||o===void 0)&&o.call(n)),r=[];for(const s of e)i&&this.$h(s)?this.Bh(s)&&this.Wh(s):r.push(s);r.length>0&&(this.yh=[...new Set([...this.yh,...r])]),this.Nh().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.Vh()}Bh(e){this.yh=this.yh.filter(o=>o!==e);const n=this.Gh();return!n.includes(e)&&(this.Qh([...n,e]),this.Zh(),!0)}jh(e){const n=new Set(e);this.yh=this.yh.filter(r=>!n.has(r));const o=this.Jh(),i=o.filter(r=>!n.has(r));i.length!==o.length&&(this.Qh(i),i.length===0&&this.Kh()),this.zh(e),this.Vh()}Vh(){try{var e;(e=this.bh)===null||e===void 0||e.call(this)}catch(n){this.Nh().error("Error while handling activated items change",n)}}Xh(){var e;const n=this.Ch();if(!n)return{};const o=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[n];return o&&typeof o=="object"?o:{}}Wh(e){if(!this.Ch())return;const n=this.Xh();this.Th(Zt(Zt({},n),{},{[e]:Date.now()}))}zh(e){if(!this.Ch())return;const n=this.Xh(),o={};let i=!1;for(const[r,s]of Object.entries(n))e.includes(r)?i=!0:o[r]=s;i&&(px(o)?this.Ih():this.Th(o))}Yh(){this.Ch()&&this.Ih()}getActivationTimestamp(e){if(!this.Gh().includes(e))return;const n=this.Xh()[e];return eh(n)?n:void 0}Jh(){var e;const n=this.td();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[n])||[]}Gh(){var e,n,o;const i=this.Jh();if(i.length===0)return[];const r=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.ed()],s=(n=this._instance)===null||n===void 0||(o=n.get_session_id)===null||o===void 0?void 0:o.call(n);return s&&r===s?i:[]}Zh(){var e,n;const o=(e=this._instance)===null||e===void 0||(n=e.get_session_id)===null||n===void 0?void 0:n.call(e);o&&this.nd(o)}Kh(){this.sd()}xh(e){var n;const o=(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0?void 0:n.props[this.ed()];if(o&&o!==e){const i=this.Jh(),r=this.Xh();i.length>0&&(this.Qh([]),i.filter(s=>eh(r[s])).forEach(s=>this.Hh(s))),this.Kh(),this.Yh(),i.length>0&&this.Vh()}}getActivatedIds(){return[...new Set([...this.Gh(),...this.yh])].filter(e=>!this.rd(e))}dispose(){var e,n,o;(e=this.Sh)===null||e===void 0||e.call(this),this.Sh=void 0,(n=this.uh)===null||n===void 0||n.call(this),this.uh=void 0,(o=this.Dh)===null||o===void 0||o.dispose(),this.Dh=void 0}reset(){this.yh=[],this.Jh().length>0&&this.Qh([]),this.Kh(),this.Yh(),this.Vh()}getEventToItemsMap(){return this._h}od(){return this.Dh}},kPn=class extends TPn{constructor(e,n){super(e,n)}td(){return ect}ed(){return tct}Ch(){return nct}Th(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated_timestamps:e})}Ih(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}$h(e){var n;let o;this.Rh(r=>{o=r.find(s=>s.id===e)});const i=o==null||(n=o.appearance)===null||n===void 0?void 0:n.surveyPopupDelaySeconds;return eh(i)&&i>0}ad(){return J3.SHOWN}Rh(e){var n;(n=this._instance)===null||n===void 0||n.getSurveys(e)}Hh(e){var n;(n=this._instance)===null||n===void 0||n.cancelPendingSurvey(e)}Nh(){return _l}Qh(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated:e})}nd(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated_session:e})}sd(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}rd(){return!1}qh(e,n,o){var i;if(e===J3.SENT&&(o==null||(i=o.properties)===null||i===void 0?void 0:i.$survey_completed)===!1)return"ignore";let r;return this.Rh(s=>{r=s.find(a=>a.id===n)}),!r||(function(s){var a;return Llt(s)&&!!(!((a=s.conditions)===null||a===void 0||(a=a.events)===null||a===void 0)&&a.repeatedActivation)||s.schedule==="always"})(r)?e===J3.SHOWN?"consume":"ignore":e===J3.SHOWN?"persist":e===J3.DISMISSED||e===J3.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},FPn=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const n={};for(const o of e){const i=this._instance.get_property(o);Eo(i)||(n[o]=i)}return n}set(e,n){this._instance.register(typeof e=="string"?{[e]:n}:e)}remove(e){typeof e!="string"?e.forEach(n=>this._instance.unregister(n)):this._instance.unregister(e)}},LPn=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=Yr?.__PosthogExtensions__;if(!e)return;const{generateSurveys:n,loadExternalDependency:o}=e;return{generateSurveys:n?i=>n(this._instance,i):void 0,loadExternalDependency:o?i=>o(this._instance,"surveys",i):void 0}}createEventReceiver(e){return new kPn(this._instance,e)}onMatchingConditionsChanged(e){const n=this._instance._addCaptureHook(s=>{s!=="$pageview"&&s!==J3.SHOWN&&s!==J3.DISMISSED&&s!==J3.SENT||e()}),o=()=>e();Wc(jn,"PHSurveyShown",o);let i=!1;const r=this._instance.onFeatureFlags(()=>{i&&e()});return i=!0,()=>{i=!1,n(),r(),jn?.removeEventListener("PHSurveyShown",o)}}};const HPn=jn?.location?noe(jn.location.hash,"__posthog")||noe(location.hash,"state"):null,s0t="_postHogToolbarParams",a0t=gd("[Toolbar]"),A0t=gd("[FeatureFlags]"),cD=gd("[FeatureFlags]",{debugEnabled:!0}),f3e=`" failed. Feature flags didn't load in time.`,OPn=[502,504],c0t=["click","keydown","wheel","touchstart","pointerdown"],l0t="connection_error",g0t=t=>{const e={};for(let n=0;t.length>n;n++)e[t[n]]=!0;return e},u0t=t=>{const e={};for(const[n,o]of Zne(t||{}))o&&(e[n]=o);return e};var GPn=class{constructor(e){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=A0t,this.ud={},this.hd={},this.dd=[],this.vd=new Set,this.fd=new Set,this.pd=!1,this.gd=!1,this.md=0,this.yd=!1,this.bd=!1,this._d=!1,this.wd=!1,this.kd=0,this.Sd=!1,this.rn=()=>{const n=this.xd();this.kd=0,n&&this.reloadFeatureFlags()},this.$d=()=>{var n,o;const i=this.Cd,r=(n=this.Td)!==null&&n!==void 0?n:i;Eo(i)||Eo(r)||this.Mr.remoteRequestsDisabled||!this.Id||this.Id.visibilityState==="hidden"||Date.now()-((o=this.Md)!==null&&o!==void 0?o:0)<r||(this.Td=this.Sd||!this.Mr.idleRefreshBackoff?i:Math.min(2*r,36e5),this.Sd=!1,this.reloadFeatureFlags(),this.Ed())},this.Pd=()=>{this.Sd&&this.Td===this.Cd||this.Rd()},this.sn=()=>{var n;((n=this.Id)===null||n===void 0?void 0:n.visibilityState)==="visible"&&this.Rd()},this.wo=e}get Ad(){}Fd(){this.bo&&this.Od()}setup(e){try{this.Dd=typeof window>"u"?void 0:window,this.Id=typeof document>"u"?void 0:document}catch{this.Dd=void 0,this.Id=void 0}return this.qc=e,this.A=e.logger.createLogger("[FeatureFlags]"),i0t(e.kv.initialize(),()=>{this.qc===e&&(this.qc=void 0,this.bo=e,this.Ld(e))})}Ld(e){var n;if(this.bo===e)return this.Dd&&Wc(this.Dd,"online",this.rn),this.Od(),this.Nd=e.registerDynamicEventProperties(()=>this.qd()?this.ud:this.hd),this.jd=(n=this.Ad)===null||n===void 0?void 0:n.onCrossTabFeatureFlagChange(()=>{this.Bd(),this.zd(),this.Hd()}),this.zd(),this.initialize()}Rd(){this.Sd=!0,this.Td=this.Cd,this.$d()}Od(){var e;const n=this.Mr.refreshIntervalMs,o=!this.Mr.remoteRequestsDisabled&&this.Id&&!Eo(n)&&n>0?n:void 0;this.Mr.idleRefreshBackoff||(this.Td=o),o!==this.Cd&&(this.Ud(),Eo(o)||(this.Cd=o,this.Td=o,this.Ed(),!((e=this.Id)===null||e===void 0)&&e.addEventListener&&(Wc(this.Id,Fz,this.sn),iF(c0t,i=>{Wc(this.Id,i,this.Pd,{capture:!0})}))))}Ed(){Eo(this.Cd)||(Eo(this.Wd)||clearInterval(this.Wd),this.Md=Date.now(),this.Wd=setInterval(this.$d,this.Cd))}Ud(){var e,n;Eo(this.Wd)||(clearInterval(this.Wd),this.Wd=void 0,(e=this.Id)===null||e===void 0||(n=e.removeEventListener)===null||n===void 0||n.call(e,"visibilitychange",this.sn),iF(c0t,o=>{var i,r;(i=this.Id)===null||i===void 0||(r=i.removeEventListener)===null||r===void 0||r.call(i,o,this.Pd,{capture:!0})})),this.Cd=void 0,this.Td=void 0,this.Sd=!1,this.Md=void 0}destroy(){this.Vd()}dispose(){this.Vd()}Vd(){var e,n,o;this.Ud(),this.md++,this.bd=!1,this.qc=void 0,this.Gd(this.vd,"cancelled"),this.Gd(this.fd,"cancelled"),this.bo&&(this.Qd(),(e=this.Nd)===null||e===void 0||e.dispose(),this.Nd=void 0,(n=this.jd)===null||n===void 0||n.call(this),this.jd=void 0,this.dd=[],(o=this.Dd)===null||o===void 0||o.removeEventListener("online",this.rn),this.bo=void 0)}get Mr(){return this.wo.get()}Zd(e){var n;return this.Jd&&e in this.Jd?this.Jd[e]:(n=this.bo)===null||n===void 0?void 0:n.kv.get(e)}Bd(){return!!this.Jd&&(this.Jd=void 0,!0)}Kd(){var e;return!Eo((e=this.bo)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.Bd()}$t(e){this.Xd(()=>{var n;return(n=this.bo)===null||n===void 0?void 0:n.kv.set(e)})}Yd(e,n,o){if(!this.Ad||!e.$enabled_feature_flags)return;const i=this.Zd("$enabled_feature_flags")||{},r=e.$enabled_feature_flags||{},s=n.flags||n.featureFlags,a=n.flags?Object.entries(n.flags).filter(([,_])=>!_?.failed).map(([_])=>_):[],A=!!n.errorsWhileComputingFlags&&!!n.flags,c=A?a:o&&!qr(s)?Object.keys(s||{}):Array.from(new Set([...Object.keys(i),...Object.keys(r)])),l=this.Zd("$feature_flag_payloads")||{},g=e.$feature_flag_payloads||{},u=A||o?c:Array.from(new Set([...Object.keys(l),...Object.keys(g)])),h=!A&&!o,d=!!h||c,m=!!h||u,p={[K8]:d,[Z4]:d,[kQ]:m};e.$feature_flag_details&&(p[tD]=d);for(const _ of[nD,DQ,Tz])Eo(e[_])||(p[_]=!0);this.Ad.markCrossTabFeatureFlagChanges(p)}Pt(e){this.Xd(()=>{var n;return(n=this.bo)===null||n===void 0?void 0:n.kv.remove(e)})}Xd(e){try{e()}catch(n){this.A.error("Failed to update feature flag persistence",n)}}zd(){const e={};for(const i of[K8,kQ,nD,V9]){const r=this.Zd(i);Eo(r)||(e[i]=r)}this.ud=e;const n=Zt({},e),o=this.Zd(Z4);if(o)for(const[i,r]of Object.entries(o))n[`$feature/${i}`]=r;this.hd=n}qd(){const e=this.Mr.cacheTtlMs;if(!e||0>=e)return!1;const n=this.Zd(DQ);return typeof n!="number"||Date.now()-n>e}tv(){return!!this.qd()&&(this.wd||this.gd||(this.wd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ev(){const e=this.Mr.evaluationContexts;return e?.length?e.filter(n=>{const o=n&&typeof n=="string"&&n.trim().length>0;return o||this.A.error("Invalid evaluation context found:",n,"Expected non-empty string"),o}):[]}iv(){const e=this.Mr.flagKeys;if(!Eo(e))return e.filter(n=>{const o=n&&typeof n=="string"&&n.trim().length>0;return o||this.A.error("Invalid flag key found:",n,"Expected non-empty string"),o})}initialize(){var e,n;const o=this.Mr,i=(e=(n=o.bootstrap)===null||n===void 0?void 0:n.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var r,s;const a=(r=(s=o.bootstrap)===null||s===void 0?void 0:s.featureFlagPayloads)!==null&&r!==void 0?r:{},A=Object.keys(i).filter(l=>!Eo(i[l])).reduce((l,g)=>(l[g]=i[g],l),{}),c=Object.keys(a).filter(l=>A[l]).reduce((l,g)=>(l[g]=a[g],l),{});return this.nv({featureFlags:A,featureFlagPayloads:c},void 0,{persist:!1})}}updateFlags(e,n,o){var i,r;const s=o?.merge&&(i=this.Zd("$enabled_feature_flags"))!==null&&i!==void 0?i:{},a=o?.merge&&(r=this.Zd("$feature_flag_payloads"))!==null&&r!==void 0?r:{},A=Zt(Zt({},s),e),c=Zt(Zt({},a),n),l={};for(const[g,u]of Object.entries(A))l[g]={key:g,enabled:IAt(u),variant:CAt(u),reason:void 0,metadata:Eo(c?.[g])?void 0:{id:0,version:void 0,description:void 0,payload:c[g]}};this.nv({flags:l})}get hasLoadedFlags(){return this.pd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.Zd(tD),n=this.Zd(V9),o=this.Zd(oD);if(!o&&!n)return e||{};const i=Xg({},e||{}),r=[...new Set([...Object.keys(o||{}),...Object.keys(n||{})])];for(const A of r){var s,a;const c=i[A],l=n?.[A],g=Eo(l)?(s=c?.enabled)!==null&&s!==void 0&&s:!!l,u=Eo(l)?c?.variant:typeof l=="string"?l:void 0,h=o?.[A],d=Zt(Zt({},c),{},{enabled:g,variant:g?u??c?.variant:void 0});g!==c?.enabled&&(d.original_enabled=c?.enabled),u!==c?.variant&&(d.original_variant=c?.variant),h&&(d.metadata=Zt(Zt({},c?.metadata),{},{payload:h,original_payload:c==null||(a=c.metadata)===null||a===void 0?void 0:a.payload})),i[A]=d}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:o,finalDetails:i}),this.ld=!0),i}getAllFeatureFlags(){const e=this.getFlagVariants(),n=this.getFlagPayloads();return Object.keys(e).map(o=>{const i=e[o];return{key:o,enabled:IAt(i),variant:CAt(i),payload:fAt(n[o])}})}getFlagVariants(){const e=this.Zd(Z4),n=this.Zd(V9);if(!n)return e||{};const o=Xg({},e||{}),i=Object.keys(n);for(let r=0;i.length>r;r++)o[i[r]]=n[i[r]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:n,finalFlags:o}),this.ld=!0),o}getFlagPayloads(){const e=this.Zd(kQ),n=this.Zd(oD);if(!n)return e||{};const o=Xg({},e||{}),i=Object.keys(n);for(let r=0;i.length>r;r++)o[i[r]]=n[i[r]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:n,finalPayloads:o}),this.ld=!0),o}reloadFeatureFlags(){this.yd||this.Mr.featureFlagsDisabled||this.xd()||(this.gd&&(this.bd=!0),this.sv||(this.dd.slice().forEach(e=>{try{e()}catch(n){this.A.error("Error while running feature flags reloading callback",n)}}),this.sv=setTimeout(()=>{this.rv()},5)))}reloadFeatureFlagsAsync(){return!this.bo||this.yd||this.Mr.featureFlagsDisabled||this.Mr.remoteRequestsDisabled||this.xd()?Promise.resolve({status:"skipped"}):new Promise(e=>{this.vd.add(e),this.reloadFeatureFlags()})}Gd(e,n){e.forEach(o=>o({status:n})),e.clear()}Qd(){clearTimeout(this.sv),this.sv=void 0}onReloading(e){return this.dd.push(e),()=>{this.dd=this.dd.filter(n=>n!==e)}}ensureFlagsLoaded(){this.pd||this.gd||this.sv||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.yd=e}resetFlagCallReported(){this.Pt(TQ)}rv(e){var n;this.Qd();const o=this.bo;if(!o||this.Mr.remoteRequestsDisabled||this.xd())return void this.Gd(this.vd,"skipped");if(this.gd)return void(this.bd=!0);const i={token:o.projectToken,distinct_id:o.distinctId,groups:o.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:Zt(Zt(Zt({},o.initialPersonProperties),this.Zd("$stored_person_properties")||{}),{},{$lib:o.library.name,$lib_version:o.library.version}),group_properties:this.Zd(NQ),timezone:jct()};Eo(o.deviceId)||(i.$device_id=o.deviceId),(e?.disableFlags||this.Mr.featureFlagsDisabled)&&(i.disable_flags=!0);const r=this.ev();r.length&&(i.evaluation_contexts=r);const s=this.iv();Eo(s)||(i.flag_keys=s);const a=this.Mr.onlyEvaluateSurveyFeatureFlags,A="/flags/?v=2"+(a?"&only_evaluate_survey_feature_flags=true":""),c=this.md,l=this.vd;this.vd=new Set,this.fd=l,this.gd=!0;const g=()=>{this.bd&&(this.bd=!1,this.rv())},u=_=>{var f,I;const C=(f=_.json)!==null&&f!==void 0?f:{},y=_.statusCode!==200;if(this.gd=!1,c!==this.md)return void g();if(this.ov(_.statusCode),y||this.bd||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.bd)return void this.Gd(l,"skipped");this._d=!y;const x=[];_.error?x.push(_.error instanceof Error&&_.error.name==="AbortError"?"timeout":_.error instanceof Error?l0t:"unknown_error"):_.statusCode!==200&&x.push(`api_error_${_.statusCode}`),C.errorsWhileComputingFlags&&x.push("errors_while_computing_flags");const E=!!(!((I=C.quotaLimited)===null||I===void 0)&&I.includes("feature_flags"));E&&x.push("quota_limited"),this.$t({[Rz]:x}),E?this.A.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."):i.disable_flags||this.nv(C,y,{partialResponse:a}),this.Gd(l,i.disable_flags?"skipped":x.length||!C.flags&&!C.featureFlags?"error":"loaded"),g()},h=_=>{this.gd=!1,c===this.md&&(this.$t({[Rz]:[l0t]}),this.A.error("Feature flag request failed",_),this.Kd()&&this.Hd(!0),this.Gd(l,"error")),g()};let d=(n=this.Mr.requestMaxRetries)!==null&&n!==void 0?n:1;const m=()=>d>0&&c===this.md,p=()=>{if(c!==this.md||!this.bo||this.Mr.remoteRequestsDisabled)return this.gd=!1,this.Gd(l,"skipped"),void g();try{o.sendRequest(A,{target:"flags",method:"POST",body:i,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(_=>{if((f=>OPn.includes(f.statusCode)||(I=>I.statusCode===0&&I.error instanceof Error&&I.error.name==="AbortError")(f))(_)&&m())return d--,void setTimeout(p,500);u(_)}).catch(h)}catch(_){h(_)}};p()}xd(){return $ct(this.kd,3)}ov(e){this.kd=Xct(e,this.kd,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,n={}){var o;if(n.fresh&&!this._d)return;if(!(this.pd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+e+f3e);if(this.tv())return;const i=this.getFeatureFlagResult(e,n);return(o=i?.variant)!==null&&o!==void 0?o:i?.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const n=this.getFeatureFlagResult(e,{send_event:!1});return n?.payload}getFeatureFlagResult(e,n={}){if(n.fresh&&!this._d)return;if(!(this.pd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+e+f3e);if(this.tv())return;const o=this.getFlagVariants(),i=e in o,r=o[e],s=this.getFlagPayloads()[e],a=String(r),A=this.Zd("$feature_flag_request_id")||void 0,c=this.Zd("$feature_flag_evaluated_at")||void 0;let l,g=this.Zd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var u;const Q=(u=this.bo)===null||u===void 0?void 0:u.session.sessionId,w=this.Zd(kz);Q&&Q!==w&&(g={},l=Q)}if(!n.send_event&&"send_event"in n)l&&this.$t({[TQ]:g,[kz]:l});else if(e in g&&g[e].includes(a))l&&this.$t({[TQ]:g,[kz]:l});else{var h,d,m,p,_,f,I,C,y,x,E,B,S;qr(g[e])?g[e].push(a):g[e]=[a],this.$t(Zt({[TQ]:g},l?{[kz]:l}:{}));const Q=this.getFeatureFlagDetails(e),w=[...(h=this.Zd("$feature_flag_errors"))!==null&&h!==void 0?h:[]];Eo(r)&&w.push("flag_missing");const M={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:s??null,$feature_flag_request_id:A,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:(d=(m=this.Mr.bootstrap)===null||m===void 0||(m=m.featureFlags)===null||m===void 0?void 0:m[e])!==null&&d!==void 0?d:null,$feature_flag_bootstrapped_payload:(p=(_=this.Mr.bootstrap)===null||_===void 0||(_=_.featureFlagPayloads)===null||_===void 0?void 0:_[e])!==null&&p!==void 0?p:null,$used_bootstrap_value:!this._d};Eo(Q==null||(f=Q.metadata)===null||f===void 0?void 0:f.has_experiment)||(M.$feature_flag_has_experiment=Q.metadata.has_experiment),Eo(Q==null||(I=Q.metadata)===null||I===void 0?void 0:I.version)||(M.$feature_flag_version=Q.metadata.version);const T=(C=Q==null||(y=Q.reason)===null||y===void 0?void 0:y.description)!==null&&C!==void 0?C:Q==null||(x=Q.reason)===null||x===void 0?void 0:x.code;T&&(M.$feature_flag_reason=T),!(Q==null||(E=Q.metadata)===null||E===void 0)&&E.id&&(M.$feature_flag_id=Q.metadata.id),Eo(Q?.original_variant)&&Eo(Q?.original_enabled)||(M.$feature_flag_original_response=Eo(Q.original_variant)?Q.original_enabled:Q.original_variant),!(Q==null||(B=Q.metadata)===null||B===void 0)&&B.original_payload&&(M.$feature_flag_original_payload=Q==null||(S=Q.metadata)===null||S===void 0?void 0:S.original_payload),w.length&&(M.$feature_flag_error=w.join(",")),this.av(M)}return i?{key:e,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:fAt(s)}:void 0}av(e){try{var n;(n=this.bo)===null||n===void 0||n.capture("$feature_flag_called",e)}catch(o){this.A.error("Failed to capture feature flag call",o)}}getRemoteConfigPayload(e,n){this.lv(e,n)}lv(e,n){var o=this;return $g(function*(){const i=o.bo;if(!i)return;const r={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},s=o.ev();s.length&&(r.evaluation_contexts=s);const a=o.iv();let A;Eo(a)||(r.flag_keys=a);try{var c;const l=(c=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:r,compression:o.Mr.compression,sentAt:"body",timeoutMs:o.Mr.requestTimeoutMs})).json)===null||c===void 0?void 0:c.featureFlagPayloads;A=l?.[e]||void 0}catch(l){return void o.A.error("Remote config feature flag request failed",l)}try{n(A)}catch(l){o.A.error("Remote config feature flag callback failed",l)}})()}isFeatureEnabled(e,n={}){if(n.fresh&&!this._d)return n.defaultValue;if(!(this.pd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+e+f3e),n.defaultValue;const o=this.getFeatureFlag(e,n);return Eo(o)?n.defaultValue:!!o}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(n=>n!==e)}receivedFeatureFlags(e,n,o){this.nv(e,n,o)}nv(e,n,o){if(!this.bo)return;this.pd=!0;const i=((r,s={},a={},A={},c,l=A0t)=>{const g=((C,y)=>{const x=C.flags;if(x){const E=Object.fromEntries(Object.keys(x).map(S=>{var Q;return[S,(Q=x[S].variant)!==null&&Q!==void 0?Q:x[S].enabled]})),B=Object.fromEntries(Object.keys(x).filter(S=>x[S].enabled).filter(S=>{var Q;return!Eo((Q=x[S].metadata)===null||Q===void 0?void 0:Q.payload)}).map(S=>{var Q;return[S,(Q=x[S].metadata)===null||Q===void 0?void 0:Q.payload]}));return Zt(Zt({},C),{},{featureFlags:E,featureFlagPayloads:B})}return C.featureFlags&&y.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),C})(r,l),u=g.flags,h=g.featureFlags,d=g.featureFlagPayloads;if(!h)return;const m=r.requestId,p=r.evaluatedAt;if(qr(h)){l.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const C={};if(h)for(let y=0;h.length>y;y++)C[h[y]]=!0;return{[K8]:h,[Z4]:C,[Tz]:!1}}let _=h,f=d,I=u;if(c?.partialResponse){const C=Object.keys(_),y=f||{};_=Zt(Zt({},s),_),f=Zt(Zt({},a),y),C.forEach(x=>{x in y||f==null||delete f[x]}),I=Zt(Zt({},A),I)}else if(r.errorsWhileComputingFlags)if(u){const C=new Set(Object.keys(u).filter(x=>{var E;return!(!((E=u[x])===null||E===void 0)&&E.failed)}));_=Zt(Zt({},s),Object.fromEntries(Object.entries(_).filter(([x])=>C.has(x))));const y=Object.fromEntries(Object.entries(f||{}).filter(([x])=>C.has(x)));f=Zt(Zt({},a),y),C.forEach(x=>{x in y||f==null||delete f[x]}),I=Zt(Zt({},A),Object.fromEntries(Object.entries(I||{}).filter(([x])=>C.has(x))))}else _=Zt(Zt({},s),_),f=Zt(Zt({},a),f),I=Zt(Zt({},A),I);return Zt(Zt({[K8]:Object.keys(u0t(_)),[Z4]:_||{},[kQ]:f||{},[tD]:I||{},[Tz]:r.minimalFlagCalledEvents===!0},m?{[nD]:m}:{}),p?{[DQ]:p}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),o,this.A);if(i)if(o?.persist===!1){const r=!Eo(this.bo.kv.get(Z4));this.Jd=i,r||this.$t(i)}else this.Bd(),this.Yd(i,e,!!o?.partialResponse),this.$t(i);else n&&this.Kd();n||(this.wd=!1),this.Hd(n)}override(e,n=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:n})}overrideFeatureFlags(e){this.uv(e)}uv(e){if(this.bo){if(e===!1)return this.Pt([V9,oD]),this.Hd(),void cD.info("All overrides cleared");if(qr(e))return this.$t({[V9]:g0t(e)}),this.Hd(),void cD.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n;const o=e;this.ld=!!((n=o.suppressWarning)!==null&&n!==void 0&&n);const i={},r=o.flags,s=o.payloads;return r&&(i[V9]=qr(r)?g0t(r):r),s&&(i[oD]=s),Object.keys(i).length&&this.$t(i),r===!1&&s===!1?this.Pt([V9,oD]):r===!1?this.Pt(V9):s===!1&&this.Pt(oD),this.Hd(),r===!1?cD.info("Flag overrides cleared"):r&&cD.info("Flag overrides set",{flags:r}),void(s===!1?cD.info("Payload overrides cleared"):s&&cD.info("Payload overrides set",{payloads:s}))}if(e&&typeof e=="object")return this.$t({[V9]:e}),this.Hd(),void cD.info("Flag overrides set",{flags:e});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.pd){const{flags:n,flagVariants:o}=this.hv();try{e(n,o)}catch(i){this.A.error("Error while running feature flags callback",i)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,n,o){var i;const r=(this.Zd("$early_access_features")||[]).find(l=>l.flagKey===e),s={[`$feature_enrollment/${e}`]:n},a={$feature_flag:e,$feature_enrollment:n,$set:s};r&&(a.$early_access_feature_name=r.name),o&&(a.$feature_enrollment_stage=o);const A=Zt(Zt({},this.getFlagVariants()),{},{[e]:n});(i=this.Ad)===null||i===void 0||i.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(s)}),this.$t({[K8]:Object.keys(u0t(A)),[Z4]:A,[RQ]:Zt(Zt({},this.Zd("$stored_person_properties")||{}),s)}),this.Hd();try{var c;(c=this.bo)===null||c===void 0||c.capture("$feature_enrollment_update",a)}catch(l){this.A.error("Failed to capture early access feature enrollment",l)}}getEarlyAccessFeatures(e,n=!1,o){const i=this.Zd(uxe);!i||n?this.dv(e,o):e(i)}dv(e,n){var o=this;return $g(function*(){const i=o.bo;if(!i)return;const r=n?`&${n.map(a=>`stage=${a}`).join("&")}`:"";let s;try{const a=yield i.sendRequest(`/api/early_access_features/?token=${i.projectToken}${r}`,{target:"api",method:"GET",sentAt:"query"});if(!a.json)return;s=a.json.earlyAccessFeatures,o.$t({[uxe]:s})}catch(a){return void o.A.error("Early access feature request failed",a)}try{e(s)}catch(a){o.A.error("Early access feature callback failed",a)}})()}hv(){const e=this.getFlags(),n=this.getFlagVariants();return{flags:e.filter(o=>n[o]),flagVariants:Object.keys(n).filter(o=>n[o]).reduce((o,i)=>(o[i]=n[i],o),{})}}Hd(e){this.zd();const{flags:n,flagVariants:o}=this.hv();this.featureFlagEventHandlers.forEach(i=>{try{i(n,o,{errorsLoading:e})}catch(r){this.A.error("Error while running feature flags callback",r)}})}setPersonPropertiesForFlags(e,n=!0){this.vv(e,n)}vv(e,n=!0){const o=this.Zd("$stored_person_properties")||{},i=e?.$set||(e?.$set_once?{}:e),r=e?.$set_once,s={};if(r)for(const a in r)({}).hasOwnProperty.call(r,a)&&(a in o||(s[a]=r[a]));this.$t({[RQ]:Zt(Zt(Zt({},o),s),i)}),n&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,n=!0){const o=Zt({},this.Zd("$stored_person_properties")||{});e.forEach(i=>{delete o[i]}),this.$t({[RQ]:o}),n&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Pt(RQ),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,n=!0){const o=this.Zd("$stored_group_properties")||{},i=Zt({},o);for(const r of Object.keys(e))i[r]=Zt(Zt({},o[r]),e[r]);this.$t({[NQ]:i}),n&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const n=this.Zd("$stored_group_properties")||{};this.$t({[NQ]:Zt(Zt({},n),{},{[e]:{}})})}else this.Pt(NQ)}reset(){this.md++,this.Gd(this.vd,"cancelled"),this.Gd(this.fd,"cancelled"),this.bd=!1,this.ud={},this.hd={},this.Jd=void 0,this.pd=!1,this.yd=!1,this._d=!1,this.$anon_distinct_id=void 0,this.Qd(),this.ld=!1,this.kd=0}};const d0t=gd("[FeatureFlags]");var YPn=class{constructor(e,n=!1){this.fv=!1,this.update(e,n)}update(e,n){this.pv=((o,i)=>{var r,s,a,A,c,l,g,u;return{bootstrap:{featureFlags:(r=(s=o.bootstrap)===null||s===void 0?void 0:s.featureFlags)!==null&&r!==void 0?r:void 0,featureFlagPayloads:(a=(A=o.bootstrap)===null||A===void 0?void 0:A.featureFlagPayloads)!==null&&a!==void 0?a:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!o.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!o.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!o.advanced_feature_flags_dedup_per_session,cacheTtlMs:o.feature_flag_cache_ttl_ms,refreshIntervalMs:(c=o.remote_config_refresh_interval_ms)!==null&&c!==void 0?c:3e5,idleRefreshBackoff:Eo(o.remote_config_refresh_interval_ms),requestTimeoutMs:o.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(l=o.feature_flag_request_max_retries)!==null&&l!==void 0?l:1),compression:o.disable_compression?void 0:"best-available",evaluationContexts:(g=(u=o.evaluation_contexts)!==null&&u!==void 0?u:o.evaluation_environments)!==null&&g!==void 0?g:[],flagKeys:qr(o.flag_keys)?o.flag_keys:void 0}})(e,n),!e.evaluation_environments||e.evaluation_contexts||this.fv||(d0t.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.fv=!0),Eo(e.flag_keys)||qr(e.flag_keys)||d0t.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.pv}};const h0t=t=>Xk(t)&&(t.name==="RangeError"&&t.message.indexOf("Maximum call stack size exceeded")===0||t.name==="InternalError"&&t.message==="too much recursion"),oB=gd("[Error tracking]"),I3e="webkit-masked-url:",UPn=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],KPn=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",I3e],zPn=["__firefox__","__gCrWeb"],m0t="Refusing to render web experiment since the viewer is a likely bot",VPn={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>loe(e,t),not_regex:(t,e)=>!loe(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},R5=gd("[Conversations]"),lD="Conversations not available yet.";function p0t(t,e){var n,o,i,r,s,a,A;const c=(n=t?.flushIntervalMs)!==null&&n!==void 0?n:3e3,l=(o=t?.maxBufferSize)!==null&&o!==void 0?o:100,g=e?.consoleCapture?void 0:(i=t?.maxLogsPerInterval)!==null&&i!==void 0?i:1e3,u=Eo(g)?Math.max(l,2048):Math.max(l,g),h=Zt(Zt({},(function(){let d="",m="";try{const p=X_?.userAgent;p&&([d,m]=eAt(p))}catch{}return(function(p,_){const f=(function(I){if(I)return{}.hasOwnProperty.call(TAt,I)?TAt[I]:I})(p);return Zt(Zt({},f?{"os.name":f}:{}),_?{"os.version":_}:{})})(d,m)})()),t?.resourceAttributes);return{serviceName:(r=(s=h?.["service.name"])!==null&&s!==void 0?s:t?.serviceName)!==null&&r!==void 0?r:e?.serviceNameDefault,serviceVersion:(a=h?.["service.version"])!==null&&a!==void 0?a:t?.serviceVersion,environment:(A=h?.["deployment.environment"])!==null&&A!==void 0?A:t?.environment,resourceAttributes:h,beforeSend:t?.beforeSend,flushIntervalMs:c,maxBufferSize:l,maxQueueSize:u,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:g,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const JPn=["debug","log","warn","error","info"],WPn=t=>{for(;t?.__rrweb_original__;)t=t.__rrweb_original__;return t},_0t="console",f0t="__posthogHandledLogsRequestError",C3e=(t,e)=>{const n=t instanceof Error?t:new Error(e);return n[f0t]=!0,n},I0t=t=>!!t&&typeof t=="object"&&t[f0t]===!0,doe=gd("[NetworkMetrics]"),y3e=()=>{var t;return!(jn==null||(t=jn.performance)===null||t===void 0)&&t.now?jn.performance.now():Date.now()},jPn={"http:":80,"https:":443},qPn=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),C0t=(t,e)=>{var n;const o=String(e);return{method:String(t).toUpperCase(),url:((n=V8(o))===null||n===void 0?void 0:n.href)||o}},x3e=(t,e,n,o,i,r,s=!1)=>{try{var a,A;const c=i();if(!c)return;const l=n||void 0,g=y3e()-o,u=V8(e.url);if(u&&u.protocol!=="http:"&&u.protocol!=="https:")return;const h={url:u?.href||e.url,method:e.method},d=ap(c.name)?c.name(h):$a(c.name)?c.name:"http.client.request.duration";if(!d)return;const m=s&&!l?void 0:((_,f)=>_?400>_?void 0:String(_):f?.name||"_OTHER")(l,r),p=Zt(Zt(Zt(Zt(Zt({},(_=>{const f=qPn.has(_)?_:"_OTHER";return Zt({"http.request.method":f},f==="_OTHER"&&_!==f?{"http.request.method_original":_}:{})})(h.method)),u?(_=>{return{"server.address":_.hostname.startsWith("[")&&_.hostname.endsWith("]")?_.hostname.slice(1,-1):_.hostname,"server.port":Number(_.port)||jPn[_.protocol],"url.scheme":_.protocol.slice(0,-1),"url.template":(f=_.pathname,f.split("/").map(I=>(C=>/^\d+$/.test(C)||C.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(C))(I)?":id":I).join("/"))};var f})(u):{}),l?{"http.response.status_code":l}:{}),m?{"error.type":m}:{}),(a=c.attributes)===null||a===void 0?void 0:a.call(c,h,{status:l,durationMs:g}));(A=t.metrics)===null||A===void 0||A.histogram(d,g,{unit:"ms",attributes:p})}catch(c){doe.error("Failed to record network metric",c)}},y0t=()=>{},$Pn=(t,e)=>ap(jn?.fetch)?fF(jn,"fetch",n=>function(...o){const i=y3e(),r=n.apply(this,o);if(!e())return r;try{var s,a,A;const[c,l]=o,g=C0t((s=(a=l?.method)!==null&&a!==void 0?a:c?.method)!==null&&s!==void 0?s:"GET",(A=c?.url)!==null&&A!==void 0?A:c);return r.then(u=>(x3e(t,g,u?.status,i,e,void 0,!0),u),u=>{throw x3e(t,g,void 0,i,e,u),u})}catch(c){return doe.error("Failed to observe fetch",c),r}}):y0t,XPn=(t,e)=>{var n;const o=jn==null||(n=jn.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!o)return y0t;const i=new WeakMap,r=fF(o,"open",a=>function(...A){try{ylt.has(this)||i.set(this,C0t(A[0],A[1]))}catch(c){doe.error("Failed to observe XHR open",c)}return a.apply(this,A)}),s=fF(o,"send",a=>function(...A){let c;try{const l=i.get(this);if(l&&e()){const g=y3e();c=()=>{this.removeEventListener("loadend",c),x3e(t,l,this.status,g,e)},Wc(this,"loadend",c)}}catch(l){doe.error("Failed to observe XHR send",l)}try{return a.apply(this,A)}catch(l){throw c&&this.removeEventListener("loadend",c),l}});return()=>{r(),s()}},x0t=new WeakMap,ZPn={maxStringLength:2048,truncationSuffix:"..."};function E0t(t){if(t)return t===!0?{intent:!0,model:!0}:{intent:t.intent!==!1,model:t.model!==!1}}function HQ(t,e){return{}.hasOwnProperty.call(t,e)}function E3e(t,e){const n=Object.create(t);return e&&Object.defineProperty(n,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:e}),n}function B0t(t,e,n=!1){if(!$a(t))return;const o=t.trim();return o?(n?Rvn(o,ZPn):o).slice(0,e):void 0}function b0t(t){try{return Ea(t)&&t.isError===!0}catch{return!1}}const hoe={featureFlags:class extends GPn{constructor(t){const e=new YPn(t.config,t.il());super(e),this.name="featureFlags",this._instance=t,this.gv=e}get Ad(){return this._instance.persistence}updateConfig(t,e){this.gv.update(t,e),this.Fd()}}},eMn={sessionRecording:class{get Mr(){return this._instance.config}get Il(){return this._instance.persistence}get started(){var t;return!!(!((t=this.mv)===null||t===void 0)&&t.isStarted)}get status(){var t,e;return this.yv==="awaiting_config"||this.yv==="missing_config"?this.yv:(t=(e=this.mv)===null||e===void 0?void 0:e.status)!==null&&t!==void 0?t:this.yv}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.yv=m3e,this.bv=void 0,this._v=!1,this.Je=(()=>{var e,n;if(!qo?.visibilityState||qo.visibilityState==="visible")return!0;const o=jn==null||(e=jn.performance)===null||e===void 0||(n=e.getEntriesByType)===null||n===void 0?void 0:n.call(e,"visibility-state");return!o?.length||o.some(i=>i.name==="visible")})(),this.sn=()=>{var e,n;qo?.visibilityState==="visible"&&(this.Je=!0,(e=this.mv)===null||e===void 0||(n=e.setDocumentWasEverVisible)===null||n===void 0||n.call(e,!0))},!this._instance.sessionManager)throw j8.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Mr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');qo?.addEventListener&&Wc(qo,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this._v=!0,qo==null||(e=qo.removeEventListener)===null||e===void 0||e.call(qo,"visibilitychange",this.sn),t?this.wv(!0):this.stopRecording()}get Sv(){var t;const e=!!(!((t=this._instance.get_property("$session_recording_remote_config"))===null||t===void 0)&&t.enabled),n=!this.Mr.disable_session_recording,o=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return jn&&e&&n&&!o}startIfEnabledOrStop(t){var e;if(this._v||this.Sv&&(!((e=this.mv)===null||e===void 0)&&e.isStarted))return;const n=!Eo(Object.assign)&&!Eo(Array.from);this.Sv&&n?(this.xv(t),j8.info("starting")):(this.yv=m3e,this.stopRecording())}xv(t){var e,n;if(this.Sv)if(this.yv!=="awaiting_config"&&this.yv!=="missing_config"&&(this.yv=n0t),(Yr==null||(e=Yr.__PosthogExtensions__)===null||e===void 0||(e=e.rrweb)===null||e===void 0?void 0:e.record)&&((n=Yr.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording))this.$v(t);else{var o,i;const r=this._instance.sessionManager;(o=Yr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,this.Cv,s=>{if(!this._v&&this.Sv&&this._instance.sessionManager===r)return s?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),j8.error("could not load recorder",s)):void this.$v(t);this.yv="disabled"})}}stopRecording(){var t,e;(t=this.bv)===null||t===void 0||t.call(this),this.bv=void 0,(e=this.mv)===null||e===void 0||e.stop()}wv(t=!1){var e,n;(e=this.bv)===null||e===void 0||e.call(this),this.bv=void 0,(n=this.mv)===null||n===void 0||n.discard({discardProducerEvents:t})}Tv(){var t,e;(t=this.Il)===null||t===void 0||t.unregister("$session_is_sampled"),(e=this.Il)===null||e===void 0||e.unregister("$replay_sample_rate")}Iv(t,e){if(Fs(t))return null;const n=eh(t)?t:parseFloat(t);return typeof(o=n)!="number"||!Number.isFinite(o)||0>o||o>1?(j8.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):n;var o}Mv(t){if(this.Il){var e,n;const o=this.Il,i=()=>{var r;const s=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.Iv((r=this.Mr.session_recording)===null||r===void 0?void 0:r.sampleRate,"session_recording.sampleRate"),A=this.Iv(s?.sampleRate,"remote config sampleRate"),c=a??A;Fs(c)&&this.Tv();const l=s?.minimumDurationMilliseconds;o.register({[Hz]:Zt(Zt({cache_timestamp:Date.now(),enabled:!!s},s),{},{networkPayloadCapture:Zt({capturePerformance:t.capturePerformance},s?.networkPayloadCapture),canvasRecording:{enabled:s?.recordCanvas,fps:s?.canvasFps,quality:s?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:Eo(l)?null:l,endpoint:s?.endpoint,triggerMatchType:s?.triggerMatchType,masking:s?.masking,urlTriggers:s?.urlTriggers,version:s?.version,triggerGroups:s?.triggerGroups})})};i(),(e=this.bv)===null||e===void 0||e.call(this),this.bv=(n=this._instance.sessionManager)===null||n===void 0?void 0:n.onSessionId(i)}}onRemoteConfig(t){const e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.Mv(e),void this.wv()):(this.Mv(e),void this.startIfEnabledOrStop()):(this.yv==="awaiting_config"&&(this.yv="missing_config",this._instance.register_for_session({[Qxe]:!0}),j8.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var n;!((n=this.mv)===null||n===void 0)&&n.log?this.mv.log(t,e):j8.warn("log called before recorder was ready")}get Cv(){var t,e;const n=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.get_property(Hz);return(n==null||(e=n.scriptConfig)===null||e===void 0?void 0:e.script)||"lazy-recorder"}Ev(){const t=this._instance.get_property(Hz);if(!t)return!1;let e;try{e=typeof t=="object"?t:JSON.parse(t)}catch(n){return j8.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!Fs(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}$v(t){var e,n,o;if(!this._v&&this.Sv&&this._instance.sessionManager){if(!(!((e=Yr.__PosthogExtensions__)===null||e===void 0)&&e.initSessionRecording))return j8.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Sxe]:!0});var i;if(this.mv||(this.mv=(i=Yr.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording(this._instance,this.Je),this.mv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ev())return this.yv==="missing_config"||this.yv==="awaiting_config"?void 0:(this.yv="awaiting_config",j8.info("persisted remote config is stale, requesting fresh config before starting"),void new glt(this._instance).load());this.yv=n0t,(n=(o=this.mv).setDocumentWasEverVisible)===null||n===void 0||n.call(o,this.Je),this.mv.start(t)}else this.yv=m3e}onRRwebEmit(t){var e,n;(e=this.mv)===null||e===void 0||(n=e.onRRwebEmit)===null||n===void 0||n.call(e,t)}overrideLinkedFlag(){var t,e;this.mv||(e=this.Il)===null||e===void 0||e.register({$replay_override_linked_flag:!0}),(t=this.mv)===null||t===void 0||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.mv||(e=this.Il)===null||e===void 0||e.register({$replay_override_sampling:!0}),(t=this.mv)===null||t===void 0||t.overrideSampling()}overrideTrigger(t){var e,n;this.mv||(n=this.Il)===null||n===void 0||n.register({[t==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.mv)===null||e===void 0||e.overrideTrigger(t)}get sdkDebugProperties(){var t;const e={};for(const o of PPn){var n;const i=(n=this._instance.sessionPersistence)===null||n===void 0?void 0:n.get_property(o);Eo(i)||(e[o]=i)}return Zt(Zt({},e),((t=this.mv)===null||t===void 0?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,e){var n;return!!(!((n=this.mv)===null||n===void 0)&&n.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;(t=this.mv)===null||t===void 0||(e=t.flushBeforeIdentityReset)===null||e===void 0||e.call(t)}}},tMn={autocapture:class extends bPn{constructor(t){super(new SPn(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.Pv=!1,this._instance=t,this.Rv=this.Av()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.Fv();return!!(t.path||t.search||this.Ov(t))}startIfEnabled(){this.isEnabled&&(li.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Rv=this.Av(),this.startIfEnabled()}stop(){this.Dv&&this.Dv(),this.Dv=void 0,this.Lv&&this.Lv(),this.Lv=void 0,li.info("History API monitoring stopped")}monitorHistoryChanges(){jn&&jn.history&&(this.Nv("pushState"),this.Nv("replaceState"),this.qv(),this.Ov()&&this.jv())}Nv(t){var e;if(!jn||!((e=jn.history[t])===null||e===void 0)&&e.__posthog_wrapped__)return;const n=this;fF(jn.history,t,o=>function(i,r,s){var a;n.Bv(s)&&n.zv(),o.call(this,i,r,s),n.Hv(t,!n.Pv&&(jn==null||(a=jn.event)===null||a===void 0?void 0:a.type)!=="popstate")})}Av(){const t=jn?.location;if(t?.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}Fv(){const t=this._instance.config.capture_pageview;return t==="history_change"?{path:!0}:Ea(t)?t:{}}Ov(t=this.Fv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Uv(t){const e=this.Fv(),n=this.Rv;return!(!n||!(e.path&&t.pathname!==n.pathname||e.search&&t.search!==n.search||this.Ov(e)&&t.hash!==n.hash))}Hv(t,e=!1){try{e||this.zv();const n=this.Av();if(!n)return;if(this.Uv(n)){const o=()=>this._instance.capture(wxe,{navigation_type:t});e?(this.Wv=o,Promise.resolve().then(()=>this.zv())):o()}this.Rv=n}catch(n){li.error(`Error capturing ${t} pageview`,n)}}Bv(t){var e,n;return!(Fs(t)||!jn)&&((e=V8(String(t)))===null||e===void 0?void 0:e.href)!==((n=jn.location)===null||n===void 0?void 0:n.href)}zv(){const t=this.Wv;if(t){this.Wv=void 0,this.Pv=!0;try{t()}catch(e){li.error("Error capturing deferred pageview",e)}finally{this.Pv=!1}this.Rv=this.Av()}}qv(){if(this.Dv)return;const t=()=>{this.Hv("popstate")};Wc(jn,"popstate",t),this.Dv=()=>{jn&&jn.removeEventListener("popstate",t)}}jv(){if(this.Lv)return;const t=()=>{this.Hv("hashchange")};Wc(jn,"hashchange",t),this.Lv=()=>{jn&&jn.removeEventListener("hashchange",t)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(t){var e;this.Vv=!1,this.ko=!1,this.Gv=null,this.instance=t,this.Vv=!!(!((e=this.instance.persistence)===null||e===void 0)&&e.props[pxe]),this.rageclicks=new $lt(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return Ea(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Mr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Fs(this.Mr.capture_heatmaps)?Fs(this.Mr.enable_heatmaps)?this.Vv:this.Mr.enable_heatmaps:this.Mr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ko)return;MPn.info("starting..."),this.Qv(),this.sn()}else{var t;clearInterval((t=this.Gv)!==null&&t!==void 0?t:void 0),this.Zv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("heatmaps"in e))return;const n=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[pxe]:n}),this.Vv=n,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Jv(t){p3e(t.originalEvent)&&this.Ir(t.originalEvent,"deadclick")}sn(){this.Gv&&clearInterval(this.Gv),this.Gv=qo?.visibilityState==="visible"?setInterval(this.fl.bind(this),this.flushIntervalMilliseconds):null}Qv(){jn&&qo&&(this.Kv=this.fl.bind(this),Wc(jn,Xne,this.Kv),this.Xv=t=>this.Ir(t||jn?.event),Wc(qo,"click",this.Xv,{capture:!0}),this.Yv=t=>this.tf(t||jn?.event),Wc(qo,"mousemove",this.Yv,{capture:!0}),this.ef=new Kct(this.instance,Mwn,this.Jv.bind(this)),this.ef.startIfEnabledOrStop(),this.if=this.sn.bind(this),Wc(qo,Fz,this.if),this.ko=!0)}Zv(){var t;jn&&qo&&(this.Kv&&jn.removeEventListener(Xne,this.Kv),this.Xv&&qo.removeEventListener("click",this.Xv,{capture:!0}),this.Yv&&qo.removeEventListener("mousemove",this.Yv,{capture:!0}),this.if&&qo.removeEventListener(Fz,this.if),clearTimeout(this.nf),(t=this.ef)===null||t===void 0||t.stop(),this.ko=!1)}sf(t,e){const n=this.instance.scrollManager.scrollY(),o=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),r=(function(s,a,A){let c=s;for(;c&&nB(c)&&!gI(c,"body");){if(c===A)return!1;let h;try{var l,g,u;h=(l=(g=(u=c.ownerDocument)===null||u===void 0?void 0:u.defaultView)!==null&&g!==void 0?g:jn)===null||l===void 0?void 0:l.getComputedStyle(c).position}catch{return!1}if(jr(a,h))return!0;c=Pct(c)}return!1})(Kz(t),["fixed","sticky"],i);return{x:t.clientX+(r?0:o),y:t.clientY+(r?0:n),target_fixed:r,type:e}}Ir(t,e="click"){var n;if(Sct(t.target)||!p3e(t))return;const o=this.sf(t,e);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&Tct(Kz(t),this.instance.config.rageclick)&&this.Qs(Zt(Zt({},o),{},{type:"rageclick"})),this.Qs(o)}tf(t){!Sct(t.target)&&p3e(t)&&(clearTimeout(this.nf),this.nf=setTimeout(()=>{this.Qs(this.sf(t,"mousemove"))},500))}Qs(t){if(!jn)return;const e=this.Mr.disable_capture_url_hashes?MQ(jn.location.href):jn.location.href,n=this.Mr.custom_personal_data_properties,o=this.Mr.mask_personal_data_properties?[...uF,...n||[]]:[],i=Jz(e,o,Wz);this.Rt=this.Rt||{},this.Rt[i]||(this.Rt[i]=[]),this.Rt[i].push(t)}fl(){this.Rt&&!px(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Kct,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.Vv=!1,this.ko=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.rf=()=>{clearTimeout(this.af),this.af=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",Zt({$current_url:this.Rt.url},this.Rt.metrics.reduce((n,o)=>Zt(Zt({},n),{},{[`$web_vitals_${o.name}_event`]:Zt({},o),[`$web_vitals_${o.name}_value`]:o.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.lf=n=>{var o;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Fs(n?.name)||Fs(n?.value))return void AD.error("Invalid metric received",n);const i=typeof n.navigationURL=="string"?n.navigationURL:void 0,r=this.uf(i);if(Eo(r))return;const s=eh(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${r}`;if(this.cf&&n.value>=this.cf)return void AD.error("Ignoring metric with value >= "+this.cf,n);this.Rt.navigationKey!==s&&(this.rf(),this.af=setTimeout(this.rf,this.flushToCaptureTimeoutMs)),Eo(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=r),this.Rt.firstMetricTimestamp=Eo(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(o=this._instance.sessionManager)===null||o===void 0?void 0:o.checkAndGetSessionAndWindowId(!0),A=Zt(Zt(Zt({},n),i?{navigationURL:r}:{}),{},{$current_url:r,timestamp:Date.now()});if(delete A.entries,Ea(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){const c={};for(const l of wPn){const g=l==="url"&&typeof n.attribution[l]=="string"?this.uf(n.attribution[l]):n.attribution[l];Eo(g)||(c[l]=g)}A.attribution=c}else delete A.attribution;Eo(a)||(A.$session_id=a.sessionId,A.$window_id=a.windowId),this.Rt.metrics.push(A),this.Rt.metrics.length===this.allowedMetrics.length&&this.rf()},this.hf=()=>{if(this.ko)return;let n,o,i,r,s=!1;const a=Yr.__PosthogExtensions__,A=a?.postHogWebVitalsCallbacksByFlavor,c=A?.[this.df]||(this.df==="web-vitals"&&Eo(A)?a?.postHogWebVitalsCallbacks:void 0);if(!Eo(c)){const u=c.withoutAttribution,h=this.attributionMetrics;s=!Eo(u),n=h.indexOf("LCP")>-1?c.onLCP:u?.onLCP||c.onLCP,o=h.indexOf("CLS")>-1?c.onCLS:u?.onCLS||c.onCLS,i=h.indexOf("FCP")>-1?c.onFCP:u?.onFCP||c.onFCP,r=h.indexOf("INP")>-1?c.onINP:u?.onINP||c.onINP}if(!(n&&o&&i&&r))return void AD.error("web vitals callbacks not loaded - not starting");const l={reportSoftNavs:this.useSoftNavs},g=s&&this.attributionMetrics.indexOf("INP")>-1?Zt(Zt({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&n(this.lf.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&o(this.lf.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.lf.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&r(this.lf.bind(this),g),this.ko=!0},this.Vv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[Ixe]),this.startIfEnabled()}get vf(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const n=Ea(this.vf)?(t=this.vf)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return Fs(n)?((e=this._instance.persistence)===null||e===void 0?void 0:e.props.$web_vitals_allowed_metrics)||t0t:n}get flushToCaptureTimeoutMs(){return(Ea(this.vf)?this.vf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=Ea(this.vf)?this.vf.web_vitals_attribution:void 0;return My(t)?t?t0t:[]:qr(t)?t:vPn}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=Ea(this.vf)?this.vf.__preview_web_vitals_soft_navs:void 0;return t!=null&&t}get cf(){const t=Ea(this.vf)&&eh(this.vf.__web_vitals_max_value)?this.vf.__web_vitals_max_value:e0t;return t>0&&6e4>=t?e0t:t}get isEnabled(){const t=qg?.protocol;if(t!=="http:"&&t!=="https:")return AD.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=Ea(this.vf)?this.vf.web_vitals:My(this.vf)?this.vf:void 0;return My(e)?e:this.Vv}startIfEnabled(){this.isEnabled&&!this.ko&&(AD.info("enabled, starting..."),this.zo(this.hf))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const n=Ea(e.capturePerformance)&&!!e.capturePerformance.web_vitals,o=Ea(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ixe]:n}),this._instance.persistence.register({[$At]:o})),this.Vv=n,this.startIfEnabled()}get df(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(t){var e;const n=Yr.__PosthogExtensions__,o=this.df,i=n?.postHogWebVitalsCallbacksByFlavor;i?.[o]||o==="web-vitals"&&Eo(i)&&n?.postHogWebVitalsCallbacks?t():n==null||(e=n.loadExternalDependency)===null||e===void 0||e.call(n,this._instance,o,r=>{r?AD.error("failed to load script",r):t()})}uf(t){const e=t||jn?.location.href;if(!e)return void AD.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?MQ(e):e,o=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...uF,...o||[]]:[];return Jz(n,i,Wz)}}},nMn={exceptionObserver:class{constructor(t){var e;this.hf=()=>{var n;if(!jn||!this.isEnabled||!(!((n=Yr.__PosthogExtensions__)===null||n===void 0)&&n.errorWrappingFunctions))return;const o=Yr.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Yr.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=Yr.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ff&&this.Mr.capture_unhandled_errors&&(this.ff=o(this.captureException.bind(this))),!this.pf&&this.Mr.capture_unhandled_rejections&&(this.pf=i(this.captureException.bind(this))),!this.gf&&this.Mr.capture_console_errors&&(this.gf=r(this.captureException.bind(this)))}catch(s){iV.error("failed to start",s),this.mf()}},this._instance=t,this.yf=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[_xe]),this.wt=new EQn(Zt(Zt({},(function(n={}){var o,i,r,s;return{refillRate:(o=(i=n.exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:n.__exceptionRateLimiterRefillRate)!==null&&o!==void 0?o:1,bucketSize:(r=(s=n.exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:n.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,A:iV})),this.Mr=this.bf(),this.startIfEnabledOrStop()}bf(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Ea(t)?e=Zt(Zt({},e),t):(Eo(t)?this.yf:t)&&(e=Zt(Zt({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(iV.info("enabled"),this.mf(),this.zo(this.hf)):this.mf()}zo(t){var e,n,o;!((e=Yr.__PosthogExtensions__)===null||e===void 0)&&e.errorWrappingFunctions?t():(n=Yr.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"exception-autocapture",i=>{if(i)return iV.error("failed to load script",i);t()})}mf(){var t,e,n;(t=this.ff)===null||t===void 0||t.call(this),this.ff=void 0,(e=this.pf)===null||e===void 0||e.call(this),this.pf=void 0,(n=this.gf)===null||n===void 0||n.call(this),this.gf=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.yf=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[_xe]:this.yf}),this.Mr=this.bf(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.bf()}captureException(t){try{var e,n,o;const i=(e=t==null||(n=t.$exception_list)===null||n===void 0||(n=n[0])===null||n===void 0?void 0:n.type)!==null&&e!==void 0?e:"Exception";if(this.wt.consumeRateLimit(i))return void iV.info("Skipping exception capture because of client rate limiting.",{exception:i});(o=this._instance.exceptions)===null||o===void 0||o.sendExceptionEvent(t)}catch{}}},exceptions:class{constructor(t){var e,n;this._f=[],this.wf=new TQn([new qQn,new rvn,new XQn,new $Qn,new ovn,new nvn,new evn,new ivn],(function(o,...i){return(r,s=0)=>{const a=[],A=r.split(`
241
241
  `),c=Math.min(A.length,s+1e3),l=[];for(let h=s;c>h;h++){const d=A[h];if(d.length>1024)continue;const m=hAt.test(d)?d.replace(hAt,"$1"):d;if(!m.match(/\S*Error: /)){for(const p of i){const _=p(m,o);if(_){a.push(_);const f=VQn(a);if(f){for(let I=l.length-1;I>=0;I--){const C=l[I];if(f.start>=C.start+C.length)break;l.pop()}l.push(f)}break}}if(WQn(a,l)>=50)break}}const g=[...l].sort((h,d)=>d.start-h.start),u=g[g.length-1];if(u){const h=mAt(a,u);a.splice(u.start-h,h);for(const d of g)d.start-=h}for(const h of g)JQn(a,h);return l.some(h=>h.start===0&&a.length===h.length)&&(function(h){const d=h.map(p=>`${p.function}|${p.filename}|${p.lineno}|${p.colno}|${p.module}`);let m=0;for(let p=1;d.length>p;p++)jQn(d,p,m)&&(m=p);h.push(...h.splice(0,m))})(a),(function(h){if(!h.length)return[];const d=Array.from(h);return d.reverse(),d.slice(0,50).map(m=>{return Zt(Zt({},m),{},{filename:m.filename||(p=d,p[p.length-1]||{}).filename,function:m.function||"?"});var p})})(a)}})("web:javascript",YQn,zQn)),this._instance=t,this._f=(e=(n=this._instance.persistence)===null||n===void 0?void 0:n.get_property("$error_tracking_suppression_rules"))!==null&&e!==void 0?e:[],this.kf=Kne(this.Sf()),this.xf=new avn(this.kf)}onConfigChange(){this.kf=Kne(this.Sf()),this.xf.setConfig(this.kf)}onRemoteConfig(t){var e,n,o;if(!t.ok)return;const i=t.config;if(!("errorTracking"in i))return;const r=(e=(n=i.errorTracking)===null||n===void 0?void 0:n.suppressionRules)!==null&&e!==void 0?e:[],s=(o=i.errorTracking)===null||o===void 0?void 0:o.captureExtensionExceptions;this._f=r,this._instance.persistence&&this._instance.persistence.register({[jAt]:this._f,[fxe]:s})}get $f(){var t;const e=!!this._instance.get_property(fxe),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.wf.buildFromUnknown(t,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(t,e){if(this.kf.enabled)try{if(!$a(t)||t.trim().length===0)return void oB.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:n,droppedKeys:o}=(function(i){if(!i)return{sanitizedProperties:{},droppedKeys:[]};const r=[];return{sanitizedProperties:Object.keys(i).reduce((s,a)=>svn.has(a)?(r.push(a),s):(s[a]=i[a],s),{}),droppedKeys:r}})(this.Cf(e));o.length>0&&oB.warn("Ignoring reserved exception step fields",{droppedKeys:o}),this.xf.add(Zt({[Yne]:t,[Une]:new Date().toISOString()},n))}catch(n){oB.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.Tf(e)){if(this.If(e))return this.Mf("Exception dropped: matched a suppression rule"),void oB.info("Skipping exception capture because a suppression rule matched");if(!this.$f&&this.Ef(e))return this.Mf("Exception dropped: thrown by a browser extension"),void oB.info("Skipping exception capture because it was thrown by an extension");if(!this.$f&&this.Pf(e))return this.Mf("Exception dropped: thrown by an injected browser script"),void oB.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Rf(e))return this.Mf("Exception dropped: thrown by the PostHog SDK"),void oB.info("Skipping exception capture because it was thrown by the PostHog SDK")}const n=this.kf.enabled&&Fs(t.$exception_steps)?this.Af(t):t,o=(function(){const i=globalThis._posthogReleaseId;return typeof i=="string"&&i.length>0?i:void 0})();o&&(n.$release_id=o);try{const i=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",fc:!0});return i&&this.xf.clear(),i}catch(i){return h0t(i)||oB.error("Failed to capture exception event. Dropping this exception.",i),void this.xf.clear()}}catch(e){return void(h0t(e)||oB.error("Failed to process exception event. Ignoring this exception.",e))}}Af(t){try{const e=this.xf.getAttachable();return e.length===0?t:Zt(Zt({},t),{},{$exception_steps:e})}catch(e){return oB.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Mf(t){this.kf.enabled&&this.xf.add({[Yne]:t,[Une]:new Date().toISOString()})}Cf(t){return Ea(t)?Zt({},t):{}}Sf(){var t,e;return(t=(e=this._instance.config.error_tracking)===null||e===void 0?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}If(t){if(t.length===0)return!1;try{const e=t.reduce((n,{type:o,value:i})=>($a(o)&&o.length>0&&n.$exception_types.push(o),$a(i)&&i.length>0&&n.$exception_values.push(i),n),{$exception_types:[],$exception_values:[]});return this._f.some(n=>{const o=n.values.map(i=>{const r=Hlt[i.operator],s=e[i.key];if(!r||!s)return!1;const a=qr(i.value)?i.value:[i.value];return a.length>0&&r(a,s)});return n.type==="OR"?o.some(Boolean):o.every(Boolean)})}catch(e){return oB.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}Ef(t){const e=t.flatMap(o=>{var i,r;return(i=(r=o.stacktrace)===null||r===void 0?void 0:r.frames)!==null&&i!==void 0?i:[]}),n=e.filter(({filename:o})=>!!o&&KPn.some(i=>o.startsWith(i)));return n.length!==0&&(!n.every(({filename:o})=>!!o&&o.startsWith(I3e))||t.some(({type:o,value:i})=>o==="NoResponse"||$a(i)&&UPn.some(({value:r,exact:s})=>s?i===r:i.includes(r)))&&!e.some(({in_app:o,filename:i})=>o&&!i?.startsWith(I3e)))}Pf(t){return t.some(({value:e})=>$a(e)&&zPn.some(n=>e.includes(n)))}Rf(t){if(t.length>0){var e,n,o,i;const r=(e=(n=t[0].stacktrace)===null||n===void 0?void 0:n.frames)!==null&&e!==void 0?e:[],s=r[r.length-1];return(o=s==null||(i=s.filename)===null||i===void 0?void 0:i.includes("posthog.com/static"))!==null&&o!==void 0&&o}return!1}Tf(t){return!Fs(t)&&qr(t)}}},oMn=Zt({productTours:class{get Il(){return this._instance.persistence}constructor(t){this.Ff=null,this.Of=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if("productTours"in e){var n,o;if(this.Il&&this.Il.register({[yxe]:!!e.productTours}),!_3e(this._instance))return!this.Ff&&Fs((n=this.Il)===null||n===void 0?void 0:n.props.ph_product_tours)||uoe.info("product tours disabled; stopping and clearing cached tours"),(o=this.Ff)===null||o===void 0||o.stop(),this.Ff=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Ff&&_3e(this._instance)&&this.zo(()=>this.Df())}zo(t){var e,n,o;!((e=Yr.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours?t():(n=Yr.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"product-tours",i=>{i?uoe.error("Could not load product tours script",i):t()})}Df(){var t;!this.Ff&&(!((t=Yr.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours)&&(this.Ff=Yr.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(qr(this.Of)&&!e)return void t(this.Of,{isLoaded:!0});const n=this.Il;if(n){const o=n.props[xxe];if(qr(o)&&!e)return this.Of=o,void t(o,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:o=>{if(!_3e(this._instance))return void t([],{isLoaded:!0});const i=o.statusCode;if(i!==200||!o.json){const s=`Product Tours API could not be loaded, status: ${i}`;return i===0?o.error||uoe.warn(s):uoe.error(s),void t([],{isLoaded:!1,error:s})}const r=qr(o.json.product_tours)?o.json.product_tours:[];this.Of=r,n&&n.register({[xxe]:r}),t(r,{isLoaded:!0})}})}getActiveProductTours(t){Fs(this.Ff)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ff.getActiveProductTours(t)}showProductTour(t){var e;(e=this.Ff)===null||e===void 0||e.showTourById(t)}previewTour(t){this.Ff?this.Ff.previewTour(t):this.zo(()=>{var e;this.Df(),(e=this.Ff)===null||e===void 0||e.previewTour(t)})}dismissProductTour(){var t;(t=this.Ff)===null||t===void 0||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.Ff)===null||t===void 0||t.nextStep()}previousStep(){var t;(t=this.Ff)===null||t===void 0||t.previousStep()}clearCache(){var t;this.Of=null,(t=this.Il)===null||t===void 0||t.unregister("ph_product_tours")}resetTour(t){var e;(e=this.Ff)===null||e===void 0||e.resetTour(t)}resetAllTours(){var t;(t=this.Ff)===null||t===void 0||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.Ff)===null||e===void 0||e.cancelPendingTour(t)}}},hoe),iMn={siteApps:class{constructor(t){this._instance=t,this.Lf=0,this.Nf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}qf(t,e){if(!e)return;const n=this.globalsForEvent(e);this.Nf.push(n),this.Nf.length>1e3&&(this.Nf=this.Nf.slice(10))}get siteAppLoaders(){var t;return(t=Yr._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(t=t[this._instance.config.token])===null||t===void 0?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.qf.bind(this));this.jf=()=>{t(),this.Nf=[],this.jf=void 0}}}globalsForEvent(t){var e,n,o,i,r,s,a;if(!t)throw new Error("Event payload is required");const A={},c=this._instance.get_property("$groups")||[],l=this._instance.get_property("$stored_group_properties")||{};for(const[h,d]of Object.entries(l))A[h]={id:c[h],type:h,properties:d};const{$set_once:g,$set:u}=t;return{event:Zt(Zt({},bAt(t,DPn)),{},{properties:Zt(Zt(Zt({},t.properties),u?{$set:Zt(Zt({},(e=(n=t.properties)===null||n===void 0?void 0:n.$set)!==null&&e!==void 0?e:{}),u)}:{}),g?{$set_once:Zt(Zt({},(o=(i=t.properties)===null||i===void 0?void 0:i.$set_once)!==null&&o!==void 0?o:{}),g)}:{}),elements_chain:(r=(s=t.properties)===null||s===void 0?void 0:s.$elements_chain)!==null&&r!==void 0?r:"",distinct_id:(a=t.properties)===null||a===void 0?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:A}}Bf(t){var e;const n=(e=t.tagName)===null||e===void 0?void 0:e.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(J9.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(J9.error("prepare_external_dependency_script returned null"),null):t}zf(){var t,e,n,o,i,r,s,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const A=qo?.defaultView,c=A==null||(t=A.Node)===null||t===void 0?void 0:t.prototype;if(!A||!c)return()=>{};if(this.Lf++,this.Hf)return this.Uf();const l=[],g=this,u=new WeakSet,h=(p,_,f)=>{if(!p?.[_])return;const I=p[_];p[_]=f(I),l.push(()=>{p[_]=I})},d=p=>{if(u.has(p))return p;const _=g.Bf(p);return _&&u.add(_),_},m=p=>p.map(_=>typeof _=="string"?_:d(_)).filter(_=>!ld(_));return h(c,"appendChild",p=>function(_){const f=d(_);return f?p.call(this,f):_}),h(c,"insertBefore",p=>function(_,f){const I=d(_);return I?p.call(this,I,f):_}),h(c,"replaceChild",p=>function(_,f){const I=d(_);return I?p.call(this,I,f):f}),[(e=A.Element)===null||e===void 0?void 0:e.prototype,(n=A.Document)===null||n===void 0?void 0:n.prototype,(o=A.DocumentFragment)===null||o===void 0?void 0:o.prototype].forEach(p=>{h(p,"append",_=>function(...f){return _.apply(this,m(f))}),h(p,"prepend",_=>function(...f){return _.apply(this,m(f))})}),[(i=A.Element)===null||i===void 0?void 0:i.prototype,(r=A.CharacterData)===null||r===void 0?void 0:r.prototype,(s=A.DocumentType)===null||s===void 0?void 0:s.prototype].forEach(p=>{h(p,"before",_=>function(...f){return _.apply(this,m(f))}),h(p,"after",_=>function(...f){return _.apply(this,m(f))}),h(p,"replaceWith",_=>function(...f){const I=m(f);return f.length&&!I.length?void 0:_.apply(this,I)})}),h((a=A.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",p=>function(_,f){const I=d(f);return I?p.call(this,_,I):null}),this.Hf=()=>{l.forEach(p=>p()),this.Hf=void 0},this.Uf()}Uf(){let t=!1;return()=>{var e;t||(t=!0,this.Lf--,this.Lf===0&&((e=this.Hf)===null||e===void 0||e.call(this)))}}Wf(t,e=!0){const n=this.zf();try{const o=t(n);return e&&n(),o}catch(o){throw n(),o}}setupSiteApp(t){const e=this.apps[t.id],n=()=>{var r;!e.errored&&this.Nf.length&&(J9.info(`Processing ${this.Nf.length} events for site app with id ${t.id}`),this.Nf.forEach(s=>this.Wf(()=>{var a;return(a=e.processEvent)===null||a===void 0?void 0:a.call(e,s)})),e.processedBuffer=!0),Object.values(this.apps).every(s=>s.processedBuffer||s.errored)&&((r=this.jf)===null||r===void 0||r.call(this))};let o=!1;const i=r=>{e.errored=!r,e.loaded=!0,J9.info(`Site app with id ${t.id} ${r?"loaded":"errored"}`),o&&n()};try{const{processEvent:r}=this.Wf(s=>t.init({posthog:this._instance,callback(a){s(),i(a)}}),!1);r&&(e.processEvent=r),o=!0}catch(r){J9.error(o0t+t.id,r),i(!1)}if(o&&e.loaded)try{n()}catch(r){J9.error(`Error while processing buffered events PostHog app with config id ${t.id}`,r),e.errored=!0}}Vf(){const t=this.siteAppLoaders||[];for(const e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(const e of t)this.setupSiteApp(e)}Gf(t){if(Object.keys(this.apps).length===0)return;const e=this.globalsForEvent(t);for(const n of Object.values(this.apps))try{this.Wf(()=>{var o;return(o=n.processEvent)===null||o===void 0?void 0:o.call(n,e)})}catch(o){J9.error(`Error while processing event ${t.event} for site app ${n.id}`,o)}}onRemoteConfig(t){var e,n,o;if(!((e=this.siteAppLoaders)===null||e===void 0)&&e.length)return this.isEnabled?(this.Vf(),void this._instance.on("eventCaptured",a=>this.Gf(a))):void J9.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.jf)===null||n===void 0||n.call(this),!t.ok)return;const i=t.config;if(!((o=i.siteApps)===null||o===void 0)&&o.length)if(this.isEnabled)for(const{id:a,url:A}of i.siteApps){var r,s;Yr[`__$$ph_site_app_${a}`]=this._instance,(r=Yr.__PosthogExtensions__)===null||r===void 0||(s=r.loadSiteApp)===null||s===void 0||s.call(r,this._instance,A,c=>{if(c)return J9.error(o0t+a,c)})}else J9.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},rMn={tracingHeaders:class{constructor(t){this._instance=t,this.Qf=void 0,this.Zf=void 0,this.Jf=void 0,this.hf=()=>{const e=this.Kf();var n,o;e?(Eo(this.Qf)&&(this.Qf=(n=Yr.__PosthogExtensions__)===null||n===void 0||(n=n.tracingHeadersPatchFns)===null||n===void 0?void 0:n._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Eo(this.Zf)&&(this.Zf=(o=Yr.__PosthogExtensions__)===null||o===void 0||(o=o.tracingHeadersPatchFns)===null||o===void 0?void 0:o._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.mf()}}initialize(){this.startIfEnabledOrStop()}zo(t){var e,n,o;!((e=Yr.__PosthogExtensions__)===null||e===void 0)&&e.tracingHeadersPatchFns?t():(n=Yr.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"tracing-headers",i=>{if(i)return QPn.error("failed to load script",i);t()})}Xf(){var t,e;return(t=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&t!==void 0?t:this._instance.config.__add_tracing_headers}Kf(){const t=this.Xf();return qr(t)?(qr(this.Jf)?this.Jf.splice(0,this.Jf.length,...t):this.Jf=[...t],t.length>0?this.Jf:void 0):(qr(this.Jf)&&this.Jf.splice(0),this.Jf=t||void 0,this.Jf)}mf(){var t,e;(t=this.Qf)===null||t===void 0||t.call(this),(e=this.Zf)===null||e===void 0||e.call(this),this.Qf=void 0,this.Zf=void 0}startIfEnabledOrStop(){this.Kf()?this.zo(this.hf):this.mf()}}},sMn=Zt({surveys:class extends NPn{constructor(t){var e;super(new LPn(t),(e=t,{get projectToken(){return e.config.token},kv:new FPn(e)})),this._instance=t}Gc(t,e){const n=e.query?Zz(t,e.query):t;return new Promise(o=>{var i;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor((i=e.target)!==null&&i!==void 0?i:"api",n),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:o})})}}},hoe),aMn={toolbar:class{constructor(t){this.instance=t}Yf(t){Yr.ph_toolbar_state=t}tp(){var t;return(t=Yr.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,e=void 0,n=void 0){var o,i;if(Mxe(this.instance.config)||!jn||!qo)return!1;t=(o=t)!==null&&o!==void 0?o:jn.location,n=(i=n)!==null&&i!==void 0?i:jn.history;try{if(!e){try{jn.localStorage.setItem("test","test"),jn.localStorage.removeItem("test")}catch{return!1}e=jn?.localStorage}const r=HPn||noe(t.hash,"__posthog")||noe(t.hash,"state");let s;const a=r?aAt(()=>JSON.parse(atob(decodeURIComponent(r))))||aAt(()=>JSON.parse(decodeURIComponent(r))):null;return a&&a.action==="ph_authorize"?(s=a,s.source="url",s&&Object.keys(s).length>0&&(a.desiredHash?t.hash=a.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):(s=JSON.parse(e.getItem(s0t)||"{}"),s.source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}ep(t){const e=Yr.ph_load_toolbar||Yr.ph_load_editor;!Fs(e)&&ap(e)?e(t,this.instance):a0t.warn("No toolbar load function found")}loadToolbar(t){const e=!!qo?.getElementById("__POSTHOG_TOOLBAR__");if(!jn||e)return!1;const n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,o=Zt(Zt({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(jn.localStorage.setItem(s0t,JSON.stringify(Zt(Zt({},o),{},{source:void 0}))),this.tp()===2)this.ep(o);else if(this.tp()===0){var i,r;this.Yf(1),(i=Yr.__PosthogExtensions__)===null||i===void 0||(r=i.loadExternalDependency)===null||r===void 0||r.call(i,this.instance,"toolbar",s=>{if(s)return a0t.error("[Toolbar] Failed to load",s),void this.Yf(0);this.Yf(2),this.ep(o)}),Wc(jn,"turbolinks:load",()=>{this.Yf(0),this.loadToolbar(o)})}return!0}np(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,n=void 0){return this.maybeLoadToolbar(t,e,n)}}},AMn=Zt({experiments:class hx{get Mr(){return this._instance.config}constructor(e){this._instance=e,this.getWebExperimentsAndEvaluateDisplayLogic=(n=!1)=>{this.getWebExperiments(o=>{hx.sp("retrieved web experiments from the server"),this.rp=new Map,o.forEach(i=>{if(i.feature_flag_key){var r;this.rp&&(hx.sp("setting flag key ",i.feature_flag_key," to web experiment ",i),(r=this.rp)===null||r===void 0||r.set(i.feature_flag_key,i));const s=this._instance.getFeatureFlag(i.feature_flag_key);$a(s)&&i.variants[s]&&this.op(i.name,s,i.variants[s].transforms)}else if(i.variants)for(const s in i.variants){const a=i.variants[s];hx.ap(a,this._instance)&&this.op(i.name,s,a.transforms)}})},n)},this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}initialize(){}onFeatureFlags(e){if(this._is_bot())hx.sp(m0t);else if(!this.Mr.disable_web_experiments){if(Fs(this.rp))return this.rp=new Map,this.loadIfEnabled(),void this.previewWebExperiment();hx.sp("applying feature flags",e),e.forEach(n=>{var o;if(this.rp&&(!((o=this.rp)===null||o===void 0)&&o.has(n))){var i;const r=this._instance.getFeatureFlag(n),s=(i=this.rp)===null||i===void 0?void 0:i.get(n);r&&s?.variants[r]&&this.op(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){const e=hx.getWindowLocation();if(e?.search){const n=gF(e?.search,"__experiment_id"),o=gF(e?.search,"__experiment_variant");n&&o&&(hx.sp(`previewing web experiments ${n} && ${o}`),this.getWebExperiments(i=>{this.lp(parseInt(n),o,i)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,o){if(this.Mr.disable_web_experiments&&!o)return e([]);const 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=${this.Mr.token}`),method:"GET",timestampMode:"query",callback:r=>e(r.statusCode===200&&r.json&&r.json.experiments||[])})}lp(e,n,o){const i=o.filter(r=>r.id===e);i&&i.length>0&&(hx.sp(`Previewing web experiment [${i[0].name}] with variant [${n}]`),this.op(i[0].name,n,i[0].variants[n].transforms))}static ap(e,n){return!Fs(e.conditions)&&hx.up(e,n)&&hx.cp(e)}static up(e,n){var o;if(Fs(e.conditions)||Fs((o=e.conditions)===null||o===void 0?void 0:o.url))return!0;const i=hx.getWindowLocation();if(i){var r,s,a;const A=bct(n,i.href);return!(!((r=e.conditions)===null||r===void 0)&&r.url)||VPn[(s=(a=e.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,A)}return!1}static getWindowLocation(){return jn?.location}static cp(e){var n;if(Fs(e.conditions)||Fs((n=e.conditions)===null||n===void 0?void 0:n.utm))return!0;const o=Zct();if(o.utm_source){var i,r,s,a,A,c,l,g;const u=!(!((i=e.conditions)===null||i===void 0||(i=i.utm)===null||i===void 0)&&i.utm_campaign)||((r=e.conditions)===null||r===void 0||(r=r.utm)===null||r===void 0?void 0:r.utm_campaign)==o.utm_campaign,h=!(!((s=e.conditions)===null||s===void 0||(s=s.utm)===null||s===void 0)&&s.utm_source)||((a=e.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0?void 0:a.utm_source)==o.utm_source,d=!(!((A=e.conditions)===null||A===void 0||(A=A.utm)===null||A===void 0)&&A.utm_medium)||((c=e.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0?void 0:c.utm_medium)==o.utm_medium,m=!(!((l=e.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0)&&l.utm_term)||((g=e.conditions)===null||g===void 0||(g=g.utm)===null||g===void 0?void 0:g.utm_term)==o.utm_term;return u&&d&&m&&h}return!1}static sp(e,...n){li.info(`[WebExperiments] ${e}`,n)}op(e,n,o){this._is_bot()?hx.sp(m0t):n!=="control"?o.forEach(i=>{if(i.selector){var r;hx.sp(`applying transform of variant ${n} for experiment ${e} `,i);const s=(r=document)===null||r===void 0?void 0:r.querySelectorAll(i.selector);s?.forEach(a=>{const A=a;i.html&&(A.innerHTML=i.html),i.css&&A.setAttribute("style",i.css)})}}):hx.sp("Control variants leave the page unmodified.")}_is_bot(){return X_&&this._instance?klt(X_,this.Mr.custom_blocked_useragents):void 0}}},hoe),cMn={conversations:class{constructor(t){this._instance=t,this.hp=void 0,this._conversationsManager=null,this.dp=!1,this.ne=null,this.vp=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations||(this.fp=t.ok,!t.ok))return;const e=t.config.conversations;Fs(e)||(My(e)?this.hp=e:(this.hp=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;(t=this._conversationsManager)===null||t===void 0||t.reset(),this._conversationsManager=null,this.hp=void 0,this.ne=null,this.fp=void 0,this.vp=!1}loadIfEnabled(){if(this._conversationsManager||this.dp||this._instance.config.disable_conversations||Mxe(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=Yr?.__PosthogExtensions__;if(t&&!Eo(this.hp)&&this.hp)if(this.ne&&this.ne.token){this.dp=!0;try{const e=t.initConversations;if(e)return this.pp(e),void(this.dp=!1);const n=t.loadExternalDependency;if(!n)return void this.gp(vxe);n(this._instance,"conversations",o=>{o||!t.initConversations?this.gp("Could not load conversations script",o):this.pp(t.initConversations),this.dp=!1})}catch(e){this.gp("Error initializing conversations",e),this.dp=!1}}else R5.error("Conversations enabled but missing token in remote config.")}pp(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.vp=!1,R5.info("Conversations loaded successfully")}catch(e){this.gp("Error completing conversations initialization",e)}else R5.error("Cannot complete initialization: remote config is null")}gp(t,e){R5.error(t,e),this._conversationsManager=null,this.dp=!1,this.vp=!0}show(){this._conversationsManager?this._conversationsManager.show():R5.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.hp===!0&&!ld(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Mxe(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.fp===!1?"remote_config_failed":Eo(this.hp)?this.fp?"disabled_in_project":"remote_config_pending":this.hp?Fs(this.ne)||!this.ne.token?"missing_token":Yr?.__PosthogExtensions__?this.dp?"initializing":this.vp?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return(t=(e=this._conversationsManager)===null||e===void 0?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,n){var o=this;return $g(function*(){return o._conversationsManager?o._conversationsManager.sendMessage(t,e,n):(R5.warn(lD),null)})()}getMessages(t,e){var n=this;return $g(function*(){return n._conversationsManager?n._conversationsManager.getMessages(t,e):(R5.warn(lD),null)})()}markAsRead(t){var e=this;return $g(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(R5.warn(lD),null)})()}getTickets(t){var e=this;return $g(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(R5.warn(lD),null)})()}requestRestoreLink(t){var e=this;return $g(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(R5.warn(lD),null)})()}restoreFromToken(t){var e=this;return $g(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(R5.warn(lD),null)})()}restoreFromUrlToken(){var t=this;return $g(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(R5.warn(lD),null)})()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)===null||e===void 0?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)===null||e===void 0?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}xc(){var t;(t=this._conversationsManager)===null||t===void 0||t.setIdentity()}$c(){var t;(t=this._conversationsManager)===null||t===void 0||t.clearIdentity()}}},lMn={logs:class{constructor(t){var e;this._instance=t,this.name="logs",this.mp=!1,this.yp=!1,this.bp=!1,this.A=gd("[logs]"),this._p=Zt(Zt({},this.A),{},{error:(...n)=>{n.some(I0t)||this.A.error(...n)}}),this.ol=[],this.wp=[],this.kd=0,this.To=!1,this.kp=[],this.Sp=[],this.xp=!1,this.$p=!1,this.Cp=()=>{var n,o;this.To||(this.kd=0,(n=this.Tp)===null||n===void 0||n.onReconnect(),(o=this.Ip)===null||o===void 0||o.onReconnect())},this._instance&&(!((e=this._instance.config.logs)===null||e===void 0)&&e.captureConsoleLogs)&&(this.mp=!0),jn&&Wc(jn,"online",this.Cp)}Mp(t,e,n,o){var i;const r=p0t((i=this._instance)===null||i===void 0||(i=i.config)===null||i===void 0?void 0:i.logs,n);return[new Uvn(this.Ep(t,e),r,this._p,()=>this.Pp(),s=>s(),void 0,o),r]}Rp(){var t;const e=(t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.logs;var n;return this.Tp&&this.Ap===e||((n=this.Tp)===null||n===void 0||n.reset(),this.Ap=e,[this.Tp,this.Fp]=this.Mp(()=>this.ol,o=>{this.ol=o})),this.Tp}Op(){var t;const e=(t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.logs;var n;return this.Ip&&this.Dp===e||((n=this.Ip)===null||n===void 0||n.reset(),this.Dp=e,[this.Ip,this.Lp]=this.Mp(()=>this.wp,o=>{this.wp=o},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},_0t)),this.Ip}setup(t){var e;if(this.To)return;this.bo=t,!((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0||(e=e.logs)===null||e===void 0)&&e.captureConsoleLogs&&(this.mp=!0),(this.mp||this.Np()&&this.qp())&&this.jp();let n=!1;const o=t.onRemoteConfig(i=>{var r;n=i.ok&&((r=i.config.logs)===null||r===void 0?void 0:r.captureConsoleLogs)===!0,this.onRemoteConfig(i)});this.To?o.dispose():(this.Eo=o,n||this.loadIfEnabled())}dispose(){var t,e,n,o;this.To||(this.To=!0,this.Bp(),(t=this.Eo)===null||t===void 0||t.dispose(),this.Eo=void 0,this.bo=void 0,this.bp=!1,jn?.removeEventListener("online",this.Cp),(e=this.zp)===null||e===void 0||e.call(this),this.zp=void 0,(n=this.Tp)===null||n===void 0||n.reset(),(o=this.Ip)===null||o===void 0||o.reset())}onRemoteConfig(t){var e,n;if(this.To)return;const o=t.ok?(e=t.config.logs)===null||e===void 0?void 0:e.captureConsoleLogs:void 0;Fs(o)?this.Hp():((n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$logs_capture_enabled_server_side:!!o}),o?(this.mp=!0,this.yp||this.jp(),this.loadIfEnabled()):this.Hp())}reset(){var t,e,n,o;this.Bp(),(t=this.Tp)===null||t===void 0||t.clearQueue(),this.ol=[],(e=this.Tp)===null||e===void 0||e.reset(),(n=this.Ip)===null||n===void 0||n.clearQueue(),this.wp=[],(o=this.Ip)===null||o===void 0||o.reset(),this.kd=0}captureLog(t){this.To||this.Rp().captureLog(t)}captureConsoleLog(t){this.To||this.Op().captureLog(t)}captureBufferedConsoleLog(t,e,n){this.To||this.Op().captureLog(t,{context:e,occurredAtMs:n})}qp(){var t;return!!(!((t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t[qAt])}Np(){var t,e,n;return!(!((t=this._instance)===null||t===void 0||(e=t.il)===null||e===void 0)&&e.call(t))||!!(!((n=Yr._POSTHOG_REMOTE_CONFIG)===null||n===void 0||(n=n[this._instance.config.token])===null||n===void 0)&&n.config)}Tc(){var t;this.Bp(),(t=this.Ip)===null||t===void 0||t.clearQueue(),this.wp=[]}Hp(){this.mp||this.Bp()}jp(){var t;if(this.xp||!Yr?.console)return;const e=p0t((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.logs).maxBufferSize;let n=!0;this.Sp.push(()=>{n=!1});for(const o of JPn){let i;try{i=WPn(Yr.console[o])}catch{continue}i&&this.Sp.push(fF(Yr.console,o,r=>{const s=(...a)=>{try{n&&this.Up(o,a,e)}catch{}return r.apply(Yr.console,a)};return s.__rrweb_original__=i,s}))}this.xp=!0,this.Wp=setTimeout(()=>{this.Bp()},3e4)}Up(t,e,n){var o;if(this.xp&&!this.$p&&e.length!==0)if(!((o=this._instance)===null||o===void 0)&&o.is_capturing()){if(n>this.kp.length){this.$p=!0;try{this.kp.push({level:t,args:e,occurredAtMs:Date.now(),context:this.Pp()})}finally{this.$p=!1}}}else this.Bp()}Bp(){if(this.kp=[],this.xp){this.xp=!1,this.Wp&&(clearTimeout(this.Wp),this.Wp=void 0);for(const t of this.Sp)t();this.Sp=[]}}Vp(){const t=this.kp;return this.Bp(),t}get logger(){return this.Gp||(this.Gp={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.Gp}flushLogs(t){t?this.Qp(t):(this.Tp&&this.Tp.flush().catch(e=>this.Zp(e)),this.Ip&&this.Ip.flush().catch(e=>this.Zp(e)))}Zp(t){I0t(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.To||!this.mp||this.yp||this.bp)return;const t=Yr?.__PosthogExtensions__;if(!t)return this.A.error("PostHog Extensions not found."),void this.Bp();const e=t.loadExternalDependency;if(!e)return this.A.error(vxe),void this.Bp();this.bp=!0;try{e(this._instance,"logs",n=>{if(this.bp=!1,this.To||!this.mp)return;const o=t.logs;if(n||!o?.initializeLogs)this.A.error("Could not load logs script",n),this.Bp();else{var i;const a=this.Vp();var r,s;this.zp=o.initializeLogs((i=this.bo)!==null&&i!==void 0?i:this._instance),this.yp=!0,a.length>0&&((r=o.replayConsoleBuffer)===null||r===void 0||r.call(o,(s=this.bo)!==null&&s!==void 0?s:this._instance,a))}})}catch(n){throw this.bp=!1,n}}Ep(t,e){const n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:o=>o===K9.LogsQueue?t():void 0,setPersistedProperty(o,i){var r;o===K9.LogsQueue&&e((r=i)!==null&&r!==void 0?r:[])},js:o=>this.js(o),getLibraryId:()=>Xp.LIB_NAME,getLibraryVersion:()=>Xp.LIB_VERSION}}js(t){return new Promise(e=>{if($ct(this.kd,3))return void e({kind:"fatal",error:C3e(void 0,"logs endpoint is unreachable, dropping batch")});let n=!1;const o=r=>{n||(n=!0,clearTimeout(i),e(r))},i=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),o({kind:"retry-later",error:C3e(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Jp(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:r=>{const s=r.statusCode;if(this.Kp(s),s>=200&&300>s)o({kind:"ok"});else if(s===413)o({kind:"too-large"});else if(s!==0&&s!==408&&s!==429&&500>s)o({kind:"fatal",error:new Error(`logs request failed with status ${s}`)});else{var a;s===0?(r.error||this.A.warn("Logs request failed before receiving an HTTP response"),o({kind:"retry-later",error:C3e(r.error,"logs request failed before receiving an HTTP response")})):o({kind:"retry-later",error:(a=r.error)!==null&&a!==void 0?a:new Error(`logs request failed with status ${s}`)})}}})})}Kp(t){(t!==0||this._instance.__loaded)&&(this.kd=Xct(t,this.kd,3,()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}Qp(t){this.ol.length>0&&this.Xp(t,this.ol,this.Fp,Xp.LIB_NAME,e=>{this.ol=e}),this.wp.length>0&&this.Xp(t,this.wp,this.Lp,_0t,e=>{this.wp=e})}Xp(t,e,n,o,i){if(e.length===0)return;const r=e.map(a=>a.record);i([]);const s=LAt(r,FAt(n,Xp.LIB_NAME,Xp.LIB_VERSION),o,Xp.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Jp(),data:s,compression:"best-available",batchKey:"logs",transport:t})}Jp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Pp(){var t;const e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:n,windowId:o,sessionStartTimestamp:i,lastActivityTimestamp:r}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=n,e.windowId=o,Fs(i)||(e.sessionStartTimestamp=i),Fs(r)||(e.lastActivityTimestamp=r)}if(!(Yr==null||(t=Yr.location)===null||t===void 0)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?MQ(Yr.location.href):Yr.location.href),this._instance.featureFlags){const n=this._instance.featureFlags.getFlags();n&&n.length>0&&(e.activeFeatureFlags=n)}return e}}},gMn={metrics:class{constructor(t){this._instance=t,this.A=gd("[metrics]"),this.To=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.To)return;const e=!!(!((t=this._instance.config.metrics)===null||t===void 0)&&t.network);e&&!this.Yp?this.Yp=(n=>{let o=!0;const i=()=>o?(a=>{var A;const c=(A=a.config.metrics)===null||A===void 0?void 0:A.network;return c===!0?{}:c||void 0})(n):void 0,r=$Pn(n,i),s=XPn(n,i);return()=>{o=!1,r(),s()}})(this._instance):!e&&this.Yp&&(this.Yp(),this.Yp=void 0)}Rp(){var t;const e=(t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.metrics;var n;return this.Tp&&this.Ap===e||((n=this.Tp)===null||n===void 0||n.reset(),this.Ap=e,this.Tp=new Kvn(this.Ep(),(function(o){var i,r,s,a,A;const c=o?.resourceAttributes;return{serviceName:(i=c?.["service.name"])!==null&&i!==void 0?i:o?.serviceName,serviceVersion:(r=c?.["service.version"])!==null&&r!==void 0?r:o?.serviceVersion,environment:(s=c?.["deployment.environment"])!==null&&s!==void 0?s:o?.environment,resourceAttributes:c,beforeSend:o?.beforeSend,flushIntervalMs:(a=o?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(A=o?.maxSeriesPerFlush)!==null&&A!==void 0?A:1e3}})(e),this.A)),this.Tp}count(t,e=1,n){this.Rp().count(t,e,n)}gauge(t,e,n){this.Rp().gauge(t,e,n)}histogram(t,e,n){this.Rp().histogram(t,e,n)}flush(t){if(!this.Tp)return Promise.resolve();if(t){const e=this.Tp.drainWindow();return e&&this.Ys(e,t),Promise.resolve()}return this.Tp.flush().catch(e=>this.A.error("PostHog metrics flush failed:",e))}reset(){var t;(t=this.Tp)===null||t===void 0||t.reset()}dispose(){var t,e;this.To=!0,(t=this.Yp)===null||t===void 0||t.call(this),this.Yp=void 0,(e=this.Tp)===null||e===void 0||e.reset()}Ep(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ys:n=>e.Ys(n),getLibraryId:()=>Xp.LIB_NAME,getLibraryVersion:()=>Xp.LIB_VERSION}}Ys(t,e){return new Promise(n=>{let o=!1;const i=s=>{o||(o=!0,clearTimeout(r),n(s))},r=setTimeout(()=>i({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(Zt(Zt({method:"POST",url:this.tg(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e}),{},{fireCallbackOnDrop:!0,callback(s){const a=s.statusCode;if(a>=200&&300>a)i({kind:"ok"});else if(a===413)i({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)i({kind:"fatal",error:new Error(`metrics request failed with status ${a}`)});else{var A;i({kind:"retry-later",error:(A=s.error)!==null&&A!==void 0?A:new Error(`metrics request failed with status ${a}`)})}}}))})}tg(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},uMn={webMCP:class{constructor(t){this._instance=t,this.eg=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.eg)return;const t=qo?.modelContext;if(!t||!ap(t.registerTool))return;const e=x0t.get(t);if(e)return e.instances.add(this._instance),void(this.eg=!0);const n={instances:new Set([this._instance])},o=t.registerTool,i=this;fF(t,"registerTool",r=>{const s=r;return function(a,...A){let c=a;try{c=i.ig(a,n)}catch{return s.call(this,a,...A)}return s.call(this,c,...A)}}),t.registerTool!==o&&(x0t.set(t,n),this.eg=!0)}ig(t,e){if(!t||!ap(t.execute))return t;const n=t.execute,o=this,{tool:i,injected:r}=(function(s,a){const A={intent:!1,model:!1},c=s.inputSchema;if(c&&(HQ(c,"$ref")||HQ(c,"oneOf")||HQ(c,"anyOf")||HQ(c,"allOf")||c.additionalProperties===!0||Ea(c.additionalProperties)||c.type&&c.type!=="object"||c.properties&&!Ea(c.properties)||c.required&&!qr(c.required))||!Eo(c)&&!Ea(c))return{tool:E3e(s),injected:A};const l=c?.properties||{};if(A.intent=a.intent&&!HQ(l,"context"),A.model=a.model&&!HQ(l,"llm_model"),!A.intent&&!A.model)return{tool:E3e(s),injected:A};const g=Zt({},l),u=qr(c?.required)?[...c.required]:[];return A.intent&&(g.context={type:"string",description:`Explain why this tool is called and how it supports the user's goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".`},u.includes("context")||u.push("context")),A.model&&(g.llm_model={type:"string",description:'The exact model identifier you are running as, taken from your system prompt or environment. Pass "unknown" if you do not know it. Never guess.'},u.includes("llm_model")||u.push("llm_model")),{tool:E3e(s,Zt(Zt({},c),{},{type:c?.type||"object",properties:g,required:u})),injected:A}})(t,(function(s){const a={intent:!1,model:!1};for(const A of s.instances){const c=E0t(A.config.capture_webmcp);a.intent||(a.intent=c?.intent===!0),a.model||(a.model=c?.model===!0)}return a})(e));return Object.defineProperty(i,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...s){const a=new Date,A=(function(u,h){if(!Ea(u))return{};try{const d=h.intent?B0t(u.context,2048,!0):void 0,m=h.model?B0t(u.llm_model,256):void 0;return Zt(Zt({},d&&d!=="{}"?{intent:d}:{}),m&&m.toLowerCase()!=="unknown"?{model:m}:{})}catch{return{}}})(s[0],r),c=(function(u,h){const d=u[0];if(!Ea(d))return u;try{const m=h.intent&&HQ(d,"context"),p=h.model&&HQ(d,"llm_model");if(!m&&!p)return u;const _=Zt({},d);return m&&delete _.context,p&&delete _.llm_model,[_,...u.slice(1)]}catch{return u}})(s,r);let l;try{l=n.apply(this===i?t:this,c)}catch(u){throw o.ng(e,i,a,!0,A),u}return(g=l)&&typeof g.then=="function"?Promise.resolve(l).then(u=>(o.ng(e,i,a,b0t(u),A),u),u=>{throw o.ng(e,i,a,!0,A),u}):(o.ng(e,i,a,b0t(l),A),l);var g}}),i}ng(t,e,n,o,i){const r=Date.now()-n.getTime();for(const s of t.instances){const a=E0t(s.config.capture_webmcp);if(a)try{s.capture("$mcp_tool_call",Zt(Zt({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:e.name,$mcp_resource_name:e.name,$mcp_tool_description:e.description,$mcp_server_name:qg?.hostname,$mcp_duration_ms:r,$mcp_is_error:o},a.intent&&i.intent?{$mcp_intent:i.intent,$mcp_intent_source:"context_parameter"}:{}),a.model&&i.model?{$mcp_llm_model:i.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:n})}catch{continue}}}}};oV.__defaultExtensionClasses=Zt({},Zt(Zt(Zt(Zt(Zt(Zt(Zt(Zt(Zt(Zt(Zt(Zt(Zt(Zt({},hoe),eMn),tMn),nMn),oMn),iMn),sMn),rMn),aMn),AMn),cMn),lMn),gMn),uMn));var yF=(function(){Xp.SDK_DIST_CHANNEL="npm";const t=eV[nV]=new oV;return(function(){function e(){e.done||(e.done=!0,Mlt=!1,pl(eV,function(n){n._dom_loaded()}))}qo?.addEventListener?qo.readyState==="complete"?e():Wc(qo,"DOMContentLoaded",e,{capture:!1}):jn&&li.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),t})();class gD extends Error{response;request;options;constructor(e,n,o){const i=e.status||e.status===0?e.status:"",r=e.statusText??"",s=`${i} ${r}`.trim(),a=s?`status code ${s}`:"an unknown error";super(`Request failed with ${a}: ${n.method} ${n.url}`),this.name="HTTPError",this.response=e,this.request=n,this.options=o}}class S0t extends Error{name="NonError";value;constructor(e){let n="Non-error value was thrown";try{typeof e=="string"?n=e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"&&(n=e.message)}catch{}super(n),this.value=e}}class B3e extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const n=e?.cause?e.cause instanceof Error?e.cause:new S0t(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",n?{cause:n}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}}const Q0t=(()=>{let t=!1,e=!1;const n=typeof globalThis.ReadableStream=="function",o=typeof globalThis.Request=="function";if(n&&o)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return t&&!e})(),dMn=typeof globalThis.AbortController=="function",v0t=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",hMn=typeof globalThis.ReadableStream=="function",mMn=typeof globalThis.FormData=="function",w0t=["get","post","put","patch","head","delete"],pMn={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},b3e=2147483647,_Mn=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,P0t=Symbol("stop");class M0t{options;constructor(e){this.options=e}}const fMn=t=>new M0t(t),IMn={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},CMn={next:!0},yMn={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},xMn=t=>{if(!t)return 0;if(t instanceof FormData){let e=0;for(const[n,o]of t)e+=_Mn,e+=new TextEncoder().encode(`Content-Disposition: form-data; name="${n}"`).length,e+=typeof o=="string"?new TextEncoder().encode(o).length:o.size;return e}if(t instanceof Blob)return t.size;if(t instanceof ArrayBuffer)return t.byteLength;if(typeof t=="string")return new TextEncoder().encode(t).length;if(t instanceof URLSearchParams)return new TextEncoder().encode(t.toString()).length;if("byteLength"in t)return t.byteLength;if(typeof t=="object"&&t!==null)try{const e=JSON.stringify(t);return new TextEncoder().encode(e).length}catch{return 0}return 0},D0t=(t,e,n)=>{let o,i=0;return t.pipeThrough(new TransformStream({transform(r,s){if(s.enqueue(r),o){i+=o.byteLength;let a=e===0?0:i/e;a>=1&&(a=1-Number.EPSILON),n?.({percent:a,totalBytes:Math.max(e,i),transferredBytes:i},o)}o=r},flush(){o&&(i+=o.byteLength,n?.({percent:1,totalBytes:Math.max(e,i),transferredBytes:i},o))}}))},EMn=(t,e)=>{if(!t.body)return t;if(t.status===204)return new Response(null,{status:t.status,statusText:t.statusText,headers:t.headers});const n=Math.max(0,Number(t.headers.get("content-length"))||0);return new Response(D0t(t.body,n,e),{status:t.status,statusText:t.statusText,headers:t.headers})},BMn=(t,e,n)=>{if(!t.body)return t;const o=xMn(n??t.body);return new Request(t,{duplex:"half",body:D0t(t.body,o,e)})},uD=t=>t!==null&&typeof t=="object",moe=(...t)=>{for(const e of t)if((!uD(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return S3e({},...t)},N0t=(t={},e={})=>{const n=new globalThis.Headers(t),o=e instanceof globalThis.Headers,i=new globalThis.Headers(e);for(const[r,s]of i.entries())o&&s==="undefined"||s===void 0?n.delete(r):n.set(r,s);return n};function poe(t,e,n){return Object.hasOwn(e,n)&&e[n]===void 0?[]:S3e(t[n]??[],e[n]??[])}const R0t=(t={},e={})=>({beforeRequest:poe(t,e,"beforeRequest"),beforeRetry:poe(t,e,"beforeRetry"),afterResponse:poe(t,e,"afterResponse"),beforeError:poe(t,e,"beforeError")}),bMn=(t,e)=>{const n=new URLSearchParams;for(const o of[t,e])if(o!==void 0)if(o instanceof URLSearchParams)for(const[i,r]of o.entries())n.append(i,r);else if(Array.isArray(o))for(const i of o){if(!Array.isArray(i)||i.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");n.append(String(i[0]),String(i[1]))}else if(uD(o))for(const[i,r]of Object.entries(o))r!==void 0&&n.append(i,String(r));else{const i=new URLSearchParams(o);for(const[r,s]of i.entries())n.append(r,s)}return n},S3e=(...t)=>{let e={},n={},o={},i;const r=[];for(const s of t)if(Array.isArray(s))Array.isArray(e)||(e=[]),e=[...e,...s];else if(uD(s)){for(let[a,A]of Object.entries(s)){if(a==="signal"&&A instanceof globalThis.AbortSignal){r.push(A);continue}if(a==="context"){if(A!=null&&(!uD(A)||Array.isArray(A)))throw new TypeError("The `context` option must be an object");e={...e,context:A==null?{}:{...e.context,...A}};continue}if(a==="searchParams"){A==null?i=void 0:i=i===void 0?A:bMn(i,A);continue}uD(A)&&a in e&&(A=S3e(e[a],A)),e={...e,[a]:A}}uD(s.hooks)&&(o=R0t(o,s.hooks),e.hooks=o),uD(s.headers)&&(n=N0t(n,s.headers),e.headers=n)}return i!==void 0&&(e.searchParams=i),r.length>0&&(r.length===1?e.signal=r[0]:v0t?e.signal=AbortSignal.any(r):e.signal=r.at(-1)),e},SMn=t=>w0t.includes(t)?t.toUpperCase():t,T0t={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3,jitter:void 0,retryOnTimeout:!1},QMn=(t={})=>{if(typeof t=="number")return{...T0t,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.methods&&=t.methods.map(n=>n.toLowerCase()),t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");const e=Object.fromEntries(Object.entries(t).filter(([,n])=>n!==void 0));return{...T0t,...e}};class Q3e extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}}async function vMn(t,e,n,o){return new Promise((i,r)=>{const s=setTimeout(()=>{n&&n.abort(),r(new Q3e(t))},o.timeout);o.fetch(t,e).then(i).catch(r).then(()=>{clearTimeout(s)})})}async function wMn(t,{signal:e}){return new Promise((n,o)=>{e&&(e.throwIfAborted(),e.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(r),o(e.reason)}const r=setTimeout(()=>{e?.removeEventListener("abort",i),n()},t)})}const PMn=(t,e)=>{const n={};for(const o in e)Object.hasOwn(e,o)&&!(o in yMn)&&!(o in IMn)&&(!(o in t)||o in CMn)&&(n[o]=e[o]);return n},MMn=t=>t===void 0?!1:Array.isArray(t)?t.length>0:t instanceof URLSearchParams?t.size>0:typeof t=="object"?Object.keys(t).length>0:typeof t=="string"?t.trim().length>0:!!t;function DMn(t){return t instanceof gD||t?.name===gD.name}function NMn(t){return t instanceof Q3e||t?.name===Q3e.name}let k0t=class Yrt{static create(e,n){const o=new Yrt(e,n),i=async()=>{if(typeof o.#e.timeout=="number"&&o.#e.timeout>b3e)throw new RangeError(`The \`timeout\` option cannot be greater than ${b3e}`);await Promise.resolve();let s=await o.#_();for(const a of o.#e.hooks.afterResponse){const A=o.#d(s.clone());let c;try{c=await a(o.request,o.#c(),A,{retryCount:o.#n})}catch(g){throw o.#r(A),o.#r(s),g}if(c instanceof M0t)throw o.#r(A),o.#r(s),new B3e(c.options);const l=c instanceof globalThis.Response?c:s;A!==l&&o.#r(A),s!==l&&o.#r(s),s=l}if(o.#d(s),!s.ok&&(typeof o.#e.throwHttpErrors=="function"?o.#e.throwHttpErrors(s.status):o.#e.throwHttpErrors)){let a=new gD(s,o.request,o.#c());for(const A of o.#e.hooks.beforeError)a=await A(a,{retryCount:o.#n});throw a}if(o.#e.onDownloadProgress){if(typeof o.#e.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!hMn)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");const a=s.clone();return o.#r(s),EMn(a,o.#e.onDownloadProgress)}return s},r=o.#h(i).finally(()=>{const s=o.#s;o.#g(s?.body??void 0),o.#g(o.request.body??void 0)});for(const[s,a]of Object.entries(pMn))s==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(r[s]=async()=>{o.request.headers.set("accept",o.request.headers.get("accept")||a);const A=await r;if(s==="json"){if(A.status===204)return"";const c=await A.text();return c===""?"":n.parseJson?n.parseJson(c):JSON.parse(c)}return A[s]()});return r}static#a(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0)):e}request;#o;#n=0;#t;#e;#s;#i;#A;constructor(e,n={}){if(this.#t=e,this.#e={...n,headers:N0t(this.#t.headers,n.headers),hooks:R0t({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},n.hooks),method:SMn(n.method??this.#t.method??"GET"),prefixUrl:String(n.prefixUrl||""),retry:QMn(n.retry),throwHttpErrors:n.throwHttpErrors??!0,timeout:n.timeout??1e4,fetch:n.fetch??globalThis.fetch.bind(globalThis),context:n.context??{}},typeof this.#t!="string"&&!(this.#t instanceof URL||this.#t instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this.#e.prefixUrl&&typeof this.#t=="string"){if(this.#t.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this.#e.prefixUrl.endsWith("/")||(this.#e.prefixUrl+="/"),this.#t=this.#e.prefixUrl+this.#t}dMn&&v0t&&(this.#i=this.#e.signal??this.#t.signal,this.#o=new globalThis.AbortController,this.#e.signal=this.#i?AbortSignal.any([this.#i,this.#o.signal]):this.#o.signal),Q0t&&(this.#e.duplex="half"),this.#e.json!==void 0&&(this.#e.body=this.#e.stringifyJson?.(this.#e.json)??JSON.stringify(this.#e.json),this.#e.headers.set("content-type",this.#e.headers.get("content-type")??"application/json"));const o=n.headers&&new globalThis.Headers(n.headers).has("content-type");if(this.#t instanceof globalThis.Request&&(mMn&&this.#e.body instanceof globalThis.FormData||this.#e.body instanceof URLSearchParams)&&!o&&this.#e.headers.delete("content-type"),this.request=new globalThis.Request(this.#t,this.#e),MMn(this.#e.searchParams)){const r="?"+(typeof this.#e.searchParams=="string"?this.#e.searchParams.replace(/^\?/,""):new URLSearchParams(Yrt.#a(this.#e.searchParams)).toString()),s=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,r);this.request=new globalThis.Request(s,this.#e)}if(this.#e.onUploadProgress){if(typeof this.#e.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!Q0t)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#m(this.request,this.#e.body??void 0)}}#l(){const e=this.#e.retry.delay(this.#n);let n=e;this.#e.retry.jitter===!0?n=Math.random()*e:typeof this.#e.retry.jitter=="function"&&(n=this.#e.retry.jitter(e),(!Number.isFinite(n)||n<0)&&(n=e));const o=this.#e.retry.backoffLimit??Number.POSITIVE_INFINITY;return Math.min(o,n)}async#p(e){if(this.#n++,this.#n>this.#e.retry.limit)throw e;const n=e instanceof Error?e:new S0t(e);if(n instanceof B3e)return n.customDelay??this.#l();if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#e.retry.shouldRetry!==void 0){const o=await this.#e.retry.shouldRetry({error:n,retryCount:this.#n});if(o===!1)throw e;if(o===!0)return this.#l()}if(NMn(e)&&!this.#e.retry.retryOnTimeout)throw e;if(DMn(e)){if(!this.#e.retry.statusCodes.includes(e.response.status))throw e;const o=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(o&&this.#e.retry.afterStatusCodes.includes(e.response.status)){let i=Number(o)*1e3;Number.isNaN(i)?i=Date.parse(o)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());const r=this.#e.retry.maxRetryAfter??i;return i<r?i:r}if(e.response.status===413)throw e}return this.#l()}#d(e){return this.#e.parseJson&&(e.json=async()=>this.#e.parseJson(await e.text())),e}#g(e){e&&e.cancel().catch(()=>{})}#r(e){this.#g(e.body??void 0)}async#h(e){try{return await e()}catch(n){const o=Math.min(await this.#p(n),b3e);if(this.#n<1)throw n;if(await wMn(o,this.#i?{signal:this.#i}:{}),n instanceof B3e&&n.customRequest){const i=this.#e.signal?new globalThis.Request(n.customRequest,{signal:this.#e.signal}):new globalThis.Request(n.customRequest);this.#u(i)}for(const i of this.#e.hooks.beforeRetry){const r=await i({request:this.request,options:this.#c(),error:n,retryCount:this.#n});if(r instanceof globalThis.Request){this.#u(r);break}if(r instanceof globalThis.Response)return r;if(r===P0t)return}return this.#h(e)}}async#_(){this.#o?.signal.aborted&&(this.#o=new globalThis.AbortController,this.#e.signal=this.#i?AbortSignal.any([this.#i,this.#o.signal]):this.#o.signal,this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));for(const n of this.#e.hooks.beforeRequest){const o=await n(this.request,this.#c(),{retryCount:this.#n});if(o instanceof Response)return o;if(o instanceof globalThis.Request){this.#u(o);break}}const e=PMn(this.request,this.#e);return this.#s=this.request,this.request=this.#s.clone(),this.#e.timeout===!1?this.#e.fetch(this.#s,e):vMn(this.#s,e,this.#o,this.#e)}#c(){if(!this.#A){const{hooks:e,...n}=this.#e;this.#A=Object.freeze(n)}return this.#A}#u(e){this.#A=void 0,this.request=this.#m(e)}#m(e,n){return!this.#e.onUploadProgress||!e.body?e:BMn(e,this.#e.onUploadProgress,n??this.#e.body??void 0)}};const v3e=t=>{const e=(n,o)=>k0t.create(n,moe(t,o));for(const n of w0t)e[n]=(o,i)=>k0t.create(o,moe(t,i,{method:n}));return e.create=n=>v3e(moe(n)),e.extend=n=>(typeof n=="function"&&(n=n(t??{})),v3e(moe(t,n))),e.stop=P0t,e.retry=fMn,e},RMn=v3e();class TMn extends gD{constructor(e,n,o,i){super(e,n,o),this.name="RegistryHTTPError",this.message=i}}function rV(t){return typeof window<"u"?window[t]:null}function dD(){const t=rV("TSCIRCUIT_REGISTRY_API_BASE_URL")||void 0||"https://registry-api.tscircuit.com",e=rV("TSCIRCUIT_REGISTRY_TOKEN");return RMn.create({prefixUrl:t,headers:{Authorization:`Bearer ${e}`},timeout:3e4,hooks:{afterResponse:[async(n,o,i)=>{if(i.ok)return i;let r=null;try{r=await i.clone().json()}catch(g){console.error("Failed to parse registry error response",g)}const s=r?.error?.message??r?.error?.error_message??r?.message,a=r?.error?.error_code??r?.error_code,A=new URL(i.url),l=[`Registry request failed for ${`${A.pathname}${A.search}`} (${i.status})`];throw s&&l.push(`Server message: ${s}`),a&&l.push(`Error code: ${a}`),new TMn(i,n,o,l.join(" | "))}]}})}function _oe(){return!!rV("TSCIRCUIT_REGISTRY_TOKEN")}const foe={get:(t,e)=>dD().get(t,e),post:(t,e)=>dD().post(t,e),put:(t,e)=>dD().put(t,e),delete:(t,e)=>dD().delete(t,e),patch:(t,e)=>dD().patch(t,e)},kMn="phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo",FMn="https://postpig.tscircuit.com",F0t="runframe:anonymous-id",w3e=()=>typeof window<"u",L0t=t=>t.includes("localhost")||t.includes("127.0.0.1"),LMn=t=>{try{return new URL(t).hostname}catch{return null}},HMn=()=>{if(!w3e())return null;let t=null;return document.referrer&&(t=LMn(document.referrer)),t??window.location.hostname},OMn=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,GMn=()=>{if(!w3e())return null;try{const t=window.localStorage.getItem(F0t);if(t)return t;const e=OMn();return window.localStorage.setItem(F0t,e),e}catch{return null}},YMn=()=>rV("TSCIRCUIT_USE_RUNFRAME_FOR_CLI")===!0,H0t=()=>!w3e()||L0t(window.location.hostname)&&!YMn()?!1:(yF.__loaded||yF.init(kMn,{api_host:FMn,person_profiles:"always"}),!0),UMn=()=>{if(!H0t())return null;const t=HMn(),e=t!=null&&!L0t(t);let n=null;e||(n=GMn());let o,i;return e?(o=`domain:${t}`,i="domain"):(o=void 0,n&&(o=`anonymous:${n}`),i="anonymous_id"),{embedDomain:t,anonymousId:n,distinctId:o,identityType:i}},KMn=(t,{source:e,...n})=>{const o=UMn();if(!o)return;const{embedDomain:i,anonymousId:r,distinctId:s,identityType:a}=o;if(s){const A={};a==="domain"&&i&&(A.embed_domain=i),a==="anonymous_id"&&r&&(A.runframe_anonymous_id=r),yF.identify(s,A)}yF.capture(t,{...n,source:e,embed_domain:i,runframe_anonymous_id:r,identity_type:a})},zMn=t=>{KMn("runframe_activity",t)};H0t();function VMn(t){const e=String.fromCodePoint(...t);return btoa(e)}var Ap=Uint8Array,W3=Uint16Array,P3e=Int32Array,Ioe=new Ap([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]),Coe=new Ap([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]),M3e=new Ap([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),O0t=function(t,e){for(var n=new W3(31),o=0;o<31;++o)n[o]=e+=1<<t[o-1];for(var i=new P3e(n[30]),o=1;o<30;++o)for(var r=n[o];r<n[o+1];++r)i[r]=r-n[o]<<5|o;return{b:n,r:i}},G0t=O0t(Ioe,2),Y0t=G0t.b,D3e=G0t.r;Y0t[28]=258,D3e[258]=28;for(var U0t=O0t(Coe,0),JMn=U0t.b,K0t=U0t.r,N3e=new W3(32768),hd=0;hd<32768;++hd){var OQ=(hd&43690)>>1|(hd&21845)<<1;OQ=(OQ&52428)>>2|(OQ&13107)<<2,OQ=(OQ&61680)>>4|(OQ&3855)<<4,N3e[hd]=((OQ&65280)>>8|(OQ&255)<<8)>>1}for(var W9=(function(t,e,n){for(var o=t.length,i=0,r=new W3(e);i<o;++i)t[i]&&++r[t[i]-1];var s=new W3(e);for(i=1;i<e;++i)s[i]=s[i-1]+r[i-1]<<1;var a;if(n){a=new W3(1<<e);var A=15-e;for(i=0;i<o;++i)if(t[i])for(var c=i<<4|t[i],l=e-t[i],g=s[t[i]-1]++<<l,u=g|(1<<l)-1;g<=u;++g)a[N3e[g]>>A]=c}else for(a=new W3(o),i=0;i<o;++i)t[i]&&(a[i]=N3e[s[t[i]-1]++]>>15-t[i]);return a}),GQ=new Ap(288),hd=0;hd<144;++hd)GQ[hd]=8;for(var hd=144;hd<256;++hd)GQ[hd]=9;for(var hd=256;hd<280;++hd)GQ[hd]=7;for(var hd=280;hd<288;++hd)GQ[hd]=8;for(var sV=new Ap(32),hd=0;hd<32;++hd)sV[hd]=5;var WMn=W9(GQ,9,0),jMn=W9(GQ,9,1),qMn=W9(sV,5,0),$Mn=W9(sV,5,1),R3e=function(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},iB=function(t,e,n){var o=e/8|0;return(t[o]|t[o+1]<<8)>>(e&7)&n},T3e=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(e&7)},k3e=function(t){return(t+7)/8|0},xF=function(t,e,n){return(e==null||e<0)&&(e=0),(n==null||n>t.length)&&(n=t.length),new Ap(t.subarray(e,n))},XMn=["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"],fx=function(t,e,n){var o=new Error(e||XMn[t]);if(o.code=t,Error.captureStackTrace&&Error.captureStackTrace(o,fx),!n)throw o;return o},z0t=function(t,e,n,o){var i=t.length,r=0;if(!i||e.f&&!e.l)return n||new Ap(0);var s=!n,a=s||e.i!=2,A=e.i;s&&(n=new Ap(i*3));var c=function(ue){var pe=n.length;if(ue>pe){var Me=new Ap(Math.max(pe*2,ue));Me.set(n),n=Me}},l=e.f||0,g=e.p||0,u=e.b||0,h=e.l,d=e.d,m=e.m,p=e.n,_=i*8;do{if(!h){l=iB(t,g,1);var f=iB(t,g+1,3);if(g+=3,f)if(f==1)h=jMn,d=$Mn,m=9,p=5;else if(f==2){var x=iB(t,g,31)+257,E=iB(t,g+10,15)+4,B=x+iB(t,g+5,31)+1;g+=14;for(var S=new Ap(B),Q=new Ap(19),w=0;w<E;++w)Q[M3e[w]]=iB(t,g+w*3,7);g+=E*3;for(var M=R3e(Q),T=(1<<M)-1,R=W9(Q,M,1),w=0;w<B;){var F=R[iB(t,g,T)];g+=F&15;var I=F>>4;if(I<16)S[w++]=I;else{var O=0,U=0;for(I==16?(U=3+iB(t,g,3),g+=2,O=S[w-1]):I==17?(U=3+iB(t,g,7),g+=3):I==18&&(U=11+iB(t,g,127),g+=7);U--;)S[w++]=O}}var Y=S.subarray(0,x),j=S.subarray(x);m=R3e(Y),p=R3e(j),h=W9(Y,m,1),d=W9(j,p,1)}else fx(1);else{var I=k3e(g)+4,C=t[I-4]|t[I-3]<<8,y=I+C;if(y>i){A&&fx(0);break}a&&c(u+C),n.set(t.subarray(I,y),u),e.b=u+=C,e.p=g=y*8,e.f=l;continue}if(g>_){A&&fx(0);break}}a&&c(u+131072);for(var Z=(1<<m)-1,J=(1<<p)-1,X=g;;X=g){var O=h[T3e(t,g)&Z],te=O>>4;if(g+=O&15,g>_){A&&fx(0);break}if(O||fx(2),te<256)n[u++]=te;else if(te==256){X=g,h=null;break}else{var ae=te-254;if(te>264){var w=te-257,ie=Ioe[w];ae=iB(t,g,(1<<ie)-1)+Y0t[w],g+=ie}var le=d[T3e(t,g)&J],he=le>>4;le||fx(3),g+=le&15;var j=JMn[he];if(he>3){var ie=Coe[he];j+=T3e(t,g)&(1<<ie)-1,g+=ie}if(g>_){A&&fx(0);break}a&&c(u+131072);var Ce=u+ae;if(u<j){var ce=r-j,_e=Math.min(j,Ce);for(ce+u<0&&fx(3);u<_e;++u)n[u]=o[ce+u]}for(;u<Ce;++u)n[u]=n[u-j]}}e.l=h,e.p=X,e.b=u,e.f=l,h&&(l=1,e.m=m,e.d=d,e.n=p)}while(!l);return u!=n.length&&s?xF(n,0,u):n.subarray(0,u)},q8=function(t,e,n){n<<=e&7;var o=e/8|0;t[o]|=n,t[o+1]|=n>>8},aV=function(t,e,n){n<<=e&7;var o=e/8|0;t[o]|=n,t[o+1]|=n>>8,t[o+2]|=n>>16},F3e=function(t,e){for(var n=[],o=0;o<t.length;++o)t[o]&&n.push({s:o,f:t[o]});var i=n.length,r=n.slice();if(!i)return{t:j0t,l:0};if(i==1){var s=new Ap(n[0].s+1);return s[n[0].s]=1,{t:s,l:1}}n.sort(function(y,x){return y.f-x.f}),n.push({s:-1,f:25001});var a=n[0],A=n[1],c=0,l=1,g=2;for(n[0]={s:-1,f:a.f+A.f,l:a,r:A};l!=i-1;)a=n[n[c].f<n[g].f?c++:g++],A=n[c!=l&&n[c].f<n[g].f?c++:g++],n[l++]={s:-1,f:a.f+A.f,l:a,r:A};for(var u=r[0].s,o=1;o<i;++o)r[o].s>u&&(u=r[o].s);var h=new W3(u+1),d=L3e(n[l-1],h,0);if(d>e){var o=0,m=0,p=d-e,_=1<<p;for(r.sort(function(x,E){return h[E.s]-h[x.s]||x.f-E.f});o<i;++o){var f=r[o].s;if(h[f]>e)m+=_-(1<<d-h[f]),h[f]=e;else break}for(m>>=p;m>0;){var I=r[o].s;h[I]<e?m-=1<<e-h[I]++-1:++o}for(;o>=0&&m;--o){var C=r[o].s;h[C]==e&&(--h[C],++m)}d=e}return{t:new Ap(h),l:d}},L3e=function(t,e,n){return t.s==-1?Math.max(L3e(t.l,e,n+1),L3e(t.r,e,n+1)):e[t.s]=n},V0t=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new W3(++e),o=0,i=t[0],r=1,s=function(A){n[o++]=A},a=1;a<=e;++a)if(t[a]==i&&a!=e)++r;else{if(!i&&r>2){for(;r>138;r-=138)s(32754);r>2&&(s(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(s(i),--r;r>6;r-=6)s(8304);r>2&&(s(r-3<<5|8208),r=0)}for(;r--;)s(i);r=1,i=t[a]}return{c:n.subarray(0,o),n:e}},AV=function(t,e){for(var n=0,o=0;o<e.length;++o)n+=t[o]*e[o];return n},J0t=function(t,e,n){var o=n.length,i=k3e(e+2);t[i]=o&255,t[i+1]=o>>8,t[i+2]=t[i]^255,t[i+3]=t[i+1]^255;for(var r=0;r<o;++r)t[i+r+4]=n[r];return(i+4+o)*8},W0t=function(t,e,n,o,i,r,s,a,A,c,l){q8(e,l++,n),++i[256];for(var g=F3e(i,15),u=g.t,h=g.l,d=F3e(r,15),m=d.t,p=d.l,_=V0t(u),f=_.c,I=_.n,C=V0t(m),y=C.c,x=C.n,E=new W3(19),B=0;B<f.length;++B)++E[f[B]&31];for(var B=0;B<y.length;++B)++E[y[B]&31];for(var S=F3e(E,7),Q=S.t,w=S.l,M=19;M>4&&!Q[M3e[M-1]];--M);var T=c+5<<3,R=AV(i,GQ)+AV(r,sV)+s,F=AV(i,u)+AV(r,m)+s+14+3*M+AV(E,Q)+2*E[16]+3*E[17]+7*E[18];if(A>=0&&T<=R&&T<=F)return J0t(e,l,t.subarray(A,A+c));var O,U,Y,j;if(q8(e,l,1+(F<R)),l+=2,F<R){O=W9(u,h,0),U=u,Y=W9(m,p,0),j=m;var Z=W9(Q,w,0);q8(e,l,I-257),q8(e,l+5,x-1),q8(e,l+10,M-4),l+=14;for(var B=0;B<M;++B)q8(e,l+3*B,Q[M3e[B]]);l+=3*M;for(var J=[f,y],X=0;X<2;++X)for(var te=J[X],B=0;B<te.length;++B){var ae=te[B]&31;q8(e,l,Z[ae]),l+=Q[ae],ae>15&&(q8(e,l,te[B]>>5&127),l+=te[B]>>12)}}else O=WMn,U=GQ,Y=qMn,j=sV;for(var B=0;B<a;++B){var ie=o[B];if(ie>255){var ae=ie>>18&31;aV(e,l,O[ae+257]),l+=U[ae+257],ae>7&&(q8(e,l,ie>>23&31),l+=Ioe[ae]);var le=ie&31;aV(e,l,Y[le]),l+=j[le],le>3&&(aV(e,l,ie>>5&8191),l+=Coe[le])}else aV(e,l,O[ie]),l+=U[ie]}return aV(e,l,O[256]),l+U[256]},ZMn=new P3e([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),j0t=new Ap(0),eDn=function(t,e,n,o,i,r){var s=r.z||t.length,a=new Ap(o+s+5*(1+Math.ceil(s/7e3))+i),A=a.subarray(o,a.length-i),c=r.l,l=(r.r||0)&7;if(e){l&&(A[0]=r.r>>3);for(var g=ZMn[e-1],u=g>>13,h=g&8191,d=(1<<n)-1,m=r.p||new W3(32768),p=r.h||new W3(d+1),_=Math.ceil(n/3),f=2*_,I=function(ve){return(t[ve]^t[ve+1]<<_^t[ve+2]<<f)&d},C=new P3e(25e3),y=new W3(288),x=new W3(32),E=0,B=0,S=r.i||0,Q=0,w=r.w||0,M=0;S+2<s;++S){var T=I(S),R=S&32767,F=p[T];if(m[R]=F,p[T]=R,w<=S){var O=s-S;if((E>7e3||Q>24576)&&(O>423||!c)){l=W0t(t,A,0,C,y,x,B,Q,M,S-M,l),Q=E=B=0,M=S;for(var U=0;U<286;++U)y[U]=0;for(var U=0;U<30;++U)x[U]=0}var Y=2,j=0,Z=h,J=R-F&32767;if(O>2&&T==I(S-J))for(var X=Math.min(u,O)-1,te=Math.min(32767,S),ae=Math.min(258,O);J<=te&&--Z&&R!=F;){if(t[S+Y]==t[S+Y-J]){for(var ie=0;ie<ae&&t[S+ie]==t[S+ie-J];++ie);if(ie>Y){if(Y=ie,j=J,ie>X)break;for(var le=Math.min(J,ie-2),he=0,U=0;U<le;++U){var Ce=S-J+U&32767,ce=m[Ce],_e=Ce-ce&32767;_e>he&&(he=_e,F=Ce)}}}R=F,F=m[R],J+=R-F&32767}if(j){C[Q++]=268435456|D3e[Y]<<18|K0t[j];var ue=D3e[Y]&31,pe=K0t[j]&31;B+=Ioe[ue]+Coe[pe],++y[257+ue],++x[pe],w=S+Y,++E}else C[Q++]=t[S],++y[t[S]]}}for(S=Math.max(S,w);S<s;++S)C[Q++]=t[S],++y[t[S]];l=W0t(t,A,c,C,y,x,B,Q,M,S-M,l),c||(r.r=l&7|A[l/8|0]<<3,l-=7,r.h=p,r.p=m,r.i=S,r.w=w)}else{for(var S=r.w||0;S<s+c;S+=65535){var Me=S+65535;Me>=s&&(A[l/8|0]=c,Me=s),l=J0t(A,l+1,t.subarray(S,Me))}r.i=s}return xF(a,0,o+k3e(l)+i)},tDn=(function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var n=e,o=9;--o;)n=(n&1&&-306674912)^n>>>1;t[e]=n}return t})(),nDn=function(){var t=-1;return{p:function(e){for(var n=t,o=0;o<e.length;++o)n=tDn[n&255^e[o]]^n>>>8;t=n},d:function(){return~t}}},q0t=function(){var t=1,e=0;return{p:function(n){for(var o=t,i=e,r=n.length|0,s=0;s!=r;){for(var a=Math.min(s+2655,r);s<a;++s)i+=o+=n[s];o=(o&65535)+15*(o>>16),i=(i&65535)+15*(i>>16)}t=o,e=i},d:function(){return t%=65521,e%=65521,(t&255)<<24|(t&65280)<<8|(e&255)<<8|e>>8}}},$0t=function(t,e,n,o,i){if(!i&&(i={l:1},e.dictionary)){var r=e.dictionary.subarray(-32768),s=new Ap(r.length+t.length);s.set(r),s.set(t,r.length),t=s,i.w=r.length}return eDn(t,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,n,o,i)},cV=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},oDn=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&&cV(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var o=0;o<=n.length;++o)t[o+10]=n.charCodeAt(o)}},iDn=function(t){return 10+(t.filename?t.filename.length+1:0)},rDn=function(t,e){var n=e.level,o=n==0?0:n<6?1:n==9?3:2;if(t[0]=120,t[1]=o<<6|(e.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var i=q0t();i.p(e.dictionary),cV(t,2,i.d())}},X0t=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&fx(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&fx(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2},H3e=(function(){function t(e,n){typeof e=="function"&&(n=e,e={}),this.ondata=n;var o=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:o?o.length:0},this.o=new Ap(32768),this.p=new Ap(0),o&&this.o.set(o)}return t.prototype.e=function(e){if(this.ondata||fx(5),this.d&&fx(4),!this.p.length)this.p=e;else if(e.length){var n=new Ap(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length),this.p=n}},t.prototype.c=function(e){this.s.i=+(this.d=e||!1);var n=this.s.b,o=z0t(this.p,this.s,this.o);this.ondata(xF(o,n,this.s.b),this.d),this.o=xF(o,this.s.b-32768),this.s.b=this.o.length,this.p=xF(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(e,n){this.e(e),this.c(n)},t})();function O3e(t,e){e||(e={});var n=nDn(),o=t.length;n.p(t);var i=$0t(t,e,iDn(e),8),r=i.length;return oDn(i,e),cV(i,r-8,n.d()),cV(i,r-4,o),i}function Z0t(t,e){e||(e={});var n=q0t();n.p(t);var o=$0t(t,e,e.dictionary?6:2,4);return rDn(o,e),cV(o,o.length-4,n.d()),o}var yoe=(function(){function t(e,n){H3e.call(this,e,n),this.v=e&&e.dictionary?2:1}return t.prototype.push=function(e,n){if(H3e.prototype.e.call(this,e),this.v){if(this.p.length<6&&!n)return;this.p=this.p.subarray(X0t(this.p,this.v-1)),this.v=0}n&&(this.p.length<4&&fx(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),H3e.prototype.c.call(this,n)},t})();function sDn(t,e){return z0t(t.subarray(X0t(t,e),-4),{i:2},e,e)}var egt=typeof TextEncoder<"u"&&new TextEncoder,aDn=typeof TextDecoder<"u"&&new TextDecoder,ADn=0;try{aDn.decode(j0t,{stream:!0}),ADn=1}catch{}function G3e(t,e){var n;if(egt)return egt.encode(t);for(var o=t.length,i=new Ap(t.length+(t.length>>1)),r=0,s=function(c){i[r++]=c},n=0;n<o;++n){if(r+5>i.length){var a=new Ap(r+8+(o-n<<1));a.set(i),i=a}var A=t.charCodeAt(n);A<128||e?s(A):A<2048?(s(192|A>>6),s(128|A&63)):A>55295&&A<57344?(A=65536+(A&1047552)|t.charCodeAt(++n)&1023,s(240|A>>18),s(128|A>>12&63),s(128|A>>6&63),s(128|A&63)):(s(224|A>>12),s(128|A>>6&63),s(128|A&63))}return xF(i,0,r)}function cDn(t,e){const n=JSON.stringify(t),o=O3e(G3e(n));return`https://tscircuit.com/editor?#data:application/gzip;base64,${VMn(o)}`}function zr(...t){return dQn(X4(t))}const tgt=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),Y3e=NSn,xoe=ee.forwardRef(({className:t,...e},n)=>z.jsx(Aat,{ref:n,className:zr("rf-inline-flex rf-h-9 rf-items-center rf-justify-center rf-rounded-lg rf-bg-zinc-100 rf-p-1 rf-text-zinc-500 dark:rf-bg-zinc-800 dark:rf-text-zinc-400",t),...e}));xoe.displayName=Aat.displayName;const j9=ee.forwardRef(({className:t,...e},n)=>z.jsx(cat,{ref:n,className:zr("rf-inline-flex rf-items-center rf-justify-center rf-whitespace-nowrap rf-rounded-md rf-px-3 rf-py-1 rf-text-sm rf-font-medium rf-ring-offset-white rf-transition-all focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 disabled:rf-pointer-events-none disabled:rf-opacity-50 data-[state=active]:rf-bg-white data-[state=active]:rf-text-zinc-950 data-[state=active]:rf-shadow dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300 dark:data-[state=active]:rf-bg-zinc-950 dark:data-[state=active]:rf-text-zinc-50",t),...e}));j9.displayName=cat.displayName;const uI=ee.forwardRef(({className:t,...e},n)=>z.jsx(lat,{ref:n,className:zr("rf-h-full rf-mt-2 rf-ring-offset-white focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300",t),...e}));uI.displayName=lat.displayName;function dn(t,e){return Array.isArray(e)?[t.a*e[0]+t.c*e[1]+t.e,t.b*e[0]+t.d*e[1]+t.f]:{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}const lDn=/^matrix\(\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*\)$/i;function gDn(t){const e=t.match(lDn);if(e===null||e.length<7)throw new Error(`'${t}' is not a matrix`);return{a:parseFloat(e[1]),b:parseFloat(e[2]),c:parseFloat(e[3]),d:parseFloat(e[4]),e:parseFloat(e[5]),f:parseFloat(e[6])}}function uDn(t){const{a:e,b:n,c:o,d:i,e:r,f:s}=t,a=e*i-n*o;return{a:i/a,b:n/-a,c:o/-a,d:e/a,e:(i*r-o*s)/-a,f:(n*r-e*s)/a}}function lV(t){return typeof t>"u"}function e_(t,e=0){return{a:1,c:0,e:t,b:0,d:1,f:e}}function gV(...t){t=Array.isArray(t[0])?t[0]:t;const e=(n,o)=>({a:n.a*o.a+n.c*o.b,c:n.a*o.c+n.c*o.d,e:n.a*o.e+n.c*o.f+n.e,b:n.b*o.a+n.d*o.b,d:n.b*o.c+n.d*o.d,f:n.b*o.e+n.d*o.f+n.f});switch(t.length){case 0:throw new Error("no matrices provided");case 1:return t[0];case 2:return e(t[0],t[1]);default:{const[n,o,...i]=t,r=e(n,o);return gV(r,...i)}}}function Vl(...t){return gV(...t)}const{cos:dDn,sin:hDn}=Math;function q9(t,e,n){const o=dDn(t),i=hDn(t),r={a:o,c:-i,e:0,b:i,d:o,f:0};return lV(e)||lV(n)?r:gV([e_(e,n),r,e_(-e,-n)])}function Ix(t,e=void 0,n=void 0,o=void 0){lV(e)&&(e=t);const i={a:t,c:0,e:0,b:0,d:e,f:0};return lV(n)||lV(o)?i:gV([e_(n,o),i,e_(-n,-o)])}function mDn(t){return $9(t)}function $9(t){return`matrix(${t.a},${t.b},${t.c},${t.d},${t.e},${t.f})`}function pDn(t,e=1e10){return{a:Math.round(t.a*e)/e,b:Math.round(t.b*e)/e,c:Math.round(t.c*e)/e,d:Math.round(t.d*e)/e,e:Math.round(t.e*e)/e,f:Math.round(t.f*e)/e}}function _Dn(t,e){const n=t[0].x!=null?t[0].x:t[0][0],o=t[0].y!=null?t[0].y:t[0][1],i=e[0].x!=null?e[0].x:e[0][0],r=e[0].y!=null?e[0].y:e[0][1],s=t[1].x!=null?t[1].x:t[1][0],a=t[1].y!=null?t[1].y:t[1][1],A=e[1].x!=null?e[1].x:e[1][0],c=e[1].y!=null?e[1].y:e[1][1],l=t[2].x!=null?t[2].x:t[2][0],g=t[2].y!=null?t[2].y:t[2][1],u=e[2].x!=null?e[2].x:e[2][0],h=e[2].y!=null?e[2].y:e[2][1],d={a:n-l,b:o-g,c:s-l,d:a-g,e:l,f:g},m={a:i-u,b:r-h,c:A-u,d:c-h,e:u,f:h},p=uDn(d),_=gV([m,p]);return pDn(_)}function fDn(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n}function Eoe(t,e,n,o){var i=Error.call(this,t);return Object.setPrototypeOf&&Object.setPrototypeOf(i,Eoe.prototype),i.expected=e,i.found=n,i.location=o,i.name="SyntaxError",i}fDn(Eoe,Error);function U3e(t,e,n){return n=n||" ",t.length>e?t:(e-=t.length,n+=n.repeat(e),t+n.slice(0,e))}Eoe.prototype.format=function(t){var e="Error: "+this.message;if(this.location){var n=null,o;for(o=0;o<t.length;o++)if(t[o].source===this.location.source){n=t[o].text.split(/\r\n|\n|\r/g);break}var i=this.location.start,r=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(i):i,s=this.location.source+":"+r.line+":"+r.column;if(n){var a=this.location.end,A=U3e("",r.line.toString().length," "),c=n[i.line-1],l=i.line===a.line?a.column:c.length+1,g=l-i.column||1;e+=`
242
242
  --> `+s+`
243
243
  `+A+` |
@@ -5664,7 +5664,7 @@ test("${c} should solve problem correctly", () => {
5664
5664
  // Add more specific assertions based on expected output
5665
5665
  // expect(solver.netLabelPlacementSolver!.netLabelPlacements).toMatchInlineSnapshot()
5666
5666
  })
5667
- `,g=new Blob([l],{type:"text/plain"}),u=URL.createObjectURL(g),h=document.createElement("a");h.href=u,h.download=`${c}.test.ts`,h.click(),URL.revokeObjectURL(u)}catch(A){alert(`Error generating test.ts for ${t.getSolverName()}: ${A instanceof Error?A.message:String(A)}`)}o(!1)};return z.jsxs("div",{className:`relative ${e}`,ref:i,children:[z.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>o(!n),title:`Download options for ${t.getSolverName()}`,children:t.getSolverName()}),n&&z.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download JSON"}),z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:a,children:"Download test.ts"})]})]})},syn=t=>t.activeSubSolver?[t,...syn(t.activeSubSolver)]:[t],Xji=({solver:t})=>{const e=syn(t);return z.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:e.map((n,o)=>z.jsxs("div",{className:"flex items-center",children:[o>0&&z.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),z.jsx($ji,{solver:n})]},n.getSolverName()))})},Zji=({solver:t,triggerRender:e,animationSpeed:n=25,renderer:o,onRendererChange:i,onAnimationSpeedChange:r,onDownloadVisualization:s,onSolverStarted:a,onSolverCompleted:A})=>{const[c,l]=ee.useReducer(B=>!B,!1),g=ee.useRef(void 0),u=ee.useRef(null),h="solver-debugger-last-iteration",[d,m]=ee.useState(null),p=ee.useRef(null),_=ee.useMemo(()=>[{label:"Slow",value:250,description:"250ms"},{label:"Normal",value:100,description:"100ms"},{label:"Fast",value:10,description:"10ms"},{label:"Fast (2x)",value:5,description:"5ms"},{label:"Fast (10x)",value:1,description:"1ms"},{label:"Fast 20x",value:.5,description:"2 steps / 1ms"},{label:"Fast 100x",value:.1,description:"10 steps / 1ms"}],[]),f=()=>{const B=Math.max(1,n),S=n<1?Math.round(1/n):1;g.current=setInterval(()=>{if(t.solved||t.failed){g.current&&(clearInterval(g.current),g.current=void 0),l(),e(),A&&t.solved&&A(t);return}for(let Q=0;Q<S&&!(t.solved||t.failed);Q++)t.step();e()},B)},I=()=>{g.current&&(clearInterval(g.current),g.current=void 0)},C=()=>{!t.solved&&!t.failed&&(t.step(),e())},y=()=>{!t.solved&&!t.failed&&(a&&a(t),t.solve(),e(),A&&A(t))},x=()=>{c?(I(),l()):(l(),f())},E=()=>{if(t.solved||t.failed||c)return;u.current===null&&typeof window<"u"&&(u.current=window.localStorage.getItem(h));const B=window.prompt("Step until which iteration?",u.current??`${t.iterations}`);if(B===null)return;u.current=B,typeof window<"u"&&window.localStorage.setItem(h,B);const S=Number(B);if(!Number.isFinite(S)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<S&&!t.solved&&!t.failed;)t.step();e(),t.solved&&A&&A(t)};return ee.useEffect(()=>()=>{I()},[]),ee.useEffect(()=>{(t.solved||t.failed)&&c&&(I(),l())},[t.solved,t.failed,c]),ee.useEffect(()=>{c&&(I(),f())},[n,c]),ee.useEffect(()=>{if(typeof document>"u")return;const B=S=>{p.current&&!p.current.contains(S.target)&&m(null)};return document.addEventListener("mousedown",B),()=>{document.removeEventListener("mousedown",B)}},[]),z.jsxs("div",{className:"space-y-2 p-2 border-b",children:[z.jsx("div",{className:"flex items-center",children:z.jsxs("div",{className:"flex items-center gap-2",ref:p,children:[z.jsxs("div",{className:"flex h-9 items-center space-x-1 rounded-md border border-slate-200 bg-white p-1 shadow-sm",children:[z.jsxs("div",{className:"relative",children:[z.jsx("button",{type:"button",onClick:()=>m(d==="renderer"?null:"renderer"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="renderer"?"open":"closed",children:"Renderer"}),d==="renderer"&&z.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[10rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:["vector","canvas"].map(B=>z.jsxs("button",{type:"button",onClick:()=>{i(B),m(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[B==="vector"?"Vector":"Canvas",o===B&&z.jsx("span",{className:"ml-auto text-xs text-slate-500",children:"✓"})]},B))})]}),z.jsxs("div",{className:"relative",children:[z.jsx("button",{type:"button",onClick:()=>m(d==="debug"?null:"debug"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="debug"?"open":"closed",children:"Debug"}),d==="debug"&&z.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[12rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:z.jsx("button",{type:"button",onClick:()=>{s(),m(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:"Download Visualization"})})]}),z.jsxs("div",{className:"relative",children:[z.jsx("button",{type:"button",onClick:()=>m(d==="animation"?null:"animation"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="animation"?"open":"closed",children:"Animation"}),d==="animation"&&z.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[12rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:_.map(B=>z.jsxs("button",{type:"button",onClick:()=>{r(B.value),m(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[B.label,z.jsx("span",{className:"ml-auto text-xs text-slate-500",children:B.description}),n===B.value&&z.jsx("span",{className:"ml-2 text-xs text-slate-500",children:"✓"})]},B.value))})]})]}),z.jsx(Xji,{solver:t})]})}),z.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[z.jsx("button",{onClick:C,disabled:t.solved||t.failed||c,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),z.jsx("button",{onClick:y,disabled:t.solved||t.failed||c,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),z.jsx("button",{onClick:x,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${c?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:c?"Stop":"Animate"}),z.jsx("button",{onClick:E,disabled:t.solved||t.failed||c,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),z.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&z.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),t.solved&&z.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&z.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&z.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},eqi=t=>t!==null&&"pipelineDef"in t&&Array.isArray(t.pipelineDef),tqi=(t,e,n)=>{const o=t.currentPipelineStageIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},nqi=(t,e)=>{const o=t.pipelineDef[e].solverName,i=tqi(t,e),r=t[o],s=t.firstIterationOfStage?.[o]??(e===t.currentPipelineStageIndex?t.iterations:null),a=t.iterations;let A=0;if(i==="Completed"){const u=t.pipelineDef[e+1],h=u?t.firstIterationOfStage?.[u.solverName]:void 0;h!==void 0&&s!==null?A=h-s:s!==null&&(A=a-s)}else i==="In Progress"&&s!==null&&(A=a-s);const c=t.timeSpentOnStage?.[o]??0;let l=0;i==="Completed"?l=1:i==="In Progress"&&r&&(l=r.progress??0);const g=r?.stats??null;return{index:e,name:o,status:i,firstIteration:s,iterations:A,progress:l,timeSpent:c,stats:g&&Object.keys(g).length>0?g:null,solverInstance:r??null}},oqi=({status:t})=>{const e={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return z.jsx("span",{className:`font-medium ${e[t]}`,children:t})},iqi=({progress:t})=>{if(t===0)return null;const e=Math.round(t*100);return z.jsxs("div",{className:"flex items-center gap-2",children:[z.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:z.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${e}%`}})}),z.jsxs("span",{className:"text-xs text-gray-500",children:[e,"%"]})]})},ayn=t=>{if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"||t==null)return String(t);if(typeof t=="object")try{return JSON.stringify(t)}catch{return String(t)}return String(t)},rqi=t=>Object.entries(t).map(([e,n])=>`${e}: ${ayn(n)}`).join(", "),sqi=({stats:t})=>{if(!t||Object.keys(t).length===0)return z.jsx("span",{children:"-"});const e=Object.entries(t),n=rqi(t);return z.jsxs("details",{className:"cursor-pointer",children:[z.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:n}),z.jsx("div",{className:"mt-1 text-xs",children:e.map(([o,i])=>z.jsxs("div",{children:[o,": ",ayn(i)]},o))})]})},MXe=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(MXe);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=MXe(o));return e},aqi=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=MXe(t.getConstructorParams()),o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),i=URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=`${e}_input.json`,r.click(),URL.revokeObjectURL(i)}catch(n){alert(`Error downloading input for ${e}: ${n instanceof Error?n.message:String(n)}`)}},Aqi=({expanded:t})=>z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:`w-4 h-4 transition-transform duration-200 ${t?"rotate-90":""}`,children:z.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})}),Ayn=t=>{let e=t;for(;e.activeSubSolver;)e=e.activeSubSolver;return e},cyn=({solver:t,onStepUntilPhase:e,onDownloadInput:n,isNested:o=!1,indentLevel:i=0,triggerRender:r})=>{const[s,a]=ee.useState(new Set),A=t.pipelineDef.map((p,_)=>nqi(t,_)),c=p=>{a(_=>{const f=new Set(_);return f.has(p)?f.delete(p):f.add(p),f})},l=p=>{e?.(p)},g=p=>{p.solverInstance&&(n?n(p.solverInstance,p.name):aqi(p.solverInstance,p.name))},u=p=>`${(p/1e3).toFixed(2)}s`,h=()=>{if(!t.solved&&!t.failed){const p=t.activeSubSolver;for(;!t.solved&&!t.failed&&(t.step(),!(t.activeSubSolver&&t.activeSubSolver!==p)););r?.()}},d=()=>{if(!t.solved&&!t.failed){const p=Ayn(t);for(;!t.solved&&!t.failed&&(t.step(),Ayn(t)===p););r?.()}},m=i*24;return z.jsxs("div",{className:o?"":"border-t border-gray-200",children:[!o&&z.jsxs("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200 flex items-center justify-between",children:[z.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Stages"}),z.jsxs("div",{className:"flex gap-2",children:[z.jsx("button",{onClick:d,disabled:t.solved||t.failed,className:"bg-indigo-500 hover:bg-indigo-600 disabled:bg-gray-300 disabled:cursor-not-allowed cursor-pointer text-white px-3 py-1 rounded text-sm",children:"Next Solver"}),z.jsx("button",{onClick:h,disabled:t.solved||t.failed,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 disabled:cursor-not-allowed cursor-pointer text-white px-3 py-1 rounded text-sm",children:"Next Stage"})]})]}),z.jsx("div",{className:"overflow-x-auto",children:z.jsxs("table",{className:"w-full text-sm",children:[!o&&z.jsx("thead",{children:z.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stage"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),z.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",z.jsx("sub",{children:"0"})]}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),z.jsx("tbody",{children:A.map(p=>{const _=eqi(p.solverInstance),f=s.has(p.name);return z.jsxs(ks.Fragment,{children:[z.jsxs("tr",{className:`border-b border-gray-100 ${p.status==="In Progress"?"bg-yellow-50":""}`,children:[z.jsx("td",{className:"px-4 py-2",children:z.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:m},children:[_?z.jsx("button",{onClick:()=>c(p.name),className:"text-gray-500 hover:text-gray-700",title:f?"Collapse":"Expand",children:z.jsx(Aqi,{expanded:f})}):z.jsx("span",{className:"w-4"}),z.jsx("span",{className:"text-gray-400 w-6",children:String(p.index+1).padStart(2,"0")}),z.jsx("button",{onClick:()=>l(p.name),disabled:p.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${p.name} completes`,children:z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:z.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),z.jsx("span",{className:"font-medium text-gray-900",children:p.name})]})}),z.jsx("td",{className:"px-4 py-2",children:z.jsx(oqi,{status:p.status})}),z.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:p.firstIteration!==null?p.firstIteration:""}),z.jsx("td",{className:"px-4 py-2 text-gray-600",children:p.iterations}),z.jsx("td",{className:"px-4 py-2",children:z.jsx(iqi,{progress:p.progress})}),z.jsx("td",{className:"px-4 py-2 text-gray-600",children:u(p.timeSpent)}),z.jsx("td",{className:"px-4 py-2 text-gray-500",children:z.jsx(sqi,{stats:p.stats})}),z.jsx("td",{className:"px-4 py-2",children:p.solverInstance?z.jsxs("button",{onClick:()=>g(p),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${p.name}`,children:[z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:z.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),z.jsx("span",{children:"Input"})]}):null})]}),_&&f&&z.jsx("tr",{children:z.jsx("td",{colSpan:8,className:"p-0",children:z.jsx(cyn,{solver:p.solverInstance,onStepUntilPhase:e,onDownloadInput:n,isNested:!0,indentLevel:i+1,triggerRender:r})})})]},p.name)})})]})})]})};function cqi({graphics:t}){const e=t.points??[],n=t.lines??[],o=t.rects??[],i=t.circles??[],r=t.texts??[];let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;const l=(p,_)=>{typeof p=="number"&&(p<s&&(s=p),p>A&&(A=p)),typeof _=="number"&&(_<a&&(a=_),_>c&&(c=_))};for(const p of e)l(p.x,p.y);for(const p of n){const _=p.points??[];for(const f of _)l(f.x,f.y)}for(const p of o){const _=p.x??0,f=p.y??0,I=p.width??0,C=p.height??0;l(_,f),l(_+I,f+C)}for(const p of i){const _=p.x??0,f=p.y??0,I=p.radius??1;l(_-I,f-I),l(_+I,f+I)}for(const p of r)l(p.x,p.y);(!isFinite(s)||!isFinite(a)||!isFinite(A)||!isFinite(c))&&(s=-20,a=-20,A=20,c=20);const g=10,u=s-g,h=a-g,d=Math.max(1,A-s+2*g),m=Math.max(1,c-a+2*g);return z.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${u} ${h} ${d} ${m}`,role:"img","aria-label":"Graphics fallback",children:[o.map((p,_)=>z.jsx("rect",{x:p.x??0,y:p.y??0,width:p.width??0,height:p.height??0,fill:"none",stroke:p.strokeColor??"black",strokeWidth:p.strokeWidth??1},`rect-${_}`)),n.map((p,_)=>z.jsx("polyline",{fill:"none",stroke:p.strokeColor??"black",strokeWidth:p.strokeWidth??1,points:(p.points??[]).map(f=>`${f.x??0},${f.y??0}`).join(" ")},`line-${_}`)),i.map((p,_)=>z.jsx("circle",{cx:p.x??0,cy:p.y??0,r:p.radius??1.5,fill:p.fillColor??"none",stroke:p.strokeColor??"black",strokeWidth:p.strokeWidth??1},`circle-${_}`)),e.map((p,_)=>z.jsx("circle",{cx:p.x??0,cy:p.y??0,r:p.radius??1.5,fill:p.color??"black"},`point-${_}`)),r.map((p,_)=>z.jsx("text",{x:p.x??0,y:p.y??0,fontSize:p.fontSize??10,fill:p.color??"black",children:p.text??""},`text-${_}`))]})}var lqi=class extends ks.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}},gqi=({solver:t,createSolver:e,animationSpeed:n=25,onSolverStarted:o,onSolverCompleted:i})=>{const[r,s]=ee.useReducer(f=>f+1,0),[a]=ee.useState(()=>{if(e)return e();if(!t)throw new Error("GenericSolverDebugger requires solver or createSolver");return t}),[A,c]=ee.useState(()=>typeof window>"u"?"vector":window.localStorage.getItem("solver-utils-renderer")==="canvas"?"canvas":"vector"),[l,g]=ee.useState(n),u=ee.useMemo(()=>{try{return a.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(f){return console.error("Visualization error:",f),{points:[],lines:[],rects:[],circles:[]}}},[a,r]),h=ee.useMemo(()=>(u.rects?.length||0)===0&&(u.lines?.length||0)===0&&(u.points?.length||0)===0&&(u.circles?.length||0)===0,[u]);ee.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const f=document.createElement("script");f.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(f)}},[]),ee.useEffect(()=>{g(n)},[n]);const d=a.pipelineDef!==void 0,m=f=>{const I=a;if(!a.solved&&!a.failed){for(;!a.solved&&!a.failed&&I.currentPipelineStageIndex<=I.pipelineDef.findIndex(C=>C.solverName===f);)a.step();s()}},p=()=>{const f=JSON.stringify(u,null,2),I=new Blob([f],{type:"application/json"}),C=URL.createObjectURL(I),y=document.createElement("a");y.download="visualization.json",y.href=C,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(C)},_=f=>{c(f),typeof window<"u"&&window.localStorage.setItem("solver-utils-renderer",f)};return z.jsxs("div",{children:[z.jsx(Zji,{solver:a,triggerRender:s,animationSpeed:l,renderer:A,onRendererChange:_,onAnimationSpeedChange:g,onDownloadVisualization:p,onSolverStarted:o,onSolverCompleted:i}),h?z.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):z.jsx(lqi,{fallback:z.jsx(cqi,{graphics:u}),children:A==="canvas"?z.jsx(qji,{graphics:u}):z.jsx(Jji,{graphics:u})}),d&&z.jsx(cyn,{solver:a,onStepUntilPhase:m,triggerRender:s})]})};const uqi=()=>{ee.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const e=document.createElement("div");e.className="hidden",document.body.appendChild(e);const n=window.getComputedStyle(e).display==="none";if(document.body.removeChild(e),n)return;const o=document.createElement("script");o.id=t,o.src="https://cdn.tailwindcss.com",document.head.appendChild(o)},[])},dqi=1e3,GE=(t,e)=>{const{fileName:n,mimeType:o="text/plain"}=e,i=t instanceof Blob?t:new Blob([t],{type:o}),r=URL.createObjectURL(i),s=document.createElement("a");s.href=r,s.download=n,s.target="_blank",s.rel="noopener noreferrer",s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>{URL.revokeObjectURL(r)},dqi)},DXe=t=>{let e=t.trim().replace(/[\\/:*?"<>|]/g,"_").replace(/[\x00-\x1f]/g,"").replace(/^\.+/,"").replace(/\.+$/,"").replace(/\s+/g," ").replace(/_+/g,"_");return/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i.test(e)&&(e=`_${e}`),e=e.slice(0,200),e||"untitled"},hqi=t=>{const e=t.solverConstructorArgs??[t.solverParams];if(t.solverName!=="AutoroutingPipelineSolver7_MultiGraph"||e.length!==1)return e;const[{input:n,options:o}]=e;return[n,o]},_8="https://github.com/tscircuit/tscircuit-autorouter/issues/new",lyn="https://github.com/tscircuit/copper-pour-solver/issues/new",gyn="https://github.com/tscircuit/calculate-packing/issues/new",mqi="https://github.com/tscircuit/matchpack/issues/new",uyn="https://github.com/tscircuit/schematic-trace-solver/issues/new?template=json-bug-report.yml",pqi={PackSolver2:gyn,LayoutPipelineSolver:mqi,AutoroutingPipelineSolver:_8,AssignableAutoroutingPipeline2:_8,AssignableAutoroutingPipeline3:_8,AutoroutingPipeline1_OriginalUnravel:_8,AutoroutingPipelineSolver3_HgPortPointPathing:_8,AutoroutingPipelineSolver4:_8,AutoroutingPipelineSolver5:_8,AutoroutingPipelineSolver7_MultiGraph:_8,AutoroutingPipelineSolver8:_8,CopperPourPipelineSolver:lyn,SchematicTracePipelineSolver:uyn},_qi=t=>t.toLowerCase().includes("pack")?yGi:t.toLowerCase().includes("rout")?zfn:dGi,dyn=t=>{const e=pqi[t];if(e)return e;const n=t.toLowerCase();return n.includes("autorout")?_8:n.includes("schematic")&&n.includes("trace")?uyn:n.includes("copperpour")?lyn:n.includes("pack")?gyn:null},fqi=t=>`${DXe(`${t.componentName}-${t.solverName}`)}-solver-input.json`,hyn=t=>{GE(JSON.stringify(t.solverParams,null,2),{fileName:fqi(t),mimeType:"application/json"})},Iqi=({solverEvent:t})=>{const e=dyn(t.solverName);return z.jsxs("div",{className:"rf-flex rf-items-center rf-justify-end rf-gap-2 rf-border-b rf-border-gray-200 rf-bg-gray-50 rf-px-4 rf-py-2",children:[z.jsxs(Xc,{type:"button",variant:"outline",size:"sm",onClick:()=>hyn(t),children:[z.jsx(pee,{className:"rf-w-4 rf-h-4"}),"Download"]}),e?z.jsx(Xc,{asChild:!0,variant:"outline",size:"sm",children:z.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[z.jsx(k_e,{className:"rf-w-4 rf-h-4"}),"Report"]})}):z.jsxs(Xc,{type:"button",variant:"outline",size:"sm",disabled:!0,title:"No report link configured for this solver",children:[z.jsx(k_e,{className:"rf-w-4 rf-h-4"}),"Report"]})]})},Cqi=({solverEvent:t})=>{const e=dyn(t.solverName);return e?z.jsx(Xc,{asChild:!0,variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",children:z.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:"Report solver bug","aria-label":"Report solver bug",children:z.jsx(k_e,{className:"rf-w-4 rf-h-4"})})}):z.jsx(Xc,{type:"button",variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",disabled:!0,title:"No report link configured for this solver","aria-label":"Report solver bug",children:z.jsx(k_e,{className:"rf-w-4 rf-h-4"})})},yqi=({solverEvents:t=[]})=>{const[e,n]=ee.useState(null);uqi();const o=ee.useMemo(()=>{const a=new Map;for(const A of t){const c=`${A.componentName}-${A.solverName}`;a.set(c,A)}return a},[t]),i=ee.useMemo(()=>Array.from(o.keys()),[o]),r=e?o.get(e):null,s=ee.useMemo(()=>{if(!r)return{instance:null,error:null,classFound:!1};const a=ske[r.solverName];if(!a)return{instance:null,error:`Solver class "${r.solverName}" not found in SOLVERS registry. Available: ${Object.keys(ske).join(", ")}`,classFound:!1};try{return{instance:new a(...hqi(r)),error:null,classFound:!0}}catch(A){const c=A instanceof Error?A.message:String(A);return console.error("Failed to reconstruct solver:",A),{instance:null,error:`Failed to instantiate solver: ${c}`,classFound:!0}}},[r]);return t.length===0?z.jsx("div",{className:"rf-p-4",children:z.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:z.jsxs("div",{className:"rf-p-4",children:[z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),z.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):z.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[z.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[z.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[i.length," ",i.length===1?"Solver":"Solvers"]}),i.map(a=>{const A=o.get(a),c=e===a;return z.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${c?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>n(a),children:(()=>{const l=_qi(A.solverName);return z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[z.jsx(l,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),z.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[z.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:A.componentName}),z.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:A.solverName})]})]})})()},a)})]}),z.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:r?s.instance?z.jsxs("div",{className:"rf-flex rf-h-full rf-flex-col rf-overflow-y-auto",children:[z.jsx(Iqi,{solverEvent:r}),z.jsx("div",{className:"rf-min-h-0 rf-flex-1",children:z.jsx(d9,{fallback:z.jsx("div",{className:"rf-p-4",children:z.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),z.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",r.solverName]})]})}),children:z.jsx(gqi,{solver:s.instance})})})]}):z.jsxs("div",{className:"rf-p-4",children:[z.jsxs("div",{className:"rf-mb-4",children:[z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:r.solverName}),z.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",r.componentName]})]}),s.error&&z.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:z.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),z.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[z.jsxs("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50 rf-flex rf-items-center rf-justify-between rf-gap-2",children:[z.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"}),z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-1",children:[z.jsx(Cqi,{solverEvent:r}),z.jsx(Xc,{type:"button",variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8","aria-label":"Download solver input JSON",title:"Download solver input JSON",onClick:()=>hyn(r),children:z.jsx(pee,{className:"rf-w-4 rf-h-4"})})]})]}),z.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:z.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(r.solverParams,null,2)})})]})]}):z.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:z.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},xqi=new Map([["custom","Custom"],["fanout","Fanout"],["single_layer_fanout","Single layer fanout"],["tscircuit_simplify","Simplify"]]),Eqi=new Set(["tscircuit","default","auto","auto_local"]);function Bqi(t){if(t==="FanoutSolver")return"Fanout";if(t==="AutoroutingPipelineSolver11_Simplification")return"Simplify";const e=t.match(/^AutoroutingPipeline(?:Solver)?(\d+)(?:_|$)/);if(e)return`Pipeline${e[1]}`;const n=t.match(/^AssignableAutoroutingPipeline(\d+)$/);return n?`Assignable${n[1]}`:t}function bqi(t){const e=t.autorouterName?.trim(),n=e?.replace(/-/g,"_"),o=n&&xqi.get(n);if(o)return o;if(n&&!Eqi.has(n))return e;const i=t.solverName?.trim();if(i)return Bqi(i);const r=t.autorouterVersion?.trim();if(r){const s=r.match(/^beta[_-]pipeline(\d+)$/);return s?`Pipeline${s[1]}`:r==="latest"?"default":r}return e?"default":"Unknown"}const NXe="#fbbf24";function Sqi(t){const e=t.endSimpleRouteJson?.traces??[],n=new Set(e.flatMap(i=>[i.pcb_trace_id,i.__replaces_pcb_trace_id].filter(r=>r!==void 0)));return[...(t.startSimpleRouteJson?.traces??[]).filter(i=>!n.has(i.pcb_trace_id)),...e]}function myn(t){const e=new Map((t.startSimpleRouteJson?.traces??[]).map(n=>[n.pcb_trace_id,n]));return(t.endSimpleRouteJson?.traces??[]).filter(n=>{const o=e.get(n.pcb_trace_id);return!o||!!n.__replaces_pcb_trace_id&&n.__replaces_pcb_trace_id!==o.__replaces_pcb_trace_id||JSON.stringify(o.route)!==JSON.stringify(n.route)}).map(n=>n.pcb_trace_id)}function Qqi(t,e){return{outer_diameter:t.via_diameter??e.minViaPadDiameter??e.min_via_pad_diameter??e.minViaDiameter??.6,hole_diameter:t.via_hole_diameter??e.minViaHoleDiameter??e.min_via_hole_diameter??.3}}function pyn(t,e){const n=[];for(const a of t.route)a.route_type==="wire"?n.push({...a,layer:a.layer}):a.route_type==="via"?n.push({route_type:"via",x:a.x,y:a.y,from_layer:a.from_layer,to_layer:a.to_layer,...Qqi(a,e)}):a.route_type==="through_obstacle"&&n.push({route_type:"through_pad",start:{...a.start},end:{...a.end},width:a.width,start_layer:a.from_layer,end_layer:a.to_layer,pcb_smtpad_id:a.circuitJsonMetadata?.pcb_smtpad_id,pcb_plated_hole_id:a.circuitJsonMetadata?.pcb_plated_hole_id});const o=a=>{let A=-1,c=Number.POSITIVE_INFINITY;return n.forEach((l,g)=>{if(l.route_type!=="wire")return;const u=Math.hypot(l.x-a.x,l.y-a.y);u<c&&(c=u,A=g)}),A},i=t.route.filter(a=>a.route_type==="jumper").map(a=>[o(a.start),o(a.end)].sort((A,c)=>A-c)).filter(([a,A])=>a>=0&&A>a).sort(([a],[A])=>a-A),r=[];let s=0;for(const[a,A]of i)a>=s&&r.push(n.slice(s,a+1)),s=Math.max(s,A);return s<n.length&&r.push(n.slice(s)),r}function vqi(t){const e=[],n=[],o=t.endSimpleRouteJson;if(!o)return{lines:e,circles:n};const i=new Set(myn(t));for(const r of o.traces??[])if(i.has(r.pcb_trace_id))for(const s of pyn(r,o)){let a;for(const A of s){if(A.route_type==="through_pad"){a={...A.end,layer:A.end_layer,width:A.width};continue}const c=A.route_type==="wire"?A.layer:A.from_layer;a&&a.layer===c&&(a.x!==A.x||a.y!==A.y)&&e.push({points:[{x:a.x,y:a.y},{x:A.x,y:A.y}],strokeWidth:A.route_type==="wire"?A.width:a.width,strokeColor:NXe,layer:c}),A.route_type==="via"&&n.push({center:{x:A.x,y:A.y},radius:A.outer_diameter/2,stroke:NXe,fill:"transparent"}),a={x:A.x,y:A.y,layer:A.route_type==="wire"?A.layer:A.to_layer,width:A.route_type==="wire"?A.width:a?.width??o.minTraceWidth}}}return{coordinateSystem:"cartesian",lines:e,circles:n}}function wqi(t){const e=JSON.stringify(t);let n=2166136261;for(let o=0;o<e.length;o++)n=Math.imul(n^e.charCodeAt(o),16777619);return(n>>>0).toString(36)}const Pqi=new Set(["pcb_trace","pcb_via","pcb_copper_pour","pcb_ground_plane","pcb_ground_plane_region","pcb_thermal_spoke","pcb_breakout_point"]);function Mqi(t,e,n){const o=n==="input"?e.startSimpleRouteJson??e.errorSimpleRouteJson:e.endSimpleRouteJson,i=t.filter(c=>!Pqi.has(c.type)&&!c.type.endsWith("_error")&&!c.type.endsWith("_warning"));if(!o)return i;const r=n==="input"?o.traces??[]:Sqi(e),s=new Set(t.filter(c=>c.type==="source_trace").map(c=>c.source_trace_id)),a=["top",...Array.from({length:Math.max(0,o.layerCount-2)},(c,l)=>`inner${l+1}`),...o.layerCount>1?["bottom"]:[]],A=[];for(const c of r){const g=o.connections.find(h=>h.name===c.connection_name||h.source_trace_id===c.connection_name)?.source_trace_id??c.connection_name??"",u=pyn(c,o);for(const[h,d]of u.entries()){const m={type:"pcb_trace",pcb_trace_id:`${e.id}_${n}_${c.pcb_trace_id}_${h}_${wqi(d)}`,subcircuit_id:e.subcircuit_id??void 0,source_trace_id:s.has(g)?g:void 0,route:d};A.push(m);for(const[p,_]of d.entries()){if(_.route_type!=="via")continue;const f=a.indexOf(_.from_layer),I=a.indexOf(_.to_layer),C={type:"pcb_via",pcb_via_id:`${m.pcb_trace_id}_via_${p}`,pcb_trace_id:m.pcb_trace_id,subcircuit_id:e.subcircuit_id??void 0,x:_.x,y:_.y,outer_diameter:_.outer_diameter,hole_diameter:_.hole_diameter,layers:f>=0&&I>=0?a.slice(Math.min(f,I),Math.max(f,I)+1):[_.from_layer,_.to_layer]};A.push(C)}}}return[...i,...A]}const RXe=(t,e)=>t.phaseName||`Phase ${t.phaseOrdinal??e+1}`,_yn=t=>t.componentDisplayName?.match(/name="([^"]+)"/)?.[1]?.replace(/^\./,"")||t.componentDisplayName||t.subcircuit_id||"Board",fyn=t=>t.startSimpleRouteJson??t.endSimpleRouteJson??t.errorSimpleRouteJson,Dqi={is_showing_autorouting:!0,is_showing_rats_nest:!1,is_showing_drc_errors:!1,is_showing_drc_warnings:!1,is_showing_pcb_groups:!1},Nqi=({circuitJson:t,phases:e=[],isRunning:n=!1})=>{const[o,i]=ee.useState(null),[r,s]=ee.useState("output"),[a,A]=ee.useState(!0),[c,l]=ee.useState(!1),g=ee.useRef(null),[u,h]=ee.useState(480),d=o?e.findIndex(R=>R.id===o.id&&fyn(R)===fyn(o)):-1,m=d<0?e.length-1:d,p=e[m],_=d<0,f=!!p?.endSimpleRouteJson,I=p?.startSimpleRouteJson??p?.errorSimpleRouteJson,C=!!I,y=r==="output"&&!f?"input":r==="input"&&!C?"output":r,x=y==="input"?I:p?.endSimpleRouteJson,E=ee.useMemo(()=>!p||!x?null:Mqi(t??[],p,y),[t,p,x,y]),B=ee.useMemo(()=>p&&y==="output"&&a?vqi(p):{lines:[],circles:[]},[p,y,a]);if(ee.useLayoutEffect(()=>{const R=g.current;if(!R)return;const F=()=>h(Math.max(360,R.clientHeight));F();const O=new ResizeObserver(F);return O.observe(R),()=>O.disconnect()},[!!p]),!p)return z.jsxs("div",{className:"rf-flex rf-min-h-[400px] rf-flex-col rf-items-center rf-justify-center rf-gap-3 rf-p-8 rf-text-center",children:[z.jsx(zfn,{className:"rf-h-7 rf-w-7 rf-text-blue-500"}),z.jsx("h3",{className:"rf-text-base rf-font-medium",children:n?"Waiting for autorouting":"No autorouting captures"}),z.jsx("p",{className:"rf-max-w-md rf-text-sm rf-text-gray-500",children:n?"Phases appear as the circuit routes. Each capture includes its input and output on the PCB.":"Run a circuit with autorouting enabled to inspect its phases. A circuit JSON file alone does not include routing history."})]});const S=RXe(p,m),Q=p.status==="running"&&n,w=!f,M=I?.connections.length,T=E?.filter(R=>R.type==="pcb_trace").length??0;return z.jsxs("div",{className:"rf-flex rf-h-full rf-min-h-[620px] rf-flex-col rf-bg-white md:rf-flex-row","data-testid":"autorouting-explorer",children:[z.jsxs("aside",{className:"rf-flex rf-shrink-0 rf-flex-col rf-border-b rf-border-gray-200 md:rf-w-52 md:rf-border-b-0 md:rf-border-r","aria-label":"Routing phases",children:[z.jsxs("div",{className:"rf-flex rf-items-center rf-justify-between rf-px-3 rf-py-2 rf-text-xs rf-text-gray-500",children:[z.jsx("span",{children:"Routing phases"}),z.jsx("span",{children:e.length})]}),z.jsx("div",{className:"rf-flex rf-gap-1 rf-overflow-x-auto rf-px-1.5 rf-pb-1.5 md:rf-flex-col md:rf-overflow-x-hidden md:rf-overflow-y-auto",children:e.map((R,F)=>{const O=myn(R).length,U=R.endSimpleRouteJson?`${O} ${O===1?"trace":"traces"} routed`:R.status==="error"?"Failed":R.status==="running"&&n?"Routing…":"No output";return z.jsxs("button",{type:"button","aria-pressed":F===m,title:`${_yn(R)} · ${U}`,onClick:()=>i(R),className:zr("rf-flex rf-min-w-[192px] rf-items-start rf-gap-2 rf-rounded-md rf-border rf-px-2 rf-py-2 rf-text-left md:rf-min-w-0",F===m?"rf-border-blue-200 rf-bg-blue-50":"rf-border-transparent hover:rf-bg-gray-50"),children:[z.jsx("span",{className:zr("rf-flex rf-h-5 rf-w-5 rf-shrink-0 rf-items-center rf-justify-center rf-rounded-full rf-text-[11px]",F===m?"rf-bg-blue-600 rf-text-white":"rf-bg-gray-100 rf-text-gray-500"),children:F+1}),z.jsxs("span",{className:"rf-min-w-0 rf-flex-1",children:[z.jsxs("span",{className:"rf-flex rf-items-center rf-gap-1",children:[z.jsx("span",{className:"rf-min-w-0 rf-flex-1 rf-truncate rf-text-xs rf-font-medium rf-leading-5 rf-text-gray-800",title:RXe(R,F),children:RXe(R,F)}),R.status==="complete"?z.jsx(mee,{"aria-label":"Captured",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-green-600"}):R.status==="error"?z.jsx(Xqe,{"aria-label":"Failed",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-red-500"}):n?z.jsx(v4,{"aria-label":"Routing",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-animate-spin rf-text-blue-500"}):null]}),z.jsxs("span",{className:"rf-block rf-text-[11px] rf-leading-4 rf-text-gray-500",children:[bqi(R)," · ",U]})]})]},R.id)})})]}),z.jsxs("div",{className:"rf-flex rf-min-w-0 rf-flex-1 rf-flex-col",children:[z.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-gap-3 rf-border-b rf-border-gray-200 rf-px-4 rf-py-3",children:[z.jsxs("h3",{className:"rf-mr-auto rf-flex rf-items-center rf-gap-2 rf-text-sm rf-font-medium",children:[S,z.jsxs("span",{className:"rf-text-xs rf-font-normal rf-text-gray-500",children:[m+1," of ",e.length]})]}),n&&z.jsx("button",{type:"button",onClick:()=>i(null),disabled:_,className:"rf-text-xs rf-text-blue-600 disabled:rf-text-gray-500",children:_?"Following latest":"Follow latest"}),z.jsx("div",{className:"rf-flex rf-rounded-md rf-bg-gray-100 rf-p-1","aria-label":"Phase snapshot",children:["input","output"].map(R=>z.jsx("button",{type:"button","aria-pressed":y===R,disabled:R==="input"?!C:!f,onClick:()=>s(R),className:zr("rf-rounded rf-px-3 rf-py-1 rf-text-xs disabled:rf-opacity-40",y===R?"rf-bg-white rf-text-gray-900 rf-shadow-sm":"rf-text-gray-500"),children:R==="input"?"Input":"Output"},R))})]}),z.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-justify-between rf-gap-2 rf-px-4 rf-py-2 rf-text-xs rf-text-gray-600",children:[z.jsxs("label",{className:"rf-flex rf-items-center rf-gap-2",children:[z.jsx("input",{type:"checkbox",checked:a,disabled:y!=="output",onChange:R=>A(R.target.checked),className:"rf-accent-blue-600"}),z.jsx("span",{"aria-hidden":"true",className:"rf-inline-block rf-h-0.5 rf-w-3",style:{backgroundColor:NXe}}),"Highlight changes (all layers)"]}),z.jsxs("span",{children:[y==="input"?"Before this phase":"After this phase"," ","· ",T," traces"]})]}),w&&z.jsx("div",{className:zr("rf-border-y rf-px-4 rf-py-2 rf-text-xs",p.status==="error"?"rf-border-red-100 rf-bg-red-50 rf-text-red-700":"rf-border-blue-100 rf-bg-blue-50 rf-text-blue-700"),role:"status",children:p.status==="error"?`Routing failed: ${p.error?.message||"No output was captured."}`:Q?"Routing in progress. Showing captured input until output is available.":"No output was captured for this phase. Showing the available input."}),z.jsx("div",{ref:g,className:"rf-relative rf-min-h-[360px] rf-flex-1","data-testid":"autorouting-pcb",children:E?z.jsx(jqe,{circuitJson:E,height:u,allowEditing:!1,clickToInteractEnabled:!1,initialState:Dqi,debugGraphics:B}):z.jsx("div",{className:"rf-p-6 rf-text-sm rf-text-gray-500",children:"No PCB snapshot available for this capture."})}),z.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-justify-between rf-gap-2 rf-border-t rf-border-gray-200 rf-px-4 rf-py-3 rf-text-xs rf-text-gray-500",children:[z.jsxs("span",{children:[M===void 0?"Input unavailable":`${M} input connections`,` · ${_yn(p)}`]}),z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-4",children:[z.jsxs("button",{type:"button",disabled:!x,onClick:()=>GE(JSON.stringify(x,null,2),{fileName:`${p.id}-${y}.srj.json`,mimeType:"application/json"}),className:"rf-flex rf-items-center rf-gap-1 disabled:rf-opacity-40",children:[z.jsx(pee,{className:"rf-h-3 rf-w-3"}),"Download SRJ"]}),z.jsxs("button",{type:"button","aria-expanded":c,onClick:()=>l(!c),className:"rf-flex rf-items-center rf-gap-1",children:[z.jsx(VU,{className:zr("rf-h-3 rf-w-3",c&&"rf-rotate-90")}),"Inspect SRJ"]})]})]}),c&&z.jsx("pre",{className:"rf-m-0 rf-max-h-64 rf-overflow-auto rf-border-t rf-border-gray-200 rf-bg-gray-50 rf-p-4 rf-text-xs","aria-label":`${S} ${y} SRJ`,children:x?JSON.stringify(x,null,2):"No snapshot captured."})]})]})},Iyn=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{ee.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{yF.captureException(o)}catch{}}},[t,e]),ee.useEffect(()=>{if(n&&n.length>0)for(const o of n){const i=new Error(o.message||"Circuit JSON Error");o.stack&&(i.stack=o.stack);try{yF.captureException(i,{error_type:o.type})}catch{}}},[n])},Rqi=t=>{ee.useEffect(()=>{try{zMn(t)}catch{}},[t.source,t.component,t.isWebEmbedded,t.activeTab])},Cyn="0.0.2940",Tqi={version:Cyn},TXe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},kXe=new Map,zfe=t=>{const e=kXe.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,o])=>[n,o.getState()])):{}},kqi=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};const o=kXe.get(n.name);if(o)return{type:"tracked",store:t,...o};const i={connection:e.connect(n),stores:{}};return kXe.set(n.name,i),{type:"tracked",store:t,...i}},yyn=(t,e={})=>(n,o,i)=>{const{enabled:r,anonymousActionType:s,store:a,...A}=e;let c;try{c=(r??(TXe?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(TXe?"production":void 0)!=="production"&&r&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,o,i);const{connection:l,...g}=kqi(a,c,A);let u=!0;i.setState=(m,p,_)=>{const f=n(m,p);if(!u)return f;const I=_===void 0?{type:s||"anonymous"}:typeof _=="string"?{type:_}:_;return a===void 0?(l?.send(I,o()),f):(l?.send({...I,type:`${a}/${I.type}`},{...zfe(A.name),[a]:i.getState()}),f)};const h=(...m)=>{const p=u;u=!1,n(...m),u=p},d=t(i.setState,o,i);if(g.type==="untracked"?l?.init(d):(g.stores[g.store]=i,l?.init(Object.fromEntries(Object.entries(g.stores).map(([m,p])=>[m,m===g.store?d:p.getState()])))),i.dispatchFromDevtools&&typeof i.dispatch=="function"){let m=!1;const p=i.dispatch;i.dispatch=(..._)=>{(TXe?"production":void 0)!=="production"&&_[0].type==="__setState"&&!m&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),m=!0),p(..._)}}return l.subscribe(m=>{var p;switch(m.type){case"ACTION":if(typeof m.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return FXe(m.payload,_=>{if(_.type==="__setState"){if(a===void 0){h(_.state);return}Object.keys(_.state).length!==1&&console.error(`
5667
+ `,g=new Blob([l],{type:"text/plain"}),u=URL.createObjectURL(g),h=document.createElement("a");h.href=u,h.download=`${c}.test.ts`,h.click(),URL.revokeObjectURL(u)}catch(A){alert(`Error generating test.ts for ${t.getSolverName()}: ${A instanceof Error?A.message:String(A)}`)}o(!1)};return z.jsxs("div",{className:`relative ${e}`,ref:i,children:[z.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>o(!n),title:`Download options for ${t.getSolverName()}`,children:t.getSolverName()}),n&&z.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download JSON"}),z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:a,children:"Download test.ts"})]})]})},syn=t=>t.activeSubSolver?[t,...syn(t.activeSubSolver)]:[t],Xji=({solver:t})=>{const e=syn(t);return z.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:e.map((n,o)=>z.jsxs("div",{className:"flex items-center",children:[o>0&&z.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),z.jsx($ji,{solver:n})]},n.getSolverName()))})},Zji=({solver:t,triggerRender:e,animationSpeed:n=25,renderer:o,onRendererChange:i,onAnimationSpeedChange:r,onDownloadVisualization:s,onSolverStarted:a,onSolverCompleted:A})=>{const[c,l]=ee.useReducer(B=>!B,!1),g=ee.useRef(void 0),u=ee.useRef(null),h="solver-debugger-last-iteration",[d,m]=ee.useState(null),p=ee.useRef(null),_=ee.useMemo(()=>[{label:"Slow",value:250,description:"250ms"},{label:"Normal",value:100,description:"100ms"},{label:"Fast",value:10,description:"10ms"},{label:"Fast (2x)",value:5,description:"5ms"},{label:"Fast (10x)",value:1,description:"1ms"},{label:"Fast 20x",value:.5,description:"2 steps / 1ms"},{label:"Fast 100x",value:.1,description:"10 steps / 1ms"}],[]),f=()=>{const B=Math.max(1,n),S=n<1?Math.round(1/n):1;g.current=setInterval(()=>{if(t.solved||t.failed){g.current&&(clearInterval(g.current),g.current=void 0),l(),e(),A&&t.solved&&A(t);return}for(let Q=0;Q<S&&!(t.solved||t.failed);Q++)t.step();e()},B)},I=()=>{g.current&&(clearInterval(g.current),g.current=void 0)},C=()=>{!t.solved&&!t.failed&&(t.step(),e())},y=()=>{!t.solved&&!t.failed&&(a&&a(t),t.solve(),e(),A&&A(t))},x=()=>{c?(I(),l()):(l(),f())},E=()=>{if(t.solved||t.failed||c)return;u.current===null&&typeof window<"u"&&(u.current=window.localStorage.getItem(h));const B=window.prompt("Step until which iteration?",u.current??`${t.iterations}`);if(B===null)return;u.current=B,typeof window<"u"&&window.localStorage.setItem(h,B);const S=Number(B);if(!Number.isFinite(S)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<S&&!t.solved&&!t.failed;)t.step();e(),t.solved&&A&&A(t)};return ee.useEffect(()=>()=>{I()},[]),ee.useEffect(()=>{(t.solved||t.failed)&&c&&(I(),l())},[t.solved,t.failed,c]),ee.useEffect(()=>{c&&(I(),f())},[n,c]),ee.useEffect(()=>{if(typeof document>"u")return;const B=S=>{p.current&&!p.current.contains(S.target)&&m(null)};return document.addEventListener("mousedown",B),()=>{document.removeEventListener("mousedown",B)}},[]),z.jsxs("div",{className:"space-y-2 p-2 border-b",children:[z.jsx("div",{className:"flex items-center",children:z.jsxs("div",{className:"flex items-center gap-2",ref:p,children:[z.jsxs("div",{className:"flex h-9 items-center space-x-1 rounded-md border border-slate-200 bg-white p-1 shadow-sm",children:[z.jsxs("div",{className:"relative",children:[z.jsx("button",{type:"button",onClick:()=>m(d==="renderer"?null:"renderer"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="renderer"?"open":"closed",children:"Renderer"}),d==="renderer"&&z.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[10rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:["vector","canvas"].map(B=>z.jsxs("button",{type:"button",onClick:()=>{i(B),m(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[B==="vector"?"Vector":"Canvas",o===B&&z.jsx("span",{className:"ml-auto text-xs text-slate-500",children:"✓"})]},B))})]}),z.jsxs("div",{className:"relative",children:[z.jsx("button",{type:"button",onClick:()=>m(d==="debug"?null:"debug"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="debug"?"open":"closed",children:"Debug"}),d==="debug"&&z.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[12rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:z.jsx("button",{type:"button",onClick:()=>{s(),m(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:"Download Visualization"})})]}),z.jsxs("div",{className:"relative",children:[z.jsx("button",{type:"button",onClick:()=>m(d==="animation"?null:"animation"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="animation"?"open":"closed",children:"Animation"}),d==="animation"&&z.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[12rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:_.map(B=>z.jsxs("button",{type:"button",onClick:()=>{r(B.value),m(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[B.label,z.jsx("span",{className:"ml-auto text-xs text-slate-500",children:B.description}),n===B.value&&z.jsx("span",{className:"ml-2 text-xs text-slate-500",children:"✓"})]},B.value))})]})]}),z.jsx(Xji,{solver:t})]})}),z.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[z.jsx("button",{onClick:C,disabled:t.solved||t.failed||c,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),z.jsx("button",{onClick:y,disabled:t.solved||t.failed||c,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),z.jsx("button",{onClick:x,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${c?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:c?"Stop":"Animate"}),z.jsx("button",{onClick:E,disabled:t.solved||t.failed||c,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),z.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&z.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),t.solved&&z.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&z.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&z.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},eqi=t=>t!==null&&"pipelineDef"in t&&Array.isArray(t.pipelineDef),tqi=(t,e,n)=>{const o=t.currentPipelineStageIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},nqi=(t,e)=>{const o=t.pipelineDef[e].solverName,i=tqi(t,e),r=t[o],s=t.firstIterationOfStage?.[o]??(e===t.currentPipelineStageIndex?t.iterations:null),a=t.iterations;let A=0;if(i==="Completed"){const u=t.pipelineDef[e+1],h=u?t.firstIterationOfStage?.[u.solverName]:void 0;h!==void 0&&s!==null?A=h-s:s!==null&&(A=a-s)}else i==="In Progress"&&s!==null&&(A=a-s);const c=t.timeSpentOnStage?.[o]??0;let l=0;i==="Completed"?l=1:i==="In Progress"&&r&&(l=r.progress??0);const g=r?.stats??null;return{index:e,name:o,status:i,firstIteration:s,iterations:A,progress:l,timeSpent:c,stats:g&&Object.keys(g).length>0?g:null,solverInstance:r??null}},oqi=({status:t})=>{const e={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return z.jsx("span",{className:`font-medium ${e[t]}`,children:t})},iqi=({progress:t})=>{if(t===0)return null;const e=Math.round(t*100);return z.jsxs("div",{className:"flex items-center gap-2",children:[z.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:z.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${e}%`}})}),z.jsxs("span",{className:"text-xs text-gray-500",children:[e,"%"]})]})},ayn=t=>{if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"||t==null)return String(t);if(typeof t=="object")try{return JSON.stringify(t)}catch{return String(t)}return String(t)},rqi=t=>Object.entries(t).map(([e,n])=>`${e}: ${ayn(n)}`).join(", "),sqi=({stats:t})=>{if(!t||Object.keys(t).length===0)return z.jsx("span",{children:"-"});const e=Object.entries(t),n=rqi(t);return z.jsxs("details",{className:"cursor-pointer",children:[z.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:n}),z.jsx("div",{className:"mt-1 text-xs",children:e.map(([o,i])=>z.jsxs("div",{children:[o,": ",ayn(i)]},o))})]})},MXe=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(MXe);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=MXe(o));return e},aqi=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=MXe(t.getConstructorParams()),o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),i=URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=`${e}_input.json`,r.click(),URL.revokeObjectURL(i)}catch(n){alert(`Error downloading input for ${e}: ${n instanceof Error?n.message:String(n)}`)}},Aqi=({expanded:t})=>z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:`w-4 h-4 transition-transform duration-200 ${t?"rotate-90":""}`,children:z.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})}),Ayn=t=>{let e=t;for(;e.activeSubSolver;)e=e.activeSubSolver;return e},cyn=({solver:t,onStepUntilPhase:e,onDownloadInput:n,isNested:o=!1,indentLevel:i=0,triggerRender:r})=>{const[s,a]=ee.useState(new Set),A=t.pipelineDef.map((p,_)=>nqi(t,_)),c=p=>{a(_=>{const f=new Set(_);return f.has(p)?f.delete(p):f.add(p),f})},l=p=>{e?.(p)},g=p=>{p.solverInstance&&(n?n(p.solverInstance,p.name):aqi(p.solverInstance,p.name))},u=p=>`${(p/1e3).toFixed(2)}s`,h=()=>{if(!t.solved&&!t.failed){const p=t.activeSubSolver;for(;!t.solved&&!t.failed&&(t.step(),!(t.activeSubSolver&&t.activeSubSolver!==p)););r?.()}},d=()=>{if(!t.solved&&!t.failed){const p=Ayn(t);for(;!t.solved&&!t.failed&&(t.step(),Ayn(t)===p););r?.()}},m=i*24;return z.jsxs("div",{className:o?"":"border-t border-gray-200",children:[!o&&z.jsxs("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200 flex items-center justify-between",children:[z.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Stages"}),z.jsxs("div",{className:"flex gap-2",children:[z.jsx("button",{onClick:d,disabled:t.solved||t.failed,className:"bg-indigo-500 hover:bg-indigo-600 disabled:bg-gray-300 disabled:cursor-not-allowed cursor-pointer text-white px-3 py-1 rounded text-sm",children:"Next Solver"}),z.jsx("button",{onClick:h,disabled:t.solved||t.failed,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 disabled:cursor-not-allowed cursor-pointer text-white px-3 py-1 rounded text-sm",children:"Next Stage"})]})]}),z.jsx("div",{className:"overflow-x-auto",children:z.jsxs("table",{className:"w-full text-sm",children:[!o&&z.jsx("thead",{children:z.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stage"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),z.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",z.jsx("sub",{children:"0"})]}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),z.jsx("tbody",{children:A.map(p=>{const _=eqi(p.solverInstance),f=s.has(p.name);return z.jsxs(ks.Fragment,{children:[z.jsxs("tr",{className:`border-b border-gray-100 ${p.status==="In Progress"?"bg-yellow-50":""}`,children:[z.jsx("td",{className:"px-4 py-2",children:z.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:m},children:[_?z.jsx("button",{onClick:()=>c(p.name),className:"text-gray-500 hover:text-gray-700",title:f?"Collapse":"Expand",children:z.jsx(Aqi,{expanded:f})}):z.jsx("span",{className:"w-4"}),z.jsx("span",{className:"text-gray-400 w-6",children:String(p.index+1).padStart(2,"0")}),z.jsx("button",{onClick:()=>l(p.name),disabled:p.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${p.name} completes`,children:z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:z.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),z.jsx("span",{className:"font-medium text-gray-900",children:p.name})]})}),z.jsx("td",{className:"px-4 py-2",children:z.jsx(oqi,{status:p.status})}),z.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:p.firstIteration!==null?p.firstIteration:""}),z.jsx("td",{className:"px-4 py-2 text-gray-600",children:p.iterations}),z.jsx("td",{className:"px-4 py-2",children:z.jsx(iqi,{progress:p.progress})}),z.jsx("td",{className:"px-4 py-2 text-gray-600",children:u(p.timeSpent)}),z.jsx("td",{className:"px-4 py-2 text-gray-500",children:z.jsx(sqi,{stats:p.stats})}),z.jsx("td",{className:"px-4 py-2",children:p.solverInstance?z.jsxs("button",{onClick:()=>g(p),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${p.name}`,children:[z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:z.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),z.jsx("span",{children:"Input"})]}):null})]}),_&&f&&z.jsx("tr",{children:z.jsx("td",{colSpan:8,className:"p-0",children:z.jsx(cyn,{solver:p.solverInstance,onStepUntilPhase:e,onDownloadInput:n,isNested:!0,indentLevel:i+1,triggerRender:r})})})]},p.name)})})]})})]})};function cqi({graphics:t}){const e=t.points??[],n=t.lines??[],o=t.rects??[],i=t.circles??[],r=t.texts??[];let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;const l=(p,_)=>{typeof p=="number"&&(p<s&&(s=p),p>A&&(A=p)),typeof _=="number"&&(_<a&&(a=_),_>c&&(c=_))};for(const p of e)l(p.x,p.y);for(const p of n){const _=p.points??[];for(const f of _)l(f.x,f.y)}for(const p of o){const _=p.x??0,f=p.y??0,I=p.width??0,C=p.height??0;l(_,f),l(_+I,f+C)}for(const p of i){const _=p.x??0,f=p.y??0,I=p.radius??1;l(_-I,f-I),l(_+I,f+I)}for(const p of r)l(p.x,p.y);(!isFinite(s)||!isFinite(a)||!isFinite(A)||!isFinite(c))&&(s=-20,a=-20,A=20,c=20);const g=10,u=s-g,h=a-g,d=Math.max(1,A-s+2*g),m=Math.max(1,c-a+2*g);return z.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${u} ${h} ${d} ${m}`,role:"img","aria-label":"Graphics fallback",children:[o.map((p,_)=>z.jsx("rect",{x:p.x??0,y:p.y??0,width:p.width??0,height:p.height??0,fill:"none",stroke:p.strokeColor??"black",strokeWidth:p.strokeWidth??1},`rect-${_}`)),n.map((p,_)=>z.jsx("polyline",{fill:"none",stroke:p.strokeColor??"black",strokeWidth:p.strokeWidth??1,points:(p.points??[]).map(f=>`${f.x??0},${f.y??0}`).join(" ")},`line-${_}`)),i.map((p,_)=>z.jsx("circle",{cx:p.x??0,cy:p.y??0,r:p.radius??1.5,fill:p.fillColor??"none",stroke:p.strokeColor??"black",strokeWidth:p.strokeWidth??1},`circle-${_}`)),e.map((p,_)=>z.jsx("circle",{cx:p.x??0,cy:p.y??0,r:p.radius??1.5,fill:p.color??"black"},`point-${_}`)),r.map((p,_)=>z.jsx("text",{x:p.x??0,y:p.y??0,fontSize:p.fontSize??10,fill:p.color??"black",children:p.text??""},`text-${_}`))]})}var lqi=class extends ks.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}},gqi=({solver:t,createSolver:e,animationSpeed:n=25,onSolverStarted:o,onSolverCompleted:i})=>{const[r,s]=ee.useReducer(f=>f+1,0),[a]=ee.useState(()=>{if(e)return e();if(!t)throw new Error("GenericSolverDebugger requires solver or createSolver");return t}),[A,c]=ee.useState(()=>typeof window>"u"?"vector":window.localStorage.getItem("solver-utils-renderer")==="canvas"?"canvas":"vector"),[l,g]=ee.useState(n),u=ee.useMemo(()=>{try{return a.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(f){return console.error("Visualization error:",f),{points:[],lines:[],rects:[],circles:[]}}},[a,r]),h=ee.useMemo(()=>(u.rects?.length||0)===0&&(u.lines?.length||0)===0&&(u.points?.length||0)===0&&(u.circles?.length||0)===0,[u]);ee.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const f=document.createElement("script");f.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(f)}},[]),ee.useEffect(()=>{g(n)},[n]);const d=a.pipelineDef!==void 0,m=f=>{const I=a;if(!a.solved&&!a.failed){for(;!a.solved&&!a.failed&&I.currentPipelineStageIndex<=I.pipelineDef.findIndex(C=>C.solverName===f);)a.step();s()}},p=()=>{const f=JSON.stringify(u,null,2),I=new Blob([f],{type:"application/json"}),C=URL.createObjectURL(I),y=document.createElement("a");y.download="visualization.json",y.href=C,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(C)},_=f=>{c(f),typeof window<"u"&&window.localStorage.setItem("solver-utils-renderer",f)};return z.jsxs("div",{children:[z.jsx(Zji,{solver:a,triggerRender:s,animationSpeed:l,renderer:A,onRendererChange:_,onAnimationSpeedChange:g,onDownloadVisualization:p,onSolverStarted:o,onSolverCompleted:i}),h?z.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):z.jsx(lqi,{fallback:z.jsx(cqi,{graphics:u}),children:A==="canvas"?z.jsx(qji,{graphics:u}):z.jsx(Jji,{graphics:u})}),d&&z.jsx(cyn,{solver:a,onStepUntilPhase:m,triggerRender:s})]})};const uqi=()=>{ee.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const e=document.createElement("div");e.className="hidden",document.body.appendChild(e);const n=window.getComputedStyle(e).display==="none";if(document.body.removeChild(e),n)return;const o=document.createElement("script");o.id=t,o.src="https://cdn.tailwindcss.com",document.head.appendChild(o)},[])},dqi=1e3,GE=(t,e)=>{const{fileName:n,mimeType:o="text/plain"}=e,i=t instanceof Blob?t:new Blob([t],{type:o}),r=URL.createObjectURL(i),s=document.createElement("a");s.href=r,s.download=n,s.target="_blank",s.rel="noopener noreferrer",s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>{URL.revokeObjectURL(r)},dqi)},DXe=t=>{let e=t.trim().replace(/[\\/:*?"<>|]/g,"_").replace(/[\x00-\x1f]/g,"").replace(/^\.+/,"").replace(/\.+$/,"").replace(/\s+/g," ").replace(/_+/g,"_");return/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i.test(e)&&(e=`_${e}`),e=e.slice(0,200),e||"untitled"},hqi=t=>{const e=t.solverConstructorArgs??[t.solverParams];if(t.solverName!=="AutoroutingPipelineSolver7_MultiGraph"||e.length!==1)return e;const[{input:n,options:o}]=e;return[n,o]},_8="https://github.com/tscircuit/tscircuit-autorouter/issues/new",lyn="https://github.com/tscircuit/copper-pour-solver/issues/new",gyn="https://github.com/tscircuit/calculate-packing/issues/new",mqi="https://github.com/tscircuit/matchpack/issues/new",uyn="https://github.com/tscircuit/schematic-trace-solver/issues/new?template=json-bug-report.yml",pqi={PackSolver2:gyn,LayoutPipelineSolver:mqi,AutoroutingPipelineSolver:_8,AssignableAutoroutingPipeline2:_8,AssignableAutoroutingPipeline3:_8,AutoroutingPipeline1_OriginalUnravel:_8,AutoroutingPipelineSolver3_HgPortPointPathing:_8,AutoroutingPipelineSolver4:_8,AutoroutingPipelineSolver5:_8,AutoroutingPipelineSolver7_MultiGraph:_8,AutoroutingPipelineSolver8:_8,CopperPourPipelineSolver:lyn,SchematicTracePipelineSolver:uyn},_qi=t=>t.toLowerCase().includes("pack")?yGi:t.toLowerCase().includes("rout")?zfn:dGi,dyn=t=>{const e=pqi[t];if(e)return e;const n=t.toLowerCase();return n.includes("autorout")?_8:n.includes("schematic")&&n.includes("trace")?uyn:n.includes("copperpour")?lyn:n.includes("pack")?gyn:null},fqi=t=>`${DXe(`${t.componentName}-${t.solverName}`)}-solver-input.json`,hyn=t=>{GE(JSON.stringify(t.solverParams,null,2),{fileName:fqi(t),mimeType:"application/json"})},Iqi=({solverEvent:t})=>{const e=dyn(t.solverName);return z.jsxs("div",{className:"rf-flex rf-items-center rf-justify-end rf-gap-2 rf-border-b rf-border-gray-200 rf-bg-gray-50 rf-px-4 rf-py-2",children:[z.jsxs(Xc,{type:"button",variant:"outline",size:"sm",onClick:()=>hyn(t),children:[z.jsx(pee,{className:"rf-w-4 rf-h-4"}),"Download"]}),e?z.jsx(Xc,{asChild:!0,variant:"outline",size:"sm",children:z.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[z.jsx(k_e,{className:"rf-w-4 rf-h-4"}),"Report"]})}):z.jsxs(Xc,{type:"button",variant:"outline",size:"sm",disabled:!0,title:"No report link configured for this solver",children:[z.jsx(k_e,{className:"rf-w-4 rf-h-4"}),"Report"]})]})},Cqi=({solverEvent:t})=>{const e=dyn(t.solverName);return e?z.jsx(Xc,{asChild:!0,variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",children:z.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:"Report solver bug","aria-label":"Report solver bug",children:z.jsx(k_e,{className:"rf-w-4 rf-h-4"})})}):z.jsx(Xc,{type:"button",variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",disabled:!0,title:"No report link configured for this solver","aria-label":"Report solver bug",children:z.jsx(k_e,{className:"rf-w-4 rf-h-4"})})},yqi=({solverEvents:t=[]})=>{const[e,n]=ee.useState(null);uqi();const o=ee.useMemo(()=>{const a=new Map;for(const A of t){const c=`${A.componentName}-${A.solverName}`;a.set(c,A)}return a},[t]),i=ee.useMemo(()=>Array.from(o.keys()),[o]),r=e?o.get(e):null,s=ee.useMemo(()=>{if(!r)return{instance:null,error:null,classFound:!1};const a=ske[r.solverName];if(!a)return{instance:null,error:`Solver class "${r.solverName}" not found in SOLVERS registry. Available: ${Object.keys(ske).join(", ")}`,classFound:!1};try{return{instance:new a(...hqi(r)),error:null,classFound:!0}}catch(A){const c=A instanceof Error?A.message:String(A);return console.error("Failed to reconstruct solver:",A),{instance:null,error:`Failed to instantiate solver: ${c}`,classFound:!0}}},[r]);return t.length===0?z.jsx("div",{className:"rf-p-4",children:z.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:z.jsxs("div",{className:"rf-p-4",children:[z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),z.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):z.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[z.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[z.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[i.length," ",i.length===1?"Solver":"Solvers"]}),i.map(a=>{const A=o.get(a),c=e===a;return z.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${c?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>n(a),children:(()=>{const l=_qi(A.solverName);return z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[z.jsx(l,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),z.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[z.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:A.componentName}),z.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:A.solverName})]})]})})()},a)})]}),z.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:r?s.instance?z.jsxs("div",{className:"rf-flex rf-h-full rf-flex-col rf-overflow-y-auto",children:[z.jsx(Iqi,{solverEvent:r}),z.jsx("div",{className:"rf-min-h-0 rf-flex-1",children:z.jsx(d9,{fallback:z.jsx("div",{className:"rf-p-4",children:z.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),z.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",r.solverName]})]})}),children:z.jsx(gqi,{solver:s.instance})})})]}):z.jsxs("div",{className:"rf-p-4",children:[z.jsxs("div",{className:"rf-mb-4",children:[z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:r.solverName}),z.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",r.componentName]})]}),s.error&&z.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:z.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),z.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[z.jsxs("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50 rf-flex rf-items-center rf-justify-between rf-gap-2",children:[z.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"}),z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-1",children:[z.jsx(Cqi,{solverEvent:r}),z.jsx(Xc,{type:"button",variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8","aria-label":"Download solver input JSON",title:"Download solver input JSON",onClick:()=>hyn(r),children:z.jsx(pee,{className:"rf-w-4 rf-h-4"})})]})]}),z.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:z.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(r.solverParams,null,2)})})]})]}):z.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:z.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},xqi=new Map([["custom","Custom"],["fanout","Fanout"],["single_layer_fanout","Single layer fanout"],["tscircuit_simplify","Simplify"]]),Eqi=new Set(["tscircuit","default","auto","auto_local"]);function Bqi(t){if(t==="FanoutSolver")return"Fanout";if(t==="AutoroutingPipelineSolver11_Simplification")return"Simplify";const e=t.match(/^AutoroutingPipeline(?:Solver)?(\d+)(?:_|$)/);if(e)return`Pipeline${e[1]}`;const n=t.match(/^AssignableAutoroutingPipeline(\d+)$/);return n?`Assignable${n[1]}`:t}function bqi(t){const e=t.autorouterName?.trim(),n=e?.replace(/-/g,"_"),o=n&&xqi.get(n);if(o)return o;if(n&&!Eqi.has(n))return e;const i=t.solverName?.trim();if(i)return Bqi(i);const r=t.autorouterVersion?.trim();if(r){const s=r.match(/^beta[_-]pipeline(\d+)$/);return s?`Pipeline${s[1]}`:r==="latest"?"default":r}return e?"default":"Unknown"}const NXe="#fbbf24";function Sqi(t){const e=t.endSimpleRouteJson?.traces??[],n=new Set(e.flatMap(i=>[i.pcb_trace_id,i.__replaces_pcb_trace_id].filter(r=>r!==void 0)));return[...(t.startSimpleRouteJson?.traces??[]).filter(i=>!n.has(i.pcb_trace_id)),...e]}function myn(t){const e=new Map((t.startSimpleRouteJson?.traces??[]).map(n=>[n.pcb_trace_id,n]));return(t.endSimpleRouteJson?.traces??[]).filter(n=>{const o=e.get(n.pcb_trace_id);return!o||!!n.__replaces_pcb_trace_id&&n.__replaces_pcb_trace_id!==o.__replaces_pcb_trace_id||JSON.stringify(o.route)!==JSON.stringify(n.route)}).map(n=>n.pcb_trace_id)}function Qqi(t,e){return{outer_diameter:t.via_diameter??e.minViaPadDiameter??e.min_via_pad_diameter??e.minViaDiameter??.6,hole_diameter:t.via_hole_diameter??e.minViaHoleDiameter??e.min_via_hole_diameter??.3}}function pyn(t,e){const n=[];for(const a of t.route)a.route_type==="wire"?n.push({...a,layer:a.layer}):a.route_type==="via"?n.push({route_type:"via",x:a.x,y:a.y,from_layer:a.from_layer,to_layer:a.to_layer,...Qqi(a,e)}):a.route_type==="through_obstacle"&&n.push({route_type:"through_pad",start:{...a.start},end:{...a.end},width:a.width,start_layer:a.from_layer,end_layer:a.to_layer,pcb_smtpad_id:a.circuitJsonMetadata?.pcb_smtpad_id,pcb_plated_hole_id:a.circuitJsonMetadata?.pcb_plated_hole_id});const o=a=>{let A=-1,c=Number.POSITIVE_INFINITY;return n.forEach((l,g)=>{if(l.route_type!=="wire")return;const u=Math.hypot(l.x-a.x,l.y-a.y);u<c&&(c=u,A=g)}),A},i=t.route.filter(a=>a.route_type==="jumper").map(a=>[o(a.start),o(a.end)].sort((A,c)=>A-c)).filter(([a,A])=>a>=0&&A>a).sort(([a],[A])=>a-A),r=[];let s=0;for(const[a,A]of i)a>=s&&r.push(n.slice(s,a+1)),s=Math.max(s,A);return s<n.length&&r.push(n.slice(s)),r}function vqi(t){const e=[],n=[],o=t.endSimpleRouteJson;if(!o)return{lines:e,circles:n};const i=new Set(myn(t));for(const r of o.traces??[])if(i.has(r.pcb_trace_id))for(const s of pyn(r,o)){let a;for(const A of s){if(A.route_type==="through_pad"){a={...A.end,layer:A.end_layer,width:A.width};continue}const c=A.route_type==="wire"?A.layer:A.from_layer;a&&a.layer===c&&(a.x!==A.x||a.y!==A.y)&&e.push({points:[{x:a.x,y:a.y},{x:A.x,y:A.y}],strokeWidth:A.route_type==="wire"?A.width:a.width,strokeColor:NXe,layer:c}),A.route_type==="via"&&n.push({center:{x:A.x,y:A.y},radius:A.outer_diameter/2,stroke:NXe,fill:"transparent"}),a={x:A.x,y:A.y,layer:A.route_type==="wire"?A.layer:A.to_layer,width:A.route_type==="wire"?A.width:a?.width??o.minTraceWidth}}}return{coordinateSystem:"cartesian",lines:e,circles:n}}function wqi(t){const e=JSON.stringify(t);let n=2166136261;for(let o=0;o<e.length;o++)n=Math.imul(n^e.charCodeAt(o),16777619);return(n>>>0).toString(36)}const Pqi=new Set(["pcb_trace","pcb_via","pcb_copper_pour","pcb_ground_plane","pcb_ground_plane_region","pcb_thermal_spoke","pcb_breakout_point"]);function Mqi(t,e,n){const o=n==="input"?e.startSimpleRouteJson??e.errorSimpleRouteJson:e.endSimpleRouteJson,i=t.filter(c=>!Pqi.has(c.type)&&!c.type.endsWith("_error")&&!c.type.endsWith("_warning"));if(!o)return i;const r=n==="input"?o.traces??[]:Sqi(e),s=new Set(t.filter(c=>c.type==="source_trace").map(c=>c.source_trace_id)),a=["top",...Array.from({length:Math.max(0,o.layerCount-2)},(c,l)=>`inner${l+1}`),...o.layerCount>1?["bottom"]:[]],A=[];for(const c of r){const g=o.connections.find(h=>h.name===c.connection_name||h.source_trace_id===c.connection_name)?.source_trace_id??c.connection_name??"",u=pyn(c,o);for(const[h,d]of u.entries()){const m={type:"pcb_trace",pcb_trace_id:`${e.id}_${n}_${c.pcb_trace_id}_${h}_${wqi(d)}`,subcircuit_id:e.subcircuit_id??void 0,source_trace_id:s.has(g)?g:void 0,route:d};A.push(m);for(const[p,_]of d.entries()){if(_.route_type!=="via")continue;const f=a.indexOf(_.from_layer),I=a.indexOf(_.to_layer),C={type:"pcb_via",pcb_via_id:`${m.pcb_trace_id}_via_${p}`,pcb_trace_id:m.pcb_trace_id,subcircuit_id:e.subcircuit_id??void 0,x:_.x,y:_.y,outer_diameter:_.outer_diameter,hole_diameter:_.hole_diameter,layers:f>=0&&I>=0?a.slice(Math.min(f,I),Math.max(f,I)+1):[_.from_layer,_.to_layer]};A.push(C)}}}return[...i,...A]}const RXe=(t,e)=>t.phaseName||`Phase ${t.phaseOrdinal??e+1}`,_yn=t=>t.componentDisplayName?.match(/name="([^"]+)"/)?.[1]?.replace(/^\./,"")||t.componentDisplayName||t.subcircuit_id||"Board",fyn=t=>t.startSimpleRouteJson??t.endSimpleRouteJson??t.errorSimpleRouteJson,Dqi={is_showing_autorouting:!0,is_showing_rats_nest:!1,is_showing_drc_errors:!1,is_showing_drc_warnings:!1,is_showing_pcb_groups:!1},Nqi=({circuitJson:t,phases:e=[],isRunning:n=!1})=>{const[o,i]=ee.useState(null),[r,s]=ee.useState("output"),[a,A]=ee.useState(!0),[c,l]=ee.useState(!1),g=ee.useRef(null),[u,h]=ee.useState(480),d=o?e.findIndex(R=>R.id===o.id&&fyn(R)===fyn(o)):-1,m=d<0?e.length-1:d,p=e[m],_=d<0,f=!!p?.endSimpleRouteJson,I=p?.startSimpleRouteJson??p?.errorSimpleRouteJson,C=!!I,y=r==="output"&&!f?"input":r==="input"&&!C?"output":r,x=y==="input"?I:p?.endSimpleRouteJson,E=ee.useMemo(()=>!p||!x?null:Mqi(t??[],p,y),[t,p,x,y]),B=ee.useMemo(()=>p&&y==="output"&&a?vqi(p):{lines:[],circles:[]},[p,y,a]);if(ee.useLayoutEffect(()=>{const R=g.current;if(!R)return;const F=()=>h(Math.max(360,R.clientHeight));F();const O=new ResizeObserver(F);return O.observe(R),()=>O.disconnect()},[!!p]),!p)return z.jsxs("div",{className:"rf-flex rf-min-h-[400px] rf-flex-col rf-items-center rf-justify-center rf-gap-3 rf-p-8 rf-text-center",children:[z.jsx(zfn,{className:"rf-h-7 rf-w-7 rf-text-blue-500"}),z.jsx("h3",{className:"rf-text-base rf-font-medium",children:n?"Waiting for autorouting":"No autorouting captures"}),z.jsx("p",{className:"rf-max-w-md rf-text-sm rf-text-gray-500",children:n?"Phases appear as the circuit routes. Each capture includes its input and output on the PCB.":"Run a circuit with autorouting enabled to inspect its phases. A circuit JSON file alone does not include routing history."})]});const S=RXe(p,m),Q=p.status==="running"&&n,w=!f,M=I?.connections.length,T=E?.filter(R=>R.type==="pcb_trace").length??0;return z.jsxs("div",{className:"rf-flex rf-h-full rf-min-h-[620px] rf-flex-col rf-bg-white md:rf-flex-row","data-testid":"autorouting-explorer",children:[z.jsxs("aside",{className:"rf-flex rf-shrink-0 rf-flex-col rf-border-b rf-border-gray-200 md:rf-w-52 md:rf-border-b-0 md:rf-border-r","aria-label":"Routing phases",children:[z.jsxs("div",{className:"rf-flex rf-items-center rf-justify-between rf-px-3 rf-py-2 rf-text-xs rf-text-gray-500",children:[z.jsx("span",{children:"Routing phases"}),z.jsx("span",{children:e.length})]}),z.jsx("div",{className:"rf-flex rf-gap-1 rf-overflow-x-auto rf-px-1.5 rf-pb-1.5 md:rf-flex-col md:rf-overflow-x-hidden md:rf-overflow-y-auto",children:e.map((R,F)=>{const O=myn(R).length,U=R.endSimpleRouteJson?`${O} ${O===1?"trace":"traces"} routed`:R.status==="error"?"Failed":R.status==="running"&&n?"Routing…":"No output";return z.jsxs("button",{type:"button","aria-pressed":F===m,title:`${_yn(R)} · ${U}`,onClick:()=>i(R),className:zr("rf-flex rf-min-w-[192px] rf-items-start rf-gap-2 rf-rounded-md rf-border rf-px-2 rf-py-2 rf-text-left md:rf-min-w-0",F===m?"rf-border-blue-200 rf-bg-blue-50":"rf-border-transparent hover:rf-bg-gray-50"),children:[z.jsx("span",{className:zr("rf-flex rf-h-5 rf-w-5 rf-shrink-0 rf-items-center rf-justify-center rf-rounded-full rf-text-[11px]",F===m?"rf-bg-blue-600 rf-text-white":"rf-bg-gray-100 rf-text-gray-500"),children:F+1}),z.jsxs("span",{className:"rf-min-w-0 rf-flex-1",children:[z.jsxs("span",{className:"rf-flex rf-items-center rf-gap-1",children:[z.jsx("span",{className:"rf-min-w-0 rf-flex-1 rf-truncate rf-text-xs rf-font-medium rf-leading-5 rf-text-gray-800",title:RXe(R,F),children:RXe(R,F)}),R.status==="complete"?z.jsx(mee,{"aria-label":"Captured",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-green-600"}):R.status==="error"?z.jsx(Xqe,{"aria-label":"Failed",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-red-500"}):n?z.jsx(v4,{"aria-label":"Routing",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-animate-spin rf-text-blue-500"}):null]}),z.jsxs("span",{className:"rf-block rf-text-[11px] rf-leading-4 rf-text-gray-500",children:[bqi(R)," · ",U]})]})]},R.id)})})]}),z.jsxs("div",{className:"rf-flex rf-min-w-0 rf-flex-1 rf-flex-col",children:[z.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-gap-3 rf-border-b rf-border-gray-200 rf-px-4 rf-py-3",children:[z.jsxs("h3",{className:"rf-mr-auto rf-flex rf-items-center rf-gap-2 rf-text-sm rf-font-medium",children:[S,z.jsxs("span",{className:"rf-text-xs rf-font-normal rf-text-gray-500",children:[m+1," of ",e.length]})]}),n&&z.jsx("button",{type:"button",onClick:()=>i(null),disabled:_,className:"rf-text-xs rf-text-blue-600 disabled:rf-text-gray-500",children:_?"Following latest":"Follow latest"}),z.jsx("div",{className:"rf-flex rf-rounded-md rf-bg-gray-100 rf-p-1","aria-label":"Phase snapshot",children:["input","output"].map(R=>z.jsx("button",{type:"button","aria-pressed":y===R,disabled:R==="input"?!C:!f,onClick:()=>s(R),className:zr("rf-rounded rf-px-3 rf-py-1 rf-text-xs disabled:rf-opacity-40",y===R?"rf-bg-white rf-text-gray-900 rf-shadow-sm":"rf-text-gray-500"),children:R==="input"?"Input":"Output"},R))})]}),z.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-justify-between rf-gap-2 rf-px-4 rf-py-2 rf-text-xs rf-text-gray-600",children:[z.jsxs("label",{className:"rf-flex rf-items-center rf-gap-2",children:[z.jsx("input",{type:"checkbox",checked:a,disabled:y!=="output",onChange:R=>A(R.target.checked),className:"rf-accent-blue-600"}),z.jsx("span",{"aria-hidden":"true",className:"rf-inline-block rf-h-0.5 rf-w-3",style:{backgroundColor:NXe}}),"Highlight changes (all layers)"]}),z.jsxs("span",{children:[y==="input"?"Before this phase":"After this phase"," ","· ",T," traces"]})]}),w&&z.jsx("div",{className:zr("rf-border-y rf-px-4 rf-py-2 rf-text-xs",p.status==="error"?"rf-border-red-100 rf-bg-red-50 rf-text-red-700":"rf-border-blue-100 rf-bg-blue-50 rf-text-blue-700"),role:"status",children:p.status==="error"?`Routing failed: ${p.error?.message||"No output was captured."}`:Q?"Routing in progress. Showing captured input until output is available.":"No output was captured for this phase. Showing the available input."}),z.jsx("div",{ref:g,className:"rf-relative rf-min-h-[360px] rf-flex-1","data-testid":"autorouting-pcb",children:E?z.jsx(jqe,{circuitJson:E,height:u,allowEditing:!1,clickToInteractEnabled:!1,initialState:Dqi,debugGraphics:B}):z.jsx("div",{className:"rf-p-6 rf-text-sm rf-text-gray-500",children:"No PCB snapshot available for this capture."})}),z.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-justify-between rf-gap-2 rf-border-t rf-border-gray-200 rf-px-4 rf-py-3 rf-text-xs rf-text-gray-500",children:[z.jsxs("span",{children:[M===void 0?"Input unavailable":`${M} input connections`,` · ${_yn(p)}`]}),z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-4",children:[z.jsxs("button",{type:"button",disabled:!x,onClick:()=>GE(JSON.stringify(x,null,2),{fileName:`${p.id}-${y}.srj.json`,mimeType:"application/json"}),className:"rf-flex rf-items-center rf-gap-1 disabled:rf-opacity-40",children:[z.jsx(pee,{className:"rf-h-3 rf-w-3"}),"Download SRJ"]}),z.jsxs("button",{type:"button","aria-expanded":c,onClick:()=>l(!c),className:"rf-flex rf-items-center rf-gap-1",children:[z.jsx(VU,{className:zr("rf-h-3 rf-w-3",c&&"rf-rotate-90")}),"Inspect SRJ"]})]})]}),c&&z.jsx("pre",{className:"rf-m-0 rf-max-h-64 rf-overflow-auto rf-border-t rf-border-gray-200 rf-bg-gray-50 rf-p-4 rf-text-xs","aria-label":`${S} ${y} SRJ`,children:x?JSON.stringify(x,null,2):"No snapshot captured."})]})]})},Iyn=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{ee.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{yF.captureException(o)}catch{}}},[t,e]),ee.useEffect(()=>{if(n&&n.length>0)for(const o of n){const i=new Error(o.message||"Circuit JSON Error");o.stack&&(i.stack=o.stack);try{yF.captureException(i,{error_type:o.type})}catch{}}},[n])},Rqi=t=>{ee.useEffect(()=>{try{zMn(t)}catch{}},[t.source,t.component,t.isWebEmbedded,t.activeTab])},Cyn="0.0.2942",Tqi={version:Cyn},TXe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},kXe=new Map,zfe=t=>{const e=kXe.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,o])=>[n,o.getState()])):{}},kqi=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};const o=kXe.get(n.name);if(o)return{type:"tracked",store:t,...o};const i={connection:e.connect(n),stores:{}};return kXe.set(n.name,i),{type:"tracked",store:t,...i}},yyn=(t,e={})=>(n,o,i)=>{const{enabled:r,anonymousActionType:s,store:a,...A}=e;let c;try{c=(r??(TXe?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(TXe?"production":void 0)!=="production"&&r&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,o,i);const{connection:l,...g}=kqi(a,c,A);let u=!0;i.setState=(m,p,_)=>{const f=n(m,p);if(!u)return f;const I=_===void 0?{type:s||"anonymous"}:typeof _=="string"?{type:_}:_;return a===void 0?(l?.send(I,o()),f):(l?.send({...I,type:`${a}/${I.type}`},{...zfe(A.name),[a]:i.getState()}),f)};const h=(...m)=>{const p=u;u=!1,n(...m),u=p},d=t(i.setState,o,i);if(g.type==="untracked"?l?.init(d):(g.stores[g.store]=i,l?.init(Object.fromEntries(Object.entries(g.stores).map(([m,p])=>[m,m===g.store?d:p.getState()])))),i.dispatchFromDevtools&&typeof i.dispatch=="function"){let m=!1;const p=i.dispatch;i.dispatch=(..._)=>{(TXe?"production":void 0)!=="production"&&_[0].type==="__setState"&&!m&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),m=!0),p(..._)}}return l.subscribe(m=>{var p;switch(m.type){case"ACTION":if(typeof m.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return FXe(m.payload,_=>{if(_.type==="__setState"){if(a===void 0){h(_.state);return}Object.keys(_.state).length!==1&&console.error(`
5668
5668
  [zustand devtools middleware] Unsupported __setState action format.
5669
5669
  When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
5670
5670
  and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }