@tscircuit/runframe 0.0.3071 → 0.0.3072

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")}gV.createRoot=function(M,f){if(!l(M))throw Error("Target container is not a DOM element.");S0(M);var _=!1,z="",iA=hf,yA=zs,Ig=jl,yg=null;return f!=null&&(f.hydrate?console.warn("hydrate through createRoot is deprecated. Use ReactDOMClient.hydrateRoot(container, <App />) instead."):typeof f=="object"&&f!==null&&f.$$typeof===Bh&&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 />);`),f.unstable_strictMode===!0&&(_=!0),f.identifierPrefix!==void 0&&(z=f.identifierPrefix),f.onUncaughtError!==void 0&&(iA=f.onUncaughtError),f.onCaughtError!==void 0&&(yA=f.onCaughtError),f.onRecoverableError!==void 0&&(Ig=f.onRecoverableError),f.unstable_transitionCallbacks!==void 0&&(yg=f.unstable_transitionCallbacks)),f=Wg(M,1,!1,null,null,_,z,iA,yA,Ig,yg,null),M[Ia]=f.current,OS(M),new Dw(f)},gV.hydrateRoot=function(M,f,_){if(!l(M))throw Error("Target container is not a DOM element.");S0(M),f===void 0&&console.error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var z=!1,iA="",yA=hf,Ig=zs,yg=jl,qg=null,eI=null;return _!=null&&(_.unstable_strictMode===!0&&(z=!0),_.identifierPrefix!==void 0&&(iA=_.identifierPrefix),_.onUncaughtError!==void 0&&(yA=_.onUncaughtError),_.onCaughtError!==void 0&&(Ig=_.onCaughtError),_.onRecoverableError!==void 0&&(yg=_.onRecoverableError),_.unstable_transitionCallbacks!==void 0&&(qg=_.unstable_transitionCallbacks),_.formState!==void 0&&(eI=_.formState)),f=Wg(M,1,!0,f,_??null,z,iA,yA,Ig,yg,qg,eI),f.context=wI(null),_=f.current,z=Ih(_),z=uA(z),iA=Zi(z),iA.callback=null,lC(_,iA,z),_=z,f.current.lanes=_,bA(f,_),Jr(f),M[Ia]=f.current,OS(M),new td(f)},gV.version="19.1.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})(),gV}var f0g;function nOI(){if(f0g)return BCA.exports;f0g=1;var g={env:{}};function A(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(g.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(A)}catch(I){console.error(I)}}}return g.env.NODE_ENV==="production"?(A(),BCA.exports=iOI()):BCA.exports=EOI(),BCA.exports}var sOI=nOI(),gA=DM();const aC=Lp(gA),Yp=lM({__proto__:null,default:aC},[gA]);var aOI=Object.defineProperty,S9=(g,A)=>aOI(g,"name",{value:A,configurable:!0}),R0g=!!(typeof window<"u"&&window.document&&window.document.createElement);function _o(g,A,{checkForDefaultPrevented:I=!0}={}){return S9(function(t){if(g?.(t),I===!1||!t||!t.defaultPrevented)return A?.(t)},"handleEvent")}S9(_o,"composeEventHandlers");function rOI(g){if(!R0g)throw new Error("Cannot access window outside of the DOM");return g?.ownerDocument?.defaultView??window}S9(rOI,"getOwnerWindow");function rfA(g){if(!R0g)throw new Error("Cannot access document outside of the DOM");return g?.ownerDocument??document}S9(rfA,"getOwnerDocument");function N0g(g,A=!1){const{activeElement:I}=rfA(g);if(!I?.nodeName)return null;if(x0g(I)&&I.contentDocument)return N0g(I.contentDocument.body,A);if(A){const e=I.getAttribute("aria-activedescendant");if(e){const t=rfA(I).getElementById(e);if(t)return t}}return I}S9(N0g,"getActiveElement");function x0g(g){return g.tagName==="IFRAME"}S9(x0g,"isFrame");var cOI=Object.defineProperty,Q2=(g,A)=>cOI(g,"name",{value:A,configurable:!0});function hOI(g,A){const I=gA.createContext(A);I.displayName=g+"Context";const e=Q2(o=>{const{children:B,...C}=o,Q=gA.useMemo(()=>C,Object.values(C));return W.jsx(I.Provider,{value:Q,children:B})},"Provider");e.displayName=g+"Provider";function t(o,B={}){const{optional:C=!1}=B,Q=gA.useContext(I);if(Q)return Q;if(A!==void 0)return A;if(!C)throw new Error(`\`${o}\` must be used within \`${g}\``)}return Q2(t,"useContext"),[e,t]}Q2(hOI,"createContext");function dM(g,A=[]){let I=[];function e(o,B){const C=gA.createContext(B);C.displayName=o+"Context";const Q=I.length;I=[...I,B];const i=Q2(n=>{const{scope:s,children:r,...a}=n,c=s?.[g]?.[Q]||C,h=gA.useMemo(()=>a,Object.values(a));return W.jsx(c.Provider,{value:h,children:r})},"Provider");i.displayName=o+"Provider";function E(n,s,r={}){const{optional:a=!1}=r,c=s?.[g]?.[Q]||C,h=gA.useContext(c);if(h)return h;if(B!==void 0)return B;if(!a)throw new Error(`\`${n}\` must be used within \`${o}\``)}return Q2(E,"useContext"),[i,E]}Q2(e,"createContext");const t=Q2(()=>{const o=I.map(B=>gA.createContext(B));return Q2(function(C){const Q=C?.[g]||o;return gA.useMemo(()=>({[`__scope${g}`]:{...C,[g]:Q}}),[C,Q])},"useScope")},"createScope");return t.scopeName=g,[e,F0g(t,...A)]}Q2(dM,"createContextScope");function F0g(...g){const A=g[0];if(g.length===1)return A;const I=Q2(()=>{const e=g.map(t=>({useScope:t(),scopeName:t.scopeName}));return Q2(function(o){const B=e.reduce((C,{useScope:Q,scopeName:i})=>{const n=Q(o)[`__scope${i}`];return{...C,...n}},{});return gA.useMemo(()=>({[`__scope${A.scopeName}`]:B}),[B])},"useComposedScopes")},"createScope");return I.scopeName=A.scopeName,I}Q2(F0g,"composeContextScopes");var lOI=Object.defineProperty,cfA=(g,A)=>lOI(g,"name",{value:A,configurable:!0});function hfA(g,A){if(typeof g=="function")return g(A);g!=null&&(g.current=A)}cfA(hfA,"setRef");function U0g(...g){return A=>{let I=!1;const e=g.map(t=>{const o=hfA(t,A);return!I&&typeof o=="function"&&(I=!0),o});if(I)return()=>{for(let t=0;t<e.length;t++){const o=e[t];typeof o=="function"?o():hfA(g[t],null)}}}}cfA(U0g,"composeRefs");function $i(...g){return gA.useCallback(U0g(...g),g)}cfA($i,"useComposedRefs");var DOI=Object.defineProperty,yM=(g,A)=>DOI(g,"name",{value:A,configurable:!0});function fN(g){const A=gA.forwardRef((I,e)=>{let{children:t,...o}=I,B=null,C=!1;const Q=[];t=b0g(t),gA.Children.forEach(t,s=>{if(Y0g(s)){C=!0;const r=s;let a="child"in r.props?r.props.child:r.props.children;for(;lfA(a)&&typeof ECA=="function";)a=ECA(a._payload);B=yOI(r,a),Q.push(B?.props?.children)}else Q.push(s)}),B?B=gA.cloneElement(B,void 0,Q):!C&&gA.Children.count(t)===1&&gA.isValidElement(t)&&(B=t);const i=B?L0g(B):void 0,E=$i(e,i);if(!B){if(t||t===0)throw new Error(C?GOI(g):uOI(g));return t}const n=K0g(o,B.props??{});return B.type!==gA.Fragment&&(n.ref=e?E:i),gA.cloneElement(B,n)});return A.displayName=`${g}.Slot`,A}yM(fN,"createSlot");var dOI=fN("Slot"),J0g=Symbol.for("radix.slottable");function P0g(g){const A=yM(I=>"child"in I?I.children(I.child):I.children,"Slottable");return A.displayName=`${g}.Slottable`,A.__radixId=J0g,A}yM(P0g,"createSlottable");var yOI=yM((g,A)=>"child"in g.props?gA.isValidElement(A)?gA.cloneElement(A,void 0,g.props.children(A.props.children)):null:gA.isValidElement(A)?A:null,"getSlottableElementFromSlottable");function K0g(g,A){const I={...A};for(const e in A){const t=g[e],o=A[e];/^on[A-Z]/.test(e)?t&&o?I[e]=(...C)=>{const Q=o(...C);return t(...C),Q}:t&&(I[e]=t):e==="style"?I[e]={...t,...o}:e==="className"?I[e]=[t,o].filter(Boolean).join(" "):e==="aria-describedby"&&(I[e]=H0g(o,t))}return{...g,...I}}yM(K0g,"mergeProps");function L0g(g){let A=Object.getOwnPropertyDescriptor(g.props,"ref")?.get,I=A&&"isReactWarning"in A&&A.isReactWarning;return I?g.ref:(A=Object.getOwnPropertyDescriptor(g,"ref")?.get,I=A&&"isReactWarning"in A&&A.isReactWarning,I?g.props.ref:g.props.ref||g.ref)}yM(L0g,"getElementRef");function Y0g(g){return gA.isValidElement(g)&&typeof g.type=="function"&&"__radixId"in g.type&&g.type.__radixId===J0g}yM(Y0g,"isSlottable");var wOI=Symbol.for("react.lazy");function lfA(g){return g!=null&&typeof g=="object"&&"$$typeof"in g&&g.$$typeof===wOI&&"_payload"in g&&_0g(g._payload)}yM(lfA,"isLazyComponent");function _0g(g){return typeof g=="object"&&g!==null&&"then"in g}yM(_0g,"isPromiseLike");function b0g(g){let A=g;for(;lfA(A)&&typeof ECA=="function";)A=ECA(A._payload);return A}yM(b0g,"useUnwrappedLazy");function H0g(...g){const A=new Set;for(const I of g)if(typeof I=="string")for(const e of String(I).trim().split(/\s+/))e&&A.add(e);return A.size>0?Array.from(A).join(" "):void 0}yM(H0g,"concatAriaDescribedby");var uOI=yM(g=>`${g} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),GOI=yM(g=>`${g} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),ECA=Yp[" use ".trim().toString()],Eh=globalThis?.document?gA.useLayoutEffect:()=>{},mOI=Object.defineProperty,sd=(g,A)=>mOI(g,"name",{value:A,configurable:!0});function nCA(g){const A=g+"CollectionProvider",[I,e]=dM(A),[t,o]=I(A,{collectionRef:{current:null},itemMap:new Map}),B=sd(c=>{const{scope:h,children:l}=c,D=gA.useRef(null),d=gA.useRef(new Map).current;return W.jsx(t,{scope:h,itemMap:d,collectionRef:D,children:l})},"CollectionProvider");B.displayName=A;const C=g+"CollectionSlot",Q=fN(C),i=gA.forwardRef((c,h)=>{const{scope:l,children:D}=c,d=o(C,l),y=$i(h,d.collectionRef);return W.jsx(Q,{ref:y,children:D})});i.displayName=C;const E=g+"CollectionItemSlot",n="data-radix-collection-item",s=fN(E),r=gA.forwardRef((c,h)=>{const{scope:l,children:D,...d}=c,y=gA.useRef(null),w=$i(h,y),u=o(E,l);return gA.useEffect(()=>(u.itemMap.set(y,{ref:y,...d}),()=>{u.itemMap.delete(y)})),W.jsx(s,{[n]:"",ref:w,children:D})});r.displayName=E;function a(c){const h=o(g+"CollectionConsumer",c);return gA.useCallback(()=>{const D=h.collectionRef.current;if(!D)return[];const d=Array.from(D.querySelectorAll(`[${n}]`));return Array.from(h.itemMap.values()).sort((u,G)=>d.indexOf(u.ref.current)-d.indexOf(G.ref.current))},[h.collectionRef,h.itemMap])}return sd(a,"useCollection"),[{Provider:B,Slot:i,ItemSlot:r},a,e]}sd(nCA,"createCollection");var v0g=new WeakMap,sCA=(kS=class extends Map{constructor(I){super(I);Zhg(this,bl);vBA(this,bl,[...super.keys()]),v0g.set(this,!0)}set(I,e){return v0g.get(this)&&!this.has(I)&&jn(this,bl).push(I),super.set(I,e),this}insert(I,e,t){const o=this.has(e),B=o?this.size:this.size+1,C=DfA(I),Q=C>=0?Math.min(C,B-1):Math.max(B+C,0);if(o?jn(this,bl).indexOf(e)===Q:Q===this.size)return this.set(e,t),this;const i=jn(this,bl).filter(n=>n!==e);i.splice(Q,0,e);const E=i.map(n=>[n,n===e?t:this.get(n)]);this.clear();for(const[n,s]of E)this.set(n,s);return this}with(I,e,t){const o=new kS(this);return o.insert(I,e,t),o}before(I){const e=jn(this,bl).indexOf(I)-1;if(!(e<0))return this.entryAt(e)}setBefore(I,e,t){const o=jn(this,bl).indexOf(I);if(o===-1)return this;const B=jn(this,bl).indexOf(e),C=B!==-1&&B<o?o-1:o;return this.insert(C,e,t)}after(I){let e=jn(this,bl).indexOf(I);if(e=e===-1||e===this.size-1?-1:e+1,e!==-1)return this.entryAt(e)}setAfter(I,e,t){const o=jn(this,bl).indexOf(I);if(o===-1)return this;const B=jn(this,bl).indexOf(e),C=B!==-1&&B<=o?o:o+1;return this.insert(C,e,t)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return vBA(this,bl,[]),super.clear()}delete(I){const e=super.delete(I);return e&&jn(this,bl).splice(jn(this,bl).indexOf(I),1),e}deleteAt(I){const e=this.keyAt(I);return e!==void 0?this.delete(e):!1}at(I){const e=aCA(jn(this,bl),I);if(e!==void 0)return this.get(e)}entryAt(I){const e=aCA(jn(this,bl),I);if(e!==void 0)return[e,this.get(e)]}indexOf(I){return jn(this,bl).indexOf(I)}keyAt(I){return aCA(jn(this,bl),I)}from(I,e){const t=this.indexOf(I);if(t===-1)return;let o=t+e;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.at(o)}keyFrom(I,e){const t=this.indexOf(I);if(t===-1)return;let o=t+e;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.keyAt(o)}find(I,e){let t=0;for(const o of this){if(Reflect.apply(I,e,[o,t,this]))return o;t++}}findIndex(I,e){let t=0;for(const o of this){if(Reflect.apply(I,e,[o,t,this]))return t;t++}return-1}filter(I,e){const t=[];let o=0;for(const B of this)Reflect.apply(I,e,[B,o,this])&&t.push(B),o++;return new kS(t)}map(I,e){const t=[];let o=0;for(const B of this)t.push([B[0],Reflect.apply(I,e,[B,o,this])]),o++;return new kS(t)}reduce(...I){const[e,t]=I,o=I.length>1;if(!o&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let B=0,C=t;for(const Q of this)B===0&&!o?C=Q:C=Reflect.apply(e,this,[C,Q,B,this]),B++;return C}reduceRight(...I){const[e,t]=I,o=I.length>1;if(!o&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let B=t;for(let C=this.size-1;C>=0;C--){const Q=this.entryAt(C);C===this.size-1&&!o?B=Q:B=Reflect.apply(e,this,[B,Q,C,this])}return B}sort(I){if(typeof I!="function")throw new TypeError("OrderedDict.sort requires a compare function");const e=[...this.entries()].sort(I);this.clear();for(const[t,o]of e)this.set(t,o);return this}toSorted(I){if(typeof I!="function")throw new TypeError("OrderedDict.toSorted requires a compare function");const e=[...this.entries()].sort(I);return new kS(e)}toReversed(){const I=new kS;for(let e=this.size-1;e>=0;e--){const t=this.keyAt(e),o=this.get(t);I.set(t,o)}return I}toSpliced(...I){const e=[...this.entries()];return e.splice(...I),new kS(e)}slice(I,e){const t=new kS;for(const o of jn(this,bl).slice(I,e))t.set(o,this.get(o));return t}every(I,e){let t=0;for(const o of this){if(!Reflect.apply(I,e,[o,t,this]))return!1;t++}return!0}some(I,e){let t=0;for(const o of this){if(Reflect.apply(I,e,[o,t,this]))return!0;t++}return!1}},bl=new WeakMap,sd(kS,"OrderedDict"),kS);function aCA(g,A){if("at"in Array.prototype)return Array.prototype.at.call(g,A);const I=q0g(g,A);return I===-1?void 0:g[I]}sd(aCA,"at");function q0g(g,A){const I=g.length,e=DfA(A),t=e>=0?e:I+e;return t<0||t>=I?-1:t}sd(q0g,"toSafeIndex");function DfA(g){return g!==g||g===0?0:Math.trunc(g)}sd(DfA,"toSafeInteger");function pOI(g){const A=g+"CollectionProvider",[I,e]=dM(A),[t,o]=I(A);t.displayName=g+"CollectionStableContextProvider";const[B,C]=I(A);B.displayName=g+"CollectionStatefulContextProvider";const Q=sd(({state:u,...G})=>u?W.jsx(E,{...G,state:u}):W.jsx(i,{...G}),"CollectionProvider");Q.displayName=A;const i=sd(u=>{const G=D();return W.jsx(E,{...u,state:G})},"CollectionInit");i.displayName=g+"CollectionInit";const E=sd(u=>{const{scope:G,children:m,state:p}=u,k=gA.useRef(null),[S,R]=gA.useState(null),x=$i(k,R),[N,U]=p,K=gA.useRef(new sCA),Y=gA.useCallback(()=>{const b=K.current;return O0g(b)||b.sort(rCA),b},[]);return gA.useEffect(()=>{if(!S)return;const b=W0g(()=>{U(q=>{const j=q.toSorted(rCA);return j.some(([O],AA)=>q.keyAt(AA)!==O)?j:q})});return b.observe(S,{childList:!0,subtree:!0}),()=>{b.disconnect()}},[S,U]),W.jsx(t,{scope:G,collectionElementRef:x,collectionElementRefObject:k,getCollection:Y,setCollection:U,registryRef:K,children:W.jsx(B,{scope:G,collectionElement:S,collection:N,children:m})})},"CollectionProviderImpl");E.displayName=g+"CollectionProviderImpl";const n=g+"CollectionSlot",s=fN(n),r=gA.forwardRef((u,G)=>{const{scope:m,children:p}=u,k=o(n,m),S=$i(G,k.collectionElementRef);return W.jsx(s,{ref:S,children:p})});r.displayName=n;const a=g+"CollectionItemSlot",c="data-radix-collection-item",h=fN(a),l=gA.forwardRef((u,G)=>{const{scope:m,children:p,...k}=u,S=gA.useRef(null),R=o(a,m),{setCollection:x,registryRef:N}=R,U=gA.useRef(k);T0g(U.current,k)||(U.current=k);const K=U.current,Y=gA.useCallback(j=>{const Z=N.current;j?Z.set(j,{...U.current,element:j}):S.current&&Z.delete(S.current)},[N]),b=$i(G,Y,S);Eh(()=>{const j=S.current,Z=N.current;j&&Z.has(j)&&Z.set(j,{...K,element:j})},[K,N]);const q=gA.useRef(null);return gA.useEffect(()=>{const j=S.current,Z=q.current;(Z?.element??null)===j&&(!j||Z?.itemData===K)||(q.current=j?{element:j,itemData:K}:null,x(O=>{const AA=new sCA(O);return Z&&Z.element!==j&&AA.delete(Z.element),j&&AA.set(j,{...K,element:j}),AA.sort(rCA)}))}),gA.useEffect(()=>()=>{const j=q.current;q.current=null,j&&x(Z=>{if(!Z.has(j.element))return Z;const O=new sCA(Z);return O.delete(j.element),O})},[x]),W.jsx(h,{[c]:"",ref:b,children:p})});l.displayName=a;function D(){return gA.useState(new sCA)}sd(D,"useInitCollection");function d(u){const{collection:G}=C(g+"CollectionConsumer",u);return G}sd(d,"useCollection");function y(u){const{getCollection:G}=o(g+"CollectionConsumer",u);return G}return sd(y,"useGetCollection"),[{Provider:Q,Slot:r,ItemSlot:l},{createCollectionScope:e,useCollection:d,useGetCollection:y,useInitCollection:D}]}sd(pOI,"createCollection");function T0g(g,A){if(g===A)return!0;if(typeof g!="object"||typeof A!="object"||g==null||A==null)return!1;const I=Object.keys(g),e=Object.keys(A);if(I.length!==e.length)return!1;for(const t of I)if(!Object.prototype.hasOwnProperty.call(A,t)||g[t]!==A[t])return!1;return!0}sd(T0g,"shallowEqual");function Z0g(g,A){return!!(A.compareDocumentPosition(g)&Node.DOCUMENT_POSITION_PRECEDING)}sd(Z0g,"isElementPreceding");function O0g(g){let A;for(const I of g.keys()){if(A){const e=A.compareDocumentPosition(I);if(!(e&Node.DOCUMENT_POSITION_DISCONNECTED)&&e&Node.DOCUMENT_POSITION_PRECEDING)return!1}A=I}return!0}sd(O0g,"isInDocumentOrder");function rCA(g,A){return!g[1].element||!A[1].element?0:Z0g(g[1].element,A[1].element)?-1:1}sd(rCA,"sortByDocumentPosition");function W0g(g){return new MutationObserver(I=>{for(const e of I)if(e.type==="childList"){g();return}})}sd(W0g,"getChildListObserver");var kOI=Object.defineProperty,MOI=(g,A)=>kOI(g,"name",{value:A,configurable:!0}),SOI=Yp[" useId ".trim().toString()]||(()=>{}),fOI=0;function wM(g){const[A,I]=gA.useState(SOI());return Eh(()=>{g||I(e=>e??String(fOI++))},[g]),g||(A?`radix-${A}`:"")}MOI(wM,"useId");var RN=afA();const V0g=Lp(RN);var ROI=Object.defineProperty,NOI=(g,A)=>ROI(g,"name",{value:A,configurable:!0}),xOI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],iE=xOI.reduce((g,A)=>{const I=fN(`Primitive.${A}`),e=gA.forwardRef((t,o)=>{const{asChild:B,...C}=t,Q=B?I:A;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),W.jsx(Q,{...C,ref:o})});return e.displayName=`Primitive.${A}`,{...g,[A]:e}},{});function dfA(g,A){g&&RN.flushSync(()=>g.dispatchEvent(A))}NOI(dfA,"dispatchDiscreteCustomEvent");var FOI=Object.defineProperty,UOI=(g,A)=>FOI(g,"name",{value:A,configurable:!0}),j0g=Yp[" useInsertionEffect ".trim().toString()];function uM(g){const A=gA.useRef(g);return typeof j0g=="function"?j0g(()=>{A.current=g}):Eh(()=>{A.current=g}),gA.useMemo(()=>((...I)=>A.current?.(...I)),[])}UOI(uM,"useCallbackRef");var JOI=Object.defineProperty,POI=(g,A)=>JOI(g,"name",{value:A,configurable:!0}),z0g=Yp[" useEffectEvent ".trim().toString()],X0g=Yp[" useInsertionEffect ".trim().toString()];function $0g(g){if(typeof z0g=="function")return z0g(g);const A=gA.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof X0g=="function"?X0g(()=>{A.current=g}):Eh(()=>{A.current=g}),gA.useMemo(()=>((...I)=>A.current?.(...I)),[])}POI($0g,"useEffectEvent");var KOI=Object.defineProperty,IV=(g,A)=>KOI(g,"name",{value:A,configurable:!0}),LOI=Yp[" useInsertionEffect ".trim().toString()]||Eh;function NN({prop:g,defaultProp:A,onChange:I=IV(()=>{},"onChange"),caller:e}){const[t,o,B]=Alg({defaultProp:A,onChange:I}),C=g!==void 0,Q=C?g:t,i=gA.useCallback(E=>{if(C){const n=glg(E)?E(g):E;n!==g&&B.current?.(n)}else o(E)},[C,g,o,B]);return[Q,i]}IV(NN,"useControllableState");function Alg({defaultProp:g,onChange:A}){const[I,e]=gA.useState(g),t=gA.useRef(I),o=gA.useRef(A);return LOI(()=>{o.current=A},[A]),gA.useEffect(()=>{t.current!==I&&(o.current?.(I),t.current=I)},[I,t]),[I,e,o]}IV(Alg,"useUncontrolledState");function glg(g){return typeof g=="function"}IV(glg,"isFunction");var Ilg=Symbol("RADIX:SYNC_STATE");function YOI(g,A,I,e){const{prop:t,defaultProp:o,onChange:B,caller:C}=A,Q=t!==void 0,i=$0g(B),E=[{...I,state:o}];e&&E.push(e);const[n,s]=gA.useReducer((h,l)=>{if(l.type===Ilg)return{...h,state:l.state};const D=g(h,l);return Q&&!Object.is(D.state,h.state)&&i(D.state),D},...E),r=n.state,a=gA.useRef(r);gA.useEffect(()=>{a.current!==r&&(a.current=r,Q||i(r))},[r,a,Q]);const c=gA.useMemo(()=>t!==void 0?{...n,state:t}:n,[n,t]);return gA.useEffect(()=>{Q&&!Object.is(t,n.state)&&s({type:Ilg,state:t})},[t,n.state,Q]),[c,s]}IV(YOI,"useControllableStateReducer");var _OI=Object.defineProperty,bOI=(g,A)=>_OI(g,"name",{value:A,configurable:!0}),HOI={LTR:"ltr"},vOI=gA.createContext(void 0);function eV(g){const A=gA.useContext(vOI);return g||A||HOI.LTR}bOI(eV,"useDirection");var qOI=Object.defineProperty,yfA=(g,A)=>qOI(g,"name",{value:A,configurable:!0}),wfA=!1;function elg(){const[g,A]=gA.useState(wfA);return gA.useEffect(()=>{wfA||(wfA=!0,A(!0))},[]),g}yfA(elg,"useIsHydrated");var tlg=Yp[" useSyncExternalStore ".trim().toString()];function olg(){return()=>{}}yfA(olg,"subscribe");function Blg(){return tlg(olg,()=>!0,()=>!1)}yfA(Blg,"useIsHydratedModern");var TOI=typeof tlg=="function"?Blg:elg,ZOI=Object.defineProperty,dY=(g,A)=>ZOI(g,"name",{value:A,configurable:!0}),ufA="rovingFocusGroup.onEntryFocus",OOI={bubbles:!1,cancelable:!0},cCA="RovingFocusGroup",[GfA,Clg,WOI]=nCA(cCA),[VOI,hCA]=dM(cCA,[WOI]),Qlg={Vertical:"vertical",Horizontal:"horizontal"},jOI={RTL:"rtl"},[zOI,XOI]=VOI(cCA),ilg=gA.forwardRef(dY(function(A,I){return W.jsx(GfA.Provider,{scope:A.__scopeRovingFocusGroup,children:W.jsx(GfA.Slot,{scope:A.__scopeRovingFocusGroup,children:W.jsx($OI,{...A,ref:I})})})},"RovingFocusGroup")),$OI=gA.forwardRef(dY(function(A,I){const{__scopeRovingFocusGroup:e,orientation:t,loop:o=!1,dir:B,currentTabStopId:C,defaultCurrentTabStopId:Q,onCurrentTabStopIdChange:i,onEntryFocus:E,preventScrollOnEntryFocus:n=!1,...s}=A,r=gA.useRef(null),a=$i(I,r),c=eV(B),[h,l]=NN({prop:C,defaultProp:Q??null,onChange:i,caller:cCA}),[D,d]=gA.useState(!1),y=uM(E),w=Clg(e),u=gA.useRef(!1),[G,m]=gA.useState(0);return gA.useEffect(()=>{const p=r.current;if(p)return p.addEventListener(ufA,y),()=>p.removeEventListener(ufA,y)},[y]),W.jsx(zOI,{scope:e,orientation:t,dir:c,loop:o,currentTabStopId:h,onItemFocus:gA.useCallback(p=>l(p),[l]),onItemShiftTab:gA.useCallback(()=>d(!0),[]),onFocusableItemAdd:gA.useCallback(()=>m(p=>p+1),[]),onFocusableItemRemove:gA.useCallback(()=>m(p=>p-1),[]),children:W.jsx(iE.div,{tabIndex:D||G===0?-1:0,"data-orientation":t,...s,ref:a,style:{outline:"none",...A.style},onMouseDown:_o(A.onMouseDown,()=>{u.current=!0}),onFocus:_o(A.onFocus,p=>{const k=!u.current;if(p.target===p.currentTarget&&k&&!D){const S=new CustomEvent(ufA,OOI);if(p.currentTarget.dispatchEvent(S),!S.defaultPrevented){const R=w().filter(Y=>Y.focusable),x=R.find(Y=>Y.active),N=R.find(Y=>Y.id===h),K=[x,N,...R].filter(Boolean).map(Y=>Y.ref.current);mfA(K,n)}}u.current=!1}),onBlur:_o(A.onBlur,()=>d(!1))})})},"RovingFocusGroupImpl")),AWI="RovingFocusGroupItem",Elg=gA.forwardRef(dY(function(A,I){const{__scopeRovingFocusGroup:e,focusable:t=!0,active:o=!1,tabStopId:B,children:C,...Q}=A,i=wM(),E=B||i,n=XOI(AWI,e),s=n.currentTabStopId===E,r=Clg(e),{onFocusableItemAdd:a,onFocusableItemRemove:c,currentTabStopId:h}=n,l=TOI();return Eh(()=>{if(!(!l||!t))return a(),()=>c()},[l,t,a,c]),gA.useEffect(()=>{if(!(l||!t))return a(),()=>c()},[l,t,a,c]),W.jsx(GfA.ItemSlot,{scope:e,id:E,focusable:t,active:o,children:W.jsx(iE.span,{tabIndex:s?0:-1,"data-orientation":n.orientation,...Q,ref:I,onMouseDown:_o(A.onMouseDown,D=>{t?n.onItemFocus(E):D.preventDefault()}),onFocus:_o(A.onFocus,()=>n.onItemFocus(E)),onKeyDown:_o(A.onKeyDown,D=>{if(D.key==="Tab"&&D.shiftKey){n.onItemShiftTab();return}if(D.target!==D.currentTarget)return;const d=slg(D,n.orientation,n.dir);if(d!==void 0){if(D.metaKey||D.ctrlKey||D.altKey||D.shiftKey)return;D.preventDefault();let w=r().filter(u=>u.focusable).map(u=>u.ref.current);if(d==="last")w.reverse();else if(d==="prev"||d==="next"){d==="prev"&&w.reverse();const u=w.indexOf(D.currentTarget);w=n.loop?alg(w,u+1):w.slice(u+1)}setTimeout(()=>mfA(w))}}),children:typeof C=="function"?C({isCurrentTabStop:s,hasTabStop:h!=null}):C})})},"RovingFocusGroupItem")),gWI={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function nlg(g,A){return A!==jOI.RTL?g:g==="ArrowLeft"?"ArrowRight":g==="ArrowRight"?"ArrowLeft":g}dY(nlg,"getDirectionAwareKey");function slg(g,A,I){const e=nlg(g.key,I);if(!(A===Qlg.Vertical&&["ArrowLeft","ArrowRight"].includes(e))&&!(A===Qlg.Horizontal&&["ArrowUp","ArrowDown"].includes(e)))return gWI[e]}dY(slg,"getFocusIntent");function mfA(g,A=!1){const I=document.activeElement;for(const e of g)if(e===I||(e.focus({preventScroll:A}),document.activeElement!==I))return}dY(mfA,"focusFirst");function alg(g,A){return g.map((I,e)=>g[(A+e)%g.length])}dY(alg,"wrapArray");var IWI=Object.defineProperty,YF=(g,A)=>IWI(g,"name",{value:A,configurable:!0});function rlg(g,A){return gA.useReducer((I,e)=>A[I][e]??I,g)}YF(rlg,"useStateMachine");var Rf=YF(g=>{const{present:A,children:I}=g,e=clg(A),t=typeof I=="function"?I({present:e.isPresent}):gA.Children.only(I),o=hlg(e.ref,llg(t));return typeof I=="function"||e.isPresent?gA.cloneElement(t,{ref:o}):null},"Presence");function clg(g){const[A,I]=gA.useState(),e=gA.useRef(null),t=gA.useRef(g),o=gA.useRef("none"),B=gA.useRef(void 0),C=g?"mounted":"unmounted",[Q,i]=rlg(C,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return gA.useEffect(()=>{Q==="mounted"?(o.current=B.current??f9(e.current),B.current=void 0):o.current="none"},[Q]),Eh(()=>{const E=e.current,n=t.current;if(n!==g){const r=o.current,a=f9(E);g?(B.current=a,i("MOUNT")):a==="none"||E?.display==="none"?i("UNMOUNT"):i(n&&r!==a?"ANIMATION_OUT":"UNMOUNT"),t.current=g}},[g,i]),Eh(()=>{if(A){let E;const n=A.ownerDocument.defaultView??window,s=YF(a=>{const h=f9(e.current).includes(CSS.escape(a.animationName));if(a.target===A&&h&&(i("ANIMATION_END"),!t.current)){const l=A.style.animationFillMode;A.style.animationFillMode="forwards",E=n.setTimeout(()=>{A.style.animationFillMode==="forwards"&&(A.style.animationFillMode=l)})}},"handleAnimationEnd"),r=YF(a=>{a.target===A&&(o.current=f9(e.current))},"handleAnimationStart");return A.addEventListener("animationstart",r),A.addEventListener("animationcancel",s),A.addEventListener("animationend",s),()=>{n.clearTimeout(E),A.removeEventListener("animationstart",r),A.removeEventListener("animationcancel",s),A.removeEventListener("animationend",s)}}else i("ANIMATION_END")},[A,i]),{isPresent:["mounted","unmountSuspended"].includes(Q),ref:gA.useCallback(E=>{if(E){const n=getComputedStyle(E);e.current=n,B.current=f9(n)}else e.current=null;I(E)},[])}}YF(clg,"usePresence");function pfA(g,A){if(typeof g=="function")return g(A);g!=null&&(g.current=A)}YF(pfA,"setRef");function hlg(...g){const A=gA.useRef(g);return A.current=g,gA.useCallback(I=>{const e=A.current;let t=!1;const o=e.map(B=>{const C=pfA(B,I);return!t&&typeof C=="function"&&(t=!0),C});if(t)return()=>{for(let B=0;B<o.length;B++){const C=o[B];typeof C=="function"?C():pfA(e[B],null)}}},[])}YF(hlg,"useStableComposedRefs");function f9(g){return g?.animationName||"none"}YF(f9,"getAnimationName");function llg(g){let A=Object.getOwnPropertyDescriptor(g.props,"ref")?.get,I=A&&"isReactWarning"in A&&A.isReactWarning;return I?g.ref:(A=Object.getOwnPropertyDescriptor(g,"ref")?.get,I=A&&"isReactWarning"in A&&A.isReactWarning,I?g.props.ref:g.props.ref||g.ref)}YF(llg,"getElementRef");var eWI=Object.defineProperty,R9=(g,A)=>eWI(g,"name",{value:A,configurable:!0}),Dlg={Automatic:"automatic",Manual:"manual"},kfA="Tabs",[tWI,jXo]=dM(kfA,[hCA]),dlg=hCA(),[oWI,MfA]=tWI(kfA),BWI=gA.forwardRef(R9(function(A,I){const{__scopeTabs:e,value:t,onValueChange:o,defaultValue:B,orientation:C="horizontal",dir:Q,activationMode:i=Dlg.Automatic,...E}=A,n=eV(Q),[s,r]=NN({prop:t,onChange:o,defaultProp:B??"",caller:kfA});return W.jsx(oWI,{scope:e,baseId:wM(),value:s,onValueChange:r,orientation:C,dir:n,activationMode:i,children:W.jsx(iE.div,{dir:n,"data-orientation":C,...E,ref:I})})},"Tabs")),CWI="TabsList",ylg=gA.forwardRef(R9(function(A,I){const{__scopeTabs:e,loop:t=!0,...o}=A,B=MfA(CWI,e),C=dlg(e);return W.jsx(ilg,{asChild:!0,...C,orientation:B.orientation,dir:B.dir,loop:t,children:W.jsx(iE.div,{role:"tablist","aria-orientation":B.orientation,...o,ref:I})})},"TabsList")),QWI="TabsTrigger",wlg=gA.forwardRef(R9(function(A,I){const{__scopeTabs:e,value:t,disabled:o=!1,...B}=A,C=MfA(QWI,e),Q=dlg(e),i=SfA(C.baseId,t),E=ffA(C.baseId,t),n=t===C.value;return W.jsx(Elg,{asChild:!0,...Q,focusable:!o,active:n,children:W.jsx(iE.button,{type:"button",role:"tab","aria-selected":n,"aria-controls":E,"data-state":n?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:i,...B,ref:I,onMouseDown:_o(A.onMouseDown,s=>{!o&&s.button===0&&s.ctrlKey===!1?(s.currentTarget.focus(),C.onValueChange(t)):s.preventDefault()}),onKeyDown:_o(A.onKeyDown,s=>{o||s.target!==s.currentTarget||[" ","Enter"].includes(s.key)&&C.onValueChange(t)}),onFocus:_o(A.onFocus,()=>{const s=C.activationMode!==Dlg.Manual;!n&&!o&&s&&C.onValueChange(t)})})})},"TabsTrigger")),iWI="TabsContent",ulg=gA.forwardRef(R9(function(A,I){const{__scopeTabs:e,value:t,forceMount:o,children:B,...C}=A,Q=MfA(iWI,e),i=SfA(Q.baseId,t),E=ffA(Q.baseId,t),n=t===Q.value,s=gA.useRef(n);return gA.useEffect(()=>{const r=requestAnimationFrame(()=>s.current=!1);return()=>cancelAnimationFrame(r)},[]),W.jsx(Rf,{present:o||n,children:({present:r})=>W.jsx(iE.div,{"data-state":n?"active":"inactive","data-orientation":Q.orientation,role:"tabpanel","aria-labelledby":i,hidden:!r,id:E,tabIndex:0,...C,ref:I,style:{...A.style,animationDuration:s.current?"0s":void 0},children:r&&B})})},"TabsContent"));function SfA(g,A){return`${g}-trigger-${A}`}R9(SfA,"makeTriggerId");function ffA(g,A){return`${g}-content-${A}`}R9(ffA,"makeContentId");function Glg(g){var A,I,e="";if(typeof g=="string"||typeof g=="number")e+=g;else if(typeof g=="object")if(Array.isArray(g)){var t=g.length;for(A=0;A<t;A++)g[A]&&(I=Glg(g[A]))&&(e&&(e+=" "),e+=I)}else for(I in g)g[I]&&(e&&(e+=" "),e+=I);return e}function Nf(){for(var g,A,I=0,e="",t=arguments.length;I<t;I++)(g=arguments[I])&&(A=Glg(g))&&(e&&(e+=" "),e+=A);return e}const RfA="-",EWI=g=>{const A=sWI(g),{conflictingClassGroups:I,conflictingClassGroupModifiers:e}=g;return{getClassGroupId:B=>{const C=B.split(RfA);return C[0]===""&&C.length!==1&&C.shift(),mlg(C,A)||nWI(B)},getConflictingClassGroupIds:(B,C)=>{const Q=I[B]||[];return C&&e[B]?[...Q,...e[B]]:Q}}},mlg=(g,A)=>{if(g.length===0)return A.classGroupId;const I=g[0],e=A.nextPart.get(I),t=e?mlg(g.slice(1),e):void 0;if(t)return t;if(A.validators.length===0)return;const o=g.join(RfA);return A.validators.find(({validator:B})=>B(o))?.classGroupId},plg=/^\[(.+)\]$/,nWI=g=>{if(plg.test(g)){const A=plg.exec(g)[1],I=A?.substring(0,A.indexOf(":"));if(I)return"arbitrary.."+I}},sWI=g=>{const{theme:A,prefix:I}=g,e={nextPart:new Map,validators:[]};return rWI(Object.entries(g.classGroups),I).forEach(([o,B])=>{NfA(B,e,o,A)}),e},NfA=(g,A,I,e)=>{g.forEach(t=>{if(typeof t=="string"){const o=t===""?A:klg(A,t);o.classGroupId=I;return}if(typeof t=="function"){if(aWI(t)){NfA(t(e),A,I,e);return}A.validators.push({validator:t,classGroupId:I});return}Object.entries(t).forEach(([o,B])=>{NfA(B,klg(A,o),I,e)})})},klg=(g,A)=>{let I=g;return A.split(RfA).forEach(e=>{I.nextPart.has(e)||I.nextPart.set(e,{nextPart:new Map,validators:[]}),I=I.nextPart.get(e)}),I},aWI=g=>g.isThemeGetter,rWI=(g,A)=>A?g.map(([I,e])=>{const t=e.map(o=>typeof o=="string"?A+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([B,C])=>[A+B,C])):o);return[I,t]}):g,cWI=g=>{if(g<1)return{get:()=>{},set:()=>{}};let A=0,I=new Map,e=new Map;const t=(o,B)=>{I.set(o,B),A++,A>g&&(A=0,e=I,I=new Map)};return{get(o){let B=I.get(o);if(B!==void 0)return B;if((B=e.get(o))!==void 0)return t(o,B),B},set(o,B){I.has(o)?I.set(o,B):t(o,B)}}},Mlg="!",hWI=g=>{const{separator:A,experimentalParseClassName:I}=g,e=A.length===1,t=A[0],o=A.length,B=C=>{const Q=[];let i=0,E=0,n;for(let h=0;h<C.length;h++){let l=C[h];if(i===0){if(l===t&&(e||C.slice(h,h+o)===A)){Q.push(C.slice(E,h)),E=h+o;continue}if(l==="/"){n=h;continue}}l==="["?i++:l==="]"&&i--}const s=Q.length===0?C:C.substring(E),r=s.startsWith(Mlg),a=r?s.substring(1):s,c=n&&n>E?n-E:void 0;return{modifiers:Q,hasImportantModifier:r,baseClassName:a,maybePostfixModifierPosition:c}};return I?C=>I({className:C,parseClassName:B}):B},lWI=g=>{if(g.length<=1)return g;const A=[];let I=[];return g.forEach(e=>{e[0]==="["?(A.push(...I.sort(),e),I=[]):I.push(e)}),A.push(...I.sort()),A},DWI=g=>({cache:cWI(g.cacheSize),parseClassName:hWI(g),...EWI(g)}),dWI=/\s+/,yWI=(g,A)=>{const{parseClassName:I,getClassGroupId:e,getConflictingClassGroupIds:t}=A,o=[],B=g.trim().split(dWI);let C="";for(let Q=B.length-1;Q>=0;Q-=1){const i=B[Q],{modifiers:E,hasImportantModifier:n,baseClassName:s,maybePostfixModifierPosition:r}=I(i);let a=!!r,c=e(a?s.substring(0,r):s);if(!c){if(!a){C=i+(C.length>0?" "+C:C);continue}if(c=e(s),!c){C=i+(C.length>0?" "+C:C);continue}a=!1}const h=lWI(E).join(":"),l=n?h+Mlg:h,D=l+c;if(o.includes(D))continue;o.push(D);const d=t(c,a);for(let y=0;y<d.length;++y){const w=d[y];o.push(l+w)}C=i+(C.length>0?" "+C:C)}return C};function wWI(){let g=0,A,I,e="";for(;g<arguments.length;)(A=arguments[g++])&&(I=Slg(A))&&(e&&(e+=" "),e+=I);return e}const Slg=g=>{if(typeof g=="string")return g;let A,I="";for(let e=0;e<g.length;e++)g[e]&&(A=Slg(g[e]))&&(I&&(I+=" "),I+=A);return I};function uWI(g,...A){let I,e,t,o=B;function B(Q){const i=A.reduce((E,n)=>n(E),g());return I=DWI(i),e=I.cache.get,t=I.cache.set,o=C,C(Q)}function C(Q){const i=e(Q);if(i)return i;const E=yWI(Q,I);return t(Q,E),E}return function(){return o(wWI.apply(null,arguments))}}const Sc=g=>{const A=I=>I[g]||[];return A.isThemeGetter=!0,A},flg=/^\[(?:([a-z-]+):)?(.+)\]$/i,GWI=/^\d+\/\d+$/,mWI=new Set(["px","full","screen"]),pWI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kWI=/\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$/,MWI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,SWI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fWI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_F=g=>N9(g)||mWI.has(g)||GWI.test(g),b4=g=>x9(g,"length",KWI),N9=g=>!!g&&!Number.isNaN(Number(g)),xfA=g=>x9(g,"number",N9),tV=g=>!!g&&Number.isInteger(Number(g)),RWI=g=>g.endsWith("%")&&N9(g.slice(0,-1)),mi=g=>flg.test(g),H4=g=>pWI.test(g),NWI=new Set(["length","size","percentage"]),xWI=g=>x9(g,NWI,Rlg),FWI=g=>x9(g,"position",Rlg),UWI=new Set(["image","url"]),JWI=g=>x9(g,UWI,YWI),PWI=g=>x9(g,"",LWI),oV=()=>!0,x9=(g,A,I)=>{const e=flg.exec(g);return e?e[1]?typeof A=="string"?e[1]===A:A.has(e[1]):I(e[2]):!1},KWI=g=>kWI.test(g)&&!MWI.test(g),Rlg=()=>!1,LWI=g=>SWI.test(g),YWI=g=>fWI.test(g),_WI=uWI(()=>{const g=Sc("colors"),A=Sc("spacing"),I=Sc("blur"),e=Sc("brightness"),t=Sc("borderColor"),o=Sc("borderRadius"),B=Sc("borderSpacing"),C=Sc("borderWidth"),Q=Sc("contrast"),i=Sc("grayscale"),E=Sc("hueRotate"),n=Sc("invert"),s=Sc("gap"),r=Sc("gradientColorStops"),a=Sc("gradientColorStopPositions"),c=Sc("inset"),h=Sc("margin"),l=Sc("opacity"),D=Sc("padding"),d=Sc("saturate"),y=Sc("scale"),w=Sc("sepia"),u=Sc("skew"),G=Sc("space"),m=Sc("translate"),p=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto",mi,A],R=()=>[mi,A],x=()=>["",_F,b4],N=()=>["auto",N9,mi],U=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],K=()=>["solid","dashed","dotted","double","none"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],b=()=>["start","end","center","between","around","evenly","stretch"],q=()=>["","0",mi],j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Z=()=>[N9,mi];return{cacheSize:500,separator:":",theme:{colors:[oV],spacing:[_F,b4],blur:["none","",H4,mi],brightness:Z(),borderColor:[g],borderRadius:["none","","full",H4,mi],borderSpacing:R(),borderWidth:x(),contrast:Z(),grayscale:q(),hueRotate:Z(),invert:q(),gap:R(),gradientColorStops:[g],gradientColorStopPositions:[RWI,b4],inset:S(),margin:S(),opacity:Z(),padding:R(),saturate:Z(),scale:Z(),sepia:q(),skew:Z(),space:R(),translate:R()},classGroups:{aspect:[{aspect:["auto","square","video",mi]}],container:["container"],columns:[{columns:[H4]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"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:[...U(),mi]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:p()}],"overscroll-x":[{"overscroll-x":p()}],"overscroll-y":[{"overscroll-y":p()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[c]}],"inset-x":[{"inset-x":[c]}],"inset-y":[{"inset-y":[c]}],start:[{start:[c]}],end:[{end:[c]}],top:[{top:[c]}],right:[{right:[c]}],bottom:[{bottom:[c]}],left:[{left:[c]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",tV,mi]}],basis:[{basis:S()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",mi]}],grow:[{grow:q()}],shrink:[{shrink:q()}],order:[{order:["first","last","none",tV,mi]}],"grid-cols":[{"grid-cols":[oV]}],"col-start-end":[{col:["auto",{span:["full",tV,mi]},mi]}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":[oV]}],"row-start-end":[{row:["auto",{span:[tV,mi]},mi]}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",mi]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",mi]}],gap:[{gap:[s]}],"gap-x":[{"gap-x":[s]}],"gap-y":[{"gap-y":[s]}],"justify-content":[{justify:["normal",...b()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...b(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...b(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[D]}],px:[{px:[D]}],py:[{py:[D]}],ps:[{ps:[D]}],pe:[{pe:[D]}],pt:[{pt:[D]}],pr:[{pr:[D]}],pb:[{pb:[D]}],pl:[{pl:[D]}],m:[{m:[h]}],mx:[{mx:[h]}],my:[{my:[h]}],ms:[{ms:[h]}],me:[{me:[h]}],mt:[{mt:[h]}],mr:[{mr:[h]}],mb:[{mb:[h]}],ml:[{ml:[h]}],"space-x":[{"space-x":[G]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[G]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",mi,A]}],"min-w":[{"min-w":[mi,A,"min","max","fit"]}],"max-w":[{"max-w":[mi,A,"none","full","min","max","fit","prose",{screen:[H4]},H4]}],h:[{h:[mi,A,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[mi,A,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[mi,A,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[mi,A,"auto","min","max","fit"]}],"font-size":[{text:["base",H4,b4]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",xfA]}],"font-family":[{font:[oV]}],"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",mi]}],"line-clamp":[{"line-clamp":["none",N9,xfA]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_F,mi]}],"list-image":[{"list-image":["none",mi]}],"list-style-type":[{list:["none","disc","decimal",mi]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[g]}],"placeholder-opacity":[{"placeholder-opacity":[l]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[g]}],"text-opacity":[{"text-opacity":[l]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",_F,b4]}],"underline-offset":[{"underline-offset":["auto",_F,mi]}],"text-decoration-color":[{decoration:[g]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",mi]}],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",mi]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[l]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...U(),FWI]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",xWI]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},JWI]}],"bg-color":[{bg:[g]}],"gradient-from-pos":[{from:[a]}],"gradient-via-pos":[{via:[a]}],"gradient-to-pos":[{to:[a]}],"gradient-from":[{from:[r]}],"gradient-via":[{via:[r]}],"gradient-to":[{to:[r]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[C]}],"border-w-x":[{"border-x":[C]}],"border-w-y":[{"border-y":[C]}],"border-w-s":[{"border-s":[C]}],"border-w-e":[{"border-e":[C]}],"border-w-t":[{"border-t":[C]}],"border-w-r":[{"border-r":[C]}],"border-w-b":[{"border-b":[C]}],"border-w-l":[{"border-l":[C]}],"border-opacity":[{"border-opacity":[l]}],"border-style":[{border:[...K(),"hidden"]}],"divide-x":[{"divide-x":[C]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[C]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[l]}],"divide-style":[{divide:K()}],"border-color":[{border:[t]}],"border-color-x":[{"border-x":[t]}],"border-color-y":[{"border-y":[t]}],"border-color-s":[{"border-s":[t]}],"border-color-e":[{"border-e":[t]}],"border-color-t":[{"border-t":[t]}],"border-color-r":[{"border-r":[t]}],"border-color-b":[{"border-b":[t]}],"border-color-l":[{"border-l":[t]}],"divide-color":[{divide:[t]}],"outline-style":[{outline:["",...K()]}],"outline-offset":[{"outline-offset":[_F,mi]}],"outline-w":[{outline:[_F,b4]}],"outline-color":[{outline:[g]}],"ring-w":[{ring:x()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[g]}],"ring-opacity":[{"ring-opacity":[l]}],"ring-offset-w":[{"ring-offset":[_F,b4]}],"ring-offset-color":[{"ring-offset":[g]}],shadow:[{shadow:["","inner","none",H4,PWI]}],"shadow-color":[{shadow:[oV]}],opacity:[{opacity:[l]}],"mix-blend":[{"mix-blend":[...Y(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Y()}],filter:[{filter:["","none"]}],blur:[{blur:[I]}],brightness:[{brightness:[e]}],contrast:[{contrast:[Q]}],"drop-shadow":[{"drop-shadow":["","none",H4,mi]}],grayscale:[{grayscale:[i]}],"hue-rotate":[{"hue-rotate":[E]}],invert:[{invert:[n]}],saturate:[{saturate:[d]}],sepia:[{sepia:[w]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[I]}],"backdrop-brightness":[{"backdrop-brightness":[e]}],"backdrop-contrast":[{"backdrop-contrast":[Q]}],"backdrop-grayscale":[{"backdrop-grayscale":[i]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[E]}],"backdrop-invert":[{"backdrop-invert":[n]}],"backdrop-opacity":[{"backdrop-opacity":[l]}],"backdrop-saturate":[{"backdrop-saturate":[d]}],"backdrop-sepia":[{"backdrop-sepia":[w]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[B]}],"border-spacing-x":[{"border-spacing-x":[B]}],"border-spacing-y":[{"border-spacing-y":[B]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",mi]}],duration:[{duration:Z()}],ease:[{ease:["linear","in","out","in-out",mi]}],delay:[{delay:Z()}],animate:[{animate:["none","spin","ping","pulse","bounce",mi]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[y]}],"scale-x":[{"scale-x":[y]}],"scale-y":[{"scale-y":[y]}],rotate:[{rotate:[tV,mi]}],"translate-x":[{"translate-x":[m]}],"translate-y":[{"translate-y":[m]}],"skew-x":[{"skew-x":[u]}],"skew-y":[{"skew-y":[u]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",mi]}],accent:[{accent:["auto",g]}],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",mi]}],"caret-color":[{caret:[g]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",mi]}],fill:[{fill:[g,"none"]}],"stroke-w":[{stroke:[_F,b4,xfA]}],stroke:[{stroke:[g,"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"]}}});var Nlg={env:{},version:""};const Me="u">typeof window?window:void 0,Vu="u">typeof globalThis?globalThis:Me,Rw=Vu?.navigator,ro=Vu?.document,ta=Vu?.location,BV=Vu?.fetch,FfA=Vu?.XMLHttpRequest&&"withCredentials"in new Vu.XMLHttpRequest?Vu.XMLHttpRequest:void 0,xlg=Vu?.AbortController,bWI=Vu?.CompressionStream,Am=Rw?.userAgent,CV=typeof globalThis<"u"?globalThis:Me;CV&&typeof self>"u"&&(CV.self=CV),CV&&typeof File>"u"&&(CV.File=function(){});const FB=Me??{},HWI="0.9.11",bF={DEBUG:!1,LIB_VERSION:HWI,LIB_NAME:"browser-common"};var xN=(function(g){return g.AnonymousId="anonymous_id",g.DistinctId="distinct_id",g.Props="props",g.EnablePersonProcessing="enable_person_processing",g.PersonMode="person_mode",g.FeatureFlagDetails="feature_flag_details",g.FeatureFlags="feature_flags",g.FeatureFlagPayloads="feature_flag_payloads",g.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",g.BootstrapFeatureFlags="bootstrap_feature_flags",g.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",g.OverrideFeatureFlags="override_feature_flags",g.Queue="queue",g.AiQueue="ai_queue",g.AiCaptureQueue="ai_capture_queue",g.LogsQueue="logs_queue",g.OptedOut="opted_out",g.SessionId="session_id",g.SessionStartTimestamp="session_start_timestamp",g.SessionLastTimestamp="session_timestamp",g.PersonProperties="person_properties",g.GroupProperties="group_properties",g.InstalledAppBuild="installed_app_build",g.InstalledAppVersion="installed_app_version",g.SessionReplay="session_replay",g.PushRegistered="push_registered",g.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",g.SurveyLastSeenDate="survey_last_seen_date",g.SurveysInProgress="surveys_in_progress",g.SurveysSeen="surveys_seen",g.Surveys="surveys",g.RemoteConfig="remote_config",g.FlagsEndpointWasHit="flags_endpoint_was_hit",g.DeviceId="device_id",g})({}),UfA=(function(g){return g.GZipJS="gzip-js",g.Base64="base64",g})({});const vWI=["$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"],qWI=["token"];function yB(g,A){return g.indexOf(A)!==-1}const F9=function(g){return g.trim()},JfA=function(g){return g.replace(/^\$/,"")};function Flg(g){var A;const I=[];return(A=JSON.stringify(g,function(e,t){if(typeof t=="bigint")return t.toString();if(typeof t!="function"&&typeof t!="symbol"){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&typeof t=="object"){for(;I.length>0&&I[I.length-1]!==this;)I.pop();if(I.includes(t))return"[Circular]";I.push(t)}return t}}))!==null&&A!==void 0?A:"null"}const Ulg=Object.prototype,PfA=Ulg.hasOwnProperty,lCA=Ulg.toString,aB=Array.isArray||function(g){return lCA.call(g)==="[object Array]"},Xh=g=>typeof g=="function",yC=g=>g===Object(g)&&!aB(g),_p=g=>{if(yC(g)){for(const A in g)if(PfA.call(g,A))return!1;return!0}return!1},Le=g=>g===void 0,UC=g=>lCA.call(g)=="[object String]",QV=g=>UC(g)&&g.trim().length===0,fc=g=>g===null,rC=g=>Le(g)||fc(g),$h=g=>lCA.call(g)=="[object Number]"&&g==g,HF=g=>$h(g)&&g>0,gm=g=>lCA.call(g)==="[object Boolean]",TWI=g=>yB(vWI,g),ZWI=g=>yB(qWI,g);function Jlg(g){return g===null||typeof g!="object"}function DCA(g,A){return{}.toString.call(g)===`[object ${A}]`}function U9(g){switch({}.toString.call(g)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Plg(g,Error)}}function KfA(g){return"u">typeof Event&&Plg(g,Event)}function Plg(g,A){try{return g instanceof A}catch{return!1}}const OWI=[!0,"true",1,"1","yes"],LfA=g=>yB(OWI,g),WWI=[!1,"false",0,"0","no"];function Klg(g,A,I,e,t,o,B){try{var C=g[o](B),Q=C.value}catch(i){return void I(i)}C.done?A(Q):Promise.resolve(Q).then(e,t)}function oa(g){return function(){var A=this,I=arguments;return new Promise(function(e,t){var o=g.apply(A,I);function B(Q){Klg(o,e,t,B,C,"next",Q)}function C(Q){Klg(o,e,t,B,C,"throw",Q)}B(void 0)})}}const VWI=["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"],dCA=new Map,Llg=function(g,A=[]){if(!g)return!1;const I=(function(B,C){let Q="";for(let i=0;C.length>i;i++){const E=C[i];Q+=E.length+":"+E}return B.length+":"+B+"|"+C.length+":"+Q})(g,A),e=dCA.get(I);if(e!==void 0)return e;const t=g.toLowerCase(),o=VWI.concat(A).some(B=>t.indexOf(B.toLowerCase())!==-1);return 256>dCA.size||dCA.clear(),dCA.set(I,o),o};function FN(g,A,I,e,t){return A>I&&(e.warn("min cannot be greater than max."),A=I),$h(g)?g>I?(e.warn(" cannot be greater than max: "+I+". Using max value instead."),I):A>g?(e.warn(" cannot be less than min: "+A+". Using min value instead."),A):g:(e.warn(" must be a number. using max or fallback. max: "+I+", fallback: "+t),FN(t??I,A,I,e))}var jWI=class{constructor(A){this.C={},this.I=A.I,this.R=FN(A.bucketSize,0,100,A.$),this.A=FN(A.refillRate,0,this.R,A.$),this.O=FN(A.refillInterval,0,864e5,A.$)}F(A,I){const e=Math.floor((I-A.lastAccess)/this.O);e>0&&(A.tokens=Math.min(A.tokens+e*this.A,this.R),A.lastAccess=A.lastAccess+e*this.O)}consumeRateLimit(A){var I;const e=Date.now(),t=String(A);let o=this.C[t];return o?this.F(o,e):(o={tokens:this.R,lastAccess:e},this.C[t]=o),o.tokens===0||(o.tokens--,o.tokens===0&&((I=this.I)===null||I===void 0||I.call(this,A)),o.tokens===0)}stop(){this.C={}}};const J9="Mobile",iV="Android",yCA="Tablet",Ylg="Android Tablet",_lg="iPad",blg="Apple Watch",wCA="Safari",uCA="BlackBerry",Hlg="Samsung Internet",GCA="Chrome",vlg="Chrome iOS",qlg="Internet Explorer",Tlg="Internet Explorer Mobile",Zlg="Opera",Olg="Microsoft Edge",mCA="Firefox",Wlg="Firefox iOS",pCA="Nintendo",kCA="PlayStation",MCA="Xbox",Vlg="Android Mobile",jlg="Mobile Safari",YfA="Windows",zlg="Windows Phone",Xlg="Nokia",_fA="Ouya",zWI="Generic "+J9.toLowerCase(),$lg="Generic "+yCA.toLowerCase(),bfA="Konqueror",ADg="Oculus Browser",gDg="Vivaldi",IDg="Yandex",eDg="Whale",tDg="DuckDuckGo",oDg="Pale Moon",BDg="Waterfox",HfA="Brave",CDg="Claude",QDg="Codex",iDg="ChatGPT",EDg="Google Search App",vfA=new RegExp("Version/(\\d+(\\.\\d+)?)"),qfA=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),XWI=new RegExp(MCA,"i"),$WI=new RegExp("PlayStation \\w+","i"),AVI=new RegExp("Nintendo \\w+","i"),TfA=new RegExp("BlackBerry|PlayBook|BB10","i"),gVI={"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"},nDg=function(g,A,I,e){return A=A||"",(function(o){return o?.brave?HfA:null})(I)||(e?.detectGoogleSearchApp&&yB(g,"GSA/")?EDg:yB(g," OPR/")&&yB(g,"Mini")?"Opera Mini":yB(g," OPR/")?Zlg:TfA.test(g)?uCA:yB(g,"IEMobile")||yB(g,"WPDesktop")?Tlg:yB(g,"OculusBrowser")?ADg:yB(g,"SamsungBrowser")?Hlg:yB(g,"Edge")||yB(g,"Edg/")?Olg:yB(g,"Vivaldi/")?gDg:yB(g,"YaBrowser/")?IDg:yB(g,"Whale/")?eDg:yB(g,"DuckDuckGo/")||yB(g,"Ddg/")?tDg:yB(g,"Claude/")?CDg:yB(g,"Codex/")?QDg:yB(g,"ChatGPT/")?iDg:yB(g,"FBIOS")?"Facebook Mobile":yB(g,"UCWEB")||yB(g,"UCBrowser")?"UC Browser":yB(g,"CriOS")?vlg:yB(g,"CrMo")||yB(g,GCA)?GCA:yB(g,iV)&&yB(g,wCA)?Vlg:yB(g,"FxiOS")?Wlg:yB(g.toLowerCase(),bfA.toLowerCase())?bfA:yB(g,"Brave/")?HfA:((o,B)=>B&&yB(B,"Apple")||(function(C){return yB(C,wCA)&&!yB(C,GCA)&&!yB(C,iV)})(o))(g,A)?yB(g,J9)?jlg:wCA:yB(g,"PaleMoon/")?oDg:yB(g,"Waterfox/")?BDg:yB(g,mCA)?mCA:yB(g,"MSIE")||yB(g,"Trident/")?qlg:yB(g,"Gecko")?mCA:"")},IVI={[Tlg]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Olg]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[GCA]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[vlg]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[wCA]:[vfA],[jlg]:[vfA],[Zlg]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[mCA]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[Wlg]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[bfA]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[uCA]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),vfA],[Vlg]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Hlg]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[ADg]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[gDg]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[IDg]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[eDg]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[HfA]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[CDg]:[qfA],[QDg]:[qfA],[iDg]:[qfA],[tDg]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[oDg]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[BDg]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[EDg]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[qlg]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},eVI=function(g,A,I,e){const t=nDg(g,A,I,e),o=IVI[t];if(Le(o))return null;for(let B=0;o.length>B;B++){const C=g.match(o[B]);if(C)return parseFloat(C[C.length-2])}return null},sDg=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),g=>[MCA,g&&g[1]||""]],[new RegExp(pCA,"i"),[pCA,""]],[new RegExp(kCA,"i"),[kCA,""]],[TfA,[uCA,""]],[new RegExp(YfA,"i"),(g,A)=>{if(/Phone/.test(A)||/WPDesktop/.test(A))return[zlg,""];if(new RegExp(J9).test(A)&&!/IEMobile\b/.test(A))return["Windows Mobile",""];const I=/Windows NT ([0-9.]+)/i.exec(A);if(I&&I[1]){let e=gVI[I[1]]||"";return/arm/i.test(A)&&(e="RT"),[YfA,e]}return[YfA,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,g=>g&&g[3]?["iOS",[g[3],g[4],g[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,g=>{let A="";return g&&g.length>=3&&(A=Le(g[2])?g[3]:g[2]),["watchOS",A]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),g=>g&&g[2]?[iV,[g[2],g[3],g[4]||"0"].join(".")]:[iV,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,g=>{const A=["Mac OS X",""];return g&&g[1]&&(A[1]=[g[1],g[2],g[3]||"0"].join(".")),A}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],aDg=function(g){for(let A=0;sDg.length>A;A++){const[I,e]=sDg[A],t=I.exec(g),o=t&&(Xh(e)?e(t,g):e);if(o)return o}return["",""]},rDg=function(g){return AVI.test(g)?pCA:$WI.test(g)?kCA:XWI.test(g)?MCA:new RegExp(_fA,"i").test(g)?_fA:new RegExp("(Windows Phone|WPDesktop)","i").test(g)?zlg:/iPad/.test(g)?_lg:/iPod/.test(g)?"iPod Touch":/iPhone/.test(g)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(g)?blg:TfA.test(g)?uCA:/(kobo)\s(ereader|touch)/i.test(g)?"Kobo":new RegExp(Xlg,"i").test(g)?Xlg:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(g)||/(kf[a-z]+)( bui|\)).+silk\//i.test(g)?"Kindle Fire":/(Android|ZTE)/i.test(g)?new RegExp(J9).test(g)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(g)||/pixel[\daxl ]{1,6}/i.test(g)&&!/pixel c/i.test(g)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(g)||/lmy47v/i.test(g)&&!/QTAQZ3/i.test(g)?iV:Ylg:new RegExp("(pda|Mobile)","i").test(g)?zWI:new RegExp(yCA,"i").test(g)&&!new RegExp("Tablet pc","i").test(g)?$lg:""},tVI=function(g,A){var I;const e=rDg(g);return e===_lg||e===Ylg||e==="Kobo"||e==="Kindle Fire"||e===$lg?yCA:e===pCA||e===MCA||e===kCA||e===_fA?"Console":e===blg?"Wearable":e?J9:A?.userAgentDataPlatform==="Android"&&((I=A?.maxTouchPoints)!==null&&I!==void 0?I:0)>0?600>Math.min((t=A?.screenWidth)!==null&&t!==void 0?t:0,(o=A?.screenHeight)!==null&&o!==void 0?o:0)/((B=A?.devicePixelRatio)!==null&&B!==void 0?B:1)?J9:yCA:"Desktop";var t,o,B},ZfA=/\bFBAV\/(\d+(?:\.\d+)*)/i,cDg=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",ZfA],[/\bFBAN\/EMA\b/i,"Facebook Lite",ZfA],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",ZfA],[/\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"]],OfA="[Truncated]",EV="[Unserializable]";function P9(g){let A="";for(let I=0;g.length>I;I++){const e=g.charCodeAt(I);if(55296>e||e>56319)A+=56320>e||e>57343?g[I]:"�";else{const t=g.charCodeAt(I+1);56320>t||t>57343?A+="�":(A+=g[I]+g[I+1],I++)}}return A}function hDg(g,A){if(!A)return g;let I=[];try{I=Object.keys(A)}catch{I=[]}for(const e of I){let t;try{t=A[e]}catch{t=EV}Object.defineProperty(g,e,{value:t,enumerable:!0,writable:!0,configurable:!0})}return g}const SCA=3e5;var lDg=class{record(A){if(A.kind==="too-large")return;if(A.kind!=="retry-later")return void this.reset();if(!A.retryAfterMs)return;const I=this.isOpen(),e=Date.now(),t=Math.min(A.retryAfterMs,SCA);if(!I)return this.ts=e,void(this.es=e+t);this.es=Math.max(this.es,Math.min(e+t,this.ts+SCA))}remainingMs(){const A=Date.now();if(this.ts-5e3>A)return this.reset(),0;const I=Math.min(SCA,Math.max(0,this.es-A));return I===0&&this.reset(),I}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const oVI=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function DDg(g,A){return typeof(I=g)=="string"&&oVI.test(I)?g:A();var I}function dDg(g,A){const I=new Error(A);try{Object.defineProperty(I,"name",{value:g,writable:!0,enumerable:!0,configurable:!0})}catch{}return I}function v4(g){return g&&g.split("#")[0]}function yDg(g){try{return g()}catch{return}}function wDg(g,A){const I=setTimeout(g,A);return I!=null&&I.unref&&I?.unref(),I}function uDg(g,A,I){return GDg.apply(this,arguments)}function GDg(){return(GDg=oa(function*(g,A,I){let e;try{return yield Promise.race([g,new Promise((t,o)=>{e=wDg(()=>{try{I?.(),t()}catch(B){o(B)}},A)})])}finally{clearTimeout(e)}})).apply(this,arguments)}function nV(g){return nV=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},nV(g)}function BVI(g,A,I){return(A=(function(e){var t=(function(o){if(nV(o)!="object"||!o)return o;var B=o[Symbol.toPrimitive];if(B!==void 0){var C=B.call(o,"string");if(nV(C)!="object")return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)})(e);return nV(t)=="symbol"?t:t+""})(A))in g?Object.defineProperty(g,A,{value:I,enumerable:!0,configurable:!0,writable:!0}):g[A]=I,g}function mDg(g,A){var I=Object.keys(g);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(g);A&&(e=e.filter(function(t){return Object.getOwnPropertyDescriptor(g,t).enumerable})),I.push.apply(I,e)}return I}function QI(g){for(var A=1;arguments.length>A;A++){var I=arguments[A]!=null?arguments[A]:{};A%2?mDg(Object(I),!0).forEach(function(e){BVI(g,e,I[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(I)):mDg(Object(I)).forEach(function(e){Object.defineProperty(g,e,Object.getOwnPropertyDescriptor(I,e))})}return g}let sV,pDg,kDg,K9;function CVI(g){var A;const I=globalThis._posthogChunkIds,e=globalThis._debugIds;if(!I&&!e)return;const t=I?Object.keys(I):[],o=e?Object.keys(e):[];if(K9&&MDg(I,t,pDg)&&MDg(e,o,kDg))return K9;pDg=I?QI({},I):void 0,kDg=e?QI({},e):void 0,K9={},(A=sV)!==null&&A!==void 0||(sV={});const B=(C,Q)=>{for(const E of C){const n=Q[E];if(!n)continue;const s=sV?.[E];if(s){K9[s]=n;continue}const r=g(E);for(let a=r.length-1;a>=0;a--){var i;const c=(i=r[a])===null||i===void 0?void 0:i.filename;if(c){K9[c]=n,sV[E]=c;break}}}};return e&&B(o,e),I&&B(t,I),K9}function MDg(g,A,I){return g&&I?A.length===Object.keys(I).length&&A.every(e=>g[e]===I[e]):g===I}var QVI=class{constructor(A,I,e=[]){this.coercers=A,this.stackParser=I,this.modifiers=e}buildFromUnknown(A,I={}){const e=I&&I.mechanism||{handled:!0,type:"generic"},t=this.buildCoercingContext(e,I,0).apply(A),o=this.buildParsingContext(I),B=this.parseStacktrace(t,o);return{$exception_list:this.convertToExceptionList(B,e),$exception_level:"error"}}modifyFrames(A){var I=this;return oa(function*(){for(const e of A)e.stacktrace&&e.stacktrace.frames&&aB(e.stacktrace.frames)&&(e.stacktrace.frames=yield I.applyModifiers(e.stacktrace.frames));return A})()}coerceFallback(A){var I;return{type:"Error",value:"Unknown error",stack:(I=A.syntheticException)===null||I===void 0?void 0:I.stack,synthetic:!0}}parseStacktrace(A,I){var e;let t,o;if(A.cause!=null&&(t=this.parseStacktrace(A.cause,I)),A.stack!=""&&A.stack!=null)try{o=this.applyChunkIds(this.stackParser(A.stack,A.synthetic?I.skipFirstLines:0),I.chunkIdMap)}catch{}return QI(QI({},A),{},{cause:t,stack:o,errors:(e=A.errors)===null||e===void 0?void 0:e.map(B=>this.parseStacktrace(B,I))})}applyChunkIds(A,I){return A.map(e=>(e.filename&&I&&(e.chunk_id=I[e.filename]),e))}applyCoercers(A,I){for(const e of this.coercers)if(e.match(A))return e.coerce(A,I);return this.coerceFallback(I)}applyModifiers(A){var I=this;return oa(function*(){let e=A;for(const t of I.modifiers)e=yield t(e);return e})()}convertToExceptionList(A,I){const e=[],t=(o,B,C)=>{var Q;const i=e.length,E=B===void 0?QI(QI({type:typeof I.type=="string"&&I.type.length>0?I.type:"generic"},typeof I.handled=="boolean"?{handled:I.handled}:I.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof I.synthetic=="boolean"?I.synthetic:o.synthetic,exception_id:i}):{type:"chained",source:C,synthetic:o.synthetic,exception_id:i,parent_id:B},n={type:o.type,value:o.value,mechanism:E};o.stack&&(n.stacktrace={type:"raw",frames:o.stack}),e.push(n),o.cause&&t(o.cause,i,"cause");for(const s of(Q=o.errors)!==null&&Q!==void 0?Q:[])t(s,i,"member")};return t(A),e}buildParsingContext(A){var I;return{chunkIdMap:CVI(this.stackParser),skipFirstLines:(I=A.skipFirstLines)!==null&&I!==void 0?I:1}}getAggregateErrors(A){try{if(U9(A)){let e=Object.getPrototypeOf(A);for(let t=0;e&&100>t;t++){var I;const o=(I=Object.getOwnPropertyDescriptor(e,"constructor"))===null||I===void 0?void 0:I.value;if(typeof o=="function"&&o.name==="AggregateError"){const B=A.errors;return aB(B)?B:void 0}e=Object.getPrototypeOf(e)}}}catch{}}buildCoercingContext(A,I,e=0){let t=0,o=0,B=!1;const C=new Set,Q=[],i={},E=(r,a,c=0)=>{const h=n(a,c),l=h.apply;if(h.apply=G=>{Q.push(r);try{return l(G)}finally{Q.pop()}},c>4||c>0&&Q.indexOf(r)!==-1)return this.coerceFallback(h);const D=typeof r=="object"&&r!==null||typeof r=="function";if(c===0&&t>=50||D&&C.has(r))return;D&&C.add(r),c===0&&t++;const d=this.getAggregateErrors(r);let y,w;B||(B=!!d);try{if(y=this.applyCoercers(r,h),!y)throw i}catch(G){if(G===i)return void(c===0&&t--);if(!B)throw G;y=this.coerceFallback(h)}if(!d||t>=50)return y;try{w=d.length}catch{return y}if(!Number.isInteger(w)||0>w||w>4294967295)return y;const u=[];for(let G=0;50>t&&1e3>o&&w>G;G++){let m;o++;try{m=h.next(d[G])}catch{t++,m=this.coerceFallback(n(a+1))}m&&u.push(m)}return QI(QI({},y),{},{errors:u})},n=(r,a=0)=>QI(QI({},I),{},{syntheticException:r==0?I.syntheticException:void 0,mechanism:r==0?A:{},apply(c){const h=E(c,r,a+1);if(!h)throw i;return h},next:c=>E(c,r+1)}),s=n(e);return QI(QI({},s),{},{apply:r=>{var a;return(a=E(r,e))!==null&&a!==void 0?a:this.coerceFallback(s)}})}};const iVI=/^([a-z][a-z0-9.+-]+):/i,EVI=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function nVI(g){if(!g||g==="<anonymous>")return!1;const A=iVI.exec(g);return!A||EVI.includes(A[1].toLowerCase())}function WfA(g,A,I,e,t){const o={platform:g,filename:A,function:I==="<anonymous>"?"?":I,in_app:nVI(A)};return Le(e)||(o.lineno=e),Le(t)||(o.colno=t),o}const SDg=(g,A)=>{const I=g.indexOf("safari-extension")!==-1,e=g.indexOf("safari-web-extension")!==-1;return I||e?[g.indexOf("@")!==-1?g.split("@")[0]:"?",I?`safari-extension:${A}`:`safari-web-extension:${A}`]:[g,A]},sVI=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,aVI=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,rVI=/\((\S*)(?::(\d+))(?::(\d+))\)/,cVI=(g,A)=>{const I=sVI.exec(g);if(I){const[,t,o,B]=I;return WfA(A,t,"?",+o,+B)}const e=aVI.exec(g);if(e){if(e[2]&&e[2].indexOf("eval")===0){const B=rVI.exec(e[2]);B&&(e[2]=B[1],e[3]=B[2],e[4]=B[3])}const[t,o]=SDg(e[1]||"?",e[2]);return WfA(A,o,t,e[3]?+e[3]:void 0,e[4]?+e[4]:void 0)}},hVI=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,lVI=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,DVI=(g,A)=>{const I=hVI.exec(g);if(I){if(I[3]&&I[3].indexOf(" > eval")>-1){const o=lVI.exec(I[3]);o&&(I[1]=I[1]||"eval",I[3]=o[1],I[4]=o[2],I[5]="")}let e=I[3],t=I[1]||"?";return[t,e]=SDg(t,e),WfA(A,e,t,I[4]?+I[4]:void 0,I[5]?+I[5]:void 0)}},fDg=/\(error: (.*)\)/;function VfA(g,A){return g.filename===A.filename&&g.function===A.function&&g.module===A.module&&g.lineno===A.lineno&&g.colno===A.colno}function dVI(g){for(let A=1;10>=A;A++){const I=g.length-2*A;if(0>I)break;let e=!0;for(let t=0;A>t;t++)if(!VfA(g[I+t],g[I+A+t])){e=!1;break}if(e){for(let t=0;A>t;t++)g[I+t]=g[I+A+t];return g.length=I+A,{start:I,length:A}}}}function yVI(g,A){const I=A.start+A.length,e=NDg(g,A);e&&g.splice(I+e===g.length?I:A.start,e)}function RDg(g,A){let I=A.start;for(;I>0&&VfA(g[I-1],g[I-1+A.length]);)I--;return A.start-I}function NDg(g,A){const I=A.start+A.length;let e=I;for(;g.length>e&&VfA(g[e],g[e-A.length]);)e++;return e-I}function wVI(g,A){const I=A[0];let e=g.length-(I?RDg(g,I):0);for(const t of A)e-=NDg(g,t);return e}function uVI(g,A,I){for(let e=0;g.length>e;e++){const t=g[(A+e)%g.length],o=g[(I+e)%g.length];if(t!==o)return o>t}return!1}var GVI=class{match(A){return this.isDOMException(A)||this.isDOMError(A)}coerce(A,I){const e=UC(A.stack);return{type:this.getType(A),value:this.getValue(A),stack:e?A.stack:void 0,cause:A.cause?I.next(A.cause):void 0,synthetic:!1}}getType(A){return this.isDOMError(A)?"DOMError":"DOMException"}getValue(A){const I=A.name||(this.isDOMError(A)?"DOMError":"DOMException");return A.message?`${I}: ${A.message}`:I}isDOMException(A){return DCA(A,"DOMException")}isDOMError(A){return DCA(A,"DOMError")}},mVI=class{match(A){return U9(A)}coerce(A,I){var e;const t=this.getStack(A),o=t===void 0?(e=I.syntheticException)===null||e===void 0?void 0:e.stack:void 0,B=!!o;return{type:this.getType(A),value:this.getMessage(A,I),stack:t??o,cause:A.cause?I.next(A.cause):void 0,synthetic:B}}getType(A){return A.name||A.constructor.name}getMessage(A,I){const e=A.message;return String(e.error&&typeof e.error.message=="string"?e.error.message:e)}getStack(A){try{const I=A.stacktrace;if(typeof I=="string"&&I.length>0)return I;const e=A.stack;return typeof e=="string"&&e.length>0?e:void 0}catch{return}}},pVI=class{match(A){return!!DCA(A,"ErrorEvent")&&(A.error!=null||this.hr(A))}coerce(A,I){var e;if(A.error!=null)return I.apply(A.error);const t=I.apply(A.message);return QI(QI({},t),{},{stack:(e=this.vr(A))!==null&&e!==void 0?e:t.stack,synthetic:!0})}hr(A){return UC(A.message)&&A.message.length>0}vr(A){var I,e;const t=A,o=(I=t.lineno)!==null&&I!==void 0?I:0,B=(e=t.colno)!==null&&e!==void 0?e:0;if(UC(t.filename)&&t.filename.length!==0&&o!==0)return`Error
240
- at ${t.filename}:${o}:${B}`}};const kVI=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var MVI=class{match(A){return typeof A=="string"}coerce(A,I){var e;const[t,o]=this.getInfos(A);return{type:t??"Error",value:o??A,stack:(e=I.syntheticException)===null||e===void 0?void 0:e.stack,synthetic:!0}}getInfos(A){let I="Error",e=A;const t=A.match(kVI);return t&&(I=t[1],e=t[2]),[I,e]}};const SVI=["fatal","error","warning","log","info","debug"];function xDg(g,A=40){const I=Object.keys(g);if(I.sort(),!I.length)return"[object has no keys]";for(let e=I.length;e>0;e--){const t=I.slice(0,e).join(", ");if(A>=t.length)return e===I.length?t:t.length>A?`${t.slice(0,A)}...`:t}return""}var fVI=class{match(A){return typeof A=="object"&&A!==null}coerce(A,I){var e,t;const o=this.getErrorPropertyFromObject(A);return o?I.apply(o):{type:this.getType(A),value:this.getValue(A),stack:(e=this.getStack(A))!==null&&e!==void 0?e:(t=I.syntheticException)===null||t===void 0?void 0:t.stack,level:this.isSeverityLevel(A.level)?A.level:"error",synthetic:!0}}getType(A){if(KfA(A))return A.constructor.name;const I="name"in A?A.name:void 0;return UC(I)&&!QV(I)?I:"Error"}getValue(A){if("name"in A&&typeof A.name=="string"){let e=`'${A.name}' captured as exception`;return"message"in A&&typeof A.message=="string"&&(e+=` with message: '${A.message}'`),e}if("message"in A&&typeof A.message=="string")return A.message;const I=this.getObjectClassName(A);return`${I&&I!=="Object"?`'${I}'`:"Object"} captured as exception with keys: ${xDg(A)}`}isSeverityLevel(A){return UC(A)&&!QV(A)&&SVI.indexOf(A)>=0}getStack(A){try{return UC(A.stacktrace)&&A.stacktrace.length>0?A.stacktrace:UC(A.stack)&&A.stack.length>0?A.stack:void 0}catch{return}}getErrorPropertyFromObject(A){for(const I in A)if({}.hasOwnProperty.call(A,I)){const e=A[I];if(U9(e))return e}}getObjectClassName(A){try{const I=Object.getPrototypeOf(A);return I?I.constructor.name:void 0}catch{return}}},RVI=class{match(A){return KfA(A)}coerce(A,I){var e;const t=A.constructor.name;return{type:t,value:`${t} captured as exception with keys: ${xDg(A)}`,stack:(e=I.syntheticException)===null||e===void 0?void 0:e.stack,synthetic:!0}}},NVI=class{match(A){return Jlg(A)}coerce(A,I){var e;return{type:"Error",value:`Primitive value captured as exception: ${String(A)}`,stack:(e=I.syntheticException)===null||e===void 0?void 0:e.stack,synthetic:!0}}},xVI=class{match(A){return DCA(A,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(A)}isCustomEventWrappingRejection(A){if(!KfA(A))return!1;try{const I=A.detail;return I!=null&&typeof I=="object"&&"reason"in I}catch{return!1}}coerce(A,I){var e;const t=this.getUnhandledRejectionReason(A);return Jlg(t)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`,stack:(e=I.syntheticException)===null||e===void 0?void 0:e.stack,synthetic:!0}:I.apply(t)}getUnhandledRejectionReason(A){try{if("reason"in A)return A.reason;if("detail"in A&&A.detail!=null&&typeof A.detail=="object"&&"reason"in A.detail)return A.detail.reason}catch{}return A}};const fCA="$message",RCA="$timestamp",FVI=new Set([fCA,RCA]),jfA={enabled:!0,max_bytes:32768};function NCA(g){var A;return g?{enabled:(A=g.enabled)!==null&&A!==void 0?A:jfA.enabled,max_bytes:JVI(g.max_bytes,jfA.max_bytes)}:QI({},jfA)}var UVI=class{constructor(A){this.ns=[],this.ss=0,this.Ar=NCA(A)}setConfig(A){this.Ar=NCA(A),this.rs()}add(A){const I=(function(t){let o;try{o=Flg(t)}catch{return}try{const B=JSON.parse(o);if(!yC(B))return;const C=B,Q=C[fCA],i=C[RCA];return!UC(Q)||Q.trim().length===0||!UC(i)&&!$h(i)?void 0:{step:C,json:o}}catch{return}})(A);if(!I)return;const e=(function(t){if("u">typeof TextEncoder)return new TextEncoder().encode(t).length;const o=encodeURIComponent(t);let B=0;for(let C=0;o.length>C;C++)o[C]==="%"?(B+=1,C+=2):B+=1;return B})(I.json);e>this.Ar.max_bytes||(this.ns.push({step:I.step,bytes:e}),this.ss+=e,this.rs())}getAttachable(){return this.ns.map(A=>A.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Ar.max_bytes&&this.ns.length>0;){const A=this.ns.shift();A&&(this.ss-=A.bytes)}}};function JVI(g,A){if(!$h(g)||g===1/0||g===-1/0)return A;const I=Math.floor(g);return 0>I?A:I}const FDg=g=>{if(typeof g!="string")return g;try{return JSON.parse(g)}catch{return g}};function UDg(g){return typeof g=="string"||g}function JDg(g){return typeof g=="string"?g:void 0}const PVI=["$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","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],PDg="NativeGzipValidationError",zfA=g=>g.length>=2&&g[0]===31&&g[1]===139,KDg=(g,A)=>g===UfA.GZipJS||A===UfA.GZipJS||A==="gzip",LDg=g=>!(!g||typeof g!="object")&&("name"in g?String(g.name):"")==="NotReadableError";let aV;const xCA=g=>{throw dDg(PDg,`Native gzip produced invalid output: ${g}`)},KVI=(YDg=oa(function*(g,A){18>g.size&&xCA("too-short");const I=new Uint8Array(yield g.slice(0,10).arrayBuffer());zfA(I)&&I[2]===8||xCA("invalid-header");const e=new DataView(yield g.slice(g.size-8).arrayBuffer());e.getUint32(0,!0)!==(o=>{const B=(()=>{if(aV)return aV;aV=[];for(let Q=0;256>Q;Q++){let i=Q;for(let E=0;8>E;E++)i=1&i?3988292384^i>>>1:i>>>1;aV[Q]=i>>>0}return aV})();let C=4294967295;for(let Q=0;o.length>Q;Q++)C=B[255&(C^o[Q])]^C>>>8;return(4294967295^C)>>>0})(A)&&xCA("invalid-crc");const t=A.length>>>0;e.getUint32(4,!0)!==t&&xCA("invalid-size")}),function(g,A){return YDg.apply(this,arguments)});var YDg;function XfA(){return XfA=oa(function*(g,A=!0,I){try{const t=new TextEncoder().encode(g),o=new globalThis.CompressionStream("gzip"),B=o.writable.getWriter(),C=B.write(t).then(()=>B.close()).catch((e=oa(function*(E){try{yield B.abort(E)}catch{}throw E}),function(E){return e.apply(this,arguments)})),Q=new Response(o.readable).blob(),[i]=yield Promise.all([Q,C]);return yield KVI(i,t),i}catch(t){if(I?.rethrow)throw t;return A&&console.error("Failed to gzip compress data",t),null}var e}),XfA.apply(this,arguments)}function _Dg(g,A){if(g==null)return{};var I,e,t=(function(B,C){if(B==null)return{};var Q={};for(var i in B)if({}.hasOwnProperty.call(B,i)){if(C.includes(i))continue;Q[i]=B[i]}return Q})(g,A);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(g);for(e=0;o.length>e;e++)A.includes(I=o[e])||{}.propertyIsEnumerable.call(g,I)&&(t[I]=g[I])}return t}const ju="[redacted]",LVI=/^[A-Za-z0-9+/\n\r]+=*$/,YVI=/^[A-Za-z0-9_-]+={0,2}$/,_VI=/[-_]/,bVI=/^data:[^,\s]*;base64,/i,HVI=/^[A-Za-z0-9+/_-]+={0,2}$/,vVI=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,qVI=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,bDg=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,TVI=/[\s<>"]/,HDg=new RegExp(bDg.source,"i"),vDg=/[a-z][a-z0-9+.-]{0,63}:\/\//i,ZVI=new RegExp(`^${vDg.source}`,"i"),OVI=new RegExp(vDg.source,"gi"),WVI=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,VVI=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,jVI=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,zVI=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,XVI=/\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,$VI=/(^|[^\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,AjI=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,gjI=/\b\d(?:[ ./-]?\d){12,}\b/g,qDg=/\d+/g,IjI=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,ejI=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function $fA(g){return(function(A){return qVI.test(A)})(g)||WVI.test(g)||VVI.test(g)}function ARA(g){return g.split("&",129).length>128}function tjI(g,A,I){return $fA(g)||A.includes(";")&&(function(e){return e.split(";").some(t=>$fA(t.split("=",1)[0]))})(A)?ju:HDg.test(A)?I?IRA(A,{allowNestedUrls:!1,stripPunctuation:!0}):ju:A}function TDg(g,A){const I=new URLSearchParams;let e=!1,t=!1;for(const[o,B]of new URLSearchParams(g)){const C=FCA(o),Q=FCA(B);e||(e=C!==o||Q!==B);const i=tjI(C,Q,A);e||(e=i!==Q),t=$fA(C)||i!==Q,I.append(C,i)}return{changed:e,lastFieldSensitive:t,serialized:I.toString()}}function ZDg(g,A){if(!g.includes("="))return{value:ojI(g,A),lastFieldSensitive:!1};const I=TDg(g,A);return{value:I.changed?I.serialized:g,lastFieldSensitive:I.lastFieldSensitive}}function ojI(g,A){return A?IRA(g,{allowNestedUrls:!1,stripPunctuation:!0}):HDg.test(g)?ju:g}function BjI(g,A,I){return g==="#"?!A.fragment&&(A.fragment=!0):g==="?"&&(A.fragment?I!=="="&&!A.fragmentQuery&&(A.fragmentQuery=!0):!A.query&&(A.query=!0))}function gRA(g,A){var I;if(g.length>8192&&ZVI.test(g))return ju;const{address:e,suffix:t}=A.stripPunctuation?(function(h){let l=h.length;for(;l>0&&".,;:!?)]}'".includes(h[l-1]);)l--;return{address:h.slice(0,l),suffix:h.slice(l)}})(g):{address:g,suffix:""};let o;try{o=new URL(e)}catch{return ju+t}const B=o.search.slice(1),C=o.hash!=="",Q=(function(h){const l=h.slice(1),D=l.indexOf("?");return 0>D?{head:l,tail:null}:{head:l.slice(0,D),tail:l.slice(D+1)}})(o.hash);if(ARA(B)||ARA(Q.head)||ARA((I=Q.tail)!==null&&I!==void 0?I:""))return ju+t;let i=!1;(o.username||o.password)&&(o.username=ju,o.password="",i=!0);const E=TDg(B,A.allowNestedUrls);E.changed&&(o.search=E.serialized,i=!0);const n=ZDg(Q.head,A.allowNestedUrls),s=Q.tail===null?null:(r=Q.tail,n.lastFieldSensitive?{value:r===""?"":ju,lastFieldSensitive:!0}:ZDg(r,A.allowNestedUrls));var r;const a=s===null?n.value:`${n.value}?${s.value}`;a!==o.hash.slice(1)&&(o.hash=a,i=!0);const c=C?s??n:E;return(i?FCA(o.toString()):e)+(c.lastFieldSensitive?"":t)}function IRA(g,A){return g.replace(bDg,I=>(function(e,t){const o=(function(Q){if(!Q.includes("://"))return[];const i=[...Q.matchAll(OVI)].map(c=>c.index),E=[],n={query:!1,fragment:!1,fragmentQuery:!1};let s=0,r=!1,a="";for(let c=0;Q.length>c&&i.length>s;c++){i[s]===c&&(c>0&&a!=="="&&E.push(c),s++);const h=Q[c];BjI(h,n,a)?(a=h,r=!0):r&&"=&".includes(h)&&(a=h)}return E})(e);if(o.length===0)return gRA(e,t);let B="",C=0;for(const Q of o)B+=gRA(e.slice(C,Q),QI(QI({},t),{},{stripPunctuation:!1})),C=Q;return B+gRA(e.slice(C),t)})(I,QI(QI({},A),{},{stripPunctuation:A.stripPunctuation&&I.length!==g.length})))}function FCA(g){return g.replace(vVI,ju)}function ODg(g,A){return(function(I){return I.length>=10240&&(LVI.test(I)||(function(e){const t=bVI.exec(e);if(!t)return!1;let o;try{o=decodeURIComponent(e.slice(t[0].length))}catch{return!1}return HVI.test(o.replace(/[\r\n]/g,""))})(I)||_VI.test(I)&&YVI.test(I))})(g)?"[binary data redacted - not supported by PostHog MCP analytics]":(function(I,e,t){const o=4*t.maxStringLength;if(I.length>o){const B=e(I.slice(0,(function(C,Q){let i=Q;for(;i>0&&!TVI.test(C[i-1]);)i--;return i})(I,o)));if(B.length>=2*t.maxStringLength)return B+t.truncationSuffix}return e(I)})(g,I=>(function(e){return IRA(e,{allowNestedUrls:!0,stripPunctuation:!0})})((function(e){let t=e.replace(jVI," ");return t=t.replace(zVI,ju),t=t.replace(XVI,ju),t=t.replace($VI,`$1${ju}`),t=t.replace(gjI,QjI),t=t.replace(AjI,ju),t=t.replace(IjI,`$1${ju}`),t=t.replace(ejI,`$1${ju}`),t})(FCA(I))),A)}function CjI(g){let A=0,I=!1;for(let e=g.length-1;e>=0;e--){let t=g.charCodeAt(e)-48;if(0>t||t>9)return!1;I&&(t*=2,t>9&&(t-=9)),A+=t,I=!I}return A%10==0}function QjI(g){const A=[];for(let o=qDg.exec(g);o!==null;o=qDg.exec(g))A.push({digits:o[0],start:o.index,end:o.index+o[0].length});let I="",e=0,t=0;for(;A.length>t;){let o="",B=-1;for(let C=t;A.length>C&&(o+=A[C].digits,19>=o.length);C++)o.length>=13&&CjI(o)&&(B=C);0>B?t++:(I+=g.slice(e,A[t].start)+ju,e=A[B].end,t=B+1)}return I+g.slice(e)}const ijI={}.propertyIsEnumerable;function UCA(g,A){try{return WDg(g,A,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function eRA(g,A,I,e){if(0>=I.remainingNodes)return{stringValue:OfA};if(I.remainingNodes--,gm(g))return{boolValue:g};if(typeof g=="bigint")return(function(t,o){const B=t.toString(),C=BigInt("9223372036854775808");return t>=C||-C>t?(o?.debug(`Attribute ${B} is outside the int64 range; encoding it as a string`),{stringValue:B}):{intValue:B}})(g,A);if(typeof g=="number"){if(!Number.isFinite(g))return{stringValue:String(g)};if(Number.isInteger(g)){if(Number.isSafeInteger(g))return{intValue:String(g)};if(typeof BigInt>"u")return{stringValue:String(g)};const t=BigInt(g).toString();return g>=9223372036854776e3||-9223372036854776e3>g?(A?.debug(`Attribute ${t} is outside the int64 range; encoding it as a string`),{stringValue:t}):{intValue:t}}return{doubleValue:g}}if(typeof g=="string")return{stringValue:P9(g)};if(typeof g=="function")return{stringValue:"[Function]"};if(typeof g=="symbol")return{stringValue:String(g)};if(typeof g=="object"&&g!==null){if(I.ancestors.has(g))return{stringValue:"[Circular]"};if(e>=20)return{stringValue:OfA};if(g instanceof Date){const t=g.getTime(),o=Number.isFinite(t)?g.toISOString():String(g);return{stringValue:typeof o=="string"?P9(o):String(o)}}I.ancestors.add(g);try{try{const t=g.toJSON;if(typeof t=="function")return eRA(t.call(g),A,I,e+1)}catch{}return aB(g)?{arrayValue:{values:EjI(g,A,I,e+1)}}:{kvlistValue:{values:WDg(g,A,I,e+1)}}}finally{I.ancestors.delete(g)}}return{stringValue:P9(String(g))}}function EjI(g,A,I,e){const t=[],o=Math.min(g.length,1e3);let B=0;for(;o>B&&I.remainingNodes>0;B++)try{const C=B in g?g[B]:void 0;if(rC(C))continue;t.push(eRA(C,A,I,e))}catch{t.push({stringValue:EV})}return g.length>B&&t.push({stringValue:OfA}),t}function WDg(g,A,I,e){const t=[];for(const o in g)if(ijI.call(g,o)){if(!o){A?.debug("Dropping an attribute with an empty key");continue}if(t.length>=1e3||0>=I.remainingNodes){A?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const B=g[o];if(fc(B)||Le(B))continue;t.push({key:P9(o),value:eRA(B,A,I,e)})}catch{t.push({key:P9(o),value:{stringValue:EV}})}}return t}function VDg(g,A,I){return QI(QI(QI(QI({},hDg({},g.resourceAttributes)),{},{"service.name":g.serviceName||"unknown_service"},g.environment&&{"deployment.environment":g.environment}),g.serviceVersion&&{"service.version":g.serviceVersion}),{},{"telemetry.sdk.name":A,"telemetry.sdk.version":I})}const njI=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function jDg(g,A){const I=hDg({},g),e={};for(const t of njI)({}).hasOwnProperty.call(I,t)&&(e[t]=I[t],delete I[t]);return[...UCA(I,A),...UCA(e,A)]}const zDg={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"},XDg={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}},sjI=XDg.info;function ajI(g){try{return P9(String(g))}catch{return EV}}function rjI(g,A,I,e){const t=g.level||"info",{text:o,number:B}=XDg[t]||sjI,C=(function(s=Date.now()){return String(s)+"000000"})($h(e)?e:void 0),Q={};A.distinctId&&(Q.posthogDistinctId=A.distinctId),A.sessionId&&(Q.sessionId=A.sessionId),A.windowId&&(Q["window.id"]=A.windowId),rC(A.sessionStartTimestamp)||(Q.sessionStartTimestamp=String(A.sessionStartTimestamp)),rC(A.lastActivityTimestamp)||(Q.lastActivityTimestamp=String(A.lastActivityTimestamp)),A.currentUrl&&(Q["url.full"]=A.currentUrl),A.screenName&&(Q["screen.name"]=A.screenName),A.appState&&(Q["app.state"]=A.appState),A.activeFeatureFlags&&A.activeFeatureFlags.length>0&&(Q.feature_flags=A.activeFeatureFlags);const i=QI({},Q),E=g.attributes;if(E){let s=[];try{s=Object.keys(E)}catch{s=[]}for(const r of s){let a;try{a=E[r]}catch{a=EV}Object.defineProperty(i,r,{value:a,enumerable:!0,writable:!0,configurable:!0})}}const n={timeUnixNano:C,observedTimeUnixNano:C,severityNumber:B,severityText:o,body:{stringValue:ajI(g.body)},attributes:UCA(i,I)};return g.trace_id&&(n.traceId=g.trace_id),g.span_id&&(n.spanId=g.span_id),Le(g.trace_flags)||(n.flags=g.trace_flags),n}function $Dg(g,A,I){return VDg(g,A,I)}function Adg(g,A,I,e){return{resourceLogs:[{resource:{attributes:jDg(A)},scopeLogs:[{scope:{name:I,version:e},logRecords:g}]}]}}var gdg=class{constructor(A){this.ls=A,this.us=0}get pending(){return!!this.cs}arm(A){this.clear(),this.us=Date.now()+A,this.cs=wDg(()=>{this.cs=void 0,this.ls()},A)}armNoEarlierThan(A){this.cs&&Date.now()+A<=this.us||this.arm(A)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function Idg(){return .75+.5*Math.random()}function edg(g,A,I,e){const t=Math.min(Math.max(0,A-1),6),o=g*Math.pow(2,t);return Math.round(Math.min(o,Math.max(e,g))*I)}var cjI=class{constructor(A,I,e,t,o,B=()=>Promise.resolve(),C){var Q;this._instance=A,this.Ar=I,this.$=e,this.hs=t,this.ds=o,this.vs=B,this.fs=C,this.ps=new gdg(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new lDg,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=I.maxBufferSize,this.Is=Math.max((Q=I.maxQueueSize)!==null&&Q!==void 0?Q:I.maxBufferSize,I.maxBufferSize),this.Ms=I.flushIntervalMs,this.Es=I.maxBatchRecordsPerPost,this.Ps=I.rateCapWindowMs,this.Rs=I.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(xN.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.Ar.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(A,I){var e;if(this._instance.isDisabled||this._instance.optedOut||!A?.body)return;const t=this.Os(A);if(t===null)return;if(!t.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const o={record:rjI(t,(e=I?.context)!==null&&e!==void 0?e:this.hs(),this.$,I?.occurredAtMs)};this.ds(()=>this.Ls(o))}Os(A){const I=this.Ar.beforeSend;if(!I)return A;const e=aB(I)?I:[I];let t=A;for(const o of e)try{const B=o(t);if(!B)return this.$.info("Log was rejected in beforeSend function"),null;t=B}catch(B){return this.$.error("Error in beforeSend function for log:",B),null}return t}Ds(){if(this.Rs===void 0)return!0;const A=Date.now(),I=A-this.xs;return this.Ps>I&&I>=0||(this.xs=A,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.Cs=!0),!1)}flush(){var A=this;return oa(function*(){if(!A._instance.isDisabled)return A.ys||(A.ys=A.Ns().finally(()=>{A.ys=null})),A.ys})()}Ns(){var A=this;return oa(function*(){var I;A.ps.clear();let e=(I=A._instance.getPersistedProperty(xN.LogsQueue))!==null&&I!==void 0?I:[];if(e.length===0)return;const t=e.length;let o=0;for(;e.length>0&&t>o;){var B,C;const Q=A._s;A.bs=0;const i=Math.min(e.length,A.Es),E=e.slice(0,i),n=Adg(E.map(r=>r.record),A.qs(),(B=A.fs)!==null&&B!==void 0?B:A._instance.getLibraryId(),A._instance.getLibraryVersion()),s=yield A._instance.js(n);if(A._s!==Q)return;if(s.kind==="too-large"&&E.length>1)A.Es=Math.max(1,Math.floor(E.length/2)),A.$.warn(`Logs batch of size ${E.length} was too large for the ingestion endpoint, reducing batch size to ${A.Es}`);else if(A.ws.record(s),A.ps.pending&&A.ps.arm(Math.max(A.Ms,A.ws.remainingMs())),s.kind==="retry-later"||(s.kind==="too-large"?A.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):s.kind==="ok"&&A.Ar.maxBatchRecordsPerPost>A.Es&&(A.Es=Math.min(A.Ar.maxBatchRecordsPerPost,A.Es+1)),yield A.Bs(E.length),e=(C=A._instance.getPersistedProperty(xN.LogsQueue))!==null&&C!==void 0?C:[],o+=E.length,s.kind==="fatal"))throw s.error}})()}Bs(A){var I=this;return oa(function*(){var e;const t=Math.max(0,A-I.bs),o=(e=I._instance.getPersistedProperty(xN.LogsQueue))!==null&&e!==void 0?e:[];I._instance.setPersistedProperty(xN.LogsQueue,o.slice(t)),yield I.vs()})()}qs(){return $Dg(this.Ar,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(A){var I;if(this._instance.optedOut)return;const e=(I=this._instance.getPersistedProperty(xN.LogsQueue))!==null&&I!==void 0?I:[];this.Is>e.length||(e.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),e.push(A),this._instance.setPersistedProperty(xN.LogsQueue,e),this.Ts>e.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(edg(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const A=this._instance.getPersistedProperty(xN.LogsQueue);return!!A&&A.length>0}shutdown(A){var I=this;return oa(function*(){I.ps.clear();const e=I.flush().catch(()=>{});A!==void 0?yield uDg(e,A):yield e})()}flushWithTimeout(A){var I=this;return oa(function*(){const e=I.flush();yield uDg(e,A,()=>{e.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},A=>{this.ks++,this.Ss=Idg(),this.$.error("PostHog logs flush failed:",A)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.zs())})}};const hjI=/^[0-9a-f]+$/;function tdg(g,A,I){return typeof g=="string"&&g.length===A&&g!==I&&hjI.test(g)}const ljI=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/,DjI="00",tRA=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function oRA(g){return String(g)+"000000"}function odg(g,A,I,e){let t="";return e&&(t=Object.keys(e).sort().map(o=>`${JSON.stringify(o)}:${JSON.stringify(e[o])}`).join(",")),`${g}\0${A}\0${I??""}\0${t}`}var djI=class{constructor(A,I,e){this._instance=A,this.Ar=I,this.$=e,this.Hs=new Map,this.ps=new gdg(()=>this.flush().catch(t=>{this.$.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new lDg,this.ks=0,this.Ss=1,this.Gs=0}count(A,I=1,e){this.Qs({name:A,type:"count",value:I,unit:e?.unit,attributes:e?.attributes})}gauge(A,I,e){this.Qs({name:A,type:"gauge",value:I,unit:e?.unit,attributes:e?.attributes})}histogram(A,I,e){this.Qs({name:A,type:"histogram",value:I,unit:e?.unit,attributes:e?.attributes})}flush(){var A=this;const I=this.ys,e=(function(){var t=oa(function*(){I&&(yield I.catch(()=>{})),yield A.Zs()});return function(){return t.apply(this,arguments)}})()().finally(()=>{this.ys===e&&(this.ys=null)});return this.ys=e,e}drainWindow(){if(this.Hs.size===0)return null;const A=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(A)}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(A){if(this._instance.isDisabled||this._instance.optedOut)return;const I=this.Os(A);if(I===null)return;if(!I.name||typeof I.name!="string")return void this.$.warn("Dropping metric with empty name");if(typeof I.value!="number"||!Number.isFinite(I.value))return void this.$.warn(`Dropping metric '${I.name}': value must be a finite number`);if(I.type==="count"&&0>I.value)return void this.$.warn(`Dropping count '${I.name}': counters are monotonic, value must be >= 0`);let e,t;try{e=I.attributes?QI({},I.attributes):void 0,t=odg(I.type,I.name,I.unit,e)}catch(Q){return void this.$.warn(`Dropping metric '${I.name}': attributes could not be serialized`,Q)}let o=this.Hs.get(t);if(!o){if(!this.Ks())return;o={name:I.name,type:I.type,unit:I.unit,attributes:e,windowStartMs:Date.now()},this.Hs.set(t,o)}const B=this.Ws.get(I.name);B===void 0?this.Ws.set(I.name,I.type):B===I.type||this.Vs.has(I.name)||(this.Vs.add(I.name),this.$.warn(`Metric name '${I.name}' is already used as a ${B}; recording it as a ${I.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(o,I.value);const C=this.Ys();C&&(o.exemplar=QI(QI({},C),{},{value:I.value,timeMs:Date.now()})),this.Fs()}Ys(){try{var A,I;const e=(function(t){const o=(function(C){if(typeof C!="string")return;const Q=ljI.exec(C.trim());if(!Q)return;const[,i,E,n,s,r]=Q;return i==="ff"||i==="00"&&r||!(function(a){return tdg(a,32,"00000000000000000000000000000000")})(E)||!(function(a){return tdg(a,16,"0000000000000000")})(n)?void 0:{version:i,traceId:E,spanId:n,flags:s}})(t);return o&&{traceId:o.traceId,spanId:o.spanId,flags:(B=o.flags,1&parseInt(B,16)?"01":DjI)};var B})((A=(I=this._instance).getActiveSpan)===null||A===void 0||(A=A.call(I))===null||A===void 0?void 0:A.traceparent());if(e&&e.flags==="01")return{traceId:e.traceId,spanId:e.spanId}}catch{}}Ks(){return this.Ar.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Ar.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(A,I){switch(A.type){case"count":var e;A.total=((e=A.total)!==null&&e!==void 0?e:0)+I;break;case"gauge":A.last=I;break;case"histogram":{A.hist||(A.hist={count:0,sum:0,min:I,max:I,bucketCounts:new Array(tRA.length+1).fill(0)});const t=A.hist;t.count+=1,t.sum+=I,t.min=Math.min(t.min,I),t.max=Math.max(t.max,I),t.bucketCounts[(function(o,B){for(let C=0;B.length>C;C++)if(B[C]>=o)return C;return B.length})(I,tRA)]+=1;break}}}Os(A){const I=this.Ar.beforeSend;if(!I)return A;const e=aB(I)?I:[I];let t=A;for(const o of e)try{const B=o(t);if(!B)return this.$.info("Metric was rejected in beforeSend function"),null;t=B}catch(B){return this.$.error("Error in beforeSend function for metric:",B),null}return t}Fs(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(edg(this.Ar.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Zs(){var A=this;return oa(function*(){if(A.ps.clear(),A.Hs.size===0)return;const I=A.Hs;A.Hs=new Map,A.Us=!1,A.Ws=new Map,A.Vs=new Set;const e=A.Gs,t=yield A._instance.po(A.Js(I));if(e===A.Gs)switch(A.ws.record(t),t.kind==="retry-later"?(A.ks++,A.Ss=Idg()):(A.ks=0,A.Ss=1),A.ps.pending&&A.ps.arm(A.zs()),t.kind){case"ok":return;case"retry-later":return A.mo(I),void A.ps.armNoEarlierThan(A.zs());case"too-large":return void A.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void A.$.error("Failed to send metrics batch:",t.error)}})()}Js(A){return I=this.yo(A),e=(function(B,C,Q){return VDg(B,C,Q)})(this.Ar,this._instance.getLibraryId(),this._instance.getLibraryVersion()),t=this._instance.getLibraryId(),o=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:jDg(e)},scopeMetrics:[{scope:{name:t,version:o},metrics:I}]}]};var I,e,t,o}yo(A){const I=oRA(Date.now()),e=new Map;for(const C of A.values()){var t;const Q=odg(C.type,C.name,C.unit,void 0);let i=e.get(Q);i||(i=QI({name:C.name},C.unit&&{unit:C.unit}),C.type==="count"?i.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:C.type==="gauge"?i.gauge={dataPoints:[]}:i.histogram={aggregationTemporality:1,dataPoints:[]},e.set(Q,i));const E=UCA((t=C.attributes)!==null&&t!==void 0?t:{},this.$),n=oRA(C.windowStartMs),s=yjI(C.exemplar);if(C.type==="count"){var o;const r=QI({attributes:E,startTimeUnixNano:n,timeUnixNano:I,asDouble:(o=C.total)!==null&&o!==void 0?o:0},s);i.sum.dataPoints.push(r)}else if(C.type==="gauge"){var B;const r=QI({attributes:E,timeUnixNano:I,asDouble:(B=C.last)!==null&&B!==void 0?B:0},s);i.gauge.dataPoints.push(r)}else if(C.hist){const r=QI({attributes:E,startTimeUnixNano:n,timeUnixNano:I,count:C.hist.count,sum:C.hist.sum,min:C.hist.min,max:C.hist.max,bucketCounts:C.hist.bucketCounts,explicitBounds:tRA},s);i.histogram.dataPoints.push(r)}}return Array.from(e.values())}mo(A){for(const[o,B]of A){var I;const C=this.Hs.get(o);if(C)switch(C.windowStartMs=Math.min(C.windowStartMs,B.windowStartMs),C.exemplar=(I=C.exemplar)!==null&&I!==void 0?I:B.exemplar,C.type){case"count":var e,t;C.total=((e=C.total)!==null&&e!==void 0?e:0)+((t=B.total)!==null&&t!==void 0?t:0);break;case"gauge":break;case"histogram":if(B.hist)if(C.hist){C.hist.count+=B.hist.count,C.hist.sum+=B.hist.sum,C.hist.min=Math.min(C.hist.min,B.hist.min),C.hist.max=Math.max(C.hist.max,B.hist.max);for(let Q=0;C.hist.bucketCounts.length>Q;Q++)C.hist.bucketCounts[Q]+=B.hist.bucketCounts[Q]}else C.hist=B.hist}else this.Ks()&&this.Hs.set(o,B)}}};function yjI(g){return g?{exemplars:[{filteredAttributes:[],timeUnixNano:oRA(g.timeMs),asDouble:g.value,traceId:g.traceId,spanId:g.spanId}]}:{}}const Bdg=(g,{debugEnabled:A}={})=>{const I={N(e,...t){let o;try{o=typeof window>"u"?void 0:window}catch{return}o&&(bF.DEBUG||o.POSTHOG_DEBUG||A)&&!Le(o.console)&&o.console&&("__rrweb_original__"in o.console[e]?o.console[e].__rrweb_original__:o.console[e])(g,...t)},debug(...e){I.N("debug",...e)},info(...e){I.N("log",...e)},warn(...e){I.N("warn",...e)},error(...e){I.N("error",...e)},critical(...e){console.error(g,...e)},uninitializedWarning(e){I.error(`You must initialize PostHog before calling ${e}`)},createLogger:(e,t)=>Bdg(`${g} ${e}`,t)};return I},Dt=Bdg("[PostHog.js]"),qr=Dt.createLogger,wjI=qr("[ExternalScriptsLoader]"),JCA=g=>{const A=ro?.querySelectorAll("script");if(A){for(let I=0;A.length>I;I++)if(A[I].src===g||A[I].getAttribute("src")===g)return A[I]}},yY=(g,A,I)=>{if(g.config.disable_external_dependency_loading)return wjI.warn(`${A} was requested but loading of external scripts is disabled.`),I("Loading of external scripts is disabled");const e=JCA(A);if(e){if(e.__posthog_loading_callback_fired)return I();const o=e.__posthog_loading_error;return o?I(o):(e.addEventListener("load",B=>{e.__posthog_loading_callback_fired=!0,I(void 0,B)}),void e.addEventListener("error",B=>{e.__posthog_loading_error=B,I(B)}))}const t=()=>{if(!ro)return I("document not found");if(JCA(A))return yY(g,A,I);let o=ro.createElement("script");if(o.type="text/javascript",o.crossOrigin="anonymous",o.src=A,o.onload=C=>{o.__posthog_loading_callback_fired=!0,I(void 0,C)},o.onerror=C=>{o.__posthog_loading_error=C,I(C)},g.config.prepare_external_dependency_script&&(o=g.config.prepare_external_dependency_script(o)),!o)return I("prepare_external_dependency_script returned null");if(g.config.external_scripts_inject_target==="head")ro.head.appendChild(o);else{const C=ro.querySelectorAll("body > script");var B;C.length>0?(B=C[0].parentNode)===null||B===void 0||B.insertBefore(o,C[0]):ro.body.appendChild(o)}};ro?.body?t():ro?.addEventListener("DOMContentLoaded",t)},BRA={},Cdg=(g,A)=>{let I=`/static/${A}.js?v=${g.version}`;return A==="toolbar"&&(I=`${I}&t=${Math.floor(Date.now()/3e5)*3e5}`),g.requestRouter.endpointFor("assets",I)};FB.__PosthogExtensions__=FB.__PosthogExtensions__||{},FB.__PosthogExtensions__.loadExternalDependency=(g,A,I)=>{if(A==="remote-config"){const t=g.requestRouter.endpointFor("assets",`/array/${g.config.token}/config.js`);return void yY(g,t,I)}const e=g.config.strict_script_versioning;if(e){const t=g.requestRouter.endpointFor("assets",`/static/${g.version}/${A}.js`),o=BRA[t];if(e==="fallback"&&o){if(JCA(o))return void yY(g,o,I);delete BRA[t]}return void yY(g,t,e==="fallback"?(B,C)=>{if(B)if(typeof B=="string")I(B);else{var Q;const i=Cdg(g,A);BRA[t]=i;const E=JCA(t);E==null||(Q=E.parentNode)===null||Q===void 0||Q.removeChild(E),yY(g,i,I)}else I(void 0,C)}:I)}yY(g,Cdg(g,A),I)},FB.__PosthogExtensions__.loadSiteApp=(g,A,I)=>{const e=g.requestRouter.endpointFor("api",A);yY(g,e,I)},bF.DEBUG=!1,bF.LIB_VERSION="1.438.23",bF.LIB_NAME="web";var bp=bF;const CRA="$early_access_features",vF="$active_feature_flags",wY="$feature_flag_details",rV="$feature_flag_errors",q4="$feature_flag_evaluated_at",uY="$feature_flag_request_id",cV="$minimal_flag_called_events",xf="$enabled_feature_flags",T4="$stored_group_properties",Z4="$stored_person_properties",qF="$flag_call_reported",hV="$flag_call_reported_session_id",O4="$feature_flag_payloads",UN="$override_feature_flags",GY="$override_feature_flag_payloads",L9="visibilitychange",Qdg="$autocapture_disabled_server_side",lV="$surveys",PCA="$surveys_loaded_at",QRA="PostHog loadExternalDependency extension not found.",iRA="$surveys_activated",KCA="$surveys_activated_session",LCA="$surveys_activated_timestamps",ujI="$people_distinct_id",Ff="distinct_id",ERA="$device_id",nRA="$device_model",YCA="__alias",GjI="__cmpns",idg="$fbc",Y9="$fbc_persistence",Edg="$fbp",DV="$fbp_persistence",sRA="__timers",aRA="$heatmaps_enabled_server_side",rRA="$exception_capture_enabled_server_side",ndg="$error_tracking_suppression_rules",cRA="$error_tracking_capture_extension_exceptions",hRA="$web_vitals_enabled_server_side",lRA="$dead_clicks_enabled_server_side",DRA="$product_tours_enabled_server_side",sdg="$logs_capture_enabled_server_side",adg="$web_vitals_allowed_metrics",dV="$session_recording_remote_config",mjI="$session_recording_enabled_server_side",pjI="$replay_sample_rate",kjI="$replay_override_sampling",MjI="$replay_override_linked_flag",SjI="$replay_override_url_trigger",fjI="$replay_override_event_trigger",_9="$sesid",rdg="$session_is_sampled",RjI="$session_past_minimum_duration",NjI="$session_recording_url_trigger_activated_session",xjI="$session_recording_event_trigger_activated_session",FjI="$debug_first_full_snapshot_timestamp",UjI="$sess_rec_flush_size",cdg="$groups",dRA="ph_product_tours",JjI="$product_tours_activated",PjI="$product_tours_activated_session",KjI="$conversations_widget_session_id",LjI="$conversations_ticket_id",YjI="$conversations_widget_state",_jI="$conversations_user_traits",Im="$user_state",yRA="$client_session_props",bjI="$capture_rate_limit",hdg="$initial_campaign_params",ldg="$initial_referrer_info",b9="$initial_person_info",wRA="$epp",uRA="$posthog_cookieless",Ddg="$cookieless_mode",ddg="$sdk_debug_extensions_init_method",ydg="$sdk_debug_extensions_init_time_ms",GRA="$sdk_debug_recording_script_not_loaded",mRA="$sdk_debug_replay_stale_config",wdg="$sdk_debug_replay_event_trigger_status",udg="$sdk_debug_replay_linked_flag_trigger_status",Gdg="$sdk_debug_replay_matched_recording_trigger_groups",mdg="$sdk_debug_replay_pending_trigger_conditions",pdg="$sdk_debug_replay_remote_trigger_matching_config",kdg="$sdk_debug_replay_trigger_groups_count",Mdg="$sdk_debug_replay_url_trigger_status",HjI="$session_recording_start_reason",TF="anonymous",_CA="identified",Sdg="identified_only",bCA="beforeunload",pRA="$pageview",fdg="$pageleave",Rdg="$identify",Ndg="$groupidentify";function H9(g,A){aB(g)&&g.forEach(A)}function dn(g,A){if(!rC(g))if(aB(g))g.forEach(A);else if((I=>I instanceof FormData)(g))g.forEach((I,e)=>A(I,e));else for(const I in g)PfA.call(g,I)&&A(g[I],I)}const Qr=function(g,...A){for(const I of A)for(const e in I)I[e]!==void 0&&(g[e]=I[e]);return g};function HCA(g){const A=Object.keys(g);let I=A.length;const e=new Array(I);for(;I--;)e[I]=[A[I],g[A[I]]];return e}const vjI=function(g){return function(...A){try{return g.apply(this,A)}catch(I){Dt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Dt.critical(I)}}},kRA=function(g){const A={};return dn(g,function(I,e){(UC(I)&&I.length>0||$h(I))&&(A[e]=I)}),A};function xdg(g){const A=QI({},g);for(const I of["name","message","stack","cause","errors"])try{I in g&&(A[I]=g[I])}catch{}return A}const qjI=["herokuapp.com","vercel.app","netlify.app"];function TjI(g){const A=g?.hostname;if(!UC(A))return!1;const I=A.split(".").slice(-2).join(".");for(const e of qjI)if(I===e)return!1;return!0}function GE(g,A,I,e){const{capture:t=!1,passive:o=!0}=e??{};g?.addEventListener(A,I,{capture:t,passive:o})}function MRA(g){return g.name==="ph_toolbar_internal"}const yV=g=>{if(ro){try{const A=g+"=",I=ro.cookie.split(";").filter(e=>e.length);for(let e=0;I.length>e;e++){let t=I[e];for(;t.charAt(0)==" ";)t=t.substring(1,t.length);if(t.indexOf(A)===0)return decodeURIComponent(t.substring(A.length,t.length))}}catch{}return null}};var ZjI=class Ohg{constructor(A){if(this.bytes=A,A.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(A,I,e,t){if(!Number.isInteger(A)||!Number.isInteger(I)||!Number.isInteger(e)||!Number.isInteger(t)||0>A||0>I||0>e||0>t||A>0xffffffffffff||I>4095||e>1073741823||t>4294967295)throw new RangeError("invalid field value");const o=new Uint8Array(16);return o[0]=A/Math.pow(2,40),o[1]=A/Math.pow(2,32),o[2]=A/Math.pow(2,24),o[3]=A/Math.pow(2,16),o[4]=A/256,o[5]=A,o[6]=112|I>>>8,o[7]=I,o[8]=128|e>>>24,o[9]=e>>>16,o[10]=e>>>8,o[11]=e,o[12]=t>>>24,o[13]=t>>>16,o[14]=t>>>8,o[15]=t,new Ohg(o)}toString(){let A="";for(let I=0;this.bytes.length>I;I++)A=A+(this.bytes[I]>>>4).toString(16)+(15&this.bytes[I]).toString(16),I!==3&&I!==5&&I!==7&&I!==9||(A+="-");if(A.length!==36)throw new Error("Invalid UUIDv7 was generated");return A}clone(){return new Ohg(this.bytes.slice(0))}equals(A){return this.compareTo(A)===0}compareTo(A){for(let I=0;16>I;I++){const e=this.bytes[I]-A.bytes[I];if(e!==0)return Math.sign(e)}return 0}},OjI=class{generate(){const A=this.generateOrAbort();if(!Le(A))return A;{this.Ct=0;const I=this.generateOrAbort();if(Le(I))throw new Error("Could not generate UUID after timestamp reset");return I}}generateOrAbort(){const A=(()=>{const I=Date.now();return $h(I)&&isFinite(I)?Math.min(Math.max(Math.floor(I),0),0xffffffffffff):0})();if(A>this.Ct)this.Ct=A,this.It();else{if(this.Ct>=A+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Ct++,this.It())}return ZjI.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 VjI}};const WjI=g=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let A=0;g.length>A;A++)g[A]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return g};let Fdg;var VjI=class{nextUint32(){var A;return this.Rt.length>this.Et||(((A=Fdg)!==null&&A!==void 0?A:Fdg="u">typeof window&&!Le(window.crypto)&&crypto.getRandomValues?I=>crypto.getRandomValues(I):WjI)(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}};let Udg;const Uf=()=>jjI().toString(),jjI=()=>(Udg||(Udg=new OjI)).generate();let wV="";const zjI=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let v9=null;const ir={$t(){if(!fc(v9))return v9;if(v9=!1,ro)try{const g=`__ph_cookie_support_${Uf()}`;ir.At(g,"xyz"),v9=yV(g)==='"xyz"',ir.Pt(g)}catch{v9=!1}return v9},Ft(g){Dt.error("cookieStore error: "+g)},Ot:yV,Lt(g){let A;try{A=JSON.parse(ir.Ot(g))||{}}catch{}return A},At(g,A,I,e,t){if(!ro)return!1;try{let o="",B="";const C=(function(i,E){if(E){let n=(function(s,r=ro){if(wV)return wV;if(!r||["localhost","127.0.0.1"].includes(s))return"";const a=s.split(".");let c=Math.min(a.length,8);const h="dmn_chk_"+Uf();for(;!wV&&c--;){const l=a.slice(c).join("."),D=h+"=1;domain=."+l+";path=/";r.cookie=D+";max-age=3",r.cookie.includes(h)&&(r.cookie=D+";max-age=0",wV=l)}return wV})(i);if(!n){const s=(r=>{const a=r.match(zjI);return a?a[0]:""})(i);s!==n&&Dt.info("Warning: cookie subdomain discovery mismatch",s,n),n=s}return n?"; domain=."+n:""}return""})(ro.location.hostname,e);if(I){const i=new Date;i.setTime(i.getTime()+864e5*I),o="; expires="+i.toUTCString()}t&&(B="; secure");const Q=g+"="+encodeURIComponent(JSON.stringify(A))+o+"; SameSite=Lax; path=/"+C+B;return Q.length>3686.4&&Dt.warn("cookieStore warning: large cookie, len="+Q.length),ro.cookie=Q,!0}catch{return!1}},Pt(g,A){if(ro?.cookie&&(!A||!fc(yV(g))))try{ir.At(g,"",-1,A)}catch{return}}};let SRA=null;const AE={$t(){if(!fc(SRA))return SRA;let g=!0;if(Le(Me))g=!1;else try{const A="__mplssupport__";AE.At(A,"xyz"),AE.Ot(A)!=='"xyz"'&&(g=!1),AE.Pt(A)}catch{g=!1}return g||Dt.error("localStorage unsupported; falling back to cookie store"),SRA=g,g},Ft(g){Dt.error("localStorage error: "+g)},Ot(g){try{return Me?.localStorage.getItem(g)}catch(A){AE.Ft(A)}return null},Lt(g){try{return JSON.parse(AE.Ot(g))||{}}catch{}return null},At(g,A){try{return Me?.localStorage.setItem(g,JSON.stringify(A)),!0}catch(I){AE.Ft(I)}return!1},Pt(g){try{Me?.localStorage.removeItem(g)}catch(A){AE.Ft(A)}}},fRA=[Z4,vF,xf,wY,O4,uY,q4,rV,qF],mY=[ERA,Ff,_9,rdg,wRA,b9,Y9,Im],uV=g=>g+"_cpm",XjI=["__proto__","constructor","prototype"],RRA=g=>{if(!yC(g))return{};const A={};return Object.keys(g).forEach(I=>{XjI.indexOf(I)===-1&&(A[I]=g[I])}),A},NRA=(g,A=[])=>{const I={};return[...mY,...A].forEach(e=>{const t=g[e];Le(t)||fc(t)||t===""||(I[e]=t)}),I},Jdg=g=>{let A=5381,I=2166136261;for(let e=0;g.length>e;e++){const t=g.charCodeAt(e);A=33*A^t,I=Math.imul(I^t,16777619)}return g.length.toString(36)+"."+(A>>>0).toString(36)+"."+(I>>>0).toString(36)},Pdg=(g,A)=>({p:A,f:Jdg(JSON.stringify(g))}),Kdg=(g,A)=>{if(!A)return{properties:[],isValid:!1};try{const I=ir.Lt(uV(g)),e=I?.f===Jdg(A)&&aB(I.p);return{properties:e?I.p:[],isValid:e}}catch{return{properties:[],isValid:!1}}},xRA=(g,A)=>A+"|"+(ir.Ot(uV(g))||""),q9={},FRA={$t:()=>!0,Ft(g){Dt.error("memoryStorage error: "+g)},Ot:g=>g in q9?q9[g]:null,Lt:g=>g in q9?q9[g]:null,At:(g,A)=>(q9[g]=A,!0),Pt(g){delete q9[g]}};let pY=null;const Ba={$t(){if(!fc(pY))return pY;if(pY=!0,Le(Me))pY=!1;else try{const g="__support__";Ba.At(g,"xyz"),Ba.Ot(g)!=='"xyz"'&&(pY=!1),Ba.Pt(g)}catch{pY=!1}return pY},Ft(g){Dt.error("sessionStorage error: ",g)},Ot(g){try{return Me?.sessionStorage.getItem(g)}catch(A){Ba.Ft(A)}return null},Lt(g){try{return JSON.parse(Ba.Ot(g))||null}catch{}return null},At(g,A){try{return Me?.sessionStorage.setItem(g,JSON.stringify(A)),!0}catch(I){Ba.Ft(I)}return!1},Pt(g){try{Me?.sessionStorage.removeItem(g)}catch(A){Ba.Ft(A)}}};var $jI=class{constructor(A){this._instance=A}get Ar(){return this._instance.config}get consent(){return this.Sl()?0:this.xl}isOptedOut(){return this.Ar.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Ar.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Ar.opt_out_capturing_by_default}optInOut(A){this.$l.At(this.Cl,A?1:0,this.Ar.cookie_expiration,this.Ar.cross_subdomain_cookie,this.Ar.secure_cookie)}reset(){this.$l.Pt(this.Cl,this.Ar.cross_subdomain_cookie)}get Cl(){const{token:A,opt_out_capturing_cookie_prefix:I,consent_persistence_name:e}=this._instance.config;return e||(I?I+A:"__ph_opt_in_out_"+A)}get xl(){const A=this.$l.Ot(this.Cl);return LfA(A)?1:yB(WWI,A)?0:-1}get $l(){const A=this.Ar.opt_out_capturing_persistence_type,I=A==="localStorage"?AE:ir,e=I.$t()?I:FRA;if(!this.Tl||this.Tl!==e){this.Tl=e;const t=A==="localStorage"?ir:AE;t.Ot(this.Cl)&&(this.Tl.Ot(this.Cl)||this.optInOut(LfA(t.Ot(this.Cl))),t.Pt(this.Cl,this.Ar.cross_subdomain_cookie))}return this.Tl}Sl(){return!!this.Ar.respect_dnt&&[Rw?.doNotTrack,Rw?.msDoNotTrack,FB.doNotTrack,Rw?.globalPrivacyControl].some(A=>LfA(A))}};function Ldg(g,A){var I;const e=g==null||(I=g.config)===null||I===void 0?void 0:I.get_current_url;if(!Xh(e))return A;try{const t=e(A);return UC(t)&&t?t:A}catch(t){return Dt.error("Error in get_current_url, falling back to window.location.href",t),A}}function Ydg(g){var A;return g instanceof Element&&(g.id==="__POSTHOG_TOOLBAR__"||!!(!((A=g.closest)===null||A===void 0)&&A.call(g,".toolbar-global-fade-container")))}function Jf(g){return!!g&&g.nodeType===1}function Nw(g,A){return!!g&&!!g.tagName&&g.tagName.toLowerCase()===A.toLowerCase()}function _dg(g){return!!g&&g.nodeType===3}function URA(g){return!!g&&g.nodeType===11&&Jf(g.host)}function JRA(g){return g?F9(g).split(/\s+/):[]}function bdg(g,A){const I=(function(e){var t;const o=typeof window>"u"?void 0:window,B=o==null||(t=o.location)===null||t===void 0?void 0:t.href;return Le(B)?void 0:Ldg(e,B)})(A);return!!(I&&g&&g.some(e=>I.match(e)))}function T9(g){let A="";switch(typeof g.className){case"string":A=g.className;break;case"object":A=(g.className&&"baseVal"in g.className?g.className.baseVal:null)||g.getAttribute("class")||"";break;default:A=""}return JRA(A)}function Hdg(g){return rC(g)?null:F9(g).split(/(\s+)/).filter(A=>O9(A)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function GV(g){let A="";return kY(g)&&!Z9(g)&&g.childNodes&&g.childNodes.length&&dn(g.childNodes,function(I){var e;_dg(I)&&I.textContent&&(A+=(e=Hdg(I.textContent))!==null&&e!==void 0?e:"")}),F9(A)}function mV(g){var A;return Le(g.target)?g.srcElement||null:!((A=g.target)===null||A===void 0)&&A.shadowRoot?g.composedPath()[0]||null:g.target||null}const PRA=["a","button","form","input","select","textarea","label"];function KRA(g,A){const I=g.matches||g.matchesSelector||g.msMatchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.oMatchesSelector;try{return!!I&&I.call(g,A)}catch{return!1}}function LRA(g,A){if(Le(A))return!0;for(const I of g)if(A.some(e=>KRA(I,e)))return!0;return!1}function vdg(g){const A=g.parentNode;return!(!A||!Jf(A))&&A}const YRA=[".ph-no-autocapture","[data-ph-no-autocapture]"],qdg=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],_RA=[...qdg,"+","-","−","–"],Tdg=_RA.length+10,AzI=["button","a","input","select","textarea","label"],gzI=["button","link","tab","menuitem","option"],Zdg=(g,A)=>/[a-z0-9]/i.test(A)?yB(_RA,A)?new RegExp(`\\b${A}\\b`).test(g):g.includes(A):g===A,IzI=g=>yB(AzI,g.tagName.toLowerCase())||yB(gzI,(g.getAttribute("role")||"").toLowerCase());function bRA(g){let A="",I="";const e=B=>{Jf(B)&&kY(B)&&!Z9(B)&&(A+=` ${GV(B)}`,I=I||B.getAttribute("aria-label")||"",dn(B.childNodes,e))};e(g),A=F9(A.replace(/\s+/g," "));const t=(O9(A)?A:"").toLowerCase(),o=g.getAttribute("aria-label")||(t?"":I);return{safeText:t,ariaLabel:F9(o).toLowerCase()}}const Odg=[".ph-no-rageclick",".ph-no-capture"],ezI=["","text","search","email","password","url","tel","number"];function Wdg(g,A){if(!(!(typeof window>"u")&&window)||HRA(g))return!1;let I,e,t;var o,B;if(gm(A)?(I=!!A&&Odg,e=void 0,t=!1):(I=(o=A?.css_selector_ignorelist)!==null&&o!==void 0?o:Odg,e=A?.content_ignorelist,t=(B=A?.ignore_text_selection)!==null&&B!==void 0&&B),I===!1||t&&(function(Q){return!(!Q||!Jf(Q))&&(!!Nw(Q,"textarea")||(Nw(Q,"input")?yB(ezI,(Q.getAttribute("type")||"").toLowerCase()):(function(i){var E;if(i.isContentEditable)return!0;const n=(E=i.getAttribute)===null||E===void 0?void 0:E.call(i,"contenteditable");return n==="true"||n===""})(Q)))})(g))return!1;const{targetElementList:C}=Vdg(g,!1);return!(e&&(function(Q,{safeText:i,ariaLabel:E}){let n;if(Q===!0)n=qdg;else{if(!aB(Q))return!1;if(Q.length>Tdg)return Dt.error(`[PostHog] content_ignorelist array cannot exceed ${Tdg} items. Use css_selector_ignorelist for more complex matching.`),!1;n=Q.map(s=>s.toLowerCase())}return n.some(s=>Zdg(i,s)||Zdg(E,s))})(e,(function(Q,i){for(const n of i)if(IzI(n))return bRA(n);for(const n of i){try{var E;if(((E=window)===null||E===void 0?void 0:E.getComputedStyle(n).getPropertyValue("cursor"))!=="pointer")break}catch{break}const s=bRA(n);if(s.safeText||s.ariaLabel)return s}return bRA(Q)})(g,C))||LRA(C,I))}const HRA=g=>!g||Nw(g,"html")||!Jf(g),Vdg=(g,A)=>{const I=typeof window>"u"?void 0:window;if(!I||HRA(g))return{parentIsUsefulElement:!1,targetElementList:[]};let e=!1;const t=[g];let o=g;for(;o.parentNode&&!Nw(o,"body");){if(URA(o.parentNode)){t.push(o.parentNode.host),o=o.parentNode.host;continue}const B=vdg(o);if(!B)break;if(A||PRA.indexOf(B.tagName.toLowerCase())>-1)e=!0;else try{const C=I.getComputedStyle(B);C&&C.getPropertyValue("cursor")==="pointer"&&(e=!0)}catch{}t.push(B),o=B}return{parentIsUsefulElement:e,targetElementList:t}};function kY(g){const A=new Set;let I=0;for(let o=g;o.parentNode&&!Nw(o,"body");o=o.parentNode){if(I++>=1e3||A.has(o))return!1;A.add(o);const B=T9(o);if(yB(B,"ph-sensitive")||yB(B,"ph-no-capture"))return!1}if(yB(T9(g),"ph-include"))return!0;const e=g.type||"";if(UC(e))switch(e.toLowerCase()){case"hidden":case"password":return!1}const t=g.name||g.id||"";return!UC(t)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(t.replace(/[^a-zA-Z0-9]/g,""))}function Z9(g){return!!(Nw(g,"input")&&!["button","checkbox","submit","reset"].includes(g.type)||Nw(g,"select")||Nw(g,"textarea")||g.getAttribute("contenteditable")==="true")}const jdg=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}))$"),zdg=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,tzI=[16,15,14,13],ozI=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Xdg=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),$dg=/[0-9A-Za-z_]/;function BzI(g){let A=0,I=!1;for(let e=g.length-1;e>=0;e--){let t=g.charCodeAt(e)-48;I&&(t*=2,t>9&&(t-=9)),A+=t,I=!I}return A%10==0}function O9(g,A=!0){return!(rC(g)||UC(g)&&(g=F9(g),(A?jdg.test((g||"").replace(/[- ]/g,"")):(function(I){let e;for(zdg.lastIndex=0;e=zdg.exec(I);){const t=e[2];if(!t)continue;const o=t.replace(/[- ]/g,"");for(let B=0;o.length>B;B++)for(const C of tzI){const Q=B+C;if(o.length>=Q){const i=o.slice(B,Q);if(jdg.test(i)&&BzI(i))return!0}}}return!1})(g))||(A?ozI.test(g):(function(I){let e;for(Xdg.lastIndex=0;e=Xdg.exec(I);){const t=e[1],o=e[3];if(!(t&&o&&$dg.test(t)&&$dg.test(o)))return!0}return!1})(g))))}function Ayg(g){let A=GV(g);return A=`${A} ${gyg(g)}`.trim(),O9(A)?A:""}function gyg(g){let A="";return g&&g.childNodes&&g.childNodes.length&&dn(g.childNodes,function(I){var e;if(I&&((e=I.tagName)===null||e===void 0?void 0:e.toLowerCase())==="span")try{const t=GV(I);A=`${A} ${t}`.trim(),I.childNodes&&I.childNodes.length&&(A=`${A} ${gyg(I)}`.trim())}catch(t){Dt.error("[AutoCapture]",t)}}),A}function Iyg(g){return g.replace(/"|\\"/g,'\\"')}function CzI(g){const A=g.attr__class;if(A)return aB(A)?A:JRA(A)}const vCA=qr("[Dead Clicks]"),QzI=()=>!0,izI=g=>{var A;const I=!!(!((A=g.instance.persistence)===null||A===void 0)&&A.get_property(lRA)),e=g.instance.config.capture_dead_clicks;return gm(e)?e:!!yC(e)||I};var eyg=class{get lazyLoadedDeadClicksAutocapture(){return this.Il}constructor(A,I,e){this.instance=A,this.isEnabled=I,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(A){if(!A.ok)return;const I=A.config;"captureDeadClicks"in I&&(this.instance.persistence&&this.instance.persistence.register({[lRA]:I.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Ml(()=>{this.El()}):this.stop()}Ml(A){var I,e,t;!((I=FB.__PosthogExtensions__)===null||I===void 0)&&I.initDeadClicksAutocapture?A():(e=FB.__PosthogExtensions__)===null||e===void 0||(t=e.loadExternalDependency)===null||t===void 0||t.call(e,this.instance,"dead-clicks-autocapture",o=>{o?vCA.error("failed to load script",o):A()})}El(){var A;if(ro){if(!this.Il&&(!((A=FB.__PosthogExtensions__)===null||A===void 0)&&A.initDeadClicksAutocapture)){const I=yC(this.instance.config.capture_dead_clicks)?QI({},this.instance.config.capture_dead_clicks):{};I.__onCapture=this.onCapture,this.onCapture&&(I.capture_dead_swipes=!1),this.Il=FB.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,I),this.Il.start(ro),vCA.info("starting...")}}else vCA.error("`document` not found. Cannot start.")}stop(){this.Il&&(this.Il.stop(),this.Il=void 0,vCA.info("stopping..."))}};const pV=qr("[SegmentIntegration]");function tyg(g,A,I=!0){const e=g.config.segment;if(!e)return A();const{analytics:t,filterProperties:o}=(C=>Xh(C.register))(B=e)?{analytics:B}:B;var B;(function(C,Q,i,E){const n=r=>{const a=()=>r.anonymousId()||Uf();C.config.get_device_id=a,E&&r.id()&&(C.register({distinct_id:r.id(),$device_id:a()}),C.persistence.set_property(Im,_CA)),i(E?void 0:r.anonymousId()||void 0)},s=Q.user();"then"in s&&Xh(s.then)?s.then(n):n(s)})(g,t,C=>{t.register(((Q,i,{filterProperties:E}={})=>{typeof Promise<"u"&&Promise.resolve||pV.warn("This browser does not have Promise support, and can not use the segment integration");const n=(s,r)=>{if(!r)return s;const a=!!i&&s.event.anonymousId===i&&!s.event.userId;a||s.event.userId||s.event.anonymousId===Q.get_distinct_id()||(pV.info("No userId set, resetting PostHog"),Q.reset()),a||(i=void 0),s.event.userId&&s.event.userId!==Q.get_distinct_id()&&(pV.info("UserId set, identifying with PostHog"),Q.identify(s.event.userId));let c=Q.calculateEventProperties(r,s.event.properties);if(!rC(E)){const h=s.event.properties||{},l={};for(const d of Object.keys(c))PfA.call(h,d)||(l[d]=c[d]);const D=((d,y)=>{const w=aB(d)?d:[d];let u=QI({},y);for(const G of w)try{if(u=G(u),rC(u))return null}catch(m){return pV.error("Error in Segment filterProperties:",m),null}return u})(E,l);if(rC(D))return s;c=D}return s.event.properties=Object.assign({},c,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(s){return n(s,s.event.event)},page(s){return n(s,pRA)},identify(s){return n(s,Rdg)},screen(s){return n(s,"$screen")}}})(g,C,{filterProperties:o})).then(()=>{A()},Q=>{pV.error("Failed to register the Segment integration",Q),A()})},I)}const oyg="posthog-js";function Byg(g,{organization:A,projectId:I,prefix:e,severityAllowList:t=["error"],sendExceptionsToPostHog:o=!0}={}){return B=>{var C,Q,i,E,n;if(t!=="*"&&!t.includes(B.level)||!g.__loaded)return B;B.tags||(B.tags={});const s=g.requestRouter.endpointFor("ui",`/project/${g.config.token}/person/${g.get_distinct_id()}`);B.tags["PostHog Person URL"]=s,g.sessionRecordingStarted()&&(B.tags["PostHog Recording URL"]=g.get_session_replay_url({withTimestamp:!0}));const r=((C=B.exception)===null||C===void 0?void 0:C.values)||[],a=r.map(l=>QI(QI({},l),{},{stacktrace:l.stacktrace?QI(QI({},l.stacktrace),{},{type:"raw",frames:(l.stacktrace.frames||[]).map(D=>QI(QI({},D),{},{platform:"web:javascript"}))}):void 0})),c={$exception_message:((Q=r[0])===null||Q===void 0?void 0:Q.value)||B.message,$exception_type:(i=r[0])===null||i===void 0?void 0:i.type,$exception_level:B.level,$exception_list:a,$sentry_event_id:B.event_id,$sentry_exception:B.exception,$sentry_exception_message:((E=r[0])===null||E===void 0?void 0:E.value)||B.message,$sentry_exception_type:(n=r[0])===null||n===void 0?void 0:n.type,$sentry_tags:B.tags};var h;return A&&I&&(c.$sentry_url=(e||"https://sentry.io/organizations/")+A+"/issues/?project="+I+"&query="+B.event_id),o&&((h=g.exceptions)===null||h===void 0||h.sendExceptionEvent(c)),B}}var EzI=class{constructor(A,I,e,t,o,B){this.name=oyg,this.setupOnce=function(C){C(Byg(A,{organization:I,projectId:e,prefix:t,severityAllowList:o,sendExceptionsToPostHog:B==null||B}))}}},Cyg=class{constructor(A){this.Pl=(I,e,t)=>{t&&(t.noSessionId||t.activityTimeout||t.sessionPastMaximumLength||t.crossTabAdoption)&&(Dt.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:I,changeReason:t}),this.Rl=void 0,this._instance.scrollManager.resetContext())},this._instance=A,this.Al()}Al(){var A;this.Fl=(A=this._instance.sessionManager)===null||A===void 0?void 0:A.onSessionId(this.Pl)}destroy(){var A;(A=this.Fl)===null||A===void 0||A.call(this),this.Fl=void 0}doPageView(A,I){var e;const t=this.Ol(A,I);return this.Rl={pathname:(e=Me?.location.pathname)!==null&&e!==void 0?e:"",pageViewId:I,timestamp:A},this._instance.scrollManager.resetContext(),t}doPageLeave(A){var I;return this.Ol(A,(I=this.Rl)===null||I===void 0?void 0:I.pageViewId)}doEvent(){var A;return{$pageview_id:(A=this.Rl)===null||A===void 0?void 0:A.pageViewId}}Ol(A,I){const e=this.Rl;if(!e)return{$pageview_id:I};let t={$pageview_id:I,$prev_pageview_id:e.pageViewId};const o=this._instance.scrollManager.getContext();if(o&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:B,lastScrollY:C,maxScrollY:Q,maxContentHeight:i,lastContentY:E,maxContentY:n}=o;if(!(Le(B)||Le(C)||Le(Q)||Le(i)||Le(E)||Le(n))){B=Math.ceil(B),C=Math.ceil(C),Q=Math.ceil(Q),i=Math.ceil(i),E=Math.ceil(E),n=Math.ceil(n);const s=B>1?FN(C/B,0,1,Dt):1,r=B>1?FN(Q/B,0,1,Dt):1,a=i>1?FN(E/i,0,1,Dt):1,c=i>1?FN(n/i,0,1,Dt):1;t=Qr(t,{$prev_pageview_last_scroll:C,$prev_pageview_last_scroll_percentage:s,$prev_pageview_max_scroll:Q,$prev_pageview_max_scroll_percentage:r,$prev_pageview_last_content:E,$prev_pageview_last_content_percentage:a,$prev_pageview_max_content:n,$prev_pageview_max_content_percentage:c})}}return e.pathname&&(t.$prev_pageview_pathname=e.pathname),e.timestamp&&(t.$prev_pageview_duration=(A.getTime()-e.timestamp.getTime())/1e3),t}};const kV=["flags","surveys"],nzI={[ujI]:{exposure:"hidden"},[YCA]:{exposure:"hidden"},[GjI]:{exposure:"hidden"},[sRA]:{exposure:"hidden"},[Y9]:{exposure:"hidden"},[DV]:{exposure:"hidden"},[Qdg]:{exposure:"event"},[aRA]:{exposure:"hidden"},[sdg]:{exposure:"hidden"},[rRA]:{exposure:"event"},[ndg]:{exposure:"hidden"},[cRA]:{exposure:"event"},[hRA]:{exposure:"event"},[lRA]:{exposure:"event"},[DRA]:{exposure:"hidden"},[adg]:{exposure:"event"},[dV]:{exposure:"hidden"},[mjI]:{exposure:"hidden"},[_9]:{exposure:"hidden"},[rdg]:{exposure:"event"},[pjI]:{exposure:"event",shouldSkipFromEventProperties:g=>fc(g)},[RjI]:{exposure:"event"},[NjI]:{exposure:"event"},[xjI]:{exposure:"event"},[FjI]:{exposure:"event"},[UjI]:{exposure:"hidden"},[xf]:{exposure:"hidden",storageGroup:"flags"},[vF]:{exposure:"hidden",storageGroup:"flags"},[CRA]:{exposure:"hidden"},[wY]:{exposure:"hidden",storageGroup:"flags"},[O4]:{exposure:"hidden",storageGroup:"flags"},[uY]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[cV]:{exposure:"hidden",storageGroup:"flags"},[UN]:{exposure:"hidden"},[GY]:{exposure:"hidden"},[Z4]:{exposure:"hidden"},[T4]:{exposure:"hidden"},[lV]:{exposure:"hidden",storageGroup:"surveys"},[PCA]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[iRA]:{exposure:"event"},[KCA]:{exposure:"hidden"},[LCA]:{exposure:"hidden"},[dRA]:{exposure:"hidden"},[JjI]:{exposure:"hidden"},[PjI]:{exposure:"hidden"},[KjI]:{exposure:"event"},[LjI]:{exposure:"event"},[YjI]:{exposure:"event"},[_jI]:{exposure:"event"},[qF]:{exposure:"hidden"},[hV]:{exposure:"hidden"},[cdg]:{exposure:"event"},[rV]:{exposure:"hidden"},[q4]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Im]:{exposure:"hidden"},[yRA]:{exposure:"hidden"},[bjI]:{exposure:"hidden"},[hdg]:{exposure:"hidden"},[ldg]:{exposure:"hidden"},[b9]:{exposure:"hidden"},[wRA]:{exposure:"hidden"},[kjI]:{exposure:"event"},[MjI]:{exposure:"event"},[SjI]:{exposure:"event"},[fjI]:{exposure:"event"},[ddg]:{exposure:"event"},[ydg]:{exposure:"event"},[GRA]:{exposure:"hidden"},[mRA]:{exposure:"hidden"},[wdg]:{exposure:"hidden"},[udg]:{exposure:"hidden"},[Gdg]:{exposure:"hidden"},[mdg]:{exposure:"hidden"},[pdg]:{exposure:"hidden"},[kdg]:{exposure:"hidden"},[Mdg]:{exposure:"hidden"},[HjI]:{exposure:"event"}},szI=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Dy=g=>{const A=nzI[g];if(A)return A;for(const[I,e]of szI)if(g.indexOf(I)===0)return e};function Qyg(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}const ZF=g=>{const A=typeof document>"u"?void 0:document,I=A?.createElement("a");return Le(I)?null:(I.href=g,I)},iyg=()=>{try{return"u">typeof window&&window.navigator.onLine!==!1}catch{return!1}},Eyg=(g,A)=>g>=A&&iyg(),nyg=(g,A,I,e)=>{if(g===0){if(iyg()){const t=A+1;return t===I&&e(),t}return A}return 0},W9=(g,A)=>{try{let I;return JSON.stringify(g,(e,t)=>{var o;return U9(t)?((o=I)!==null&&o!==void 0||(I=new WeakMap),I.has(t)||I.set(t,xdg(t)),I.get(t)):typeof t=="bigint"?t.toString():t},A)}catch{return Flg(g)}},V9=function(g,A){const I=((g.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let e;for(let t=0;I.length>t;t++){const o=I[t].split(/=(.*)/);if(o[0]===A){e=o;break}}if(!aB(e)||2>e.length)return"";{let t=e[1].replace(/\+/g," ");try{t=decodeURIComponent(t)}catch{Dt.error("Skipping decoding for malformed query param: "+t)}return t}},MV=function(g,A,I){if(!g||!A||!A.length)return g;const e=g.split("#"),t=e[1],o=(e[0]||"").split("?"),B=o[1],C=o[0],Q=(B||"").split("&"),i=[];for(let n=0;Q.length>n;n++){const s=Q[n].split("=");aB(s)&&(A.includes(s[0])?i.push(s[0]+"="+I):i.push(Q[n]))}let E=C;return B!=null&&(E+="?"+i.join("&")),t!=null&&(E+="#"+t),E},qCA=function(g,A){const I=g.match(new RegExp(A+"=([^&]*)"));return I?I[1]:null},j9=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],azI=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...j9],SV="<masked>",rzI=["li_fat_id"];function syg(g,A,I){if(!ro)return{};const e=A?[...j9,...I||[]]:[],t=ayg(MV(ro.URL,e,SV),g),o=(function(){const B={};return dn(rzI,function(C){const Q=yV(C);B[C]=Q||null}),B})();return Qr(o,t)}function ayg(g,A){const I=azI.concat(A||[]),e={};return dn(I,function(t){const o=V9(g,t);e[t]=o||null}),e}function ryg(g){const A=(function(t){return t?t.search("https?://(.*)google.([^/?]*)")===0?"google":t.search("https?://(.*)bing.com")===0?"bing":t.search("https?://(.*)yahoo.com")===0?"yahoo":t.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(g),I=A!="yahoo"?"q":"p",e={};if(!fc(A)){e.$search_engine=A;const t=ro?V9(ro.referrer,I):"";t.length&&(e.ph_keyword=t)}return e}function cyg(){return navigator.language||navigator.userLanguage}function czI(){const g=cyg();return typeof g=="string"?g.split("-")[0]:void 0}const TCA="$direct";function hyg(){return ro?.referrer||TCA}function lyg(g,A,I=!1){const e=g?[...j9,...A||[]]:[],t=I?v4(ta?.href):ta?.href,o=t?.substring(0,1e3);return{r:hyg().substring(0,1e3),u:o?MV(o,e,SV):void 0}}function Dyg(g,A=!1){var I;const{r:e,u:t}=g,o=A?v4(t):t,B={$referrer:e,$referring_domain:e==null?void 0:e==TCA?TCA:(I=ZF(e))===null||I===void 0?void 0:I.host};if(o){B.$current_url=o;const C=ZF(o);B.$host=C?.host,B.$pathname=C?.pathname;const Q=ayg(o);Qr(B,Q)}if(e){const C=ryg(e);Qr(B,C)}return B}function hzI(){try{return new Date().getTimezoneOffset()}catch{return}}const lzI={flags:q4,surveys:PCA},DzI=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ZCA=g=>`${g}_cookie_identity_change_pending`,OCA=g=>{let A="",I=0;for(const e of g){const t=encodeURIComponent(JSON.stringify(e).slice(1,-1)).length;if(I+t>1e3)break;A+=e,I+=t}return A},aD="main",OF=[xf,vF,wY,O4,uY,q4,cV,Z4],vRA=g=>OF.indexOf(g)!==-1,dyg=[Y9,DV],yyg=g=>dyg.indexOf(g)!==-1,W4=(g,A)=>{try{return JSON.stringify(g)===JSON.stringify(A)}catch{return g===A}},z9=g=>{if(!g)return{};const A=JSON.parse(g);return yC(A)?A:{}},wyg=(g,A)=>{dn(g,(I,e)=>{const t=Dy(e);t&&t.exposure!=="event"||{}.hasOwnProperty.call(A,e)||delete g[e]})};var qRA=class{constructor(A,I,e=!0,t=!A.cookieless_mode){if(this.Dl={},this.Ll=!1,this.Nl=!1,this.ql=!1,this.jl=!1,this.Bl=!1,this.zl=new Map,this.Hl=!1,this.Ul=!1,this.Wl=!1,this.Vl=new Set,this.Gl=new Set,this.Ar=A,this.Ql=e,this.props={},this.Zl=void 0,this.Jl=(o=>{let B="";return o.token&&(B=o.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),o.persistence_name?"ph_"+o.persistence_name:"ph_"+B+"_posthog"})(A),this.hi=A.disable_persistence||!!I,this.$l=this.Kl(A),this.ql=this.Xl(A),this.load(t),this.Yl(),A.debug&&Dt.info("Persistence loaded",A.persistence,QI({},this.props)),this.update_config(A,A,I),this.save(),Me){const o=()=>this.flush();GE(Me,"beforeunload",o,{capture:!1}),GE(Me,"pagehide",o,{capture:!1}),this.tu=B=>{if(this.Ll&&(!B.storageArea||B.storageArea===Me?.localStorage)&&B.key)if(B.key!==this.Jl){if(this.ql){const C=kV.find(Q=>B.key===this.eu(Q));C&&this.iu(B.key,C)}}else this.iu(B.key,aD)},GE(Me,"storage",this.tu)}}markCrossTabFeatureFlagChanges(A){Object.entries(A).forEach(([I,e])=>{const t=this.zl.get(I);if(!vRA(I)||t===!0)return;if(e===!0)return void this.nu(I,!0);const o=new Set(t||[]);e.forEach(B=>o.add(B)),o.size&&this.nu(I,o)})}onCrossTabFeatureFlagChange(A){return this.Gl.add(A),()=>this.Gl.delete(A)}destroy(){this.tu&&Me&&(Me.removeEventListener("storage",this.tu),this.tu=void 0),this.Gl.clear()}iu(A,I,e=!0){if(this.hi)return!1;let t,o;try{if(o=AE.Ot(A),fc(o)){const Q=this.su(I);return Q.storageValue=null,I!==aD&&(Q.persisted=!1),!1}t=z9(o)}catch{return!1}const B=I===aD?t:AE.Lt(this.Jl);if(B&&this.ru(B))return!1;const C=this.ou(t,I,e);return I===aD&&this.ql&&!W4(this.au().main,t)||this.lu(t,I,!0,o),C}ru(A){const I=this.props[Ff],e=A[Ff];return!Le(I)&&!Le(e)&&I!==e}lu(A,I,e,t){const o=this.su(I);o.storageValue=t,I!==aD&&(o.persisted=e);try{o.fingerprint=this.uu(A,I)}catch{o.fingerprint=void 0}}ou(A,I,e){let t=!1;return OF.forEach(o=>{var B;const C=(B=Dy(o))===null||B===void 0?void 0:B.storageGroup;if(I===aD&&this.ql&&C||I!==aD&&C!==I)return;const Q=o in A,i=this.cu(o,Q?A[o]:void 0),E=this.zl.has(o)?o in this.props:Q;E===o in this.props&&W4(i,this.props[o])||(E?this.hu(o,i,!1):this.du(o,!1),t=!0)}),t&&e&&this.Gl.forEach(o=>o()),t}vu(){if(!this.Ll)return!1;try{this.Wl=!1;const A=AE.Ot(this.Jl),I=this.su(aD);let e,t=!1,o=!1;if(A!==I.storageValue)if(fc(A))I.storageValue=null;else{if(e=z9(A),this.Wl=!this.Ul&&this.ru(e),this.Wl)return!1;o=this.ou(e,aD,!1),!this.ql||W4(this.au().main,e)?this.lu(e,aD,!0,A):I.storageValue=A,t=!0}return this.ql&&kV.forEach(B=>{const C=AE.Ot(this.eu(B)),Q=this.su(B),i=e||{},E=t&&OF.some(s=>{var r;return((r=Dy(s))===null||r===void 0?void 0:r.storageGroup)===B&&s in i});if(C===Q.storageValue&&!E)return;if(fc(C))return Q.storageValue=null,Q.persisted=!1,void(E&&(o=this.ou(i,B,!1)||o));const n=z9(C);o=this.ou(n,B,!1)||o,this.lu(n,B,!0,C)}),o}catch{return!1}}nu(A,I){this.zl.set(A,I);const e=Dy(A);e?.volatile||(this.su((this.ql?e?.storageGroup:void 0)||aD).fingerprint=void 0,this.fu(A))}pu(){OF.forEach(A=>this.zl.set(A,!0))}Yl(){if(this.Ll)try{const A=AE.Ot(this.Jl),I=z9(A);this.su(aD).storageValue=A,OF.forEach(e=>{var t;const o=this.ql?(t=Dy(e))===null||t===void 0?void 0:t.storageGroup:void 0,B=o?AE.Ot(this.eu(o)):null;if(o){const Q=this.su(o);Q.storageValue=B,Q.persisted=!fc(B)}const C=o&&!fc(B)?z9(B):I;e in this.props?this.gu(e,C[e],this.props[e]):e in C&&this.nu(e,!0)})}catch{}}cu(A,I){const e=this.zl.get(A);if(!e)return I;if(e===!0)return this.props[A];if(A==="$active_feature_flags"){const B=new Set(aB(I)?I:[]),C=new Set(aB(this.props[A])?this.props[A]:[]);return e.forEach(Q=>C.has(Q)?B.add(Q):B.delete(Q)),Array.from(B)}const t=yC(I)?QI({},I):{},o=yC(this.props[A])?this.props[A]:{};return e.forEach(B=>{B in o?t[B]=o[B]:delete t[B]}),t}gu(A,I,e){if(!vRA(A))return;const t=this.zl.get(A);if(t===!0)return;let o=I;if(this.Ll)try{var B;const Q=this.ql?(B=Dy(A))===null||B===void 0?void 0:B.storageGroup:void 0,i=Q?this.eu(Q):this.Jl;o=z9(AE.Ot(i))[A]}catch{}const C=new Set(t||[]);if(A==="$active_feature_flags"){if(!Le(I)&&!aB(I)||!Le(o)&&!aB(o)||!aB(e))return void this.nu(A,!0);const Q=new Set(I||[]),i=new Set(o||[]),E=new Set(e);new Set([...Q,...E]).forEach(n=>{Q.has(n)!==E.has(n)&&C.add(n)}),C.forEach(n=>{i.has(n)===E.has(n)&&C.delete(n)})}else{if(!yC(e))return void(W4(o,e)?this.zl.delete(A):this.nu(A,!0));{if(!Le(I)&&!yC(I)||Le(I)&&_p(e)&&Le(o))return void this.nu(A,!0);const Q=yC(I)?I:{},i=yC(o)?o:{};new Set([...Object.keys(Q),...Object.keys(e)]).forEach(E=>{E in Q==E in e&&W4(Q[E],e[E])||C.add(E)}),C.forEach(E=>{E in i==E in e&&W4(i[E],e[E])&&C.delete(E)})}}C.size?this.nu(A,C):this.zl.delete(A)}mu(){var A;const I=(A=this.Ar)===null||A===void 0?void 0:A.persistence_save_debounce_ms;return $h(I)&&I>0?I:0}yu(A){if(this.Ar.cookieWinsOnConflict&&this.Ar.persistence.toLowerCase()==="localstorage+cookie")if(A)try{const I=NRA(A,this.Ar.cookie_persisted_properties||[]),e=Pdg(I,this.Ar.cookie_persisted_properties||[]),t=JSON.stringify(I)+"|"+JSON.stringify(e),o=ir.Ot(this.Jl)||void 0;o&&xRA(this.Jl,o)===t&&(this.bu=t,this._u=o)}catch{}else try{const I=ir.Ot(this.Jl)||void 0;this.bu=I?xRA(this.Jl,I):void 0,this._u=I}catch{}}syncCookieProperties(){return this.wu(this.Ar)}wu(A,I=!1){if(this.hi&&!I||this.Bl||!A.cookieWinsOnConflict||A.persistence.toLowerCase()!=="localstorage+cookie")return!1;let e;try{e=ir.Ot(this.Jl)||void 0}catch{}if(!e||e===this._u)return!1;const t=xRA(this.Jl,e);let o;try{o=RRA(JSON.parse(e))}catch{return!1}if((ir.Ot(this.Jl)||void 0)!==e)return!1;this.bu=t,this._u=e;const B=Kdg(this.Jl,e),C=[...mY,...B.properties],Q={};if(Object.keys(o).forEach(h=>{const l=o[h];(Le(l)||fc(l)||l===""||h==="$user_state"&&l!=="anonymous"&&l!=="identified")&&(Q[h]=!0,delete o[h])}),_p(o))return!1;const i="distinct_id"in o||o.$user_state==="anonymous"||o.$user_state==="identified",E=this.props,n=E[Ff],s=E[Im],r=Qr({},E);[...mY,...A.cookie_persisted_properties||[]].forEach(h=>{if(C.indexOf(h)!==-1&&!(h in o)&&!Q[h]&&(i||h!=="distinct_id"&&h!=="$user_state")){const l=r[h];(B.isValid||mY.indexOf(h)===-1||l!==!1&&l!==0)&&delete r[h]}}),this.props=Qr(r,o),OF.forEach(h=>{const l=h in this.props;h in E===l&&W4(E[h],this.props[h])||(l?this.gu(h,E[h],this.props[h]):this.nu(h,!0))}),!i||"$user_state"in o||"$user_state"in this.props||this.hu(Im,TF);const a=this.props[Ff],c=this.props[Im];return!i||a===n&&c===s||(this.Ul=!0,this.jl=!0,Ba.At(ZCA(this.Jl),!0),this.du(Z4),this.du(vF),this.du(xf),this.du(wY),this.du(O4),this.du(uY),this.du(q4),this.du(rV),this.du(qF),c!=="anonymous"||s!=="identified"&&o.$user_state!=="anonymous"&&(Le(n)||a===n)||(wyg(this.props,o),this.du(T4)),c==="identified"?this.props.$user_id=a:delete this.props.$user_id,this.du(YCA)),!0}consumeCookieIdentityChange(){const A=ZCA(this.Jl),I=this.jl||!!Ba.Ot(A);return this.jl=!1,I&&Ba.Pt(A),I}ku(A=!1){return!(this.Bl||this.hi&&!A||!this.Ar.cookieWinsOnConflict||this.Ar.persistence.toLowerCase()!=="localstorage+cookie"||(this.Bl=!0,0))}Su(){this.Bl&&(Le(this.xu)||(clearTimeout(this.xu),this.xu=void 0),delete this.Dl[aD],this.$u(!0))}Cu(A=!0){if(this.Bl)try{A?this.Su():Le(this.xu)||(clearTimeout(this.xu),this.xu=void 0)}finally{this.Bl=!1}}isDisabled(){return!!this.hi}Kl(A){DzI.indexOf(A.persistence.toLowerCase())===-1&&(Dt.critical("Unknown persistence type "+A.persistence+"; falling back to localStorage+cookie"),A.persistence="localStorage+cookie");const I=((C=[],Q=!1,i=()=>!1)=>{const E=[...mY,...C];return QI(QI({},AE),{},{Tu(n){return[ir.Ot(n),ir.Ot(uV(n)),AE.Ot(n)].join("\0")},Lt(n){try{let r,a={};try{r=ir.Ot(n)||void 0,a=r?RRA(JSON.parse(r)):{}}catch{}const c=JSON.parse(AE.Ot(n)||"{}");let h;if(Q){const l=Kdg(n,r),D=[...mY,...l.properties],d={};Object.keys(a).forEach(w=>{const u=a[w];fc(u)||u===""||w==="$user_state"&&u!=="anonymous"&&u!=="identified"||(d[w]=u)});const y="distinct_id"in d||d.$user_state==="anonymous"||d.$user_state==="identified";if(Object.keys(d).length>0){var s;const w=c[Ff],u=(s=c.$user_state)!==null&&s!==void 0?s:TF;E.forEach(G=>{if(D.indexOf(G)!==-1&&!(G in a)&&(y||G!=="distinct_id"&&G!=="$user_state")){const m=c[G];(l.isValid||mY.indexOf(G)===-1||m!==!1&&m!==0)&&delete c[G]}}),!y||"$user_state"in a||"$user_state"in c||(c[Im]=TF),!y||("distinct_id"in d?d[Ff]:c[Ff])===w&&("$user_state"in d?d[Im]:c[Im])===u||(fRA.forEach(G=>delete c[G]),d.$user_state==="identified"&&"distinct_id"in d?c.$user_id=d[Ff]:delete c.$user_id,d.$user_state!=="identified"&&(delete c[cdg],delete c[T4]),delete c.__alias)}h=Qr(c,d)}else h=Qr(a,c);return i()||AE.At(n,h),h}catch{}return null},At(n,s,r,a,c,h){const l=AE.At(n,s,void 0,void 0,h);try{const D=NRA(s,C);if(Object.keys(D).length){if(Q){const d=uV(n),y=Pdg(D,C);if(ir.At(d,y,r,a,c,h),ir.Ot(d)!==JSON.stringify(y)){ir.Pt(d,a);const w=NRA(s);return ir.At(n,w,r,a,c,h),l}}ir.At(n,D,r,a,c,h)}}catch(D){AE.Ft(D)}return l},Pt(n,s){try{Me?.localStorage.removeItem(n),ir.Pt(n,s),ir.Pt(uV(n),s)}catch(r){AE.Ft(r)}}})})(A.cookie_persisted_properties||[],A.cookieWinsOnConflict,()=>!!this.hi);let e,t=!1,o=!1;const B=A.persistence.toLowerCase();return B==="localstorage"&&AE.$t()?(e=AE,o=!0):B==="localstorage+cookie"&&I.$t()?(e=I,o=!0,t=!0):B==="sessionstorage"&&Ba.$t()?e=Ba:B==="memory"?e=FRA:B==="cookie"&&ir.$t()?(e=ir,t=!0):I.$t()?(e=I,o=!0,t=!0):ir.$t()?(e=ir,t=!0):e=FRA,this.Ll=o,this.Nl=t,e}eu(A){return`${this.Jl}__${A}`}Xl(A){return this.Ll&&!!A.split_storage}properties(){const A={};return dn(this.props,(I,e)=>{const t=Dy(e);if(!t||t.exposure==="event"){var o;if(!(t==null||(o=t.shouldSkipFromEventProperties)===null||o===void 0)&&o.call(t,I))return;A[e]=I}}),A}load(A=!1){if(this.hi&&!A)return;const I=this.Ar.cookieWinsOnConflict&&this.Ar.persistence.toLowerCase()==="localstorage+cookie",e=I?AE.Lt(this.Jl):null;let t={};if(I)try{t=RRA(ir.Lt(this.Jl)),dn(t,(Q,i)=>{(Le(Q)||fc(Q)||Q==="")&&delete t[i]})}catch{}const o=this.$l.Lt(this.Jl);if(o&&(this.props=Qr({},o)),this.ql&&this.Iu(),I&&o){var B,C;const Q=e?.[Ff],i=(B=e?.$user_state)!==null&&B!==void 0?B:TF,E=o[Ff],n=(C=o.$user_state)!==null&&C!==void 0?C:TF;if(E!==Q||n!==i){this.jl=!0,this.hi||Ba.At(ZCA(this.Jl),!0);const s=Qr({},this.props);fRA.forEach(a=>delete s[a]),n!=="anonymous"||i!=="identified"&&t.$user_state!=="anonymous"&&(Le(Q)||E===Q)||(wyg(s,t),delete s[T4]),this.props=s;const r=new Set;fRA.forEach(a=>{var c;const h=(c=Dy(a))===null||c===void 0?void 0:c.storageGroup;h&&r.add(h)}),r.forEach(a=>{if(this.hi)return;const c={};dn(this.props,(h,l)=>{var D;((D=Dy(l))===null||D===void 0?void 0:D.storageGroup)===a&&(c[l]=h)}),_p(c)?(AE.Pt(this.eu(a)),this.Dl[a]={}):AE.At(this.eu(a),c)&&(this.Dl[a]={persisted:!0,fingerprint:this.uu(c,a)})})}}Ba.Ot(ZCA(this.Jl))&&(this.jl=!0)}Iu(){for(const A of kV){const I=AE.Lt(this.eu(A));if(I&&!_p(I)){const e=this.su(A);e.persisted=!0,this.Mu(A)||(e.fingerprint=this.uu(I,A)),this.Eu(A,I)||Qr(this.props,I)}}}Mu(A){return Object.keys(this.props).some(I=>{var e;return((e=Dy(I))===null||e===void 0?void 0:e.storageGroup)===A})}Eu(A,I){const e=lzI[A];if(!e)return!1;const t=I[e],o=this.props[e];return $h(t)&&$h(o)&&o>t}refreshKey(A){this.Pu([A])}Pu(A){if(this.hi)return;let I,e=!1;const t=()=>(e||(I=this.$l.Lt(this.Jl),e=!0),I);A.forEach(o=>{var B;if(this.Vl.has(o))return;const C=this.ql?(B=Dy(o))===null||B===void 0?void 0:B.storageGroup:void 0,Q=C?AE.Lt(this.eu(C)):t();if(Q&&o in Q)this.hu(o,Q[o],!1);else{if(C){const i=t();if(i&&o in i)return void this.hu(o,i[o],!1)}this.du(o,!1)}})}refreshMetaIdentifiers(){if(this.hi)return;const A=this.Ru();(Le(A)||A!==this.Au)&&(this.Pu(dyg),this.Fu(A))}Fu(A=this.Ru()){this.Au=this.Vl.size===0?A:void 0}Ru(){const A=this.$l.Tu?this.$l.Tu(this.Jl):this.$l.Ot(this.Jl);return UC(A)?A:void 0}save(){if(this.hi)return;const A=this.mu();A>0?Le(this.xu)&&(this.xu=setTimeout(()=>{this.xu=void 0,this.$u()},A)):this.$u()}flush(){Le(this.xu)||(clearTimeout(this.xu),this.xu=void 0,this.$u())}$u(A=!1){if(this.hi||this.Bl&&!A)return;A||(this.syncCookieProperties(),this.Ar.cookieWinsOnConflict&&this.Ar.persistence.toLowerCase()==="localstorage+cookie"||this.refreshMetaIdentifiers());const I=!A&&!this.Hl;I||(this.Wl=!1);const e=!!I&&this.vu();if(this.Wl)return void(this.Ar.debug&&Dt.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.ql)return this.Ou(),void(e&&this.Gl.forEach(o=>o()));const t=this.Du(this.$l,this.Jl,this.props,aD);t==="written"&&this.yu(this.props),t!=="failed"&&(this.zl.clear(),this.Ul=!1,this.Vl.clear()),t==="written"&&this.Fu(),e&&this.Gl.forEach(o=>o())}Ou(){const{main:A,groups:I}=this.au(),e=this.Du(this.$l,this.Jl,A,aD);e==="written"&&this.yu(A),e!=="failed"&&(this.Ul=!1,this.Vl.clear(),OF.forEach(o=>{var B;!((B=Dy(o))===null||B===void 0)&&B.storageGroup||this.zl.delete(o)})),e==="written"&&this.Fu();for(const o of kV){var t;const B=I[o];if(_p(B)&&!(!((t=this.Dl[o])===null||t===void 0)&&t.persisted)){OF.forEach(Q=>{var i;((i=Dy(Q))===null||i===void 0?void 0:i.storageGroup)===o&&this.zl.delete(Q)});continue}const C=this.Du(AE,this.eu(o),B,o);C!=="failed"&&OF.forEach(Q=>{const i=Dy(Q);i?.storageGroup!==o||C!=="written"&&i.volatile||this.zl.delete(Q)})}}au(){const A={},I={flags:{},surveys:{}};return dn(this.props,(e,t)=>{var o;const B=(o=Dy(t))===null||o===void 0?void 0:o.storageGroup;B?I[B][t]=e:A[t]=e}),{main:A,groups:I}}uu(A,I){if(I===aD)return JSON.stringify(A)+"|"+this.Lu+"|"+this.Nu+"|"+this.qu;const e={};return dn(A,(t,o)=>{var B;e[o]=!((B=Dy(o))===null||B===void 0)&&B.volatile?"__volatile__":t}),JSON.stringify(e)}Du(A,I,e,t){const o=this.su(t);if(t!==aD&&!o.dirty&&!Le(o.fingerprint))return"skipped";let B;try{if(B=this.uu(e,t),B===o.fingerprint)return o.dirty=!1,"skipped"}catch{B=void 0}return A.At(I,e,this.Lu,this.Nu,this.qu,this.Ar.debug)?(o.dirty=!1,t!==aD&&(o.persisted=!0),Le(B)||(o.fingerprint=B),this.Ll&&(o.storageValue=AE.Ot(I)),"written"):(this.Ar.debug&&Dt.warn(`failed to persist storage entry "${I}"; will retry on next save`),"failed")}remove({keepGroupEntries:A=!1}={}){if(this.pu(),Le(this.xu)||(clearTimeout(this.xu),this.xu=void 0),this.$l.Pt(this.Jl,!1),this.$l.Pt(this.Jl,!0),!A&&this.Ql)for(const I of kV)AE.Pt(this.eu(I));A?delete this.Dl[aD]:this.Dl={},this.bu=void 0,this._u=void 0}clear(){this.remove(),this.props={}}register_once(A,I,e){if(yC(A)){this.syncCookieProperties(),Le(I)&&(I="None"),this.Lu=Le(e)?this.ju:e;let t=!1;if(dn(A,(o,B)=>{this.props.hasOwnProperty(B)&&this.props[B]!==I||(this.hu(B,o),t=!0)}),t)return this.save(),!0}return!1}register(A,I){if(yC(A)){this.syncCookieProperties(),this.Lu=Le(I)?this.ju:I;let e=!1;if(dn(A,(t,o)=>{A.hasOwnProperty(o)&&(this.props[o]!==t||yC(t)||aB(t))&&(this.hu(o,t),e=!0)}),e)return this.save(),!0}return!1}unregister(A){this.syncCookieProperties();const I=typeof A=="string"?[A]:A;let e=!1;for(const t of I)t in this.props&&(this.du(t),e=!0);e&&this.save()}update_campaign_params(){const A=ro?.URL;if(A===this.Zl)return;const I=syg(this.Ar.custom_campaign_params,this.Ar.mask_personal_data_properties,this.Ar.custom_personal_data_properties),e=!_p(kRA(I));return e&&this.register(I),this.Zl=A,e?I:void 0}update_search_keyword(){this.register((function(){const A=ro?.referrer;return A?ryg(A):{}})())}update_referrer_info(){var A;this.register_once({$referrer:hyg(),$referring_domain:ro?.referrer&&((A=ZF(ro.referrer))===null||A===void 0?void 0:A.host)||TCA},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const A=lyg(this.Ar.mask_personal_data_properties,this.Ar.custom_personal_data_properties,this.Ar.disable_capture_url_hashes);this.register_once({[b9]:this.Nl?{r:OCA(A.r),u:A.u?OCA(A.u):void 0}:A},void 0)}get_initial_props(){const A={};dn([ldg,hdg],e=>{const t=this.props[e];t&&dn(t,function(o,B){A["$initial_"+JfA(B)]=o})});const I=this.props[b9];if(I){const e=(function(t,o=!1){const B=Dyg(t,o),C={};return dn(B,function(Q,i){C[`$initial_${JfA(i)}`]=Q}),C})(I,this.Ar.disable_capture_url_hashes);Qr(A,e)}return A}safe_merge(A){return dn(this.props,function(I,e){e in A||(A[e]=I)}),A}update_config(A,I,e){const t=A.persistence!==I.persistence,o=!((a,c)=>{if(a.length!==c.length)return!1;const h=[...a].sort(),l=[...c].sort();return h.every((D,d)=>D===l[d])})(A.cookie_persisted_properties||[],I.cookie_persisted_properties||[]),B=t||o,C=A.cookieWinsOnConflict!==I.cookieWinsOnConflict,Q=A.disable_persistence||!!e,i=!!this.hi&&!Q;Q||this.wu(I,i),this.Ar=A,!Q&&(t||o||C)&&(this.bu=void 0,this._u=void 0,this.wu(QI(QI({},A),{},{cookie_persisted_properties:I.cookie_persisted_properties}),i));const E=B||C?this.Kl(A):this.$l;this.Bu();const n=this.Xl(A),s=B||n!==this.ql,r=!Q&&(s||A.cross_subdomain_cookie!==this.Nu||A.secure_cookie!==this.qu)&&this.ku(i);this.Hl=s;try{if(this.ju=this.Lu=A.cookie_expiration,this.set_disabled(Q),this.set_cross_subdomain(A.cross_subdomain_cookie),this.set_secure(A.secure_cookie),s){const a=this.props;this.clear(),this.$l=E,this.ql=n,this.props=a,this.save()}else C&&(this.$l=E,Q||(delete this.Dl[aD],this.$u()))}finally{this.Hl=!1,r&&this.Cu()}}Bu(){const A=this.props[b9];if(!this.Nl||!yC(A)||typeof A.r!="string")return;const I=OCA(A.r),e=typeof A.u=="string"?OCA(A.u):A.u;I===A.r&&e===A.u||this.hu(b9,QI(QI({},A),{},{r:I,u:e}))}set_disabled(A){this.hi=A,this.hi?this.remove():this.save()}set_cross_subdomain(A){A!==this.Nu&&(this.Nu=A,this.remove({keepGroupEntries:!0}),this.save())}set_secure(A){A!==this.qu&&(this.qu=A,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(A,I){const e=this.props.__timers||{};e[A]=I,this.hu(sRA,e),this.save()}remove_event_timer(A){const I=this.props.__timers||{},e=I[A];return Le(e)||(delete I[A],this.hu(sRA,I),this.save()),e}get_property(A){return this.props[A]}set_property(A,I){this.hu(A,I),this.save()}hu(A,I,e=!0){var t;const o=this.props[A];this.props[A]=I,e&&(A!=="distinct_id"&&A!=="$user_state"||o===I||(this.Ul=!0),yyg(A)&&!W4(o,I)&&this.Vl.add(A),this.gu(A,o,I),!((t=Dy(A))===null||t===void 0)&&t.volatile||this.fu(A))}du(A,I=!0){delete this.props[A],I&&(vRA(A)&&this.nu(A,!0),yyg(A)&&this.Vl.add(A),this.fu(A))}fu(A){var I;const e=(I=Dy(A))===null||I===void 0?void 0:I.storageGroup;e&&(this.su(e).dirty=!0)}su(A){return this.Dl[A]||(this.Dl[A]={})}};const GM={GZipJS:"gzip-js",Base64:"base64"},fV={Activation:"events",Cancellation:"cancelEvents"},TRA={Popover:"popover",API:"api",Widget:"widget"},mM={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},ZRA={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},ORA={Popover:"popover",Inline:"inline"};function WCA(g){let A=!0;return{dispose(){if(A){A=!1;const I=g();I&&Xh(I.then)&&I.then(void 0,()=>{})}}}}const dzI={SHOWN:"product tour shown"},uyg={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Gyg=qr("[RateLimiter]");var yzI=class{constructor(A){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=I=>{const e=I.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach(t=>{Gyg.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=new Date().getTime()+6e4})}catch(t){return void Gyg.warn(`could not rate limit - continuing. Error: "${t?.message}"`,{text:e})}},this.instance=A,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var A;return((A=this.instance.config.rate_limiting)===null||A===void 0?void 0:A.events_per_second)||10}get captureEventsBurstLimit(){var A;return Math.max(((A=this.instance.config.rate_limiting)===null||A===void 0?void 0:A.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(A=!1){var I,e,t;const{captureEventsBurstLimit:o,captureEventsPerSecond:B}=this,C=new Date().getTime(),Q=(I=(e=this.instance.persistence)===null||e===void 0?void 0:e.get_property("$capture_rate_limit"))!==null&&I!==void 0?I:{tokens:o,last:C};Q.tokens+=Math.max(0,C-Q.last)/1e3*B,Q.last=Math.max(Q.last,C),Q.tokens>o&&(Q.tokens=o);const i=1>Q.tokens;if(i||A||(Q.tokens=Math.max(0,Q.tokens-1)),i&&!A){const E=($h(Q.dropped)?Q.dropped:0)+1;Q.dropped=E,!this.lastEventRateLimited&&this.zu(E)&&(Q.dropped=0)}return this.lastEventRateLimited=i,(t=this.instance.persistence)===null||t===void 0||t.set_property("$capture_rate_limit",Q),{isRateLimited:i,remainingTokens:Q.tokens}}Hu(A){const I=this.instance.config.property_denylist;return!aB(I)||!I.includes(A)}Uu(){var A;if(this.Hu("$current_url")&&this.Hu("$pathname")&&ta?.pathname)return`${(A=ta.origin)!==null&&A!==void 0?A:""}${ta.pathname}`}zu(A){var I,e;const{captureEventsBurstLimit:t,captureEventsPerSecond:o}=this,B=this.Uu(),C=this.Hu("$session_id")?(I=(e=this.instance).get_session_id)===null||I===void 0?void 0:I.call(e):void 0,Q=[`${A} event(s) dropped since the last warning`,B?`triggered on ${B}`:void 0,C?`session ${C}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${Q}. Config is set to ${o} events per second and ${t} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(A){const I=this.serverLimits[A||"events"]||!1;return I!==!1&&new Date().getTime()<I}};const V4=qr("[RemoteConfig]");var myg=class{constructor(A){this._instance=A}get remoteConfig(){var A;return(A=FB._POSTHOG_REMOTE_CONFIG)===null||A===void 0||(A=A[this._instance.config.token])===null||A===void 0?void 0:A.config}Wu(A){var I,e,t;!((I=FB.__PosthogExtensions__)===null||I===void 0)&&I.loadExternalDependency?(e=FB.__PosthogExtensions__)===null||e===void 0||(t=e.loadExternalDependency)===null||t===void 0||t.call(e,this._instance,"remote-config",()=>A(this.remoteConfig)):A()}Vu(A){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:A})}load(){try{if(this.remoteConfig)return V4.info("Using preloaded remote config",this.remoteConfig),void this.Gu(this.remoteConfig);if(this._instance.Qu())return void V4.warn("Remote config is disabled. Falling back to local config.");this.Wu(A=>{if(!A)return V4.info("No config found after loading remote JS config. Falling back to JSON."),void this.Vu(I=>{this.Gu(I.json,I)});this.Gu(A)})}catch(A){V4.error("Error loading remote config",A),this.Gu()}}Gu(A,I){!A&&I&&(I.statusCode===0?I.error||V4.warn("Failed to fetch remote config from PostHog."):V4.error("Failed to fetch remote config from PostHog."));try{this._instance.Gu(A?{ok:!0,config:A}:{ok:!1})}catch(t){V4.error("Error applying remote config",t)}if(A?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;(e=this._instance.featureFlags)===null||e===void 0||e.ensureFlagsLoaded()}catch(t){V4.error("Error loading feature flags",t)}}},i2=Uint8Array,Hp=Uint16Array,X9=Uint32Array,WRA=new i2([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]),VRA=new i2([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]),pyg=new i2([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),kyg=function(g,A){for(var I=new Hp(31),e=0;31>e;++e)I[e]=A+=1<<g[e-1];var t=new X9(I[30]);for(e=1;30>e;++e)for(var o=I[e];I[e+1]>o;++o)t[o]=o-I[e]<<5|e;return[I,t]},Myg=kyg(WRA,2),jRA=Myg[1];Myg[0][28]=258,jRA[258]=28;for(var Syg=kyg(VRA,0)[1],fyg=new Hp(32768),Rc=0;32768>Rc;++Rc){var $9=(43690&Rc)>>>1|(21845&Rc)<<1;fyg[Rc]=((65280&($9=(61680&($9=(52428&$9)>>>2|(13107&$9)<<2))>>>4|(3855&$9)<<4))>>>8|(255&$9)<<8)>>>1}var RV=function(g,A,I){for(var e=g.length,t=0,o=new Hp(A);e>t;++t)++o[g[t]-1];var B,C=new Hp(A);for(t=0;A>t;++t)C[t]=C[t-1]+o[t-1]<<1;for(B=new Hp(e),t=0;e>t;++t)B[t]=fyg[C[g[t]-1]++]>>>15-g[t];return B},MY=new i2(288);for(Rc=0;144>Rc;++Rc)MY[Rc]=8;for(Rc=144;256>Rc;++Rc)MY[Rc]=9;for(Rc=256;280>Rc;++Rc)MY[Rc]=7;for(Rc=280;288>Rc;++Rc)MY[Rc]=8;var VCA=new i2(32);for(Rc=0;32>Rc;++Rc)VCA[Rc]=5;var wzI=RV(MY,9),uzI=RV(VCA,5),Ryg=function(g){return(g/8|0)+(7&g&&1)},Nyg=function(g,A,I){(I==null||I>g.length)&&(I=g.length);var e=new(g instanceof Hp?Hp:g instanceof X9?X9:i2)(I-A);return e.set(g.subarray(A,I)),e},WF=function(g,A,I){var e=A/8|0;g[e]|=I<<=7&A,g[e+1]|=I>>>8},NV=function(g,A,I){var e=A/8|0;g[e]|=I<<=7&A,g[e+1]|=I>>>8,g[e+2]|=I>>>16},zRA=function(g,A){for(var I=[],e=0;g.length>e;++e)g[e]&&I.push({s:e,f:g[e]});var t=I.length,o=I.slice();if(!t)return[new i2(0),0];if(t==1){var B=new i2(I[0].s+1);return B[I[0].s]=1,[B,1]}I.sort(function(w,u){return w.f-u.f}),I.push({s:-1,f:25001});var C=I[0],Q=I[1],i=0,E=1,n=2;for(I[0]={s:-1,f:C.f+Q.f,l:C,r:Q};E!=t-1;)C=I[I[n].f>I[i].f?i++:n++],Q=I[i!=E&&I[n].f>I[i].f?i++:n++],I[E++]={s:-1,f:C.f+Q.f,l:C,r:Q};var s=o[0].s;for(e=1;t>e;++e)o[e].s>s&&(s=o[e].s);var r=new Hp(s+1),a=XRA(I[E-1],r,0);if(a>A){e=0;var c=0,h=a-A,l=1<<h;for(o.sort(function(w,u){return r[u.s]-r[w.s]||w.f-u.f});t>e;++e){var D=o[e].s;if(A>=r[D])break;c+=l-(1<<a-r[D]),r[D]=A}for(c>>>=h;c>0;){var d=o[e].s;A>r[d]?c-=1<<A-r[d]++-1:++e}for(;e>=0&&c;--e){var y=o[e].s;r[y]==A&&(--r[y],++c)}a=A}return[new i2(r),a]},XRA=function(g,A,I){return g.s==-1?Math.max(XRA(g.l,A,I+1),XRA(g.r,A,I+1)):A[g.s]=I},xyg=function(g){for(var A=g.length;A&&!g[--A];);for(var I=new Hp(++A),e=0,t=g[0],o=1,B=function(Q){I[e++]=Q},C=1;A>=C;++C)if(g[C]==t&&C!=A)++o;else{if(!t&&o>2){for(;o>138;o-=138)B(32754);o>2&&(B(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(B(t),--o;o>6;o-=6)B(8304);o>2&&(B(o-3<<5|8208),o=0)}for(;o--;)B(t);o=1,t=g[C]}return[I.subarray(0,e),A]},xV=function(g,A){for(var I=0,e=0;A.length>e;++e)I+=g[e]*A[e];return I},$RA=function(g,A,I){var e=I.length,t=Ryg(A+2);g[t]=255&e,g[t+1]=e>>>8,g[t+2]=255^g[t],g[t+3]=255^g[t+1];for(var o=0;e>o;++o)g[t+o+4]=I[o];return 8*(t+4+e)},Fyg=function(g,A,I,e,t,o,B,C,Q,i,E){WF(A,E++,I),++t[256];for(var n=zRA(t,15),s=n[0],r=n[1],a=zRA(o,15),c=a[0],h=a[1],l=xyg(s),D=l[0],d=l[1],y=xyg(c),w=y[0],u=y[1],G=new Hp(19),m=0;D.length>m;++m)G[31&D[m]]++;for(m=0;w.length>m;++m)G[31&w[m]]++;for(var p=zRA(G,7),k=p[0],S=p[1],R=19;R>4&&!k[pyg[R-1]];--R);var x,N,U,K,Y=i+5<<3,b=xV(t,MY)+xV(o,VCA)+B,q=xV(t,s)+xV(o,c)+B+14+3*R+xV(G,k)+(2*G[16]+3*G[17]+7*G[18]);if(b>=Y&&q>=Y)return $RA(A,E,g.subarray(Q,Q+i));if(WF(A,E,1+(b>q)),E+=2,b>q){x=RV(s,r),N=s,U=RV(c,h),K=c;var j=RV(k,S);for(WF(A,E,d-257),WF(A,E+5,u-1),WF(A,E+10,R-4),E+=14,m=0;R>m;++m)WF(A,E+3*m,k[pyg[m]]);E+=3*R;for(var Z=[D,w],O=0;2>O;++O){var AA=Z[O];for(m=0;AA.length>m;++m)WF(A,E,j[tA=31&AA[m]]),E+=k[tA],tA>15&&(WF(A,E,AA[m]>>>5&127),E+=AA[m]>>>12)}}else x=wzI,N=MY,U=uzI,K=VCA;for(m=0;C>m;++m)if(e[m]>255){var tA;NV(A,E,x[257+(tA=e[m]>>>18&31)]),E+=N[tA+257],tA>7&&(WF(A,E,e[m]>>>23&31),E+=WRA[tA]);var eA=31&e[m];NV(A,E,U[eA]),E+=K[eA],eA>3&&(NV(A,E,e[m]>>>5&8191),E+=VRA[eA])}else NV(A,E,x[e[m]]),E+=N[e[m]];return NV(A,E,x[256]),E+N[256]},GzI=new X9([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),mzI=(function(){for(var g=new X9(256),A=0;256>A;++A){for(var I=A,e=9;--e;)I=(1&I&&3988292384)^I>>>1;g[A]=I}return g})(),ANA=function(g,A,I){for(;I;++A)g[A]=I,I>>>=8};function pzI(g,A){A===void 0&&(A={});var I=(function(){var n=4294967295;return{p(s){for(var r=n,a=0;s.length>a;++a)r=mzI[255&r^s[a]]^r>>>8;n=r},d(){return 4294967295^n}}})(),e=g.length;I.p(g);var t,o,B,C,Q,i=(C=10+((t=A).filename&&t.filename.length+1||0),Q=8,(function(n,s,r,a,c,h){var l=n.length,D=new i2(a+l+5*(1+Math.floor(l/7e3))+c),d=D.subarray(a,D.length-c),y=0;if(!s||8>l)for(var w=0;l>=w;w+=65535){var u=w+65535;l>u?y=$RA(d,y,n.subarray(w,u)):(d[w]=h,y=$RA(d,y,n.subarray(w,l)))}else{for(var G=GzI[s-1],m=G>>>13,p=8191&G,k=(1<<r)-1,S=new Hp(32768),R=new Hp(k+1),x=Math.ceil(r/3),N=2*x,U=function(DA){return(n[DA]^n[DA+1]<<x^n[DA+2]<<N)&k},K=new X9(25e3),Y=new Hp(288),b=new Hp(32),q=0,j=0,Z=(w=0,0),O=0,AA=0;l>w;++w){var tA=U(w),eA=32767&w,QA=R[tA];if(S[eA]=QA,R[tA]=eA,w>=O){var sA=l-w;if((q>7e3||Z>24576)&&sA>423){y=Fyg(n,d,0,K,Y,b,j,Z,AA,w-AA,y),Z=q=j=0,AA=w;for(var dA=0;286>dA;++dA)Y[dA]=0;for(dA=0;30>dA;++dA)b[dA]=0}var CA=2,hA=0,nA=p,aA=eA-QA&32767;if(sA>2&&tA==U(w-aA))for(var SA=Math.min(m,sA)-1,xA=Math.min(32767,w),rA=Math.min(258,sA);xA>=aA&&--nA&&eA!=QA;){if(n[w+CA]==n[w+CA-aA]){for(var NA=0;rA>NA&&n[w+NA]==n[w+NA-aA];++NA);if(NA>CA){if(CA=NA,hA=aA,NA>SA)break;var RA=Math.min(aA,NA-2),UA=0;for(dA=0;RA>dA;++dA){var vA=w-aA+dA+32768&32767,KA=vA-S[vA]+32768&32767;KA>UA&&(UA=KA,QA=vA)}}}aA+=(eA=QA)-(QA=S[eA])+32768&32767}if(hA){K[Z++]=268435456|jRA[CA]<<18|Syg[hA];var kA=31&jRA[CA],YA=31&Syg[hA];j+=WRA[kA]+VRA[YA],++Y[257+kA],++b[YA],O=w+CA,++q}else K[Z++]=n[w],++Y[n[w]]}}y=Fyg(n,d,h,K,Y,b,j,Z,AA,w-AA,y)}return Nyg(D,0,a+Ryg(y)+c)})(o=g,(B=A).level==null?6:B.level,B.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(o.length)))):12+B.mem,C,Q,!0)),E=i.length;return(function(n,s){var r=s.filename;if(n[0]=31,n[1]=139,n[2]=8,n[8]=2>s.level?4:s.level==9?2:0,n[9]=3,s.mtime!=0&&ANA(n,4,Math.floor(new Date(s.mtime||Date.now())/1e3)),r){n[3]=8;for(var a=0;r.length>=a;++a)n[a+10]=r.charCodeAt(a)}})(i,A),ANA(i,E-8,I.d()),ANA(i,E-4,e),i}const kzI=!!FfA||!!BV,Uyg=new WeakMap,Jyg="text/plain";let gNA=0,jCA=!1;const Pyg=(g,A)=>{const[I,e]=g.split("#"),[t,o]=I.split("?");if(!o)return g;const B=o.split("&").filter(C=>C.split("=")[0]!==A).join("&");return`${t}${B?`?${B}`:""}${e?`#${e}`:""}`},zCA=(g,A,I=!0)=>{var e;const[t,o]=g.split("?"),B=QI({},A),C=(e=o?.split("&").map(i=>{var E;const[n,s]=i.split("="),r=I&&(E=B[n])!==null&&E!==void 0?E:s;return delete B[n],`${n}=${r}`}))!==null&&e!==void 0?e:[],Q=(function(i,E="&"){let n,s;const r=[];return dn(i,function(a,c){Le(a)||Le(c)||c==="undefined"||(n=encodeURIComponent((h=>h instanceof File)(a)?a.name:a.toString()),s=encodeURIComponent(c),r[r.length]=s+"="+n)}),r.join(E)})(B);return Q&&C.push(Q),C.length>0?`${t}?${C.join("&")}`:t},INA=g=>{if(g.lr)return g.lr;const{data:A,compression:I}=g;if(!A)return;if(I===GM.GZipJS){const t=pzI((function(o){var B=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var C=new i2(o.length+(o.length>>>1)),Q=0,i=function(r){C[Q++]=r},E=0;B>E;++E){if(Q+5>C.length){var n=new i2(Q+8+(B-E<<1));n.set(C),C=n}var s=o.charCodeAt(E);128>s?i(s):2048>s?(i(192|s>>>6),i(128|63&s)):s>55295&&57344>s?(i(240|(s=65536+(1047552&s)|1023&o.charCodeAt(++E))>>>18),i(128|s>>>12&63),i(128|s>>>6&63),i(128|63&s)):(i(224|s>>>12),i(128|s>>>6&63),i(128|63&s))}return Nyg(C,0,Q)})(W9(A)),{mtime:0});return{contentType:Jyg,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(I===GM.Base64){const t=(function(B){return B&&btoa(encodeURIComponent(B).replace(/%([0-9A-F]{2})/g,(C,Q)=>String.fromCharCode(parseInt(Q,16))))})(W9(A)),o=(B=>"data="+encodeURIComponent(typeof B=="string"?B:W9(B)))(t);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}const e=W9(A);return{contentType:"application/json",body:e,estimatedSize:new Blob([e]).size}},Kyg=g=>{const A=()=>g.transport==="sendBeacon"?{url:zCA(g.url,{compression:GM.Base64}),encodedBody:INA(QI(QI({},g),{},{compression:GM.Base64,lr:void 0}))}:{url:Pyg(g.url,"compression"),encodedBody:INA(QI(QI({},g),{},{compression:void 0,lr:void 0}))};let I;try{I=INA(g)}catch(t){if(KDg(g.compression,V9(g.url,"compression")))return Dt.error("Failed to gzip request body, sending uncompressed payload",t),A();throw t}return I&&KDg(g.compression,V9(g.url,"compression"))&&!((e=I.body)instanceof ArrayBuffer?zfA(new Uint8Array(e)):ArrayBuffer.isView(e)&&zfA(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?(jCA=!0,A()):{url:g.url,encodedBody:I};var e},Lyg=g=>{try{return Kyg(g)}catch(I){var A;return Dt.error(I),void((A=g.callback)===null||A===void 0||A.call(g,{statusCode:0,error:I}))}},MzI=(function(){var g=oa(function*(A){const I=yield(function(t){return XfA.apply(this,arguments)})(W9(A.data),bp.DEBUG,{rethrow:!0});if(!I)return A;const e=yield I.arrayBuffer();return QI(QI({},A),{},{lr:{contentType:Jyg,body:e,estimatedSize:e.byteLength}})});return function(A){return g.apply(this,arguments)}})(),SzI=/Failed to fetch|NetworkError|Load failed/i,Yyg=g=>g?.name==="TypeError"&&SzI.test(g?.message||""),_yg=g=>{try{const A=(function(I,e=Date.now()){if(typeof I!="string"||!I)return;const t=I.trim(),o=/^\d+\s*,/.test(t)?t.slice(0,t.indexOf(",")).trim():t;if(/^\d+$/.test(o)){const Q=1e3*Math.min(Number(o),300);return Q>0?Q:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(o))return;const B=/^\w{3} \w{3} /.test(o)?o+" GMT":o,C=Date.parse(B)-e;return Number.isFinite(C)&&C>0?Math.min(C,SCA):void 0})(g());return Le(A)?void 0:Math.min(A,3e4)}catch{return}},byg=g=>{const A=Lyg(g);if(!A)return;const I=new FfA;Uyg.set(I,!0);const{url:e,encodedBody:t}=A;I.open(g.method||"GET",e,!0);const{contentType:o,body:B}=t??{};dn(g.headers,function(C,Q){I.setRequestHeader(Q,C)}),o&&I.setRequestHeader("Content-Type",o),g.timeout&&(I.timeout=g.timeout),I.onreadystatechange=()=>{if(I.readyState===4){var C;const Q={statusCode:I.status,text:I.responseText};if(I.status===200)try{Q.json=JSON.parse(I.responseText)}catch{}(C=g.callback)===null||C===void 0||C.call(g,Q,_yg(()=>I.getResponseHeader("Retry-After")))}},I.send(B)},Hyg=g=>{const A=Lyg(g);if(!A)return;const{url:I,encodedBody:e}=A,{contentType:t,body:o,estimatedSize:B}=e??{},C=new Headers;dn(g.headers,function(a,c){C.append(c,a)}),t&&C.append("Content-Type",t);let Q=null,i=!1;if(xlg){const a=new xlg;Q={signal:a.signal,timeout:setTimeout(()=>{i=!0;try{a.abort(dDg("AbortError","PostHog request timed out"+((c=g.timeout)?` after ${c}ms`:"")))}catch(h){n(h)}var c},g.timeout)}}let E=!1;const n=a=>{var c;E||(E=!0,i&&a?.name==="AbortError"||Yyg(a)?Dt.warn(a):Dt.error(a),(c=g.callback)===null||c===void 0||c.call(g,{statusCode:0,error:a}))};let s=0;const r=()=>{gNA-=s,s=0,Q&&clearTimeout(Q.timeout)};try{const a=QI({method:g?.method||"GET",headers:C,referrerPolicy:"strict-origin",body:o,signal:Q?.signal},g.fetchOptions),c=B??(Le(o)?0:void 0);a.keepalive=a.method==="POST"&&!g.kl&&a.keepalive!==!1&&a.body===o&&!Le(c)&&c>=0&&52428.8>gNA+c,a.keepalive&&(s=c,gNA+=s),BV(I,a).then(h=>h.text().then(l=>{var D;if(E)return;const d={statusCode:h.status,text:l};if(h.status===200)try{d.json=JSON.parse(l)}catch(y){Dt.error(y)}E=!0,r(),(D=g.callback)===null||D===void 0||D.call(g,d,_yg(()=>h.headers.get("Retry-After")))})).catch(h=>{r(),n(h)}).finally(r)}catch(a){r(),n(a)}},eNA=g=>{try{var A;const{url:I,encodedBody:e}=Kyg(g),{contentType:t,body:o,estimatedSize:B}=e??{};if(!o)return;const C=o instanceof Blob?o:new Blob([o],{type:t});if(Rw.sendBeacon(I,C))return;const Q=aB(g.data)?g.data:(A=g.data)===null||A===void 0?void 0:A.batch;if(aB(Q)&&Q.length>1&&(B??0)>16384){const i=Math.ceil(Q.length/2),E=n=>aB(g.data)?n:QI(QI({},g.data),{},{batch:n});return eNA(QI(QI({},g),{},{data:E(Q.slice(0,i))})),void eNA(QI(QI({},g),{},{data:E(Q.slice(i))}))}Dt.warn(`Beacon of ~${B??0} bytes was rejected by the browser, falling back to ${BV?"fetch":"XHR"}`),BV?Hyg(QI(QI({},g),{},{kl:!0})):byg(g)}catch(I){Dt.warn("Beacon send failed",I)}},vyg=(g,A,I,e)=>{const t=e==="query"?A==="POST"?"sent_at":"_":void 0;return zCA(I===GM.GZipJS?Pyg(g,"compression"):g,QI(QI({},t?{[t]:Date.now().toString()}:{}),I===GM.GZipJS?{}:{compression:I}))},fzI=(()=>{const g=[];return BV&&g.push({transport:"fetch",method:Hyg}),FfA&&g.push({transport:"XHR",method:byg}),Rw?.sendBeacon&&g.push({transport:"sendBeacon",method:eNA}),g})();let qyg=!kzI&&Am?.indexOf("MSIE")===-1&&Am?.indexOf("Mozilla")===-1;function Tyg(g,A,I){var e,t,o;I&&(A=QI(QI({},A),{},{callback:B=>I(B)})),g.__loaded?qyg?g.__request_queue.push(A):g.rateLimiter.isServerRateLimited(A.batchKey)?A.fireCallbackOnDrop&&((t=A.callback)===null||t===void 0||t.call(A,{statusCode:429})):(A.transport=A.transport||g.config.api_transport,A.headers=QI(QI({},g.config.request_headers),A.headers),A.compression=A.compression==="best-available"?(e=g.compression)!==null&&e!==void 0?e:A.compressionFallback:A.compression,(Le(g.config.disable_beacon)?g.config.__preview_disable_beacon:g.config.disable_beacon)&&(A.disableTransport=["sendBeacon"]),A.fetchOptions=A.fetchOptions||g.config.fetch_options,((B,C)=>{var Q,i,E;const n=QI(QI({},B),{},{callback:C??(h=>{var l;return(l=B.callback)===null||l===void 0?void 0:l.call(B,h)})});n.timeout=n.timeout||6e4;const s=(Q=n.transport)!==null&&Q!==void 0?Q:"fetch";s==="sendBeacon"&&Le(n.compression)&&n.data&&(n.compression=GM.Base64),n.method==="POST"&&n.data&&(n.timestampMode==="capture-body"?n.data=(h=>{var l,D;const d=(aB(h)?h:[h]).map(w=>QI(QI({},w),w.timestamp instanceof Date&&!isNaN(w.timestamp.getTime())?{timestamp:w.timestamp.toISOString()}:{})),y=d[0];return{api_key:(l=y==null||(D=y.properties)===null||D===void 0?void 0:D.token)!==null&&l!==void 0?l:y?.token,batch:d,sent_at:new Date().toISOString()}})(n.data):n.timestampMode==="body"&&(n.data=((h,l=new Date().toISOString())=>aB(h)?h.map(D=>QI(QI({},D),{},{sent_at:l})):QI(QI({},h),{},{sent_at:l}))(n.data))),n.url=vyg(n.url,n.method,n.compression,n.timestampMode);const r=fzI.filter(h=>!n.disableTransport||!h.transport||!n.disableTransport.includes(h.transport)),a=(i=(E=(function(h,l){for(let D=0;h.length>D;D++)if(l(h[D]))return h[D]})(r,h=>h.transport===s))===null||E===void 0?void 0:E.method)!==null&&i!==void 0?i:r[0].method;if(!a)throw new Error("No available transport method");const c=h=>{try{a(h)}catch(D){var l;Yyg(D)?Dt.warn(D):Dt.error(D),(l=n.callback)===null||l===void 0||l.call(n,{statusCode:0,error:D})}};s!=="sendBeacon"&&!n.preferSyncCompression&&n.data&&n.compression===GM.GZipJS&&bWI&&typeof Promise<"u"&&!jCA?MzI(n).then(h=>{c(h)}).catch(h=>{if(LDg(h))return jCA=!0,void c(QI(QI({},n),{},{compression:void 0,url:vyg(B.url,B.method,void 0,B.timestampMode)}));(l=>{if(!l||typeof l!="object")return!1;const D="name"in l?String(l.name):"";return LDg(l)||D===PDg})(h)&&(jCA=!0),c(n)}):c(n)})(A,(B,C)=>{var Q,i,E;g.rateLimiter.checkForLimiting(B),400>B.statusCode||(Q=(i=g.config).on_request_error)===null||Q===void 0||Q.call(i,B),I?I(B,C):(E=A.callback)===null||E===void 0||E.call(A,B)})):A.fireCallbackOnDrop&&((o=A.callback)===null||o===void 0||o.call(A,{statusCode:0}))}var RzI=class{constructor(A,I){this.Zu=!0,this.Ju=[],this.Ku=FN(I?.flush_interval_ms||3e3,250,5e3,Dt.createLogger("flush interval"),3e3),this.Xu=A}enqueue(A){this.Ju.push(A),this.Yu||this.tc()}unload(){this.ec();const A=this.Ju.length>0?this.nc():{},I=Object.values(A);[...I.filter(e=>e.url.indexOf("/e")===0),...I.filter(e=>e.url.indexOf("/e")!==0)].map(e=>{this.sc(QI(QI({},e),{},{callback:void 0}),"sendBeacon")})}enable(){this.Zu=!1,this.tc()}tc(){this.Zu||(this.Yu=setTimeout(()=>{this.ec(),this.rc()},this.Ku))}rc(){if(this.Ju.length>0){const A=this.nc();for(const I in A)this.sc(A[I])}}sc(A,I){try{this.Xu(A,I)}catch(e){Dt.error(e)}}ec(){clearTimeout(this.Yu),this.Yu=void 0}nc(){const A={},I={};dn(this.Ju,e=>{var t;const o=e,B=((o?o.batchKey:null)||o.url)+(o.batchGroup?`:${o.batchGroup}`:"");Le(A[B])&&(A[B]=QI(QI({},o),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),I[B]=[]),(t=A[B].data)===null||t===void 0||t.push(o.data),o.callback&&I[B].push(o.callback)});for(const e in I){const t=I[e];t.length&&(A[e].callback=o=>{for(const B of t)B(o)})}return this.Ju=[],A}};const NzI=["retriesPerformedSoFar"];var xzI=class{constructor(A){this._instance=A,this.oc=!1,this.ac=3e3,this.Ju=[],this.Ju=[],this.lc=!0,this.resume()}resume(){if(!Le(Me)&&"onLine"in Me.navigator){if(this.lc=Me.navigator.onLine,this.uc)return;this.uc=()=>{this.lc=!0,this.rc()},this.cc=()=>{this.lc=!1},GE(Me,"online",this.uc),GE(Me,"offline",this.cc)}}get length(){return this.Ju.length}retriableRequest(A,I){let{retriesPerformedSoFar:e}=A,t=_Dg(A,NzI);HF(e)&&(t.url=zCA(t.url,{retry_count:e})),Tyg(this._instance,I?QI(QI({},t),{},{transport:I}):t,(o,B)=>{var C;if(o.statusCode!==200&&(400>o.statusCode||o.statusCode>=500)){if((o.statusCode===0?3:10)>(e??0))return void this.Ls(QI({retriesPerformedSoFar:e},t),B);o.statusCode===0&&Dt.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${e??0} retries.`)}(C=t.callback)===null||C===void 0||C.call(t,o)})}Ls(A,I){const e=A.retriesPerformedSoFar||0;A.retriesPerformedSoFar=e+1;const t=Math.max((function(C){const Q=3e3*Math.pow(2,C),i=Q/2,E=Math.min(18e5,Q),n=(Math.random()-.5)*(E-i);return Math.ceil(E+n)})(e),I??0),o=Date.now()+t;this.Ju.push({retryAt:o,requestOptions:A});let B=`Enqueued failed request for retry in ${t}`;navigator.onLine||(B+=" (Browser is offline)"),Dt.warn(B),this.oc||(this.oc=!0,this.hc())}hc(){if(this.dc&&clearTimeout(this.dc),this.Ju.length===0)return this.oc=!1,void(this.dc=void 0);this.dc=setTimeout(()=>{this.lc&&this.Ju.length>0&&this.rc(),this.hc()},this.ac)}rc(){const A=Date.now(),I=[],e=this.Ju.filter(t=>A>t.retryAt||(I.push(t),!1));if(this.Ju=I,e.length>0)for(const{requestOptions:t}of e)this.retriableRequest(t)}unload(){this.dc&&(clearTimeout(this.dc),this.dc=void 0),this.oc=!1,Le(Me)||(this.uc&&(Me.removeEventListener("online",this.uc),this.uc=void 0),this.cc&&(Me.removeEventListener("offline",this.cc),this.cc=void 0));for(const{requestOptions:A}of this.Ju)try{this._instance._send_request(QI(QI({},A),{},{callback:aB(A.data)?void 0:A.callback,transport:"sendBeacon"}))}catch(I){Dt.error(I)}this.Ju=[]}},FzI=class{constructor(A){this._instance=A,this.vc=()=>{var I,e,t,o;this.fc||(this.fc={});const B=this.scrollElement(),C=this.scrollY(),Q=B?Math.max(0,B.scrollHeight-B.clientHeight):0,i=C+(B?.clientHeight||0),E=B?.scrollHeight||0;this.fc.lastScrollY=Math.ceil(C),this.fc.maxScrollY=Math.max(C,(I=this.fc.maxScrollY)!==null&&I!==void 0?I:0),this.fc.maxScrollHeight=Math.max(Q,(e=this.fc.maxScrollHeight)!==null&&e!==void 0?e:0),this.fc.lastContentY=i,this.fc.maxContentY=Math.max(i,(t=this.fc.maxContentY)!==null&&t!==void 0?t:0),this.fc.maxContentHeight=Math.max(E,(o=this.fc.maxContentHeight)!==null&&o!==void 0?o:0)}}get gc(){return this._instance.config.scroll_root_selector}getContext(){return this.fc}resetContext(){const A=this.fc;return this.fc=void 0,setTimeout(this.vc,0),A}startMeasuringScrollPosition(){GE(Me,"scroll",this.vc,{capture:!0}),GE(Me,"scrollend",this.vc,{capture:!0}),GE(Me,"resize",this.vc)}scrollElement(){if(this.gc){const e=aB(this.gc)?this.gc:[this.gc];for(const t of e){var A;const o=Me==null||(A=Me.document)===null||A===void 0?void 0:A.querySelector(t);if(o)return o}return}var I;return Me==null||(I=Me.document)===null||I===void 0?void 0:I.documentElement}mc(A){var I,e;const t=A==="y"?"scrollTop":"scrollLeft";if(this.gc){const o=this.scrollElement();return o&&o[t]||0}return Me?A==="y"?Me.scrollY||Me.pageYOffset||((I=Me.document)===null||I===void 0||(I=I.documentElement)===null||I===void 0?void 0:I.scrollTop)||0:Me.scrollX||Me.pageXOffset||((e=Me.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.scrollLeft)||0:0}scrollY(){return this.mc("y")}scrollX(){return this.mc("x")}};const UzI=g=>lyg(g?.config.mask_personal_data_properties,g?.config.custom_personal_data_properties,g?.config.disable_capture_url_hashes);var Zyg=class{constructor(A,I,e,t){this.qe=o=>{const B=this.yc();if(B&&B.sessionId===o)return;const C={sessionId:o,props:this.bc(this._instance)};this._c.register({[yRA]:C})},this._instance=A,this.wc=I,this._c=e,this.bc=t||UzI,this.wc.onSessionId(this.qe)}yc(){return this._c.props[yRA]}getSetOnceProps(){var A;const I=(A=this.yc())===null||A===void 0?void 0:A.props;return I?"r"in I?Dyg(I,this._instance.config.disable_capture_url_hashes):{$referring_domain:I.referringDomain,$pathname:I.initialPathName,utm_source:I.utm_source,utm_campaign:I.utm_campaign,utm_medium:I.utm_medium,utm_content:I.utm_content,utm_term:I.utm_term}:{}}getSessionProps(){const A={};return dn(kRA(this.getSetOnceProps()),(I,e)=>{e==="$current_url"&&(e="url"),A[`$session_entry_${JfA(e)}`]=I}),A}},XCA=class{on(A,I){return this.bo[A]||(this.bo[A]=[]),this.bo[A].push(I),()=>{this.bo[A]=this.bo[A].filter(e=>e!==I)}}emit(A,I){for(const e of this.bo[A]||[])e(I);for(const e of this.bo["*"]||[])e(A,I)}constructor(){this.bo={}}};const AH=qr("[SessionId]"),Oyg=864e5;var Wyg=class{on(A,I){return this.kc.on(A,I)}constructor(A,I,e){var t;if(this.Sc=null,this.xc=null,this.$c=[],this.Cc=void 0,this.Tc=!1,this.kc=new XCA,this.Ic=(B,C)=>!(!HF(B)||!HF(C))&&Math.abs(B-C)>this.sessionTimeoutMs,!A.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(A.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ar=A.config,this._c=A.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Mc=void 0,this._sessionActivityTimestamp=null,this.Ec=I||Uf,this.Pc=e||Uf;const o=this.Ar.persistence_name||this.Ar.token;if(this._sessionTimeoutMs=1e3*FN(this.Ar.session_idle_timeout_seconds||1800,60,36e3,AH.createLogger("session_idle_timeout_seconds"),1800),A.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Rc(),this.Ac="ph_"+o+"_window_id",this.Fc="ph_"+o+"_primary_window_exists",this.Oc()){const B=Ba.Lt(this.Ac),C=Ba.Lt(this.Fc);B&&!C?this.je=B:Ba.Pt(this.Ac),Ba.At(this.Fc,!0)}!((t=this.Ar.bootstrap)===null||t===void 0)&&t.sessionID&&this.setBootstrapSessionId(this.Ar.bootstrap.sessionID),this.Dc()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(A){return Le(this.$c)&&(this.$c=[]),this.$c.push(A),this.Xt&&A(this.Xt,this.je),()=>{this.$c=this.$c.filter(I=>I!==A)}}Oc(){return this.Ar.persistence!=="memory"&&!this._c.hi&&Ba.$t()}Lc(A){A!==this.je&&(this.je=A,this.Oc()&&Ba.At(this.Ac,A))}Nc(){return this.je?this.je:this.Oc()?Ba.Lt(this.Ac):null}qc(A){const I=this.Sc;return!fc(I)&&!fc(A)&&5e3>Math.abs(A-I)}jc(A,I,e){const t=I!==this._sessionActivityTimestamp,o=!(A!==this.Xt||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=I,this.Xt=A,o&&!t||o&&this.qc(I)||(this.Sc=I,this._c.register({[_9]:[I,A,e]}))}Bc(){var A;const I=(A=this.Ar)===null||A===void 0?void 0:A.persistence_save_debounce_ms;return HF(I)&&I>0}zc(){this.Bc()?this._c.refreshKey(_9):(this._c.flush(),this._c.load())}Hc(){var A;if(fc(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Sc)return;this.zc();const[,I,e]=this.Uc();I===this.Xt&&e===this._sessionStartTimestamp&&(this.Sc=this._sessionActivityTimestamp,this._c.register({[_9]:[this._sessionActivityTimestamp,(A=this.Xt)!==null&&A!==void 0?A:null,this._sessionStartTimestamp]}),this._c.flush())}Wc(){const[A]=this.Uc(),I=HF(A)?A:0,e=HF(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(I,e)}Vc(A){return this.zc(),this.Ic(A,this.Wc())}Uc(){const A=this._c.props[_9];return aB(A)&&A.length===2&&A.push(A[0]),A||[0,null,0]}resetSessionId(){this.Sc=null,this.Mc=void 0,clearTimeout(this.Gc),this.Gc=void 0,this.jc(null,null,null)}setBootstrapSessionId(A,I=!1){const e=((t,o=new Date().getTime())=>{try{const B=(C=>{const Q=C.replace(/-/g,"");if(Q.length!==32)throw new Error("Not a valid UUID");if(Q[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(Q.substring(0,12),16)})(t);return B>o+6e4?void AH.error("Bootstrap sessionID cannot be in the future"):B}catch(B){return void AH.error("Invalid sessionID in bootstrap",B)}})(A);return!Le(e)&&(I?this.Mc={sessionId:A,sessionStartTimestamp:e}:this.jc(A,new Date().getTime(),e),!0)}destroy(){this.Tc=!0,this.Hc(),clearTimeout(this.Gc),this.Gc=void 0,this.Cc&&Me&&(Me.removeEventListener(bCA,this.Cc,{capture:!1}),this.Cc=void 0),this.$c=[]}Dc(){this.Cc=()=>{this.Hc(),this.Oc()&&Ba.Pt(this.Fc)},GE(Me,bCA,this.Cc,{capture:!1})}checkAndGetSessionAndWindowId(A=!1,I=null,e=!1){if(this.Ar.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const t=I||new Date().getTime(),o=this.Xt;if(e)this.xc=t;else if(fc(this.xc)||this.xc>t||t-this.xc>=1e3){var B,C;(B=(C=this._c).syncCookieProperties)===null||B===void 0||B.call(C),this.xc=t}let[,Q,i]=this.Uc();const E=!Le(o)&&Q!==o,n=this.Wc();let s=this.Nc();const r=this.Mc,a=!!r&&(r.sessionStartTimestamp>t+6e4||t-r.sessionStartTimestamp>Oyg),c=r?a:HF(i)&&Math.abs(t-i)>Oyg;let h=!1,l=E,D=!Q||!!r;const d=Q;let y=!D&&!A&&this.Ic(t,n);if(y&&(y=this.Vc(t),y||AH.info("cross-tab refresh kept the session alive",{sessionId:Q}),[,Q,i]=this.Uc(),y||(D=!Q||!!r)),D||y||c){l=!1;const m=r&&!a;Q=m?r.sessionId:this.Ec(),s=this.Pc(),AH.info("new session ID assigned",{sessionId:Q,windowId:s,bootstrapped:!!m,changeReason:{noSessionId:D,activityTimeout:y,sessionPastMaximumLength:c}}),i=m?r.sessionStartTimestamp:t,this.Mc=void 0,h=!0}else s||(s=this.Pc(),h=!0),l=l||Q!==d,l&&(AH.info("adopted cross-tab session id",{sessionId:Q,windowId:s}),h=!0);const w=HF(n)&&A&&!c?n:t,u=HF(i)?i:new Date().getTime();this.Lc(s),this.jc(Q,w,u),A||this.Rc();const G={noSessionId:D,activityTimeout:y,sessionPastMaximumLength:c,crossTabAdoption:l};return h&&this.$c.forEach(m=>m(Q,s,G)),{sessionId:Q,windowId:s,sessionStartTimestamp:u,changeReason:h?G:void 0,lastActivityTimestamp:n}}Rc(){this.Tc||(clearTimeout(this.Gc),this.Gc=setTimeout(()=>{if(!this.Tc)if(this.Vc(new Date().getTime())){const A=this.Xt;this.resetSessionId(),this.kc.emit("forcedIdleReset",{idleSessionId:A})}else this.Rc()},1.1*this.sessionTimeoutMs))}};const Vyg=function(g,A){if(!g)return!1;const I=g.userAgent;if(I&&Llg(I,A))return!0;try{const e=g?.userAgentData;if(e?.brands&&e.brands.some(t=>Llg(t?.brand,A)))return!0}catch{}return!!g.webdriver};function jyg(){return(jyg=oa(function*(){const g=Rw?.userAgentData;if(g?.getHighEntropyValues)try{const A=yield g.getHighEntropyValues(["model"]),I=A?.model;return UC(I)&&I.length>0?I:void 0}catch(A){return void Dt.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",A)}})).apply(this,arguments)}function JzI(g,A){let I=`$survey_${A}/${g.id}`;return g.current_iteration&&g.current_iteration>0&&(I=`$survey_${A}/${g.id}/${g.current_iteration}`),I}function zyg(g){var A;return!!(!((A=g.conditions)===null||A===void 0||(A=A.events)===null||A===void 0||(A=A.values)===null||A===void 0)&&A.length)}const $CA=(g,A)=>{if(!(I=>{try{new RegExp(I)}catch{return!1}return!0})(A))return!1;try{return new RegExp(A).test(g)}catch{return!1}},AQA=g=>g.toLowerCase(),Xyg={exact:(g,A)=>A.some(I=>g.some(e=>I===e)),is_not:(g,A)=>A.every(I=>g.every(e=>I!==e)),regex:(g,A)=>A.some(I=>g.some(e=>$CA(I,e))),not_regex:(g,A)=>A.every(I=>g.every(e=>!$CA(I,e))),icontains:(g,A)=>A.map(AQA).some(I=>g.map(AQA).some(e=>I.includes(e))),not_icontains:(g,A)=>A.map(AQA).every(I=>g.map(AQA).every(e=>!I.includes(e))),gt:(g,A)=>A.some(I=>{const e=parseFloat(I);return!isNaN(e)&&g.some(t=>e>parseFloat(t))}),lt:(g,A)=>A.some(I=>{const e=parseFloat(I);return!isNaN(e)&&g.some(t=>e<parseFloat(t))})};function $yg(g,A){return!g||Object.entries(g).every(([I,e])=>{const t=A?.[I];if(t==null)return!1;const o=Xyg[e.operator];return!!o&&o(e.values.map(String),[String(t)])})}function tNA(g,A,I){return W9({distinct_id:g,userPropertiesToSet:A,userPropertiesToSetOnce:I})}const oNA="custom",Awg="i.posthog.com",PzI=/^\/static\//,KzI=["/s/","/e/","/i/"];var LzI=class{constructor(A){this.Qc={},this.instance=A}get apiHost(){const A=this.instance.config.api_host.trim().replace(/\/$/,"");return A==="https://app.posthog.com"?"https://us.i.posthog.com":A}get flagsApiHost(){const A=this.instance.config.flags_api_host;return A?A.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var A;let I=(A=this.instance.config.ui_host)===null||A===void 0?void 0:A.replace(/\/$/,"");return I||(I=this.apiHost.replace(`.${Awg}`,".posthog.com")),I==="https://app.posthog.com"?"https://us.posthog.com":I}get region(){return this.Qc[this.apiHost]||(this.Qc[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":oNA),this.Qc[this.apiHost]}Zc(A){if(!PzI.test(A))return;const I=this.instance.config.asset_host;return typeof I=="string"&&I.trim().replace(/\/$/,"")||void 0}Jc(A){const I=ZF(A);return I?I.protocol+"//"+I.host+I.pathname:void 0}Kc(A,I,e){if(A==="ui")return e;let t=e;const o=this.instance.config.rewriteRequestPath;if(o){var B;const C=((B=ZF(e))===null||B===void 0?void 0:B.href)||e;t=o(new URL(C)).toString()}if(o&&A==="api"&&KzI.some(C=>I.indexOf(C)===0)){const C=this.Jc(t);if(C){const Q=this.apiHost;let i=this.Xc;i?.apiHost===Q&&i.rewriteRequestPath===o||(i={apiHost:Q,rewriteRequestPath:o,urls:new Set},this.Xc=i),i.urls.add(C)}}return t}isIngestionEndpoint(A){const I=this.Xc,e=this.Jc(A);return I?.apiHost===this.apiHost&&I.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!e&&I.urls.has(e)}endpointFor(A,I=""){if(I&&(I=I[0]==="/"?I:`/${I}`),A==="ui")return this.Kc(A,I,this.uiHost+I);if(A==="flags")return this.Kc(A,I,this.flagsApiHost+I);if(A==="assets"){const t=this.Zc(I);if(t)return this.Kc(A,I,`${t}${I}`)}if(this.region===oNA)return this.Kc(A,I,this.apiHost+I);const e=Awg+I;switch(A){case"assets":return this.Kc(A,I,`https://${this.region}-assets.${e}`);case"api":return this.Kc(A,I,`https://${this.region}.${e}`)}}};const yn=qr("[Surveys]"),gwg=g=>{try{const A=(I=>((e,t)=>`seenSurvey_${(function(o){return o.current_iteration&&o.current_iteration>0?`${o.id}_${o.current_iteration}`:o.id})(t)}`)(0,I))(g);if(localStorage.getItem(A))return;localStorage.setItem(A,"true")}catch(A){yn.error("Failed to persist survey seen state",A)}},YzI=[TRA.Popover,TRA.Widget,TRA.API],_zI={ignoreConditions:!1,ignoreDelay:!1,displayType:ORA.Popover},bzI=qr("[PostHog ExternalIntegrations]"),HzI={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var vzI=class{constructor(A){this._instance=A}Ml(A,I){var e,t;(e=FB.__PosthogExtensions__)===null||e===void 0||(t=e.loadExternalDependency)===null||t===void 0||t.call(e,this._instance,A,o=>{if(o)return bzI.error("failed to load script",o);I()})}startIfEnabledOrStop(){var A;for(const[o,B]of Object.entries((A=this._instance.config.integrations)!==null&&A!==void 0?A:{})){var I,e,t;B&&!(!((I=FB.__PosthogExtensions__)===null||I===void 0||(I=I.integrations)===null||I===void 0)&&I[o])&&this.Ml(HzI[o],()=>{var C;(C=FB.__PosthogExtensions__)===null||C===void 0||(C=C.integrations)===null||C===void 0||(C=C[o])===null||C===void 0||C.start(this._instance)}),!B&&(!((e=FB.__PosthogExtensions__)===null||e===void 0||(e=e.integrations)===null||e===void 0)&&e[o])&&((t=FB.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0||(t=t[o])===null||t===void 0||t.stop())}}},Iwg=class{constructor(A){this.disabled=A===!1;const I=yC(A)?A:{};this.thresholdPx=I.threshold_px||30,this.timeoutMs=I.timeout_ms||1e3,this.clickCount=I.click_count||3,this.clicks=[]}isRageClick(A,I,e){if(this.disabled)return!1;const t=this.clicks[this.clicks.length-1];if(t&&Math.abs(A-t.x)+Math.abs(I-t.y)<this.thresholdPx&&this.timeoutMs>e-t.timestamp){if(this.clicks.push({x:A,y:I,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:A,y:I,timestamp:e}];return!1}};const BNA=()=>typeof window>"u"?void 0:window,FV=()=>typeof document>"u"?void 0:document,CNA="$copy_autocapture",QNA=qr("[AutoCapture]");function iNA(g,A){return A.length>g?A.slice(0,g)+"...":A}function qzI(g){if(g.previousElementSibling)return g.previousElementSibling;let A=g;do A=A.previousSibling;while(A&&!Jf(A));return A}function TzI(g,{e:A,maskAllElementAttributes:I,maskAllText:e,elementAttributeIgnoreList:t,elementsChainAsString:o,disableCaptureUrlHashes:B}){var C,Q;if(!Jf(g))return{props:{}};const i=[g],E=new Set([g]);let n=g;for(;n.parentNode&&!Nw(n,"body")&&1e3>i.length;){if(URA(n.parentNode)){const u=n.parentNode.host;if(E.has(u))break;E.add(u),i.push(u),n=u;continue}if(!Jf(n.parentNode)||E.has(n.parentNode))break;E.add(n.parentNode),i.push(n.parentNode),n=n.parentNode}const s=A.type==="click"&&g.namespaceURI==="http://www.w3.org/2000/svg"?i.findIndex(u=>Nw(u,"button")||Nw(u,"a")):-1;s>0&&(e=e||i.slice(0,s+1).some(u=>!kY(u)||Z9(u)));const r=[],a={};let c,h=!1,l=!1;if(dn(i,u=>{const G=kY(u);if(Nw(u,"a")&&!I&&!t?.includes("href")){const m=u.getAttribute("href");h=!!(G&&m&&O9(m))&&(B?v4(m):m)}yB(T9(u),"ph-no-capture")&&(l=!0),r.push((function(m,p,k,S,R=!1){const x=m.tagName.toLowerCase(),N={tag_name:x};PRA.indexOf(x)>-1&&!k&&(N.$el_text=x.toLowerCase()==="a"||x.toLowerCase()==="button"?iNA(1024,Ayg(m)):iNA(1024,GV(m)));const U=T9(m);p||S?.includes("class")||0>=U.length||(N.classes=U.filter(function(q){return q!==""})),dn(m.attributes,function(q){var j;if((!Z9(m)||["name","id","class","aria-label"].indexOf(q.name)!==-1)&&!S?.includes(q.name)&&!p&&O9(q.value)&&(!UC(j=q.name)||j.substring(0,10)!=="_ngcontent"&&j.substring(0,7)!=="_nghost")){let Z=q.value;q.name==="class"&&(Z=JRA(Z).join(" ")),N["attr__"+q.name]=iNA(1024,q.name==="href"&&R?v4(Z):Z)}});let K=1,Y=1,b=m;for(;b=qzI(b);)K++,b.tagName===m.tagName&&Y++;return N.nth_child=K,N.nth_of_type=Y,N})(u,I,e,t,B)),dn((function(m){if(!kY(m))return{};const p={};return dn(m.attributes,function(k){if(k.name&&k.name.indexOf("data-ph-capture-attribute")===0){const S=k.name.replace("data-ph-capture-attribute-",""),R=k.value;S&&R&&O9(R)&&(p[S]=R)}}),p})(u),(m,p)=>{({}).hasOwnProperty.call(a,p)||(a[p]=m)})}),l)return{props:{},explicitNoCapture:l};if(s>0&&(g=i[s],r.splice(0,s)),e||(r[0].$el_text=Nw(g,"a")||Nw(g,"button")?Ayg(g):GV(g)),h){var D,d;r[0].attr__href=h;const u=(D=ZF(h))===null||D===void 0?void 0:D.host,G=(d=BNA())===null||d===void 0||(d=d.location)===null||d===void 0?void 0:d.host;u&&G&&u!==G&&(c=h)}return{props:Qr((w=A.type,{$event_type:w,$ce_version:1}),o?{}:{$elements:r},{$elements_chain:(y=r,aB(y)?(function(u){return u.map(G=>{var m,p;let k="";if(G.tag_name&&(k+=G.tag_name),G.attr_class){G.attr_class.sort();for(const x of G.attr_class)k+=`.${x.replace(/"/g,"")}`}const S=QI(QI(QI(QI({},G.text?{text:G.text}:{}),{},{"nth-child":(m=G.nth_child)!==null&&m!==void 0?m:0,"nth-of-type":(p=G.nth_of_type)!==null&&p!==void 0?p:0},G.href?{href:G.href}:{}),G.attr_id?{attr_id:G.attr_id}:{}),G.attributes),R={};return HCA(S).sort(([x],[N])=>(function(U,K){return K>U?-1:U>K?1:0})(x,N)).forEach(([x,N])=>R[Iyg(x.toString())]=Iyg(N.toString())),k+=":",k+=HCA(R).map(([x,N])=>`${x}="${N}"`).join(""),k}).join(";")})((function(u){return u.map(G=>{var m,p;const k={text:(m=G.$el_text)===null||m===void 0?void 0:m.slice(0,400),tag_name:G.tag_name,href:(p=G.attr__href)===null||p===void 0?void 0:p.slice(0,2048),attr_class:CzI(G),attr_id:G.attr__id,nth_child:G.nth_child,nth_of_type:G.nth_of_type,attributes:{}};return HCA(G).filter(([S])=>S.indexOf("attr__")===0).forEach(([S,R])=>k.attributes[S]=R),k})})(y)):"")},!((C=r[0])===null||C===void 0)&&C.$el_text?{$el_text:(Q=r[0])===null||Q===void 0?void 0:Q.$el_text}:{},c&&A.type==="click"?{$external_click_url:c}:{},a),target:g};var y,w}const ewg="autocapture";var ZzI=class{el(){this.il=void 0,clearTimeout(this.nl),this.nl=void 0}sl(A){var I;if(!kY(A))return!0;const e=(I=this.rl().css_selector_ignorelist)!==null&&I!==void 0?I:YRA,t=new Set;let o=A;for(;o;){if(t.size>=1e3||t.has(o))return!0;t.add(o);const B=o,C=T9(B);if(yB(C,"ph-no-capture")||yB(C,"ph-sensitive")||Z9(B)||e.some(i=>KRA(B,i)))return!0;const Q=o.parentNode;o=URA(Q)?Q.host:Q&&Jf(Q)?Q:null}return!1}ol(A){if(!this.isEnabled||A.type==="pointercancel")return void this.el();if(A.type==="pointerdown"){var I;this.el();const t=mV(A);return void(A.isPrimary&&A.button===0&&!A.ctrlKey&&t&&Jf(t)&&(this.il={target:t,excluded:this.sl(t),id:A.pointerId,x:A.clientX,y:A.clientY,released:!1,distinctId:(I=this.xa)===null||I===void 0?void 0:I.distinctId}))}const e=this.il;e&&(A.pointerId!==e.id||Math.abs(A.clientX-e.x)>5||Math.abs(A.clientY-e.y)>5?this.el():A.type==="pointerup"&&(e.released=!0,this.nl=setTimeout(()=>this.el(),0)))}al(A){var I;const e=this.il;this.el();const t=mV(A);if(e?.released&&e.target.isConnected&&e.distinctId===((I=this.xa)===null||I===void 0?void 0:I.distinctId)&&A.pointerId===e.id&&(A.detail>0||A.pointerType==="touch"||A.pointerType==="pen")&&A.button===0&&5>=Math.abs(A.clientX-e.x)&&5>=Math.abs(A.clientY-e.y)&&t&&(Nw(t,"html")||Nw(t,"body"))){var o,B,C;if(e.excluded)return null;const Q=(o=this.rl().css_selector_ignorelist)!==null&&o!==void 0?o:YRA;return[t,(B=FV())===null||B===void 0?void 0:B.documentElement,(C=FV())===null||C===void 0?void 0:C.body].some(i=>{if(!i)return!1;const E=T9(i);return yB(E,"ph-no-capture")||yB(E,"ph-sensitive")||!kY(i)||Z9(i)||Q.some(n=>KRA(i,n))})?null:e.target}}constructor(A){this.Ta=A,this.name=ewg,this.ll=!1,this.ul=null,this.cl=!1,this.hl=new Map,this.dl=!1,this.Ar={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Ci=!1,this.Ta.refresh(this.Ar),this.rageclicks=new Iwg(this.Ar.rageclick),this.vl=null}setup(A){this.fl(),this.xa=A;const I=A.onRemoteConfig(this.onRemoteConfig.bind(this));this.Ci?I.dispose():(this.qa=I,this.startIfEnabled())}dispose(){var A;this.Ci||(this.Ci=!0,this.xa=void 0,(A=this.qa)===null||A===void 0||A.dispose(),this.qa=void 0,this.hl.clear(),this.vl=null,this.pl())}rl(){return this.Ta.refresh(this.Ar),this.Ar}fl(){var A,I;return this.rl(),this.Ar.url_allowlist=(A=this.Ar.url_allowlist)===null||A===void 0?void 0:A.map(e=>new RegExp(e)),this.Ar.url_ignorelist=(I=this.Ar.url_ignorelist)===null||I===void 0?void 0:I.map(e=>new RegExp(e)),this.Ar}gl(){const A=BNA(),I=FV();if(!this.isBrowserSupported())return void QNA.info("Disabling Automatic Event Collection because this browser is not supported");if(!A||!I)return;this.ml=A,this.yl=I;const e=this.bl=t=>{t=t||A?.event;try{if(t.type==="blur")return void this.el();if(t.type.indexOf("pointer")===0)return void this.ol(t);const o=t.type==="click"?this.al(t):void 0;if(fc(o))return;this._l(t,"$autocapture",o)}catch(o){QNA.error("Failed to capture event",o)}};if(GE(A,"blur",e),GE(I,"submit",e,{capture:!0}),GE(I,"change",e,{capture:!0}),GE(I,"click",e,{capture:!0}),dn(["pointerdown","pointermove","pointerup","pointercancel"],t=>{GE(I,t,e,{capture:!0})}),this.rl().capture_copied_text){const t=this.wl=o=>{o=o||A?.event;try{this._l(o,CNA)}catch(B){QNA.error("Failed to capture clipboard event",B)}};GE(I,"copy",t,{capture:!0}),GE(I,"cut",t,{capture:!0}),GE(I,"paste",t,{capture:!0})}}pl(){const A=this.ml,I=this.yl;this.el(),this.bl&&(A?.removeEventListener("blur",this.bl),dn(["pointerdown","pointermove","pointerup","pointercancel"],e=>{I?.removeEventListener(e,this.bl,!0)}),I?.removeEventListener("submit",this.bl,!0),I?.removeEventListener("change",this.bl,!0),I?.removeEventListener("click",this.bl,!0),this.bl=void 0),this.wl&&(I?.removeEventListener("copy",this.wl,!0),I?.removeEventListener("cut",this.wl,!0),I?.removeEventListener("paste",this.wl,!0),this.wl=void 0),this.ml=void 0,this.yl=void 0,this.ll=!1}startIfEnabled(){this.isEnabled||this.el(),!this.Ci&&this.xa&&this.isEnabled&&!this.ll&&(this.gl(),this.ll=!0)}onRemoteConfig(A){if(this.Ci)return;if(this.cl=!0,!A.ok)return void this.startIfEnabled();const I=A.config;I.elementsChainAsString&&(this.dl=I.elementsChainAsString);const e=I.autocapture_opt_out;var t;gm(e)&&((t=this.xa)===null||t===void 0||t.kv.set("$autocapture_disabled_server_side",e),this.ul=e),this.startIfEnabled()}setElementSelectors(A,I=this){if(this.Ci)return;A.size?this.hl.set(I,new Set(A)):this.hl.delete(I);const e=new Set;this.hl.forEach(t=>{t.forEach(o=>e.add(o))}),this.vl=e}getElementSelectors(A,I){var e;const t=[];return(e=this.vl)===null||e===void 0||e.forEach(o=>{var B;const C=(B=FV())===null||B===void 0?void 0:B.querySelectorAll(o);C?.forEach(Q=>{A!==Q&&I!==Q||yB(t,o)||t.push(o)})}),t}get isEnabled(){var A,I;if(this.Ci)return!1;const e=(A=this.xa)===null||A===void 0?void 0:A.kv.get(Qdg),t=this.ul,o=this.rl();if(!o.remoteRequestsDisabled&&!this.cl)return!1;const B=o.remoteRequestsDisabled&&!this.cl;if(fc(t)&&!gm(e)&&!B)return!1;const C=(I=this.ul)!==null&&I!==void 0?I:!!e;return!!o.enabled&&!C}_l(A,I="$autocapture",e){if(!this.isEnabled)return void this.el();let t=e||mV(A);_dg(t)&&(t=t.parentNode||null);const o=this.fl();var B;I==="$autocapture"&&A.type==="click"&&A instanceof MouseEvent&&o.rageclick&&(!((B=this.rageclicks)===null||B===void 0)&&B.isRageClick(A.clientX,A.clientY,A.timeStamp||new Date().getTime()))&&Wdg(t,o.rageclick)&&this._l(A,"$rageclick",e);const C=I===CNA,Q=C?QI(QI({},o),{},{dom_event_allowlist:void 0}):o;if(t&&(function(s,r,a,c,h,l){var D;const d=typeof window>"u"?void 0:window;if(!d||HRA(s)||a?.url_allowlist&&!bdg(a.url_allowlist,l)||a?.url_ignorelist&&bdg(a.url_ignorelist,l))return!1;if(a?.dom_event_allowlist){const G=a.dom_event_allowlist;if(G&&!G.some(m=>r.type===m))return!1}const{parentIsUsefulElement:y,targetElementList:w}=Vdg(s,c);if(!(function(G,m){const p=m?.element_allowlist;if(Le(p))return!0;for(const k of G)if(p.some(S=>k.tagName.toLowerCase()===S))return!0;return!1})(w,a)||!LRA(w,a?.css_selector_allowlist)||LRA(w,(D=a?.css_selector_ignorelist)!==null&&D!==void 0?D:YRA))return!1;try{const G=d.getComputedStyle(s);if(G&&G.getPropertyValue("cursor")==="pointer"&&r.type==="click")return!0}catch{}const u=s.tagName.toLowerCase();switch(u){case"html":return!1;case"form":return(h||["submit"]).indexOf(r.type)>=0;case"input":case"select":case"textarea":return(h||["change","click"]).indexOf(r.type)>=0;default:return y?(h||["click"]).indexOf(r.type)>=0:(h||["click"]).indexOf(r.type)>=0&&(PRA.indexOf(u)>-1||s.getAttribute("contenteditable")==="true")}})(t,A,Q,C,C?["copy","cut","paste"]:void 0,{config:{get_current_url:o.getCurrentUrl}})){var i;const{props:s,explicitNoCapture:r,target:a}=TzI(t,{e:A,maskAllElementAttributes:o.maskAllElementAttributes,maskAllText:o.maskAllText,elementAttributeIgnoreList:o.element_attribute_ignorelist,elementsChainAsString:this.dl,disableCaptureUrlHashes:o.disableCaptureUrlHashes});if(r)return!1;const c=this.getElementSelectors(t,a);if(c&&c.length>0&&(s.$element_selectors=c),I===CNA){const h=A.type||"clipboard";if(h!=="paste"){var E,n;const l=(E=BNA())===null||E===void 0||(E=E.getSelection())===null||E===void 0?void 0:E.toString(),D=Hdg(l);if(!D)return!1;s.$selected_content=D,s.$clipboard_text_length=(n=l?.length)!==null&&n!==void 0?n:0}s.$copy_type=h}return(i=this.xa)===null||i===void 0||i.capture(I,s),!0}}isBrowserSupported(){var A;return Xh((A=FV())===null||A===void 0?void 0:A.querySelectorAll)}};const twg="featureFlags",owg="logs";var OzI=class{constructor(A){this._instance=A}initialize(){}get(A){const I=this._instance.persistence;if(typeof A=="string")return I?.get_property(A);const e={};for(const t of A){const o=I?.get_property(t);Le(o)||(e[t]=o)}return e}set(A,I){var e;(e=this._instance.persistence)===null||e===void 0||e.register(typeof A=="string"?{[A]:I}:A)}remove(A){var I;(I=this._instance.persistence)===null||I===void 0||I.unregister(A)}},WzI=class{constructor(A){this.instance=A,this.$=Dt,this.kv=new OzI(A),this.onSession=I=>WCA(this.instance.onSessionId(e=>{try{I(e)}catch(t){this.$.error("Browser extension session listener failed",t)}})),this.onEvent=I=>WCA(this.instance._addCaptureHook((e,t)=>{if(t)try{I({event:e,properties:t.properties})}catch(o){this.$.error("Browser extension event listener failed",o)}})),this.onRemoteConfig=I=>{const e=o=>{try{I(o)}catch(B){this.$.error("Browser extension remote config listener failed",B)}},t=this.instance.ur.on("extensionsRemoteConfig",e);return this.instance.cr&&e(this.instance.cr),WCA(t)}}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var A;return(A=this.instance.get_property("$device_id"))!==null&&A!==void 0?A:this.distinctId}get deviceId(){const A=this.instance.get_property(ERA);return typeof A=="string"?A:void 0}get library(){return{name:bp.LIB_NAME,version:bp.LIB_VERSION}}get initialPersonProperties(){var A,I;return(A=(I=this.instance.persistence)===null||I===void 0?void 0:I.get_initial_props())!==null&&A!==void 0?A:{}}get groups(){return this.instance.getGroups()}get session(){try{var A,I,e,t,o;const B=(A=this.instance.sessionManager)===null||A===void 0?void 0:A.checkAndGetSessionAndWindowId(!0);return{sessionId:(I=B?.sessionId)!==null&&I!==void 0?I:"",windowId:(e=B?.windowId)!==null&&e!==void 0?e:"",sessionStartTimestamp:(t=B?.sessionStartTimestamp)!==null&&t!==void 0?t:0,lastActivityTimestamp:(o=B?.lastActivityTimestamp)!==null&&o!==void 0?o:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return Xh(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get projectToken(){return this.instance.config.token}getExtension(A){let I;switch(A){case twg:case"featureFlagsCommon":I=this.instance.featureFlags;break;case owg:I=this.instance.logs;break;case"surveys":I=this.instance.surveys;break;case ewg:I=this.instance.autocapture}return I}capture(A,I,e){if(!e)return void this.instance.capture(A,I);const t=QI({timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce},e.delivery==="unload"?{transport:"sendBeacon",send_instantly:!0}:{});this.instance.capture(A,I,t)}registerDynamicEventProperties(A){return WCA(this.instance.dr(A))}sendRequest(A){var I=this;return oa(function*(e,t={}){var o;const B=(o=t.target)!==null&&o!==void 0?o:"api",C=t.query?zCA(e,t.query):e,Q=I.instance.requestRouter.endpointFor(B,C),i={method:t.method,url:Q,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,compressionFallback:t.target==="flags"&&t.compression==="best-available"?UfA.Base64:void 0,timestampMode:t.sentAt};return B==="api"&&e==="/i/v1/logs"&&(i.batchKey="logs"),t.transport==="sendBeacon"?(I.instance._send_request(i),{statusCode:202}):new Promise(E=>{i.callback=E,I.instance._send_request(i)})}).apply(this,arguments)}};const UV={};let ENA=0;const JV=()=>{},Bwg='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',gH="Surveys module not available",Cwg="sanitize_properties is deprecated. Use before_send instead",Qwg="Invalid value for property_denylist config: ",VzI=["$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"],jzI=["$feature_flag_called","$$heatmap","$snapshot"],iwg=g=>g.charAt(0)==="$"&&!yB(jzI,g),zzI=/^[A-Za-z0-9_-]{1,400}$/,Ewg=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,nwg=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,XzI=["token","distinct_id",Ddg],PV="posthog",$zI=g=>{const A={};return g&&g!=="unset"&&("2025-11-30">g||(A.strictMinimumDuration=!0),"2026-05-30">g||(A.canvasCapture={resolutionScale:.6}),"2026-06-25">g||(A.streamNetworkBody=!0),"2026-08-30">g||(A.captureJsonLd=!0)),A},nNA=g=>{var A;return QI({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:TjI(ro?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:JV,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:g??"unset",__preview_deferred_init_extensions:!1,__preview_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:ta&&UC(ta?.search)&&ta.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:(Me==null||(A=Me.location)===null||A===void 0?void 0:A.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(I){Dt.error("Bad HTTP status: "+I.statusCode+" "+I.text)},get_device_id:I=>I,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Sdg,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:JV},(I=>({rageclick:I&&I>="2026-05-30"?{content_ignorelist:_RA,ignore_text_selection:!0}:!I||"2025-11-30">I||{content_ignorelist:!0},capture_pageview:!I||"2025-05-24">I||"history_change",session_recording:$zI(I),external_scripts_inject_target:I&&I>="2026-01-30"?"head":"body",internal_or_test_user_hostname:I&&I>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:I&&I>="2026-05-30"?250:0,split_storage:!(!I||"2026-05-30">I),detect_google_search_app:!(!I||"2026-05-30">I),disable_capture_url_hashes:!(!I||"2026-06-25">I),cookieWinsOnConflict:!(!I||I==="unset"||"2026-08-29">I)}))(g))},AXI=[["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"]],swg=g=>{const A={};for(const[t,o]of AXI)Le(g[t])||(A[o]=g[t]);const I=Qr({},A,g),e=g.__preview_external_dependency_versioned_paths;return Le(e)||(Le(g.strict_script_versioning)&&(I.strict_script_versioning=!!e),UC(e)&&Le(g.asset_host)&&(I.asset_host=e)),aB(g.property_blacklist)&&(Le(g.property_denylist)?I.property_denylist=g.property_blacklist:aB(g.property_denylist)?I.property_denylist=[...g.property_blacklist,...g.property_denylist]:Dt.error(Qwg+g.property_denylist)),I};var gXI=class{constructor(){this.__forceAllowLocalhost=!1}get Yc(){return this.__forceAllowLocalhost}set Yc(A){Dt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=A}},KV=class aY{th(A){if(!A)return;const I=this.eh.indexOf(A);I!==-1&&this.eh.splice(I,1)}ih(A,I){var e;return this.th(A),this.eh.push(I),(e=I.initialize)===null||e===void 0||e.call(I),I}nh(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}sh(){if(this.rh||this.config.reuseAnonymousId||this.config.segment||this.nh())return;const A=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!A&&!this.config.disable_persistence||this.oh)return;let I,e,t;A?(I=`persistence is set to '${this.config.persistence}'`,e=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",t="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(I="persistence is disabled (disable_persistence is true)",e="on every page load",t="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.rh=!0,console.warn("[PostHog.js]",`${I} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${e}, 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. ${t}`)}ah(){const A=this.persistence;if(!A||this.uh)return;if(this.nh())return void(this.config.cookieless_mode==="on_reject"&&this.get_distinct_id()!=="$posthog_cookieless"&&(this.hh(),this.dh()));if(this.get_distinct_id()!=="$posthog_cookieless")return;this.fh()||A.load(!0);const I=this.get_distinct_id();if(!I||I==="$posthog_cookieless"){const e=this.config.get_device_id(Uf());this.register({distinct_id:e,$device_id:e}),A.set_property(Im,TF)}this.hh()}get decideEndpointWasHit(){var A,I;return(A=(I=this.featureFlags)===null||I===void 0?void 0:I.hasLoadedFlags)!==null&&A!==void 0&&A}get flagsEndpointWasHit(){var A,I;return(A=(I=this.featureFlags)===null||I===void 0?void 0:I.hasLoadedFlags)!==null&&A!==void 0&&A}constructor(){var A;this.ph=!1,this.gh=!1,this.webPerformance=new gXI,this.mh=!1,this.version=bp.LIB_VERSION,this.yh=new Set,this.bh="",this.ur=new XCA,this.eh=[],this._h=[],this.wh=!1,this.oh=!1,this.rh=!1,this.uh=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=nNA(),this.SentryIntegration=EzI,this.sentryIntegration=e=>(function(t,o){const B=Byg(t,o);return{name:oyg,processEvent:C=>B(C)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.kh=!1,this.Sh=null,this.xh=null,this.$h=null,this.scrollManager=new FzI(this),this.pageViewManager=new Cyg(this),this.rateLimiter=new yzI(this),this.requestRouter=new LzI(this),this.consent=new $jI(this),this.externalIntegrations=new vzI(this);const I=(A=aY.__defaultExtensionClasses)!==null&&A!==void 0?A:{};this.featureFlags=I.featureFlags&&new I.featureFlags(this),this.toolbar=I.toolbar&&new I.toolbar(this),this.surveys=I.surveys&&new I.surveys(this),this.conversations=I.conversations&&new I.conversations(this),this.logs=I.logs&&new I.logs(this),this.metrics=I.metrics&&new I.metrics(this),this.experiments=I.experiments&&new I.experiments(this),this.exceptions=I.exceptions&&new I.exceptions(this),this.people={set:(e,t,o)=>{const B=UC(e)?{[e]:t}:e;this.setPersonProperties(B),o?.({})},set_once:(e,t,o)=>{const B=UC(e)?{[e]:t}:e;this.setPersonProperties(void 0,B),o?.({})}},this.on("eventCaptured",e=>Dt.info(`send "${e?.event}"`,e))}init(A,I,e){if(e&&e!==PV){var t;const o=(t=UV[e])!==null&&t!==void 0?t:new aY;return o._init(A,I,e),UV[e]=o,UV[PV][e]=o,o}return this._init(A,I,e)}_init(A,I={},e){var t,o,B;const C=UC(A)?A.trim():"";if(!C)return Dt.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var Q;if(this.__loaded)return C!==((Q=this.config)===null||Q===void 0?void 0:Q.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('${C}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=nNA(I.defaults),I.debug=this.Ch(I.debug),this.Th=I,this.Ih=[],I.person_profiles?this.xh=I.person_profiles:I.process_person&&(this.xh=I.process_person);const i=nNA(I.defaults),E=swg(I),n=Qr({},i,E,{name:e,token:C});yC(i.rageclick)&&yC(E.rageclick)&&(n.rageclick=Qr({},i.rageclick,E.rageclick)),yC(i.session_recording)&&yC(E.session_recording)&&(n.session_recording=Qr({},i.session_recording,E.session_recording)),this.set_config(n),this.config.on_xhr_error&&Dt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=I.disable_compression?void 0:GM.GZipJS;const s=this.fh(),r=!this.nh();if(this.persistence=new qRA(this.config,s,!0,r),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new qRA(QI(QI({},this.config),{},{persistence:"sessionStorage"}),s,!1,r),this.bh="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!s&&Ba.$t()){const D=Ba.Lt(this.bh);aB(D)&&D.forEach(d=>{UC(d)&&this.yh.add(d)})}else Ba.Pt(this.bh);const a=QI({},this.persistence.props),c=QI({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Mh=new RzI((D,d)=>this.Eh(D,d),this.config.request_queue_config),this.Ph=new xzI(this),this.__request_queue=[];const h=this.nh();h||(this.sessionManager=new Wyg(this),this.sessionPropsManager=new Zyg(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((D,d,y)=>{(y?.activityTimeout||y?.sessionPastMaximumLength||y?.crossTabAdoption)&&this.Rh()})),this.Ah(),this.config.__preview_deferred_init_extensions?(Dt.info("Deferring extension initialization to improve startup performance"),this.Fh=setTimeout(()=>{this.Fh=void 0,this.Oh(h)},0)):(Dt.info("Initializing extensions synchronously"),this.Oh(h)),bp.DEBUG=bp.DEBUG||this.config.debug,bp.DEBUG&&Dt.info("Starting in debug mode",{this:this,config:I,thisC:QI({},this.config),p:a,s:c}),this.config.identity_distinct_id&&!(!((t=I.bootstrap)===null||t===void 0)&&t.distinctID)&&(I.bootstrap=QI(QI({},I.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const l=(o=I.bootstrap)===null||o===void 0?void 0:o.distinctID;if(this.oh=!!l&&!QV(l),(B=I.bootstrap)===null||B===void 0?void 0:B.distinctID){const D=I.bootstrap.distinctID,d=this.get_distinct_id(),y=this.persistence.get_property(Im);if(I.bootstrap.isIdentifiedID&&d!=null&&d!==D&&y==="anonymous")this.identify(D);else if(I.bootstrap.isIdentifiedID&&d!=null&&d!==D&&y==="identified")Dt.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 w=this.config.get_device_id(Uf()),u=I.bootstrap.isIdentifiedID?w:D;this.persistence.set_property(Im,I.bootstrap.isIdentifiedID?_CA:TF),this.register({distinct_id:D,$device_id:u})}}if(h)this.register_once({distinct_id:uRA,$device_id:null},"");else if(!this.get_distinct_id()){const D=this.config.get_device_id(Uf());this.register_once({distinct_id:D,$device_id:D},""),this.persistence.set_property(Im,TF)}return GE(Me,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),GE(Me,"pageshow",()=>{var D;this.ph=!1,this.gh||(D=this.Ph)===null||D===void 0||D.resume()}),I.segment?tyg(this,()=>this.Dh()):this.Dh(),Xh(this.config._onCapture)&&this.config._onCapture!==JV&&(Dt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",D=>this.config._onCapture(D.event,D))),this.config.ip&&Dt.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 jyg.apply(this,arguments)})().then(D=>{D&&this.register({[nRA]:D})}).catch(JV),this}Lh(A){const I=A;return UC(I.name)&&Xh(I.setup)}Nh(A,I){var e=this;this.Lh(A)?I.push(oa(function*(){try{yield A.setup(e.qh())}catch(o){Dt.error(`Failed to set up extension "${A.name}"`,o);try{var t;yield(t=A.dispose)===null||t===void 0?void 0:t.call(A)}catch(B){Dt.error(`Failed to dispose extension "${A.name}"`,B)}}})):this.eh.push(A)}Ah(){var A,I,e,t=this;const o=(A=(I=this.config.__extensionClasses)===null||I===void 0?void 0:I.featureFlags)!==null&&A!==void 0?A:(e=aY.__defaultExtensionClasses)===null||e===void 0?void 0:e.featureFlags;var B,C,Q;if(o)if(this.featureFlags&&this.featureFlags instanceof o||((B=this.jh)===null||B===void 0||B.call(this),this.jh=void 0,this.featureFlags=new o(this)),Xh(this.featureFlags.onReloading)&&Xh(this.featureFlags.setup)){if(!this.jh){this.jh=this.featureFlags.onReloading(()=>{this.ur.emit("featureFlagsReloading",!0)});const i=this.featureFlags;oa(function*(){try{yield i.setup(t.qh())}catch(E){Dt.error("Failed to set up feature flags",E);const n=t.jh;t.jh=void 0;try{n?.()}catch(s){Dt.error("Failed to unsubscribe feature flag reloading",s)}try{yield i.dispose()}catch(s){Dt.error("Failed to dispose feature flags",s)}}})()}}else(C=(Q=this.featureFlags).initialize)===null||C===void 0||C.call(Q)}Oh(A){const I=performance.now(),e=QI(QI({},aY.__defaultExtensionClasses),this.config.__extensionClasses),t=[];var o,B,C,Q,i,E,n,s;e.exceptions&&this.eh.push(this.exceptions=(o=this.exceptions)!==null&&o!==void 0?o:new e.exceptions(this)),e.historyAutocapture&&this.eh.push(this.historyAutocapture=new e.historyAutocapture(this)),e.tracingHeaders&&this.eh.push(this.tracingHeaders=new e.tracingHeaders(this)),e.siteApps&&this.eh.push(this.siteApps=new e.siteApps(this)),e.sessionRecording&&!A&&this.eh.push(this.sessionRecording=new e.sessionRecording(this)),this.config.disable_scroll_properties||t.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),e.autocapture&&this.Nh(this.autocapture=new e.autocapture(this),t),e.surveys&&this.Nh(this.surveys=(B=this.surveys)!==null&&B!==void 0?B:new e.surveys(this),t),e.logs&&this.Nh(this.logs=(C=this.logs)!==null&&C!==void 0?C:new e.logs(this),t),e.metrics&&this.eh.push(this.metrics=(Q=this.metrics)!==null&&Q!==void 0?Q:new e.metrics(this)),e.conversations&&this.eh.push(this.conversations=(i=this.conversations)!==null&&i!==void 0?i:new e.conversations(this)),e.productTours&&this.eh.push(this.productTours=new e.productTours(this)),e.heatmaps&&this.eh.push(this.heatmaps=new e.heatmaps(this)),e.webVitalsAutocapture&&this.eh.push(this.webVitalsAutocapture=new e.webVitalsAutocapture(this)),e.exceptionObserver&&this.eh.push(this.exceptionObserver=new e.exceptionObserver(this)),e.deadClicksAutocapture&&this.eh.push(this.deadClicksAutocapture=new e.deadClicksAutocapture(this,izI)),e.toolbar&&this.eh.push(this.toolbar=(E=this.toolbar)!==null&&E!==void 0?E:new e.toolbar(this)),e.experiments&&this.eh.push(this.experiments=(n=this.experiments)!==null&&n!==void 0?n:new e.experiments(this)),e.webMCP&&this.eh.push(this.webMCP=(s=this.webMCP)!==null&&s!==void 0?s:new e.webMCP(this)),this.eh.forEach(r=>{r.initialize&&t.push(()=>{var a;(a=r.initialize)===null||a===void 0||a.call(r)})}),t.push(()=>{if(this.Bh){const r=this.Bh;this.Bh=void 0,this.eh.forEach(a=>{var c;return(c=a.onRemoteConfig)===null||c===void 0?void 0:c.call(a,r)})}}),this.zh(t,I)}zh(A,I){for(;A.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-I>=30&&A.length>0)return void(this.Fh=setTimeout(()=>{this.Fh=void 0,this.zh(A,I)},0));const t=A.shift();if(t)try{t()}catch(o){Dt.error("Error initializing extension:",o)}}const e=Math.round(performance.now()-I);this.register_for_session({[ddg]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ydg]:e}),this.config.__preview_deferred_init_extensions&&Dt.info(`PostHog extensions initialized (${e}ms)`)}Gu(A){if(!ro||!ro.body)return Dt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Gu(A)},500);if(this.config.__preview_deferred_init_extensions&&(this.Bh=A),this.cr=A,this.compression=void 0,A.ok){var I;const e=A.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=yB(e.supportedCompression,GM.GZipJS)?GM.GZipJS:yB(e.supportedCompression,GM.Base64)?GM.Base64:void 0),!((I=e.analytics)===null||I===void 0)&&I.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.xh?this.xh:Sdg}),this.ur.emit("extensionsRemoteConfig",A),this.eh.forEach(e=>{var t;return(t=e.onRemoteConfig)===null||t===void 0?void 0:t.call(e,A)})}Dh(){try{this.config.loaded(this)}catch(A){Dt.critical("`loaded` function failed",A)}if(this.Hh(),this.config.internal_or_test_user_hostname&&ta?.hostname){const A=ta.hostname,I=this.config.internal_or_test_user_hostname;(typeof I=="string"?A===I:I.test(A))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.nh())&&this.Uh()},1),this.Wh=new myg(this),this.Wh.load()}Hh(){var A;this.is_capturing()&&this.config.request_batching&&((A=this.Mh)===null||A===void 0||A.enable())}_dom_loaded(){this.is_capturing()&&H9(this.__request_queue,A=>this.Eh(A)),this.__request_queue=[],this.Hh()}_handle_unload(){var A,I,e,t,o,B;this.ph=!0,(A=this.surveys)===null||A===void 0||(I=A.handlePageUnload)===null||I===void 0||I.call(A),(e=this.metrics)===null||e===void 0||e.flush("sendBeacon"),this.config.request_batching?(this.Vh()&&this.capture(fdg),(t=this.logs)===null||t===void 0||t.flushLogs("sendBeacon"),(o=this.Mh)===null||o===void 0||o.unload(),(B=this.Ph)===null||B===void 0||B.unload()):this.Vh()&&this.capture(fdg,null,{transport:"sendBeacon"})}_send_request(A){Tyg(this,A)}Eh(A,I){this.Ph?this.Ph.retriableRequest(A,I):this._send_request(I?QI(QI({},A),{},{transport:I}):A)}_execute_array(A){ENA++;try{let I;const e=[],t=[],o=[];H9(A,C=>{if(C)if(I=C[0],aB(I))o.push(C);else if(Xh(C))try{C.call(this)}catch(Q){Dt.error("Error executing queued PostHog call",C,Q)}else aB(C)&&I==="alias"?e.push(C):aB(C)&&I.indexOf("capture")!==-1&&Xh(this[I])?o.push(C):t.push(C)});const B=function(C,Q){H9(C,function(i){try{if(aB(i[0])){let E=Q;dn(i,function(n){E=E[n[0]].apply(E,n.slice(1))})}else Q[i[0]].apply(Q,i.slice(1))}catch(E){Dt.error("Error executing queued PostHog call",i,E)}})};B(e,this),B(t,this),B(o,this)}finally{ENA--}}push(A){if(ENA>0&&aB(A)&&UC(A[0])){const I=aY.prototype[A[0]];return void(Xh(I)&&I.apply(this,A.slice(1)))}this._execute_array([A])}get Gh(){return{property:idg,persistenceKey:Y9,cookieName:"_fbc",pattern:Ewg,register:(A,I)=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.register({[Y9]:{value:A,delivered:I}})},unregister:()=>{var A;return(A=this.persistence)===null||A===void 0?void 0:A.unregister(Y9)}}}get Qh(){return{property:Edg,persistenceKey:DV,cookieName:"_fbp",pattern:nwg,register:(A,I)=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.register({[DV]:{value:A,delivered:I}})},unregister:()=>{var A;return(A=this.persistence)===null||A===void 0?void 0:A.unregister(DV)}}}Zh(A){var I;const e=(I=this.persistence)===null||I===void 0?void 0:I.get_property(A.persistenceKey);return UC(e)&&A.pattern.test(e)?{value:e,delivered:!1}:yC(e)&&UC(e.value)&&A.pattern.test(e.value)?{value:e.value,delivered:e.delivered===!0}:void 0}Jh(A,I,e){return I===e?.value?{value:I,pending:!e.delivered}:(A.register(I,!1),{value:I,pending:!0})}Kh(A){if(!this.config.save_campaign_params||this.nh())return;const I=yV(A.cookieName);return UC(I)&&A.pattern.test(I)?I:void 0}Xh(A,I,e,t){if(!this.persistence)return;const o=this.Gh;this.persistence.refreshMetaIdentifiers();const B=this.Zh(o);if(t)return void o.unregister();if(e)return UC(I)&&Ewg.test(I)?this.Jh(o,I,B):void o.unregister();const C=UC(A)&&zzI.test(A)?A:void 0,Q=this.Kh(o);return Q&&((i,E,n)=>{const s=i.split(".");if(E)return s[3]===E;if(!n)return!0;const r=n.value.split(".");return s[3]===r[3]||Number(s[2])>Number(r[2])})(Q,C,B)?this.Jh(o,Q,B):C?B?.value.split(".")[3]===C?{value:B.value,pending:!B.delivered}:this.Jh(o,`fb.1.${Date.now()}.${C}`,B):B?{value:B.value,pending:!B.delivered}:void 0}Yh(A,I,e){if(!this.persistence)return;const t=this.Qh;this.persistence.refreshMetaIdentifiers();const o=this.Zh(t);if(e)return void t.unregister();if(I)return UC(A)&&nwg.test(A)?this.Jh(t,A,o):void t.unregister();const B=this.Kh(t);return B?this.Jh(t,B,o):o?{value:o.value,pending:!o.delivered}:void 0}td(A,I){if(!this.persistence)return;this.persistence.refreshMetaIdentifiers();const e=this.Zh(A);e?.value!==I||e.delivered||A.register(I,!0)}capture(A,I,e){var t,o;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Mh))return void Dt.uninitializedWarning("posthog.capture");if(!this.is_capturing())return void Dt.info(`Event "${A}" was not captured because capturing is disabled (opted out or consent pending).`);if(Le(A)||!UC(A))return void Dt.error("No event name provided to posthog.capture");if(this.ah(),A==="$snapshot"&&this.nh())return;const B=!this.config.opt_out_useragent_filter&&this._is_bot();if(B&&!this.config.__preview_capture_bot_pageviews)return void Dt.info(`Event "${A}" was not captured because the user agent looks like a bot. Set \`opt_out_useragent_filter: true\` to capture it.`);const C=e?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(C?.isRateLimited)return void Dt.critical("This capture call is ignored due to client rate limiting.");let Q;I?.$current_url&&!UC(I?.$current_url)&&(Dt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),I==null||delete I.$current_url),A!=="$exception"||e?.ed||Dt.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&&(Q=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 i=new Date,E=e?.timestamp||i,n=DDg(e?.uuid,Uf);let s={uuid:n,event:A,properties:this.calculateEventProperties(A,I||{},E,n)};A==="$pageview"&&this.config.__preview_capture_bot_pageviews&&B&&(s.event="$bot_pageview",s.properties.$browser_type="bot"),C&&(s.properties.$lib_rate_limit_remaining_tokens=C.remainingTokens);const r=A==="$feature_flag_called"&&s.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;e?.$set&&!r&&(s.$set=e?.$set);const a=yC(I?.$set)?I.$set:void 0,c=aB(I?.$unset)?I.$unset:[],h=e?.$unset||[],l=N=>{var U;const K=!!e?.$set&&N in e.$set;return{hasProvided:K||!!a&&N in a,provided:K?e==null||(U=e.$set)===null||U===void 0?void 0:U[N]:a?.[N],unset:c.indexOf(N)!==-1||h.indexOf(N)!==-1}},D=l(idg),d=l(Edg),y=[{channel:this.Gh,hasProvided:D.hasProvided,update:this.Xh(Q?.fbclid,D.provided,D.hasProvided,D.unset)},{channel:this.Qh,hasProvided:d.hasProvided,update:this.Yh(d.provided,d.hasProvided,d.unset)}];for(const{channel:N,hasProvided:U,update:K}of y)K&&s.properties.$process_person_profile===!0&&K.pending&&!U&&!r&&(s.$set=QI({[N.property]:K.value},s.$set));const w=e?.$unset;w&&(s.$unset=w);const u=r?void 0:this.nd(e?.$set_once,A!==Ndg,A===Rdg);if(u&&(s.$set_once=u),e?._noTruncate||(G=this.config.properties_string_max_length,s=(function(N,U){const K=new Set;return(function Y(b,q){if(b!==Object(b))return U?U(b):b;if(K.has(b))return;let j;if(K.add(b),aB(b))j=[],H9(b,Z=>{j.push(Y(Z))});else{const Z={};dn(U9(b)?xdg(b):b,(O,AA)=>{K.has(O)||(Z[AA]=Y(O))}),j=Z}return j})(N)})(s,N=>UC(N)?N.slice(0,G):N)),s.timestamp=E,Le(e?.timestamp)||(s.properties.$event_time_override_provided=!0,s.properties.$event_time_override_system_time=i),r&&(s.properties=((N,U=[])=>{const K={},Y=b=>{N[b]!==void 0&&(K[b]=N[b])};return PVI.forEach(Y),U.forEach(Y),K})(s.properties,XzI)),A===mM.DISMISSED||A===mM.SENT){const N=I?.[ZRA.SURVEY_ID],U=I?.[ZRA.SURVEY_ITERATION];gwg({id:N,current_iteration:U}),s.$set=QI(QI({},s.$set),{},{[JzI({id:N,current_iteration:U},A===mM.SENT?"responded":"dismissed")]:!0})}else A===mM.SHOWN&&(s.$set=QI(QI({},s.$set),{},{[ZRA.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var G;if(A===dzI.SHOWN){const N=I?.[uyg.TOUR_TYPE];N&&(s.$set=QI(QI({},s.$set),{},{[`${uyg.TOUR_LAST_SEEN_DATE}/${N}`]:new Date().toISOString()}))}const m=QI(QI({},s.properties.$set),s.$set);if(_p(m)||this.setPersonPropertiesForFlags(m),!rC(this.config.before_send)){const N=this.Os(s);if(!N)return;s=N,s.uuid=DDg(s.uuid,Uf)}this.sessionRecording&&!this.wh&&iwg(A)&&(this.wh=!0,setTimeout(()=>this.wh=!1,3e4));const p=y.filter(({channel:N,update:U})=>{var K,Y,b;const q=(K=(Y=s.$set)===null||Y===void 0?void 0:Y[N.property])!==null&&K!==void 0?K:yC((b=s.properties)===null||b===void 0?void 0:b.$set)?s.properties.$set[N.property]:void 0;return U?.pending&&q===U.value});this.ur.emit("eventCaptured",s);const k=(t=e?._url)!==null&&t!==void 0?t:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),S=e?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(k),R=QI(QI(QI({method:"POST",url:k,data:s,compression:"best-available",preferSyncCompression:e?.send_instantly,timestampMode:S?"body":"capture-body",batchKey:e?._batchKey},S&&(!((o=s.properties)===null||o===void 0)&&o.$session_id)?{batchGroup:s.properties.$session_id+(s.properties.$window_id?`-${s.properties.$window_id}`:"")}:{}),e?.transport?{transport:e.transport}:{}),p.length?{fireCallbackOnDrop:!0,callback:N=>{if(N.statusCode>=200&&300>N.statusCode)for(const{channel:U,update:K}of p)this.td(U,K.value)}}:{});if(!this.config.request_batching||e&&!e?._batchKey||e?.send_instantly){var x;let N;!R.transport&&!R.callback&&_p((x=this.config.request_headers)!==null&&x!==void 0?x:{})&&this.ph&&(N="sendBeacon"),this.Eh(R,N)}else this.Mh.enqueue(R);return s}_addCaptureHook(A){return this.on("eventCaptured",I=>A(I.event,I))}getExtension(A){var I;return(I=this.sd)===null||I===void 0?void 0:I.getExtension(A)}qh(){var A;return(A=this.sd)!==null&&A!==void 0?A:this.sd=new WzI(this)}dr(A){this._h.push(A);let I=!0;return()=>{if(!I)return;I=!1;const e=this._h.indexOf(A);e!==-1&&this._h.splice(e,1)}}rd(A=!0){var I,e,t;return!!(!((I=this.persistence)===null||I===void 0)&&I.consumeCookieIdentityChange())&&(this.$h=null,this.persistence.get_property("$user_state")==="anonymous"&&((t=this.sessionPersistence)===null||t===void 0||t.clear(),this.yh.clear(),this.od()),(e=this.featureFlags)===null||e===void 0||e.reset(),A&&this.reloadFeatureFlags(),!0)}calculateEventProperties(A,I,e,t,o){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return I;this.ah(),this.persistence.syncCookieProperties(),this.rd();const B=o?void 0:this.persistence.remove_event_timer(A);let C=QI({},I);if(C.token=this.config.token,C.$config_defaults=this.config.defaults,this.nh()&&(C[Ddg]=!0),A==="$snapshot"){const D=QI(QI({},this.persistence.properties()),this.sessionPersistence.properties());return C.distinct_id=D.distinct_id,(!UC(C.distinct_id)&&!$h(C.distinct_id)||QV(C.distinct_id))&&Dt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),C}const Q=(function(D,d,y,w=!1){var u,G,m,p;if(!Am)return{};const k=D?[...j9,...d||[]]:[],[S,R]=aDg(Am),[x,N]=(function(tA){for(let eA=0;cDg.length>eA;eA++){const[QA,sA,dA]=cDg[eA],CA=tA.match(QA);if(CA){const hA=dA&&tA.match(dA)||CA;return[sA,hA?.[1]||""]}}return["",""]})(Am),U=(function(){const tA="u">typeof navigator?navigator:void 0;return tA?.brave?{brave:!0}:{}})(),K={};Le(y)||(K.detectGoogleSearchApp=y);const Y={},b=(u=navigator)===null||u===void 0||(u=u.userAgentData)===null||u===void 0?void 0:u.platform,q=(G=navigator)===null||G===void 0?void 0:G.maxTouchPoints,j=Me==null||(m=Me.screen)===null||m===void 0?void 0:m.width,Z=Me==null||(p=Me.screen)===null||p===void 0?void 0:p.height,O=Me?.devicePixelRatio;Le(b)||(Y.userAgentDataPlatform=b),Le(q)||(Y.maxTouchPoints=q),Le(j)||(Y.screenWidth=j),Le(Z)||(Y.screenHeight=Z),Le(O)||(Y.devicePixelRatio=O);const AA=Qr(kRA({$os:S,$os_version:R,$browser:nDg(Am,navigator.vendor,U,K),$webview_app:x,$webview_app_version:N,$device:rDg(Am),$device_type:tVI(Am,Y),$timezone:Qyg(),$timezone_offset:hzI()}),{$current_url:MV(w?v4(ta?.href):ta?.href,k,SV),$host:ta?.host,$pathname:ta?.pathname,$raw_user_agent:Am.length>1e3?Am.substring(0,997)+"...":Am,$browser_version:eVI(Am,navigator.vendor,U,K),$browser_language:cyg(),$browser_language_prefix:czI(),$screen_height:Me?.screen.height,$screen_width:Me?.screen.width,$viewport_height:Me?.innerHeight,$viewport_width:Me?.innerWidth,$lib:bF.LIB_NAME,$lib_version:bF.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return bF.SDK_DIST_CHANNEL&&(AA.$sdk_dist_channel=bF.SDK_DIST_CHANNEL),AA})(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:D,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(o,e.getTime(),!0);C.$session_id=D,C.$window_id=d}this.sessionPropsManager&&Qr(C,this.sessionPropsManager.getSessionProps());try{var i;if(this.sessionRecording){const D=this.sessionRecording.sdkDebugProperties,d=!this.wh&&iwg(A);for(const y in D)(d||yB(VzI,y))&&(C[y]=D[y])}C.$sdk_debug_retry_queue_size=(i=this.Ph)===null||i===void 0?void 0:i.length}catch(D){C.$sdk_debug_error_capturing_properties=String(D)}let E;if(this.requestRouter.region===oNA&&(C.$lib_custom_api_host=this.config.api_host),E=A!=="$pageview"||o?A!=="$pageleave"||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,t),C=Qr(C,E),A==="$pageview"&&ro&&(C.title=ro.title),!Le(B)){const D=e.getTime()-B;C.$duration=parseFloat((D/1e3).toFixed(3))}Am&&this.config.opt_out_useragent_filter&&(C.$browser_type=this._is_bot()?"bot":"browser");const n=this.persistence.properties(),s=this.sessionPersistence.properties(),r=C.$groups,a=n.$groups;yC(r)&&!_p(r)&&(C.$groups=QI(QI({},yC(a)?a:{}),r)),dn(["$referrer","$referring_domain"],D=>{D in n&&delete s[D]});const c={};if(this._h.length>0)for(const D of this._h.slice())try{Qr(c,D())}catch(d){Dt.error("Failed to produce browser extension event properties",d)}C=Qr({},Q,n,s,QI(QI({},c),C)),C.$is_identified=this._isIdentified(),aB(this.config.property_denylist)?dn(this.config.property_denylist,function(D){delete C[D]}):Dt.error(Qwg+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const h=this.config.sanitize_properties;h&&(Dt.error(Cwg),C=h(C,A));const l=this.ad();return C.$process_person_profile=l,l&&!o&&this.ld("_calculate_event_properties"),C}nd(A,I=!0,e=!1){var t;if(!this.persistence||!this.ad()||this.mh&&!e)return A;const o=this.persistence.get_initial_props(),B=(t=this.sessionPropsManager)===null||t===void 0?void 0:t.getSetOnceProps();let C=Qr({},o,B||{},A||{});const Q=this.config.sanitize_properties;return Q&&(Dt.error(Cwg),C=Q(C,"$set_once")),I&&(this.mh=!0),_p(C)?void 0:C}register(A,I){var e;(e=this.persistence)===null||e===void 0||e.register(A,I)}register_once(A,I,e){var t;(t=this.persistence)===null||t===void 0||t.register_once(A,I,e)}register_for_session(A){var I,e;(I=this.persistence)===null||I===void 0||I.syncCookieProperties(),this.rd(),(e=this.sessionPersistence)===null||e===void 0||e.register(A),Object.keys(A).forEach(t=>this.yh.add(t)),this.od()}unregister(A){var I;(I=this.persistence)===null||I===void 0||I.unregister(A)}unregister_for_session(A){var I;(I=this.sessionPersistence)===null||I===void 0||I.unregister(A),this.yh.delete(A),this.od()}ud(A,I){this.register({[A]:I})}Rh(){this.yh.forEach(A=>{var I;(I=this.sessionPersistence)===null||I===void 0||I.unregister(A)}),this.yh.clear(),this.od()}od(){var A;if(!this.bh)return;if(this.config.persistence==="memory"||!((A=this.sessionPersistence)===null||A===void 0)&&A.hi||!Ba.$t())return void Ba.Pt(this.bh);const I=[];this.yh.forEach(e=>I.push(e)),I.length>0?Ba.At(this.bh,I):Ba.Pt(this.bh)}getFeatureFlag(A,I){var e;return(e=this.featureFlags)===null||e===void 0?void 0:e.getFeatureFlag(A,I)}getFeatureFlagPayload(A){var I;return(I=this.featureFlags)===null||I===void 0?void 0:I.getFeatureFlagPayload(A)}getFeatureFlagResult(A,I){var e;return(e=this.featureFlags)===null||e===void 0?void 0:e.getFeatureFlagResult(A,I)}getAllFeatureFlags(){var A,I;return(A=(I=this.featureFlags)===null||I===void 0?void 0:I.getAllFeatureFlags())!==null&&A!==void 0?A:[]}isFeatureEnabled(A,I){var e,t;return(e=(t=this.featureFlags)===null||t===void 0?void 0:t.isFeatureEnabled(A,I))!==null&&e!==void 0?e:I?.defaultValue}reloadFeatureFlags(){var A;(A=this.featureFlags)===null||A===void 0||A.reloadFeatureFlags()}updateFlags(A,I,e){var t;(t=this.featureFlags)===null||t===void 0||t.updateFlags(A,I,e)}updateEarlyAccessFeatureEnrollment(A,I,e){var t;(t=this.featureFlags)===null||t===void 0||t.updateEarlyAccessFeatureEnrollment(A,I,e)}getEarlyAccessFeatures(A,I=!1,e){var t;return(t=this.featureFlags)===null||t===void 0?void 0:t.getEarlyAccessFeatures(A,I,e)}on(A,I){return this.ur.on(A,I)}onFeatureFlags(A){return this.featureFlags?this.featureFlags.onFeatureFlags(A):(A([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(A){return this.surveys?this.surveys.onSurveysLoaded(A):(A([],{isLoaded:!1,error:gH}),()=>{})}onSessionId(A){var I,e;return(I=(e=this.sessionManager)===null||e===void 0?void 0:e.onSessionId(A))!==null&&I!==void 0?I:()=>{}}getSurveys(A,I=!1){this.surveys?this.surveys.getSurveys(A,I):A([],{isLoaded:!1,error:gH})}getActiveMatchingSurveys(A,I=!1){this.surveys?this.surveys.getActiveMatchingSurveys(A,I):A([],{isLoaded:!1,error:gH})}onActiveMatchingSurveysChanged(A){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(A):(A([],{isLoaded:!1,error:gH}),()=>{})}renderSurvey(A,I){var e;(e=this.surveys)===null||e===void 0||e.renderSurvey(A,I)}displaySurvey(A,I=_zI){var e;(e=this.surveys)===null||e===void 0||e.displaySurvey(A,I)}cancelPendingSurvey(A){var I;(I=this.surveys)===null||I===void 0||I.cancelPendingSurvey(A)}canRenderSurvey(A){var I,e;return(I=(e=this.surveys)===null||e===void 0?void 0:e.canRenderSurvey(A))!==null&&I!==void 0?I:{visible:!1,disabledReason:gH}}canRenderSurveyAsync(A,I=!1){var e,t;return(e=(t=this.surveys)===null||t===void 0?void 0:t.canRenderSurveyAsync(A,I))!==null&&e!==void 0?e:Promise.resolve({visible:!1,disabledReason:gH})}hd(A){return!A||QV(A)?(Dt.critical("Unique user id has not been set in posthog.identify"),!1):A==="$posthog_cookieless"?(Dt.critical(`The string "${A}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(A.toLowerCase())&&!["undefined","null"].includes(A.toLowerCase())||(Dt.critical(`The string "${A}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(A,I,e){if(!this.__loaded||!this.persistence)return Dt.uninitializedWarning("posthog.identify");if($h(A)&&(A=A.toString(),Dt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.hd(A)||!this.ld("posthog.identify"))return;this.ah();const t=this.get_distinct_id(),o=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==t,B=this.rd(!1),C=this.persistence.ku();let Q=!1;try{const E=this.get_distinct_id();this.register({$user_id:A}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:E},""),A!==E&&A!==this.get_property("__alias")&&(this.unregister(YCA),this.register({distinct_id:A}));const n=(this.persistence.get_property("$user_state")||"anonymous")===TF,s=A!==E,r=!s&&n;if(s&&n){var i;const a=this.config.reuseAnonymousId?{distinct_id:A}:{distinct_id:A,$anon_distinct_id:E};this.persistence.set_property(Im,_CA),this.setPersonPropertiesForFlags({$set:I||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Su(),this.capture("$identify",a,{$set:I||{},$set_once:e||{}})&&(this.$h=tNA(A,I,e)),(i=this.featureFlags)===null||i===void 0||i.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:E)}else if(r){this.persistence.set_property(Im,_CA);const a=I||{},c=e||{};this.setPersonPropertiesForFlags({$set:a,$set_once:c},!1),this.config.cookieWinsOnConflict&&this.persistence.Su(),this.capture("$set",{$set:a,$set_once:c})&&(this.$h=tNA(A,I,e))}else(I||e)&&this.setPersonProperties(I,e);s||o||B?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(qF)):r&&(I||e)&&this.reloadFeatureFlags(),Q=!0}finally{C&&this.persistence.Cu(Q)}}setPersonProperties(A,I){if(!A&&!I||!this.ld("posthog.setPersonProperties"))return;const e=tNA(this.get_distinct_id(),A,I);this.$h!==e?(this.setPersonPropertiesForFlags({$set:A||{},$set_once:I||{}},!0),this.capture("$set",{$set:A||{},$set_once:I||{}})&&(this.$h=e)):Dt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(A){var I;const e=(aB(A)?A:[A]).filter(t=>UC(t)&&t.length>0);e.length!==0&&this.ld("posthog.unsetPersonProperties")&&((I=this.featureFlags)===null||I===void 0||I.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.$h=null)}group(A,I,e){var t;if(!A||!I)return void Dt.error("posthog.group requires a group type and group key");(t=this.persistence)===null||t===void 0||t.syncCookieProperties(),this.rd();const o=this.getGroups(),B=o[A]!==I;if(B&&this.resetGroupPropertiesForFlags(A),this.register({$groups:QI(QI({},o),{},{[A]:I})}),(B||e)&&this.ad()){const C={$group_type:A,$group_key:I};e&&(C.$group_set=e),this.capture(Ndg,C)}e&&this.setGroupPropertiesForFlags({[A]:e}),B&&!e&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(A,I=!0){var e;(e=this.featureFlags)===null||e===void 0||e.setPersonPropertiesForFlags(A,I)}resetPersonPropertiesForFlags(A=!0){var I;(I=this.featureFlags)===null||I===void 0||I.resetPersonPropertiesForFlags(A)}setGroupPropertiesForFlags(A,I=!0){var e;this.ld("posthog.setGroupPropertiesForFlags")&&((e=this.featureFlags)===null||e===void 0||e.setGroupPropertiesForFlags(A,I))}resetGroupPropertiesForFlags(A){var I;(I=this.featureFlags)===null||I===void 0||I.resetGroupPropertiesForFlags(A)}reset(A){const I=gm(A)?A:A?.resetDeviceID,e=gm(A)||A==null?void 0:A.bootstrap;this.dd(I,!1,e)}dd(A,I=!1,e){var t,o,B,C,Q,i;if(Dt.info("reset"),!this.__loaded)return Dt.uninitializedWarning("posthog.reset");const E=e?.sessionID;this.config.bootstrap=e||((t=this.Th)===null||t===void 0?void 0:t.bootstrap)||{},(o=this.featureFlags)===null||o===void 0||(B=o.updateConfig)===null||B===void 0||B.call(o,this.config,this.Qu());const n=this.get_property(ERA),s=this.get_property(nRA),r=this.get_property(dV);(C=this.sessionRecording)===null||C===void 0||C.flushBeforeIdentityReset();const a=this.is_capturing();I||this.consent.reset(),I||!a||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 c=(Q=this.persistence)===null||Q===void 0||(i=Q.ku)===null||i===void 0?void 0:i.call(Q),h=this.uh;this.uh=h||I;let l=!1;try{var D,d,y,w,u,G,m,p,k,S,R,x,N;if((D=this.persistence)===null||D===void 0||D.clear(),(d=this.sessionPersistence)===null||d===void 0||d.clear(),this.yh.clear(),this.od(),Le(r)||(S=this.persistence)===null||S===void 0||S.register({$session_recording_remote_config:r}),(y=this.surveys)===null||y===void 0||y.reset(),(w=this.featureFlags)===null||w===void 0||w.reset(),(u=this.conversations)===null||u===void 0||u.reset(),(G=this.logs)===null||G===void 0||G.reset(),(m=this.metrics)===null||m===void 0||m.reset(),(p=this.persistence)===null||p===void 0||p.set_property("$user_state","anonymous"),(k=this.sessionManager)===null||k===void 0||k.resetSessionId(),this.$h=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:uRA,$device_id:null},"");else{const b=this.config.get_device_id(Uf());this.register_once({distinct_id:b,$device_id:A?b:n},""),A||Le(s)||this.register({[nRA]:s})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),e&&(e.distinctID&&!this.nh()&&((N=this.persistence)===null||N===void 0||N.set_property("$user_state",e.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.distinctID})),(R=this.featureFlags)===null||R===void 0||R.initialize(),!rC(E)&&!(!((x=this.sessionManager)===null||x===void 0)&&x.setBootstrapSessionId(E,!0)))){const b=QI({},e);delete b.sessionID,this.config.bootstrap=b}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,l=!0}finally{var U,K;this.uh=h,c&&((U=this.persistence)===null||U===void 0||(K=U.Cu)===null||K===void 0||K.call(U,l))}var Y;this.cr&&((Y=this.conversations)===null||Y===void 0||Y.onRemoteConfig(this.cr)),this.reloadFeatureFlags()}shutdown(A){var I=this;return oa(function*(){if(!I.__loaded)return void Dt.uninitializedWarning("posthog.shutdown");I.gh=!0,clearTimeout(I.Fh),I.Fh=void 0;const e=I.jh;I.jh=void 0;for(const t of[()=>{var o;return(o=I.sessionRecording)===null||o===void 0?void 0:o.dispose()},()=>{var o;return(o=I.logs)===null||o===void 0?void 0:o.flushLogs("sendBeacon")},()=>{var o;return(o=I.metrics)===null||o===void 0?void 0:o.flush("sendBeacon")},()=>{var o;return(o=I.metrics)===null||o===void 0?void 0:o.dispose()},()=>{var o;return(o=I.logs)===null||o===void 0?void 0:o.dispose()},()=>{var o;return(o=I.surveys)===null||o===void 0?void 0:o.dispose()},()=>{var o;return(o=I.autocapture)===null||o===void 0?void 0:o.dispose()},()=>e?.(),()=>{var o;return(o=I.Mh)===null||o===void 0?void 0:o.unload()},()=>{var o;return(o=I.Ph)===null||o===void 0?void 0:o.unload()},()=>{var o;return(o=I.featureFlags)===null||o===void 0?void 0:o.destroy()},()=>{var o;return(o=I.persistence)===null||o===void 0?void 0:o.destroy()},()=>{var o;return(o=I.sessionPersistence)===null||o===void 0?void 0:o.destroy()}])try{const o=t();o&&Xh(o.then)&&o.then(void 0,B=>{Dt.error("Error during shutdown",B)})}catch(o){Dt.error("Error during shutdown",o)}})()}setIdentity(A,I){var e;delete this.config.identity_claims,this.config.identity_distinct_id=A,this.config.identity_hash=I,this.alias(A),(e=this.conversations)===null||e===void 0||e.vd()}clearIdentity(){var A;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(A=this.conversations)===null||A===void 0||A.fd()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var A,I;return(A=(I=this.sessionManager)===null||I===void 0?void 0:I.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&A!==void 0?A:""}get_session_replay_url(A){if(!this.sessionManager)return"";const{sessionId:I,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let t=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${I}`);if(A?.withTimestamp&&e){var o;const B=(o=A.timestampLookBack)!==null&&o!==void 0?o:10;if(!e)return t;t+=`?t=${Math.max(Math.floor((new Date().getTime()-e)/1e3)-B,0)}`}return t}alias(A,I){return A===this.get_property("$people_distinct_id")?(Dt.critical("Attempting to create alias for existing People user - aborting."),-2):this.ld("posthog.alias")?(Le(I)&&(I=this.get_distinct_id()),A!==I?(this.ud(YCA,A),this.capture("$create_alias",{alias:A,distinct_id:I})):(Dt.warn("alias matches current distinct_id - skipping api call."),this.identify(A),-1)):void 0}set_config(A){const I=QI({},this.config);if(yC(A)){var e,t,o,B,C,Q,i,E,n,s,r,a,c,h;Qr(this.config,swg(A));const w=this.fh();if(this.persistence){const G=this.config.persistence==="sessionStorage"||this.config.persistence==="memory";var l,D;if(G&&this.sessionPersistence!==this.persistence&&((l=this.sessionPersistence)===null||l===void 0||l.remove(),(D=this.sessionPersistence)===null||D===void 0||D.destroy()),this.persistence.update_config(this.config,I,w),G)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new qRA(QI(QI({},this.config),{},{persistence:"sessionStorage"}),w,!1);else{var d;(d=this.sessionPersistence)===null||d===void 0||d.update_config(QI(QI({},this.config),{},{persistence:"sessionStorage"}),QI(QI({},I),{},{persistence:"sessionStorage"}),w)}}const u=this.Ch(this.config.debug);var y;gm(u)&&(this.config.debug=u),gm(this.config.debug)&&(this.config.debug?(bp.DEBUG=!0,AE.$t()&&AE.At("ph_debug",!0),Dt.info("set_config",{config:A,oldConfig:I,newConfig:QI({},this.config)})):(bp.DEBUG=!1,AE.$t()&&AE.Pt("ph_debug"))),(e=this.featureFlags)===null||e===void 0||(t=e.updateConfig)===null||t===void 0||t.call(e,this.config,this.Qu()),(o=this.exceptionObserver)===null||o===void 0||o.onConfigChange(),(B=this.exceptions)===null||B===void 0||B.onConfigChange(),(C=this.metrics)===null||C===void 0||C.onConfigChange(),(Q=this.webMCP)===null||Q===void 0||Q.startIfEnabled(),(i=this.sessionRecording)===null||i===void 0||i.startIfEnabledOrStop(),(E=this.tracingHeaders)===null||E===void 0||E.startIfEnabledOrStop(),(n=this.autocapture)===null||n===void 0||n.startIfEnabled(),(s=this.heatmaps)===null||s===void 0||s.startIfEnabled(),("capture_pageview"in A||"disable_capture_url_hashes"in A)&&((y=this.historyAutocapture)===null||y===void 0||y.startIfEnabledOrStop()),(r=this.exceptionObserver)===null||r===void 0||r.startIfEnabledOrStop(),(a=this.deadClicksAutocapture)===null||a===void 0||a.startIfEnabledOrStop(),(c=this.surveys)===null||c===void 0||c.loadIfEnabled(),this.hh(),(h=this.externalIntegrations)===null||h===void 0||h.startIfEnabledOrStop(),!I.segment&&this.config.segment&&this.persistence&&tyg(this,JV,!1)}}_overrideSDKInfo(A,I){bp.LIB_NAME=A,bp.LIB_VERSION=I}startSessionRecording(A){const I=A===!0,e={sampling:I||!!A?.sampling,linked_flag:I||!!A?.linked_flag,url_trigger:I||!!A?.url_trigger,event_trigger:I||!!A?.event_trigger};var t,o,B,C,Q;Object.values(e).some(Boolean)&&((t=this.sessionManager)===null||t===void 0||t.checkAndGetSessionAndWindowId(),e.sampling&&((o=this.sessionRecording)===null||o===void 0||o.overrideSampling()),e.linked_flag&&((B=this.sessionRecording)===null||B===void 0||B.overrideLinkedFlag()),e.url_trigger&&((C=this.sessionRecording)===null||C===void 0||C.overrideTrigger("url")),e.event_trigger&&((Q=this.sessionRecording)===null||Q===void 0||Q.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var A;return!!(!((A=this.sessionRecording)===null||A===void 0)&&A.started)}captureException(A,I){try{if(!this.exceptions)return;const e=this.exceptions.buildProperties(A,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(QI(QI({},e),I))}catch{return}}addExceptionStep(A,I){var e;(e=this.exceptions)===null||e===void 0||e.addExceptionStep(A,I)}captureLog(A){var I;(I=this.logs)===null||I===void 0||I.captureLog(A)}get logger(){var A,I;return(A=(I=this.logs)===null||I===void 0?void 0:I.logger)!==null&&A!==void 0?A:aY.pd}startExceptionAutocapture(A){this.set_config({capture_exceptions:A==null||A})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(A){var I,e;return(I=(e=this.toolbar)===null||e===void 0?void 0:e.loadToolbar(A))!==null&&I!==void 0&&I}get_property(A){var I;return(I=this.persistence)===null||I===void 0?void 0:I.props[A]}getSessionProperty(A){var I;return(I=this.sessionPersistence)===null||I===void 0?void 0:I.props[A]}toString(){var A;let I=(A=this.config.name)!==null&&A!==void 0?A:PV;return I!==PV&&(I="posthog."+I),I}_isIdentified(){var A,I;return((A=this.persistence)===null||A===void 0?void 0:A.get_property("$user_state"))==="identified"||((I=this.sessionPersistence)===null||I===void 0?void 0:I.get_property("$user_state"))==="identified"}ad(){var A,I;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&_p(this.getGroups())&&!(!((A=this.persistence)===null||A===void 0||(A=A.props)===null||A===void 0)&&A.__alias)&&!(!((I=this.persistence)===null||I===void 0||(I=I.props)===null||I===void 0)&&I.$epp))}Vh(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.ad()||this.ld("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ld("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ld(A){return this.config.person_profiles==="never"?(Dt.error(A+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.sh(),this.ud(wRA,!0),!0)}fh(){if(this.config.cookieless_mode==="always")return!0;const A=this.consent.isOptedOut();return this.config.disable_persistence||A&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}hh(){var A,I;const e=this.fh();var t,o,B;return this.is_capturing()||(t=this.logs)===null||t===void 0||t.gd(),((A=this.persistence)===null||A===void 0?void 0:A.hi)!==e&&((o=this.persistence)===null||o===void 0||o.set_disabled(e)),((I=this.sessionPersistence)===null||I===void 0?void 0:I.hi)!==e&&((B=this.sessionPersistence)===null||B===void 0||B.set_disabled(e)),this.od(),e}opt_in_capturing(A){var I;if(this.config.cookieless_mode!=="always"){if(this.nh()){var e,t,o,B,C,Q;(e=this.sessionRecording)===null||e===void 0||e.dispose({discardBufferedEvents:!0}),this.dd(!0,!0),(t=this.sessionManager)===null||t===void 0||t.destroy(),(o=this.pageViewManager)===null||o===void 0||o.destroy(),this.sessionManager=new Wyg(this),this.pageViewManager=new Cyg(this),this.persistence&&(this.sessionPropsManager=new Zyg(this,this.sessionManager,this.persistence));const a=(B=(C=this.config.__extensionClasses)===null||C===void 0?void 0:C.sessionRecording)!==null&&B!==void 0?B:(Q=aY.__defaultExtensionClasses)===null||Q===void 0?void 0:Q.sessionRecording;var i,E;a&&(this.sessionRecording=this.ih(this.sessionRecording,new a(this)),this.cr&&((i=this.sessionRecording)===null||i===void 0||(E=i.onRemoteConfig)===null||E===void 0||E.call(i,this.cr)))}var n,s,r;this.consent.optInOut(!0),this.hh(),this.Hh(),(I=this.sessionRecording)===null||I===void 0||I.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((n=this.surveys)===null||n===void 0||n.loadIfEnabled(),(s=this.conversations)===null||s===void 0||s.loadIfEnabled()),(Le(A?.captureEventName)||A?.captureEventName)&&this.capture((r=A?.captureEventName)!==null&&r!==void 0?r:"$opt_in",A?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Uh()}else Dt.warn(Bwg)}opt_out_capturing(){this.config.cookieless_mode!=="always"?(this.consent.optInOut(!1),this.hh(),this.config.cookieless_mode==="on_reject"&&this.dh()):Dt.warn(Bwg)}dh(){var A,I;const e=this.sessionRecording;e?.dispose({discardBufferedEvents:!0}),this.get_distinct_id()!=="$posthog_cookieless"&&this.dd(!0,!0),this.register({distinct_id:uRA,$device_id:null}),this.th(e),this.sessionRecording=void 0,(A=this.sessionManager)===null||A===void 0||A.destroy(),(I=this.pageViewManager)===null||I===void 0||I.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Uh(),this.Hh()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const A=this.consent.consent;return A===1?"granted":A===0?"denied":"pending"}is_capturing(){return!this.uh&&(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.hh()}_is_bot(){return Rw?Vyg(Rw,this.config.custom_blocked_useragents):void 0}Uh(){ro&&(ro.visibilityState==="visible"?this.kh||(this.kh=!0,this.capture(pRA,{title:ro.title},{send_instantly:!0}),this.Sh&&(ro.removeEventListener(L9,this.Sh),this.Sh=null)):this.Sh||(this.Sh=this.Uh.bind(this),GE(ro,L9,this.Sh)))}debug(A){A===!1?(Me?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Me?.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}))}Qu(){const A=this.Th||{};return"advanced_disable_flags"in A?!!A.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Dt.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(I,e,t,o,B){const C=e in I&&!rC(I[e]),Q=t in I&&!rC(I[t]);return C?I[e]:!!Q&&(B&&B.warn(`Config field '${t}' is deprecated. Please use '${e}' instead. The old field will be removed in a future major version.`),I[t])})(A,"advanced_disable_flags","advanced_disable_decide",0,Dt)}Os(A){var I;if(rC(this.config.before_send))return A;const e=Object.keys((I=A.properties)!==null&&I!==void 0?I:{}).filter(ZWI),t=aB(this.config.before_send)?this.config.before_send:[this.config.before_send];let o=A;for(const B of t)try{if(o=B(o),rC(o)){const C=`Event '${A.event}' was rejected in beforeSend function`;return TWI(A.event)?Dt.warn(`${C}. This can cause unexpected behavior.`):Dt.info(C),null}o.properties&&!_p(o.properties)||Dt.warn(`Event '${A.event}' has no properties after beforeSend function, this is likely an error.`)}catch(C){return Dt.error(`Error in beforeSend function for event '${A.event}':`,C),null}for(const B of e)if(o.properties&&rC(o.properties[B]))return Dt.warn(`Event '${A.event}' had its '${B}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return o}getPageViewId(){var A;return(A=this.pageViewManager.Rl)===null||A===void 0?void 0:A.pageViewId}captureTraceFeedback(A,I){this.capture("$ai_feedback",{$ai_trace_id:String(A),$ai_feedback_text:I})}captureTraceMetric(A,I,e){this.capture("$ai_metric",{$ai_trace_id:String(A),$ai_metric_name:I,$ai_metric_value:String(e)})}Ch(A){const I=gm(A)&&!A,e=AE.$t()&&AE.Ot("ph_debug")==="true";return!I&&(!!e||A)}};KV.__defaultExtensionClasses={},KV.pd=(()=>{const g=()=>{};return{trace:g,debug:g,info:g,warn:g,error:g,fatal:g}})(),(function(g,A){for(let I=0;A.length>I;I++)g.prototype[A[I]]=vjI(g.prototype[A[I]])})(KV,["identify"]);var IXI=class{constructor(A){this._instance=A}refresh(A){const I=this._instance.config,e=yC(I.autocapture)?I.autocapture:void 0;A.enabled=!!I.autocapture,A.rageclick=I.rageclick,A.maskAllElementAttributes=I.mask_all_element_attributes,A.maskAllText=I.mask_all_text,A.disableCaptureUrlHashes=I.disable_capture_url_hashes,A.getCurrentUrl=I.get_current_url,A.remoteRequestsDisabled=this._instance.Qu(),A.url_allowlist=e?.url_allowlist,A.url_ignorelist=e?.url_ignorelist,A.dom_event_allowlist=e?.dom_event_allowlist,A.element_allowlist=e?.element_allowlist,A.css_selector_allowlist=e?.css_selector_allowlist,A.css_selector_ignorelist=e?.css_selector_ignorelist,A.element_attribute_ignorelist=e?.element_attribute_ignorelist,A.capture_copied_text=e?.capture_copied_text}};const LV=qr("[ExceptionAutocapture]"),awg=()=>{},rwg=g=>{var A;if(Xh(g))return(A=g.__posthog_layer__)!==null&&A!==void 0?A:g.__rrweb_layer__};function IH(g,A,I){try{if(!(A in g))return awg;const e={next:g[A]},t=I(function(...o){return e.next.apply(this,o)});return Xh(t)&&(t.prototype=t.prototype||{},Object.defineProperties(t,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:e}})),g[A]=t,()=>{if(g[A]===t)return void(g[A]=e.next);let o=g[A],B=rwg(o);for(;B;){if(B.next===t)return void(B.next=e.next);o=B.next,B=rwg(o)}}}catch{return awg}}const eXI=qr("[TracingHeaders]"),SY=qr("[Web Vitals]"),cwg=9e5,hwg=["CLS","FCP","INP","LCP"],tXI=["INP","LCP"],oXI=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],sNA="disabled",lwg="lazy_loading",VF=qr("[SessionRecording]"),BXI=[GRA,mRA,wdg,udg,Gdg,mdg,pdg,kdg,Mdg],CXI=qr("[Heatmaps]");function aNA(g){return yC(g)&&"clientX"in g&&"clientY"in g&&$h(g.clientX)&&$h(g.clientY)}const gQA=qr("[Product Tours]"),rNA=g=>{var A;return!g.config.disable_product_tours&&!!(!((A=g.persistence)===null||A===void 0)&&A.get_property(DRA))},QXI=["$set_once","$set"],JN=qr("[SiteApps]"),Dwg="Error while initializing PostHog app with config id ";function eH(g,A,I){if(rC(g))return!1;switch(I){case"exact":return g===A;case"contains":{const e=A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(e,"i").test(g)}case"regex":try{return new RegExp(A).test(g)}catch{return!1}default:return!1}}var iXI=class{constructor(A){this.Ai=A,this._o=new Set,this.wo=new Set,this.ko=new XCA,this.So=(I,e)=>this.xo(I,e)&&this.$o(I,e)&&this.Co(I,e)&&this.To(I,e),this.xo=(I,e)=>!e?.event||I?.event===e?.event}init(){var A,I;Le((A=this.Ai)===null||A===void 0?void 0:A.subscribeCapture)||(this.Io=(I=this.Ai)===null||I===void 0?void 0:I.subscribeCapture((e,t)=>{this.on(e,t)}))}dispose(){var A,I,e;(A=this.Io)===null||A===void 0||A.call(this),this.Io=void 0,(I=this.Ai)===null||I===void 0||(e=I.setElementSelectors)===null||e===void 0||e.call(I,new Set,this),this.ko=new XCA}register(A){var I,e;if(!Le((I=this.Ai)===null||I===void 0?void 0:I.subscribeCapture)&&(A.forEach(t=>{var o;this._o.add(t),(o=t.steps)===null||o===void 0||o.forEach(B=>{this.wo.add(B?.event||"")})}),(e=this.Ai)===null||e===void 0?void 0:e.setElementSelectors)){const t=new Set;this._o.forEach(o=>{var B;(B=o.steps)===null||B===void 0||B.forEach(C=>{C?.selector&&t.add(C.selector)})}),this.Ai.setElementSelectors(t,this)}}replace(A){this._o.clear(),this.wo.clear(),this.register(A)}on(A,I){I!=null&&A.length!=0&&(this.wo.has(A)||this.wo.has(I.event))&&this._o.forEach(e=>{this.Mo(I,e)&&this.ko.emit("actionCaptured",e.name)})}Eo(A){this.onAction("actionCaptured",I=>A(I))}Mo(A,I){if(I?.steps==null)return!1;for(const e of I.steps)if(this.So(A,e))return!0;return!1}onAction(A,I){return this.ko.on(A,I)}$o(A,I){if(I?.url){var e;let B=A==null||(e=A.properties)===null||e===void 0?void 0:e.$current_url;if(!A?.properties||!("$current_url"in A.properties))try{var t,o;B=(t=this.Ai)===null||t===void 0||(o=t.getActionUrl)===null||o===void 0?void 0:o.call(t)}catch{return!1}if(!B||typeof B!="string"||!eH(B,I.url,I.url_matching||"contains"))return!1}return!0}Co(A,I){return!!this.Po(A,I)&&!!this.Ro(A,I)&&!!this.Ao(A,I)}Po(A,I){var e;if(!I?.href)return!0;const t=this.Fo(A);if(t.length>0)return t.some(B=>eH(B.href,I.href,I.href_matching||"exact"));const o=(A==null||(e=A.properties)===null||e===void 0?void 0:e.$elements_chain)||"";return!!o&&eH((function(B){const C=B.match(/(?::|")href="(.*?)"/);return C?C[1]:""})(o),I.href,I.href_matching||"exact")}Ro(A,I){var e;if(!I?.text)return!0;const t=this.Fo(A);if(t.length>0)return t.some(i=>eH(i.text,I.text,I.text_matching||"exact")||eH(i.$el_text,I.text,I.text_matching||"exact"));const o=(A==null||(e=A.properties)===null||e===void 0?void 0:e.$elements_chain)||"";return!!o&&(B=(function(i){const E=[],n=/(?::|")text="(.*?)"/g;let s;for(;!rC(s=n.exec(i));)E.includes(s[1])||E.push(s[1]);return E})(o),C=I.text,Q=I.text_matching||"exact",B.some(i=>eH(i,C,Q)));var B,C,Q}Ao(A,I){var e,t;if(!I?.selector)return!0;const o=A==null||(e=A.properties)===null||e===void 0?void 0:e.$element_selectors;if(o?.includes(I.selector))return!0;const B=(A==null||(t=A.properties)===null||t===void 0?void 0:t.$elements_chain)||"";if(I.selector_regex&&B)try{return new RegExp(I.selector_regex).test(B)}catch{}return!1}Fo(A){var I;return(A==null||(I=A.properties)===null||I===void 0?void 0:I.$elements)==null?[]:A?.properties.$elements}To(A,I){return!I?.properties||I.properties.length===0||$yg(I.properties.reduce((e,t)=>{const o=aB(t.value)?t.value.map(String):t.value!=null?[String(t.value)]:[];return e[t.key]={values:o,operator:t.operator||"exact"},e},{}),A?.properties)}},EXI=class{constructor(A,I){this.Oo=I,this.Do=[],this.Ai=A,this.Lo=new Map,this.No=new Map,this.qo=new Map}jo(){var A,I;this.Bo=(A=(I=this.Ai).subscribeSession)===null||A===void 0?void 0:A.call(I,e=>this.zo(e))}Ho(A){return!1}Uo(){return null}Wo(A){}Vo(){}Go(A,I){return!!A&&$yg(A.propertyFilters,I?.properties)}Qo(A,I){const e=new Map;return A.forEach(t=>{var o;(o=t.conditions)===null||o===void 0||(o=o[I])===null||o===void 0||(o=o.values)===null||o===void 0||o.forEach(B=>{if(B?.name){const C=e.get(B.name)||[];C.push(t.id),e.set(B.name,C)}})}),e}Zo(A,I,e){const t=(e===fV.Activation?this.Lo:this.No).get(A);let o=[];return this.Jo(B=>{o=B.filter(C=>t?.includes(C.id))}),o.filter(B=>{var C;const Q=(C=B.conditions)===null||C===void 0||(C=C[e])===null||C===void 0||(C=C.values)===null||C===void 0?void 0:C.find(i=>i.name===A);return this.Go(Q,I)})}register(A){this.Ko(A,!1)}replace(A){this.Ko(A,!0)}Ko(A,I){Le(this.Ai.subscribeCapture)||(this.Xo(A,I),this.Yo(A,I))}Yo(A,I){const e=A.filter(B=>{var C;return(C=B.conditions)===null||C===void 0||(C=C.actions)===null||C===void 0||(C=C.values)===null||C===void 0?void 0:C.length});var t;if(I&&this.qo.clear(),e.length===0)return void(I&&((t=this.ta)===null||t===void 0||t.replace([])));this.ta||(this.ta=new iXI(this.Ai),this.ta.init(),this.ta.Eo(B=>this.onAction(B)));const o=[];e.forEach(B=>{var C;(C=B.conditions)===null||C===void 0||(C=C.actions)===null||C===void 0||C.values.forEach(Q=>{if(o.push(Q),Q.name){var i;const E=(i=this.qo.get(Q.name))!==null&&i!==void 0?i:[];E.includes(B.id)||E.push(B.id),this.qo.set(Q.name,E)}})}),I?this.ta.replace(o):this.ta.register(o)}ea(A,I){I.forEach((e,t)=>{var o;const B=(o=A.get(t))!==null&&o!==void 0?o:[];e.forEach(C=>{B.includes(C)||B.push(C)}),A.set(t,B)})}Xo(A,I){var e,t,o;const B=A.filter(E=>{var n,s;return((n=E.conditions)===null||n===void 0?void 0:n.events)&&((s=E.conditions)===null||s===void 0||(s=s.events)===null||s===void 0||(s=s.values)===null||s===void 0?void 0:s.length)>0}),C=A.filter(E=>{var n,s;return((n=E.conditions)===null||n===void 0?void 0:n.cancelEvents)&&((s=E.conditions)===null||s===void 0||(s=s.cancelEvents)===null||s===void 0||(s=s.values)===null||s===void 0?void 0:s.length)>0}),Q=this.Qo(A,fV.Activation),i=this.Qo(A,fV.Cancellation);I?(this.Lo=Q,this.No=i):(this.ea(this.Lo,Q),this.ea(this.No,i)),(B.length!==0||C.length!==0||A.some(E=>{var n;return(n=E.conditions)===null||n===void 0||(n=n.actions)===null||n===void 0||(n=n.values)===null||n===void 0?void 0:n.length}))&&((e=this.Io)!==null&&e!==void 0||(this.Io=(t=(o=this.Ai).subscribeCapture)===null||t===void 0?void 0:t.call(o,(E,n)=>{this.onEvent(E,n)})))}onEvent(A,I){var e,t;const o=this.ia(),B=(I==null||(e=I.properties)===null||e===void 0?void 0:e.$survey_id)||(I==null||(t=I.properties)===null||t===void 0?void 0:t.$product_tour_id);if(B&&this.getActivatedIds().includes(B)){const Q=this.na(A,B,I);if(Q==="consume")return o.info("event consumed activated item, removing it",{event:A,itemId:B}),void this.sa([B]);if(Q==="persist")return o.info("shown item promoted to persisted activation",{event:A,itemId:B}),this.ra(B),void this.oa([B])}if(this.No.has(A)){const Q=this.Zo(A,I,fV.Cancellation);Q.length>0&&(o.info("cancel event matched, cancelling items",{event:A,itemsToCancel:Q.map(i=>i.id)}),this.sa(Q.map(i=>i.id)),Q.forEach(i=>this.aa(i.id)))}if(!this.Lo.has(A))return;o.info("event name matched",{event:A,eventPayload:I,items:this.Lo.get(A)});const C=this.Zo(A,I,fV.Activation);this.la(C.map(Q=>Q.id))}onAction(A){this.qo.has(A)&&this.la(this.qo.get(A)||[])}la(A){if(A.length===0)return;const I=!!this.Ai.getSessionId(),e=[];for(const t of A)I&&this.Ho(t)?this.ra(t)&&this.ua(t):e.push(t);e.length>0&&(this.Do=[...new Set([...this.Do,...e])]),this.ia().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.ca()}ra(A){this.Do=this.Do.filter(e=>e!==A);const I=this.ha();return!I.includes(A)&&(this.da([...I,A]),this.va(),!0)}sa(A){const I=new Set(A);this.Do=this.Do.filter(o=>!I.has(o));const e=this.fa(),t=e.filter(o=>!I.has(o));t.length!==e.length&&(this.da(t),t.length===0&&this.pa()),this.oa(A),this.ca()}ca(){try{var A;(A=this.Oo)===null||A===void 0||A.call(this)}catch(I){this.ia().error("Error while handling activated items change",I)}}ga(){const A=this.Uo();if(!A)return{};const I=this.Ai.getProperty(A);return I&&typeof I=="object"?I:{}}ua(A){if(!this.Uo())return;const I=this.ga();this.Wo(QI(QI({},I),{},{[A]:Date.now()}))}oa(A){if(!this.Uo())return;const I=this.ga(),e={};let t=!1;for(const[o,B]of Object.entries(I))A.includes(o)?t=!0:e[o]=B;t&&(_p(e)?this.Vo():this.Wo(e))}ma(){this.Uo()&&this.Vo()}getActivationTimestamp(A){if(!this.ha().includes(A))return;const I=this.ga()[A];return $h(I)?I:void 0}fa(){const A=this.ya();return this.Ai.getProperty(A)||[]}ha(){const A=this.fa();if(A.length===0)return[];const I=this.Ai.getProperty(this.ba()),e=this.Ai.getSessionId();return e&&I===e?A:[]}va(){const A=this.Ai.getSessionId();A&&this._a(A)}pa(){this.wa()}zo(A){const I=this.Ai.getProperty(this.ba());if(I&&I!==A){const e=this.fa(),t=this.ga();e.length>0&&(this.da([]),e.filter(o=>$h(t[o])).forEach(o=>this.aa(o))),this.pa(),this.ma(),e.length>0&&this.ca()}}getActivatedIds(){return[...new Set([...this.ha(),...this.Do])].filter(A=>!this.ka(A))}dispose(){var A,I,e;(A=this.Bo)===null||A===void 0||A.call(this),this.Bo=void 0,(I=this.Io)===null||I===void 0||I.call(this),this.Io=void 0,(e=this.ta)===null||e===void 0||e.dispose(),this.ta=void 0}reset(){this.Do=[],this.fa().length>0&&this.da([]),this.pa(),this.ma(),this.ca()}getEventToItemsMap(){return this.Lo}Sa(){return this.ta}},nXI=class extends EXI{constructor(A,I,e,t){var o;super({subscribeCapture(B){const C=A.onEvent(Q=>B(Q.event,Q));return()=>C.dispose()},subscribeSession(B){const C=A.onSession(B);return()=>C.dispose()},getSessionId(){var B;return(B=A.session)===null||B===void 0?void 0:B.sessionId},getProperty:B=>A.kv.get(B),getActionUrl:e?.getActionUrl,setElementSelectors:(o=e?.setElementSelectors)!==null&&o!==void 0?o:(B,C)=>{var Q;return(Q=A.getExtension("autocapture"))===null||Q===void 0?void 0:Q.setElementSelectors(B,C)}},t),this.xa=A,this.$a=I,this.jo()}ya(){return iRA}ba(){return KCA}Uo(){return LCA}Wo(A){this.xa.kv.set({[LCA]:A})}Vo(){this.xa.kv.remove(LCA)}Ho(A){var I;let e;this.Jo(o=>{e=o.find(B=>B.id===A)});const t=e==null||(I=e.appearance)===null||I===void 0?void 0:I.surveyPopupDelaySeconds;return $h(t)&&t>0}Ca(){return mM.SHOWN}Jo(A){this.$a.getSurveys(A)}aa(A){this.$a.cancelPendingSurvey(A)}ia(){return yn}da(A){this.xa.kv.set({[iRA]:A})}_a(A){this.xa.kv.set({[KCA]:A})}wa(){this.xa.kv.remove(KCA)}ka(){return!1}na(A,I,e){var t;if(A===mM.SENT&&(e==null||(t=e.properties)===null||t===void 0?void 0:t.$survey_completed)===!1)return"ignore";let o;return this.Jo(B=>{o=B.find(C=>C.id===I)}),!o||(function(B){var C;return zyg(B)&&!!(!((C=B.conditions)===null||C===void 0||(C=C.events)===null||C===void 0)&&C.repeatedActivation)||B.schedule==="always"})(o)?A===mM.SHOWN?"consume":"ignore":A===mM.SHOWN?"persist":A===mM.DISMISSED||A===mM.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}};const cNA=(g,A)=>g?.then?g.then(A):A(g),tH="SDK is not enabled or survey functionality is not yet loaded",dwg="Disabled. Not loading surveys.";var sXI=class{constructor(A){this.Ta=A,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ia=!1,this.Ma=!1,this.Ea=[],this.Pa=[],this.Ra=null,this.Aa=null,this.Ci=!1,this.Fa=new Set,this.onRemoteConfig=I=>{if(this.Ci||this.Ar.disableSurveys)return;if(!I.ok)return this.Ma=!0,this.Oa({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),yn.warn("Remote config unavailable. Not loading surveys.");const e=I.config.surveys;if(rC(e))return yn.warn("Flags not loaded yet. Not loading surveys.");this.Da=gm(e)?e:e.length>0,yn.info(`flags response received, isSurveysEnabled: ${this.Da}`),this.loadIfEnabled()},this.Oa=I=>{this.Pa.slice().forEach(e=>this.La(e,I))}}setup(A){if(!this.Ci)return this.Na=A,cNA(A.kv.initialize(),()=>{if(this.Na!==A||this.Ci)return;this.Na=void 0,this.xa=A;const I=A.onRemoteConfig(this.onRemoteConfig);this.Ci?I.dispose():(this.qa=I,this.loadIfEnabled())})}dispose(){var A,I,e,t,o;this.Ci||(this.Ci=!0,this.Na=void 0,this.xa=void 0,(A=this.qa)===null||A===void 0||A.dispose(),this.qa=void 0,(I=this._surveyEventReceiver)===null||I===void 0||I.dispose(),this._surveyEventReceiver=null,(e=this._surveyManager)===null||e===void 0||(t=e.dispose)===null||t===void 0||t.call(e),this._surveyManager=null,this.Ea=[],this.Pa.forEach(B=>{B.active=!1}),this.Pa=[],(o=this.ja)===null||o===void 0||o.call(this),this.ja=void 0,this.Ra=null,this.Fa.forEach(B=>clearTimeout(B)),this.Fa.clear())}get Ar(){return this.Ta.get()}getRenderContext(){if(!this.xa)return;const A=this;return{client:this.xa,get config(){return A.Ar},surveys:A}}initialize(){this.loadIfEnabled()}reset(){var A,I;(A=this._surveyManager)===null||A===void 0||(I=A.clearInMemoryInProgressSurveyState)===null||I===void 0||I.call(A);try{var e;(e=this._surveyEventReceiver)===null||e===void 0||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let o=0;o<localStorage.length;o++){const B=localStorage.key(o);(B?.startsWith("seenSurvey_")||B?.startsWith("inProgressSurvey_"))&&t.push(B)}t.forEach(o=>localStorage.removeItem(o))}catch{}this.Oa()}loadIfEnabled(){if(this.Ci||!this.xa)return;const A=this.Ar;if(this._surveyManager)return;if(this.Ia)return void yn.info("Already initializing surveys, skipping...");if(A.disableSurveys)return void yn.info(dwg);if(A.cookielessMode&&this.xa.isOptedOut)return void yn.info("Not loading surveys in cookieless mode without consent.");const I=this.Ta.getExtensions();if(!I)return void this.Ba("PostHog Extensions not found.");if(Le(this.Da)&&!A.advancedEnableSurveys)return;const e=this.Da||A.advancedEnableSurveys;this.Ia=!0,this.Ma=!1;try{const t=I.generateSurveys;if(t)return this.za(t,e),void(this.Ia=!1);const o=I.loadExternalDependency;if(!o)return this.Ba(QRA),void(this.Ia=!1);o(B=>{try{if(this.Ci)return;const C=this.Ta.getExtensions();B||!C?.generateSurveys?this.Ba("Could not load surveys script",B):this.za(C.generateSurveys,e)}finally{this.Ia=!1}})}catch(t){throw this.Ia=!1,this.Ba("Error initializing surveys",t),t}}za(A,I){var e;if(this.Ci)return;this._surveyManager=A(I),this._surveyEventReceiver=this.Ha(this.xa,this.Oa);const t=(e=this.xa)===null||e===void 0?void 0:e.kv.get(lV);t&&this.Ua(t),yn.info("Surveys loaded successfully"),this.Wa(),this.Oa(),this.Va({isLoaded:!0})}Ha(A,I){return new nXI(A,this,void 0,I)}Ba(A,I){this.Ma=!0,yn.error(A,I),this.Oa({isLoaded:!1,error:A}),this.Va({isLoaded:!1,error:A})}onSurveysLoaded(A){return this.Ea.push(A),this._surveyManager&&this.Va({isLoaded:!0}),()=>{this.Ea=this.Ea.filter(I=>I!==A)}}getSurveys(A,I=!1){if(this.Ci)return;const e=this.xa;if(!e)return A([],{isLoaded:!1,error:tH});if(this.Ar.disableSurveys)return yn.info(dwg),A([]);const t=e.kv.get(lV);if(t&&!I)return A(t,{isLoaded:!0}),void(this.Ga()&&this.getSurveys(()=>{},!0));if(this.Ra)return void this.Ra.then(({surveys:C,context:Q})=>{this.Ci||A(C,Q)}).catch(C=>yn.error("Error in survey callback",C));const o=e.sendRequest("/api/surveys/",{method:"GET",query:{token:e.projectToken},sentAt:"query",timeoutMs:this.Ar.requestTimeoutMs}).then(C=>{try{return this.Qa(e,C)}catch(Q){return yn.error("Error processing surveys response",Q),this.Qa(e,{statusCode:0,error:Q})}},C=>this.Qa(e,{statusCode:0,error:C}));this.Ra=o;const B=()=>{this.Ra===o&&(this.Ra=null)};o.then(C=>{B(),this.Ci||(this.Oa(C.context),A(C.surveys,C.context))},B).catch(C=>yn.error("Error in survey callback",C))}Qa(A,I){if(this.Ci)return{surveys:[],context:{isLoaded:!1,error:tH}};const e=I.statusCode;if(e!==200||!I.json){const o=`Surveys API could not be loaded, status: ${e}`;return e!==0?yn.error(o):I.error||yn.warn(o),this.Aa=Date.now(),{surveys:[],context:{isLoaded:!1,error:o}}}this.Aa=null;const t=I.json.surveys||[];return A.kv.set({[lV]:t,[PCA]:Date.now()}),this.Ua(t),{surveys:t,context:{isLoaded:!0}}}Ua(A){const I=A.filter(e=>(function(t){return!(!t.start_date||t.end_date)})(e)&&(zyg(e)||(function(t){var o;return!!(!((o=t.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0)&&o.length)})(e)));this.Za(I)}Za(A){var I;(I=this._surveyEventReceiver)===null||I===void 0||I.replace(A)}Ga(){return this.Ja()&&!this.Ra&&!this.Ka()}Ja(){var A;const I=(A=this.xa)===null||A===void 0?void 0:A.kv.get(PCA);return $h(I)&&Date.now()-I>3e5}Ka(){return $h(this.Aa)&&3e5>Date.now()-this.Aa}markSurveyAsSeen(A,I){var e;const t={id:A,current_iteration:(e=I?.iteration)!==null&&e!==void 0?e:null};gwg(t);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this.Oa()}Va(A){for(const I of this.Ea){if(this.Ci)return;try{A.isLoaded?this.getSurveys(I):I([],A)}catch(e){yn.error("Error in survey callback",e)}}}getActiveMatchingSurveys(A,I=!1){if(!rC(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(A,I);yn.warn("init was not called")}onActiveMatchingSurveysChanged(A){var I;if(this.Ci)return()=>{};const e={callback:A,active:!0,revision:0};this.Pa.push(e),this.Wa();const t=(I=this.xa)===null||I===void 0?void 0:I.kv.get(lV);return this.Ar.disableSurveys||!this._surveyManager&&this.Ma&&!this.Ia||!t&&!rC(this.Aa)&&!this.Ra?this.La(e,{isLoaded:!1}):this._surveyManager&&this.La(e),()=>{var o;e.active=!1,this.Pa=this.Pa.filter(B=>B!==e),this.Pa.length===0&&((o=this.ja)===null||o===void 0||o.call(this),this.ja=void 0)}}Wa(){var A,I,e;this._surveyManager&&this.Pa.length>0&&((A=this.ja)!==null&&A!==void 0||(this.ja=(I=(e=this.Ta).onMatchingConditionsChanged)===null||I===void 0?void 0:I.call(e,this.Oa)))}La(A,I){if(this.Ci||!A.active)return;const e=++A.revision,t=o=>{if(!this.Ci&&A.active&&e===A.revision)try{const B=I??{isLoaded:!0},C=JSON.stringify([o,B]);if(C===A.lastResult)return;A.lastResult=C,A.callback(o,B)}catch(B){yn.error("Error in active matching surveys callback",B)}};try{I&&!I.isLoaded?t([]):this.getActiveMatchingSurveys(t)}catch(o){yn.error("Error in active matching surveys callback",o)}}Xa(A){let I=null;return this.getSurveys(e=>{var t;I=(t=e.find(o=>o.id===A))!==null&&t!==void 0?t:null}),I}Ya(A){if(rC(this._surveyManager))return{eligible:!1,reason:tH};const I=typeof A=="string"?this.Xa(A):A;return I?this._surveyManager.checkSurveyEligibility(I):{eligible:!1,reason:"Survey not found"}}tl(A){var I;if(!(!((I=this.xa)===null||I===void 0)&&I.canCapture))return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(rC(this._surveyManager))return{eligible:!1,reason:tH};const e=typeof A=="string"?this.Xa(A):A;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(A){if(rC(this._surveyManager))return yn.warn("init was not called"),{visible:!1,disabledReason:tH};const I=this.tl(A);return{visible:I.eligible,disabledReason:I.reason}}canRenderSurveyAsync(A,I){return rC(this._surveyManager)?(yn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:tH})):new Promise(e=>{this.getSurveys(t=>{var o;const B=(o=t.find(C=>C.id===A))!==null&&o!==void 0?o:null;if(B){const C=this.tl(B);e({visible:C.eligible,disabledReason:C.reason})}else e({visible:!1,disabledReason:"Survey not found"})},I)})}renderSurvey(A,I,e){var t,o,B;if(!(!((t=this.xa)===null||t===void 0)&&t.canCapture))return;if(rC(this._surveyManager))return void yn.warn("init was not called");const C=typeof A=="string"?this.Xa(A):A;if(!C?.id)return void yn.warn("Survey not found");if(!YzI.includes(C.type))return void yn.warn(`Surveys of type ${C.type} cannot be rendered in the app`);const Q=(o=typeof document>"u"?void 0:document)===null||o===void 0?void 0:o.querySelector(I);if(Q){if(!((B=C.appearance)===null||B===void 0)&&B.surveyPopupDelaySeconds){yn.info(`Rendering survey ${C.id} with delay of ${C.appearance.surveyPopupDelaySeconds} seconds`);const i=setTimeout(()=>{var E,n,s;this.Fa.delete(i),!this.Ci&&(!((E=this.xa)===null||E===void 0)&&E.canCapture)&&(yn.info(`Rendering survey ${C.id} with delay of ${(n=C.appearance)===null||n===void 0?void 0:n.surveyPopupDelaySeconds} seconds`),(s=this._surveyManager)===null||s===void 0||s.renderSurvey(C,Q,e),yn.info(`Survey ${C.id} rendered`))},1e3*C.appearance.surveyPopupDelaySeconds);return void this.Fa.add(i)}this._surveyManager.renderSurvey(C,Q,e)}else yn.warn("Survey element not found")}displaySurvey(A,I){var e,t;if(!(!((e=this.xa)===null||e===void 0)&&e.canCapture))return;if(rC(this._surveyManager))return void yn.warn("init was not called");const o=this.Xa(A);if(!o)return void yn.warn("Survey not found");let B=o;if(!((t=o.appearance)===null||t===void 0)&&t.surveyPopupDelaySeconds&&I.ignoreDelay&&(B=QI(QI({},o),{},{appearance:QI(QI({},o.appearance),{},{surveyPopupDelaySeconds:0})})),I.displayType!==ORA.Popover&&I.initialResponses&&yn.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),I.ignoreConditions===!1){const C=this.Ya(o);if(!C.eligible)return void yn.warn("Survey is not eligible to be displayed: ",C.reason)}I.displayType!==ORA.Inline?this._surveyManager.handlePopoverSurvey(B,I):this.renderSurvey(B,I.selector,I.properties)}cancelPendingSurvey(A){rC(this._surveyManager)?yn.warn("init was not called"):this._surveyManager.cancelSurvey(A)}handlePageUnload(){var A,I;(A=this._surveyManager)===null||A===void 0||(I=A.handlePageUnload)===null||I===void 0||I.call(A)}},aXI=class{constructor(A){this._instance=A}get(){var A,I,e,t;const o=(A=this._instance)===null||A===void 0?void 0:A.config;return{disableSurveys:!!o?.disable_surveys,cookielessMode:!!o?.cookieless_mode,advancedEnableSurveys:!!o?.advanced_enable_surveys,requestTimeoutMs:(I=o?.surveys_request_timeout_ms)!==null&&I!==void 0?I:1e4,prefillFromUrl:!!(!(o==null||(e=o.surveys)===null||e===void 0)&&e.prefillFromUrl),automaticDisplay:!o?.disable_surveys_automatic_display,featureFlagEvaluation:!o?.advanced_disable_feature_flags,overrideLanguage:o?.override_display_language,prepareStylesheet:o?.prepare_external_dependency_stylesheet,get_current_url:o?.get_current_url,uiHost:(t=this._instance)===null||t===void 0||(t=t.requestRouter)===null||t===void 0?void 0:t.endpointFor("ui","")}}getExtensions(){const A=FB?.__PosthogExtensions__;if(!A||!this._instance)return;const I=this._instance,{generateSurveys:e,loadExternalDependency:t}=A;return{generateSurveys:e?o=>e(I,o):void 0,loadExternalDependency:t?o=>t(I,"surveys",o):void 0}}onMatchingConditionsChanged(A){var I,e;const t=(I=this._instance)===null||I===void 0?void 0:I._addCaptureHook(Q=>{Q!=="$pageview"&&Q!==mM.SHOWN&&Q!==mM.DISMISSED&&Q!==mM.SENT||A()}),o=()=>A();GE(Me,"PHSurveyShown",o);let B=!1;const C=(e=this._instance)===null||e===void 0?void 0:e.onFeatureFlags(()=>{B&&A()});return B=!0,()=>{B=!1,t?.(),C?.(),Me?.removeEventListener("PHSurveyShown",o)}}};const rXI=Me?.location?qCA(Me.location.hash,"__posthog")||qCA(location.hash,"state"):null,ywg="_postHogToolbarParams",wwg=qr("[Toolbar]"),uwg=qr("[FeatureFlags]"),fY=qr("[FeatureFlags]",{debugEnabled:!0}),hNA=`" failed. Feature flags didn't load in time.`,cXI=[502,504],Gwg=["click","keydown","wheel","touchstart","pointerdown"],mwg="connection_error",pwg=g=>{const A={};for(let I=0;g.length>I;I++)A[g[I]]=!0;return A},kwg=g=>{const A={};for(const[I,e]of HCA(g||{}))e&&(A[I]=e);return A};var hXI=class{constructor(A){this.name="featureFlags",this.md=!1,this.featureFlagEventHandlers=[],this.$=uwg,this.yd={},this.bd={},this._d=[],this.wd=new Set,this.kd=new Set,this.Sd=!1,this.xd=!1,this.$d=0,this.Cd=!1,this.Td=!1,this.Id=!1,this.Md=!1,this.Ed=!1,this.Pd=0,this.Rd=!1,this.rn=()=>{const I=this.Ad();this.Pd=0,I&&this.reloadFeatureFlags()},this.Fd=()=>{var I,e;const t=this.Od,o=(I=this.Dd)!==null&&I!==void 0?I:t;Le(t)||Le(o)||this.Ar.remoteRequestsDisabled||!this.Ld||this.Ld.visibilityState==="hidden"||Date.now()-((e=this.Nd)!==null&&e!==void 0?e:0)<o||(this.Dd=this.Rd||!this.Ar.idleRefreshBackoff?t:Math.min(2*o,36e5),this.Rd=!1,this.reloadFeatureFlags(),this.qd())},this.jd=()=>{this.Rd&&this.Dd===this.Od||this.Bd()},this.sn=()=>{var I;((I=this.Ld)===null||I===void 0?void 0:I.visibilityState)==="visible"&&this.Bd()},this.Ta=A}get zd(){}Hd(){this.xa&&this.Ud()}setup(A){try{this.Wd=typeof window>"u"?void 0:window,this.Ld=typeof document>"u"?void 0:document}catch{this.Wd=void 0,this.Ld=void 0}return this.Na=A,this.$=A.logger.createLogger("[FeatureFlags]"),cNA(A.kv.initialize(),()=>{this.Na===A&&(this.Na=void 0,this.xa=A,this.Vd(A))})}Vd(A){var I;if(this.xa===A)return this.Wd&&GE(this.Wd,"online",this.rn),this.Ud(),this.Gd=A.registerDynamicEventProperties(()=>this.Qd()?this.yd:this.bd),this.Zd=(I=this.zd)===null||I===void 0?void 0:I.onCrossTabFeatureFlagChange(()=>{this.Jd(),this.Kd(),this.Xd()}),this.Kd(),this.initialize()}Bd(){this.Rd=!0,this.Dd=this.Od,this.Fd()}Ud(){var A;const I=this.Ar.refreshIntervalMs,e=!this.Ar.remoteRequestsDisabled&&this.Ld&&!Le(I)&&I>0?I:void 0;this.Ar.idleRefreshBackoff||(this.Dd=e),e!==this.Od&&(this.Yd(),Le(e)||(this.Od=e,this.Dd=e,this.qd(),!((A=this.Ld)===null||A===void 0)&&A.addEventListener&&(GE(this.Ld,L9,this.sn),H9(Gwg,t=>{GE(this.Ld,t,this.jd,{capture:!0})}))))}qd(){Le(this.Od)||(Le(this.tv)||clearInterval(this.tv),this.Nd=Date.now(),this.tv=setInterval(this.Fd,this.Od))}Yd(){var A,I;Le(this.tv)||(clearInterval(this.tv),this.tv=void 0,(A=this.Ld)===null||A===void 0||(I=A.removeEventListener)===null||I===void 0||I.call(A,"visibilitychange",this.sn),H9(Gwg,e=>{var t,o;(t=this.Ld)===null||t===void 0||(o=t.removeEventListener)===null||o===void 0||o.call(t,e,this.jd,{capture:!0})})),this.Od=void 0,this.Dd=void 0,this.Rd=!1,this.Nd=void 0}destroy(){this.ev()}dispose(){this.ev()}ev(){var A,I,e;this.Yd(),this.$d++,this.Td=!1,this.Na=void 0,this.iv(this.wd,"cancelled"),this.iv(this.kd,"cancelled"),this.xa&&(this.nv(),(A=this.Gd)===null||A===void 0||A.dispose(),this.Gd=void 0,(I=this.Zd)===null||I===void 0||I.call(this),this.Zd=void 0,this._d=[],(e=this.Wd)===null||e===void 0||e.removeEventListener("online",this.rn),this.xa=void 0)}get Ar(){return this.Ta.get()}sv(A){var I;return this.rv&&A in this.rv?this.rv[A]:(I=this.xa)===null||I===void 0?void 0:I.kv.get(A)}Jd(){return!!this.rv&&(this.rv=void 0,!0)}ov(){var A;return!Le((A=this.xa)===null||A===void 0?void 0:A.kv.get("$enabled_feature_flags"))&&this.Jd()}At(A){this.av(()=>{var I;return(I=this.xa)===null||I===void 0?void 0:I.kv.set(A)})}lv(A,I,e){if(!this.zd||!A.$enabled_feature_flags)return;const t=this.sv("$enabled_feature_flags")||{},o=A.$enabled_feature_flags||{},B=I.flags||I.featureFlags,C=I.flags?Object.entries(I.flags).filter(([,l])=>!l?.failed).map(([l])=>l):[],Q=!!I.errorsWhileComputingFlags&&!!I.flags,i=Q?C:e&&!aB(B)?Object.keys(B||{}):Array.from(new Set([...Object.keys(t),...Object.keys(o)])),E=this.sv("$feature_flag_payloads")||{},n=A.$feature_flag_payloads||{},s=Q||e?i:Array.from(new Set([...Object.keys(E),...Object.keys(n)])),r=!Q&&!e,a=!!r||i,c=!!r||s,h={[vF]:a,[xf]:a,[O4]:c};A.$feature_flag_details&&(h[wY]=a);for(const l of[uY,q4,cV])Le(A[l])||(h[l]=!0);this.zd.markCrossTabFeatureFlagChanges(h)}Pt(A){this.av(()=>{var I;return(I=this.xa)===null||I===void 0?void 0:I.kv.remove(A)})}av(A){try{A()}catch(I){this.$.error("Failed to update feature flag persistence",I)}}Kd(){const A={};for(const t of[vF,O4,uY,UN]){const o=this.sv(t);Le(o)||(A[t]=o)}this.yd=A;const I=QI({},A),e=this.sv(xf);if(e)for(const[t,o]of Object.entries(e))I[`$feature/${t}`]=o;this.bd=I}Qd(){const A=this.Ar.cacheTtlMs;if(!A||0>=A)return!1;const I=this.sv(q4);return typeof I!="number"||Date.now()-I>A}uv(){return!!this.Qd()&&(this.Ed||this.xd||(this.Ed=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hv(){const A=this.Ar.evaluationContexts;return A?.length?A.filter(I=>{const e=I&&typeof I=="string"&&I.trim().length>0;return e||this.$.error("Invalid evaluation context found:",I,"Expected non-empty string"),e}):[]}dv(){const A=this.Ar.flagKeys;if(!Le(A))return A.filter(I=>{const e=I&&typeof I=="string"&&I.trim().length>0;return e||this.$.error("Invalid flag key found:",I,"Expected non-empty string"),e})}initialize(){var A,I;const e=this.Ar,t=(A=(I=e.bootstrap)===null||I===void 0?void 0:I.featureFlags)!==null&&A!==void 0?A:{};if(Object.keys(t).length){var o,B;const C=(o=(B=e.bootstrap)===null||B===void 0?void 0:B.featureFlagPayloads)!==null&&o!==void 0?o:{},Q=Object.keys(t).filter(E=>!Le(t[E])).reduce((E,n)=>(E[n]=t[n],E),{}),i=Object.keys(C).filter(E=>Q[E]).reduce((E,n)=>(E[n]=C[n],E),{});return this.vv({featureFlags:Q,featureFlagPayloads:i},void 0,{persist:!1})}}updateFlags(A,I,e){var t,o;const B=e?.merge&&(t=this.sv("$enabled_feature_flags"))!==null&&t!==void 0?t:{},C=e?.merge&&(o=this.sv("$feature_flag_payloads"))!==null&&o!==void 0?o:{},Q=QI(QI({},B),A),i=QI(QI({},C),I),E={};for(const[n,s]of Object.entries(Q))E[n]={key:n,enabled:UDg(s),variant:JDg(s),reason:void 0,metadata:Le(i?.[n])?void 0:{id:0,version:void 0,description:void 0,payload:i[n]}};this.vv({flags:E})}get hasLoadedFlags(){return this.Sd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const A=this.sv(wY),I=this.sv(UN),e=this.sv(GY);if(!e&&!I)return A||{};const t=Qr({},A||{}),o=[...new Set([...Object.keys(e||{}),...Object.keys(I||{})])];for(const Q of o){var B,C;const i=t[Q],E=I?.[Q],n=Le(E)?(B=i?.enabled)!==null&&B!==void 0&&B:!!E,s=Le(E)?i?.variant:typeof E=="string"?E:void 0,r=e?.[Q],a=QI(QI({},i),{},{enabled:n,variant:n?s??i?.variant:void 0});n!==i?.enabled&&(a.original_enabled=i?.enabled),s!==i?.variant&&(a.original_variant=i?.variant),r&&(a.metadata=QI(QI({},i?.metadata),{},{payload:r,original_payload:i==null||(C=i.metadata)===null||C===void 0?void 0:C.payload})),t[Q]=a}return this.md||(this.$.warn(" Overriding feature flag details!",{flagDetails:A,overriddenPayloads:e,finalDetails:t}),this.md=!0),t}getAllFeatureFlags(){const A=this.getFlagVariants(),I=this.getFlagPayloads();return Object.keys(A).map(e=>{const t=A[e];return{key:e,enabled:UDg(t),variant:JDg(t),payload:FDg(I[e])}})}getFlagVariants(){const A=this.sv(xf),I=this.sv(UN);if(!I)return A||{};const e=Qr({},A||{}),t=Object.keys(I);for(let o=0;t.length>o;o++)e[t[o]]=I[t[o]];return this.md||(this.$.warn(" Overriding feature flags!",{enabledFlags:A,overriddenFlags:I,finalFlags:e}),this.md=!0),e}getFlagPayloads(){const A=this.sv(O4),I=this.sv(GY);if(!I)return A||{};const e=Qr({},A||{}),t=Object.keys(I);for(let o=0;t.length>o;o++)e[t[o]]=I[t[o]];return this.md||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:A,overriddenPayloads:I,finalPayloads:e}),this.md=!0),e}reloadFeatureFlags(){this.Cd||this.Ar.featureFlagsDisabled||this.Ad()||(this.Id&&this.$.warn("reloadFeatureFlags() was called inside an onFeatureFlags callback. This callback also runs when flags change in other tabs, so this can cause a request loop."),this.xd&&(this.Td=!0),this.fv||(this._d.slice().forEach(A=>{try{A()}catch(I){this.$.error("Error while running feature flags reloading callback",I)}}),this.fv=setTimeout(()=>{this.pv()},5)))}reloadFeatureFlagsAsync(){return!this.xa||this.Cd||this.Ar.featureFlagsDisabled||this.Ar.remoteRequestsDisabled||this.Ad()?Promise.resolve({status:"skipped"}):new Promise(A=>{this.wd.add(A),this.reloadFeatureFlags()})}iv(A,I){A.forEach(e=>e({status:I})),A.clear()}nv(){clearTimeout(this.fv),this.fv=void 0}onReloading(A){return this._d.push(A),()=>{this._d=this._d.filter(I=>I!==A)}}ensureFlagsLoaded(){this.Sd||this.xd||this.fv||this.reloadFeatureFlags()}setAnonymousDistinctId(A){this.$anon_distinct_id=A}setReloadingPaused(A){this.Cd=A}resetFlagCallReported(){this.Pt(qF)}pv(A){var I;this.nv();const e=this.xa;if(!e||this.Ar.remoteRequestsDisabled||this.Ad())return void this.iv(this.wd,"skipped");if(this.xd)return void(this.Td=!0);const t={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:QI(QI(QI({},e.initialPersonProperties),this.sv("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.sv(T4),timezone:Qyg()};Le(e.deviceId)||(t.$device_id=e.deviceId),(A?.disableFlags||this.Ar.featureFlagsDisabled)&&(t.disable_flags=!0);const o=this.hv();o.length&&(t.evaluation_contexts=o);const B=this.dv();Le(B)||(t.flag_keys=B);const C=this.Ar.onlyEvaluateSurveyFeatureFlags,Q="/flags/?v=2"+(C?"&only_evaluate_survey_feature_flags=true":""),i=this.$d,E=this.wd;this.wd=new Set,this.kd=E,this.xd=!0;const n=()=>{this.Td&&(this.Td=!1,this.pv())},s=l=>{var D,d;const y=(D=l.json)!==null&&D!==void 0?D:{},w=l.statusCode!==200;if(this.xd=!1,i!==this.$d)return void n();if(this.gv(l.statusCode),w||this.Td||(this.$anon_distinct_id=void 0),t.disable_flags&&!this.Td)return void this.iv(E,"skipped");this.Md=!w;const u=[];l.error?u.push(l.error instanceof Error&&l.error.name==="AbortError"?"timeout":l.error instanceof Error?mwg:"unknown_error"):l.statusCode!==200&&u.push(`api_error_${l.statusCode}`),y.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");const G=!!(!((d=y.quotaLimited)===null||d===void 0)&&d.includes("feature_flags"));G&&u.push("quota_limited"),this.At({[rV]:u}),G?this.$.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."):t.disable_flags||this.vv(y,w,{partialResponse:C}),this.iv(E,t.disable_flags?"skipped":u.length||!y.flags&&!y.featureFlags?"error":"loaded"),n()},r=l=>{this.xd=!1,i===this.$d&&(this.At({[rV]:[mwg]}),this.$.error("Feature flag request failed",l),this.ov()&&this.Xd(!0),this.iv(E,"error")),n()};let a=(I=this.Ar.requestMaxRetries)!==null&&I!==void 0?I:1;const c=()=>a>0&&i===this.$d,h=()=>{if(i!==this.$d||!this.xa||this.Ar.remoteRequestsDisabled)return this.xd=!1,this.iv(E,"skipped"),void n();try{e.sendRequest(Q,{target:"flags",method:"POST",body:t,compression:this.Ar.compression,sentAt:"body",timeoutMs:this.Ar.requestTimeoutMs}).then(l=>{if((D=>cXI.includes(D.statusCode)||(d=>d.statusCode===0&&d.error instanceof Error&&d.error.name==="AbortError")(D))(l)&&c())return a--,void setTimeout(h,500);s(l)}).catch(r)}catch(l){r(l)}};h()}Ad(){return Eyg(this.Pd,3)}gv(A){this.Pd=nyg(A,this.Pd,3,()=>this.$.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(A,I={}){var e;if(I.fresh&&!this.Md)return;if(!(this.Sd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+A+hNA);if(this.uv())return;const t=this.getFeatureFlagResult(A,I);return(e=t?.variant)!==null&&e!==void 0?e:t?.enabled}getFeatureFlagDetails(A){return this.getFlagsWithDetails()[A]}getFeatureFlagPayload(A){const I=this.getFeatureFlagResult(A,{send_event:!1});return I?.payload}getFeatureFlagResult(A,I={}){if(I.fresh&&!this.Md)return;if(!(this.Sd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+A+hNA);if(this.uv())return;const e=this.getFlagVariants(),t=A in e,o=e[A],B=this.getFlagPayloads()[A],C=String(o),Q=this.sv("$feature_flag_request_id")||void 0,i=this.sv("$feature_flag_evaluated_at")||void 0;let E,n=this.sv("$flag_call_reported")||{};if(this.Ar.deduplicateCallsPerSession){var s;const R=(s=this.xa)===null||s===void 0||(s=s.session)===null||s===void 0?void 0:s.sessionId,x=this.sv(hV);R&&R!==x&&(n={},E=R)}if(!I.send_event&&"send_event"in I)E&&this.At({[qF]:n,[hV]:E});else{var r,a;const R=(r=this.xa)===null||r===void 0?void 0:r.canCapture;if(!R&&Object.keys(n).length>0&&(n={},this.At({[qF]:n})),R&&!(!((a=n[A])===null||a===void 0)&&a.includes(C))){var c,h,l,D,d,y,w,u,G,m,p,k,S;aB(n[A])?n[A].push(C):n[A]=[C],this.At(QI({[qF]:n},E?{[hV]:E}:{}));const x=this.getFeatureFlagDetails(A),N=[...(c=this.sv("$feature_flag_errors"))!==null&&c!==void 0?c:[]];Le(o)&&N.push("flag_missing");const U={$feature_flag:A,$feature_flag_response:o,$feature_flag_payload:B??null,$feature_flag_request_id:Q,$feature_flag_evaluated_at:i,$feature_flag_bootstrapped_response:(h=(l=this.Ar.bootstrap)===null||l===void 0||(l=l.featureFlags)===null||l===void 0?void 0:l[A])!==null&&h!==void 0?h:null,$feature_flag_bootstrapped_payload:(D=(d=this.Ar.bootstrap)===null||d===void 0||(d=d.featureFlagPayloads)===null||d===void 0?void 0:d[A])!==null&&D!==void 0?D:null,$used_bootstrap_value:!this.Md};Le(x==null||(y=x.metadata)===null||y===void 0?void 0:y.has_experiment)||(U.$feature_flag_has_experiment=x.metadata.has_experiment),Le(x==null||(w=x.metadata)===null||w===void 0?void 0:w.version)||(U.$feature_flag_version=x.metadata.version);const K=(u=x==null||(G=x.reason)===null||G===void 0?void 0:G.description)!==null&&u!==void 0?u:x==null||(m=x.reason)===null||m===void 0?void 0:m.code;K&&(U.$feature_flag_reason=K),!(x==null||(p=x.metadata)===null||p===void 0)&&p.id&&(U.$feature_flag_id=x.metadata.id),Le(x?.original_variant)&&Le(x?.original_enabled)||(U.$feature_flag_original_response=Le(x.original_variant)?x.original_enabled:x.original_variant),!(x==null||(k=x.metadata)===null||k===void 0)&&k.original_payload&&(U.$feature_flag_original_payload=x==null||(S=x.metadata)===null||S===void 0?void 0:S.original_payload),N.length&&(U.$feature_flag_error=N.join(",")),this.mv(U)}else E&&this.At({[qF]:n,[hV]:E})}return t?{key:A,enabled:!!o,variant:typeof o=="string"?o:void 0,payload:FDg(B)}:void 0}mv(A){try{var I;(I=this.xa)===null||I===void 0||I.capture("$feature_flag_called",A)}catch(e){this.$.error("Failed to capture feature flag call",e)}}getRemoteConfigPayload(A,I){this.yv(A,I)}yv(A,I){var e=this;return oa(function*(){const t=e.xa;if(!t)return;const o={distinct_id:t.distinctId,token:t.projectToken,person_properties:{$lib:t.library.name,$lib_version:t.library.version}},B=e.hv();B.length&&(o.evaluation_contexts=B);const C=e.dv();let Q;Le(C)||(o.flag_keys=C);try{var i;const E=(i=(yield t.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:o,compression:e.Ar.compression,sentAt:"body",timeoutMs:e.Ar.requestTimeoutMs})).json)===null||i===void 0?void 0:i.featureFlagPayloads;Q=E?.[A]||void 0}catch(E){return void e.$.error("Remote config feature flag request failed",E)}try{I(Q)}catch(E){e.$.error("Remote config feature flag callback failed",E)}})()}isFeatureEnabled(A,I={}){if(I.fresh&&!this.Md)return I.defaultValue;if(!(this.Sd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+A+hNA),I.defaultValue;const e=this.getFeatureFlag(A,I);return Le(e)?I.defaultValue:!!e}addFeatureFlagsHandler(A){this.featureFlagEventHandlers.push(A)}removeFeatureFlagsHandler(A){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(I=>I!==A)}receivedFeatureFlags(A,I,e){this.vv(A,I,e)}vv(A,I,e){if(!this.xa)return;this.Sd=!0;const t=((o,B={},C={},Q={},i,E=uwg)=>{const n=((y,w)=>{const u=y.flags;if(u){const G=Object.fromEntries(Object.keys(u).map(p=>{var k;return[p,(k=u[p].variant)!==null&&k!==void 0?k:u[p].enabled]})),m=Object.fromEntries(Object.keys(u).filter(p=>u[p].enabled).filter(p=>{var k;return!Le((k=u[p].metadata)===null||k===void 0?void 0:k.payload)}).map(p=>{var k;return[p,(k=u[p].metadata)===null||k===void 0?void 0:k.payload]}));return QI(QI({},y),{},{featureFlags:G,featureFlagPayloads:m})}return y.featureFlags&&w.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),y})(o,E),s=n.flags,r=n.featureFlags,a=n.featureFlagPayloads;if(!r)return;const c=o.requestId,h=o.evaluatedAt;if(aB(r)){E.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const y={};if(r)for(let w=0;r.length>w;w++)y[r[w]]=!0;return{[vF]:r,[xf]:y,[cV]:!1}}let l=r,D=a,d=s;if(i?.partialResponse){const y=Object.keys(l),w=D||{};l=QI(QI({},B),l),D=QI(QI({},C),w),y.forEach(u=>{u in w||D==null||delete D[u]}),d=QI(QI({},Q),d)}else if(o.errorsWhileComputingFlags)if(s){const y=new Set(Object.keys(s).filter(u=>{var G;return!(!((G=s[u])===null||G===void 0)&&G.failed)}));l=QI(QI({},B),Object.fromEntries(Object.entries(l).filter(([u])=>y.has(u))));const w=Object.fromEntries(Object.entries(D||{}).filter(([u])=>y.has(u)));D=QI(QI({},C),w),y.forEach(u=>{u in w||D==null||delete D[u]}),d=QI(QI({},Q),Object.fromEntries(Object.entries(d||{}).filter(([u])=>y.has(u))))}else l=QI(QI({},B),l),D=QI(QI({},C),D),d=QI(QI({},Q),d);return QI(QI({[vF]:Object.keys(kwg(l)),[xf]:l||{},[O4]:D||{},[wY]:d||{},[cV]:o.minimalFlagCalledEvents===!0},c?{[uY]:c}:{}),h?{[q4]:h}:{})})(A,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.$);if(t)if(e?.persist===!1){const o=!Le(this.xa.kv.get(xf));this.rv=t,o||this.At(t)}else this.Jd(),this.lv(t,A,!!e?.partialResponse),this.At(t);else I&&this.ov();I||(this.Ed=!1),this.Xd(I)}override(A,I=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:A,suppressWarning:I})}overrideFeatureFlags(A){this.bv(A)}bv(A){if(this.xa){if(A===!1)return this.Pt([UN,GY]),this.Xd(),void fY.info("All overrides cleared");if(aB(A))return this.At({[UN]:pwg(A)}),this.Xd(),void fY.info("Flag overrides set",{flags:A});if(A&&typeof A=="object"&&("flags"in A||"payloads"in A)){var I;const e=A;this.md=!!((I=e.suppressWarning)!==null&&I!==void 0&&I);const t={},o=e.flags,B=e.payloads;return o&&(t[UN]=aB(o)?pwg(o):o),B&&(t[GY]=B),Object.keys(t).length&&this.At(t),o===!1&&B===!1?this.Pt([UN,GY]):o===!1?this.Pt(UN):B===!1&&this.Pt(GY),this.Xd(),o===!1?fY.info("Flag overrides cleared"):o&&fY.info("Flag overrides set",{flags:o}),void(B===!1?fY.info("Payload overrides cleared"):B&&fY.info("Payload overrides set",{payloads:B}))}if(A&&typeof A=="object")return this.At({[UN]:A}),this.Xd(),void fY.info("Flag overrides set",{flags:A});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:A})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(A){if(this.addFeatureFlagsHandler(A),this.Sd){const{flags:I,flagVariants:e}=this._v();try{A(I,e)}catch(t){this.$.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(A)}updateEarlyAccessFeatureEnrollment(A,I,e){var t;const o=(this.sv("$early_access_features")||[]).find(E=>E.flagKey===A),B={[`$feature_enrollment/${A}`]:I},C={$feature_flag:A,$feature_enrollment:I,$set:B};o&&(C.$early_access_feature_name=o.name),e&&(C.$feature_enrollment_stage=e);const Q=QI(QI({},this.getFlagVariants()),{},{[A]:I});(t=this.zd)===null||t===void 0||t.markCrossTabFeatureFlagChanges({$active_feature_flags:[A],$enabled_feature_flags:[A],$stored_person_properties:Object.keys(B)}),this.At({[vF]:Object.keys(kwg(Q)),[xf]:Q,[Z4]:QI(QI({},this.sv("$stored_person_properties")||{}),B)}),this.Xd();try{var i;(i=this.xa)===null||i===void 0||i.capture("$feature_enrollment_update",C)}catch(E){this.$.error("Failed to capture early access feature enrollment",E)}}getEarlyAccessFeatures(A,I=!1,e){const t=this.sv(CRA);!t||I?this.wv(A,e):A(t)}wv(A,I){var e=this;return oa(function*(){const t=e.xa;if(!t)return;const o=I?`&${I.map(C=>`stage=${C}`).join("&")}`:"";let B;try{const C=yield t.sendRequest(`/api/early_access_features/?token=${t.projectToken}${o}`,{target:"api",method:"GET",sentAt:"query"});if(!C.json)return;B=C.json.earlyAccessFeatures,e.At({[CRA]:B})}catch(C){return void e.$.error("Early access feature request failed",C)}try{A(B)}catch(C){e.$.error("Early access feature callback failed",C)}})()}_v(){const A=this.getFlags(),I=this.getFlagVariants();return{flags:A.filter(e=>I[e]),flagVariants:Object.keys(I).filter(e=>I[e]).reduce((e,t)=>(e[t]=I[t],e),{})}}Xd(A){this.Kd();const{flags:I,flagVariants:e}=this._v(),t=this.Id;this.Id=!0,this.featureFlagEventHandlers.forEach(o=>{try{o(I,e,{errorsLoading:A})}catch(B){this.$.error("Error while running feature flags callback",B)}}),this.Id=t}setPersonPropertiesForFlags(A,I=!0){this.Sv(A,I)}Sv(A,I=!0){const e=this.sv("$stored_person_properties")||{},t=A?.$set||(A?.$set_once?{}:A),o=A?.$set_once,B={};if(o)for(const C in o)({}).hasOwnProperty.call(o,C)&&(C in e||(B[C]=o[C]));this.At({[Z4]:QI(QI(QI({},e),B),t)}),I&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(A,I=!0){const e=QI({},this.sv("$stored_person_properties")||{});A.forEach(t=>{delete e[t]}),this.At({[Z4]:e}),I&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(A=!0){this.Pt(Z4),A&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(A,I=!0){const e=this.sv("$stored_group_properties")||{},t=QI({},e);for(const o of Object.keys(A))t[o]=QI(QI({},e[o]),A[o]);this.At({[T4]:t}),I&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(A){if(A){const I=this.sv("$stored_group_properties")||{};this.At({[T4]:QI(QI({},I),{},{[A]:{}})})}else this.Pt(T4)}reset(){this.$d++,this.iv(this.wd,"cancelled"),this.iv(this.kd,"cancelled"),this.Td=!1,this.yd={},this.bd={},this.rv=void 0,this.Sd=!1,this.Cd=!1,this.Md=!1,this.$anon_distinct_id=void 0,this.nv(),this.md=!1,this.Pd=0}};const Mwg=qr("[FeatureFlags]");var lXI=class{constructor(A,I=!1){this.xv=!1,this.update(A,I)}update(A,I){this.$v=((e,t)=>{var o,B,C,Q,i,E,n,s;return{bootstrap:{featureFlags:(o=(B=e.bootstrap)===null||B===void 0?void 0:B.featureFlags)!==null&&o!==void 0?o:void 0,featureFlagPayloads:(C=(Q=e.bootstrap)===null||Q===void 0?void 0:Q.featureFlagPayloads)!==null&&C!==void 0?C:void 0},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,refreshIntervalMs:(i=e.remote_config_refresh_interval_ms)!==null&&i!==void 0?i:3e5,idleRefreshBackoff:Le(e.remote_config_refresh_interval_ms),requestTimeoutMs:e.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(E=e.feature_flag_request_max_retries)!==null&&E!==void 0?E:1),compression:e.disable_compression?void 0:"best-available",evaluationContexts:(n=(s=e.evaluation_contexts)!==null&&s!==void 0?s:e.evaluation_environments)!==null&&n!==void 0?n:[],flagKeys:aB(e.flag_keys)?e.flag_keys:void 0}})(A,I),!A.evaluation_environments||A.evaluation_contexts||this.xv||(Mwg.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.xv=!0),Le(A.flag_keys)||aB(A.flag_keys)||Mwg.error("Invalid flag_keys found:",A.flag_keys,"Expected array of non-empty strings")}get(){return this.$v}};const Swg=g=>U9(g)&&(g.name==="RangeError"&&g.message.indexOf("Maximum call stack size exceeded")===0||g.name==="InternalError"&&g.message==="too much recursion"),Pf=qr("[Error tracking]"),lNA="webkit-masked-url:",DXI=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],dXI=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",lNA],yXI=["__firefox__","__gCrWeb"],fwg="Refusing to render web experiment since the viewer is a likely bot",wXI={icontains:(g,A)=>A.toLowerCase().indexOf(g.toLowerCase())>-1,not_icontains:(g,A)=>A.toLowerCase().indexOf(g.toLowerCase())===-1,regex:(g,A)=>$CA(A,g),not_regex:(g,A)=>!$CA(A,g),exact:(g,A)=>A===g,is_not:(g,A)=>A!==g},E2=qr("[Conversations]"),RY="Conversations not available yet.";function Rwg(g,A){var I,e,t,o,B,C,Q;const i=(I=g?.flushIntervalMs)!==null&&I!==void 0?I:3e3,E=(e=g?.maxBufferSize)!==null&&e!==void 0?e:100,n=A?.consoleCapture?void 0:(t=g?.maxLogsPerInterval)!==null&&t!==void 0?t:1e3,s=Le(n)?Math.max(E,2048):Math.max(E,n),r=QI(QI({},(function(){let a="",c="";try{var h;const l="u">typeof globalThis?globalThis:"u">typeof window?window:void 0,D=l==null||(h=l.navigator)===null||h===void 0?void 0:h.userAgent;D&&([a,c]=aDg(D))}catch{}return(function(l,D){const d=(function(y){if(y)return{}.hasOwnProperty.call(zDg,y)?zDg[y]:y})(l);return QI(QI({},d?{"os.name":d}:{}),D?{"os.version":D}:{})})(a,c)})()),g?.resourceAttributes);return{serviceName:(o=(B=r?.["service.name"])!==null&&B!==void 0?B:g?.serviceName)!==null&&o!==void 0?o:A?.serviceNameDefault,serviceVersion:(C=r?.["service.version"])!==null&&C!==void 0?C:g?.serviceVersion,environment:(Q=r?.["deployment.environment"])!==null&&Q!==void 0?Q:g?.environment,resourceAttributes:r,beforeSend:g?.beforeSend,flushIntervalMs:i,maxBufferSize:E,maxQueueSize:s,maxBatchRecordsPerPost:100,rateCapWindowMs:i,maxLogsPerInterval:n,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const uXI=["debug","log","warn","error","info"],GXI=g=>{for(;g?.__rrweb_original__;)g=g.__rrweb_original__;return g},Nwg="console",xwg="__posthogHandledLogsRequestError",DNA=(g,A)=>{const I=g instanceof Error?g:new Error(A);return I[xwg]=!0,I},Fwg=g=>!!g&&typeof g=="object"&&g[xwg]===!0;var mXI=class{get Cv(){return QI(QI({},this.$),{},{error:(...A)=>{A.some(Fwg)||this.$.error(...A)}})}constructor(A,I){var e;this.Ta=A,this.Tv=I,this.name="logs",this.Iv=!1,this.Mv=!1,this.Ev=!1,this.$=qr("[logs]"),this.Ju=[],this.Pv=[],this.Pd=0,this.Rv=!1,this.Ci=!1,this.Av=[],this.Fv=[],this.Ov=!1,this.Dv=!1,this.Lv=!1,this.Nv=()=>{var t,o;this.Ci||(this.Pd=0,(t=this.qv)===null||t===void 0||t.onReconnect(),(o=this.jv)===null||o===void 0||o.onReconnect())},this.Iv=!!(!((e=A.get())===null||e===void 0)&&e.captureConsoleLogs)}get Bv(){return!0}zv(){}Hv(){if(!this.Lv){try{this.Wd=typeof window>"u"?void 0:window}catch{this.Wd=void 0}this.Wd&&(GE(this.Wd,"online",this.Nv),this.Lv=!0)}}Uv(A,I,e,t){this.Hv();const o=Rwg(this.Ta.get(),e);return[new cjI(this.Wv(A,I),o,this.Cv,()=>this.Tv(),B=>B(),void 0,t),o]}Vv(){const A=this.Ta.get();var I;return this.qv&&this.Gv===A||((I=this.qv)===null||I===void 0||I.reset(),this.Gv=A,[this.qv,this.Qv]=this.Uv(()=>this.Ju,e=>{this.Ju=e})),this.qv}Zv(){const A=this.Ta.get();var I;return this.jv&&this.Jv===A||((I=this.jv)===null||I===void 0||I.reset(),this.Jv=A,[this.jv,this.Kv]=this.Uv(()=>this.Pv,e=>{this.Pv=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Nwg)),this.jv}setup(A){if(!this.Ci&&!this.Rv)return this.Rv=!0,this.xa=A,this.$=A.logger.createLogger("[logs]"),cNA(A.kv.initialize(),()=>{this.Ci||this.Vd(A)})}Vd(A){var I;this.Hv(),!((I=this.Ta.get())===null||I===void 0)&&I.captureConsoleLogs&&(this.Iv=!0),(this.Iv||this.Ta.remoteConfigWillArrive&&A.kv.get(this.Ta.captureHintKey))&&this.Xv();let e=!1;const t=A.onRemoteConfig(o=>{var B;e=o.ok&&((B=o.config.logs)===null||B===void 0?void 0:B.captureConsoleLogs)===!0,this.onRemoteConfig(o)});this.Ci?t.dispose():(this.qa=t,e||this.loadIfEnabled())}dispose(){var A,I,e,t,o,B,C;this.Ci||(this.Ci=!0,this.Yv(),(A=this.qa)===null||A===void 0||A.dispose(),this.qa=void 0,this.xa=void 0,this.Ev=!1,(I=this.Wd)===null||I===void 0||I.removeEventListener("online",this.Nv),(e=this.tf)===null||e===void 0||e.call(this),this.tf=void 0,(t=this.qv)===null||t===void 0||t.clearQueue(),(o=this.jv)===null||o===void 0||o.clearQueue(),(B=this.qv)===null||B===void 0||B.reset(),(C=this.jv)===null||C===void 0||C.reset())}onRemoteConfig(A){var I,e;if(this.Ci)return;const t=A.ok?(I=A.config.logs)===null||I===void 0?void 0:I.captureConsoleLogs:void 0;rC(t)?this.ef():((e=this.xa)===null||e===void 0||e.kv.set(this.Ta.captureHintKey,!!t),t?(this.Iv=!0,this.Mv||this.Xv(),this.loadIfEnabled()):this.ef())}reset(){var A,I,e,t;this.Yv(),(A=this.qv)===null||A===void 0||A.clearQueue(),this.Ju=[],(I=this.qv)===null||I===void 0||I.reset(),(e=this.jv)===null||e===void 0||e.clearQueue(),this.Pv=[],(t=this.jv)===null||t===void 0||t.reset(),this.Pd=0}captureLog(A){!this.Ci&&this.xa&&this.Vv().captureLog(A)}captureConsoleLog(A){!this.Ci&&this.xa&&this.Zv().captureLog(A)}captureBufferedConsoleLog(A,I,e){!this.Ci&&this.xa&&this.Zv().captureLog(A,{context:I,occurredAtMs:e})}gd(){var A;this.Yv(),(A=this.jv)===null||A===void 0||A.clearQueue(),this.Pv=[]}ef(){this.Iv||this.Yv()}Xv(){var A;if(this.Ov||!(!((A=this.Wd)===null||A===void 0)&&A.console))return;const I=Rwg(this.Ta.get()).maxBufferSize;let e=!0;this.Fv.push(()=>{e=!1});for(const t of uXI){let o;try{o=GXI(this.Wd.console[t])}catch{continue}o&&this.Fv.push(IH(this.Wd.console,t,B=>{const C=(...Q)=>{try{e&&this.if(t,Q,I)}catch{}return B.apply(this.Wd.console,Q)};return C.__rrweb_original__=o,C}))}this.Ov=!0,this.nf=setTimeout(()=>{this.Yv()},3e4)}if(A,I,e){var t;if(this.Ov&&!this.Dv&&I.length!==0)if(!((t=this.xa)===null||t===void 0)&&t.canCapture){if(e>this.Av.length){this.Dv=!0;try{this.Av.push({level:A,args:I,occurredAtMs:Date.now(),context:this.Tv()})}finally{this.Dv=!1}}}else this.Yv()}Yv(){if(this.Av=[],this.Ov){this.Ov=!1,this.nf&&(clearTimeout(this.nf),this.nf=void 0);for(const A of this.Fv)A();this.Fv=[]}}sf(){const A=this.Av;return this.Yv(),A}get logger(){return this.rf||(this.rf={trace:(A,I)=>this.captureLog({body:A,level:"trace",attributes:I}),debug:(A,I)=>this.captureLog({body:A,level:"debug",attributes:I}),info:(A,I)=>this.captureLog({body:A,level:"info",attributes:I}),warn:(A,I)=>this.captureLog({body:A,level:"warn",attributes:I}),error:(A,I)=>this.captureLog({body:A,level:"error",attributes:I}),fatal:(A,I)=>this.captureLog({body:A,level:"fatal",attributes:I})}),this.rf}flushLogs(A){this.xa&&(A?this.af(A):(this.qv&&this.qv.flush().catch(I=>this.lf(I)),this.jv&&this.jv.flush().catch(I=>this.lf(I))))}flush(){var A=this;return oa(function*(){var I,e;const t=(I=A.qv)===null||I===void 0?void 0:I.flush().catch(B=>A.lf(B)),o=(e=A.jv)===null||e===void 0?void 0:e.flush().catch(B=>A.lf(B));yield t,yield o})()}lf(A){Fwg(A)||this.$.error("PostHog logs flush failed:",A)}loadIfEnabled(){if(this.Ci||!this.Iv||this.Mv||this.Ev)return;const A=this.zv();if(A){this.Ev=!0;try{A((I,e)=>{if(this.Ev=!1,!this.Ci&&this.Iv)if(I||!e)this.$.error("Could not load logs script",I),this.Yv();else{const t=this.sf();this.tf=e.initialize(this.xa),this.Mv=!0,t.length>0&&e.replay(this.xa,t)}})}catch(I){throw this.Ev=!1,I}}else this.Yv()}Wv(A,I){const e=this.xa;return{get isDisabled(){return!1},get optedOut(){return!e.canCapture},getPersistedProperty:t=>t===xN.LogsQueue?A():void 0,setPersistedProperty(t,o){t===xN.LogsQueue&&I(o??[])},js:t=>this.js(t),getLibraryId:()=>e.library.name,getLibraryVersion:()=>e.library.version}}js(A){return new Promise(I=>{if(Eyg(this.Pd,3))return void I({kind:"fatal",error:DNA(void 0,"logs endpoint is unreachable, dropping batch")});let e=!1;const t=C=>{e||(e=!0,clearTimeout(o),I(C))},o=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),t({kind:"retry-later",error:DNA(void 0,"logs request timed out")})},9e4),B=this.Bv;this.xa.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.xa.projectToken},body:A,compression:"best-available",timeoutMs:6e4}).then(C=>{var Q;const i=C.statusCode;this.uf(i,B),i>=200&&300>i?t({kind:"ok"}):i===413?t({kind:"too-large"}):i!==0&&i!==408&&i!==429&&500>i?t({kind:"fatal",error:new Error(`logs request failed with status ${i}`)}):i===0?(C.error||this.$.warn("Logs request failed before receiving an HTTP response"),t({kind:"retry-later",error:DNA(C.error,"logs request failed before receiving an HTTP response")})):t({kind:"retry-later",error:(Q=C.error)!==null&&Q!==void 0?Q:new Error(`logs request failed with status ${i}`)})},C=>{t({kind:"retry-later",error:C})})})}uf(A,I){(A!==0||I)&&(this.Pd=nyg(A,this.Pd,3,()=>this.$.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.")))}af(A){this.Ju.length>0&&this.cf(A,this.Ju,this.Qv,this.xa.library.name,I=>{this.Ju=I}),this.Pv.length>0&&this.cf(A,this.Pv,this.Kv,Nwg,I=>{this.Pv=I})}cf(A,I,e,t,o){if(I.length===0)return;const B=I.map(Q=>Q.record);o([]);const C=Adg(B,$Dg(e,this.xa.library.name,this.xa.library.version),t,this.xa.library.version);this.xa.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.xa.projectToken},body:C,compression:"best-available",transport:A,timeoutMs:6e4}).catch(Q=>this.lf(Q))}};const IQA=qr("[NetworkMetrics]"),dNA=()=>{var g;return!(Me==null||(g=Me.performance)===null||g===void 0)&&g.now?Me.performance.now():Date.now()},pXI={"http:":80,"https:":443},kXI=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),Uwg=(g,A)=>{var I;const e=String(A);return{method:String(g).toUpperCase(),url:((I=ZF(e))===null||I===void 0?void 0:I.href)||e}},yNA=(g,A,I,e,t,o,B=!1)=>{try{var C,Q;const i=t();if(!i)return;const E=I||void 0,n=dNA()-e,s=ZF(A.url);if(s&&s.protocol!=="http:"&&s.protocol!=="https:")return;const r={url:s?.href||A.url,method:A.method},a=Xh(i.name)?i.name(r):UC(i.name)?i.name:"http.client.request.duration";if(!a)return;const c=B&&!E?void 0:((l,D)=>l?400>l?void 0:String(l):D?.name||"_OTHER")(E,o),h=QI(QI(QI(QI(QI({},(l=>{const D=kXI.has(l)?l:"_OTHER";return QI({"http.request.method":D},D==="_OTHER"&&l!==D?{"http.request.method_original":l}:{})})(r.method)),s?(l=>{return{"server.address":l.hostname.startsWith("[")&&l.hostname.endsWith("]")?l.hostname.slice(1,-1):l.hostname,"server.port":Number(l.port)||pXI[l.protocol],"url.scheme":l.protocol.slice(0,-1),"url.template":(D=l.pathname,D.split("/").map(d=>(y=>/^\d+$/.test(y)||y.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(y))(d)?":id":d).join("/"))};var D})(s):{}),E?{"http.response.status_code":E}:{}),c?{"error.type":c}:{}),(C=i.attributes)===null||C===void 0?void 0:C.call(i,r,{status:E,durationMs:n}));(Q=g.metrics)===null||Q===void 0||Q.histogram(a,n,{unit:"ms",attributes:h})}catch(i){IQA.error("Failed to record network metric",i)}},Jwg=()=>{},MXI=(g,A)=>Xh(Me?.fetch)?IH(Me,"fetch",I=>function(...e){const t=dNA(),o=I.apply(this,e);if(!A())return o;try{var B,C,Q;const[i,E]=e,n=Uwg((B=(C=E?.method)!==null&&C!==void 0?C:i?.method)!==null&&B!==void 0?B:"GET",(Q=i?.url)!==null&&Q!==void 0?Q:i);return o.then(s=>(yNA(g,n,s?.status,t,A,void 0,!0),s),s=>{throw yNA(g,n,void 0,t,A,s),s})}catch(i){return IQA.error("Failed to observe fetch",i),o}}):Jwg,SXI=(g,A)=>{var I;const e=Me==null||(I=Me.XMLHttpRequest)===null||I===void 0?void 0:I.prototype;if(!e)return Jwg;const t=new WeakMap,o=IH(e,"open",C=>function(...Q){try{Uyg.has(this)||t.set(this,Uwg(Q[0],Q[1]))}catch(i){IQA.error("Failed to observe XHR open",i)}return C.apply(this,Q)}),B=IH(e,"send",C=>function(...Q){let i;try{const E=t.get(this);if(E&&A()){const n=dNA();i=()=>{this.removeEventListener("loadend",i),yNA(g,E,this.status,n,A)},GE(this,"loadend",i)}}catch(E){IQA.error("Failed to observe XHR send",E)}try{return C.apply(this,Q)}catch(E){throw i&&this.removeEventListener("loadend",i),E}});return()=>{o(),B()}},Pwg=new WeakMap,fXI=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),RXI={maxStringLength:2048,truncationSuffix:"..."},NXI={maxStringLength:2048,truncationSuffix:"..."};function Kwg(g){if(g)return g===!0?{intent:!0,model:!0}:{intent:g.intent!==!1,model:g.model!==!1}}function wNA(g,A){return{}.hasOwnProperty.call(g,A)}function uNA(g,A){const I=Object.create(g);return A&&Object.defineProperty(I,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:A}),I}function Lwg(g,A,I=!1){if(!UC(g))return;const e=g.trim();return e?(I?ODg(e,RXI):e).slice(0,A):void 0}function Ywg(g){try{return yC(g)&&g.isError===!0}catch{return!1}}function _wg(g){return ODg(g||"Unknown error",NXI).slice(0,2048)}function xXI(g,A){try{return _wg(A?(function(I){try{return!yC(I)||!aB(I.content)?void 0:I.content.filter(e=>yC(e)&&e.type==="text"&&UC(e.text)).map(e=>e.text).join(" ").trim()||void 0}catch{return}})(g):yC(g)&&UC(g.message)?g.message:UC(g)?g:String(g))}catch{return"Unknown error"}}function FXI(g,A,I){return A.errorResult?[{type:"Error",value:I,mechanism:{type:"generic",handled:!0,synthetic:!0,exception_id:0}}]:g.buildProperties(A.error,{handled:!0}).$exception_list.map(e=>QI(QI({},e),{},{value:_wg(e.value)}))}function UXI(g,A){if(A)return"Error";try{if(!yC(g))return"Error";let I=UC(g.name)?g.name.trim():"";const e=g.constructor;return I&&I!=="Error"||!Xh(e)||e.name==="Error"||(I=e.name),(I||"Error").slice(0,256)}catch{return"Error"}}function JXI(g,A){return{message:xXI(g,A),type:UXI(g,A)}}const eQA={featureFlags:class extends hXI{constructor(g){const A=new lXI(g.config,g.Qu());super(A),this.name=twg,this._instance=g,this.hf=A}get zd(){return this._instance.persistence}updateConfig(g,A){this.hf.update(g,A),this.Hd()}}},PXI={sessionRecording:class{get Ar(){return this._instance.config}get _c(){return this._instance.persistence}get started(){var g;return!!(!((g=this.df)===null||g===void 0)&&g.isStarted)}get status(){var g,A;return this.vf==="awaiting_config"||this.vf==="missing_config"?this.vf:(g=(A=this.df)===null||A===void 0?void 0:A.status)!==null&&g!==void 0?g:this.vf}constructor(g){if(this._instance=g,this._forceAllowLocalhostNetworkCapture=!1,this.vf=sNA,this.ff=void 0,this.pf=!1,this.Je=(()=>{var A,I;if(!ro?.visibilityState||ro.visibilityState==="visible")return!0;const e=Me==null||(A=Me.performance)===null||A===void 0||(I=A.getEntriesByType)===null||I===void 0?void 0:I.call(A,"visibility-state");return!e?.length||e.some(t=>t.name==="visible")})(),this.sn=()=>{var A,I;ro?.visibilityState==="visible"&&(this.Je=!0,(A=this.df)===null||A===void 0||(I=A.setDocumentWasEverVisible)===null||I===void 0||I.call(A,!0))},!this._instance.sessionManager)throw VF.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Ar.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');ro?.addEventListener&&GE(ro,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:g=!1}={}){var A;this.pf=!0,ro==null||(A=ro.removeEventListener)===null||A===void 0||A.call(ro,"visibilitychange",this.sn),g?this.gf(!0):this.stopRecording()}get mf(){var g;const A=!!(!((g=this._instance.get_property("$session_recording_remote_config"))===null||g===void 0)&&g.enabled),I=!this.Ar.disable_session_recording,e=this.Ar.disable_session_recording||this._instance.consent.isOptedOut();return Me&&A&&I&&!e}startIfEnabledOrStop(g){var A;if(this.pf||this.mf&&(!((A=this.df)===null||A===void 0)&&A.isStarted))return;const I=!Le(Object.assign)&&!Le(Array.from);this.mf&&I?(this.yf(g),VF.info("starting")):(this.vf=sNA,this.stopRecording())}yf(g){var A,I;if(this.mf)if(this.vf!=="awaiting_config"&&this.vf!=="missing_config"&&(this.vf=lwg),(FB==null||(A=FB.__PosthogExtensions__)===null||A===void 0||(A=A.rrweb)===null||A===void 0?void 0:A.record)&&((I=FB.__PosthogExtensions__)===null||I===void 0?void 0:I.initSessionRecording))this.bf(g);else{var e,t;const o=this._instance.sessionManager;(e=FB.__PosthogExtensions__)===null||e===void 0||(t=e.loadExternalDependency)===null||t===void 0||t.call(e,this._instance,this._f,B=>{if(!this.pf&&this.mf&&this._instance.sessionManager===o)return B?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),VF.error("could not load recorder",B)):void this.bf(g);this.vf="disabled"})}}stopRecording(){var g,A;(g=this.ff)===null||g===void 0||g.call(this),this.ff=void 0,(A=this.df)===null||A===void 0||A.stop()}gf(g=!1){var A,I;(A=this.ff)===null||A===void 0||A.call(this),this.ff=void 0,(I=this.df)===null||I===void 0||I.discard({discardProducerEvents:g})}wf(){var g,A;(g=this._c)===null||g===void 0||g.unregister("$session_is_sampled"),(A=this._c)===null||A===void 0||A.unregister("$replay_sample_rate")}kf(g,A){if(rC(g))return null;const I=$h(g)?g:parseFloat(g);return typeof(e=I)!="number"||!Number.isFinite(e)||0>e||e>1?(VF.warn(`${A} must be between 0 and 1. Ignoring invalid value:`,g),null):I;var e}Sf(g){if(this._c){var A,I;const e=this._c,t=()=>{var o;const B=g.sessionRecording===!1?void 0:g.sessionRecording,C=this.kf((o=this.Ar.session_recording)===null||o===void 0?void 0:o.sampleRate,"session_recording.sampleRate"),Q=this.kf(B?.sampleRate,"remote config sampleRate"),i=C??Q;rC(i)&&this.wf();const E=B?.minimumDurationMilliseconds;e.register({[dV]:QI(QI({cache_timestamp:Date.now(),enabled:!!B},B),{},{networkPayloadCapture:QI({capturePerformance:g.capturePerformance},B?.networkPayloadCapture),canvasRecording:{enabled:B?.recordCanvas,fps:B?.canvasFps,quality:B?.canvasQuality},sampleRate:i,minimumDurationMilliseconds:Le(E)?null:E,endpoint:B?.endpoint,triggerMatchType:B?.triggerMatchType,masking:B?.masking,urlTriggers:B?.urlTriggers,version:B?.version,triggerGroups:B?.triggerGroups})})};t(),(A=this.ff)===null||A===void 0||A.call(this),this.ff=(I=this._instance.sessionManager)===null||I===void 0?void 0:I.onSessionId(t)}}onRemoteConfig(g){const A=g.ok?g.config:void 0;return A&&"sessionRecording"in A?A.sessionRecording===!1?(this.Sf(A),void this.gf()):(this.Sf(A),void this.startIfEnabledOrStop()):(this.vf==="awaiting_config"&&(this.vf="missing_config",this._instance.register_for_session({[mRA]:!0}),VF.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(g,A="log"){var I;!((I=this.df)===null||I===void 0)&&I.log?this.df.log(g,A):VF.warn("log called before recorder was ready")}get _f(){var g,A;const I=(g=this._instance)===null||g===void 0||(g=g.persistence)===null||g===void 0?void 0:g.get_property(dV);return(I==null||(A=I.scriptConfig)===null||A===void 0?void 0:A.script)||"lazy-recorder"}xf(){const g=this._instance.get_property(dV);if(!g)return!1;let A;try{A=typeof g=="object"?g:JSON.parse(g)}catch(I){return VF.warn("persisted remote config for session recording is invalid and will be ignored",I),!1}return!rC(A.cache_timestamp)&&36e5>=Date.now()-A.cache_timestamp}bf(g){var A,I,e;if(!this.pf&&this.mf&&this._instance.sessionManager){if(!(!((A=FB.__PosthogExtensions__)===null||A===void 0)&&A.initSessionRecording))return VF.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[GRA]:!0});var t;if(this.df||(this.df=(t=FB.__PosthogExtensions__)===null||t===void 0?void 0:t.initSessionRecording(this._instance,this.Je),this.df._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.xf())return this.vf==="missing_config"||this.vf==="awaiting_config"?void 0:(this.vf="awaiting_config",VF.info("persisted remote config is stale, requesting fresh config before starting"),void new myg(this._instance).load());this.vf=lwg,(I=(e=this.df).setDocumentWasEverVisible)===null||I===void 0||I.call(e,this.Je),this.df.start(g)}else this.vf=sNA}onRRwebEmit(g){var A,I;(A=this.df)===null||A===void 0||(I=A.onRRwebEmit)===null||I===void 0||I.call(A,g)}overrideLinkedFlag(){var g,A;this.df||(A=this._c)===null||A===void 0||A.register({$replay_override_linked_flag:!0}),(g=this.df)===null||g===void 0||g.overrideLinkedFlag()}overrideSampling(){var g,A;this.df||(A=this._c)===null||A===void 0||A.register({$replay_override_sampling:!0}),(g=this.df)===null||g===void 0||g.overrideSampling()}overrideTrigger(g){var A,I;this.df||(I=this._c)===null||I===void 0||I.register({[g==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(A=this.df)===null||A===void 0||A.overrideTrigger(g)}get sdkDebugProperties(){var g;const A={};for(const e of BXI){var I;const t=(I=this._instance.sessionPersistence)===null||I===void 0?void 0:I.get_property(e);Le(t)||(A[e]=t)}return QI(QI({},A),((g=this.df)===null||g===void 0?void 0:g.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(g,A){var I;return!!(!((I=this.df)===null||I===void 0)&&I.tryAddCustomEvent(g,A))}flushBeforeIdentityReset(){var g,A;(g=this.df)===null||g===void 0||(A=g.flushBeforeIdentityReset)===null||A===void 0||A.call(g)}}},KXI={autocapture:class extends ZzI{constructor(g){super(new IXI(g)),this.instance=g}},historyAutocapture:class{constructor(g){this.$f=!1,this._instance=g,this.Cf=this.Tf()}initialize(){this.startIfEnabled()}get isEnabled(){const g=this.If();return!!(g.path||g.search||this.Mf(g))}startIfEnabled(){this.isEnabled&&(Dt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Cf=this.Tf(),this.startIfEnabled()}stop(){this.Ef&&this.Ef(),this.Ef=void 0,this.Pf&&this.Pf(),this.Pf=void 0,Dt.info("History API monitoring stopped")}monitorHistoryChanges(){Me&&Me.history&&(this.Rf("pushState"),this.Rf("replaceState"),this.Af(),this.Mf()&&this.Ff())}Rf(g){var A;if(!Me||!((A=Me.history[g])===null||A===void 0)&&A.__posthog_wrapped__)return;const I=this;IH(Me.history,g,e=>function(t,o,B){var C;I.Of(B)&&I.Df(),e.call(this,t,o,B),I.Lf(g,!I.$f&&(Me==null||(C=Me.event)===null||C===void 0?void 0:C.type)!=="popstate")})}Tf(){const g=Me?.location;if(g?.pathname)return{pathname:g.pathname,search:g.search,hash:g.hash}}If(){const g=this._instance.config.capture_pageview;return g==="history_change"?{path:!0}:yC(g)?g:{}}Mf(g=this.If()){return!!g.hash&&!this._instance.config.disable_capture_url_hashes}Nf(g){const A=this.If(),I=this.Cf;return!(!I||!(A.path&&g.pathname!==I.pathname||A.search&&g.search!==I.search||this.Mf(A)&&g.hash!==I.hash))}Lf(g,A=!1){try{A||this.Df();const I=this.Tf();if(!I)return;if(this.Nf(I)){const e=()=>this._instance.capture(pRA,{navigation_type:g});A?(this.qf=e,Promise.resolve().then(()=>this.Df())):e()}this.Cf=I}catch(I){Dt.error(`Error capturing ${g} pageview`,I)}}Of(g){var A,I;return!(rC(g)||!Me)&&((A=ZF(String(g)))===null||A===void 0?void 0:A.href)!==((I=Me.location)===null||I===void 0?void 0:I.href)}Df(){const g=this.qf;if(g){this.qf=void 0,this.$f=!0;try{g()}catch(A){Dt.error("Error capturing deferred pageview",A)}finally{this.$f=!1}this.Cf=this.Tf()}}Af(){if(this.Ef)return;const g=()=>{this.Lf("popstate")};GE(Me,"popstate",g),this.Ef=()=>{Me&&Me.removeEventListener("popstate",g)}}Ff(){if(this.Pf)return;const g=()=>{this.Lf("hashchange")};GE(Me,"hashchange",g),this.Pf=()=>{Me&&Me.removeEventListener("hashchange",g)}}},heatmaps:class{get Ar(){return this.instance.config}constructor(g){var A;this.jf=!1,this.ll=!1,this.Bf=null,this.instance=g,this.jf=!!(!((A=this.instance.persistence)===null||A===void 0)&&A.props[aRA]),this.rageclicks=new Iwg(g.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let g=5e3;return yC(this.Ar.capture_heatmaps)&&this.Ar.capture_heatmaps.flush_interval_milliseconds&&(g=this.Ar.capture_heatmaps.flush_interval_milliseconds),g}get isEnabled(){return rC(this.Ar.capture_heatmaps)?rC(this.Ar.enable_heatmaps)?this.jf:this.Ar.enable_heatmaps:this.Ar.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ll)return;CXI.info("starting..."),this.zf(),this.sn()}else{var g;clearInterval((g=this.Bf)!==null&&g!==void 0?g:void 0),this.Hf(),this.getAndClearBuffer()}}onRemoteConfig(g){if(!g.ok)return;const A=g.config;if(!("heatmaps"in A))return;const I=!!A.heatmaps;this.instance.persistence&&this.instance.persistence.register({[aRA]:I}),this.jf=I,this.startIfEnabled()}getAndClearBuffer(){const g=this.Rt;return this.Rt=void 0,g}Uf(g){aNA(g.originalEvent)&&this.$r(g.originalEvent,"deadclick")}sn(){this.Bf&&clearInterval(this.Bf),this.Bf=ro?.visibilityState==="visible"?setInterval(this.rc.bind(this),this.flushIntervalMilliseconds):null}zf(){Me&&ro&&(this.Wf=this.rc.bind(this),GE(Me,bCA,this.Wf),this.Vf=g=>this.$r(g||Me?.event),GE(ro,"click",this.Vf,{capture:!0}),this.Gf=g=>this.Qf(g||Me?.event),GE(ro,"mousemove",this.Gf,{capture:!0}),this.Zf=new eyg(this.instance,QzI,this.Uf.bind(this)),this.Zf.startIfEnabledOrStop(),this.Jf=this.sn.bind(this),GE(ro,L9,this.Jf),this.ll=!0)}Hf(){var g;Me&&ro&&(this.Wf&&Me.removeEventListener(bCA,this.Wf),this.Vf&&ro.removeEventListener("click",this.Vf,{capture:!0}),this.Gf&&ro.removeEventListener("mousemove",this.Gf,{capture:!0}),this.Jf&&ro.removeEventListener(L9,this.Jf),clearTimeout(this.Kf),(g=this.Zf)===null||g===void 0||g.stop(),this.ll=!1)}Xf(g,A){const I=this.instance.scrollManager.scrollY(),e=this.instance.scrollManager.scrollX(),t=this.instance.scrollManager.scrollElement(),o=(function(B,C,Q){let i=B;for(;i&&Jf(i)&&!Nw(i,"body");){if(i===Q)return!1;let r;try{var E,n,s;r=(E=(n=(s=i.ownerDocument)===null||s===void 0?void 0:s.defaultView)!==null&&n!==void 0?n:Me)===null||E===void 0?void 0:E.getComputedStyle(i).position}catch{return!1}if(yB(C,r))return!0;i=vdg(i)}return!1})(mV(g),["fixed","sticky"],t);return{x:g.clientX+(o?0:e),y:g.clientY+(o?0:I),target_fixed:o,type:A}}$r(g,A="click"){var I;if(Ydg(g.target)||!aNA(g))return;const e=this.Xf(g,A);!((I=this.rageclicks)===null||I===void 0)&&I.isRageClick(g.clientX,g.clientY,new Date().getTime())&&Wdg(mV(g),this.instance.config.rageclick)&&this.Qs(QI(QI({},e),{},{type:"rageclick"})),this.Qs(e)}Qf(g){!Ydg(g.target)&&aNA(g)&&(clearTimeout(this.Kf),this.Kf=setTimeout(()=>{this.Qs(this.Xf(g,"mousemove"))},500))}Qs(g){if(!Me)return;const A=this.Ar.disable_capture_url_hashes?v4(Me.location.href):Me.location.href,I=this.Ar.custom_personal_data_properties,e=this.Ar.mask_personal_data_properties?[...j9,...I||[]]:[],t=MV(A,e,SV);this.Rt=this.Rt||{},this.Rt[t]||(this.Rt[t]=[]),this.Rt[t].push(g)}rc(){this.Rt&&!_p(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:eyg,webVitalsAutocapture:class{constructor(g){var A;this._instance=g,this.jf=!1,this.ll=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Yf=(I=!1)=>{clearTimeout(this.tp),this.tp=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",QI({$current_url:this.Rt.url},this.Rt.metrics.reduce((e,t)=>QI(QI({},e),{},{[`$web_vitals_${t.name}_event`]:QI({},t),[`$web_vitals_${t.name}_value`]:t.value}),{})),I?{transport:"sendBeacon",send_instantly:!0}:void 0),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ep=I=>{var e;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},rC(I?.name)||rC(I?.value))return void SY.error("Invalid metric received",I);const t=typeof I.navigationURL=="string"?I.navigationURL:void 0,o=this.np(t);if(Le(o))return;const B=$h(I.navigationId)||typeof I.navigationId=="string"?`navigation:${I.navigationId}`:`url:${o}`;if(this.sp&&I.value>=this.sp)return void SY.error("Ignoring metric with value >= "+this.sp,I);this.Rt.navigationKey!==B&&(this.Yf(),this.tp=setTimeout(this.Yf,this.flushToCaptureTimeoutMs)),Le(this.Rt.navigationKey)&&(this.Rt.navigationKey=B,this.Rt.url=o),this.Rt.firstMetricTimestamp=Le(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const C=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0),Q=QI(QI(QI({},I),t?{navigationURL:o}:{}),{},{$current_url:o,timestamp:Date.now()});if(delete Q.entries,yC(I.attribution)&&this.attributionMetrics.indexOf(I.name)>-1){const i={};for(const E of oXI){const n=E==="url"&&typeof I.attribution[E]=="string"?this.np(I.attribution[E]):I.attribution[E];Le(n)||(i[E]=n)}Q.attribution=i}else delete Q.attribution;Le(C)||(Q.$session_id=C.sessionId,Q.$window_id=C.windowId),this.Rt.metrics.push(Q),this.Rt.metrics.length===this.allowedMetrics.length&&this.Yf()},this.rp=()=>{if(this.ll)return;let I,e,t,o,B=!1;const C=FB.__PosthogExtensions__,Q=C?.postHogWebVitalsCallbacksByFlavor,i=Q?.[this.op]||(this.op==="web-vitals"&&Le(Q)?C?.postHogWebVitalsCallbacks:void 0);if(!Le(i)){const r=i.withoutAttribution,a=this.attributionMetrics;B=!Le(r),I=a.indexOf("LCP")>-1?i.onLCP:r?.onLCP||i.onLCP,e=a.indexOf("CLS")>-1?i.onCLS:r?.onCLS||i.onCLS,t=a.indexOf("FCP")>-1?i.onFCP:r?.onFCP||i.onFCP,o=a.indexOf("INP")>-1?i.onINP:r?.onINP||i.onINP}if(!(I&&e&&t&&o))return void SY.error("web vitals callbacks not loaded - not starting");const E={reportSoftNavs:this.useSoftNavs},n=B&&this.attributionMetrics.indexOf("INP")>-1?QI(QI({},E),{},{includeProcessedEventEntries:!1}):E;this.allowedMetrics.indexOf("LCP")>-1&&I(this.ep.bind(this),E),this.allowedMetrics.indexOf("CLS")>-1&&e(this.ep.bind(this),E),this.allowedMetrics.indexOf("FCP")>-1&&t(this.ep.bind(this),E),this.allowedMetrics.indexOf("INP")>-1&&o(this.ep.bind(this),n);const s=Me?.document;GE(s,L9,()=>{s?.visibilityState==="hidden"&&this.Yf(!0)}),GE(Me,"pagehide",()=>this.Yf(!0)),this.ll=!0},this.jf=!!(!((A=this._instance.persistence)===null||A===void 0)&&A.props[hRA]),this.startIfEnabled()}get ap(){return this._instance.config.capture_performance}get allowedMetrics(){var g,A;const I=yC(this.ap)?(g=this.ap)===null||g===void 0?void 0:g.web_vitals_allowed_metrics:void 0;return rC(I)?((A=this._instance.persistence)===null||A===void 0?void 0:A.props.$web_vitals_allowed_metrics)||hwg:I}get flushToCaptureTimeoutMs(){return(yC(this.ap)?this.ap.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const g=yC(this.ap)?this.ap.web_vitals_attribution:void 0;return gm(g)?g?hwg:[]:aB(g)?g:tXI}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const g=yC(this.ap)?this.ap.__preview_web_vitals_soft_navs:void 0;return g!=null&&g}get sp(){const g=yC(this.ap)&&$h(this.ap.__web_vitals_max_value)?this.ap.__web_vitals_max_value:cwg;return g>0&&6e4>=g?cwg:g}get isEnabled(){const g=ta?.protocol;if(g!=="http:"&&g!=="https:")return SY.info("Web Vitals are disabled on non-http/https protocols"),!1;const A=yC(this.ap)?this.ap.web_vitals:gm(this.ap)?this.ap:void 0;return gm(A)?A:this.jf}startIfEnabled(){this.isEnabled&&!this.ll&&(SY.info("enabled, starting..."),this.Ml(this.rp))}onRemoteConfig(g){if(!g.ok)return;const A=g.config;if(!("capturePerformance"in A))return;const I=yC(A.capturePerformance)&&!!A.capturePerformance.web_vitals,e=yC(A.capturePerformance)?A.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[hRA]:I}),this._instance.persistence.register({[adg]:e})),this.jf=I,this.startIfEnabled()}get op(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ml(g){var A;const I=FB.__PosthogExtensions__,e=this.op,t=I?.postHogWebVitalsCallbacksByFlavor;t?.[e]||e==="web-vitals"&&Le(t)&&I?.postHogWebVitalsCallbacks?g():I==null||(A=I.loadExternalDependency)===null||A===void 0||A.call(I,this._instance,e,o=>{o?SY.error("failed to load script",o):g()})}np(g){const A=g||Me?.location.href;if(!A)return void SY.error("Could not determine current URL");const I=this._instance.config.disable_capture_url_hashes?v4(A):A,e=this._instance.config.custom_personal_data_properties,t=this._instance.config.mask_personal_data_properties?[...j9,...e||[]]:[];return MV(I,t,SV)}}},LXI={exceptionObserver:class{constructor(g){var A;this.rp=()=>{var I;if(!Me||!this.isEnabled||!(!((I=FB.__PosthogExtensions__)===null||I===void 0)&&I.errorWrappingFunctions))return;const e=FB.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,t=FB.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=FB.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.lp&&this.Ar.capture_unhandled_errors&&(this.lp=e(this.captureException.bind(this))),!this.up&&this.Ar.capture_unhandled_rejections&&(this.up=t(this.captureException.bind(this))),!this.cp&&this.Ar.capture_console_errors&&(this.cp=o(this.captureException.bind(this)))}catch(B){LV.error("failed to start",B),this.hp()}},this._instance=g,this.dp=!!(!((A=this._instance.persistence)===null||A===void 0)&&A.props[rRA]),this.wt=new jWI(QI(QI({},(function(I={}){var e,t,o,B;return{refillRate:(e=(t=I.exceptionRateLimiterRefillRate)!==null&&t!==void 0?t:I.__exceptionRateLimiterRefillRate)!==null&&e!==void 0?e:1,bucketSize:(o=(B=I.exceptionRateLimiterBucketSize)!==null&&B!==void 0?B:I.__exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:LV})),this.Ar=this.vp(),this.startIfEnabledOrStop()}vp(){const g=this._instance.config.capture_exceptions;let A={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return yC(g)?A=QI(QI({},A),g):(Le(g)?this.dp:g)&&(A=QI(QI({},A),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),A}get isEnabled(){return this.Ar.capture_console_errors||this.Ar.capture_unhandled_errors||this.Ar.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(LV.info("enabled"),this.hp(),this.Ml(this.rp)):this.hp()}Ml(g){var A,I,e;!((A=FB.__PosthogExtensions__)===null||A===void 0)&&A.errorWrappingFunctions?g():(I=FB.__PosthogExtensions__)===null||I===void 0||(e=I.loadExternalDependency)===null||e===void 0||e.call(I,this._instance,"exception-autocapture",t=>{if(t)return LV.error("failed to load script",t);g()})}hp(){var g,A,I;(g=this.lp)===null||g===void 0||g.call(this),this.lp=void 0,(A=this.up)===null||A===void 0||A.call(this),this.up=void 0,(I=this.cp)===null||I===void 0||I.call(this),this.cp=void 0}onRemoteConfig(g){if(!g.ok)return;const A=g.config;"autocaptureExceptions"in A&&(this.dp=!!A.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[rRA]:this.dp}),this.Ar=this.vp(),this.startIfEnabledOrStop())}onConfigChange(){this.Ar=this.vp()}captureException(g){try{var A,I,e;const t=(A=g==null||(I=g.$exception_list)===null||I===void 0||(I=I[0])===null||I===void 0?void 0:I.type)!==null&&A!==void 0?A:"Exception";if(this.wt.consumeRateLimit(t))return void LV.info("Skipping exception capture because of client rate limiting.",{exception:t});(e=this._instance.exceptions)===null||e===void 0||e.sendExceptionEvent(g)}catch{}}},exceptions:class{constructor(g){var A,I;this.fp=[],this.pp=new QVI([new GVI,new xVI,new pVI,new mVI,new RVI,new fVI,new MVI,new NVI],(function(e,...t){return(o,B=0)=>{const C=[],Q=o.split(`
239
+ root.render(<App />);`),f.unstable_strictMode===!0&&(_=!0),f.identifierPrefix!==void 0&&(z=f.identifierPrefix),f.onUncaughtError!==void 0&&(iA=f.onUncaughtError),f.onCaughtError!==void 0&&(yA=f.onCaughtError),f.onRecoverableError!==void 0&&(Ig=f.onRecoverableError),f.unstable_transitionCallbacks!==void 0&&(yg=f.unstable_transitionCallbacks)),f=Wg(M,1,!1,null,null,_,z,iA,yA,Ig,yg,null),M[Ia]=f.current,OS(M),new Dw(f)},gV.hydrateRoot=function(M,f,_){if(!l(M))throw Error("Target container is not a DOM element.");S0(M),f===void 0&&console.error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var z=!1,iA="",yA=hf,Ig=zs,yg=jl,qg=null,eI=null;return _!=null&&(_.unstable_strictMode===!0&&(z=!0),_.identifierPrefix!==void 0&&(iA=_.identifierPrefix),_.onUncaughtError!==void 0&&(yA=_.onUncaughtError),_.onCaughtError!==void 0&&(Ig=_.onCaughtError),_.onRecoverableError!==void 0&&(yg=_.onRecoverableError),_.unstable_transitionCallbacks!==void 0&&(qg=_.unstable_transitionCallbacks),_.formState!==void 0&&(eI=_.formState)),f=Wg(M,1,!0,f,_??null,z,iA,yA,Ig,yg,qg,eI),f.context=wI(null),_=f.current,z=Ih(_),z=uA(z),iA=Zi(z),iA.callback=null,lC(_,iA,z),_=z,f.current.lanes=_,bA(f,_),Jr(f),M[Ia]=f.current,OS(M),new td(f)},gV.version="19.1.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})(),gV}var f0g;function nOI(){if(f0g)return BCA.exports;f0g=1;var g={env:{}};function A(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(g.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(A)}catch(I){console.error(I)}}}return g.env.NODE_ENV==="production"?(A(),BCA.exports=iOI()):BCA.exports=EOI(),BCA.exports}var sOI=nOI(),gA=DM();const aC=Lp(gA),Yp=lM({__proto__:null,default:aC},[gA]);var aOI=Object.defineProperty,S9=(g,A)=>aOI(g,"name",{value:A,configurable:!0}),R0g=!!(typeof window<"u"&&window.document&&window.document.createElement);function _o(g,A,{checkForDefaultPrevented:I=!0}={}){return S9(function(t){if(g?.(t),I===!1||!t||!t.defaultPrevented)return A?.(t)},"handleEvent")}S9(_o,"composeEventHandlers");function rOI(g){if(!R0g)throw new Error("Cannot access window outside of the DOM");return g?.ownerDocument?.defaultView??window}S9(rOI,"getOwnerWindow");function rfA(g){if(!R0g)throw new Error("Cannot access document outside of the DOM");return g?.ownerDocument??document}S9(rfA,"getOwnerDocument");function N0g(g,A=!1){const{activeElement:I}=rfA(g);if(!I?.nodeName)return null;if(x0g(I)&&I.contentDocument)return N0g(I.contentDocument.body,A);if(A){const e=I.getAttribute("aria-activedescendant");if(e){const t=rfA(I).getElementById(e);if(t)return t}}return I}S9(N0g,"getActiveElement");function x0g(g){return g.tagName==="IFRAME"}S9(x0g,"isFrame");var cOI=Object.defineProperty,Q2=(g,A)=>cOI(g,"name",{value:A,configurable:!0});function hOI(g,A){const I=gA.createContext(A);I.displayName=g+"Context";const e=Q2(o=>{const{children:B,...C}=o,Q=gA.useMemo(()=>C,Object.values(C));return W.jsx(I.Provider,{value:Q,children:B})},"Provider");e.displayName=g+"Provider";function t(o,B={}){const{optional:C=!1}=B,Q=gA.useContext(I);if(Q)return Q;if(A!==void 0)return A;if(!C)throw new Error(`\`${o}\` must be used within \`${g}\``)}return Q2(t,"useContext"),[e,t]}Q2(hOI,"createContext");function dM(g,A=[]){let I=[];function e(o,B){const C=gA.createContext(B);C.displayName=o+"Context";const Q=I.length;I=[...I,B];const i=Q2(n=>{const{scope:s,children:r,...a}=n,c=s?.[g]?.[Q]||C,h=gA.useMemo(()=>a,Object.values(a));return W.jsx(c.Provider,{value:h,children:r})},"Provider");i.displayName=o+"Provider";function E(n,s,r={}){const{optional:a=!1}=r,c=s?.[g]?.[Q]||C,h=gA.useContext(c);if(h)return h;if(B!==void 0)return B;if(!a)throw new Error(`\`${n}\` must be used within \`${o}\``)}return Q2(E,"useContext"),[i,E]}Q2(e,"createContext");const t=Q2(()=>{const o=I.map(B=>gA.createContext(B));return Q2(function(C){const Q=C?.[g]||o;return gA.useMemo(()=>({[`__scope${g}`]:{...C,[g]:Q}}),[C,Q])},"useScope")},"createScope");return t.scopeName=g,[e,F0g(t,...A)]}Q2(dM,"createContextScope");function F0g(...g){const A=g[0];if(g.length===1)return A;const I=Q2(()=>{const e=g.map(t=>({useScope:t(),scopeName:t.scopeName}));return Q2(function(o){const B=e.reduce((C,{useScope:Q,scopeName:i})=>{const n=Q(o)[`__scope${i}`];return{...C,...n}},{});return gA.useMemo(()=>({[`__scope${A.scopeName}`]:B}),[B])},"useComposedScopes")},"createScope");return I.scopeName=A.scopeName,I}Q2(F0g,"composeContextScopes");var lOI=Object.defineProperty,cfA=(g,A)=>lOI(g,"name",{value:A,configurable:!0});function hfA(g,A){if(typeof g=="function")return g(A);g!=null&&(g.current=A)}cfA(hfA,"setRef");function U0g(...g){return A=>{let I=!1;const e=g.map(t=>{const o=hfA(t,A);return!I&&typeof o=="function"&&(I=!0),o});if(I)return()=>{for(let t=0;t<e.length;t++){const o=e[t];typeof o=="function"?o():hfA(g[t],null)}}}}cfA(U0g,"composeRefs");function $i(...g){return gA.useCallback(U0g(...g),g)}cfA($i,"useComposedRefs");var DOI=Object.defineProperty,yM=(g,A)=>DOI(g,"name",{value:A,configurable:!0});function fN(g){const A=gA.forwardRef((I,e)=>{let{children:t,...o}=I,B=null,C=!1;const Q=[];t=b0g(t),gA.Children.forEach(t,s=>{if(Y0g(s)){C=!0;const r=s;let a="child"in r.props?r.props.child:r.props.children;for(;lfA(a)&&typeof ECA=="function";)a=ECA(a._payload);B=yOI(r,a),Q.push(B?.props?.children)}else Q.push(s)}),B?B=gA.cloneElement(B,void 0,Q):!C&&gA.Children.count(t)===1&&gA.isValidElement(t)&&(B=t);const i=B?L0g(B):void 0,E=$i(e,i);if(!B){if(t||t===0)throw new Error(C?GOI(g):uOI(g));return t}const n=K0g(o,B.props??{});return B.type!==gA.Fragment&&(n.ref=e?E:i),gA.cloneElement(B,n)});return A.displayName=`${g}.Slot`,A}yM(fN,"createSlot");var dOI=fN("Slot"),J0g=Symbol.for("radix.slottable");function P0g(g){const A=yM(I=>"child"in I?I.children(I.child):I.children,"Slottable");return A.displayName=`${g}.Slottable`,A.__radixId=J0g,A}yM(P0g,"createSlottable");var yOI=yM((g,A)=>"child"in g.props?gA.isValidElement(A)?gA.cloneElement(A,void 0,g.props.children(A.props.children)):null:gA.isValidElement(A)?A:null,"getSlottableElementFromSlottable");function K0g(g,A){const I={...A};for(const e in A){const t=g[e],o=A[e];/^on[A-Z]/.test(e)?t&&o?I[e]=(...C)=>{const Q=o(...C);return t(...C),Q}:t&&(I[e]=t):e==="style"?I[e]={...t,...o}:e==="className"?I[e]=[t,o].filter(Boolean).join(" "):e==="aria-describedby"&&(I[e]=H0g(o,t))}return{...g,...I}}yM(K0g,"mergeProps");function L0g(g){let A=Object.getOwnPropertyDescriptor(g.props,"ref")?.get,I=A&&"isReactWarning"in A&&A.isReactWarning;return I?g.ref:(A=Object.getOwnPropertyDescriptor(g,"ref")?.get,I=A&&"isReactWarning"in A&&A.isReactWarning,I?g.props.ref:g.props.ref||g.ref)}yM(L0g,"getElementRef");function Y0g(g){return gA.isValidElement(g)&&typeof g.type=="function"&&"__radixId"in g.type&&g.type.__radixId===J0g}yM(Y0g,"isSlottable");var wOI=Symbol.for("react.lazy");function lfA(g){return g!=null&&typeof g=="object"&&"$$typeof"in g&&g.$$typeof===wOI&&"_payload"in g&&_0g(g._payload)}yM(lfA,"isLazyComponent");function _0g(g){return typeof g=="object"&&g!==null&&"then"in g}yM(_0g,"isPromiseLike");function b0g(g){let A=g;for(;lfA(A)&&typeof ECA=="function";)A=ECA(A._payload);return A}yM(b0g,"useUnwrappedLazy");function H0g(...g){const A=new Set;for(const I of g)if(typeof I=="string")for(const e of String(I).trim().split(/\s+/))e&&A.add(e);return A.size>0?Array.from(A).join(" "):void 0}yM(H0g,"concatAriaDescribedby");var uOI=yM(g=>`${g} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),GOI=yM(g=>`${g} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),ECA=Yp[" use ".trim().toString()],Eh=globalThis?.document?gA.useLayoutEffect:()=>{},mOI=Object.defineProperty,sd=(g,A)=>mOI(g,"name",{value:A,configurable:!0});function nCA(g){const A=g+"CollectionProvider",[I,e]=dM(A),[t,o]=I(A,{collectionRef:{current:null},itemMap:new Map}),B=sd(c=>{const{scope:h,children:l}=c,D=gA.useRef(null),d=gA.useRef(new Map).current;return W.jsx(t,{scope:h,itemMap:d,collectionRef:D,children:l})},"CollectionProvider");B.displayName=A;const C=g+"CollectionSlot",Q=fN(C),i=gA.forwardRef((c,h)=>{const{scope:l,children:D}=c,d=o(C,l),y=$i(h,d.collectionRef);return W.jsx(Q,{ref:y,children:D})});i.displayName=C;const E=g+"CollectionItemSlot",n="data-radix-collection-item",s=fN(E),r=gA.forwardRef((c,h)=>{const{scope:l,children:D,...d}=c,y=gA.useRef(null),w=$i(h,y),u=o(E,l);return gA.useEffect(()=>(u.itemMap.set(y,{ref:y,...d}),()=>{u.itemMap.delete(y)})),W.jsx(s,{[n]:"",ref:w,children:D})});r.displayName=E;function a(c){const h=o(g+"CollectionConsumer",c);return gA.useCallback(()=>{const D=h.collectionRef.current;if(!D)return[];const d=Array.from(D.querySelectorAll(`[${n}]`));return Array.from(h.itemMap.values()).sort((u,G)=>d.indexOf(u.ref.current)-d.indexOf(G.ref.current))},[h.collectionRef,h.itemMap])}return sd(a,"useCollection"),[{Provider:B,Slot:i,ItemSlot:r},a,e]}sd(nCA,"createCollection");var v0g=new WeakMap,sCA=(kS=class extends Map{constructor(I){super(I);Zhg(this,bl);vBA(this,bl,[...super.keys()]),v0g.set(this,!0)}set(I,e){return v0g.get(this)&&!this.has(I)&&jn(this,bl).push(I),super.set(I,e),this}insert(I,e,t){const o=this.has(e),B=o?this.size:this.size+1,C=DfA(I),Q=C>=0?Math.min(C,B-1):Math.max(B+C,0);if(o?jn(this,bl).indexOf(e)===Q:Q===this.size)return this.set(e,t),this;const i=jn(this,bl).filter(n=>n!==e);i.splice(Q,0,e);const E=i.map(n=>[n,n===e?t:this.get(n)]);this.clear();for(const[n,s]of E)this.set(n,s);return this}with(I,e,t){const o=new kS(this);return o.insert(I,e,t),o}before(I){const e=jn(this,bl).indexOf(I)-1;if(!(e<0))return this.entryAt(e)}setBefore(I,e,t){const o=jn(this,bl).indexOf(I);if(o===-1)return this;const B=jn(this,bl).indexOf(e),C=B!==-1&&B<o?o-1:o;return this.insert(C,e,t)}after(I){let e=jn(this,bl).indexOf(I);if(e=e===-1||e===this.size-1?-1:e+1,e!==-1)return this.entryAt(e)}setAfter(I,e,t){const o=jn(this,bl).indexOf(I);if(o===-1)return this;const B=jn(this,bl).indexOf(e),C=B!==-1&&B<=o?o:o+1;return this.insert(C,e,t)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return vBA(this,bl,[]),super.clear()}delete(I){const e=super.delete(I);return e&&jn(this,bl).splice(jn(this,bl).indexOf(I),1),e}deleteAt(I){const e=this.keyAt(I);return e!==void 0?this.delete(e):!1}at(I){const e=aCA(jn(this,bl),I);if(e!==void 0)return this.get(e)}entryAt(I){const e=aCA(jn(this,bl),I);if(e!==void 0)return[e,this.get(e)]}indexOf(I){return jn(this,bl).indexOf(I)}keyAt(I){return aCA(jn(this,bl),I)}from(I,e){const t=this.indexOf(I);if(t===-1)return;let o=t+e;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.at(o)}keyFrom(I,e){const t=this.indexOf(I);if(t===-1)return;let o=t+e;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.keyAt(o)}find(I,e){let t=0;for(const o of this){if(Reflect.apply(I,e,[o,t,this]))return o;t++}}findIndex(I,e){let t=0;for(const o of this){if(Reflect.apply(I,e,[o,t,this]))return t;t++}return-1}filter(I,e){const t=[];let o=0;for(const B of this)Reflect.apply(I,e,[B,o,this])&&t.push(B),o++;return new kS(t)}map(I,e){const t=[];let o=0;for(const B of this)t.push([B[0],Reflect.apply(I,e,[B,o,this])]),o++;return new kS(t)}reduce(...I){const[e,t]=I,o=I.length>1;if(!o&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let B=0,C=t;for(const Q of this)B===0&&!o?C=Q:C=Reflect.apply(e,this,[C,Q,B,this]),B++;return C}reduceRight(...I){const[e,t]=I,o=I.length>1;if(!o&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let B=t;for(let C=this.size-1;C>=0;C--){const Q=this.entryAt(C);C===this.size-1&&!o?B=Q:B=Reflect.apply(e,this,[B,Q,C,this])}return B}sort(I){if(typeof I!="function")throw new TypeError("OrderedDict.sort requires a compare function");const e=[...this.entries()].sort(I);this.clear();for(const[t,o]of e)this.set(t,o);return this}toSorted(I){if(typeof I!="function")throw new TypeError("OrderedDict.toSorted requires a compare function");const e=[...this.entries()].sort(I);return new kS(e)}toReversed(){const I=new kS;for(let e=this.size-1;e>=0;e--){const t=this.keyAt(e),o=this.get(t);I.set(t,o)}return I}toSpliced(...I){const e=[...this.entries()];return e.splice(...I),new kS(e)}slice(I,e){const t=new kS;for(const o of jn(this,bl).slice(I,e))t.set(o,this.get(o));return t}every(I,e){let t=0;for(const o of this){if(!Reflect.apply(I,e,[o,t,this]))return!1;t++}return!0}some(I,e){let t=0;for(const o of this){if(Reflect.apply(I,e,[o,t,this]))return!0;t++}return!1}},bl=new WeakMap,sd(kS,"OrderedDict"),kS);function aCA(g,A){if("at"in Array.prototype)return Array.prototype.at.call(g,A);const I=q0g(g,A);return I===-1?void 0:g[I]}sd(aCA,"at");function q0g(g,A){const I=g.length,e=DfA(A),t=e>=0?e:I+e;return t<0||t>=I?-1:t}sd(q0g,"toSafeIndex");function DfA(g){return g!==g||g===0?0:Math.trunc(g)}sd(DfA,"toSafeInteger");function pOI(g){const A=g+"CollectionProvider",[I,e]=dM(A),[t,o]=I(A);t.displayName=g+"CollectionStableContextProvider";const[B,C]=I(A);B.displayName=g+"CollectionStatefulContextProvider";const Q=sd(({state:u,...G})=>u?W.jsx(E,{...G,state:u}):W.jsx(i,{...G}),"CollectionProvider");Q.displayName=A;const i=sd(u=>{const G=D();return W.jsx(E,{...u,state:G})},"CollectionInit");i.displayName=g+"CollectionInit";const E=sd(u=>{const{scope:G,children:m,state:p}=u,k=gA.useRef(null),[S,R]=gA.useState(null),x=$i(k,R),[N,U]=p,K=gA.useRef(new sCA),Y=gA.useCallback(()=>{const b=K.current;return O0g(b)||b.sort(rCA),b},[]);return gA.useEffect(()=>{if(!S)return;const b=W0g(()=>{U(q=>{const j=q.toSorted(rCA);return j.some(([O],AA)=>q.keyAt(AA)!==O)?j:q})});return b.observe(S,{childList:!0,subtree:!0}),()=>{b.disconnect()}},[S,U]),W.jsx(t,{scope:G,collectionElementRef:x,collectionElementRefObject:k,getCollection:Y,setCollection:U,registryRef:K,children:W.jsx(B,{scope:G,collectionElement:S,collection:N,children:m})})},"CollectionProviderImpl");E.displayName=g+"CollectionProviderImpl";const n=g+"CollectionSlot",s=fN(n),r=gA.forwardRef((u,G)=>{const{scope:m,children:p}=u,k=o(n,m),S=$i(G,k.collectionElementRef);return W.jsx(s,{ref:S,children:p})});r.displayName=n;const a=g+"CollectionItemSlot",c="data-radix-collection-item",h=fN(a),l=gA.forwardRef((u,G)=>{const{scope:m,children:p,...k}=u,S=gA.useRef(null),R=o(a,m),{setCollection:x,registryRef:N}=R,U=gA.useRef(k);T0g(U.current,k)||(U.current=k);const K=U.current,Y=gA.useCallback(j=>{const Z=N.current;j?Z.set(j,{...U.current,element:j}):S.current&&Z.delete(S.current)},[N]),b=$i(G,Y,S);Eh(()=>{const j=S.current,Z=N.current;j&&Z.has(j)&&Z.set(j,{...K,element:j})},[K,N]);const q=gA.useRef(null);return gA.useEffect(()=>{const j=S.current,Z=q.current;(Z?.element??null)===j&&(!j||Z?.itemData===K)||(q.current=j?{element:j,itemData:K}:null,x(O=>{const AA=new sCA(O);return Z&&Z.element!==j&&AA.delete(Z.element),j&&AA.set(j,{...K,element:j}),AA.sort(rCA)}))}),gA.useEffect(()=>()=>{const j=q.current;q.current=null,j&&x(Z=>{if(!Z.has(j.element))return Z;const O=new sCA(Z);return O.delete(j.element),O})},[x]),W.jsx(h,{[c]:"",ref:b,children:p})});l.displayName=a;function D(){return gA.useState(new sCA)}sd(D,"useInitCollection");function d(u){const{collection:G}=C(g+"CollectionConsumer",u);return G}sd(d,"useCollection");function y(u){const{getCollection:G}=o(g+"CollectionConsumer",u);return G}return sd(y,"useGetCollection"),[{Provider:Q,Slot:r,ItemSlot:l},{createCollectionScope:e,useCollection:d,useGetCollection:y,useInitCollection:D}]}sd(pOI,"createCollection");function T0g(g,A){if(g===A)return!0;if(typeof g!="object"||typeof A!="object"||g==null||A==null)return!1;const I=Object.keys(g),e=Object.keys(A);if(I.length!==e.length)return!1;for(const t of I)if(!Object.prototype.hasOwnProperty.call(A,t)||g[t]!==A[t])return!1;return!0}sd(T0g,"shallowEqual");function Z0g(g,A){return!!(A.compareDocumentPosition(g)&Node.DOCUMENT_POSITION_PRECEDING)}sd(Z0g,"isElementPreceding");function O0g(g){let A;for(const I of g.keys()){if(A){const e=A.compareDocumentPosition(I);if(!(e&Node.DOCUMENT_POSITION_DISCONNECTED)&&e&Node.DOCUMENT_POSITION_PRECEDING)return!1}A=I}return!0}sd(O0g,"isInDocumentOrder");function rCA(g,A){return!g[1].element||!A[1].element?0:Z0g(g[1].element,A[1].element)?-1:1}sd(rCA,"sortByDocumentPosition");function W0g(g){return new MutationObserver(I=>{for(const e of I)if(e.type==="childList"){g();return}})}sd(W0g,"getChildListObserver");var kOI=Object.defineProperty,MOI=(g,A)=>kOI(g,"name",{value:A,configurable:!0}),SOI=Yp[" useId ".trim().toString()]||(()=>{}),fOI=0;function wM(g){const[A,I]=gA.useState(SOI());return Eh(()=>{g||I(e=>e??String(fOI++))},[g]),g||(A?`radix-${A}`:"")}MOI(wM,"useId");var RN=afA();const V0g=Lp(RN);var ROI=Object.defineProperty,NOI=(g,A)=>ROI(g,"name",{value:A,configurable:!0}),xOI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],iE=xOI.reduce((g,A)=>{const I=fN(`Primitive.${A}`),e=gA.forwardRef((t,o)=>{const{asChild:B,...C}=t,Q=B?I:A;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),W.jsx(Q,{...C,ref:o})});return e.displayName=`Primitive.${A}`,{...g,[A]:e}},{});function dfA(g,A){g&&RN.flushSync(()=>g.dispatchEvent(A))}NOI(dfA,"dispatchDiscreteCustomEvent");var FOI=Object.defineProperty,UOI=(g,A)=>FOI(g,"name",{value:A,configurable:!0}),j0g=Yp[" useInsertionEffect ".trim().toString()];function uM(g){const A=gA.useRef(g);return typeof j0g=="function"?j0g(()=>{A.current=g}):Eh(()=>{A.current=g}),gA.useMemo(()=>((...I)=>A.current?.(...I)),[])}UOI(uM,"useCallbackRef");var JOI=Object.defineProperty,POI=(g,A)=>JOI(g,"name",{value:A,configurable:!0}),z0g=Yp[" useEffectEvent ".trim().toString()],X0g=Yp[" useInsertionEffect ".trim().toString()];function $0g(g){if(typeof z0g=="function")return z0g(g);const A=gA.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof X0g=="function"?X0g(()=>{A.current=g}):Eh(()=>{A.current=g}),gA.useMemo(()=>((...I)=>A.current?.(...I)),[])}POI($0g,"useEffectEvent");var KOI=Object.defineProperty,IV=(g,A)=>KOI(g,"name",{value:A,configurable:!0}),LOI=Yp[" useInsertionEffect ".trim().toString()]||Eh;function NN({prop:g,defaultProp:A,onChange:I=IV(()=>{},"onChange"),caller:e}){const[t,o,B]=Alg({defaultProp:A,onChange:I}),C=g!==void 0,Q=C?g:t,i=gA.useCallback(E=>{if(C){const n=glg(E)?E(g):E;n!==g&&B.current?.(n)}else o(E)},[C,g,o,B]);return[Q,i]}IV(NN,"useControllableState");function Alg({defaultProp:g,onChange:A}){const[I,e]=gA.useState(g),t=gA.useRef(I),o=gA.useRef(A);return LOI(()=>{o.current=A},[A]),gA.useEffect(()=>{t.current!==I&&(o.current?.(I),t.current=I)},[I,t]),[I,e,o]}IV(Alg,"useUncontrolledState");function glg(g){return typeof g=="function"}IV(glg,"isFunction");var Ilg=Symbol("RADIX:SYNC_STATE");function YOI(g,A,I,e){const{prop:t,defaultProp:o,onChange:B,caller:C}=A,Q=t!==void 0,i=$0g(B),E=[{...I,state:o}];e&&E.push(e);const[n,s]=gA.useReducer((h,l)=>{if(l.type===Ilg)return{...h,state:l.state};const D=g(h,l);return Q&&!Object.is(D.state,h.state)&&i(D.state),D},...E),r=n.state,a=gA.useRef(r);gA.useEffect(()=>{a.current!==r&&(a.current=r,Q||i(r))},[r,a,Q]);const c=gA.useMemo(()=>t!==void 0?{...n,state:t}:n,[n,t]);return gA.useEffect(()=>{Q&&!Object.is(t,n.state)&&s({type:Ilg,state:t})},[t,n.state,Q]),[c,s]}IV(YOI,"useControllableStateReducer");var _OI=Object.defineProperty,bOI=(g,A)=>_OI(g,"name",{value:A,configurable:!0}),HOI={LTR:"ltr"},vOI=gA.createContext(void 0);function eV(g){const A=gA.useContext(vOI);return g||A||HOI.LTR}bOI(eV,"useDirection");var qOI=Object.defineProperty,yfA=(g,A)=>qOI(g,"name",{value:A,configurable:!0}),wfA=!1;function elg(){const[g,A]=gA.useState(wfA);return gA.useEffect(()=>{wfA||(wfA=!0,A(!0))},[]),g}yfA(elg,"useIsHydrated");var tlg=Yp[" useSyncExternalStore ".trim().toString()];function olg(){return()=>{}}yfA(olg,"subscribe");function Blg(){return tlg(olg,()=>!0,()=>!1)}yfA(Blg,"useIsHydratedModern");var TOI=typeof tlg=="function"?Blg:elg,ZOI=Object.defineProperty,dY=(g,A)=>ZOI(g,"name",{value:A,configurable:!0}),ufA="rovingFocusGroup.onEntryFocus",OOI={bubbles:!1,cancelable:!0},cCA="RovingFocusGroup",[GfA,Clg,WOI]=nCA(cCA),[VOI,hCA]=dM(cCA,[WOI]),Qlg={Vertical:"vertical",Horizontal:"horizontal"},jOI={RTL:"rtl"},[zOI,XOI]=VOI(cCA),ilg=gA.forwardRef(dY(function(A,I){return W.jsx(GfA.Provider,{scope:A.__scopeRovingFocusGroup,children:W.jsx(GfA.Slot,{scope:A.__scopeRovingFocusGroup,children:W.jsx($OI,{...A,ref:I})})})},"RovingFocusGroup")),$OI=gA.forwardRef(dY(function(A,I){const{__scopeRovingFocusGroup:e,orientation:t,loop:o=!1,dir:B,currentTabStopId:C,defaultCurrentTabStopId:Q,onCurrentTabStopIdChange:i,onEntryFocus:E,preventScrollOnEntryFocus:n=!1,...s}=A,r=gA.useRef(null),a=$i(I,r),c=eV(B),[h,l]=NN({prop:C,defaultProp:Q??null,onChange:i,caller:cCA}),[D,d]=gA.useState(!1),y=uM(E),w=Clg(e),u=gA.useRef(!1),[G,m]=gA.useState(0);return gA.useEffect(()=>{const p=r.current;if(p)return p.addEventListener(ufA,y),()=>p.removeEventListener(ufA,y)},[y]),W.jsx(zOI,{scope:e,orientation:t,dir:c,loop:o,currentTabStopId:h,onItemFocus:gA.useCallback(p=>l(p),[l]),onItemShiftTab:gA.useCallback(()=>d(!0),[]),onFocusableItemAdd:gA.useCallback(()=>m(p=>p+1),[]),onFocusableItemRemove:gA.useCallback(()=>m(p=>p-1),[]),children:W.jsx(iE.div,{tabIndex:D||G===0?-1:0,"data-orientation":t,...s,ref:a,style:{outline:"none",...A.style},onMouseDown:_o(A.onMouseDown,()=>{u.current=!0}),onFocus:_o(A.onFocus,p=>{const k=!u.current;if(p.target===p.currentTarget&&k&&!D){const S=new CustomEvent(ufA,OOI);if(p.currentTarget.dispatchEvent(S),!S.defaultPrevented){const R=w().filter(Y=>Y.focusable),x=R.find(Y=>Y.active),N=R.find(Y=>Y.id===h),K=[x,N,...R].filter(Boolean).map(Y=>Y.ref.current);mfA(K,n)}}u.current=!1}),onBlur:_o(A.onBlur,()=>d(!1))})})},"RovingFocusGroupImpl")),AWI="RovingFocusGroupItem",Elg=gA.forwardRef(dY(function(A,I){const{__scopeRovingFocusGroup:e,focusable:t=!0,active:o=!1,tabStopId:B,children:C,...Q}=A,i=wM(),E=B||i,n=XOI(AWI,e),s=n.currentTabStopId===E,r=Clg(e),{onFocusableItemAdd:a,onFocusableItemRemove:c,currentTabStopId:h}=n,l=TOI();return Eh(()=>{if(!(!l||!t))return a(),()=>c()},[l,t,a,c]),gA.useEffect(()=>{if(!(l||!t))return a(),()=>c()},[l,t,a,c]),W.jsx(GfA.ItemSlot,{scope:e,id:E,focusable:t,active:o,children:W.jsx(iE.span,{tabIndex:s?0:-1,"data-orientation":n.orientation,...Q,ref:I,onMouseDown:_o(A.onMouseDown,D=>{t?n.onItemFocus(E):D.preventDefault()}),onFocus:_o(A.onFocus,()=>n.onItemFocus(E)),onKeyDown:_o(A.onKeyDown,D=>{if(D.key==="Tab"&&D.shiftKey){n.onItemShiftTab();return}if(D.target!==D.currentTarget)return;const d=slg(D,n.orientation,n.dir);if(d!==void 0){if(D.metaKey||D.ctrlKey||D.altKey||D.shiftKey)return;D.preventDefault();let w=r().filter(u=>u.focusable).map(u=>u.ref.current);if(d==="last")w.reverse();else if(d==="prev"||d==="next"){d==="prev"&&w.reverse();const u=w.indexOf(D.currentTarget);w=n.loop?alg(w,u+1):w.slice(u+1)}setTimeout(()=>mfA(w))}}),children:typeof C=="function"?C({isCurrentTabStop:s,hasTabStop:h!=null}):C})})},"RovingFocusGroupItem")),gWI={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function nlg(g,A){return A!==jOI.RTL?g:g==="ArrowLeft"?"ArrowRight":g==="ArrowRight"?"ArrowLeft":g}dY(nlg,"getDirectionAwareKey");function slg(g,A,I){const e=nlg(g.key,I);if(!(A===Qlg.Vertical&&["ArrowLeft","ArrowRight"].includes(e))&&!(A===Qlg.Horizontal&&["ArrowUp","ArrowDown"].includes(e)))return gWI[e]}dY(slg,"getFocusIntent");function mfA(g,A=!1){const I=document.activeElement;for(const e of g)if(e===I||(e.focus({preventScroll:A}),document.activeElement!==I))return}dY(mfA,"focusFirst");function alg(g,A){return g.map((I,e)=>g[(A+e)%g.length])}dY(alg,"wrapArray");var IWI=Object.defineProperty,YF=(g,A)=>IWI(g,"name",{value:A,configurable:!0});function rlg(g,A){return gA.useReducer((I,e)=>A[I][e]??I,g)}YF(rlg,"useStateMachine");var Rf=YF(g=>{const{present:A,children:I}=g,e=clg(A),t=typeof I=="function"?I({present:e.isPresent}):gA.Children.only(I),o=hlg(e.ref,llg(t));return typeof I=="function"||e.isPresent?gA.cloneElement(t,{ref:o}):null},"Presence");function clg(g){const[A,I]=gA.useState(),e=gA.useRef(null),t=gA.useRef(g),o=gA.useRef("none"),B=gA.useRef(void 0),C=g?"mounted":"unmounted",[Q,i]=rlg(C,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return gA.useEffect(()=>{Q==="mounted"?(o.current=B.current??f9(e.current),B.current=void 0):o.current="none"},[Q]),Eh(()=>{const E=e.current,n=t.current;if(n!==g){const r=o.current,a=f9(E);g?(B.current=a,i("MOUNT")):a==="none"||E?.display==="none"?i("UNMOUNT"):i(n&&r!==a?"ANIMATION_OUT":"UNMOUNT"),t.current=g}},[g,i]),Eh(()=>{if(A){let E;const n=A.ownerDocument.defaultView??window,s=YF(a=>{const h=f9(e.current).includes(CSS.escape(a.animationName));if(a.target===A&&h&&(i("ANIMATION_END"),!t.current)){const l=A.style.animationFillMode;A.style.animationFillMode="forwards",E=n.setTimeout(()=>{A.style.animationFillMode==="forwards"&&(A.style.animationFillMode=l)})}},"handleAnimationEnd"),r=YF(a=>{a.target===A&&(o.current=f9(e.current))},"handleAnimationStart");return A.addEventListener("animationstart",r),A.addEventListener("animationcancel",s),A.addEventListener("animationend",s),()=>{n.clearTimeout(E),A.removeEventListener("animationstart",r),A.removeEventListener("animationcancel",s),A.removeEventListener("animationend",s)}}else i("ANIMATION_END")},[A,i]),{isPresent:["mounted","unmountSuspended"].includes(Q),ref:gA.useCallback(E=>{if(E){const n=getComputedStyle(E);e.current=n,B.current=f9(n)}else e.current=null;I(E)},[])}}YF(clg,"usePresence");function pfA(g,A){if(typeof g=="function")return g(A);g!=null&&(g.current=A)}YF(pfA,"setRef");function hlg(...g){const A=gA.useRef(g);return A.current=g,gA.useCallback(I=>{const e=A.current;let t=!1;const o=e.map(B=>{const C=pfA(B,I);return!t&&typeof C=="function"&&(t=!0),C});if(t)return()=>{for(let B=0;B<o.length;B++){const C=o[B];typeof C=="function"?C():pfA(e[B],null)}}},[])}YF(hlg,"useStableComposedRefs");function f9(g){return g?.animationName||"none"}YF(f9,"getAnimationName");function llg(g){let A=Object.getOwnPropertyDescriptor(g.props,"ref")?.get,I=A&&"isReactWarning"in A&&A.isReactWarning;return I?g.ref:(A=Object.getOwnPropertyDescriptor(g,"ref")?.get,I=A&&"isReactWarning"in A&&A.isReactWarning,I?g.props.ref:g.props.ref||g.ref)}YF(llg,"getElementRef");var eWI=Object.defineProperty,R9=(g,A)=>eWI(g,"name",{value:A,configurable:!0}),Dlg={Automatic:"automatic",Manual:"manual"},kfA="Tabs",[tWI,jXo]=dM(kfA,[hCA]),dlg=hCA(),[oWI,MfA]=tWI(kfA),BWI=gA.forwardRef(R9(function(A,I){const{__scopeTabs:e,value:t,onValueChange:o,defaultValue:B,orientation:C="horizontal",dir:Q,activationMode:i=Dlg.Automatic,...E}=A,n=eV(Q),[s,r]=NN({prop:t,onChange:o,defaultProp:B??"",caller:kfA});return W.jsx(oWI,{scope:e,baseId:wM(),value:s,onValueChange:r,orientation:C,dir:n,activationMode:i,children:W.jsx(iE.div,{dir:n,"data-orientation":C,...E,ref:I})})},"Tabs")),CWI="TabsList",ylg=gA.forwardRef(R9(function(A,I){const{__scopeTabs:e,loop:t=!0,...o}=A,B=MfA(CWI,e),C=dlg(e);return W.jsx(ilg,{asChild:!0,...C,orientation:B.orientation,dir:B.dir,loop:t,children:W.jsx(iE.div,{role:"tablist","aria-orientation":B.orientation,...o,ref:I})})},"TabsList")),QWI="TabsTrigger",wlg=gA.forwardRef(R9(function(A,I){const{__scopeTabs:e,value:t,disabled:o=!1,...B}=A,C=MfA(QWI,e),Q=dlg(e),i=SfA(C.baseId,t),E=ffA(C.baseId,t),n=t===C.value;return W.jsx(Elg,{asChild:!0,...Q,focusable:!o,active:n,children:W.jsx(iE.button,{type:"button",role:"tab","aria-selected":n,"aria-controls":E,"data-state":n?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:i,...B,ref:I,onMouseDown:_o(A.onMouseDown,s=>{!o&&s.button===0&&s.ctrlKey===!1?(s.currentTarget.focus(),C.onValueChange(t)):s.preventDefault()}),onKeyDown:_o(A.onKeyDown,s=>{o||s.target!==s.currentTarget||[" ","Enter"].includes(s.key)&&C.onValueChange(t)}),onFocus:_o(A.onFocus,()=>{const s=C.activationMode!==Dlg.Manual;!n&&!o&&s&&C.onValueChange(t)})})})},"TabsTrigger")),iWI="TabsContent",ulg=gA.forwardRef(R9(function(A,I){const{__scopeTabs:e,value:t,forceMount:o,children:B,...C}=A,Q=MfA(iWI,e),i=SfA(Q.baseId,t),E=ffA(Q.baseId,t),n=t===Q.value,s=gA.useRef(n);return gA.useEffect(()=>{const r=requestAnimationFrame(()=>s.current=!1);return()=>cancelAnimationFrame(r)},[]),W.jsx(Rf,{present:o||n,children:({present:r})=>W.jsx(iE.div,{"data-state":n?"active":"inactive","data-orientation":Q.orientation,role:"tabpanel","aria-labelledby":i,hidden:!r,id:E,tabIndex:0,...C,ref:I,style:{...A.style,animationDuration:s.current?"0s":void 0},children:r&&B})})},"TabsContent"));function SfA(g,A){return`${g}-trigger-${A}`}R9(SfA,"makeTriggerId");function ffA(g,A){return`${g}-content-${A}`}R9(ffA,"makeContentId");function Glg(g){var A,I,e="";if(typeof g=="string"||typeof g=="number")e+=g;else if(typeof g=="object")if(Array.isArray(g)){var t=g.length;for(A=0;A<t;A++)g[A]&&(I=Glg(g[A]))&&(e&&(e+=" "),e+=I)}else for(I in g)g[I]&&(e&&(e+=" "),e+=I);return e}function Nf(){for(var g,A,I=0,e="",t=arguments.length;I<t;I++)(g=arguments[I])&&(A=Glg(g))&&(e&&(e+=" "),e+=A);return e}const RfA="-",EWI=g=>{const A=sWI(g),{conflictingClassGroups:I,conflictingClassGroupModifiers:e}=g;return{getClassGroupId:B=>{const C=B.split(RfA);return C[0]===""&&C.length!==1&&C.shift(),mlg(C,A)||nWI(B)},getConflictingClassGroupIds:(B,C)=>{const Q=I[B]||[];return C&&e[B]?[...Q,...e[B]]:Q}}},mlg=(g,A)=>{if(g.length===0)return A.classGroupId;const I=g[0],e=A.nextPart.get(I),t=e?mlg(g.slice(1),e):void 0;if(t)return t;if(A.validators.length===0)return;const o=g.join(RfA);return A.validators.find(({validator:B})=>B(o))?.classGroupId},plg=/^\[(.+)\]$/,nWI=g=>{if(plg.test(g)){const A=plg.exec(g)[1],I=A?.substring(0,A.indexOf(":"));if(I)return"arbitrary.."+I}},sWI=g=>{const{theme:A,prefix:I}=g,e={nextPart:new Map,validators:[]};return rWI(Object.entries(g.classGroups),I).forEach(([o,B])=>{NfA(B,e,o,A)}),e},NfA=(g,A,I,e)=>{g.forEach(t=>{if(typeof t=="string"){const o=t===""?A:klg(A,t);o.classGroupId=I;return}if(typeof t=="function"){if(aWI(t)){NfA(t(e),A,I,e);return}A.validators.push({validator:t,classGroupId:I});return}Object.entries(t).forEach(([o,B])=>{NfA(B,klg(A,o),I,e)})})},klg=(g,A)=>{let I=g;return A.split(RfA).forEach(e=>{I.nextPart.has(e)||I.nextPart.set(e,{nextPart:new Map,validators:[]}),I=I.nextPart.get(e)}),I},aWI=g=>g.isThemeGetter,rWI=(g,A)=>A?g.map(([I,e])=>{const t=e.map(o=>typeof o=="string"?A+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([B,C])=>[A+B,C])):o);return[I,t]}):g,cWI=g=>{if(g<1)return{get:()=>{},set:()=>{}};let A=0,I=new Map,e=new Map;const t=(o,B)=>{I.set(o,B),A++,A>g&&(A=0,e=I,I=new Map)};return{get(o){let B=I.get(o);if(B!==void 0)return B;if((B=e.get(o))!==void 0)return t(o,B),B},set(o,B){I.has(o)?I.set(o,B):t(o,B)}}},Mlg="!",hWI=g=>{const{separator:A,experimentalParseClassName:I}=g,e=A.length===1,t=A[0],o=A.length,B=C=>{const Q=[];let i=0,E=0,n;for(let h=0;h<C.length;h++){let l=C[h];if(i===0){if(l===t&&(e||C.slice(h,h+o)===A)){Q.push(C.slice(E,h)),E=h+o;continue}if(l==="/"){n=h;continue}}l==="["?i++:l==="]"&&i--}const s=Q.length===0?C:C.substring(E),r=s.startsWith(Mlg),a=r?s.substring(1):s,c=n&&n>E?n-E:void 0;return{modifiers:Q,hasImportantModifier:r,baseClassName:a,maybePostfixModifierPosition:c}};return I?C=>I({className:C,parseClassName:B}):B},lWI=g=>{if(g.length<=1)return g;const A=[];let I=[];return g.forEach(e=>{e[0]==="["?(A.push(...I.sort(),e),I=[]):I.push(e)}),A.push(...I.sort()),A},DWI=g=>({cache:cWI(g.cacheSize),parseClassName:hWI(g),...EWI(g)}),dWI=/\s+/,yWI=(g,A)=>{const{parseClassName:I,getClassGroupId:e,getConflictingClassGroupIds:t}=A,o=[],B=g.trim().split(dWI);let C="";for(let Q=B.length-1;Q>=0;Q-=1){const i=B[Q],{modifiers:E,hasImportantModifier:n,baseClassName:s,maybePostfixModifierPosition:r}=I(i);let a=!!r,c=e(a?s.substring(0,r):s);if(!c){if(!a){C=i+(C.length>0?" "+C:C);continue}if(c=e(s),!c){C=i+(C.length>0?" "+C:C);continue}a=!1}const h=lWI(E).join(":"),l=n?h+Mlg:h,D=l+c;if(o.includes(D))continue;o.push(D);const d=t(c,a);for(let y=0;y<d.length;++y){const w=d[y];o.push(l+w)}C=i+(C.length>0?" "+C:C)}return C};function wWI(){let g=0,A,I,e="";for(;g<arguments.length;)(A=arguments[g++])&&(I=Slg(A))&&(e&&(e+=" "),e+=I);return e}const Slg=g=>{if(typeof g=="string")return g;let A,I="";for(let e=0;e<g.length;e++)g[e]&&(A=Slg(g[e]))&&(I&&(I+=" "),I+=A);return I};function uWI(g,...A){let I,e,t,o=B;function B(Q){const i=A.reduce((E,n)=>n(E),g());return I=DWI(i),e=I.cache.get,t=I.cache.set,o=C,C(Q)}function C(Q){const i=e(Q);if(i)return i;const E=yWI(Q,I);return t(Q,E),E}return function(){return o(wWI.apply(null,arguments))}}const Sc=g=>{const A=I=>I[g]||[];return A.isThemeGetter=!0,A},flg=/^\[(?:([a-z-]+):)?(.+)\]$/i,GWI=/^\d+\/\d+$/,mWI=new Set(["px","full","screen"]),pWI=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kWI=/\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$/,MWI=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,SWI=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fWI=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_F=g=>N9(g)||mWI.has(g)||GWI.test(g),b4=g=>x9(g,"length",KWI),N9=g=>!!g&&!Number.isNaN(Number(g)),xfA=g=>x9(g,"number",N9),tV=g=>!!g&&Number.isInteger(Number(g)),RWI=g=>g.endsWith("%")&&N9(g.slice(0,-1)),mi=g=>flg.test(g),H4=g=>pWI.test(g),NWI=new Set(["length","size","percentage"]),xWI=g=>x9(g,NWI,Rlg),FWI=g=>x9(g,"position",Rlg),UWI=new Set(["image","url"]),JWI=g=>x9(g,UWI,YWI),PWI=g=>x9(g,"",LWI),oV=()=>!0,x9=(g,A,I)=>{const e=flg.exec(g);return e?e[1]?typeof A=="string"?e[1]===A:A.has(e[1]):I(e[2]):!1},KWI=g=>kWI.test(g)&&!MWI.test(g),Rlg=()=>!1,LWI=g=>SWI.test(g),YWI=g=>fWI.test(g),_WI=uWI(()=>{const g=Sc("colors"),A=Sc("spacing"),I=Sc("blur"),e=Sc("brightness"),t=Sc("borderColor"),o=Sc("borderRadius"),B=Sc("borderSpacing"),C=Sc("borderWidth"),Q=Sc("contrast"),i=Sc("grayscale"),E=Sc("hueRotate"),n=Sc("invert"),s=Sc("gap"),r=Sc("gradientColorStops"),a=Sc("gradientColorStopPositions"),c=Sc("inset"),h=Sc("margin"),l=Sc("opacity"),D=Sc("padding"),d=Sc("saturate"),y=Sc("scale"),w=Sc("sepia"),u=Sc("skew"),G=Sc("space"),m=Sc("translate"),p=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],S=()=>["auto",mi,A],R=()=>[mi,A],x=()=>["",_F,b4],N=()=>["auto",N9,mi],U=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],K=()=>["solid","dashed","dotted","double","none"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],b=()=>["start","end","center","between","around","evenly","stretch"],q=()=>["","0",mi],j=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Z=()=>[N9,mi];return{cacheSize:500,separator:":",theme:{colors:[oV],spacing:[_F,b4],blur:["none","",H4,mi],brightness:Z(),borderColor:[g],borderRadius:["none","","full",H4,mi],borderSpacing:R(),borderWidth:x(),contrast:Z(),grayscale:q(),hueRotate:Z(),invert:q(),gap:R(),gradientColorStops:[g],gradientColorStopPositions:[RWI,b4],inset:S(),margin:S(),opacity:Z(),padding:R(),saturate:Z(),scale:Z(),sepia:q(),skew:Z(),space:R(),translate:R()},classGroups:{aspect:[{aspect:["auto","square","video",mi]}],container:["container"],columns:[{columns:[H4]}],"break-after":[{"break-after":j()}],"break-before":[{"break-before":j()}],"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:[...U(),mi]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:p()}],"overscroll-x":[{"overscroll-x":p()}],"overscroll-y":[{"overscroll-y":p()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[c]}],"inset-x":[{"inset-x":[c]}],"inset-y":[{"inset-y":[c]}],start:[{start:[c]}],end:[{end:[c]}],top:[{top:[c]}],right:[{right:[c]}],bottom:[{bottom:[c]}],left:[{left:[c]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",tV,mi]}],basis:[{basis:S()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",mi]}],grow:[{grow:q()}],shrink:[{shrink:q()}],order:[{order:["first","last","none",tV,mi]}],"grid-cols":[{"grid-cols":[oV]}],"col-start-end":[{col:["auto",{span:["full",tV,mi]},mi]}],"col-start":[{"col-start":N()}],"col-end":[{"col-end":N()}],"grid-rows":[{"grid-rows":[oV]}],"row-start-end":[{row:["auto",{span:[tV,mi]},mi]}],"row-start":[{"row-start":N()}],"row-end":[{"row-end":N()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",mi]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",mi]}],gap:[{gap:[s]}],"gap-x":[{"gap-x":[s]}],"gap-y":[{"gap-y":[s]}],"justify-content":[{justify:["normal",...b()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...b(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...b(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[D]}],px:[{px:[D]}],py:[{py:[D]}],ps:[{ps:[D]}],pe:[{pe:[D]}],pt:[{pt:[D]}],pr:[{pr:[D]}],pb:[{pb:[D]}],pl:[{pl:[D]}],m:[{m:[h]}],mx:[{mx:[h]}],my:[{my:[h]}],ms:[{ms:[h]}],me:[{me:[h]}],mt:[{mt:[h]}],mr:[{mr:[h]}],mb:[{mb:[h]}],ml:[{ml:[h]}],"space-x":[{"space-x":[G]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[G]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",mi,A]}],"min-w":[{"min-w":[mi,A,"min","max","fit"]}],"max-w":[{"max-w":[mi,A,"none","full","min","max","fit","prose",{screen:[H4]},H4]}],h:[{h:[mi,A,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[mi,A,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[mi,A,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[mi,A,"auto","min","max","fit"]}],"font-size":[{text:["base",H4,b4]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",xfA]}],"font-family":[{font:[oV]}],"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",mi]}],"line-clamp":[{"line-clamp":["none",N9,xfA]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_F,mi]}],"list-image":[{"list-image":["none",mi]}],"list-style-type":[{list:["none","disc","decimal",mi]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[g]}],"placeholder-opacity":[{"placeholder-opacity":[l]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[g]}],"text-opacity":[{"text-opacity":[l]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",_F,b4]}],"underline-offset":[{"underline-offset":["auto",_F,mi]}],"text-decoration-color":[{decoration:[g]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",mi]}],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",mi]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[l]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...U(),FWI]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",xWI]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},JWI]}],"bg-color":[{bg:[g]}],"gradient-from-pos":[{from:[a]}],"gradient-via-pos":[{via:[a]}],"gradient-to-pos":[{to:[a]}],"gradient-from":[{from:[r]}],"gradient-via":[{via:[r]}],"gradient-to":[{to:[r]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[C]}],"border-w-x":[{"border-x":[C]}],"border-w-y":[{"border-y":[C]}],"border-w-s":[{"border-s":[C]}],"border-w-e":[{"border-e":[C]}],"border-w-t":[{"border-t":[C]}],"border-w-r":[{"border-r":[C]}],"border-w-b":[{"border-b":[C]}],"border-w-l":[{"border-l":[C]}],"border-opacity":[{"border-opacity":[l]}],"border-style":[{border:[...K(),"hidden"]}],"divide-x":[{"divide-x":[C]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[C]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[l]}],"divide-style":[{divide:K()}],"border-color":[{border:[t]}],"border-color-x":[{"border-x":[t]}],"border-color-y":[{"border-y":[t]}],"border-color-s":[{"border-s":[t]}],"border-color-e":[{"border-e":[t]}],"border-color-t":[{"border-t":[t]}],"border-color-r":[{"border-r":[t]}],"border-color-b":[{"border-b":[t]}],"border-color-l":[{"border-l":[t]}],"divide-color":[{divide:[t]}],"outline-style":[{outline:["",...K()]}],"outline-offset":[{"outline-offset":[_F,mi]}],"outline-w":[{outline:[_F,b4]}],"outline-color":[{outline:[g]}],"ring-w":[{ring:x()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[g]}],"ring-opacity":[{"ring-opacity":[l]}],"ring-offset-w":[{"ring-offset":[_F,b4]}],"ring-offset-color":[{"ring-offset":[g]}],shadow:[{shadow:["","inner","none",H4,PWI]}],"shadow-color":[{shadow:[oV]}],opacity:[{opacity:[l]}],"mix-blend":[{"mix-blend":[...Y(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Y()}],filter:[{filter:["","none"]}],blur:[{blur:[I]}],brightness:[{brightness:[e]}],contrast:[{contrast:[Q]}],"drop-shadow":[{"drop-shadow":["","none",H4,mi]}],grayscale:[{grayscale:[i]}],"hue-rotate":[{"hue-rotate":[E]}],invert:[{invert:[n]}],saturate:[{saturate:[d]}],sepia:[{sepia:[w]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[I]}],"backdrop-brightness":[{"backdrop-brightness":[e]}],"backdrop-contrast":[{"backdrop-contrast":[Q]}],"backdrop-grayscale":[{"backdrop-grayscale":[i]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[E]}],"backdrop-invert":[{"backdrop-invert":[n]}],"backdrop-opacity":[{"backdrop-opacity":[l]}],"backdrop-saturate":[{"backdrop-saturate":[d]}],"backdrop-sepia":[{"backdrop-sepia":[w]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[B]}],"border-spacing-x":[{"border-spacing-x":[B]}],"border-spacing-y":[{"border-spacing-y":[B]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",mi]}],duration:[{duration:Z()}],ease:[{ease:["linear","in","out","in-out",mi]}],delay:[{delay:Z()}],animate:[{animate:["none","spin","ping","pulse","bounce",mi]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[y]}],"scale-x":[{"scale-x":[y]}],"scale-y":[{"scale-y":[y]}],rotate:[{rotate:[tV,mi]}],"translate-x":[{"translate-x":[m]}],"translate-y":[{"translate-y":[m]}],"skew-x":[{"skew-x":[u]}],"skew-y":[{"skew-y":[u]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",mi]}],accent:[{accent:["auto",g]}],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",mi]}],"caret-color":[{caret:[g]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",mi]}],fill:[{fill:[g,"none"]}],"stroke-w":[{stroke:[_F,b4,xfA]}],stroke:[{stroke:[g,"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"]}}});var Nlg={env:{},version:""};const Me="u">typeof window?window:void 0,Vu="u">typeof globalThis?globalThis:Me,Rw=Vu?.navigator,ro=Vu?.document,ta=Vu?.location,BV=Vu?.fetch,FfA=Vu?.XMLHttpRequest&&"withCredentials"in new Vu.XMLHttpRequest?Vu.XMLHttpRequest:void 0,xlg=Vu?.AbortController,bWI=Vu?.CompressionStream,Am=Rw?.userAgent,CV=typeof globalThis<"u"?globalThis:Me;CV&&typeof self>"u"&&(CV.self=CV),CV&&typeof File>"u"&&(CV.File=function(){});const FB=Me??{},HWI="0.9.12",bF={DEBUG:!1,LIB_VERSION:HWI,LIB_NAME:"browser-common"};var xN=(function(g){return g.AnonymousId="anonymous_id",g.DistinctId="distinct_id",g.Props="props",g.EnablePersonProcessing="enable_person_processing",g.PersonMode="person_mode",g.FeatureFlagDetails="feature_flag_details",g.FeatureFlags="feature_flags",g.FeatureFlagPayloads="feature_flag_payloads",g.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",g.BootstrapFeatureFlags="bootstrap_feature_flags",g.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",g.OverrideFeatureFlags="override_feature_flags",g.Queue="queue",g.AiQueue="ai_queue",g.AiCaptureQueue="ai_capture_queue",g.LogsQueue="logs_queue",g.OptedOut="opted_out",g.SessionId="session_id",g.SessionStartTimestamp="session_start_timestamp",g.SessionLastTimestamp="session_timestamp",g.PersonProperties="person_properties",g.GroupProperties="group_properties",g.InstalledAppBuild="installed_app_build",g.InstalledAppVersion="installed_app_version",g.SessionReplay="session_replay",g.PushRegistered="push_registered",g.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",g.SurveyLastSeenDate="survey_last_seen_date",g.SurveysInProgress="surveys_in_progress",g.SurveysSeen="surveys_seen",g.Surveys="surveys",g.RemoteConfig="remote_config",g.FlagsEndpointWasHit="flags_endpoint_was_hit",g.DeviceId="device_id",g})({}),UfA=(function(g){return g.GZipJS="gzip-js",g.Base64="base64",g})({});const vWI=["$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"],qWI=["token"];function yB(g,A){return g.indexOf(A)!==-1}const F9=function(g){return g.trim()},JfA=function(g){return g.replace(/^\$/,"")};function Flg(g){var A;const I=[];return(A=JSON.stringify(g,function(e,t){if(typeof t=="bigint")return t.toString();if(typeof t!="function"&&typeof t!="symbol"){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&typeof t=="object"){for(;I.length>0&&I[I.length-1]!==this;)I.pop();if(I.includes(t))return"[Circular]";I.push(t)}return t}}))!==null&&A!==void 0?A:"null"}const Ulg=Object.prototype,PfA=Ulg.hasOwnProperty,lCA=Ulg.toString,aB=Array.isArray||function(g){return lCA.call(g)==="[object Array]"},Xh=g=>typeof g=="function",yC=g=>g===Object(g)&&!aB(g),_p=g=>{if(yC(g)){for(const A in g)if(PfA.call(g,A))return!1;return!0}return!1},Le=g=>g===void 0,UC=g=>lCA.call(g)=="[object String]",QV=g=>UC(g)&&g.trim().length===0,fc=g=>g===null,rC=g=>Le(g)||fc(g),$h=g=>lCA.call(g)=="[object Number]"&&g==g,HF=g=>$h(g)&&g>0,gm=g=>lCA.call(g)==="[object Boolean]",TWI=g=>yB(vWI,g),ZWI=g=>yB(qWI,g);function Jlg(g){return g===null||typeof g!="object"}function DCA(g,A){return{}.toString.call(g)===`[object ${A}]`}function U9(g){switch({}.toString.call(g)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Plg(g,Error)}}function KfA(g){return"u">typeof Event&&Plg(g,Event)}function Plg(g,A){try{return g instanceof A}catch{return!1}}const OWI=[!0,"true",1,"1","yes"],LfA=g=>yB(OWI,g),WWI=[!1,"false",0,"0","no"];function Klg(g,A,I,e,t,o,B){try{var C=g[o](B),Q=C.value}catch(i){return void I(i)}C.done?A(Q):Promise.resolve(Q).then(e,t)}function oa(g){return function(){var A=this,I=arguments;return new Promise(function(e,t){var o=g.apply(A,I);function B(Q){Klg(o,e,t,B,C,"next",Q)}function C(Q){Klg(o,e,t,B,C,"throw",Q)}B(void 0)})}}const VWI=["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"],dCA=new Map,Llg=function(g,A=[]){if(!g)return!1;const I=(function(B,C){let Q="";for(let i=0;C.length>i;i++){const E=C[i];Q+=E.length+":"+E}return B.length+":"+B+"|"+C.length+":"+Q})(g,A),e=dCA.get(I);if(e!==void 0)return e;const t=g.toLowerCase(),o=VWI.concat(A).some(B=>t.indexOf(B.toLowerCase())!==-1);return 256>dCA.size||dCA.clear(),dCA.set(I,o),o};function FN(g,A,I,e,t){return A>I&&(e.warn("min cannot be greater than max."),A=I),$h(g)?g>I?(e.warn(" cannot be greater than max: "+I+". Using max value instead."),I):A>g?(e.warn(" cannot be less than min: "+A+". Using min value instead."),A):g:(e.warn(" must be a number. using max or fallback. max: "+I+", fallback: "+t),FN(t??I,A,I,e))}var jWI=class{constructor(A){this.C={},this.I=A.I,this.R=FN(A.bucketSize,0,100,A.$),this.A=FN(A.refillRate,0,this.R,A.$),this.O=FN(A.refillInterval,0,864e5,A.$)}F(A,I){const e=Math.floor((I-A.lastAccess)/this.O);e>0&&(A.tokens=Math.min(A.tokens+e*this.A,this.R),A.lastAccess=A.lastAccess+e*this.O)}consumeRateLimit(A){var I;const e=Date.now(),t=String(A);let o=this.C[t];return o?this.F(o,e):(o={tokens:this.R,lastAccess:e},this.C[t]=o),o.tokens===0||(o.tokens--,o.tokens===0&&((I=this.I)===null||I===void 0||I.call(this,A)),o.tokens===0)}stop(){this.C={}}};const J9="Mobile",iV="Android",yCA="Tablet",Ylg="Android Tablet",_lg="iPad",blg="Apple Watch",wCA="Safari",uCA="BlackBerry",Hlg="Samsung Internet",GCA="Chrome",vlg="Chrome iOS",qlg="Internet Explorer",Tlg="Internet Explorer Mobile",Zlg="Opera",Olg="Microsoft Edge",mCA="Firefox",Wlg="Firefox iOS",pCA="Nintendo",kCA="PlayStation",MCA="Xbox",Vlg="Android Mobile",jlg="Mobile Safari",YfA="Windows",zlg="Windows Phone",Xlg="Nokia",_fA="Ouya",zWI="Generic "+J9.toLowerCase(),$lg="Generic "+yCA.toLowerCase(),bfA="Konqueror",ADg="Oculus Browser",gDg="Vivaldi",IDg="Yandex",eDg="Whale",tDg="DuckDuckGo",oDg="Pale Moon",BDg="Waterfox",HfA="Brave",CDg="Claude",QDg="Codex",iDg="ChatGPT",EDg="Google Search App",vfA=new RegExp("Version/(\\d+(\\.\\d+)?)"),qfA=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),XWI=new RegExp(MCA,"i"),$WI=new RegExp("PlayStation \\w+","i"),AVI=new RegExp("Nintendo \\w+","i"),TfA=new RegExp("BlackBerry|PlayBook|BB10","i"),gVI={"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"},nDg=function(g,A,I,e){return A=A||"",(function(o){return o?.brave?HfA:null})(I)||(e?.detectGoogleSearchApp&&yB(g,"GSA/")?EDg:yB(g," OPR/")&&yB(g,"Mini")?"Opera Mini":yB(g," OPR/")?Zlg:TfA.test(g)?uCA:yB(g,"IEMobile")||yB(g,"WPDesktop")?Tlg:yB(g,"OculusBrowser")?ADg:yB(g,"SamsungBrowser")?Hlg:yB(g,"Edge")||yB(g,"Edg/")?Olg:yB(g,"Vivaldi/")?gDg:yB(g,"YaBrowser/")?IDg:yB(g,"Whale/")?eDg:yB(g,"DuckDuckGo/")||yB(g,"Ddg/")?tDg:yB(g,"Claude/")?CDg:yB(g,"Codex/")?QDg:yB(g,"ChatGPT/")?iDg:yB(g,"FBIOS")?"Facebook Mobile":yB(g,"UCWEB")||yB(g,"UCBrowser")?"UC Browser":yB(g,"CriOS")?vlg:yB(g,"CrMo")||yB(g,GCA)?GCA:yB(g,iV)&&yB(g,wCA)?Vlg:yB(g,"FxiOS")?Wlg:yB(g.toLowerCase(),bfA.toLowerCase())?bfA:yB(g,"Brave/")?HfA:((o,B)=>B&&yB(B,"Apple")||(function(C){return yB(C,wCA)&&!yB(C,GCA)&&!yB(C,iV)})(o))(g,A)?yB(g,J9)?jlg:wCA:yB(g,"PaleMoon/")?oDg:yB(g,"Waterfox/")?BDg:yB(g,mCA)?mCA:yB(g,"MSIE")||yB(g,"Trident/")?qlg:yB(g,"Gecko")?mCA:"")},IVI={[Tlg]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Olg]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[GCA]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[vlg]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[wCA]:[vfA],[jlg]:[vfA],[Zlg]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[mCA]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[Wlg]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[bfA]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[uCA]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),vfA],[Vlg]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Hlg]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[ADg]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[gDg]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[IDg]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[eDg]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[HfA]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[CDg]:[qfA],[QDg]:[qfA],[iDg]:[qfA],[tDg]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[oDg]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[BDg]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[EDg]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[qlg]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},eVI=function(g,A,I,e){const t=nDg(g,A,I,e),o=IVI[t];if(Le(o))return null;for(let B=0;o.length>B;B++){const C=g.match(o[B]);if(C)return parseFloat(C[C.length-2])}return null},sDg=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),g=>[MCA,g&&g[1]||""]],[new RegExp(pCA,"i"),[pCA,""]],[new RegExp(kCA,"i"),[kCA,""]],[TfA,[uCA,""]],[new RegExp(YfA,"i"),(g,A)=>{if(/Phone/.test(A)||/WPDesktop/.test(A))return[zlg,""];if(new RegExp(J9).test(A)&&!/IEMobile\b/.test(A))return["Windows Mobile",""];const I=/Windows NT ([0-9.]+)/i.exec(A);if(I&&I[1]){let e=gVI[I[1]]||"";return/arm/i.test(A)&&(e="RT"),[YfA,e]}return[YfA,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,g=>g&&g[3]?["iOS",[g[3],g[4],g[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,g=>{let A="";return g&&g.length>=3&&(A=Le(g[2])?g[3]:g[2]),["watchOS",A]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),g=>g&&g[2]?[iV,[g[2],g[3],g[4]||"0"].join(".")]:[iV,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,g=>{const A=["Mac OS X",""];return g&&g[1]&&(A[1]=[g[1],g[2],g[3]||"0"].join(".")),A}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],aDg=function(g){for(let A=0;sDg.length>A;A++){const[I,e]=sDg[A],t=I.exec(g),o=t&&(Xh(e)?e(t,g):e);if(o)return o}return["",""]},rDg=function(g){return AVI.test(g)?pCA:$WI.test(g)?kCA:XWI.test(g)?MCA:new RegExp(_fA,"i").test(g)?_fA:new RegExp("(Windows Phone|WPDesktop)","i").test(g)?zlg:/iPad/.test(g)?_lg:/iPod/.test(g)?"iPod Touch":/iPhone/.test(g)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(g)?blg:TfA.test(g)?uCA:/(kobo)\s(ereader|touch)/i.test(g)?"Kobo":new RegExp(Xlg,"i").test(g)?Xlg:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(g)||/(kf[a-z]+)( bui|\)).+silk\//i.test(g)?"Kindle Fire":/(Android|ZTE)/i.test(g)?new RegExp(J9).test(g)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(g)||/pixel[\daxl ]{1,6}/i.test(g)&&!/pixel c/i.test(g)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(g)||/lmy47v/i.test(g)&&!/QTAQZ3/i.test(g)?iV:Ylg:new RegExp("(pda|Mobile)","i").test(g)?zWI:new RegExp(yCA,"i").test(g)&&!new RegExp("Tablet pc","i").test(g)?$lg:""},tVI=function(g,A){var I;const e=rDg(g);return e===_lg||e===Ylg||e==="Kobo"||e==="Kindle Fire"||e===$lg?yCA:e===pCA||e===MCA||e===kCA||e===_fA?"Console":e===blg?"Wearable":e?J9:A?.userAgentDataPlatform==="Android"&&((I=A?.maxTouchPoints)!==null&&I!==void 0?I:0)>0?600>Math.min((t=A?.screenWidth)!==null&&t!==void 0?t:0,(o=A?.screenHeight)!==null&&o!==void 0?o:0)/((B=A?.devicePixelRatio)!==null&&B!==void 0?B:1)?J9:yCA:"Desktop";var t,o,B},ZfA=/\bFBAV\/(\d+(?:\.\d+)*)/i,cDg=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",ZfA],[/\bFBAN\/EMA\b/i,"Facebook Lite",ZfA],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",ZfA],[/\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"]],OfA="[Truncated]",EV="[Unserializable]";function P9(g){let A="";for(let I=0;g.length>I;I++){const e=g.charCodeAt(I);if(55296>e||e>56319)A+=56320>e||e>57343?g[I]:"�";else{const t=g.charCodeAt(I+1);56320>t||t>57343?A+="�":(A+=g[I]+g[I+1],I++)}}return A}function hDg(g,A){if(!A)return g;let I=[];try{I=Object.keys(A)}catch{I=[]}for(const e of I){let t;try{t=A[e]}catch{t=EV}Object.defineProperty(g,e,{value:t,enumerable:!0,writable:!0,configurable:!0})}return g}const SCA=3e5;var lDg=class{record(A){if(A.kind==="too-large")return;if(A.kind!=="retry-later")return void this.reset();if(!A.retryAfterMs)return;const I=this.isOpen(),e=Date.now(),t=Math.min(A.retryAfterMs,SCA);if(!I)return this.ts=e,void(this.es=e+t);this.es=Math.max(this.es,Math.min(e+t,this.ts+SCA))}remainingMs(){const A=Date.now();if(this.ts-5e3>A)return this.reset(),0;const I=Math.min(SCA,Math.max(0,this.es-A));return I===0&&this.reset(),I}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const oVI=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function DDg(g,A){return typeof(I=g)=="string"&&oVI.test(I)?g:A();var I}function dDg(g,A){const I=new Error(A);try{Object.defineProperty(I,"name",{value:g,writable:!0,enumerable:!0,configurable:!0})}catch{}return I}function v4(g){return g&&g.split("#")[0]}function yDg(g){try{return g()}catch{return}}function wDg(g,A){const I=setTimeout(g,A);return I!=null&&I.unref&&I?.unref(),I}function uDg(g,A,I){return GDg.apply(this,arguments)}function GDg(){return(GDg=oa(function*(g,A,I){let e;try{return yield Promise.race([g,new Promise((t,o)=>{e=wDg(()=>{try{I?.(),t()}catch(B){o(B)}},A)})])}finally{clearTimeout(e)}})).apply(this,arguments)}function nV(g){return nV=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},nV(g)}function BVI(g,A,I){return(A=(function(e){var t=(function(o){if(nV(o)!="object"||!o)return o;var B=o[Symbol.toPrimitive];if(B!==void 0){var C=B.call(o,"string");if(nV(C)!="object")return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)})(e);return nV(t)=="symbol"?t:t+""})(A))in g?Object.defineProperty(g,A,{value:I,enumerable:!0,configurable:!0,writable:!0}):g[A]=I,g}function mDg(g,A){var I=Object.keys(g);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(g);A&&(e=e.filter(function(t){return Object.getOwnPropertyDescriptor(g,t).enumerable})),I.push.apply(I,e)}return I}function QI(g){for(var A=1;arguments.length>A;A++){var I=arguments[A]!=null?arguments[A]:{};A%2?mDg(Object(I),!0).forEach(function(e){BVI(g,e,I[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(I)):mDg(Object(I)).forEach(function(e){Object.defineProperty(g,e,Object.getOwnPropertyDescriptor(I,e))})}return g}let sV,pDg,kDg,K9;function CVI(g){var A;const I=globalThis._posthogChunkIds,e=globalThis._debugIds;if(!I&&!e)return;const t=I?Object.keys(I):[],o=e?Object.keys(e):[];if(K9&&MDg(I,t,pDg)&&MDg(e,o,kDg))return K9;pDg=I?QI({},I):void 0,kDg=e?QI({},e):void 0,K9={},(A=sV)!==null&&A!==void 0||(sV={});const B=(C,Q)=>{for(const E of C){const n=Q[E];if(!n)continue;const s=sV?.[E];if(s){K9[s]=n;continue}const r=g(E);for(let a=r.length-1;a>=0;a--){var i;const c=(i=r[a])===null||i===void 0?void 0:i.filename;if(c){K9[c]=n,sV[E]=c;break}}}};return e&&B(o,e),I&&B(t,I),K9}function MDg(g,A,I){return g&&I?A.length===Object.keys(I).length&&A.every(e=>g[e]===I[e]):g===I}var QVI=class{constructor(A,I,e=[]){this.coercers=A,this.stackParser=I,this.modifiers=e}buildFromUnknown(A,I={}){const e=I&&I.mechanism||{handled:!0,type:"generic"},t=this.buildCoercingContext(e,I,0).apply(A),o=this.buildParsingContext(I),B=this.parseStacktrace(t,o);return{$exception_list:this.convertToExceptionList(B,e),$exception_level:"error"}}modifyFrames(A){var I=this;return oa(function*(){for(const e of A)e.stacktrace&&e.stacktrace.frames&&aB(e.stacktrace.frames)&&(e.stacktrace.frames=yield I.applyModifiers(e.stacktrace.frames));return A})()}coerceFallback(A){var I;return{type:"Error",value:"Unknown error",stack:(I=A.syntheticException)===null||I===void 0?void 0:I.stack,synthetic:!0}}parseStacktrace(A,I){var e;let t,o;if(A.cause!=null&&(t=this.parseStacktrace(A.cause,I)),A.stack!=""&&A.stack!=null)try{o=this.applyChunkIds(this.stackParser(A.stack,A.synthetic?I.skipFirstLines:0),I.chunkIdMap)}catch{}return QI(QI({},A),{},{cause:t,stack:o,errors:(e=A.errors)===null||e===void 0?void 0:e.map(B=>this.parseStacktrace(B,I))})}applyChunkIds(A,I){return A.map(e=>(e.filename&&I&&(e.chunk_id=I[e.filename]),e))}applyCoercers(A,I){for(const e of this.coercers)if(e.match(A))return e.coerce(A,I);return this.coerceFallback(I)}applyModifiers(A){var I=this;return oa(function*(){let e=A;for(const t of I.modifiers)e=yield t(e);return e})()}convertToExceptionList(A,I){const e=[],t=(o,B,C)=>{var Q;const i=e.length,E=B===void 0?QI(QI({type:typeof I.type=="string"&&I.type.length>0?I.type:"generic"},typeof I.handled=="boolean"?{handled:I.handled}:I.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof I.synthetic=="boolean"?I.synthetic:o.synthetic,exception_id:i}):{type:"chained",source:C,synthetic:o.synthetic,exception_id:i,parent_id:B},n={type:o.type,value:o.value,mechanism:E};o.stack&&(n.stacktrace={type:"raw",frames:o.stack}),e.push(n),o.cause&&t(o.cause,i,"cause");for(const s of(Q=o.errors)!==null&&Q!==void 0?Q:[])t(s,i,"member")};return t(A),e}buildParsingContext(A){var I;return{chunkIdMap:CVI(this.stackParser),skipFirstLines:(I=A.skipFirstLines)!==null&&I!==void 0?I:1}}getAggregateErrors(A){try{if(U9(A)){let e=Object.getPrototypeOf(A);for(let t=0;e&&100>t;t++){var I;const o=(I=Object.getOwnPropertyDescriptor(e,"constructor"))===null||I===void 0?void 0:I.value;if(typeof o=="function"&&o.name==="AggregateError"){const B=A.errors;return aB(B)?B:void 0}e=Object.getPrototypeOf(e)}}}catch{}}buildCoercingContext(A,I,e=0){let t=0,o=0,B=!1;const C=new Set,Q=[],i={},E=(r,a,c=0)=>{const h=n(a,c),l=h.apply;if(h.apply=G=>{Q.push(r);try{return l(G)}finally{Q.pop()}},c>4||c>0&&Q.indexOf(r)!==-1)return this.coerceFallback(h);const D=typeof r=="object"&&r!==null||typeof r=="function";if(c===0&&t>=50||D&&C.has(r))return;D&&C.add(r),c===0&&t++;const d=this.getAggregateErrors(r);let y,w;B||(B=!!d);try{if(y=this.applyCoercers(r,h),!y)throw i}catch(G){if(G===i)return void(c===0&&t--);if(!B)throw G;y=this.coerceFallback(h)}if(!d||t>=50)return y;try{w=d.length}catch{return y}if(!Number.isInteger(w)||0>w||w>4294967295)return y;const u=[];for(let G=0;50>t&&1e3>o&&w>G;G++){let m;o++;try{m=h.next(d[G])}catch{t++,m=this.coerceFallback(n(a+1))}m&&u.push(m)}return QI(QI({},y),{},{errors:u})},n=(r,a=0)=>QI(QI({},I),{},{syntheticException:r==0?I.syntheticException:void 0,mechanism:r==0?A:{},apply(c){const h=E(c,r,a+1);if(!h)throw i;return h},next:c=>E(c,r+1)}),s=n(e);return QI(QI({},s),{},{apply:r=>{var a;return(a=E(r,e))!==null&&a!==void 0?a:this.coerceFallback(s)}})}};const iVI=/^([a-z][a-z0-9.+-]+):/i,EVI=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function nVI(g){if(!g||g==="<anonymous>")return!1;const A=iVI.exec(g);return!A||EVI.includes(A[1].toLowerCase())}function WfA(g,A,I,e,t){const o={platform:g,filename:A,function:I==="<anonymous>"?"?":I,in_app:nVI(A)};return Le(e)||(o.lineno=e),Le(t)||(o.colno=t),o}const SDg=(g,A)=>{const I=g.indexOf("safari-extension")!==-1,e=g.indexOf("safari-web-extension")!==-1;return I||e?[g.indexOf("@")!==-1?g.split("@")[0]:"?",I?`safari-extension:${A}`:`safari-web-extension:${A}`]:[g,A]},sVI=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,aVI=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,rVI=/\((\S*)(?::(\d+))(?::(\d+))\)/,cVI=(g,A)=>{const I=sVI.exec(g);if(I){const[,t,o,B]=I;return WfA(A,t,"?",+o,+B)}const e=aVI.exec(g);if(e){if(e[2]&&e[2].indexOf("eval")===0){const B=rVI.exec(e[2]);B&&(e[2]=B[1],e[3]=B[2],e[4]=B[3])}const[t,o]=SDg(e[1]||"?",e[2]);return WfA(A,o,t,e[3]?+e[3]:void 0,e[4]?+e[4]:void 0)}},hVI=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,lVI=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,DVI=(g,A)=>{const I=hVI.exec(g);if(I){if(I[3]&&I[3].indexOf(" > eval")>-1){const o=lVI.exec(I[3]);o&&(I[1]=I[1]||"eval",I[3]=o[1],I[4]=o[2],I[5]="")}let e=I[3],t=I[1]||"?";return[t,e]=SDg(t,e),WfA(A,e,t,I[4]?+I[4]:void 0,I[5]?+I[5]:void 0)}},fDg=/\(error: (.*)\)/;function VfA(g,A){return g.filename===A.filename&&g.function===A.function&&g.module===A.module&&g.lineno===A.lineno&&g.colno===A.colno}function dVI(g){for(let A=1;10>=A;A++){const I=g.length-2*A;if(0>I)break;let e=!0;for(let t=0;A>t;t++)if(!VfA(g[I+t],g[I+A+t])){e=!1;break}if(e){for(let t=0;A>t;t++)g[I+t]=g[I+A+t];return g.length=I+A,{start:I,length:A}}}}function yVI(g,A){const I=A.start+A.length,e=NDg(g,A);e&&g.splice(I+e===g.length?I:A.start,e)}function RDg(g,A){let I=A.start;for(;I>0&&VfA(g[I-1],g[I-1+A.length]);)I--;return A.start-I}function NDg(g,A){const I=A.start+A.length;let e=I;for(;g.length>e&&VfA(g[e],g[e-A.length]);)e++;return e-I}function wVI(g,A){const I=A[0];let e=g.length-(I?RDg(g,I):0);for(const t of A)e-=NDg(g,t);return e}function uVI(g,A,I){for(let e=0;g.length>e;e++){const t=g[(A+e)%g.length],o=g[(I+e)%g.length];if(t!==o)return o>t}return!1}var GVI=class{match(A){return this.isDOMException(A)||this.isDOMError(A)}coerce(A,I){const e=UC(A.stack);return{type:this.getType(A),value:this.getValue(A),stack:e?A.stack:void 0,cause:A.cause?I.next(A.cause):void 0,synthetic:!1}}getType(A){return this.isDOMError(A)?"DOMError":"DOMException"}getValue(A){const I=A.name||(this.isDOMError(A)?"DOMError":"DOMException");return A.message?`${I}: ${A.message}`:I}isDOMException(A){return DCA(A,"DOMException")}isDOMError(A){return DCA(A,"DOMError")}},mVI=class{match(A){return U9(A)}coerce(A,I){var e;const t=this.getStack(A),o=t===void 0?(e=I.syntheticException)===null||e===void 0?void 0:e.stack:void 0,B=!!o;return{type:this.getType(A),value:this.getMessage(A,I),stack:t??o,cause:A.cause?I.next(A.cause):void 0,synthetic:B}}getType(A){return A.name||A.constructor.name}getMessage(A,I){const e=A.message;return String(e.error&&typeof e.error.message=="string"?e.error.message:e)}getStack(A){try{const I=A.stacktrace;if(typeof I=="string"&&I.length>0)return I;const e=A.stack;return typeof e=="string"&&e.length>0?e:void 0}catch{return}}},pVI=class{match(A){return!!DCA(A,"ErrorEvent")&&(A.error!=null||this.hr(A))}coerce(A,I){var e;if(A.error!=null)return I.apply(A.error);const t=I.apply(A.message);return QI(QI({},t),{},{stack:(e=this.vr(A))!==null&&e!==void 0?e:t.stack,synthetic:!0})}hr(A){return UC(A.message)&&A.message.length>0}vr(A){var I,e;const t=A,o=(I=t.lineno)!==null&&I!==void 0?I:0,B=(e=t.colno)!==null&&e!==void 0?e:0;if(UC(t.filename)&&t.filename.length!==0&&o!==0)return`Error
240
+ at ${t.filename}:${o}:${B}`}};const kVI=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var MVI=class{match(A){return typeof A=="string"}coerce(A,I){var e;const[t,o]=this.getInfos(A);return{type:t??"Error",value:o??A,stack:(e=I.syntheticException)===null||e===void 0?void 0:e.stack,synthetic:!0}}getInfos(A){let I="Error",e=A;const t=A.match(kVI);return t&&(I=t[1],e=t[2]),[I,e]}};const SVI=["fatal","error","warning","log","info","debug"];function xDg(g,A=40){const I=Object.keys(g);if(I.sort(),!I.length)return"[object has no keys]";for(let e=I.length;e>0;e--){const t=I.slice(0,e).join(", ");if(A>=t.length)return e===I.length?t:t.length>A?`${t.slice(0,A)}...`:t}return""}var fVI=class{match(A){return typeof A=="object"&&A!==null}coerce(A,I){var e,t;const o=this.getErrorPropertyFromObject(A);return o?I.apply(o):{type:this.getType(A),value:this.getValue(A),stack:(e=this.getStack(A))!==null&&e!==void 0?e:(t=I.syntheticException)===null||t===void 0?void 0:t.stack,level:this.isSeverityLevel(A.level)?A.level:"error",synthetic:!0}}getType(A){if(KfA(A))return A.constructor.name;const I="name"in A?A.name:void 0;return UC(I)&&!QV(I)?I:"Error"}getValue(A){if("name"in A&&typeof A.name=="string"){let e=`'${A.name}' captured as exception`;return"message"in A&&typeof A.message=="string"&&(e+=` with message: '${A.message}'`),e}if("message"in A&&typeof A.message=="string")return A.message;const I=this.getObjectClassName(A);return`${I&&I!=="Object"?`'${I}'`:"Object"} captured as exception with keys: ${xDg(A)}`}isSeverityLevel(A){return UC(A)&&!QV(A)&&SVI.indexOf(A)>=0}getStack(A){try{return UC(A.stacktrace)&&A.stacktrace.length>0?A.stacktrace:UC(A.stack)&&A.stack.length>0?A.stack:void 0}catch{return}}getErrorPropertyFromObject(A){for(const I in A)if({}.hasOwnProperty.call(A,I)){const e=A[I];if(U9(e))return e}}getObjectClassName(A){try{const I=Object.getPrototypeOf(A);return I?I.constructor.name:void 0}catch{return}}},RVI=class{match(A){return KfA(A)}coerce(A,I){var e;const t=A.constructor.name;return{type:t,value:`${t} captured as exception with keys: ${xDg(A)}`,stack:(e=I.syntheticException)===null||e===void 0?void 0:e.stack,synthetic:!0}}},NVI=class{match(A){return Jlg(A)}coerce(A,I){var e;return{type:"Error",value:`Primitive value captured as exception: ${String(A)}`,stack:(e=I.syntheticException)===null||e===void 0?void 0:e.stack,synthetic:!0}}},xVI=class{match(A){return DCA(A,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(A)}isCustomEventWrappingRejection(A){if(!KfA(A))return!1;try{const I=A.detail;return I!=null&&typeof I=="object"&&"reason"in I}catch{return!1}}coerce(A,I){var e;const t=this.getUnhandledRejectionReason(A);return Jlg(t)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`,stack:(e=I.syntheticException)===null||e===void 0?void 0:e.stack,synthetic:!0}:I.apply(t)}getUnhandledRejectionReason(A){try{if("reason"in A)return A.reason;if("detail"in A&&A.detail!=null&&typeof A.detail=="object"&&"reason"in A.detail)return A.detail.reason}catch{}return A}};const fCA="$message",RCA="$timestamp",FVI=new Set([fCA,RCA]),jfA={enabled:!0,max_bytes:32768};function NCA(g){var A;return g?{enabled:(A=g.enabled)!==null&&A!==void 0?A:jfA.enabled,max_bytes:JVI(g.max_bytes,jfA.max_bytes)}:QI({},jfA)}var UVI=class{constructor(A){this.ns=[],this.ss=0,this.Ar=NCA(A)}setConfig(A){this.Ar=NCA(A),this.rs()}add(A){const I=(function(t){let o;try{o=Flg(t)}catch{return}try{const B=JSON.parse(o);if(!yC(B))return;const C=B,Q=C[fCA],i=C[RCA];return!UC(Q)||Q.trim().length===0||!UC(i)&&!$h(i)?void 0:{step:C,json:o}}catch{return}})(A);if(!I)return;const e=(function(t){if("u">typeof TextEncoder)return new TextEncoder().encode(t).length;const o=encodeURIComponent(t);let B=0;for(let C=0;o.length>C;C++)o[C]==="%"?(B+=1,C+=2):B+=1;return B})(I.json);e>this.Ar.max_bytes||(this.ns.push({step:I.step,bytes:e}),this.ss+=e,this.rs())}getAttachable(){return this.ns.map(A=>A.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Ar.max_bytes&&this.ns.length>0;){const A=this.ns.shift();A&&(this.ss-=A.bytes)}}};function JVI(g,A){if(!$h(g)||g===1/0||g===-1/0)return A;const I=Math.floor(g);return 0>I?A:I}const FDg=g=>{if(typeof g!="string")return g;try{return JSON.parse(g)}catch{return g}};function UDg(g){return typeof g=="string"||g}function JDg(g){return typeof g=="string"?g:void 0}const PVI=["$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","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],PDg="NativeGzipValidationError",zfA=g=>g.length>=2&&g[0]===31&&g[1]===139,KDg=(g,A)=>g===UfA.GZipJS||A===UfA.GZipJS||A==="gzip",LDg=g=>!(!g||typeof g!="object")&&("name"in g?String(g.name):"")==="NotReadableError";let aV;const xCA=g=>{throw dDg(PDg,`Native gzip produced invalid output: ${g}`)},KVI=(YDg=oa(function*(g,A){18>g.size&&xCA("too-short");const I=new Uint8Array(yield g.slice(0,10).arrayBuffer());zfA(I)&&I[2]===8||xCA("invalid-header");const e=new DataView(yield g.slice(g.size-8).arrayBuffer());e.getUint32(0,!0)!==(o=>{const B=(()=>{if(aV)return aV;aV=[];for(let Q=0;256>Q;Q++){let i=Q;for(let E=0;8>E;E++)i=1&i?3988292384^i>>>1:i>>>1;aV[Q]=i>>>0}return aV})();let C=4294967295;for(let Q=0;o.length>Q;Q++)C=B[255&(C^o[Q])]^C>>>8;return(4294967295^C)>>>0})(A)&&xCA("invalid-crc");const t=A.length>>>0;e.getUint32(4,!0)!==t&&xCA("invalid-size")}),function(g,A){return YDg.apply(this,arguments)});var YDg;function XfA(){return XfA=oa(function*(g,A=!0,I){try{const t=new TextEncoder().encode(g),o=new globalThis.CompressionStream("gzip"),B=o.writable.getWriter(),C=B.write(t).then(()=>B.close()).catch((e=oa(function*(E){try{yield B.abort(E)}catch{}throw E}),function(E){return e.apply(this,arguments)})),Q=new Response(o.readable).blob(),[i]=yield Promise.all([Q,C]);return yield KVI(i,t),i}catch(t){if(I?.rethrow)throw t;return A&&console.error("Failed to gzip compress data",t),null}var e}),XfA.apply(this,arguments)}function _Dg(g,A){if(g==null)return{};var I,e,t=(function(B,C){if(B==null)return{};var Q={};for(var i in B)if({}.hasOwnProperty.call(B,i)){if(C.includes(i))continue;Q[i]=B[i]}return Q})(g,A);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(g);for(e=0;o.length>e;e++)A.includes(I=o[e])||{}.propertyIsEnumerable.call(g,I)&&(t[I]=g[I])}return t}const ju="[redacted]",LVI=/^[A-Za-z0-9+/\n\r]+=*$/,YVI=/^[A-Za-z0-9_-]+={0,2}$/,_VI=/[-_]/,bVI=/^data:[^,\s]*;base64,/i,HVI=/^[A-Za-z0-9+/_-]+={0,2}$/,vVI=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,qVI=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,bDg=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,TVI=/[\s<>"]/,HDg=new RegExp(bDg.source,"i"),vDg=/[a-z][a-z0-9+.-]{0,63}:\/\//i,ZVI=new RegExp(`^${vDg.source}`,"i"),OVI=new RegExp(vDg.source,"gi"),WVI=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,VVI=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,jVI=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,zVI=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,XVI=/\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,$VI=/(^|[^\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,AjI=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,gjI=/\b\d(?:[ ./-]?\d){12,}\b/g,qDg=/\d+/g,IjI=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,ejI=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function $fA(g){return(function(A){return qVI.test(A)})(g)||WVI.test(g)||VVI.test(g)}function ARA(g){return g.split("&",129).length>128}function tjI(g,A,I){return $fA(g)||A.includes(";")&&(function(e){return e.split(";").some(t=>$fA(t.split("=",1)[0]))})(A)?ju:HDg.test(A)?I?IRA(A,{allowNestedUrls:!1,stripPunctuation:!0}):ju:A}function TDg(g,A){const I=new URLSearchParams;let e=!1,t=!1;for(const[o,B]of new URLSearchParams(g)){const C=FCA(o),Q=FCA(B);e||(e=C!==o||Q!==B);const i=tjI(C,Q,A);e||(e=i!==Q),t=$fA(C)||i!==Q,I.append(C,i)}return{changed:e,lastFieldSensitive:t,serialized:I.toString()}}function ZDg(g,A){if(!g.includes("="))return{value:ojI(g,A),lastFieldSensitive:!1};const I=TDg(g,A);return{value:I.changed?I.serialized:g,lastFieldSensitive:I.lastFieldSensitive}}function ojI(g,A){return A?IRA(g,{allowNestedUrls:!1,stripPunctuation:!0}):HDg.test(g)?ju:g}function BjI(g,A,I){return g==="#"?!A.fragment&&(A.fragment=!0):g==="?"&&(A.fragment?I!=="="&&!A.fragmentQuery&&(A.fragmentQuery=!0):!A.query&&(A.query=!0))}function gRA(g,A){var I;if(g.length>8192&&ZVI.test(g))return ju;const{address:e,suffix:t}=A.stripPunctuation?(function(h){let l=h.length;for(;l>0&&".,;:!?)]}'".includes(h[l-1]);)l--;return{address:h.slice(0,l),suffix:h.slice(l)}})(g):{address:g,suffix:""};let o;try{o=new URL(e)}catch{return ju+t}const B=o.search.slice(1),C=o.hash!=="",Q=(function(h){const l=h.slice(1),D=l.indexOf("?");return 0>D?{head:l,tail:null}:{head:l.slice(0,D),tail:l.slice(D+1)}})(o.hash);if(ARA(B)||ARA(Q.head)||ARA((I=Q.tail)!==null&&I!==void 0?I:""))return ju+t;let i=!1;(o.username||o.password)&&(o.username=ju,o.password="",i=!0);const E=TDg(B,A.allowNestedUrls);E.changed&&(o.search=E.serialized,i=!0);const n=ZDg(Q.head,A.allowNestedUrls),s=Q.tail===null?null:(r=Q.tail,n.lastFieldSensitive?{value:r===""?"":ju,lastFieldSensitive:!0}:ZDg(r,A.allowNestedUrls));var r;const a=s===null?n.value:`${n.value}?${s.value}`;a!==o.hash.slice(1)&&(o.hash=a,i=!0);const c=C?s??n:E;return(i?FCA(o.toString()):e)+(c.lastFieldSensitive?"":t)}function IRA(g,A){return g.replace(bDg,I=>(function(e,t){const o=(function(Q){if(!Q.includes("://"))return[];const i=[...Q.matchAll(OVI)].map(c=>c.index),E=[],n={query:!1,fragment:!1,fragmentQuery:!1};let s=0,r=!1,a="";for(let c=0;Q.length>c&&i.length>s;c++){i[s]===c&&(c>0&&a!=="="&&E.push(c),s++);const h=Q[c];BjI(h,n,a)?(a=h,r=!0):r&&"=&".includes(h)&&(a=h)}return E})(e);if(o.length===0)return gRA(e,t);let B="",C=0;for(const Q of o)B+=gRA(e.slice(C,Q),QI(QI({},t),{},{stripPunctuation:!1})),C=Q;return B+gRA(e.slice(C),t)})(I,QI(QI({},A),{},{stripPunctuation:A.stripPunctuation&&I.length!==g.length})))}function FCA(g){return g.replace(vVI,ju)}function ODg(g,A){return(function(I){return I.length>=10240&&(LVI.test(I)||(function(e){const t=bVI.exec(e);if(!t)return!1;let o;try{o=decodeURIComponent(e.slice(t[0].length))}catch{return!1}return HVI.test(o.replace(/[\r\n]/g,""))})(I)||_VI.test(I)&&YVI.test(I))})(g)?"[binary data redacted - not supported by PostHog MCP analytics]":(function(I,e,t){const o=4*t.maxStringLength;if(I.length>o){const B=e(I.slice(0,(function(C,Q){let i=Q;for(;i>0&&!TVI.test(C[i-1]);)i--;return i})(I,o)));if(B.length>=2*t.maxStringLength)return B+t.truncationSuffix}return e(I)})(g,I=>(function(e){return IRA(e,{allowNestedUrls:!0,stripPunctuation:!0})})((function(e){let t=e.replace(jVI," ");return t=t.replace(zVI,ju),t=t.replace(XVI,ju),t=t.replace($VI,`$1${ju}`),t=t.replace(gjI,QjI),t=t.replace(AjI,ju),t=t.replace(IjI,`$1${ju}`),t=t.replace(ejI,`$1${ju}`),t})(FCA(I))),A)}function CjI(g){let A=0,I=!1;for(let e=g.length-1;e>=0;e--){let t=g.charCodeAt(e)-48;if(0>t||t>9)return!1;I&&(t*=2,t>9&&(t-=9)),A+=t,I=!I}return A%10==0}function QjI(g){const A=[];for(let o=qDg.exec(g);o!==null;o=qDg.exec(g))A.push({digits:o[0],start:o.index,end:o.index+o[0].length});let I="",e=0,t=0;for(;A.length>t;){let o="",B=-1;for(let C=t;A.length>C&&(o+=A[C].digits,19>=o.length);C++)o.length>=13&&CjI(o)&&(B=C);0>B?t++:(I+=g.slice(e,A[t].start)+ju,e=A[B].end,t=B+1)}return I+g.slice(e)}const ijI={}.propertyIsEnumerable;function UCA(g,A){try{return WDg(g,A,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function eRA(g,A,I,e){if(0>=I.remainingNodes)return{stringValue:OfA};if(I.remainingNodes--,gm(g))return{boolValue:g};if(typeof g=="bigint")return(function(t,o){const B=t.toString(),C=BigInt("9223372036854775808");return t>=C||-C>t?(o?.debug(`Attribute ${B} is outside the int64 range; encoding it as a string`),{stringValue:B}):{intValue:B}})(g,A);if(typeof g=="number"){if(!Number.isFinite(g))return{stringValue:String(g)};if(Number.isInteger(g)){if(Number.isSafeInteger(g))return{intValue:String(g)};if(typeof BigInt>"u")return{stringValue:String(g)};const t=BigInt(g).toString();return g>=9223372036854776e3||-9223372036854776e3>g?(A?.debug(`Attribute ${t} is outside the int64 range; encoding it as a string`),{stringValue:t}):{intValue:t}}return{doubleValue:g}}if(typeof g=="string")return{stringValue:P9(g)};if(typeof g=="function")return{stringValue:"[Function]"};if(typeof g=="symbol")return{stringValue:String(g)};if(typeof g=="object"&&g!==null){if(I.ancestors.has(g))return{stringValue:"[Circular]"};if(e>=20)return{stringValue:OfA};if(g instanceof Date){const t=g.getTime(),o=Number.isFinite(t)?g.toISOString():String(g);return{stringValue:typeof o=="string"?P9(o):String(o)}}I.ancestors.add(g);try{try{const t=g.toJSON;if(typeof t=="function")return eRA(t.call(g),A,I,e+1)}catch{}return aB(g)?{arrayValue:{values:EjI(g,A,I,e+1)}}:{kvlistValue:{values:WDg(g,A,I,e+1)}}}finally{I.ancestors.delete(g)}}return{stringValue:P9(String(g))}}function EjI(g,A,I,e){const t=[],o=Math.min(g.length,1e3);let B=0;for(;o>B&&I.remainingNodes>0;B++)try{const C=B in g?g[B]:void 0;if(rC(C))continue;t.push(eRA(C,A,I,e))}catch{t.push({stringValue:EV})}return g.length>B&&t.push({stringValue:OfA}),t}function WDg(g,A,I,e){const t=[];for(const o in g)if(ijI.call(g,o)){if(!o){A?.debug("Dropping an attribute with an empty key");continue}if(t.length>=1e3||0>=I.remainingNodes){A?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const B=g[o];if(fc(B)||Le(B))continue;t.push({key:P9(o),value:eRA(B,A,I,e)})}catch{t.push({key:P9(o),value:{stringValue:EV}})}}return t}function VDg(g,A,I){return QI(QI(QI(QI({},hDg({},g.resourceAttributes)),{},{"service.name":g.serviceName||"unknown_service"},g.environment&&{"deployment.environment":g.environment}),g.serviceVersion&&{"service.version":g.serviceVersion}),{},{"telemetry.sdk.name":A,"telemetry.sdk.version":I})}const njI=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function jDg(g,A){const I=hDg({},g),e={};for(const t of njI)({}).hasOwnProperty.call(I,t)&&(e[t]=I[t],delete I[t]);return[...UCA(I,A),...UCA(e,A)]}const zDg={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"},XDg={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}},sjI=XDg.info;function ajI(g){try{return P9(String(g))}catch{return EV}}function rjI(g,A,I,e){const t=g.level||"info",{text:o,number:B}=XDg[t]||sjI,C=(function(s=Date.now()){return String(s)+"000000"})($h(e)?e:void 0),Q={};A.distinctId&&(Q.posthogDistinctId=A.distinctId),A.sessionId&&(Q.sessionId=A.sessionId),A.windowId&&(Q["window.id"]=A.windowId),rC(A.sessionStartTimestamp)||(Q.sessionStartTimestamp=String(A.sessionStartTimestamp)),rC(A.lastActivityTimestamp)||(Q.lastActivityTimestamp=String(A.lastActivityTimestamp)),A.currentUrl&&(Q["url.full"]=A.currentUrl),A.screenName&&(Q["screen.name"]=A.screenName),A.appState&&(Q["app.state"]=A.appState),A.activeFeatureFlags&&A.activeFeatureFlags.length>0&&(Q.feature_flags=A.activeFeatureFlags);const i=QI({},Q),E=g.attributes;if(E){let s=[];try{s=Object.keys(E)}catch{s=[]}for(const r of s){let a;try{a=E[r]}catch{a=EV}Object.defineProperty(i,r,{value:a,enumerable:!0,writable:!0,configurable:!0})}}const n={timeUnixNano:C,observedTimeUnixNano:C,severityNumber:B,severityText:o,body:{stringValue:ajI(g.body)},attributes:UCA(i,I)};return g.trace_id&&(n.traceId=g.trace_id),g.span_id&&(n.spanId=g.span_id),Le(g.trace_flags)||(n.flags=g.trace_flags),n}function $Dg(g,A,I){return VDg(g,A,I)}function Adg(g,A,I,e){return{resourceLogs:[{resource:{attributes:jDg(A)},scopeLogs:[{scope:{name:I,version:e},logRecords:g}]}]}}var gdg=class{constructor(A){this.ls=A,this.us=0}get pending(){return!!this.cs}arm(A){this.clear(),this.us=Date.now()+A,this.cs=wDg(()=>{this.cs=void 0,this.ls()},A)}armNoEarlierThan(A){this.cs&&Date.now()+A<=this.us||this.arm(A)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function Idg(){return .75+.5*Math.random()}function edg(g,A,I,e){const t=Math.min(Math.max(0,A-1),6),o=g*Math.pow(2,t);return Math.round(Math.min(o,Math.max(e,g))*I)}var cjI=class{constructor(A,I,e,t,o,B=()=>Promise.resolve(),C){var Q;this._instance=A,this.Ar=I,this.$=e,this.hs=t,this.ds=o,this.vs=B,this.fs=C,this.ps=new gdg(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new lDg,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=I.maxBufferSize,this.Is=Math.max((Q=I.maxQueueSize)!==null&&Q!==void 0?Q:I.maxBufferSize,I.maxBufferSize),this.Ms=I.flushIntervalMs,this.Es=I.maxBatchRecordsPerPost,this.Ps=I.rateCapWindowMs,this.Rs=I.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(xN.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.Ar.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(A,I){var e;if(this._instance.isDisabled||this._instance.optedOut||!A?.body)return;const t=this.Os(A);if(t===null)return;if(!t.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const o={record:rjI(t,(e=I?.context)!==null&&e!==void 0?e:this.hs(),this.$,I?.occurredAtMs)};this.ds(()=>this.Ls(o))}Os(A){const I=this.Ar.beforeSend;if(!I)return A;const e=aB(I)?I:[I];let t=A;for(const o of e)try{const B=o(t);if(!B)return this.$.info("Log was rejected in beforeSend function"),null;t=B}catch(B){return this.$.error("Error in beforeSend function for log:",B),null}return t}Ds(){if(this.Rs===void 0)return!0;const A=Date.now(),I=A-this.xs;return this.Ps>I&&I>=0||(this.xs=A,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.Cs=!0),!1)}flush(){var A=this;return oa(function*(){if(!A._instance.isDisabled)return A.ys||(A.ys=A.Ns().finally(()=>{A.ys=null})),A.ys})()}Ns(){var A=this;return oa(function*(){var I;A.ps.clear();let e=(I=A._instance.getPersistedProperty(xN.LogsQueue))!==null&&I!==void 0?I:[];if(e.length===0)return;const t=e.length;let o=0;for(;e.length>0&&t>o;){var B,C;const Q=A._s;A.bs=0;const i=Math.min(e.length,A.Es),E=e.slice(0,i),n=Adg(E.map(r=>r.record),A.qs(),(B=A.fs)!==null&&B!==void 0?B:A._instance.getLibraryId(),A._instance.getLibraryVersion()),s=yield A._instance.js(n);if(A._s!==Q)return;if(s.kind==="too-large"&&E.length>1)A.Es=Math.max(1,Math.floor(E.length/2)),A.$.warn(`Logs batch of size ${E.length} was too large for the ingestion endpoint, reducing batch size to ${A.Es}`);else if(A.ws.record(s),A.ps.pending&&A.ps.arm(Math.max(A.Ms,A.ws.remainingMs())),s.kind==="retry-later"||(s.kind==="too-large"?A.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):s.kind==="ok"&&A.Ar.maxBatchRecordsPerPost>A.Es&&(A.Es=Math.min(A.Ar.maxBatchRecordsPerPost,A.Es+1)),yield A.Bs(E.length),e=(C=A._instance.getPersistedProperty(xN.LogsQueue))!==null&&C!==void 0?C:[],o+=E.length,s.kind==="fatal"))throw s.error}})()}Bs(A){var I=this;return oa(function*(){var e;const t=Math.max(0,A-I.bs),o=(e=I._instance.getPersistedProperty(xN.LogsQueue))!==null&&e!==void 0?e:[];I._instance.setPersistedProperty(xN.LogsQueue,o.slice(t)),yield I.vs()})()}qs(){return $Dg(this.Ar,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(A){var I;if(this._instance.optedOut)return;const e=(I=this._instance.getPersistedProperty(xN.LogsQueue))!==null&&I!==void 0?I:[];this.Is>e.length||(e.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),e.push(A),this._instance.setPersistedProperty(xN.LogsQueue,e),this.Ts>e.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(edg(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const A=this._instance.getPersistedProperty(xN.LogsQueue);return!!A&&A.length>0}shutdown(A){var I=this;return oa(function*(){I.ps.clear();const e=I.flush().catch(()=>{});A!==void 0?yield uDg(e,A):yield e})()}flushWithTimeout(A){var I=this;return oa(function*(){const e=I.flush();yield uDg(e,A,()=>{e.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},A=>{this.ks++,this.Ss=Idg(),this.$.error("PostHog logs flush failed:",A)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.zs())})}};const hjI=/^[0-9a-f]+$/;function tdg(g,A,I){return typeof g=="string"&&g.length===A&&g!==I&&hjI.test(g)}const ljI=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/,DjI="00",tRA=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function oRA(g){return String(g)+"000000"}function odg(g,A,I,e){let t="";return e&&(t=Object.keys(e).sort().map(o=>`${JSON.stringify(o)}:${JSON.stringify(e[o])}`).join(",")),`${g}\0${A}\0${I??""}\0${t}`}var djI=class{constructor(A,I,e){this._instance=A,this.Ar=I,this.$=e,this.Hs=new Map,this.ps=new gdg(()=>this.flush().catch(t=>{this.$.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new lDg,this.ks=0,this.Ss=1,this.Gs=0}count(A,I=1,e){this.Qs({name:A,type:"count",value:I,unit:e?.unit,attributes:e?.attributes})}gauge(A,I,e){this.Qs({name:A,type:"gauge",value:I,unit:e?.unit,attributes:e?.attributes})}histogram(A,I,e){this.Qs({name:A,type:"histogram",value:I,unit:e?.unit,attributes:e?.attributes})}flush(){var A=this;const I=this.ys,e=(function(){var t=oa(function*(){I&&(yield I.catch(()=>{})),yield A.Zs()});return function(){return t.apply(this,arguments)}})()().finally(()=>{this.ys===e&&(this.ys=null)});return this.ys=e,e}drainWindow(){if(this.Hs.size===0)return null;const A=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(A)}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(A){if(this._instance.isDisabled||this._instance.optedOut)return;const I=this.Os(A);if(I===null)return;if(!I.name||typeof I.name!="string")return void this.$.warn("Dropping metric with empty name");if(typeof I.value!="number"||!Number.isFinite(I.value))return void this.$.warn(`Dropping metric '${I.name}': value must be a finite number`);if(I.type==="count"&&0>I.value)return void this.$.warn(`Dropping count '${I.name}': counters are monotonic, value must be >= 0`);let e,t;try{e=I.attributes?QI({},I.attributes):void 0,t=odg(I.type,I.name,I.unit,e)}catch(Q){return void this.$.warn(`Dropping metric '${I.name}': attributes could not be serialized`,Q)}let o=this.Hs.get(t);if(!o){if(!this.Ks())return;o={name:I.name,type:I.type,unit:I.unit,attributes:e,windowStartMs:Date.now()},this.Hs.set(t,o)}const B=this.Ws.get(I.name);B===void 0?this.Ws.set(I.name,I.type):B===I.type||this.Vs.has(I.name)||(this.Vs.add(I.name),this.$.warn(`Metric name '${I.name}' is already used as a ${B}; recording it as a ${I.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(o,I.value);const C=this.Ys();C&&(o.exemplar=QI(QI({},C),{},{value:I.value,timeMs:Date.now()})),this.Fs()}Ys(){try{var A,I;const e=(function(t){const o=(function(C){if(typeof C!="string")return;const Q=ljI.exec(C.trim());if(!Q)return;const[,i,E,n,s,r]=Q;return i==="ff"||i==="00"&&r||!(function(a){return tdg(a,32,"00000000000000000000000000000000")})(E)||!(function(a){return tdg(a,16,"0000000000000000")})(n)?void 0:{version:i,traceId:E,spanId:n,flags:s}})(t);return o&&{traceId:o.traceId,spanId:o.spanId,flags:(B=o.flags,1&parseInt(B,16)?"01":DjI)};var B})((A=(I=this._instance).getActiveSpan)===null||A===void 0||(A=A.call(I))===null||A===void 0?void 0:A.traceparent());if(e&&e.flags==="01")return{traceId:e.traceId,spanId:e.spanId}}catch{}}Ks(){return this.Ar.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Ar.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(A,I){switch(A.type){case"count":var e;A.total=((e=A.total)!==null&&e!==void 0?e:0)+I;break;case"gauge":A.last=I;break;case"histogram":{A.hist||(A.hist={count:0,sum:0,min:I,max:I,bucketCounts:new Array(tRA.length+1).fill(0)});const t=A.hist;t.count+=1,t.sum+=I,t.min=Math.min(t.min,I),t.max=Math.max(t.max,I),t.bucketCounts[(function(o,B){for(let C=0;B.length>C;C++)if(B[C]>=o)return C;return B.length})(I,tRA)]+=1;break}}}Os(A){const I=this.Ar.beforeSend;if(!I)return A;const e=aB(I)?I:[I];let t=A;for(const o of e)try{const B=o(t);if(!B)return this.$.info("Metric was rejected in beforeSend function"),null;t=B}catch(B){return this.$.error("Error in beforeSend function for metric:",B),null}return t}Fs(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(edg(this.Ar.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Zs(){var A=this;return oa(function*(){if(A.ps.clear(),A.Hs.size===0)return;const I=A.Hs;A.Hs=new Map,A.Us=!1,A.Ws=new Map,A.Vs=new Set;const e=A.Gs,t=yield A._instance.po(A.Js(I));if(e===A.Gs)switch(A.ws.record(t),t.kind==="retry-later"?(A.ks++,A.Ss=Idg()):(A.ks=0,A.Ss=1),A.ps.pending&&A.ps.arm(A.zs()),t.kind){case"ok":return;case"retry-later":return A.mo(I),void A.ps.armNoEarlierThan(A.zs());case"too-large":return void A.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void A.$.error("Failed to send metrics batch:",t.error)}})()}Js(A){return I=this.yo(A),e=(function(B,C,Q){return VDg(B,C,Q)})(this.Ar,this._instance.getLibraryId(),this._instance.getLibraryVersion()),t=this._instance.getLibraryId(),o=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:jDg(e)},scopeMetrics:[{scope:{name:t,version:o},metrics:I}]}]};var I,e,t,o}yo(A){const I=oRA(Date.now()),e=new Map;for(const C of A.values()){var t;const Q=odg(C.type,C.name,C.unit,void 0);let i=e.get(Q);i||(i=QI({name:C.name},C.unit&&{unit:C.unit}),C.type==="count"?i.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:C.type==="gauge"?i.gauge={dataPoints:[]}:i.histogram={aggregationTemporality:1,dataPoints:[]},e.set(Q,i));const E=UCA((t=C.attributes)!==null&&t!==void 0?t:{},this.$),n=oRA(C.windowStartMs),s=yjI(C.exemplar);if(C.type==="count"){var o;const r=QI({attributes:E,startTimeUnixNano:n,timeUnixNano:I,asDouble:(o=C.total)!==null&&o!==void 0?o:0},s);i.sum.dataPoints.push(r)}else if(C.type==="gauge"){var B;const r=QI({attributes:E,timeUnixNano:I,asDouble:(B=C.last)!==null&&B!==void 0?B:0},s);i.gauge.dataPoints.push(r)}else if(C.hist){const r=QI({attributes:E,startTimeUnixNano:n,timeUnixNano:I,count:C.hist.count,sum:C.hist.sum,min:C.hist.min,max:C.hist.max,bucketCounts:C.hist.bucketCounts,explicitBounds:tRA},s);i.histogram.dataPoints.push(r)}}return Array.from(e.values())}mo(A){for(const[o,B]of A){var I;const C=this.Hs.get(o);if(C)switch(C.windowStartMs=Math.min(C.windowStartMs,B.windowStartMs),C.exemplar=(I=C.exemplar)!==null&&I!==void 0?I:B.exemplar,C.type){case"count":var e,t;C.total=((e=C.total)!==null&&e!==void 0?e:0)+((t=B.total)!==null&&t!==void 0?t:0);break;case"gauge":break;case"histogram":if(B.hist)if(C.hist){C.hist.count+=B.hist.count,C.hist.sum+=B.hist.sum,C.hist.min=Math.min(C.hist.min,B.hist.min),C.hist.max=Math.max(C.hist.max,B.hist.max);for(let Q=0;C.hist.bucketCounts.length>Q;Q++)C.hist.bucketCounts[Q]+=B.hist.bucketCounts[Q]}else C.hist=B.hist}else this.Ks()&&this.Hs.set(o,B)}}};function yjI(g){return g?{exemplars:[{filteredAttributes:[],timeUnixNano:oRA(g.timeMs),asDouble:g.value,traceId:g.traceId,spanId:g.spanId}]}:{}}const Bdg=(g,{debugEnabled:A}={})=>{const I={N(e,...t){let o;try{o=typeof window>"u"?void 0:window}catch{return}o&&(bF.DEBUG||o.POSTHOG_DEBUG||A)&&!Le(o.console)&&o.console&&("__rrweb_original__"in o.console[e]?o.console[e].__rrweb_original__:o.console[e])(g,...t)},debug(...e){I.N("debug",...e)},info(...e){I.N("log",...e)},warn(...e){I.N("warn",...e)},error(...e){I.N("error",...e)},critical(...e){console.error(g,...e)},uninitializedWarning(e){I.error(`You must initialize PostHog before calling ${e}`)},createLogger:(e,t)=>Bdg(`${g} ${e}`,t)};return I},Dt=Bdg("[PostHog.js]"),qr=Dt.createLogger,wjI=qr("[ExternalScriptsLoader]"),JCA=g=>{const A=ro?.querySelectorAll("script");if(A){for(let I=0;A.length>I;I++)if(A[I].src===g||A[I].getAttribute("src")===g)return A[I]}},yY=(g,A,I)=>{if(g.config.disable_external_dependency_loading)return wjI.warn(`${A} was requested but loading of external scripts is disabled.`),I("Loading of external scripts is disabled");const e=JCA(A);if(e){if(e.__posthog_loading_callback_fired)return I();const o=e.__posthog_loading_error;return o?I(o):(e.addEventListener("load",B=>{e.__posthog_loading_callback_fired=!0,I(void 0,B)}),void e.addEventListener("error",B=>{e.__posthog_loading_error=B,I(B)}))}const t=()=>{if(!ro)return I("document not found");if(JCA(A))return yY(g,A,I);let o=ro.createElement("script");if(o.type="text/javascript",o.crossOrigin="anonymous",o.src=A,o.onload=C=>{o.__posthog_loading_callback_fired=!0,I(void 0,C)},o.onerror=C=>{o.__posthog_loading_error=C,I(C)},g.config.prepare_external_dependency_script&&(o=g.config.prepare_external_dependency_script(o)),!o)return I("prepare_external_dependency_script returned null");if(g.config.external_scripts_inject_target==="head")ro.head.appendChild(o);else{const C=ro.querySelectorAll("body > script");var B;C.length>0?(B=C[0].parentNode)===null||B===void 0||B.insertBefore(o,C[0]):ro.body.appendChild(o)}};ro?.body?t():ro?.addEventListener("DOMContentLoaded",t)},BRA={},Cdg=(g,A)=>{let I=`/static/${A}.js?v=${g.version}`;return A==="toolbar"&&(I=`${I}&t=${Math.floor(Date.now()/3e5)*3e5}`),g.requestRouter.endpointFor("assets",I)};FB.__PosthogExtensions__=FB.__PosthogExtensions__||{},FB.__PosthogExtensions__.loadExternalDependency=(g,A,I)=>{if(A==="remote-config"){const t=g.requestRouter.endpointFor("assets",`/array/${g.config.token}/config.js`);return void yY(g,t,I)}const e=g.config.strict_script_versioning;if(e){const t=g.requestRouter.endpointFor("assets",`/static/${g.version}/${A}.js`),o=BRA[t];if(e==="fallback"&&o){if(JCA(o))return void yY(g,o,I);delete BRA[t]}return void yY(g,t,e==="fallback"?(B,C)=>{if(B)if(typeof B=="string")I(B);else{var Q;const i=Cdg(g,A);BRA[t]=i;const E=JCA(t);E==null||(Q=E.parentNode)===null||Q===void 0||Q.removeChild(E),yY(g,i,I)}else I(void 0,C)}:I)}yY(g,Cdg(g,A),I)},FB.__PosthogExtensions__.loadSiteApp=(g,A,I)=>{const e=g.requestRouter.endpointFor("api",A);yY(g,e,I)},bF.DEBUG=!1,bF.LIB_VERSION="1.438.24",bF.LIB_NAME="web";var bp=bF;const CRA="$early_access_features",vF="$active_feature_flags",wY="$feature_flag_details",rV="$feature_flag_errors",q4="$feature_flag_evaluated_at",uY="$feature_flag_request_id",cV="$minimal_flag_called_events",xf="$enabled_feature_flags",T4="$stored_group_properties",Z4="$stored_person_properties",qF="$flag_call_reported",hV="$flag_call_reported_session_id",O4="$feature_flag_payloads",UN="$override_feature_flags",GY="$override_feature_flag_payloads",L9="visibilitychange",Qdg="$autocapture_disabled_server_side",lV="$surveys",PCA="$surveys_loaded_at",QRA="PostHog loadExternalDependency extension not found.",iRA="$surveys_activated",KCA="$surveys_activated_session",LCA="$surveys_activated_timestamps",ujI="$people_distinct_id",Ff="distinct_id",ERA="$device_id",nRA="$device_model",YCA="__alias",GjI="__cmpns",idg="$fbc",Y9="$fbc_persistence",Edg="$fbp",DV="$fbp_persistence",sRA="__timers",aRA="$heatmaps_enabled_server_side",rRA="$exception_capture_enabled_server_side",ndg="$error_tracking_suppression_rules",cRA="$error_tracking_capture_extension_exceptions",hRA="$web_vitals_enabled_server_side",lRA="$dead_clicks_enabled_server_side",DRA="$product_tours_enabled_server_side",sdg="$logs_capture_enabled_server_side",adg="$web_vitals_allowed_metrics",dV="$session_recording_remote_config",mjI="$session_recording_enabled_server_side",pjI="$replay_sample_rate",kjI="$replay_override_sampling",MjI="$replay_override_linked_flag",SjI="$replay_override_url_trigger",fjI="$replay_override_event_trigger",_9="$sesid",rdg="$session_is_sampled",RjI="$session_past_minimum_duration",NjI="$session_recording_url_trigger_activated_session",xjI="$session_recording_event_trigger_activated_session",FjI="$debug_first_full_snapshot_timestamp",UjI="$sess_rec_flush_size",cdg="$groups",dRA="ph_product_tours",JjI="$product_tours_activated",PjI="$product_tours_activated_session",KjI="$conversations_widget_session_id",LjI="$conversations_ticket_id",YjI="$conversations_widget_state",_jI="$conversations_user_traits",Im="$user_state",yRA="$client_session_props",bjI="$capture_rate_limit",hdg="$initial_campaign_params",ldg="$initial_referrer_info",b9="$initial_person_info",wRA="$epp",uRA="$posthog_cookieless",Ddg="$cookieless_mode",ddg="$sdk_debug_extensions_init_method",ydg="$sdk_debug_extensions_init_time_ms",GRA="$sdk_debug_recording_script_not_loaded",mRA="$sdk_debug_replay_stale_config",wdg="$sdk_debug_replay_event_trigger_status",udg="$sdk_debug_replay_linked_flag_trigger_status",Gdg="$sdk_debug_replay_matched_recording_trigger_groups",mdg="$sdk_debug_replay_pending_trigger_conditions",pdg="$sdk_debug_replay_remote_trigger_matching_config",kdg="$sdk_debug_replay_trigger_groups_count",Mdg="$sdk_debug_replay_url_trigger_status",HjI="$session_recording_start_reason",TF="anonymous",_CA="identified",Sdg="identified_only",bCA="beforeunload",pRA="$pageview",fdg="$pageleave",Rdg="$identify",Ndg="$groupidentify";function H9(g,A){aB(g)&&g.forEach(A)}function dn(g,A){if(!rC(g))if(aB(g))g.forEach(A);else if((I=>I instanceof FormData)(g))g.forEach((I,e)=>A(I,e));else for(const I in g)PfA.call(g,I)&&A(g[I],I)}const Qr=function(g,...A){for(const I of A)for(const e in I)I[e]!==void 0&&(g[e]=I[e]);return g};function HCA(g){const A=Object.keys(g);let I=A.length;const e=new Array(I);for(;I--;)e[I]=[A[I],g[A[I]]];return e}const vjI=function(g){return function(...A){try{return g.apply(this,A)}catch(I){Dt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Dt.critical(I)}}},kRA=function(g){const A={};return dn(g,function(I,e){(UC(I)&&I.length>0||$h(I))&&(A[e]=I)}),A};function xdg(g){const A=QI({},g);for(const I of["name","message","stack","cause","errors"])try{I in g&&(A[I]=g[I])}catch{}return A}const qjI=["herokuapp.com","vercel.app","netlify.app"];function TjI(g){const A=g?.hostname;if(!UC(A))return!1;const I=A.split(".").slice(-2).join(".");for(const e of qjI)if(I===e)return!1;return!0}function GE(g,A,I,e){const{capture:t=!1,passive:o=!0}=e??{};g?.addEventListener(A,I,{capture:t,passive:o})}function MRA(g){return g.name==="ph_toolbar_internal"}const yV=g=>{if(ro){try{const A=g+"=",I=ro.cookie.split(";").filter(e=>e.length);for(let e=0;I.length>e;e++){let t=I[e];for(;t.charAt(0)==" ";)t=t.substring(1,t.length);if(t.indexOf(A)===0)return decodeURIComponent(t.substring(A.length,t.length))}}catch{}return null}};var ZjI=class Ohg{constructor(A){if(this.bytes=A,A.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(A,I,e,t){if(!Number.isInteger(A)||!Number.isInteger(I)||!Number.isInteger(e)||!Number.isInteger(t)||0>A||0>I||0>e||0>t||A>0xffffffffffff||I>4095||e>1073741823||t>4294967295)throw new RangeError("invalid field value");const o=new Uint8Array(16);return o[0]=A/Math.pow(2,40),o[1]=A/Math.pow(2,32),o[2]=A/Math.pow(2,24),o[3]=A/Math.pow(2,16),o[4]=A/256,o[5]=A,o[6]=112|I>>>8,o[7]=I,o[8]=128|e>>>24,o[9]=e>>>16,o[10]=e>>>8,o[11]=e,o[12]=t>>>24,o[13]=t>>>16,o[14]=t>>>8,o[15]=t,new Ohg(o)}toString(){let A="";for(let I=0;this.bytes.length>I;I++)A=A+(this.bytes[I]>>>4).toString(16)+(15&this.bytes[I]).toString(16),I!==3&&I!==5&&I!==7&&I!==9||(A+="-");if(A.length!==36)throw new Error("Invalid UUIDv7 was generated");return A}clone(){return new Ohg(this.bytes.slice(0))}equals(A){return this.compareTo(A)===0}compareTo(A){for(let I=0;16>I;I++){const e=this.bytes[I]-A.bytes[I];if(e!==0)return Math.sign(e)}return 0}},OjI=class{generate(){const A=this.generateOrAbort();if(!Le(A))return A;{this.Ct=0;const I=this.generateOrAbort();if(Le(I))throw new Error("Could not generate UUID after timestamp reset");return I}}generateOrAbort(){const A=(()=>{const I=Date.now();return $h(I)&&isFinite(I)?Math.min(Math.max(Math.floor(I),0),0xffffffffffff):0})();if(A>this.Ct)this.Ct=A,this.It();else{if(this.Ct>=A+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Ct++,this.It())}return ZjI.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 VjI}};const WjI=g=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let A=0;g.length>A;A++)g[A]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return g};let Fdg;var VjI=class{nextUint32(){var A;return this.Rt.length>this.Et||(((A=Fdg)!==null&&A!==void 0?A:Fdg="u">typeof window&&!Le(window.crypto)&&crypto.getRandomValues?I=>crypto.getRandomValues(I):WjI)(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}};let Udg;const Uf=()=>jjI().toString(),jjI=()=>(Udg||(Udg=new OjI)).generate();let wV="";const zjI=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let v9=null;const ir={$t(){if(!fc(v9))return v9;if(v9=!1,ro)try{const g=`__ph_cookie_support_${Uf()}`;ir.At(g,"xyz"),v9=yV(g)==='"xyz"',ir.Pt(g)}catch{v9=!1}return v9},Ft(g){Dt.error("cookieStore error: "+g)},Ot:yV,Lt(g){let A;try{A=JSON.parse(ir.Ot(g))||{}}catch{}return A},At(g,A,I,e,t){if(!ro)return!1;try{let o="",B="";const C=(function(i,E){if(E){let n=(function(s,r=ro){if(wV)return wV;if(!r||["localhost","127.0.0.1"].includes(s))return"";const a=s.split(".");let c=Math.min(a.length,8);const h="dmn_chk_"+Uf();for(;!wV&&c--;){const l=a.slice(c).join("."),D=h+"=1;domain=."+l+";path=/";r.cookie=D+";max-age=3",r.cookie.includes(h)&&(r.cookie=D+";max-age=0",wV=l)}return wV})(i);if(!n){const s=(r=>{const a=r.match(zjI);return a?a[0]:""})(i);s!==n&&Dt.info("Warning: cookie subdomain discovery mismatch",s,n),n=s}return n?"; domain=."+n:""}return""})(ro.location.hostname,e);if(I){const i=new Date;i.setTime(i.getTime()+864e5*I),o="; expires="+i.toUTCString()}t&&(B="; secure");const Q=g+"="+encodeURIComponent(JSON.stringify(A))+o+"; SameSite=Lax; path=/"+C+B;return Q.length>3686.4&&Dt.warn("cookieStore warning: large cookie, len="+Q.length),ro.cookie=Q,!0}catch{return!1}},Pt(g,A){if(ro?.cookie&&(!A||!fc(yV(g))))try{ir.At(g,"",-1,A)}catch{return}}};let SRA=null;const AE={$t(){if(!fc(SRA))return SRA;let g=!0;if(Le(Me))g=!1;else try{const A="__mplssupport__";AE.At(A,"xyz"),AE.Ot(A)!=='"xyz"'&&(g=!1),AE.Pt(A)}catch{g=!1}return g||Dt.error("localStorage unsupported; falling back to cookie store"),SRA=g,g},Ft(g){Dt.error("localStorage error: "+g)},Ot(g){try{return Me?.localStorage.getItem(g)}catch(A){AE.Ft(A)}return null},Lt(g){try{return JSON.parse(AE.Ot(g))||{}}catch{}return null},At(g,A){try{return Me?.localStorage.setItem(g,JSON.stringify(A)),!0}catch(I){AE.Ft(I)}return!1},Pt(g){try{Me?.localStorage.removeItem(g)}catch(A){AE.Ft(A)}}},fRA=[Z4,vF,xf,wY,O4,uY,q4,rV,qF],mY=[ERA,Ff,_9,rdg,wRA,b9,Y9,Im],uV=g=>g+"_cpm",XjI=["__proto__","constructor","prototype"],RRA=g=>{if(!yC(g))return{};const A={};return Object.keys(g).forEach(I=>{XjI.indexOf(I)===-1&&(A[I]=g[I])}),A},NRA=(g,A=[])=>{const I={};return[...mY,...A].forEach(e=>{const t=g[e];Le(t)||fc(t)||t===""||(I[e]=t)}),I},Jdg=g=>{let A=5381,I=2166136261;for(let e=0;g.length>e;e++){const t=g.charCodeAt(e);A=33*A^t,I=Math.imul(I^t,16777619)}return g.length.toString(36)+"."+(A>>>0).toString(36)+"."+(I>>>0).toString(36)},Pdg=(g,A)=>({p:A,f:Jdg(JSON.stringify(g))}),Kdg=(g,A)=>{if(!A)return{properties:[],isValid:!1};try{const I=ir.Lt(uV(g)),e=I?.f===Jdg(A)&&aB(I.p);return{properties:e?I.p:[],isValid:e}}catch{return{properties:[],isValid:!1}}},xRA=(g,A)=>A+"|"+(ir.Ot(uV(g))||""),q9={},FRA={$t:()=>!0,Ft(g){Dt.error("memoryStorage error: "+g)},Ot:g=>g in q9?q9[g]:null,Lt:g=>g in q9?q9[g]:null,At:(g,A)=>(q9[g]=A,!0),Pt(g){delete q9[g]}};let pY=null;const Ba={$t(){if(!fc(pY))return pY;if(pY=!0,Le(Me))pY=!1;else try{const g="__support__";Ba.At(g,"xyz"),Ba.Ot(g)!=='"xyz"'&&(pY=!1),Ba.Pt(g)}catch{pY=!1}return pY},Ft(g){Dt.error("sessionStorage error: ",g)},Ot(g){try{return Me?.sessionStorage.getItem(g)}catch(A){Ba.Ft(A)}return null},Lt(g){try{return JSON.parse(Ba.Ot(g))||null}catch{}return null},At(g,A){try{return Me?.sessionStorage.setItem(g,JSON.stringify(A)),!0}catch(I){Ba.Ft(I)}return!1},Pt(g){try{Me?.sessionStorage.removeItem(g)}catch(A){Ba.Ft(A)}}};var $jI=class{constructor(A){this._instance=A}get Ar(){return this._instance.config}get consent(){return this.Sl()?0:this.xl}isOptedOut(){return this.Ar.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Ar.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Ar.opt_out_capturing_by_default}optInOut(A){this.$l.At(this.Cl,A?1:0,this.Ar.cookie_expiration,this.Ar.cross_subdomain_cookie,this.Ar.secure_cookie)}reset(){this.$l.Pt(this.Cl,this.Ar.cross_subdomain_cookie)}get Cl(){const{token:A,opt_out_capturing_cookie_prefix:I,consent_persistence_name:e}=this._instance.config;return e||(I?I+A:"__ph_opt_in_out_"+A)}get xl(){const A=this.$l.Ot(this.Cl);return LfA(A)?1:yB(WWI,A)?0:-1}get $l(){const A=this.Ar.opt_out_capturing_persistence_type,I=A==="localStorage"?AE:ir,e=I.$t()?I:FRA;if(!this.Tl||this.Tl!==e){this.Tl=e;const t=A==="localStorage"?ir:AE;t.Ot(this.Cl)&&(this.Tl.Ot(this.Cl)||this.optInOut(LfA(t.Ot(this.Cl))),t.Pt(this.Cl,this.Ar.cross_subdomain_cookie))}return this.Tl}Sl(){return!!this.Ar.respect_dnt&&[Rw?.doNotTrack,Rw?.msDoNotTrack,FB.doNotTrack,Rw?.globalPrivacyControl].some(A=>LfA(A))}};function Ldg(g,A){var I;const e=g==null||(I=g.config)===null||I===void 0?void 0:I.get_current_url;if(!Xh(e))return A;try{const t=e(A);return UC(t)&&t?t:A}catch(t){return Dt.error("Error in get_current_url, falling back to window.location.href",t),A}}function Ydg(g){var A;return g instanceof Element&&(g.id==="__POSTHOG_TOOLBAR__"||!!(!((A=g.closest)===null||A===void 0)&&A.call(g,".toolbar-global-fade-container")))}function Jf(g){return!!g&&g.nodeType===1}function Nw(g,A){return!!g&&!!g.tagName&&g.tagName.toLowerCase()===A.toLowerCase()}function _dg(g){return!!g&&g.nodeType===3}function URA(g){return!!g&&g.nodeType===11&&Jf(g.host)}function JRA(g){return g?F9(g).split(/\s+/):[]}function bdg(g,A){const I=(function(e){var t;const o=typeof window>"u"?void 0:window,B=o==null||(t=o.location)===null||t===void 0?void 0:t.href;return Le(B)?void 0:Ldg(e,B)})(A);return!!(I&&g&&g.some(e=>I.match(e)))}function T9(g){let A="";switch(typeof g.className){case"string":A=g.className;break;case"object":A=(g.className&&"baseVal"in g.className?g.className.baseVal:null)||g.getAttribute("class")||"";break;default:A=""}return JRA(A)}function Hdg(g){return rC(g)?null:F9(g).split(/(\s+)/).filter(A=>O9(A)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function GV(g){let A="";return kY(g)&&!Z9(g)&&g.childNodes&&g.childNodes.length&&dn(g.childNodes,function(I){var e;_dg(I)&&I.textContent&&(A+=(e=Hdg(I.textContent))!==null&&e!==void 0?e:"")}),F9(A)}function mV(g){var A;return Le(g.target)?g.srcElement||null:!((A=g.target)===null||A===void 0)&&A.shadowRoot?g.composedPath()[0]||null:g.target||null}const PRA=["a","button","form","input","select","textarea","label"];function KRA(g,A){const I=g.matches||g.matchesSelector||g.msMatchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.oMatchesSelector;try{return!!I&&I.call(g,A)}catch{return!1}}function LRA(g,A){if(Le(A))return!0;for(const I of g)if(A.some(e=>KRA(I,e)))return!0;return!1}function vdg(g){const A=g.parentNode;return!(!A||!Jf(A))&&A}const YRA=[".ph-no-autocapture","[data-ph-no-autocapture]"],qdg=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],_RA=[...qdg,"+","-","−","–"],Tdg=_RA.length+10,AzI=["button","a","input","select","textarea","label"],gzI=["button","link","tab","menuitem","option"],Zdg=(g,A)=>/[a-z0-9]/i.test(A)?yB(_RA,A)?new RegExp(`\\b${A}\\b`).test(g):g.includes(A):g===A,IzI=g=>yB(AzI,g.tagName.toLowerCase())||yB(gzI,(g.getAttribute("role")||"").toLowerCase());function bRA(g){let A="",I="";const e=B=>{Jf(B)&&kY(B)&&!Z9(B)&&(A+=` ${GV(B)}`,I=I||B.getAttribute("aria-label")||"",dn(B.childNodes,e))};e(g),A=F9(A.replace(/\s+/g," "));const t=(O9(A)?A:"").toLowerCase(),o=g.getAttribute("aria-label")||(t?"":I);return{safeText:t,ariaLabel:F9(o).toLowerCase()}}const Odg=[".ph-no-rageclick",".ph-no-capture"],ezI=["","text","search","email","password","url","tel","number"];function Wdg(g,A){if(!(!(typeof window>"u")&&window)||HRA(g))return!1;let I,e,t;var o,B;if(gm(A)?(I=!!A&&Odg,e=void 0,t=!1):(I=(o=A?.css_selector_ignorelist)!==null&&o!==void 0?o:Odg,e=A?.content_ignorelist,t=(B=A?.ignore_text_selection)!==null&&B!==void 0&&B),I===!1||t&&(function(Q){return!(!Q||!Jf(Q))&&(!!Nw(Q,"textarea")||(Nw(Q,"input")?yB(ezI,(Q.getAttribute("type")||"").toLowerCase()):(function(i){var E;if(i.isContentEditable)return!0;const n=(E=i.getAttribute)===null||E===void 0?void 0:E.call(i,"contenteditable");return n==="true"||n===""})(Q)))})(g))return!1;const{targetElementList:C}=Vdg(g,!1);return!(e&&(function(Q,{safeText:i,ariaLabel:E}){let n;if(Q===!0)n=qdg;else{if(!aB(Q))return!1;if(Q.length>Tdg)return Dt.error(`[PostHog] content_ignorelist array cannot exceed ${Tdg} items. Use css_selector_ignorelist for more complex matching.`),!1;n=Q.map(s=>s.toLowerCase())}return n.some(s=>Zdg(i,s)||Zdg(E,s))})(e,(function(Q,i){for(const n of i)if(IzI(n))return bRA(n);for(const n of i){try{var E;if(((E=window)===null||E===void 0?void 0:E.getComputedStyle(n).getPropertyValue("cursor"))!=="pointer")break}catch{break}const s=bRA(n);if(s.safeText||s.ariaLabel)return s}return bRA(Q)})(g,C))||LRA(C,I))}const HRA=g=>!g||Nw(g,"html")||!Jf(g),Vdg=(g,A)=>{const I=typeof window>"u"?void 0:window;if(!I||HRA(g))return{parentIsUsefulElement:!1,targetElementList:[]};let e=!1;const t=[g];let o=g;for(;o.parentNode&&!Nw(o,"body");){if(URA(o.parentNode)){t.push(o.parentNode.host),o=o.parentNode.host;continue}const B=vdg(o);if(!B)break;if(A||PRA.indexOf(B.tagName.toLowerCase())>-1)e=!0;else try{const C=I.getComputedStyle(B);C&&C.getPropertyValue("cursor")==="pointer"&&(e=!0)}catch{}t.push(B),o=B}return{parentIsUsefulElement:e,targetElementList:t}};function kY(g){const A=new Set;let I=0;for(let o=g;o.parentNode&&!Nw(o,"body");o=o.parentNode){if(I++>=1e3||A.has(o))return!1;A.add(o);const B=T9(o);if(yB(B,"ph-sensitive")||yB(B,"ph-no-capture"))return!1}if(yB(T9(g),"ph-include"))return!0;const e=g.type||"";if(UC(e))switch(e.toLowerCase()){case"hidden":case"password":return!1}const t=g.name||g.id||"";return!UC(t)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(t.replace(/[^a-zA-Z0-9]/g,""))}function Z9(g){return!!(Nw(g,"input")&&!["button","checkbox","submit","reset"].includes(g.type)||Nw(g,"select")||Nw(g,"textarea")||g.getAttribute("contenteditable")==="true")}const jdg=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}))$"),zdg=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,tzI=[16,15,14,13],ozI=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Xdg=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),$dg=/[0-9A-Za-z_]/;function BzI(g){let A=0,I=!1;for(let e=g.length-1;e>=0;e--){let t=g.charCodeAt(e)-48;I&&(t*=2,t>9&&(t-=9)),A+=t,I=!I}return A%10==0}function O9(g,A=!0){return!(rC(g)||UC(g)&&(g=F9(g),(A?jdg.test((g||"").replace(/[- ]/g,"")):(function(I){let e;for(zdg.lastIndex=0;e=zdg.exec(I);){const t=e[2];if(!t)continue;const o=t.replace(/[- ]/g,"");for(let B=0;o.length>B;B++)for(const C of tzI){const Q=B+C;if(o.length>=Q){const i=o.slice(B,Q);if(jdg.test(i)&&BzI(i))return!0}}}return!1})(g))||(A?ozI.test(g):(function(I){let e;for(Xdg.lastIndex=0;e=Xdg.exec(I);){const t=e[1],o=e[3];if(!(t&&o&&$dg.test(t)&&$dg.test(o)))return!0}return!1})(g))))}function Ayg(g){let A=GV(g);return A=`${A} ${gyg(g)}`.trim(),O9(A)?A:""}function gyg(g){let A="";return g&&g.childNodes&&g.childNodes.length&&dn(g.childNodes,function(I){var e;if(I&&((e=I.tagName)===null||e===void 0?void 0:e.toLowerCase())==="span")try{const t=GV(I);A=`${A} ${t}`.trim(),I.childNodes&&I.childNodes.length&&(A=`${A} ${gyg(I)}`.trim())}catch(t){Dt.error("[AutoCapture]",t)}}),A}function Iyg(g){return g.replace(/"|\\"/g,'\\"')}function CzI(g){const A=g.attr__class;if(A)return aB(A)?A:JRA(A)}const vCA=qr("[Dead Clicks]"),QzI=()=>!0,izI=g=>{var A;const I=!!(!((A=g.instance.persistence)===null||A===void 0)&&A.get_property(lRA)),e=g.instance.config.capture_dead_clicks;return gm(e)?e:!!yC(e)||I};var eyg=class{get lazyLoadedDeadClicksAutocapture(){return this.Il}constructor(A,I,e){this.instance=A,this.isEnabled=I,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(A){if(!A.ok)return;const I=A.config;"captureDeadClicks"in I&&(this.instance.persistence&&this.instance.persistence.register({[lRA]:I.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Ml(()=>{this.El()}):this.stop()}Ml(A){var I,e,t;!((I=FB.__PosthogExtensions__)===null||I===void 0)&&I.initDeadClicksAutocapture?A():(e=FB.__PosthogExtensions__)===null||e===void 0||(t=e.loadExternalDependency)===null||t===void 0||t.call(e,this.instance,"dead-clicks-autocapture",o=>{o?vCA.error("failed to load script",o):A()})}El(){var A;if(ro){if(!this.Il&&(!((A=FB.__PosthogExtensions__)===null||A===void 0)&&A.initDeadClicksAutocapture)){const I=yC(this.instance.config.capture_dead_clicks)?QI({},this.instance.config.capture_dead_clicks):{};I.__onCapture=this.onCapture,this.onCapture&&(I.capture_dead_swipes=!1),this.Il=FB.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,I),this.Il.start(ro),vCA.info("starting...")}}else vCA.error("`document` not found. Cannot start.")}stop(){this.Il&&(this.Il.stop(),this.Il=void 0,vCA.info("stopping..."))}};const pV=qr("[SegmentIntegration]");function tyg(g,A,I=!0){const e=g.config.segment;if(!e)return A();const{analytics:t,filterProperties:o}=(C=>Xh(C.register))(B=e)?{analytics:B}:B;var B;(function(C,Q,i,E){const n=r=>{const a=()=>r.anonymousId()||Uf();C.config.get_device_id=a,E&&r.id()&&(C.register({distinct_id:r.id(),$device_id:a()}),C.persistence.set_property(Im,_CA)),i(E?void 0:r.anonymousId()||void 0)},s=Q.user();"then"in s&&Xh(s.then)?s.then(n):n(s)})(g,t,C=>{t.register(((Q,i,{filterProperties:E}={})=>{typeof Promise<"u"&&Promise.resolve||pV.warn("This browser does not have Promise support, and can not use the segment integration");const n=(s,r)=>{if(!r)return s;const a=!!i&&s.event.anonymousId===i&&!s.event.userId;a||s.event.userId||s.event.anonymousId===Q.get_distinct_id()||(pV.info("No userId set, resetting PostHog"),Q.reset()),a||(i=void 0),s.event.userId&&s.event.userId!==Q.get_distinct_id()&&(pV.info("UserId set, identifying with PostHog"),Q.identify(s.event.userId));let c=Q.calculateEventProperties(r,s.event.properties);if(!rC(E)){const h=s.event.properties||{},l={};for(const d of Object.keys(c))PfA.call(h,d)||(l[d]=c[d]);const D=((d,y)=>{const w=aB(d)?d:[d];let u=QI({},y);for(const G of w)try{if(u=G(u),rC(u))return null}catch(m){return pV.error("Error in Segment filterProperties:",m),null}return u})(E,l);if(rC(D))return s;c=D}return s.event.properties=Object.assign({},c,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(s){return n(s,s.event.event)},page(s){return n(s,pRA)},identify(s){return n(s,Rdg)},screen(s){return n(s,"$screen")}}})(g,C,{filterProperties:o})).then(()=>{A()},Q=>{pV.error("Failed to register the Segment integration",Q),A()})},I)}const oyg="posthog-js";function Byg(g,{organization:A,projectId:I,prefix:e,severityAllowList:t=["error"],sendExceptionsToPostHog:o=!0}={}){return B=>{var C,Q,i,E,n;if(t!=="*"&&!t.includes(B.level)||!g.__loaded)return B;B.tags||(B.tags={});const s=g.requestRouter.endpointFor("ui",`/project/${g.config.token}/person/${g.get_distinct_id()}`);B.tags["PostHog Person URL"]=s,g.sessionRecordingStarted()&&(B.tags["PostHog Recording URL"]=g.get_session_replay_url({withTimestamp:!0}));const r=((C=B.exception)===null||C===void 0?void 0:C.values)||[],a=r.map(l=>QI(QI({},l),{},{stacktrace:l.stacktrace?QI(QI({},l.stacktrace),{},{type:"raw",frames:(l.stacktrace.frames||[]).map(D=>QI(QI({},D),{},{platform:"web:javascript"}))}):void 0})),c={$exception_message:((Q=r[0])===null||Q===void 0?void 0:Q.value)||B.message,$exception_type:(i=r[0])===null||i===void 0?void 0:i.type,$exception_level:B.level,$exception_list:a,$sentry_event_id:B.event_id,$sentry_exception:B.exception,$sentry_exception_message:((E=r[0])===null||E===void 0?void 0:E.value)||B.message,$sentry_exception_type:(n=r[0])===null||n===void 0?void 0:n.type,$sentry_tags:B.tags};var h;return A&&I&&(c.$sentry_url=(e||"https://sentry.io/organizations/")+A+"/issues/?project="+I+"&query="+B.event_id),o&&((h=g.exceptions)===null||h===void 0||h.sendExceptionEvent(c)),B}}var EzI=class{constructor(A,I,e,t,o,B){this.name=oyg,this.setupOnce=function(C){C(Byg(A,{organization:I,projectId:e,prefix:t,severityAllowList:o,sendExceptionsToPostHog:B==null||B}))}}},Cyg=class{constructor(A){this.Pl=(I,e,t)=>{t&&(t.noSessionId||t.activityTimeout||t.sessionPastMaximumLength||t.crossTabAdoption)&&(Dt.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:I,changeReason:t}),this.Rl=void 0,this._instance.scrollManager.resetContext())},this._instance=A,this.Al()}Al(){var A;this.Fl=(A=this._instance.sessionManager)===null||A===void 0?void 0:A.onSessionId(this.Pl)}destroy(){var A;(A=this.Fl)===null||A===void 0||A.call(this),this.Fl=void 0}doPageView(A,I){var e;const t=this.Ol(A,I);return this.Rl={pathname:(e=Me?.location.pathname)!==null&&e!==void 0?e:"",pageViewId:I,timestamp:A},this._instance.scrollManager.resetContext(),t}doPageLeave(A){var I;return this.Ol(A,(I=this.Rl)===null||I===void 0?void 0:I.pageViewId)}doEvent(){var A;return{$pageview_id:(A=this.Rl)===null||A===void 0?void 0:A.pageViewId}}Ol(A,I){const e=this.Rl;if(!e)return{$pageview_id:I};let t={$pageview_id:I,$prev_pageview_id:e.pageViewId};const o=this._instance.scrollManager.getContext();if(o&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:B,lastScrollY:C,maxScrollY:Q,maxContentHeight:i,lastContentY:E,maxContentY:n}=o;if(!(Le(B)||Le(C)||Le(Q)||Le(i)||Le(E)||Le(n))){B=Math.ceil(B),C=Math.ceil(C),Q=Math.ceil(Q),i=Math.ceil(i),E=Math.ceil(E),n=Math.ceil(n);const s=B>1?FN(C/B,0,1,Dt):1,r=B>1?FN(Q/B,0,1,Dt):1,a=i>1?FN(E/i,0,1,Dt):1,c=i>1?FN(n/i,0,1,Dt):1;t=Qr(t,{$prev_pageview_last_scroll:C,$prev_pageview_last_scroll_percentage:s,$prev_pageview_max_scroll:Q,$prev_pageview_max_scroll_percentage:r,$prev_pageview_last_content:E,$prev_pageview_last_content_percentage:a,$prev_pageview_max_content:n,$prev_pageview_max_content_percentage:c})}}return e.pathname&&(t.$prev_pageview_pathname=e.pathname),e.timestamp&&(t.$prev_pageview_duration=(A.getTime()-e.timestamp.getTime())/1e3),t}};const kV=["flags","surveys"],nzI={[ujI]:{exposure:"hidden"},[YCA]:{exposure:"hidden"},[GjI]:{exposure:"hidden"},[sRA]:{exposure:"hidden"},[Y9]:{exposure:"hidden"},[DV]:{exposure:"hidden"},[Qdg]:{exposure:"event"},[aRA]:{exposure:"hidden"},[sdg]:{exposure:"hidden"},[rRA]:{exposure:"event"},[ndg]:{exposure:"hidden"},[cRA]:{exposure:"event"},[hRA]:{exposure:"event"},[lRA]:{exposure:"event"},[DRA]:{exposure:"hidden"},[adg]:{exposure:"event"},[dV]:{exposure:"hidden"},[mjI]:{exposure:"hidden"},[_9]:{exposure:"hidden"},[rdg]:{exposure:"event"},[pjI]:{exposure:"event",shouldSkipFromEventProperties:g=>fc(g)},[RjI]:{exposure:"event"},[NjI]:{exposure:"event"},[xjI]:{exposure:"event"},[FjI]:{exposure:"event"},[UjI]:{exposure:"hidden"},[xf]:{exposure:"hidden",storageGroup:"flags"},[vF]:{exposure:"hidden",storageGroup:"flags"},[CRA]:{exposure:"hidden"},[wY]:{exposure:"hidden",storageGroup:"flags"},[O4]:{exposure:"hidden",storageGroup:"flags"},[uY]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[cV]:{exposure:"hidden",storageGroup:"flags"},[UN]:{exposure:"hidden"},[GY]:{exposure:"hidden"},[Z4]:{exposure:"hidden"},[T4]:{exposure:"hidden"},[lV]:{exposure:"hidden",storageGroup:"surveys"},[PCA]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[iRA]:{exposure:"event"},[KCA]:{exposure:"hidden"},[LCA]:{exposure:"hidden"},[dRA]:{exposure:"hidden"},[JjI]:{exposure:"hidden"},[PjI]:{exposure:"hidden"},[KjI]:{exposure:"event"},[LjI]:{exposure:"event"},[YjI]:{exposure:"event"},[_jI]:{exposure:"event"},[qF]:{exposure:"hidden"},[hV]:{exposure:"hidden"},[cdg]:{exposure:"event"},[rV]:{exposure:"hidden"},[q4]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Im]:{exposure:"hidden"},[yRA]:{exposure:"hidden"},[bjI]:{exposure:"hidden"},[hdg]:{exposure:"hidden"},[ldg]:{exposure:"hidden"},[b9]:{exposure:"hidden"},[wRA]:{exposure:"hidden"},[kjI]:{exposure:"event"},[MjI]:{exposure:"event"},[SjI]:{exposure:"event"},[fjI]:{exposure:"event"},[ddg]:{exposure:"event"},[ydg]:{exposure:"event"},[GRA]:{exposure:"hidden"},[mRA]:{exposure:"hidden"},[wdg]:{exposure:"hidden"},[udg]:{exposure:"hidden"},[Gdg]:{exposure:"hidden"},[mdg]:{exposure:"hidden"},[pdg]:{exposure:"hidden"},[kdg]:{exposure:"hidden"},[Mdg]:{exposure:"hidden"},[HjI]:{exposure:"event"}},szI=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Dy=g=>{const A=nzI[g];if(A)return A;for(const[I,e]of szI)if(g.indexOf(I)===0)return e};function Qyg(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}const ZF=g=>{const A=typeof document>"u"?void 0:document,I=A?.createElement("a");return Le(I)?null:(I.href=g,I)},iyg=()=>{try{return"u">typeof window&&window.navigator.onLine!==!1}catch{return!1}},Eyg=(g,A)=>g>=A&&iyg(),nyg=(g,A,I,e)=>{if(g===0){if(iyg()){const t=A+1;return t===I&&e(),t}return A}return 0},W9=(g,A)=>{try{let I;return JSON.stringify(g,(e,t)=>{var o;return U9(t)?((o=I)!==null&&o!==void 0||(I=new WeakMap),I.has(t)||I.set(t,xdg(t)),I.get(t)):typeof t=="bigint"?t.toString():t},A)}catch{return Flg(g)}},V9=function(g,A){const I=((g.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let e;for(let t=0;I.length>t;t++){const o=I[t].split(/=(.*)/);if(o[0]===A){e=o;break}}if(!aB(e)||2>e.length)return"";{let t=e[1].replace(/\+/g," ");try{t=decodeURIComponent(t)}catch{Dt.error("Skipping decoding for malformed query param: "+t)}return t}},MV=function(g,A,I){if(!g||!A||!A.length)return g;const e=g.split("#"),t=e[1],o=(e[0]||"").split("?"),B=o[1],C=o[0],Q=(B||"").split("&"),i=[];for(let n=0;Q.length>n;n++){const s=Q[n].split("=");aB(s)&&(A.includes(s[0])?i.push(s[0]+"="+I):i.push(Q[n]))}let E=C;return B!=null&&(E+="?"+i.join("&")),t!=null&&(E+="#"+t),E},qCA=function(g,A){const I=g.match(new RegExp(A+"=([^&]*)"));return I?I[1]:null},j9=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],azI=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...j9],SV="<masked>",rzI=["li_fat_id"];function syg(g,A,I){if(!ro)return{};const e=A?[...j9,...I||[]]:[],t=ayg(MV(ro.URL,e,SV),g),o=(function(){const B={};return dn(rzI,function(C){const Q=yV(C);B[C]=Q||null}),B})();return Qr(o,t)}function ayg(g,A){const I=azI.concat(A||[]),e={};return dn(I,function(t){const o=V9(g,t);e[t]=o||null}),e}function ryg(g){const A=(function(t){return t?t.search("https?://(.*)google.([^/?]*)")===0?"google":t.search("https?://(.*)bing.com")===0?"bing":t.search("https?://(.*)yahoo.com")===0?"yahoo":t.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(g),I=A!="yahoo"?"q":"p",e={};if(!fc(A)){e.$search_engine=A;const t=ro?V9(ro.referrer,I):"";t.length&&(e.ph_keyword=t)}return e}function cyg(){return navigator.language||navigator.userLanguage}function czI(){const g=cyg();return typeof g=="string"?g.split("-")[0]:void 0}const TCA="$direct";function hyg(){return ro?.referrer||TCA}function lyg(g,A,I=!1){const e=g?[...j9,...A||[]]:[],t=I?v4(ta?.href):ta?.href,o=t?.substring(0,1e3);return{r:hyg().substring(0,1e3),u:o?MV(o,e,SV):void 0}}function Dyg(g,A=!1){var I;const{r:e,u:t}=g,o=A?v4(t):t,B={$referrer:e,$referring_domain:e==null?void 0:e==TCA?TCA:(I=ZF(e))===null||I===void 0?void 0:I.host};if(o){B.$current_url=o;const C=ZF(o);B.$host=C?.host,B.$pathname=C?.pathname;const Q=ayg(o);Qr(B,Q)}if(e){const C=ryg(e);Qr(B,C)}return B}function hzI(){try{return new Date().getTimezoneOffset()}catch{return}}const lzI={flags:q4,surveys:PCA},DzI=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ZCA=g=>`${g}_cookie_identity_change_pending`,OCA=g=>{let A="",I=0;for(const e of g){const t=encodeURIComponent(JSON.stringify(e).slice(1,-1)).length;if(I+t>1e3)break;A+=e,I+=t}return A},aD="main",OF=[xf,vF,wY,O4,uY,q4,cV,Z4],vRA=g=>OF.indexOf(g)!==-1,dyg=[Y9,DV],yyg=g=>dyg.indexOf(g)!==-1,W4=(g,A)=>{try{return JSON.stringify(g)===JSON.stringify(A)}catch{return g===A}},z9=g=>{if(!g)return{};const A=JSON.parse(g);return yC(A)?A:{}},wyg=(g,A)=>{dn(g,(I,e)=>{const t=Dy(e);t&&t.exposure!=="event"||{}.hasOwnProperty.call(A,e)||delete g[e]})};var qRA=class{constructor(A,I,e=!0,t=!A.cookieless_mode){if(this.Dl={},this.Ll=!1,this.Nl=!1,this.ql=!1,this.jl=!1,this.Bl=!1,this.zl=new Map,this.Hl=!1,this.Ul=!1,this.Wl=!1,this.Vl=new Set,this.Gl=new Set,this.Ar=A,this.Ql=e,this.props={},this.Zl=void 0,this.Jl=(o=>{let B="";return o.token&&(B=o.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),o.persistence_name?"ph_"+o.persistence_name:"ph_"+B+"_posthog"})(A),this.hi=A.disable_persistence||!!I,this.$l=this.Kl(A),this.ql=this.Xl(A),this.load(t),this.Yl(),A.debug&&Dt.info("Persistence loaded",A.persistence,QI({},this.props)),this.update_config(A,A,I),this.save(),Me){const o=()=>this.flush();GE(Me,"beforeunload",o,{capture:!1}),GE(Me,"pagehide",o,{capture:!1}),this.tu=B=>{if(this.Ll&&(!B.storageArea||B.storageArea===Me?.localStorage)&&B.key)if(B.key!==this.Jl){if(this.ql){const C=kV.find(Q=>B.key===this.eu(Q));C&&this.iu(B.key,C)}}else this.iu(B.key,aD)},GE(Me,"storage",this.tu)}}markCrossTabFeatureFlagChanges(A){Object.entries(A).forEach(([I,e])=>{const t=this.zl.get(I);if(!vRA(I)||t===!0)return;if(e===!0)return void this.nu(I,!0);const o=new Set(t||[]);e.forEach(B=>o.add(B)),o.size&&this.nu(I,o)})}onCrossTabFeatureFlagChange(A){return this.Gl.add(A),()=>this.Gl.delete(A)}destroy(){this.tu&&Me&&(Me.removeEventListener("storage",this.tu),this.tu=void 0),this.Gl.clear()}iu(A,I,e=!0){if(this.hi)return!1;let t,o;try{if(o=AE.Ot(A),fc(o)){const Q=this.su(I);return Q.storageValue=null,I!==aD&&(Q.persisted=!1),!1}t=z9(o)}catch{return!1}const B=I===aD?t:AE.Lt(this.Jl);if(B&&this.ru(B))return!1;const C=this.ou(t,I,e);return I===aD&&this.ql&&!W4(this.au().main,t)||this.lu(t,I,!0,o),C}ru(A){const I=this.props[Ff],e=A[Ff];return!Le(I)&&!Le(e)&&I!==e}lu(A,I,e,t){const o=this.su(I);o.storageValue=t,I!==aD&&(o.persisted=e);try{o.fingerprint=this.uu(A,I)}catch{o.fingerprint=void 0}}ou(A,I,e){let t=!1;return OF.forEach(o=>{var B;const C=(B=Dy(o))===null||B===void 0?void 0:B.storageGroup;if(I===aD&&this.ql&&C||I!==aD&&C!==I)return;const Q=o in A,i=this.cu(o,Q?A[o]:void 0),E=this.zl.has(o)?o in this.props:Q;E===o in this.props&&W4(i,this.props[o])||(E?this.hu(o,i,!1):this.du(o,!1),t=!0)}),t&&e&&this.Gl.forEach(o=>o()),t}vu(){if(!this.Ll)return!1;try{this.Wl=!1;const A=AE.Ot(this.Jl),I=this.su(aD);let e,t=!1,o=!1;if(A!==I.storageValue)if(fc(A))I.storageValue=null;else{if(e=z9(A),this.Wl=!this.Ul&&this.ru(e),this.Wl)return!1;o=this.ou(e,aD,!1),!this.ql||W4(this.au().main,e)?this.lu(e,aD,!0,A):I.storageValue=A,t=!0}return this.ql&&kV.forEach(B=>{const C=AE.Ot(this.eu(B)),Q=this.su(B),i=e||{},E=t&&OF.some(s=>{var r;return((r=Dy(s))===null||r===void 0?void 0:r.storageGroup)===B&&s in i});if(C===Q.storageValue&&!E)return;if(fc(C))return Q.storageValue=null,Q.persisted=!1,void(E&&(o=this.ou(i,B,!1)||o));const n=z9(C);o=this.ou(n,B,!1)||o,this.lu(n,B,!0,C)}),o}catch{return!1}}nu(A,I){this.zl.set(A,I);const e=Dy(A);e?.volatile||(this.su((this.ql?e?.storageGroup:void 0)||aD).fingerprint=void 0,this.fu(A))}pu(){OF.forEach(A=>this.zl.set(A,!0))}Yl(){if(this.Ll)try{const A=AE.Ot(this.Jl),I=z9(A);this.su(aD).storageValue=A,OF.forEach(e=>{var t;const o=this.ql?(t=Dy(e))===null||t===void 0?void 0:t.storageGroup:void 0,B=o?AE.Ot(this.eu(o)):null;if(o){const Q=this.su(o);Q.storageValue=B,Q.persisted=!fc(B)}const C=o&&!fc(B)?z9(B):I;e in this.props?this.gu(e,C[e],this.props[e]):e in C&&this.nu(e,!0)})}catch{}}cu(A,I){const e=this.zl.get(A);if(!e)return I;if(e===!0)return this.props[A];if(A==="$active_feature_flags"){const B=new Set(aB(I)?I:[]),C=new Set(aB(this.props[A])?this.props[A]:[]);return e.forEach(Q=>C.has(Q)?B.add(Q):B.delete(Q)),Array.from(B)}const t=yC(I)?QI({},I):{},o=yC(this.props[A])?this.props[A]:{};return e.forEach(B=>{B in o?t[B]=o[B]:delete t[B]}),t}gu(A,I,e){if(!vRA(A))return;const t=this.zl.get(A);if(t===!0)return;let o=I;if(this.Ll)try{var B;const Q=this.ql?(B=Dy(A))===null||B===void 0?void 0:B.storageGroup:void 0,i=Q?this.eu(Q):this.Jl;o=z9(AE.Ot(i))[A]}catch{}const C=new Set(t||[]);if(A==="$active_feature_flags"){if(!Le(I)&&!aB(I)||!Le(o)&&!aB(o)||!aB(e))return void this.nu(A,!0);const Q=new Set(I||[]),i=new Set(o||[]),E=new Set(e);new Set([...Q,...E]).forEach(n=>{Q.has(n)!==E.has(n)&&C.add(n)}),C.forEach(n=>{i.has(n)===E.has(n)&&C.delete(n)})}else{if(!yC(e))return void(W4(o,e)?this.zl.delete(A):this.nu(A,!0));{if(!Le(I)&&!yC(I)||Le(I)&&_p(e)&&Le(o))return void this.nu(A,!0);const Q=yC(I)?I:{},i=yC(o)?o:{};new Set([...Object.keys(Q),...Object.keys(e)]).forEach(E=>{E in Q==E in e&&W4(Q[E],e[E])||C.add(E)}),C.forEach(E=>{E in i==E in e&&W4(i[E],e[E])&&C.delete(E)})}}C.size?this.nu(A,C):this.zl.delete(A)}mu(){var A;const I=(A=this.Ar)===null||A===void 0?void 0:A.persistence_save_debounce_ms;return $h(I)&&I>0?I:0}yu(A){if(this.Ar.cookieWinsOnConflict&&this.Ar.persistence.toLowerCase()==="localstorage+cookie")if(A)try{const I=NRA(A,this.Ar.cookie_persisted_properties||[]),e=Pdg(I,this.Ar.cookie_persisted_properties||[]),t=JSON.stringify(I)+"|"+JSON.stringify(e),o=ir.Ot(this.Jl)||void 0;o&&xRA(this.Jl,o)===t&&(this.bu=t,this._u=o)}catch{}else try{const I=ir.Ot(this.Jl)||void 0;this.bu=I?xRA(this.Jl,I):void 0,this._u=I}catch{}}syncCookieProperties(){return this.wu(this.Ar)}wu(A,I=!1){if(this.hi&&!I||this.Bl||!A.cookieWinsOnConflict||A.persistence.toLowerCase()!=="localstorage+cookie")return!1;let e;try{e=ir.Ot(this.Jl)||void 0}catch{}if(!e||e===this._u)return!1;const t=xRA(this.Jl,e);let o;try{o=RRA(JSON.parse(e))}catch{return!1}if((ir.Ot(this.Jl)||void 0)!==e)return!1;this.bu=t,this._u=e;const B=Kdg(this.Jl,e),C=[...mY,...B.properties],Q={};if(Object.keys(o).forEach(h=>{const l=o[h];(Le(l)||fc(l)||l===""||h==="$user_state"&&l!=="anonymous"&&l!=="identified")&&(Q[h]=!0,delete o[h])}),_p(o))return!1;const i="distinct_id"in o||o.$user_state==="anonymous"||o.$user_state==="identified",E=this.props,n=E[Ff],s=E[Im],r=Qr({},E);[...mY,...A.cookie_persisted_properties||[]].forEach(h=>{if(C.indexOf(h)!==-1&&!(h in o)&&!Q[h]&&(i||h!=="distinct_id"&&h!=="$user_state")){const l=r[h];(B.isValid||mY.indexOf(h)===-1||l!==!1&&l!==0)&&delete r[h]}}),this.props=Qr(r,o),OF.forEach(h=>{const l=h in this.props;h in E===l&&W4(E[h],this.props[h])||(l?this.gu(h,E[h],this.props[h]):this.nu(h,!0))}),!i||"$user_state"in o||"$user_state"in this.props||this.hu(Im,TF);const a=this.props[Ff],c=this.props[Im];return!i||a===n&&c===s||(this.Ul=!0,this.jl=!0,Ba.At(ZCA(this.Jl),!0),this.du(Z4),this.du(vF),this.du(xf),this.du(wY),this.du(O4),this.du(uY),this.du(q4),this.du(rV),this.du(qF),c!=="anonymous"||s!=="identified"&&o.$user_state!=="anonymous"&&(Le(n)||a===n)||(wyg(this.props,o),this.du(T4)),c==="identified"?this.props.$user_id=a:delete this.props.$user_id,this.du(YCA)),!0}consumeCookieIdentityChange(){const A=ZCA(this.Jl),I=this.jl||!!Ba.Ot(A);return this.jl=!1,I&&Ba.Pt(A),I}ku(A=!1){return!(this.Bl||this.hi&&!A||!this.Ar.cookieWinsOnConflict||this.Ar.persistence.toLowerCase()!=="localstorage+cookie"||(this.Bl=!0,0))}Su(){this.Bl&&(Le(this.xu)||(clearTimeout(this.xu),this.xu=void 0),delete this.Dl[aD],this.$u(!0))}Cu(A=!0){if(this.Bl)try{A?this.Su():Le(this.xu)||(clearTimeout(this.xu),this.xu=void 0)}finally{this.Bl=!1}}isDisabled(){return!!this.hi}Kl(A){DzI.indexOf(A.persistence.toLowerCase())===-1&&(Dt.critical("Unknown persistence type "+A.persistence+"; falling back to localStorage+cookie"),A.persistence="localStorage+cookie");const I=((C=[],Q=!1,i=()=>!1)=>{const E=[...mY,...C];return QI(QI({},AE),{},{Tu(n){return[ir.Ot(n),ir.Ot(uV(n)),AE.Ot(n)].join("\0")},Lt(n){try{let r,a={};try{r=ir.Ot(n)||void 0,a=r?RRA(JSON.parse(r)):{}}catch{}const c=JSON.parse(AE.Ot(n)||"{}");let h;if(Q){const l=Kdg(n,r),D=[...mY,...l.properties],d={};Object.keys(a).forEach(w=>{const u=a[w];fc(u)||u===""||w==="$user_state"&&u!=="anonymous"&&u!=="identified"||(d[w]=u)});const y="distinct_id"in d||d.$user_state==="anonymous"||d.$user_state==="identified";if(Object.keys(d).length>0){var s;const w=c[Ff],u=(s=c.$user_state)!==null&&s!==void 0?s:TF;E.forEach(G=>{if(D.indexOf(G)!==-1&&!(G in a)&&(y||G!=="distinct_id"&&G!=="$user_state")){const m=c[G];(l.isValid||mY.indexOf(G)===-1||m!==!1&&m!==0)&&delete c[G]}}),!y||"$user_state"in a||"$user_state"in c||(c[Im]=TF),!y||("distinct_id"in d?d[Ff]:c[Ff])===w&&("$user_state"in d?d[Im]:c[Im])===u||(fRA.forEach(G=>delete c[G]),d.$user_state==="identified"&&"distinct_id"in d?c.$user_id=d[Ff]:delete c.$user_id,d.$user_state!=="identified"&&(delete c[cdg],delete c[T4]),delete c.__alias)}h=Qr(c,d)}else h=Qr(a,c);return i()||AE.At(n,h),h}catch{}return null},At(n,s,r,a,c,h){const l=AE.At(n,s,void 0,void 0,h);try{const D=NRA(s,C);if(Object.keys(D).length){if(Q){const d=uV(n),y=Pdg(D,C);if(ir.At(d,y,r,a,c,h),ir.Ot(d)!==JSON.stringify(y)){ir.Pt(d,a);const w=NRA(s);return ir.At(n,w,r,a,c,h),l}}ir.At(n,D,r,a,c,h)}}catch(D){AE.Ft(D)}return l},Pt(n,s){try{Me?.localStorage.removeItem(n),ir.Pt(n,s),ir.Pt(uV(n),s)}catch(r){AE.Ft(r)}}})})(A.cookie_persisted_properties||[],A.cookieWinsOnConflict,()=>!!this.hi);let e,t=!1,o=!1;const B=A.persistence.toLowerCase();return B==="localstorage"&&AE.$t()?(e=AE,o=!0):B==="localstorage+cookie"&&I.$t()?(e=I,o=!0,t=!0):B==="sessionstorage"&&Ba.$t()?e=Ba:B==="memory"?e=FRA:B==="cookie"&&ir.$t()?(e=ir,t=!0):I.$t()?(e=I,o=!0,t=!0):ir.$t()?(e=ir,t=!0):e=FRA,this.Ll=o,this.Nl=t,e}eu(A){return`${this.Jl}__${A}`}Xl(A){return this.Ll&&!!A.split_storage}properties(){const A={};return dn(this.props,(I,e)=>{const t=Dy(e);if(!t||t.exposure==="event"){var o;if(!(t==null||(o=t.shouldSkipFromEventProperties)===null||o===void 0)&&o.call(t,I))return;A[e]=I}}),A}load(A=!1){if(this.hi&&!A)return;const I=this.Ar.cookieWinsOnConflict&&this.Ar.persistence.toLowerCase()==="localstorage+cookie",e=I?AE.Lt(this.Jl):null;let t={};if(I)try{t=RRA(ir.Lt(this.Jl)),dn(t,(Q,i)=>{(Le(Q)||fc(Q)||Q==="")&&delete t[i]})}catch{}const o=this.$l.Lt(this.Jl);if(o&&(this.props=Qr({},o)),this.ql&&this.Iu(),I&&o){var B,C;const Q=e?.[Ff],i=(B=e?.$user_state)!==null&&B!==void 0?B:TF,E=o[Ff],n=(C=o.$user_state)!==null&&C!==void 0?C:TF;if(E!==Q||n!==i){this.jl=!0,this.hi||Ba.At(ZCA(this.Jl),!0);const s=Qr({},this.props);fRA.forEach(a=>delete s[a]),n!=="anonymous"||i!=="identified"&&t.$user_state!=="anonymous"&&(Le(Q)||E===Q)||(wyg(s,t),delete s[T4]),this.props=s;const r=new Set;fRA.forEach(a=>{var c;const h=(c=Dy(a))===null||c===void 0?void 0:c.storageGroup;h&&r.add(h)}),r.forEach(a=>{if(this.hi)return;const c={};dn(this.props,(h,l)=>{var D;((D=Dy(l))===null||D===void 0?void 0:D.storageGroup)===a&&(c[l]=h)}),_p(c)?(AE.Pt(this.eu(a)),this.Dl[a]={}):AE.At(this.eu(a),c)&&(this.Dl[a]={persisted:!0,fingerprint:this.uu(c,a)})})}}Ba.Ot(ZCA(this.Jl))&&(this.jl=!0)}Iu(){for(const A of kV){const I=AE.Lt(this.eu(A));if(I&&!_p(I)){const e=this.su(A);e.persisted=!0,this.Mu(A)||(e.fingerprint=this.uu(I,A)),this.Eu(A,I)||Qr(this.props,I)}}}Mu(A){return Object.keys(this.props).some(I=>{var e;return((e=Dy(I))===null||e===void 0?void 0:e.storageGroup)===A})}Eu(A,I){const e=lzI[A];if(!e)return!1;const t=I[e],o=this.props[e];return $h(t)&&$h(o)&&o>t}refreshKey(A){this.Pu([A])}Pu(A){if(this.hi)return;let I,e=!1;const t=()=>(e||(I=this.$l.Lt(this.Jl),e=!0),I);A.forEach(o=>{var B;if(this.Vl.has(o))return;const C=this.ql?(B=Dy(o))===null||B===void 0?void 0:B.storageGroup:void 0,Q=C?AE.Lt(this.eu(C)):t();if(Q&&o in Q)this.hu(o,Q[o],!1);else{if(C){const i=t();if(i&&o in i)return void this.hu(o,i[o],!1)}this.du(o,!1)}})}refreshMetaIdentifiers(){if(this.hi)return;const A=this.Ru();(Le(A)||A!==this.Au)&&(this.Pu(dyg),this.Fu(A))}Fu(A=this.Ru()){this.Au=this.Vl.size===0?A:void 0}Ru(){const A=this.$l.Tu?this.$l.Tu(this.Jl):this.$l.Ot(this.Jl);return UC(A)?A:void 0}save(){if(this.hi)return;const A=this.mu();A>0?Le(this.xu)&&(this.xu=setTimeout(()=>{this.xu=void 0,this.$u()},A)):this.$u()}flush(){Le(this.xu)||(clearTimeout(this.xu),this.xu=void 0,this.$u())}$u(A=!1){if(this.hi||this.Bl&&!A)return;A||(this.syncCookieProperties(),this.Ar.cookieWinsOnConflict&&this.Ar.persistence.toLowerCase()==="localstorage+cookie"||this.refreshMetaIdentifiers());const I=!A&&!this.Hl;I||(this.Wl=!1);const e=!!I&&this.vu();if(this.Wl)return void(this.Ar.debug&&Dt.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.ql)return this.Ou(),void(e&&this.Gl.forEach(o=>o()));const t=this.Du(this.$l,this.Jl,this.props,aD);t==="written"&&this.yu(this.props),t!=="failed"&&(this.zl.clear(),this.Ul=!1,this.Vl.clear()),t==="written"&&this.Fu(),e&&this.Gl.forEach(o=>o())}Ou(){const{main:A,groups:I}=this.au(),e=this.Du(this.$l,this.Jl,A,aD);e==="written"&&this.yu(A),e!=="failed"&&(this.Ul=!1,this.Vl.clear(),OF.forEach(o=>{var B;!((B=Dy(o))===null||B===void 0)&&B.storageGroup||this.zl.delete(o)})),e==="written"&&this.Fu();for(const o of kV){var t;const B=I[o];if(_p(B)&&!(!((t=this.Dl[o])===null||t===void 0)&&t.persisted)){OF.forEach(Q=>{var i;((i=Dy(Q))===null||i===void 0?void 0:i.storageGroup)===o&&this.zl.delete(Q)});continue}const C=this.Du(AE,this.eu(o),B,o);C!=="failed"&&OF.forEach(Q=>{const i=Dy(Q);i?.storageGroup!==o||C!=="written"&&i.volatile||this.zl.delete(Q)})}}au(){const A={},I={flags:{},surveys:{}};return dn(this.props,(e,t)=>{var o;const B=(o=Dy(t))===null||o===void 0?void 0:o.storageGroup;B?I[B][t]=e:A[t]=e}),{main:A,groups:I}}uu(A,I){if(I===aD)return JSON.stringify(A)+"|"+this.Lu+"|"+this.Nu+"|"+this.qu;const e={};return dn(A,(t,o)=>{var B;e[o]=!((B=Dy(o))===null||B===void 0)&&B.volatile?"__volatile__":t}),JSON.stringify(e)}Du(A,I,e,t){const o=this.su(t);if(t!==aD&&!o.dirty&&!Le(o.fingerprint))return"skipped";let B;try{if(B=this.uu(e,t),B===o.fingerprint)return o.dirty=!1,"skipped"}catch{B=void 0}return A.At(I,e,this.Lu,this.Nu,this.qu,this.Ar.debug)?(o.dirty=!1,t!==aD&&(o.persisted=!0),Le(B)||(o.fingerprint=B),this.Ll&&(o.storageValue=AE.Ot(I)),"written"):(this.Ar.debug&&Dt.warn(`failed to persist storage entry "${I}"; will retry on next save`),"failed")}remove({keepGroupEntries:A=!1}={}){if(this.pu(),Le(this.xu)||(clearTimeout(this.xu),this.xu=void 0),this.$l.Pt(this.Jl,!1),this.$l.Pt(this.Jl,!0),!A&&this.Ql)for(const I of kV)AE.Pt(this.eu(I));A?delete this.Dl[aD]:this.Dl={},this.bu=void 0,this._u=void 0}clear(){this.remove(),this.props={}}register_once(A,I,e){if(yC(A)){this.syncCookieProperties(),Le(I)&&(I="None"),this.Lu=Le(e)?this.ju:e;let t=!1;if(dn(A,(o,B)=>{this.props.hasOwnProperty(B)&&this.props[B]!==I||(this.hu(B,o),t=!0)}),t)return this.save(),!0}return!1}register(A,I){if(yC(A)){this.syncCookieProperties(),this.Lu=Le(I)?this.ju:I;let e=!1;if(dn(A,(t,o)=>{A.hasOwnProperty(o)&&(this.props[o]!==t||yC(t)||aB(t))&&(this.hu(o,t),e=!0)}),e)return this.save(),!0}return!1}unregister(A){this.syncCookieProperties();const I=typeof A=="string"?[A]:A;let e=!1;for(const t of I)t in this.props&&(this.du(t),e=!0);e&&this.save()}update_campaign_params(){const A=ro?.URL;if(A===this.Zl)return;const I=syg(this.Ar.custom_campaign_params,this.Ar.mask_personal_data_properties,this.Ar.custom_personal_data_properties),e=!_p(kRA(I));return e&&this.register(I),this.Zl=A,e?I:void 0}update_search_keyword(){this.register((function(){const A=ro?.referrer;return A?ryg(A):{}})())}update_referrer_info(){var A;this.register_once({$referrer:hyg(),$referring_domain:ro?.referrer&&((A=ZF(ro.referrer))===null||A===void 0?void 0:A.host)||TCA},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const A=lyg(this.Ar.mask_personal_data_properties,this.Ar.custom_personal_data_properties,this.Ar.disable_capture_url_hashes);this.register_once({[b9]:this.Nl?{r:OCA(A.r),u:A.u?OCA(A.u):void 0}:A},void 0)}get_initial_props(){const A={};dn([ldg,hdg],e=>{const t=this.props[e];t&&dn(t,function(o,B){A["$initial_"+JfA(B)]=o})});const I=this.props[b9];if(I){const e=(function(t,o=!1){const B=Dyg(t,o),C={};return dn(B,function(Q,i){C[`$initial_${JfA(i)}`]=Q}),C})(I,this.Ar.disable_capture_url_hashes);Qr(A,e)}return A}safe_merge(A){return dn(this.props,function(I,e){e in A||(A[e]=I)}),A}update_config(A,I,e){const t=A.persistence!==I.persistence,o=!((a,c)=>{if(a.length!==c.length)return!1;const h=[...a].sort(),l=[...c].sort();return h.every((D,d)=>D===l[d])})(A.cookie_persisted_properties||[],I.cookie_persisted_properties||[]),B=t||o,C=A.cookieWinsOnConflict!==I.cookieWinsOnConflict,Q=A.disable_persistence||!!e,i=!!this.hi&&!Q;Q||this.wu(I,i),this.Ar=A,!Q&&(t||o||C)&&(this.bu=void 0,this._u=void 0,this.wu(QI(QI({},A),{},{cookie_persisted_properties:I.cookie_persisted_properties}),i));const E=B||C?this.Kl(A):this.$l;this.Bu();const n=this.Xl(A),s=B||n!==this.ql,r=!Q&&(s||A.cross_subdomain_cookie!==this.Nu||A.secure_cookie!==this.qu)&&this.ku(i);this.Hl=s;try{if(this.ju=this.Lu=A.cookie_expiration,this.set_disabled(Q),this.set_cross_subdomain(A.cross_subdomain_cookie),this.set_secure(A.secure_cookie),s){const a=this.props;this.clear(),this.$l=E,this.ql=n,this.props=a,this.save()}else C&&(this.$l=E,Q||(delete this.Dl[aD],this.$u()))}finally{this.Hl=!1,r&&this.Cu()}}Bu(){const A=this.props[b9];if(!this.Nl||!yC(A)||typeof A.r!="string")return;const I=OCA(A.r),e=typeof A.u=="string"?OCA(A.u):A.u;I===A.r&&e===A.u||this.hu(b9,QI(QI({},A),{},{r:I,u:e}))}set_disabled(A){this.hi=A,this.hi?this.remove():this.save()}set_cross_subdomain(A){A!==this.Nu&&(this.Nu=A,this.remove({keepGroupEntries:!0}),this.save())}set_secure(A){A!==this.qu&&(this.qu=A,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(A,I){const e=this.props.__timers||{};e[A]=I,this.hu(sRA,e),this.save()}remove_event_timer(A){const I=this.props.__timers||{},e=I[A];return Le(e)||(delete I[A],this.hu(sRA,I),this.save()),e}get_property(A){return this.props[A]}set_property(A,I){this.hu(A,I),this.save()}hu(A,I,e=!0){var t;const o=this.props[A];this.props[A]=I,e&&(A!=="distinct_id"&&A!=="$user_state"||o===I||(this.Ul=!0),yyg(A)&&!W4(o,I)&&this.Vl.add(A),this.gu(A,o,I),!((t=Dy(A))===null||t===void 0)&&t.volatile||this.fu(A))}du(A,I=!0){delete this.props[A],I&&(vRA(A)&&this.nu(A,!0),yyg(A)&&this.Vl.add(A),this.fu(A))}fu(A){var I;const e=(I=Dy(A))===null||I===void 0?void 0:I.storageGroup;e&&(this.su(e).dirty=!0)}su(A){return this.Dl[A]||(this.Dl[A]={})}};const GM={GZipJS:"gzip-js",Base64:"base64"},fV={Activation:"events",Cancellation:"cancelEvents"},TRA={Popover:"popover",API:"api",Widget:"widget"},mM={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},ZRA={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},ORA={Popover:"popover",Inline:"inline"};function WCA(g){let A=!0;return{dispose(){if(A){A=!1;const I=g();I&&Xh(I.then)&&I.then(void 0,()=>{})}}}}const dzI={SHOWN:"product tour shown"},uyg={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Gyg=qr("[RateLimiter]");var yzI=class{constructor(A){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=I=>{const e=I.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach(t=>{Gyg.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=new Date().getTime()+6e4})}catch(t){return void Gyg.warn(`could not rate limit - continuing. Error: "${t?.message}"`,{text:e})}},this.instance=A,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var A;return((A=this.instance.config.rate_limiting)===null||A===void 0?void 0:A.events_per_second)||10}get captureEventsBurstLimit(){var A;return Math.max(((A=this.instance.config.rate_limiting)===null||A===void 0?void 0:A.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(A=!1){var I,e,t;const{captureEventsBurstLimit:o,captureEventsPerSecond:B}=this,C=new Date().getTime(),Q=(I=(e=this.instance.persistence)===null||e===void 0?void 0:e.get_property("$capture_rate_limit"))!==null&&I!==void 0?I:{tokens:o,last:C};Q.tokens+=Math.max(0,C-Q.last)/1e3*B,Q.last=Math.max(Q.last,C),Q.tokens>o&&(Q.tokens=o);const i=1>Q.tokens;if(i||A||(Q.tokens=Math.max(0,Q.tokens-1)),i&&!A){const E=($h(Q.dropped)?Q.dropped:0)+1;Q.dropped=E,!this.lastEventRateLimited&&this.zu(E)&&(Q.dropped=0)}return this.lastEventRateLimited=i,(t=this.instance.persistence)===null||t===void 0||t.set_property("$capture_rate_limit",Q),{isRateLimited:i,remainingTokens:Q.tokens}}Hu(A){const I=this.instance.config.property_denylist;return!aB(I)||!I.includes(A)}Uu(){var A;if(this.Hu("$current_url")&&this.Hu("$pathname")&&ta?.pathname)return`${(A=ta.origin)!==null&&A!==void 0?A:""}${ta.pathname}`}zu(A){var I,e;const{captureEventsBurstLimit:t,captureEventsPerSecond:o}=this,B=this.Uu(),C=this.Hu("$session_id")?(I=(e=this.instance).get_session_id)===null||I===void 0?void 0:I.call(e):void 0,Q=[`${A} event(s) dropped since the last warning`,B?`triggered on ${B}`:void 0,C?`session ${C}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${Q}. Config is set to ${o} events per second and ${t} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(A){const I=this.serverLimits[A||"events"]||!1;return I!==!1&&new Date().getTime()<I}};const V4=qr("[RemoteConfig]");var myg=class{constructor(A){this._instance=A}get remoteConfig(){var A;return(A=FB._POSTHOG_REMOTE_CONFIG)===null||A===void 0||(A=A[this._instance.config.token])===null||A===void 0?void 0:A.config}Wu(A){var I,e,t;!((I=FB.__PosthogExtensions__)===null||I===void 0)&&I.loadExternalDependency?(e=FB.__PosthogExtensions__)===null||e===void 0||(t=e.loadExternalDependency)===null||t===void 0||t.call(e,this._instance,"remote-config",()=>A(this.remoteConfig)):A()}Vu(A){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:A})}load(){try{if(this.remoteConfig)return V4.info("Using preloaded remote config",this.remoteConfig),void this.Gu(this.remoteConfig);if(this._instance.Qu())return void V4.warn("Remote config is disabled. Falling back to local config.");this.Wu(A=>{if(!A)return V4.info("No config found after loading remote JS config. Falling back to JSON."),void this.Vu(I=>{this.Gu(I.json,I)});this.Gu(A)})}catch(A){V4.error("Error loading remote config",A),this.Gu()}}Gu(A,I){!A&&I&&(I.statusCode===0?I.error||V4.warn("Failed to fetch remote config from PostHog."):V4.error("Failed to fetch remote config from PostHog."));try{this._instance.Gu(A?{ok:!0,config:A}:{ok:!1})}catch(t){V4.error("Error applying remote config",t)}if(A?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;(e=this._instance.featureFlags)===null||e===void 0||e.ensureFlagsLoaded()}catch(t){V4.error("Error loading feature flags",t)}}},i2=Uint8Array,Hp=Uint16Array,X9=Uint32Array,WRA=new i2([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]),VRA=new i2([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]),pyg=new i2([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),kyg=function(g,A){for(var I=new Hp(31),e=0;31>e;++e)I[e]=A+=1<<g[e-1];var t=new X9(I[30]);for(e=1;30>e;++e)for(var o=I[e];I[e+1]>o;++o)t[o]=o-I[e]<<5|e;return[I,t]},Myg=kyg(WRA,2),jRA=Myg[1];Myg[0][28]=258,jRA[258]=28;for(var Syg=kyg(VRA,0)[1],fyg=new Hp(32768),Rc=0;32768>Rc;++Rc){var $9=(43690&Rc)>>>1|(21845&Rc)<<1;fyg[Rc]=((65280&($9=(61680&($9=(52428&$9)>>>2|(13107&$9)<<2))>>>4|(3855&$9)<<4))>>>8|(255&$9)<<8)>>>1}var RV=function(g,A,I){for(var e=g.length,t=0,o=new Hp(A);e>t;++t)++o[g[t]-1];var B,C=new Hp(A);for(t=0;A>t;++t)C[t]=C[t-1]+o[t-1]<<1;for(B=new Hp(e),t=0;e>t;++t)B[t]=fyg[C[g[t]-1]++]>>>15-g[t];return B},MY=new i2(288);for(Rc=0;144>Rc;++Rc)MY[Rc]=8;for(Rc=144;256>Rc;++Rc)MY[Rc]=9;for(Rc=256;280>Rc;++Rc)MY[Rc]=7;for(Rc=280;288>Rc;++Rc)MY[Rc]=8;var VCA=new i2(32);for(Rc=0;32>Rc;++Rc)VCA[Rc]=5;var wzI=RV(MY,9),uzI=RV(VCA,5),Ryg=function(g){return(g/8|0)+(7&g&&1)},Nyg=function(g,A,I){(I==null||I>g.length)&&(I=g.length);var e=new(g instanceof Hp?Hp:g instanceof X9?X9:i2)(I-A);return e.set(g.subarray(A,I)),e},WF=function(g,A,I){var e=A/8|0;g[e]|=I<<=7&A,g[e+1]|=I>>>8},NV=function(g,A,I){var e=A/8|0;g[e]|=I<<=7&A,g[e+1]|=I>>>8,g[e+2]|=I>>>16},zRA=function(g,A){for(var I=[],e=0;g.length>e;++e)g[e]&&I.push({s:e,f:g[e]});var t=I.length,o=I.slice();if(!t)return[new i2(0),0];if(t==1){var B=new i2(I[0].s+1);return B[I[0].s]=1,[B,1]}I.sort(function(w,u){return w.f-u.f}),I.push({s:-1,f:25001});var C=I[0],Q=I[1],i=0,E=1,n=2;for(I[0]={s:-1,f:C.f+Q.f,l:C,r:Q};E!=t-1;)C=I[I[n].f>I[i].f?i++:n++],Q=I[i!=E&&I[n].f>I[i].f?i++:n++],I[E++]={s:-1,f:C.f+Q.f,l:C,r:Q};var s=o[0].s;for(e=1;t>e;++e)o[e].s>s&&(s=o[e].s);var r=new Hp(s+1),a=XRA(I[E-1],r,0);if(a>A){e=0;var c=0,h=a-A,l=1<<h;for(o.sort(function(w,u){return r[u.s]-r[w.s]||w.f-u.f});t>e;++e){var D=o[e].s;if(A>=r[D])break;c+=l-(1<<a-r[D]),r[D]=A}for(c>>>=h;c>0;){var d=o[e].s;A>r[d]?c-=1<<A-r[d]++-1:++e}for(;e>=0&&c;--e){var y=o[e].s;r[y]==A&&(--r[y],++c)}a=A}return[new i2(r),a]},XRA=function(g,A,I){return g.s==-1?Math.max(XRA(g.l,A,I+1),XRA(g.r,A,I+1)):A[g.s]=I},xyg=function(g){for(var A=g.length;A&&!g[--A];);for(var I=new Hp(++A),e=0,t=g[0],o=1,B=function(Q){I[e++]=Q},C=1;A>=C;++C)if(g[C]==t&&C!=A)++o;else{if(!t&&o>2){for(;o>138;o-=138)B(32754);o>2&&(B(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(B(t),--o;o>6;o-=6)B(8304);o>2&&(B(o-3<<5|8208),o=0)}for(;o--;)B(t);o=1,t=g[C]}return[I.subarray(0,e),A]},xV=function(g,A){for(var I=0,e=0;A.length>e;++e)I+=g[e]*A[e];return I},$RA=function(g,A,I){var e=I.length,t=Ryg(A+2);g[t]=255&e,g[t+1]=e>>>8,g[t+2]=255^g[t],g[t+3]=255^g[t+1];for(var o=0;e>o;++o)g[t+o+4]=I[o];return 8*(t+4+e)},Fyg=function(g,A,I,e,t,o,B,C,Q,i,E){WF(A,E++,I),++t[256];for(var n=zRA(t,15),s=n[0],r=n[1],a=zRA(o,15),c=a[0],h=a[1],l=xyg(s),D=l[0],d=l[1],y=xyg(c),w=y[0],u=y[1],G=new Hp(19),m=0;D.length>m;++m)G[31&D[m]]++;for(m=0;w.length>m;++m)G[31&w[m]]++;for(var p=zRA(G,7),k=p[0],S=p[1],R=19;R>4&&!k[pyg[R-1]];--R);var x,N,U,K,Y=i+5<<3,b=xV(t,MY)+xV(o,VCA)+B,q=xV(t,s)+xV(o,c)+B+14+3*R+xV(G,k)+(2*G[16]+3*G[17]+7*G[18]);if(b>=Y&&q>=Y)return $RA(A,E,g.subarray(Q,Q+i));if(WF(A,E,1+(b>q)),E+=2,b>q){x=RV(s,r),N=s,U=RV(c,h),K=c;var j=RV(k,S);for(WF(A,E,d-257),WF(A,E+5,u-1),WF(A,E+10,R-4),E+=14,m=0;R>m;++m)WF(A,E+3*m,k[pyg[m]]);E+=3*R;for(var Z=[D,w],O=0;2>O;++O){var AA=Z[O];for(m=0;AA.length>m;++m)WF(A,E,j[tA=31&AA[m]]),E+=k[tA],tA>15&&(WF(A,E,AA[m]>>>5&127),E+=AA[m]>>>12)}}else x=wzI,N=MY,U=uzI,K=VCA;for(m=0;C>m;++m)if(e[m]>255){var tA;NV(A,E,x[257+(tA=e[m]>>>18&31)]),E+=N[tA+257],tA>7&&(WF(A,E,e[m]>>>23&31),E+=WRA[tA]);var eA=31&e[m];NV(A,E,U[eA]),E+=K[eA],eA>3&&(NV(A,E,e[m]>>>5&8191),E+=VRA[eA])}else NV(A,E,x[e[m]]),E+=N[e[m]];return NV(A,E,x[256]),E+N[256]},GzI=new X9([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),mzI=(function(){for(var g=new X9(256),A=0;256>A;++A){for(var I=A,e=9;--e;)I=(1&I&&3988292384)^I>>>1;g[A]=I}return g})(),ANA=function(g,A,I){for(;I;++A)g[A]=I,I>>>=8};function pzI(g,A){A===void 0&&(A={});var I=(function(){var n=4294967295;return{p(s){for(var r=n,a=0;s.length>a;++a)r=mzI[255&r^s[a]]^r>>>8;n=r},d(){return 4294967295^n}}})(),e=g.length;I.p(g);var t,o,B,C,Q,i=(C=10+((t=A).filename&&t.filename.length+1||0),Q=8,(function(n,s,r,a,c,h){var l=n.length,D=new i2(a+l+5*(1+Math.floor(l/7e3))+c),d=D.subarray(a,D.length-c),y=0;if(!s||8>l)for(var w=0;l>=w;w+=65535){var u=w+65535;l>u?y=$RA(d,y,n.subarray(w,u)):(d[w]=h,y=$RA(d,y,n.subarray(w,l)))}else{for(var G=GzI[s-1],m=G>>>13,p=8191&G,k=(1<<r)-1,S=new Hp(32768),R=new Hp(k+1),x=Math.ceil(r/3),N=2*x,U=function(DA){return(n[DA]^n[DA+1]<<x^n[DA+2]<<N)&k},K=new X9(25e3),Y=new Hp(288),b=new Hp(32),q=0,j=0,Z=(w=0,0),O=0,AA=0;l>w;++w){var tA=U(w),eA=32767&w,QA=R[tA];if(S[eA]=QA,R[tA]=eA,w>=O){var sA=l-w;if((q>7e3||Z>24576)&&sA>423){y=Fyg(n,d,0,K,Y,b,j,Z,AA,w-AA,y),Z=q=j=0,AA=w;for(var dA=0;286>dA;++dA)Y[dA]=0;for(dA=0;30>dA;++dA)b[dA]=0}var CA=2,hA=0,nA=p,aA=eA-QA&32767;if(sA>2&&tA==U(w-aA))for(var SA=Math.min(m,sA)-1,xA=Math.min(32767,w),rA=Math.min(258,sA);xA>=aA&&--nA&&eA!=QA;){if(n[w+CA]==n[w+CA-aA]){for(var NA=0;rA>NA&&n[w+NA]==n[w+NA-aA];++NA);if(NA>CA){if(CA=NA,hA=aA,NA>SA)break;var RA=Math.min(aA,NA-2),UA=0;for(dA=0;RA>dA;++dA){var vA=w-aA+dA+32768&32767,KA=vA-S[vA]+32768&32767;KA>UA&&(UA=KA,QA=vA)}}}aA+=(eA=QA)-(QA=S[eA])+32768&32767}if(hA){K[Z++]=268435456|jRA[CA]<<18|Syg[hA];var kA=31&jRA[CA],YA=31&Syg[hA];j+=WRA[kA]+VRA[YA],++Y[257+kA],++b[YA],O=w+CA,++q}else K[Z++]=n[w],++Y[n[w]]}}y=Fyg(n,d,h,K,Y,b,j,Z,AA,w-AA,y)}return Nyg(D,0,a+Ryg(y)+c)})(o=g,(B=A).level==null?6:B.level,B.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(o.length)))):12+B.mem,C,Q,!0)),E=i.length;return(function(n,s){var r=s.filename;if(n[0]=31,n[1]=139,n[2]=8,n[8]=2>s.level?4:s.level==9?2:0,n[9]=3,s.mtime!=0&&ANA(n,4,Math.floor(new Date(s.mtime||Date.now())/1e3)),r){n[3]=8;for(var a=0;r.length>=a;++a)n[a+10]=r.charCodeAt(a)}})(i,A),ANA(i,E-8,I.d()),ANA(i,E-4,e),i}const kzI=!!FfA||!!BV,Uyg=new WeakMap,Jyg="text/plain";let gNA=0,jCA=!1;const Pyg=(g,A)=>{const[I,e]=g.split("#"),[t,o]=I.split("?");if(!o)return g;const B=o.split("&").filter(C=>C.split("=")[0]!==A).join("&");return`${t}${B?`?${B}`:""}${e?`#${e}`:""}`},zCA=(g,A,I=!0)=>{var e;const[t,o]=g.split("?"),B=QI({},A),C=(e=o?.split("&").map(i=>{var E;const[n,s]=i.split("="),r=I&&(E=B[n])!==null&&E!==void 0?E:s;return delete B[n],`${n}=${r}`}))!==null&&e!==void 0?e:[],Q=(function(i,E="&"){let n,s;const r=[];return dn(i,function(a,c){Le(a)||Le(c)||c==="undefined"||(n=encodeURIComponent((h=>h instanceof File)(a)?a.name:a.toString()),s=encodeURIComponent(c),r[r.length]=s+"="+n)}),r.join(E)})(B);return Q&&C.push(Q),C.length>0?`${t}?${C.join("&")}`:t},INA=g=>{if(g.lr)return g.lr;const{data:A,compression:I}=g;if(!A)return;if(I===GM.GZipJS){const t=pzI((function(o){var B=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var C=new i2(o.length+(o.length>>>1)),Q=0,i=function(r){C[Q++]=r},E=0;B>E;++E){if(Q+5>C.length){var n=new i2(Q+8+(B-E<<1));n.set(C),C=n}var s=o.charCodeAt(E);128>s?i(s):2048>s?(i(192|s>>>6),i(128|63&s)):s>55295&&57344>s?(i(240|(s=65536+(1047552&s)|1023&o.charCodeAt(++E))>>>18),i(128|s>>>12&63),i(128|s>>>6&63),i(128|63&s)):(i(224|s>>>12),i(128|s>>>6&63),i(128|63&s))}return Nyg(C,0,Q)})(W9(A)),{mtime:0});return{contentType:Jyg,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(I===GM.Base64){const t=(function(B){return B&&btoa(encodeURIComponent(B).replace(/%([0-9A-F]{2})/g,(C,Q)=>String.fromCharCode(parseInt(Q,16))))})(W9(A)),o=(B=>"data="+encodeURIComponent(typeof B=="string"?B:W9(B)))(t);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}const e=W9(A);return{contentType:"application/json",body:e,estimatedSize:new Blob([e]).size}},Kyg=g=>{const A=()=>g.transport==="sendBeacon"?{url:zCA(g.url,{compression:GM.Base64}),encodedBody:INA(QI(QI({},g),{},{compression:GM.Base64,lr:void 0}))}:{url:Pyg(g.url,"compression"),encodedBody:INA(QI(QI({},g),{},{compression:void 0,lr:void 0}))};let I;try{I=INA(g)}catch(t){if(KDg(g.compression,V9(g.url,"compression")))return Dt.error("Failed to gzip request body, sending uncompressed payload",t),A();throw t}return I&&KDg(g.compression,V9(g.url,"compression"))&&!((e=I.body)instanceof ArrayBuffer?zfA(new Uint8Array(e)):ArrayBuffer.isView(e)&&zfA(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?(jCA=!0,A()):{url:g.url,encodedBody:I};var e},Lyg=g=>{try{return Kyg(g)}catch(I){var A;return Dt.error(I),void((A=g.callback)===null||A===void 0||A.call(g,{statusCode:0,error:I}))}},MzI=(function(){var g=oa(function*(A){const I=yield(function(t){return XfA.apply(this,arguments)})(W9(A.data),bp.DEBUG,{rethrow:!0});if(!I)return A;const e=yield I.arrayBuffer();return QI(QI({},A),{},{lr:{contentType:Jyg,body:e,estimatedSize:e.byteLength}})});return function(A){return g.apply(this,arguments)}})(),SzI=/Failed to fetch|NetworkError|Load failed/i,Yyg=g=>g?.name==="TypeError"&&SzI.test(g?.message||""),_yg=g=>{try{const A=(function(I,e=Date.now()){if(typeof I!="string"||!I)return;const t=I.trim(),o=/^\d+\s*,/.test(t)?t.slice(0,t.indexOf(",")).trim():t;if(/^\d+$/.test(o)){const Q=1e3*Math.min(Number(o),300);return Q>0?Q:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(o))return;const B=/^\w{3} \w{3} /.test(o)?o+" GMT":o,C=Date.parse(B)-e;return Number.isFinite(C)&&C>0?Math.min(C,SCA):void 0})(g());return Le(A)?void 0:Math.min(A,3e4)}catch{return}},byg=g=>{const A=Lyg(g);if(!A)return;const I=new FfA;Uyg.set(I,!0);const{url:e,encodedBody:t}=A;I.open(g.method||"GET",e,!0);const{contentType:o,body:B}=t??{};dn(g.headers,function(C,Q){I.setRequestHeader(Q,C)}),o&&I.setRequestHeader("Content-Type",o),g.timeout&&(I.timeout=g.timeout),I.onreadystatechange=()=>{if(I.readyState===4){var C;const Q={statusCode:I.status,text:I.responseText};if(I.status===200)try{Q.json=JSON.parse(I.responseText)}catch{}(C=g.callback)===null||C===void 0||C.call(g,Q,_yg(()=>I.getResponseHeader("Retry-After")))}},I.send(B)},Hyg=g=>{const A=Lyg(g);if(!A)return;const{url:I,encodedBody:e}=A,{contentType:t,body:o,estimatedSize:B}=e??{},C=new Headers;dn(g.headers,function(a,c){C.append(c,a)}),t&&C.append("Content-Type",t);let Q=null,i=!1;if(xlg){const a=new xlg;Q={signal:a.signal,timeout:setTimeout(()=>{i=!0;try{a.abort(dDg("AbortError","PostHog request timed out"+((c=g.timeout)?` after ${c}ms`:"")))}catch(h){n(h)}var c},g.timeout)}}let E=!1;const n=a=>{var c;E||(E=!0,i&&a?.name==="AbortError"||Yyg(a)?Dt.warn(a):Dt.error(a),(c=g.callback)===null||c===void 0||c.call(g,{statusCode:0,error:a}))};let s=0;const r=()=>{gNA-=s,s=0,Q&&clearTimeout(Q.timeout)};try{const a=QI({method:g?.method||"GET",headers:C,referrerPolicy:"strict-origin",body:o,signal:Q?.signal},g.fetchOptions),c=B??(Le(o)?0:void 0);a.keepalive=a.method==="POST"&&!g.kl&&a.keepalive!==!1&&a.body===o&&!Le(c)&&c>=0&&52428.8>gNA+c,a.keepalive&&(s=c,gNA+=s),BV(I,a).then(h=>h.text().then(l=>{var D;if(E)return;const d={statusCode:h.status,text:l};if(h.status===200)try{d.json=JSON.parse(l)}catch(y){Dt.error(y)}E=!0,r(),(D=g.callback)===null||D===void 0||D.call(g,d,_yg(()=>h.headers.get("Retry-After")))})).catch(h=>{r(),n(h)}).finally(r)}catch(a){r(),n(a)}},eNA=g=>{try{var A;const{url:I,encodedBody:e}=Kyg(g),{contentType:t,body:o,estimatedSize:B}=e??{};if(!o)return;const C=o instanceof Blob?o:new Blob([o],{type:t});if(Rw.sendBeacon(I,C))return;const Q=aB(g.data)?g.data:(A=g.data)===null||A===void 0?void 0:A.batch;if(aB(Q)&&Q.length>1&&(B??0)>16384){const i=Math.ceil(Q.length/2),E=n=>aB(g.data)?n:QI(QI({},g.data),{},{batch:n});return eNA(QI(QI({},g),{},{data:E(Q.slice(0,i))})),void eNA(QI(QI({},g),{},{data:E(Q.slice(i))}))}Dt.warn(`Beacon of ~${B??0} bytes was rejected by the browser, falling back to ${BV?"fetch":"XHR"}`),BV?Hyg(QI(QI({},g),{},{kl:!0})):byg(g)}catch(I){Dt.warn("Beacon send failed",I)}},vyg=(g,A,I,e)=>{const t=e==="query"?A==="POST"?"sent_at":"_":void 0;return zCA(I===GM.GZipJS?Pyg(g,"compression"):g,QI(QI({},t?{[t]:Date.now().toString()}:{}),I===GM.GZipJS?{}:{compression:I}))},fzI=(()=>{const g=[];return BV&&g.push({transport:"fetch",method:Hyg}),FfA&&g.push({transport:"XHR",method:byg}),Rw?.sendBeacon&&g.push({transport:"sendBeacon",method:eNA}),g})();let qyg=!kzI&&Am?.indexOf("MSIE")===-1&&Am?.indexOf("Mozilla")===-1;function Tyg(g,A,I){var e,t,o;I&&(A=QI(QI({},A),{},{callback:B=>I(B)})),g.__loaded?qyg?g.__request_queue.push(A):g.rateLimiter.isServerRateLimited(A.batchKey)?A.fireCallbackOnDrop&&((t=A.callback)===null||t===void 0||t.call(A,{statusCode:429})):(A.transport=A.transport||g.config.api_transport,A.headers=QI(QI({},g.config.request_headers),A.headers),A.compression=A.compression==="best-available"?(e=g.compression)!==null&&e!==void 0?e:A.compressionFallback:A.compression,(Le(g.config.disable_beacon)?g.config.__preview_disable_beacon:g.config.disable_beacon)&&(A.disableTransport=["sendBeacon"]),A.fetchOptions=A.fetchOptions||g.config.fetch_options,((B,C)=>{var Q,i,E;const n=QI(QI({},B),{},{callback:C??(h=>{var l;return(l=B.callback)===null||l===void 0?void 0:l.call(B,h)})});n.timeout=n.timeout||6e4;const s=(Q=n.transport)!==null&&Q!==void 0?Q:"fetch";s==="sendBeacon"&&Le(n.compression)&&n.data&&(n.compression=GM.Base64),n.method==="POST"&&n.data&&(n.timestampMode==="capture-body"?n.data=(h=>{var l,D;const d=(aB(h)?h:[h]).map(w=>QI(QI({},w),w.timestamp instanceof Date&&!isNaN(w.timestamp.getTime())?{timestamp:w.timestamp.toISOString()}:{})),y=d[0];return{api_key:(l=y==null||(D=y.properties)===null||D===void 0?void 0:D.token)!==null&&l!==void 0?l:y?.token,batch:d,sent_at:new Date().toISOString()}})(n.data):n.timestampMode==="body"&&(n.data=((h,l=new Date().toISOString())=>aB(h)?h.map(D=>QI(QI({},D),{},{sent_at:l})):QI(QI({},h),{},{sent_at:l}))(n.data))),n.url=vyg(n.url,n.method,n.compression,n.timestampMode);const r=fzI.filter(h=>!n.disableTransport||!h.transport||!n.disableTransport.includes(h.transport)),a=(i=(E=(function(h,l){for(let D=0;h.length>D;D++)if(l(h[D]))return h[D]})(r,h=>h.transport===s))===null||E===void 0?void 0:E.method)!==null&&i!==void 0?i:r[0].method;if(!a)throw new Error("No available transport method");const c=h=>{try{a(h)}catch(D){var l;Yyg(D)?Dt.warn(D):Dt.error(D),(l=n.callback)===null||l===void 0||l.call(n,{statusCode:0,error:D})}};s!=="sendBeacon"&&!n.preferSyncCompression&&n.data&&n.compression===GM.GZipJS&&bWI&&typeof Promise<"u"&&!jCA?MzI(n).then(h=>{c(h)}).catch(h=>{if(LDg(h))return jCA=!0,void c(QI(QI({},n),{},{compression:void 0,url:vyg(B.url,B.method,void 0,B.timestampMode)}));(l=>{if(!l||typeof l!="object")return!1;const D="name"in l?String(l.name):"";return LDg(l)||D===PDg})(h)&&(jCA=!0),c(n)}):c(n)})(A,(B,C)=>{var Q,i,E;g.rateLimiter.checkForLimiting(B),400>B.statusCode||(Q=(i=g.config).on_request_error)===null||Q===void 0||Q.call(i,B),I?I(B,C):(E=A.callback)===null||E===void 0||E.call(A,B)})):A.fireCallbackOnDrop&&((o=A.callback)===null||o===void 0||o.call(A,{statusCode:0}))}var RzI=class{constructor(A,I){this.Zu=!0,this.Ju=[],this.Ku=FN(I?.flush_interval_ms||3e3,250,5e3,Dt.createLogger("flush interval"),3e3),this.Xu=A}enqueue(A){this.Ju.push(A),this.Yu||this.tc()}unload(){this.ec();const A=this.Ju.length>0?this.nc():{},I=Object.values(A);[...I.filter(e=>e.url.indexOf("/e")===0),...I.filter(e=>e.url.indexOf("/e")!==0)].map(e=>{this.sc(QI(QI({},e),{},{callback:void 0}),"sendBeacon")})}enable(){this.Zu=!1,this.tc()}tc(){this.Zu||(this.Yu=setTimeout(()=>{this.ec(),this.rc()},this.Ku))}rc(){if(this.Ju.length>0){const A=this.nc();for(const I in A)this.sc(A[I])}}sc(A,I){try{this.Xu(A,I)}catch(e){Dt.error(e)}}ec(){clearTimeout(this.Yu),this.Yu=void 0}nc(){const A={},I={};dn(this.Ju,e=>{var t;const o=e,B=((o?o.batchKey:null)||o.url)+(o.batchGroup?`:${o.batchGroup}`:"");Le(A[B])&&(A[B]=QI(QI({},o),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),I[B]=[]),(t=A[B].data)===null||t===void 0||t.push(o.data),o.callback&&I[B].push(o.callback)});for(const e in I){const t=I[e];t.length&&(A[e].callback=o=>{for(const B of t)B(o)})}return this.Ju=[],A}};const NzI=["retriesPerformedSoFar"];var xzI=class{constructor(A){this._instance=A,this.oc=!1,this.ac=3e3,this.Ju=[],this.Ju=[],this.lc=!0,this.resume()}resume(){if(!Le(Me)&&"onLine"in Me.navigator){if(this.lc=Me.navigator.onLine,this.uc)return;this.uc=()=>{this.lc=!0,this.rc()},this.cc=()=>{this.lc=!1},GE(Me,"online",this.uc),GE(Me,"offline",this.cc)}}get length(){return this.Ju.length}retriableRequest(A,I){let{retriesPerformedSoFar:e}=A,t=_Dg(A,NzI);HF(e)&&(t.url=zCA(t.url,{retry_count:e})),Tyg(this._instance,I?QI(QI({},t),{},{transport:I}):t,(o,B)=>{var C;if(o.statusCode!==200&&(400>o.statusCode||o.statusCode>=500)){if((o.statusCode===0?3:10)>(e??0))return void this.Ls(QI({retriesPerformedSoFar:e},t),B);o.statusCode===0&&Dt.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${e??0} retries.`)}(C=t.callback)===null||C===void 0||C.call(t,o)})}Ls(A,I){const e=A.retriesPerformedSoFar||0;A.retriesPerformedSoFar=e+1;const t=Math.max((function(C){const Q=3e3*Math.pow(2,C),i=Q/2,E=Math.min(18e5,Q),n=(Math.random()-.5)*(E-i);return Math.ceil(E+n)})(e),I??0),o=Date.now()+t;this.Ju.push({retryAt:o,requestOptions:A});let B=`Enqueued failed request for retry in ${t}`;navigator.onLine||(B+=" (Browser is offline)"),Dt.warn(B),this.oc||(this.oc=!0,this.hc())}hc(){if(this.dc&&clearTimeout(this.dc),this.Ju.length===0)return this.oc=!1,void(this.dc=void 0);this.dc=setTimeout(()=>{this.lc&&this.Ju.length>0&&this.rc(),this.hc()},this.ac)}rc(){const A=Date.now(),I=[],e=this.Ju.filter(t=>A>t.retryAt||(I.push(t),!1));if(this.Ju=I,e.length>0)for(const{requestOptions:t}of e)this.retriableRequest(t)}unload(){this.dc&&(clearTimeout(this.dc),this.dc=void 0),this.oc=!1,Le(Me)||(this.uc&&(Me.removeEventListener("online",this.uc),this.uc=void 0),this.cc&&(Me.removeEventListener("offline",this.cc),this.cc=void 0));for(const{requestOptions:A}of this.Ju)try{this._instance._send_request(QI(QI({},A),{},{callback:aB(A.data)?void 0:A.callback,transport:"sendBeacon"}))}catch(I){Dt.error(I)}this.Ju=[]}},FzI=class{constructor(A){this._instance=A,this.vc=()=>{var I,e,t,o;this.fc||(this.fc={});const B=this.scrollElement(),C=this.scrollY(),Q=B?Math.max(0,B.scrollHeight-B.clientHeight):0,i=C+(B?.clientHeight||0),E=B?.scrollHeight||0;this.fc.lastScrollY=Math.ceil(C),this.fc.maxScrollY=Math.max(C,(I=this.fc.maxScrollY)!==null&&I!==void 0?I:0),this.fc.maxScrollHeight=Math.max(Q,(e=this.fc.maxScrollHeight)!==null&&e!==void 0?e:0),this.fc.lastContentY=i,this.fc.maxContentY=Math.max(i,(t=this.fc.maxContentY)!==null&&t!==void 0?t:0),this.fc.maxContentHeight=Math.max(E,(o=this.fc.maxContentHeight)!==null&&o!==void 0?o:0)}}get gc(){return this._instance.config.scroll_root_selector}getContext(){return this.fc}resetContext(){const A=this.fc;return this.fc=void 0,setTimeout(this.vc,0),A}startMeasuringScrollPosition(){GE(Me,"scroll",this.vc,{capture:!0}),GE(Me,"scrollend",this.vc,{capture:!0}),GE(Me,"resize",this.vc)}scrollElement(){if(this.gc){const e=aB(this.gc)?this.gc:[this.gc];for(const t of e){var A;const o=Me==null||(A=Me.document)===null||A===void 0?void 0:A.querySelector(t);if(o)return o}return}var I;return Me==null||(I=Me.document)===null||I===void 0?void 0:I.documentElement}mc(A){var I,e;const t=A==="y"?"scrollTop":"scrollLeft";if(this.gc){const o=this.scrollElement();return o&&o[t]||0}return Me?A==="y"?Me.scrollY||Me.pageYOffset||((I=Me.document)===null||I===void 0||(I=I.documentElement)===null||I===void 0?void 0:I.scrollTop)||0:Me.scrollX||Me.pageXOffset||((e=Me.document)===null||e===void 0||(e=e.documentElement)===null||e===void 0?void 0:e.scrollLeft)||0:0}scrollY(){return this.mc("y")}scrollX(){return this.mc("x")}};const UzI=g=>lyg(g?.config.mask_personal_data_properties,g?.config.custom_personal_data_properties,g?.config.disable_capture_url_hashes);var Zyg=class{constructor(A,I,e,t){this.qe=o=>{const B=this.yc();if(B&&B.sessionId===o)return;const C={sessionId:o,props:this.bc(this._instance)};this._c.register({[yRA]:C})},this._instance=A,this.wc=I,this._c=e,this.bc=t||UzI,this.wc.onSessionId(this.qe)}yc(){return this._c.props[yRA]}getSetOnceProps(){var A;const I=(A=this.yc())===null||A===void 0?void 0:A.props;return I?"r"in I?Dyg(I,this._instance.config.disable_capture_url_hashes):{$referring_domain:I.referringDomain,$pathname:I.initialPathName,utm_source:I.utm_source,utm_campaign:I.utm_campaign,utm_medium:I.utm_medium,utm_content:I.utm_content,utm_term:I.utm_term}:{}}getSessionProps(){const A={};return dn(kRA(this.getSetOnceProps()),(I,e)=>{e==="$current_url"&&(e="url"),A[`$session_entry_${JfA(e)}`]=I}),A}},XCA=class{on(A,I){return this.bo[A]||(this.bo[A]=[]),this.bo[A].push(I),()=>{this.bo[A]=this.bo[A].filter(e=>e!==I)}}emit(A,I){for(const e of this.bo[A]||[])e(I);for(const e of this.bo["*"]||[])e(A,I)}constructor(){this.bo={}}};const AH=qr("[SessionId]"),Oyg=864e5;var Wyg=class{on(A,I){return this.kc.on(A,I)}constructor(A,I,e){var t;if(this.Sc=null,this.xc=null,this.$c=[],this.Cc=void 0,this.Tc=!1,this.kc=new XCA,this.Ic=(B,C)=>!(!HF(B)||!HF(C))&&Math.abs(B-C)>this.sessionTimeoutMs,!A.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(A.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ar=A.config,this._c=A.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Mc=void 0,this._sessionActivityTimestamp=null,this.Ec=I||Uf,this.Pc=e||Uf;const o=this.Ar.persistence_name||this.Ar.token;if(this._sessionTimeoutMs=1e3*FN(this.Ar.session_idle_timeout_seconds||1800,60,36e3,AH.createLogger("session_idle_timeout_seconds"),1800),A.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Rc(),this.Ac="ph_"+o+"_window_id",this.Fc="ph_"+o+"_primary_window_exists",this.Oc()){const B=Ba.Lt(this.Ac),C=Ba.Lt(this.Fc);B&&!C?this.je=B:Ba.Pt(this.Ac),Ba.At(this.Fc,!0)}!((t=this.Ar.bootstrap)===null||t===void 0)&&t.sessionID&&this.setBootstrapSessionId(this.Ar.bootstrap.sessionID),this.Dc()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(A){return Le(this.$c)&&(this.$c=[]),this.$c.push(A),this.Xt&&A(this.Xt,this.je),()=>{this.$c=this.$c.filter(I=>I!==A)}}Oc(){return this.Ar.persistence!=="memory"&&!this._c.hi&&Ba.$t()}Lc(A){A!==this.je&&(this.je=A,this.Oc()&&Ba.At(this.Ac,A))}Nc(){return this.je?this.je:this.Oc()?Ba.Lt(this.Ac):null}qc(A){const I=this.Sc;return!fc(I)&&!fc(A)&&5e3>Math.abs(A-I)}jc(A,I,e){const t=I!==this._sessionActivityTimestamp,o=!(A!==this.Xt||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=I,this.Xt=A,o&&!t||o&&this.qc(I)||(this.Sc=I,this._c.register({[_9]:[I,A,e]}))}Bc(){var A;const I=(A=this.Ar)===null||A===void 0?void 0:A.persistence_save_debounce_ms;return HF(I)&&I>0}zc(){this.Bc()?this._c.refreshKey(_9):(this._c.flush(),this._c.load())}Hc(){var A;if(fc(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Sc)return;this.zc();const[,I,e]=this.Uc();I===this.Xt&&e===this._sessionStartTimestamp&&(this.Sc=this._sessionActivityTimestamp,this._c.register({[_9]:[this._sessionActivityTimestamp,(A=this.Xt)!==null&&A!==void 0?A:null,this._sessionStartTimestamp]}),this._c.flush())}Wc(){const[A]=this.Uc(),I=HF(A)?A:0,e=HF(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(I,e)}Vc(A){return this.zc(),this.Ic(A,this.Wc())}Uc(){const A=this._c.props[_9];return aB(A)&&A.length===2&&A.push(A[0]),A||[0,null,0]}resetSessionId(){this.Sc=null,this.Mc=void 0,clearTimeout(this.Gc),this.Gc=void 0,this.jc(null,null,null)}setBootstrapSessionId(A,I=!1){const e=((t,o=new Date().getTime())=>{try{const B=(C=>{const Q=C.replace(/-/g,"");if(Q.length!==32)throw new Error("Not a valid UUID");if(Q[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(Q.substring(0,12),16)})(t);return B>o+6e4?void AH.error("Bootstrap sessionID cannot be in the future"):B}catch(B){return void AH.error("Invalid sessionID in bootstrap",B)}})(A);return!Le(e)&&(I?this.Mc={sessionId:A,sessionStartTimestamp:e}:this.jc(A,new Date().getTime(),e),!0)}destroy(){this.Tc=!0,this.Hc(),clearTimeout(this.Gc),this.Gc=void 0,this.Cc&&Me&&(Me.removeEventListener(bCA,this.Cc,{capture:!1}),this.Cc=void 0),this.$c=[]}Dc(){this.Cc=()=>{this.Hc(),this.Oc()&&Ba.Pt(this.Fc)},GE(Me,bCA,this.Cc,{capture:!1})}checkAndGetSessionAndWindowId(A=!1,I=null,e=!1){if(this.Ar.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const t=I||new Date().getTime(),o=this.Xt;if(e)this.xc=t;else if(fc(this.xc)||this.xc>t||t-this.xc>=1e3){var B,C;(B=(C=this._c).syncCookieProperties)===null||B===void 0||B.call(C),this.xc=t}let[,Q,i]=this.Uc();const E=!Le(o)&&Q!==o,n=this.Wc();let s=this.Nc();const r=this.Mc,a=!!r&&(r.sessionStartTimestamp>t+6e4||t-r.sessionStartTimestamp>Oyg),c=r?a:HF(i)&&Math.abs(t-i)>Oyg;let h=!1,l=E,D=!Q||!!r;const d=Q;let y=!D&&!A&&this.Ic(t,n);if(y&&(y=this.Vc(t),y||AH.info("cross-tab refresh kept the session alive",{sessionId:Q}),[,Q,i]=this.Uc(),y||(D=!Q||!!r)),D||y||c){l=!1;const m=r&&!a;Q=m?r.sessionId:this.Ec(),s=this.Pc(),AH.info("new session ID assigned",{sessionId:Q,windowId:s,bootstrapped:!!m,changeReason:{noSessionId:D,activityTimeout:y,sessionPastMaximumLength:c}}),i=m?r.sessionStartTimestamp:t,this.Mc=void 0,h=!0}else s||(s=this.Pc(),h=!0),l=l||Q!==d,l&&(AH.info("adopted cross-tab session id",{sessionId:Q,windowId:s}),h=!0);const w=HF(n)&&A&&!c?n:t,u=HF(i)?i:new Date().getTime();this.Lc(s),this.jc(Q,w,u),A||this.Rc();const G={noSessionId:D,activityTimeout:y,sessionPastMaximumLength:c,crossTabAdoption:l};return h&&this.$c.forEach(m=>m(Q,s,G)),{sessionId:Q,windowId:s,sessionStartTimestamp:u,changeReason:h?G:void 0,lastActivityTimestamp:n}}Rc(){this.Tc||(clearTimeout(this.Gc),this.Gc=setTimeout(()=>{if(!this.Tc)if(this.Vc(new Date().getTime())){const A=this.Xt;this.resetSessionId(),this.kc.emit("forcedIdleReset",{idleSessionId:A})}else this.Rc()},1.1*this.sessionTimeoutMs))}};const Vyg=function(g,A){if(!g)return!1;const I=g.userAgent;if(I&&Llg(I,A))return!0;try{const e=g?.userAgentData;if(e?.brands&&e.brands.some(t=>Llg(t?.brand,A)))return!0}catch{}return!!g.webdriver};function jyg(){return(jyg=oa(function*(){const g=Rw?.userAgentData;if(g?.getHighEntropyValues)try{const A=yield g.getHighEntropyValues(["model"]),I=A?.model;return UC(I)&&I.length>0?I:void 0}catch(A){return void Dt.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",A)}})).apply(this,arguments)}function JzI(g,A){let I=`$survey_${A}/${g.id}`;return g.current_iteration&&g.current_iteration>0&&(I=`$survey_${A}/${g.id}/${g.current_iteration}`),I}function zyg(g){var A;return!!(!((A=g.conditions)===null||A===void 0||(A=A.events)===null||A===void 0||(A=A.values)===null||A===void 0)&&A.length)}const $CA=(g,A)=>{if(!(I=>{try{new RegExp(I)}catch{return!1}return!0})(A))return!1;try{return new RegExp(A).test(g)}catch{return!1}},AQA=g=>g.toLowerCase(),Xyg={exact:(g,A)=>A.some(I=>g.some(e=>I===e)),is_not:(g,A)=>A.every(I=>g.every(e=>I!==e)),regex:(g,A)=>A.some(I=>g.some(e=>$CA(I,e))),not_regex:(g,A)=>A.every(I=>g.every(e=>!$CA(I,e))),icontains:(g,A)=>A.map(AQA).some(I=>g.map(AQA).some(e=>I.includes(e))),not_icontains:(g,A)=>A.map(AQA).every(I=>g.map(AQA).every(e=>!I.includes(e))),gt:(g,A)=>A.some(I=>{const e=parseFloat(I);return!isNaN(e)&&g.some(t=>e>parseFloat(t))}),lt:(g,A)=>A.some(I=>{const e=parseFloat(I);return!isNaN(e)&&g.some(t=>e<parseFloat(t))})};function $yg(g,A){return!g||Object.entries(g).every(([I,e])=>{const t=A?.[I];if(t==null)return!1;const o=Xyg[e.operator];return!!o&&o(e.values.map(String),[String(t)])})}function tNA(g,A,I){return W9({distinct_id:g,userPropertiesToSet:A,userPropertiesToSetOnce:I})}const oNA="custom",Awg="i.posthog.com",PzI=/^\/static\//,KzI=["/s/","/e/","/i/"];var LzI=class{constructor(A){this.Qc={},this.instance=A}get apiHost(){const A=this.instance.config.api_host.trim().replace(/\/$/,"");return A==="https://app.posthog.com"?"https://us.i.posthog.com":A}get flagsApiHost(){const A=this.instance.config.flags_api_host;return A?A.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var A;let I=(A=this.instance.config.ui_host)===null||A===void 0?void 0:A.replace(/\/$/,"");return I||(I=this.apiHost.replace(`.${Awg}`,".posthog.com")),I==="https://app.posthog.com"?"https://us.posthog.com":I}get region(){return this.Qc[this.apiHost]||(this.Qc[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":oNA),this.Qc[this.apiHost]}Zc(A){if(!PzI.test(A))return;const I=this.instance.config.asset_host;return typeof I=="string"&&I.trim().replace(/\/$/,"")||void 0}Jc(A){const I=ZF(A);return I?I.protocol+"//"+I.host+I.pathname:void 0}Kc(A,I,e){if(A==="ui")return e;let t=e;const o=this.instance.config.rewriteRequestPath;if(o){var B;const C=((B=ZF(e))===null||B===void 0?void 0:B.href)||e;t=o(new URL(C)).toString()}if(o&&A==="api"&&KzI.some(C=>I.indexOf(C)===0)){const C=this.Jc(t);if(C){const Q=this.apiHost;let i=this.Xc;i?.apiHost===Q&&i.rewriteRequestPath===o||(i={apiHost:Q,rewriteRequestPath:o,urls:new Set},this.Xc=i),i.urls.add(C)}}return t}isIngestionEndpoint(A){const I=this.Xc,e=this.Jc(A);return I?.apiHost===this.apiHost&&I.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!e&&I.urls.has(e)}endpointFor(A,I=""){if(I&&(I=I[0]==="/"?I:`/${I}`),A==="ui")return this.Kc(A,I,this.uiHost+I);if(A==="flags")return this.Kc(A,I,this.flagsApiHost+I);if(A==="assets"){const t=this.Zc(I);if(t)return this.Kc(A,I,`${t}${I}`)}if(this.region===oNA)return this.Kc(A,I,this.apiHost+I);const e=Awg+I;switch(A){case"assets":return this.Kc(A,I,`https://${this.region}-assets.${e}`);case"api":return this.Kc(A,I,`https://${this.region}.${e}`)}}};const yn=qr("[Surveys]"),gwg=g=>{try{const A=(I=>((e,t)=>`seenSurvey_${(function(o){return o.current_iteration&&o.current_iteration>0?`${o.id}_${o.current_iteration}`:o.id})(t)}`)(0,I))(g);if(localStorage.getItem(A))return;localStorage.setItem(A,"true")}catch(A){yn.error("Failed to persist survey seen state",A)}},YzI=[TRA.Popover,TRA.Widget,TRA.API],_zI={ignoreConditions:!1,ignoreDelay:!1,displayType:ORA.Popover},bzI=qr("[PostHog ExternalIntegrations]"),HzI={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var vzI=class{constructor(A){this._instance=A}Ml(A,I){var e,t;(e=FB.__PosthogExtensions__)===null||e===void 0||(t=e.loadExternalDependency)===null||t===void 0||t.call(e,this._instance,A,o=>{if(o)return bzI.error("failed to load script",o);I()})}startIfEnabledOrStop(){var A;for(const[o,B]of Object.entries((A=this._instance.config.integrations)!==null&&A!==void 0?A:{})){var I,e,t;B&&!(!((I=FB.__PosthogExtensions__)===null||I===void 0||(I=I.integrations)===null||I===void 0)&&I[o])&&this.Ml(HzI[o],()=>{var C;(C=FB.__PosthogExtensions__)===null||C===void 0||(C=C.integrations)===null||C===void 0||(C=C[o])===null||C===void 0||C.start(this._instance)}),!B&&(!((e=FB.__PosthogExtensions__)===null||e===void 0||(e=e.integrations)===null||e===void 0)&&e[o])&&((t=FB.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0||(t=t[o])===null||t===void 0||t.stop())}}},Iwg=class{constructor(A){this.disabled=A===!1;const I=yC(A)?A:{};this.thresholdPx=I.threshold_px||30,this.timeoutMs=I.timeout_ms||1e3,this.clickCount=I.click_count||3,this.clicks=[]}isRageClick(A,I,e){if(this.disabled)return!1;const t=this.clicks[this.clicks.length-1];if(t&&Math.abs(A-t.x)+Math.abs(I-t.y)<this.thresholdPx&&this.timeoutMs>e-t.timestamp){if(this.clicks.push({x:A,y:I,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:A,y:I,timestamp:e}];return!1}};const BNA=()=>typeof window>"u"?void 0:window,FV=()=>typeof document>"u"?void 0:document,CNA="$copy_autocapture",QNA=qr("[AutoCapture]");function iNA(g,A){return A.length>g?A.slice(0,g)+"...":A}function qzI(g){if(g.previousElementSibling)return g.previousElementSibling;let A=g;do A=A.previousSibling;while(A&&!Jf(A));return A}function TzI(g,{e:A,maskAllElementAttributes:I,maskAllText:e,elementAttributeIgnoreList:t,elementsChainAsString:o,disableCaptureUrlHashes:B}){var C,Q;if(!Jf(g))return{props:{}};const i=[g],E=new Set([g]);let n=g;for(;n.parentNode&&!Nw(n,"body")&&1e3>i.length;){if(URA(n.parentNode)){const u=n.parentNode.host;if(E.has(u))break;E.add(u),i.push(u),n=u;continue}if(!Jf(n.parentNode)||E.has(n.parentNode))break;E.add(n.parentNode),i.push(n.parentNode),n=n.parentNode}const s=A.type==="click"&&g.namespaceURI==="http://www.w3.org/2000/svg"?i.findIndex(u=>Nw(u,"button")||Nw(u,"a")):-1;s>0&&(e=e||i.slice(0,s+1).some(u=>!kY(u)||Z9(u)));const r=[],a={};let c,h=!1,l=!1;if(dn(i,u=>{const G=kY(u);if(Nw(u,"a")&&!I&&!t?.includes("href")){const m=u.getAttribute("href");h=!!(G&&m&&O9(m))&&(B?v4(m):m)}yB(T9(u),"ph-no-capture")&&(l=!0),r.push((function(m,p,k,S,R=!1){const x=m.tagName.toLowerCase(),N={tag_name:x};PRA.indexOf(x)>-1&&!k&&(N.$el_text=x.toLowerCase()==="a"||x.toLowerCase()==="button"?iNA(1024,Ayg(m)):iNA(1024,GV(m)));const U=T9(m);p||S?.includes("class")||0>=U.length||(N.classes=U.filter(function(q){return q!==""})),dn(m.attributes,function(q){var j;if((!Z9(m)||["name","id","class","aria-label"].indexOf(q.name)!==-1)&&!S?.includes(q.name)&&!p&&O9(q.value)&&(!UC(j=q.name)||j.substring(0,10)!=="_ngcontent"&&j.substring(0,7)!=="_nghost")){let Z=q.value;q.name==="class"&&(Z=JRA(Z).join(" ")),N["attr__"+q.name]=iNA(1024,q.name==="href"&&R?v4(Z):Z)}});let K=1,Y=1,b=m;for(;b=qzI(b);)K++,b.tagName===m.tagName&&Y++;return N.nth_child=K,N.nth_of_type=Y,N})(u,I,e,t,B)),dn((function(m){if(!kY(m))return{};const p={};return dn(m.attributes,function(k){if(k.name&&k.name.indexOf("data-ph-capture-attribute")===0){const S=k.name.replace("data-ph-capture-attribute-",""),R=k.value;S&&R&&O9(R)&&(p[S]=R)}}),p})(u),(m,p)=>{({}).hasOwnProperty.call(a,p)||(a[p]=m)})}),l)return{props:{},explicitNoCapture:l};if(s>0&&(g=i[s],r.splice(0,s)),e||(r[0].$el_text=Nw(g,"a")||Nw(g,"button")?Ayg(g):GV(g)),h){var D,d;r[0].attr__href=h;const u=(D=ZF(h))===null||D===void 0?void 0:D.host,G=(d=BNA())===null||d===void 0||(d=d.location)===null||d===void 0?void 0:d.host;u&&G&&u!==G&&(c=h)}return{props:Qr((w=A.type,{$event_type:w,$ce_version:1}),o?{}:{$elements:r},{$elements_chain:(y=r,aB(y)?(function(u){return u.map(G=>{var m,p;let k="";if(G.tag_name&&(k+=G.tag_name),G.attr_class){G.attr_class.sort();for(const x of G.attr_class)k+=`.${x.replace(/"/g,"")}`}const S=QI(QI(QI(QI({},G.text?{text:G.text}:{}),{},{"nth-child":(m=G.nth_child)!==null&&m!==void 0?m:0,"nth-of-type":(p=G.nth_of_type)!==null&&p!==void 0?p:0},G.href?{href:G.href}:{}),G.attr_id?{attr_id:G.attr_id}:{}),G.attributes),R={};return HCA(S).sort(([x],[N])=>(function(U,K){return K>U?-1:U>K?1:0})(x,N)).forEach(([x,N])=>R[Iyg(x.toString())]=Iyg(N.toString())),k+=":",k+=HCA(R).map(([x,N])=>`${x}="${N}"`).join(""),k}).join(";")})((function(u){return u.map(G=>{var m,p;const k={text:(m=G.$el_text)===null||m===void 0?void 0:m.slice(0,400),tag_name:G.tag_name,href:(p=G.attr__href)===null||p===void 0?void 0:p.slice(0,2048),attr_class:CzI(G),attr_id:G.attr__id,nth_child:G.nth_child,nth_of_type:G.nth_of_type,attributes:{}};return HCA(G).filter(([S])=>S.indexOf("attr__")===0).forEach(([S,R])=>k.attributes[S]=R),k})})(y)):"")},!((C=r[0])===null||C===void 0)&&C.$el_text?{$el_text:(Q=r[0])===null||Q===void 0?void 0:Q.$el_text}:{},c&&A.type==="click"?{$external_click_url:c}:{},a),target:g};var y,w}const ewg="autocapture";var ZzI=class{el(){this.il=void 0,clearTimeout(this.nl),this.nl=void 0}sl(A){var I;if(!kY(A))return!0;const e=(I=this.rl().css_selector_ignorelist)!==null&&I!==void 0?I:YRA,t=new Set;let o=A;for(;o;){if(t.size>=1e3||t.has(o))return!0;t.add(o);const B=o,C=T9(B);if(yB(C,"ph-no-capture")||yB(C,"ph-sensitive")||Z9(B)||e.some(i=>KRA(B,i)))return!0;const Q=o.parentNode;o=URA(Q)?Q.host:Q&&Jf(Q)?Q:null}return!1}ol(A){if(!this.isEnabled||A.type==="pointercancel")return void this.el();if(A.type==="pointerdown"){var I;this.el();const t=mV(A);return void(A.isPrimary&&A.button===0&&!A.ctrlKey&&t&&Jf(t)&&(this.il={target:t,excluded:this.sl(t),id:A.pointerId,x:A.clientX,y:A.clientY,released:!1,distinctId:(I=this.xa)===null||I===void 0?void 0:I.distinctId}))}const e=this.il;e&&(A.pointerId!==e.id||Math.abs(A.clientX-e.x)>5||Math.abs(A.clientY-e.y)>5?this.el():A.type==="pointerup"&&(e.released=!0,this.nl=setTimeout(()=>this.el(),0)))}al(A){var I;const e=this.il;this.el();const t=mV(A);if(e?.released&&e.target.isConnected&&e.distinctId===((I=this.xa)===null||I===void 0?void 0:I.distinctId)&&A.pointerId===e.id&&(A.detail>0||A.pointerType==="touch"||A.pointerType==="pen")&&A.button===0&&5>=Math.abs(A.clientX-e.x)&&5>=Math.abs(A.clientY-e.y)&&t&&(Nw(t,"html")||Nw(t,"body"))){var o,B,C;if(e.excluded)return null;const Q=(o=this.rl().css_selector_ignorelist)!==null&&o!==void 0?o:YRA;return[t,(B=FV())===null||B===void 0?void 0:B.documentElement,(C=FV())===null||C===void 0?void 0:C.body].some(i=>{if(!i)return!1;const E=T9(i);return yB(E,"ph-no-capture")||yB(E,"ph-sensitive")||!kY(i)||Z9(i)||Q.some(n=>KRA(i,n))})?null:e.target}}constructor(A){this.Ta=A,this.name=ewg,this.ll=!1,this.ul=null,this.cl=!1,this.hl=new Map,this.dl=!1,this.Ar={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Ci=!1,this.Ta.refresh(this.Ar),this.rageclicks=new Iwg(this.Ar.rageclick),this.vl=null}setup(A){this.fl(),this.xa=A;const I=A.onRemoteConfig(this.onRemoteConfig.bind(this));this.Ci?I.dispose():(this.qa=I,this.startIfEnabled())}dispose(){var A;this.Ci||(this.Ci=!0,this.xa=void 0,(A=this.qa)===null||A===void 0||A.dispose(),this.qa=void 0,this.hl.clear(),this.vl=null,this.pl())}rl(){return this.Ta.refresh(this.Ar),this.Ar}fl(){var A,I;return this.rl(),this.Ar.url_allowlist=(A=this.Ar.url_allowlist)===null||A===void 0?void 0:A.map(e=>new RegExp(e)),this.Ar.url_ignorelist=(I=this.Ar.url_ignorelist)===null||I===void 0?void 0:I.map(e=>new RegExp(e)),this.Ar}gl(){const A=BNA(),I=FV();if(!this.isBrowserSupported())return void QNA.info("Disabling Automatic Event Collection because this browser is not supported");if(!A||!I)return;this.ml=A,this.yl=I;const e=this.bl=t=>{t=t||A?.event;try{if(t.type==="blur")return void this.el();if(t.type.indexOf("pointer")===0)return void this.ol(t);const o=t.type==="click"?this.al(t):void 0;if(fc(o))return;this._l(t,"$autocapture",o)}catch(o){QNA.error("Failed to capture event",o)}};if(GE(A,"blur",e),GE(I,"submit",e,{capture:!0}),GE(I,"change",e,{capture:!0}),GE(I,"click",e,{capture:!0}),dn(["pointerdown","pointermove","pointerup","pointercancel"],t=>{GE(I,t,e,{capture:!0})}),this.rl().capture_copied_text){const t=this.wl=o=>{o=o||A?.event;try{this._l(o,CNA)}catch(B){QNA.error("Failed to capture clipboard event",B)}};GE(I,"copy",t,{capture:!0}),GE(I,"cut",t,{capture:!0}),GE(I,"paste",t,{capture:!0})}}pl(){const A=this.ml,I=this.yl;this.el(),this.bl&&(A?.removeEventListener("blur",this.bl),dn(["pointerdown","pointermove","pointerup","pointercancel"],e=>{I?.removeEventListener(e,this.bl,!0)}),I?.removeEventListener("submit",this.bl,!0),I?.removeEventListener("change",this.bl,!0),I?.removeEventListener("click",this.bl,!0),this.bl=void 0),this.wl&&(I?.removeEventListener("copy",this.wl,!0),I?.removeEventListener("cut",this.wl,!0),I?.removeEventListener("paste",this.wl,!0),this.wl=void 0),this.ml=void 0,this.yl=void 0,this.ll=!1}startIfEnabled(){this.isEnabled||this.el(),!this.Ci&&this.xa&&this.isEnabled&&!this.ll&&(this.gl(),this.ll=!0)}onRemoteConfig(A){if(this.Ci)return;if(this.cl=!0,!A.ok)return void this.startIfEnabled();const I=A.config;I.elementsChainAsString&&(this.dl=I.elementsChainAsString);const e=I.autocapture_opt_out;var t;gm(e)&&((t=this.xa)===null||t===void 0||t.kv.set("$autocapture_disabled_server_side",e),this.ul=e),this.startIfEnabled()}setElementSelectors(A,I=this){if(this.Ci)return;A.size?this.hl.set(I,new Set(A)):this.hl.delete(I);const e=new Set;this.hl.forEach(t=>{t.forEach(o=>e.add(o))}),this.vl=e}getElementSelectors(A,I){var e;const t=[];return(e=this.vl)===null||e===void 0||e.forEach(o=>{var B;const C=(B=FV())===null||B===void 0?void 0:B.querySelectorAll(o);C?.forEach(Q=>{A!==Q&&I!==Q||yB(t,o)||t.push(o)})}),t}get isEnabled(){var A,I;if(this.Ci)return!1;const e=(A=this.xa)===null||A===void 0?void 0:A.kv.get(Qdg),t=this.ul,o=this.rl();if(!o.remoteRequestsDisabled&&!this.cl)return!1;const B=o.remoteRequestsDisabled&&!this.cl;if(fc(t)&&!gm(e)&&!B)return!1;const C=(I=this.ul)!==null&&I!==void 0?I:!!e;return!!o.enabled&&!C}_l(A,I="$autocapture",e){if(!this.isEnabled)return void this.el();let t=e||mV(A);_dg(t)&&(t=t.parentNode||null);const o=this.fl();var B;I==="$autocapture"&&A.type==="click"&&A instanceof MouseEvent&&o.rageclick&&(!((B=this.rageclicks)===null||B===void 0)&&B.isRageClick(A.clientX,A.clientY,A.timeStamp||new Date().getTime()))&&Wdg(t,o.rageclick)&&this._l(A,"$rageclick",e);const C=I===CNA,Q=C?QI(QI({},o),{},{dom_event_allowlist:void 0}):o;if(t&&(function(s,r,a,c,h,l){var D;const d=typeof window>"u"?void 0:window;if(!d||HRA(s)||a?.url_allowlist&&!bdg(a.url_allowlist,l)||a?.url_ignorelist&&bdg(a.url_ignorelist,l))return!1;if(a?.dom_event_allowlist){const G=a.dom_event_allowlist;if(G&&!G.some(m=>r.type===m))return!1}const{parentIsUsefulElement:y,targetElementList:w}=Vdg(s,c);if(!(function(G,m){const p=m?.element_allowlist;if(Le(p))return!0;for(const k of G)if(p.some(S=>k.tagName.toLowerCase()===S))return!0;return!1})(w,a)||!LRA(w,a?.css_selector_allowlist)||LRA(w,(D=a?.css_selector_ignorelist)!==null&&D!==void 0?D:YRA))return!1;try{const G=d.getComputedStyle(s);if(G&&G.getPropertyValue("cursor")==="pointer"&&r.type==="click")return!0}catch{}const u=s.tagName.toLowerCase();switch(u){case"html":return!1;case"form":return(h||["submit"]).indexOf(r.type)>=0;case"input":case"select":case"textarea":return(h||["change","click"]).indexOf(r.type)>=0;default:return y?(h||["click"]).indexOf(r.type)>=0:(h||["click"]).indexOf(r.type)>=0&&(PRA.indexOf(u)>-1||s.getAttribute("contenteditable")==="true")}})(t,A,Q,C,C?["copy","cut","paste"]:void 0,{config:{get_current_url:o.getCurrentUrl}})){var i;const{props:s,explicitNoCapture:r,target:a}=TzI(t,{e:A,maskAllElementAttributes:o.maskAllElementAttributes,maskAllText:o.maskAllText,elementAttributeIgnoreList:o.element_attribute_ignorelist,elementsChainAsString:this.dl,disableCaptureUrlHashes:o.disableCaptureUrlHashes});if(r)return!1;const c=this.getElementSelectors(t,a);if(c&&c.length>0&&(s.$element_selectors=c),I===CNA){const h=A.type||"clipboard";if(h!=="paste"){var E,n;const l=(E=BNA())===null||E===void 0||(E=E.getSelection())===null||E===void 0?void 0:E.toString(),D=Hdg(l);if(!D)return!1;s.$selected_content=D,s.$clipboard_text_length=(n=l?.length)!==null&&n!==void 0?n:0}s.$copy_type=h}return(i=this.xa)===null||i===void 0||i.capture(I,s),!0}}isBrowserSupported(){var A;return Xh((A=FV())===null||A===void 0?void 0:A.querySelectorAll)}};const twg="featureFlags",owg="logs";var OzI=class{constructor(A){this._instance=A}initialize(){}get(A){const I=this._instance.persistence;if(typeof A=="string")return I?.get_property(A);const e={};for(const t of A){const o=I?.get_property(t);Le(o)||(e[t]=o)}return e}set(A,I){var e;(e=this._instance.persistence)===null||e===void 0||e.register(typeof A=="string"?{[A]:I}:A)}remove(A){var I;(I=this._instance.persistence)===null||I===void 0||I.unregister(A)}},WzI=class{constructor(A){this.instance=A,this.$=Dt,this.kv=new OzI(A),this.onSession=I=>WCA(this.instance.onSessionId(e=>{try{I(e)}catch(t){this.$.error("Browser extension session listener failed",t)}})),this.onEvent=I=>WCA(this.instance._addCaptureHook((e,t)=>{if(t)try{I({event:e,properties:t.properties})}catch(o){this.$.error("Browser extension event listener failed",o)}})),this.onRemoteConfig=I=>{const e=o=>{try{I(o)}catch(B){this.$.error("Browser extension remote config listener failed",B)}},t=this.instance.ur.on("extensionsRemoteConfig",e);return this.instance.cr&&e(this.instance.cr),WCA(t)}}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var A;return(A=this.instance.get_property("$device_id"))!==null&&A!==void 0?A:this.distinctId}get deviceId(){const A=this.instance.get_property(ERA);return typeof A=="string"?A:void 0}get library(){return{name:bp.LIB_NAME,version:bp.LIB_VERSION}}get initialPersonProperties(){var A,I;return(A=(I=this.instance.persistence)===null||I===void 0?void 0:I.get_initial_props())!==null&&A!==void 0?A:{}}get groups(){return this.instance.getGroups()}get session(){try{var A,I,e,t,o;const B=(A=this.instance.sessionManager)===null||A===void 0?void 0:A.checkAndGetSessionAndWindowId(!0);return{sessionId:(I=B?.sessionId)!==null&&I!==void 0?I:"",windowId:(e=B?.windowId)!==null&&e!==void 0?e:"",sessionStartTimestamp:(t=B?.sessionStartTimestamp)!==null&&t!==void 0?t:0,lastActivityTimestamp:(o=B?.lastActivityTimestamp)!==null&&o!==void 0?o:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return Xh(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get projectToken(){return this.instance.config.token}getExtension(A){let I;switch(A){case twg:case"featureFlagsCommon":I=this.instance.featureFlags;break;case owg:I=this.instance.logs;break;case"surveys":I=this.instance.surveys;break;case ewg:I=this.instance.autocapture}return I}capture(A,I,e){if(!e)return void this.instance.capture(A,I);const t=QI({timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce},e.delivery==="unload"?{transport:"sendBeacon",send_instantly:!0}:{});this.instance.capture(A,I,t)}registerDynamicEventProperties(A){return WCA(this.instance.dr(A))}sendRequest(A){var I=this;return oa(function*(e,t={}){var o;const B=(o=t.target)!==null&&o!==void 0?o:"api",C=t.query?zCA(e,t.query):e,Q=I.instance.requestRouter.endpointFor(B,C),i={method:t.method,url:Q,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,compressionFallback:t.target==="flags"&&t.compression==="best-available"?UfA.Base64:void 0,timestampMode:t.sentAt};return B==="api"&&e==="/i/v1/logs"&&(i.batchKey="logs"),t.transport==="sendBeacon"?(I.instance._send_request(i),{statusCode:202}):new Promise(E=>{i.callback=E,I.instance._send_request(i)})}).apply(this,arguments)}};const UV={};let ENA=0;const JV=()=>{},Bwg='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',gH="Surveys module not available",Cwg="sanitize_properties is deprecated. Use before_send instead",Qwg="Invalid value for property_denylist config: ",VzI=["$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"],jzI=["$feature_flag_called","$$heatmap","$snapshot"],iwg=g=>g.charAt(0)==="$"&&!yB(jzI,g),zzI=/^[A-Za-z0-9_-]{1,400}$/,Ewg=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,nwg=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,XzI=["token","distinct_id",Ddg],PV="posthog",$zI=g=>{const A={};return g&&g!=="unset"&&("2025-11-30">g||(A.strictMinimumDuration=!0),"2026-05-30">g||(A.canvasCapture={resolutionScale:.6}),"2026-06-25">g||(A.streamNetworkBody=!0),"2026-08-30">g||(A.captureJsonLd=!0)),A},nNA=g=>{var A;return QI({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:TjI(ro?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:JV,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:g??"unset",__preview_deferred_init_extensions:!1,__preview_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:ta&&UC(ta?.search)&&ta.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:(Me==null||(A=Me.location)===null||A===void 0?void 0:A.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(I){Dt.error("Bad HTTP status: "+I.statusCode+" "+I.text)},get_device_id:I=>I,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Sdg,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:JV},(I=>({rageclick:I&&I>="2026-05-30"?{content_ignorelist:_RA,ignore_text_selection:!0}:!I||"2025-11-30">I||{content_ignorelist:!0},capture_pageview:!I||"2025-05-24">I||"history_change",session_recording:$zI(I),external_scripts_inject_target:I&&I>="2026-01-30"?"head":"body",internal_or_test_user_hostname:I&&I>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:I&&I>="2026-05-30"?250:0,split_storage:!(!I||"2026-05-30">I),detect_google_search_app:!(!I||"2026-05-30">I),disable_capture_url_hashes:!(!I||"2026-06-25">I),cookieWinsOnConflict:!(!I||I==="unset"||"2026-08-29">I)}))(g))},AXI=[["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"]],swg=g=>{const A={};for(const[t,o]of AXI)Le(g[t])||(A[o]=g[t]);const I=Qr({},A,g),e=g.__preview_external_dependency_versioned_paths;return Le(e)||(Le(g.strict_script_versioning)&&(I.strict_script_versioning=!!e),UC(e)&&Le(g.asset_host)&&(I.asset_host=e)),aB(g.property_blacklist)&&(Le(g.property_denylist)?I.property_denylist=g.property_blacklist:aB(g.property_denylist)?I.property_denylist=[...g.property_blacklist,...g.property_denylist]:Dt.error(Qwg+g.property_denylist)),I};var gXI=class{constructor(){this.__forceAllowLocalhost=!1}get Yc(){return this.__forceAllowLocalhost}set Yc(A){Dt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=A}},KV=class aY{th(A){if(!A)return;const I=this.eh.indexOf(A);I!==-1&&this.eh.splice(I,1)}ih(A,I){var e;return this.th(A),this.eh.push(I),(e=I.initialize)===null||e===void 0||e.call(I),I}nh(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}sh(){if(this.rh||this.config.reuseAnonymousId||this.config.segment||this.nh())return;const A=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!A&&!this.config.disable_persistence||this.oh)return;let I,e,t;A?(I=`persistence is set to '${this.config.persistence}'`,e=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",t="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(I="persistence is disabled (disable_persistence is true)",e="on every page load",t="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.rh=!0,console.warn("[PostHog.js]",`${I} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${e}, 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. ${t}`)}ah(){const A=this.persistence;if(!A||this.uh)return;if(this.nh())return void(this.config.cookieless_mode==="on_reject"&&this.get_distinct_id()!=="$posthog_cookieless"&&(this.hh(),this.dh()));if(this.get_distinct_id()!=="$posthog_cookieless")return;this.fh()||A.load(!0);const I=this.get_distinct_id();if(!I||I==="$posthog_cookieless"){const e=this.config.get_device_id(Uf());this.register({distinct_id:e,$device_id:e}),A.set_property(Im,TF)}this.hh()}get decideEndpointWasHit(){var A,I;return(A=(I=this.featureFlags)===null||I===void 0?void 0:I.hasLoadedFlags)!==null&&A!==void 0&&A}get flagsEndpointWasHit(){var A,I;return(A=(I=this.featureFlags)===null||I===void 0?void 0:I.hasLoadedFlags)!==null&&A!==void 0&&A}constructor(){var A;this.ph=!1,this.gh=!1,this.webPerformance=new gXI,this.mh=!1,this.version=bp.LIB_VERSION,this.yh=new Set,this.bh="",this.ur=new XCA,this.eh=[],this._h=[],this.wh=!1,this.oh=!1,this.rh=!1,this.uh=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=nNA(),this.SentryIntegration=EzI,this.sentryIntegration=e=>(function(t,o){const B=Byg(t,o);return{name:oyg,processEvent:C=>B(C)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.kh=!1,this.Sh=null,this.xh=null,this.$h=null,this.scrollManager=new FzI(this),this.pageViewManager=new Cyg(this),this.rateLimiter=new yzI(this),this.requestRouter=new LzI(this),this.consent=new $jI(this),this.externalIntegrations=new vzI(this);const I=(A=aY.__defaultExtensionClasses)!==null&&A!==void 0?A:{};this.featureFlags=I.featureFlags&&new I.featureFlags(this),this.toolbar=I.toolbar&&new I.toolbar(this),this.surveys=I.surveys&&new I.surveys(this),this.conversations=I.conversations&&new I.conversations(this),this.logs=I.logs&&new I.logs(this),this.metrics=I.metrics&&new I.metrics(this),this.experiments=I.experiments&&new I.experiments(this),this.exceptions=I.exceptions&&new I.exceptions(this),this.people={set:(e,t,o)=>{const B=UC(e)?{[e]:t}:e;this.setPersonProperties(B),o?.({})},set_once:(e,t,o)=>{const B=UC(e)?{[e]:t}:e;this.setPersonProperties(void 0,B),o?.({})}},this.on("eventCaptured",e=>Dt.info(`send "${e?.event}"`,e))}init(A,I,e){if(e&&e!==PV){var t;const o=(t=UV[e])!==null&&t!==void 0?t:new aY;return o._init(A,I,e),UV[e]=o,UV[PV][e]=o,o}return this._init(A,I,e)}_init(A,I={},e){var t,o,B;const C=UC(A)?A.trim():"";if(!C)return Dt.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var Q;if(this.__loaded)return C!==((Q=this.config)===null||Q===void 0?void 0:Q.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('${C}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=nNA(I.defaults),I.debug=this.Ch(I.debug),this.Th=I,this.Ih=[],I.person_profiles?this.xh=I.person_profiles:I.process_person&&(this.xh=I.process_person);const i=nNA(I.defaults),E=swg(I),n=Qr({},i,E,{name:e,token:C});yC(i.rageclick)&&yC(E.rageclick)&&(n.rageclick=Qr({},i.rageclick,E.rageclick)),yC(i.session_recording)&&yC(E.session_recording)&&(n.session_recording=Qr({},i.session_recording,E.session_recording)),this.set_config(n),this.config.on_xhr_error&&Dt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=I.disable_compression?void 0:GM.GZipJS;const s=this.fh(),r=!this.nh();if(this.persistence=new qRA(this.config,s,!0,r),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new qRA(QI(QI({},this.config),{},{persistence:"sessionStorage"}),s,!1,r),this.bh="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!s&&Ba.$t()){const D=Ba.Lt(this.bh);aB(D)&&D.forEach(d=>{UC(d)&&this.yh.add(d)})}else Ba.Pt(this.bh);const a=QI({},this.persistence.props),c=QI({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Mh=new RzI((D,d)=>this.Eh(D,d),this.config.request_queue_config),this.Ph=new xzI(this),this.__request_queue=[];const h=this.nh();h||(this.sessionManager=new Wyg(this),this.sessionPropsManager=new Zyg(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((D,d,y)=>{(y?.activityTimeout||y?.sessionPastMaximumLength||y?.crossTabAdoption)&&this.Rh()})),this.Ah(),this.config.__preview_deferred_init_extensions?(Dt.info("Deferring extension initialization to improve startup performance"),this.Fh=setTimeout(()=>{this.Fh=void 0,this.Oh(h)},0)):(Dt.info("Initializing extensions synchronously"),this.Oh(h)),bp.DEBUG=bp.DEBUG||this.config.debug,bp.DEBUG&&Dt.info("Starting in debug mode",{this:this,config:I,thisC:QI({},this.config),p:a,s:c}),this.config.identity_distinct_id&&!(!((t=I.bootstrap)===null||t===void 0)&&t.distinctID)&&(I.bootstrap=QI(QI({},I.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const l=(o=I.bootstrap)===null||o===void 0?void 0:o.distinctID;if(this.oh=!!l&&!QV(l),(B=I.bootstrap)===null||B===void 0?void 0:B.distinctID){const D=I.bootstrap.distinctID,d=this.get_distinct_id(),y=this.persistence.get_property(Im);if(I.bootstrap.isIdentifiedID&&d!=null&&d!==D&&y==="anonymous")this.identify(D);else if(I.bootstrap.isIdentifiedID&&d!=null&&d!==D&&y==="identified")Dt.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 w=this.config.get_device_id(Uf()),u=I.bootstrap.isIdentifiedID?w:D;this.persistence.set_property(Im,I.bootstrap.isIdentifiedID?_CA:TF),this.register({distinct_id:D,$device_id:u})}}if(h)this.register_once({distinct_id:uRA,$device_id:null},"");else if(!this.get_distinct_id()){const D=this.config.get_device_id(Uf());this.register_once({distinct_id:D,$device_id:D},""),this.persistence.set_property(Im,TF)}return GE(Me,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),GE(Me,"pageshow",()=>{var D;this.ph=!1,this.gh||(D=this.Ph)===null||D===void 0||D.resume()}),I.segment?tyg(this,()=>this.Dh()):this.Dh(),Xh(this.config._onCapture)&&this.config._onCapture!==JV&&(Dt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",D=>this.config._onCapture(D.event,D))),this.config.ip&&Dt.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 jyg.apply(this,arguments)})().then(D=>{D&&this.register({[nRA]:D})}).catch(JV),this}Lh(A){const I=A;return UC(I.name)&&Xh(I.setup)}Nh(A,I){var e=this;this.Lh(A)?I.push(oa(function*(){try{yield A.setup(e.qh())}catch(o){Dt.error(`Failed to set up extension "${A.name}"`,o);try{var t;yield(t=A.dispose)===null||t===void 0?void 0:t.call(A)}catch(B){Dt.error(`Failed to dispose extension "${A.name}"`,B)}}})):this.eh.push(A)}Ah(){var A,I,e,t=this;const o=(A=(I=this.config.__extensionClasses)===null||I===void 0?void 0:I.featureFlags)!==null&&A!==void 0?A:(e=aY.__defaultExtensionClasses)===null||e===void 0?void 0:e.featureFlags;var B,C,Q;if(o)if(this.featureFlags&&this.featureFlags instanceof o||((B=this.jh)===null||B===void 0||B.call(this),this.jh=void 0,this.featureFlags=new o(this)),Xh(this.featureFlags.onReloading)&&Xh(this.featureFlags.setup)){if(!this.jh){this.jh=this.featureFlags.onReloading(()=>{this.ur.emit("featureFlagsReloading",!0)});const i=this.featureFlags;oa(function*(){try{yield i.setup(t.qh())}catch(E){Dt.error("Failed to set up feature flags",E);const n=t.jh;t.jh=void 0;try{n?.()}catch(s){Dt.error("Failed to unsubscribe feature flag reloading",s)}try{yield i.dispose()}catch(s){Dt.error("Failed to dispose feature flags",s)}}})()}}else(C=(Q=this.featureFlags).initialize)===null||C===void 0||C.call(Q)}Oh(A){const I=performance.now(),e=QI(QI({},aY.__defaultExtensionClasses),this.config.__extensionClasses),t=[];var o,B,C,Q,i,E,n,s;e.exceptions&&this.eh.push(this.exceptions=(o=this.exceptions)!==null&&o!==void 0?o:new e.exceptions(this)),e.historyAutocapture&&this.eh.push(this.historyAutocapture=new e.historyAutocapture(this)),e.tracingHeaders&&this.eh.push(this.tracingHeaders=new e.tracingHeaders(this)),e.siteApps&&this.eh.push(this.siteApps=new e.siteApps(this)),e.sessionRecording&&!A&&this.eh.push(this.sessionRecording=new e.sessionRecording(this)),this.config.disable_scroll_properties||t.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),e.autocapture&&this.Nh(this.autocapture=new e.autocapture(this),t),e.surveys&&this.Nh(this.surveys=(B=this.surveys)!==null&&B!==void 0?B:new e.surveys(this),t),e.logs&&this.Nh(this.logs=(C=this.logs)!==null&&C!==void 0?C:new e.logs(this),t),e.metrics&&this.eh.push(this.metrics=(Q=this.metrics)!==null&&Q!==void 0?Q:new e.metrics(this)),e.conversations&&this.eh.push(this.conversations=(i=this.conversations)!==null&&i!==void 0?i:new e.conversations(this)),e.productTours&&this.eh.push(this.productTours=new e.productTours(this)),e.heatmaps&&this.eh.push(this.heatmaps=new e.heatmaps(this)),e.webVitalsAutocapture&&this.eh.push(this.webVitalsAutocapture=new e.webVitalsAutocapture(this)),e.exceptionObserver&&this.eh.push(this.exceptionObserver=new e.exceptionObserver(this)),e.deadClicksAutocapture&&this.eh.push(this.deadClicksAutocapture=new e.deadClicksAutocapture(this,izI)),e.toolbar&&this.eh.push(this.toolbar=(E=this.toolbar)!==null&&E!==void 0?E:new e.toolbar(this)),e.experiments&&this.eh.push(this.experiments=(n=this.experiments)!==null&&n!==void 0?n:new e.experiments(this)),e.webMCP&&this.eh.push(this.webMCP=(s=this.webMCP)!==null&&s!==void 0?s:new e.webMCP(this)),this.eh.forEach(r=>{r.initialize&&t.push(()=>{var a;(a=r.initialize)===null||a===void 0||a.call(r)})}),t.push(()=>{if(this.Bh){const r=this.Bh;this.Bh=void 0,this.eh.forEach(a=>{var c;return(c=a.onRemoteConfig)===null||c===void 0?void 0:c.call(a,r)})}}),this.zh(t,I)}zh(A,I){for(;A.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-I>=30&&A.length>0)return void(this.Fh=setTimeout(()=>{this.Fh=void 0,this.zh(A,I)},0));const t=A.shift();if(t)try{t()}catch(o){Dt.error("Error initializing extension:",o)}}const e=Math.round(performance.now()-I);this.register_for_session({[ddg]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[ydg]:e}),this.config.__preview_deferred_init_extensions&&Dt.info(`PostHog extensions initialized (${e}ms)`)}Gu(A){if(!ro||!ro.body)return Dt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Gu(A)},500);if(this.config.__preview_deferred_init_extensions&&(this.Bh=A),this.cr=A,this.compression=void 0,A.ok){var I;const e=A.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=yB(e.supportedCompression,GM.GZipJS)?GM.GZipJS:yB(e.supportedCompression,GM.Base64)?GM.Base64:void 0),!((I=e.analytics)===null||I===void 0)&&I.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.xh?this.xh:Sdg}),this.ur.emit("extensionsRemoteConfig",A),this.eh.forEach(e=>{var t;return(t=e.onRemoteConfig)===null||t===void 0?void 0:t.call(e,A)})}Dh(){try{this.config.loaded(this)}catch(A){Dt.critical("`loaded` function failed",A)}if(this.Hh(),this.config.internal_or_test_user_hostname&&ta?.hostname){const A=ta.hostname,I=this.config.internal_or_test_user_hostname;(typeof I=="string"?A===I:I.test(A))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.nh())&&this.Uh()},1),this.Wh=new myg(this),this.Wh.load()}Hh(){var A;this.is_capturing()&&this.config.request_batching&&((A=this.Mh)===null||A===void 0||A.enable())}_dom_loaded(){this.is_capturing()&&H9(this.__request_queue,A=>this.Eh(A)),this.__request_queue=[],this.Hh()}_handle_unload(){var A,I,e,t,o,B;this.ph=!0,(A=this.surveys)===null||A===void 0||(I=A.handlePageUnload)===null||I===void 0||I.call(A),(e=this.metrics)===null||e===void 0||e.flush("sendBeacon"),this.config.request_batching?(this.Vh()&&this.capture(fdg),(t=this.logs)===null||t===void 0||t.flushLogs("sendBeacon"),(o=this.Mh)===null||o===void 0||o.unload(),(B=this.Ph)===null||B===void 0||B.unload()):this.Vh()&&this.capture(fdg,null,{transport:"sendBeacon"})}_send_request(A){Tyg(this,A)}Eh(A,I){this.Ph?this.Ph.retriableRequest(A,I):this._send_request(I?QI(QI({},A),{},{transport:I}):A)}_execute_array(A){ENA++;try{let I;const e=[],t=[],o=[];H9(A,C=>{if(C)if(I=C[0],aB(I))o.push(C);else if(Xh(C))try{C.call(this)}catch(Q){Dt.error("Error executing queued PostHog call",C,Q)}else aB(C)&&I==="alias"?e.push(C):aB(C)&&I.indexOf("capture")!==-1&&Xh(this[I])?o.push(C):t.push(C)});const B=function(C,Q){H9(C,function(i){try{if(aB(i[0])){let E=Q;dn(i,function(n){E=E[n[0]].apply(E,n.slice(1))})}else Q[i[0]].apply(Q,i.slice(1))}catch(E){Dt.error("Error executing queued PostHog call",i,E)}})};B(e,this),B(t,this),B(o,this)}finally{ENA--}}push(A){if(ENA>0&&aB(A)&&UC(A[0])){const I=aY.prototype[A[0]];return void(Xh(I)&&I.apply(this,A.slice(1)))}this._execute_array([A])}get Gh(){return{property:idg,persistenceKey:Y9,cookieName:"_fbc",pattern:Ewg,register:(A,I)=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.register({[Y9]:{value:A,delivered:I}})},unregister:()=>{var A;return(A=this.persistence)===null||A===void 0?void 0:A.unregister(Y9)}}}get Qh(){return{property:Edg,persistenceKey:DV,cookieName:"_fbp",pattern:nwg,register:(A,I)=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.register({[DV]:{value:A,delivered:I}})},unregister:()=>{var A;return(A=this.persistence)===null||A===void 0?void 0:A.unregister(DV)}}}Zh(A){var I;const e=(I=this.persistence)===null||I===void 0?void 0:I.get_property(A.persistenceKey);return UC(e)&&A.pattern.test(e)?{value:e,delivered:!1}:yC(e)&&UC(e.value)&&A.pattern.test(e.value)?{value:e.value,delivered:e.delivered===!0}:void 0}Jh(A,I,e){return I===e?.value?{value:I,pending:!e.delivered}:(A.register(I,!1),{value:I,pending:!0})}Kh(A){if(!this.config.save_campaign_params||this.nh())return;const I=yV(A.cookieName);return UC(I)&&A.pattern.test(I)?I:void 0}Xh(A,I,e,t){if(!this.persistence)return;const o=this.Gh;this.persistence.refreshMetaIdentifiers();const B=this.Zh(o);if(t)return void o.unregister();if(e)return UC(I)&&Ewg.test(I)?this.Jh(o,I,B):void o.unregister();const C=UC(A)&&zzI.test(A)?A:void 0,Q=this.Kh(o);return Q&&((i,E,n)=>{const s=i.split(".");if(E)return s[3]===E;if(!n)return!0;const r=n.value.split(".");return s[3]===r[3]||Number(s[2])>Number(r[2])})(Q,C,B)?this.Jh(o,Q,B):C?B?.value.split(".")[3]===C?{value:B.value,pending:!B.delivered}:this.Jh(o,`fb.1.${Date.now()}.${C}`,B):B?{value:B.value,pending:!B.delivered}:void 0}Yh(A,I,e){if(!this.persistence)return;const t=this.Qh;this.persistence.refreshMetaIdentifiers();const o=this.Zh(t);if(e)return void t.unregister();if(I)return UC(A)&&nwg.test(A)?this.Jh(t,A,o):void t.unregister();const B=this.Kh(t);return B?this.Jh(t,B,o):o?{value:o.value,pending:!o.delivered}:void 0}td(A,I){if(!this.persistence)return;this.persistence.refreshMetaIdentifiers();const e=this.Zh(A);e?.value!==I||e.delivered||A.register(I,!0)}capture(A,I,e){var t,o;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Mh))return void Dt.uninitializedWarning("posthog.capture");if(!this.is_capturing())return void Dt.info(`Event "${A}" was not captured because capturing is disabled (opted out or consent pending).`);if(Le(A)||!UC(A))return void Dt.error("No event name provided to posthog.capture");if(this.ah(),A==="$snapshot"&&this.nh())return;const B=!this.config.opt_out_useragent_filter&&this._is_bot();if(B&&!this.config.__preview_capture_bot_pageviews)return void Dt.info(`Event "${A}" was not captured because the user agent looks like a bot. Set \`opt_out_useragent_filter: true\` to capture it.`);const C=e?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(C?.isRateLimited)return void Dt.critical("This capture call is ignored due to client rate limiting.");let Q;I?.$current_url&&!UC(I?.$current_url)&&(Dt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),I==null||delete I.$current_url),A!=="$exception"||e?.ed||Dt.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&&(Q=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 i=new Date,E=e?.timestamp||i,n=DDg(e?.uuid,Uf);let s={uuid:n,event:A,properties:this.calculateEventProperties(A,I||{},E,n)};A==="$pageview"&&this.config.__preview_capture_bot_pageviews&&B&&(s.event="$bot_pageview",s.properties.$browser_type="bot"),C&&(s.properties.$lib_rate_limit_remaining_tokens=C.remainingTokens);const r=A==="$feature_flag_called"&&s.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;e?.$set&&!r&&(s.$set=e?.$set);const a=yC(I?.$set)?I.$set:void 0,c=aB(I?.$unset)?I.$unset:[],h=e?.$unset||[],l=N=>{var U;const K=!!e?.$set&&N in e.$set;return{hasProvided:K||!!a&&N in a,provided:K?e==null||(U=e.$set)===null||U===void 0?void 0:U[N]:a?.[N],unset:c.indexOf(N)!==-1||h.indexOf(N)!==-1}},D=l(idg),d=l(Edg),y=[{channel:this.Gh,hasProvided:D.hasProvided,update:this.Xh(Q?.fbclid,D.provided,D.hasProvided,D.unset)},{channel:this.Qh,hasProvided:d.hasProvided,update:this.Yh(d.provided,d.hasProvided,d.unset)}];for(const{channel:N,hasProvided:U,update:K}of y)K&&s.properties.$process_person_profile===!0&&K.pending&&!U&&!r&&(s.$set=QI({[N.property]:K.value},s.$set));const w=e?.$unset;w&&(s.$unset=w);const u=r?void 0:this.nd(e?.$set_once,A!==Ndg,A===Rdg);if(u&&(s.$set_once=u),e?._noTruncate||(G=this.config.properties_string_max_length,s=(function(N,U){const K=new Set;return(function Y(b,q){if(b!==Object(b))return U?U(b):b;if(K.has(b))return;let j;if(K.add(b),aB(b))j=[],H9(b,Z=>{j.push(Y(Z))});else{const Z={};dn(U9(b)?xdg(b):b,(O,AA)=>{K.has(O)||(Z[AA]=Y(O))}),j=Z}return j})(N)})(s,N=>UC(N)?N.slice(0,G):N)),s.timestamp=E,Le(e?.timestamp)||(s.properties.$event_time_override_provided=!0,s.properties.$event_time_override_system_time=i),r&&(s.properties=((N,U=[])=>{const K={},Y=b=>{N[b]!==void 0&&(K[b]=N[b])};return PVI.forEach(Y),U.forEach(Y),K})(s.properties,XzI)),A===mM.DISMISSED||A===mM.SENT){const N=I?.[ZRA.SURVEY_ID],U=I?.[ZRA.SURVEY_ITERATION];gwg({id:N,current_iteration:U}),s.$set=QI(QI({},s.$set),{},{[JzI({id:N,current_iteration:U},A===mM.SENT?"responded":"dismissed")]:!0})}else A===mM.SHOWN&&(s.$set=QI(QI({},s.$set),{},{[ZRA.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var G;if(A===dzI.SHOWN){const N=I?.[uyg.TOUR_TYPE];N&&(s.$set=QI(QI({},s.$set),{},{[`${uyg.TOUR_LAST_SEEN_DATE}/${N}`]:new Date().toISOString()}))}const m=QI(QI({},s.properties.$set),s.$set);if(_p(m)||this.setPersonPropertiesForFlags(m),!rC(this.config.before_send)){const N=this.Os(s);if(!N)return;s=N,s.uuid=DDg(s.uuid,Uf)}this.sessionRecording&&!this.wh&&iwg(A)&&(this.wh=!0,setTimeout(()=>this.wh=!1,3e4));const p=y.filter(({channel:N,update:U})=>{var K,Y,b;const q=(K=(Y=s.$set)===null||Y===void 0?void 0:Y[N.property])!==null&&K!==void 0?K:yC((b=s.properties)===null||b===void 0?void 0:b.$set)?s.properties.$set[N.property]:void 0;return U?.pending&&q===U.value});this.ur.emit("eventCaptured",s);const k=(t=e?._url)!==null&&t!==void 0?t:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),S=e?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(k),R=QI(QI(QI({method:"POST",url:k,data:s,compression:"best-available",preferSyncCompression:e?.send_instantly,timestampMode:S?"body":"capture-body",batchKey:e?._batchKey},S&&(!((o=s.properties)===null||o===void 0)&&o.$session_id)?{batchGroup:s.properties.$session_id+(s.properties.$window_id?`-${s.properties.$window_id}`:"")}:{}),e?.transport?{transport:e.transport}:{}),p.length?{fireCallbackOnDrop:!0,callback:N=>{if(N.statusCode>=200&&300>N.statusCode)for(const{channel:U,update:K}of p)this.td(U,K.value)}}:{});if(!this.config.request_batching||e&&!e?._batchKey||e?.send_instantly){var x;let N;!R.transport&&!R.callback&&_p((x=this.config.request_headers)!==null&&x!==void 0?x:{})&&this.ph&&(N="sendBeacon"),this.Eh(R,N)}else this.Mh.enqueue(R);return s}_addCaptureHook(A){return this.on("eventCaptured",I=>A(I.event,I))}getExtension(A){var I;return(I=this.sd)===null||I===void 0?void 0:I.getExtension(A)}qh(){var A;return(A=this.sd)!==null&&A!==void 0?A:this.sd=new WzI(this)}dr(A){this._h.push(A);let I=!0;return()=>{if(!I)return;I=!1;const e=this._h.indexOf(A);e!==-1&&this._h.splice(e,1)}}rd(A=!0){var I,e,t;return!!(!((I=this.persistence)===null||I===void 0)&&I.consumeCookieIdentityChange())&&(this.$h=null,this.persistence.get_property("$user_state")==="anonymous"&&((t=this.sessionPersistence)===null||t===void 0||t.clear(),this.yh.clear(),this.od()),(e=this.featureFlags)===null||e===void 0||e.reset(),A&&this.reloadFeatureFlags(),!0)}calculateEventProperties(A,I,e,t,o){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return I;this.ah(),this.persistence.syncCookieProperties(),this.rd();const B=o?void 0:this.persistence.remove_event_timer(A);let C=QI({},I);if(C.token=this.config.token,C.$config_defaults=this.config.defaults,this.nh()&&(C[Ddg]=!0),A==="$snapshot"){const D=QI(QI({},this.persistence.properties()),this.sessionPersistence.properties());return C.distinct_id=D.distinct_id,(!UC(C.distinct_id)&&!$h(C.distinct_id)||QV(C.distinct_id))&&Dt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),C}const Q=(function(D,d,y,w=!1){var u,G,m,p;if(!Am)return{};const k=D?[...j9,...d||[]]:[],[S,R]=aDg(Am),[x,N]=(function(tA){for(let eA=0;cDg.length>eA;eA++){const[QA,sA,dA]=cDg[eA],CA=tA.match(QA);if(CA){const hA=dA&&tA.match(dA)||CA;return[sA,hA?.[1]||""]}}return["",""]})(Am),U=(function(){const tA="u">typeof navigator?navigator:void 0;return tA?.brave?{brave:!0}:{}})(),K={};Le(y)||(K.detectGoogleSearchApp=y);const Y={},b=(u=navigator)===null||u===void 0||(u=u.userAgentData)===null||u===void 0?void 0:u.platform,q=(G=navigator)===null||G===void 0?void 0:G.maxTouchPoints,j=Me==null||(m=Me.screen)===null||m===void 0?void 0:m.width,Z=Me==null||(p=Me.screen)===null||p===void 0?void 0:p.height,O=Me?.devicePixelRatio;Le(b)||(Y.userAgentDataPlatform=b),Le(q)||(Y.maxTouchPoints=q),Le(j)||(Y.screenWidth=j),Le(Z)||(Y.screenHeight=Z),Le(O)||(Y.devicePixelRatio=O);const AA=Qr(kRA({$os:S,$os_version:R,$browser:nDg(Am,navigator.vendor,U,K),$webview_app:x,$webview_app_version:N,$device:rDg(Am),$device_type:tVI(Am,Y),$timezone:Qyg(),$timezone_offset:hzI()}),{$current_url:MV(w?v4(ta?.href):ta?.href,k,SV),$host:ta?.host,$pathname:ta?.pathname,$raw_user_agent:Am.length>1e3?Am.substring(0,997)+"...":Am,$browser_version:eVI(Am,navigator.vendor,U,K),$browser_language:cyg(),$browser_language_prefix:czI(),$screen_height:Me?.screen.height,$screen_width:Me?.screen.width,$viewport_height:Me?.innerHeight,$viewport_width:Me?.innerWidth,$lib:bF.LIB_NAME,$lib_version:bF.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return bF.SDK_DIST_CHANNEL&&(AA.$sdk_dist_channel=bF.SDK_DIST_CHANNEL),AA})(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:D,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(o,e.getTime(),!0);C.$session_id=D,C.$window_id=d}this.sessionPropsManager&&Qr(C,this.sessionPropsManager.getSessionProps());try{var i;if(this.sessionRecording){const D=this.sessionRecording.sdkDebugProperties,d=!this.wh&&iwg(A);for(const y in D)(d||yB(VzI,y))&&(C[y]=D[y])}C.$sdk_debug_retry_queue_size=(i=this.Ph)===null||i===void 0?void 0:i.length}catch(D){C.$sdk_debug_error_capturing_properties=String(D)}let E;if(this.requestRouter.region===oNA&&(C.$lib_custom_api_host=this.config.api_host),E=A!=="$pageview"||o?A!=="$pageleave"||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,t),C=Qr(C,E),A==="$pageview"&&ro&&(C.title=ro.title),!Le(B)){const D=e.getTime()-B;C.$duration=parseFloat((D/1e3).toFixed(3))}Am&&this.config.opt_out_useragent_filter&&(C.$browser_type=this._is_bot()?"bot":"browser");const n=this.persistence.properties(),s=this.sessionPersistence.properties(),r=C.$groups,a=n.$groups;yC(r)&&!_p(r)&&(C.$groups=QI(QI({},yC(a)?a:{}),r)),dn(["$referrer","$referring_domain"],D=>{D in n&&delete s[D]});const c={};if(this._h.length>0)for(const D of this._h.slice())try{Qr(c,D())}catch(d){Dt.error("Failed to produce browser extension event properties",d)}C=Qr({},Q,n,s,QI(QI({},c),C)),C.$is_identified=this._isIdentified(),aB(this.config.property_denylist)?dn(this.config.property_denylist,function(D){delete C[D]}):Dt.error(Qwg+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const h=this.config.sanitize_properties;h&&(Dt.error(Cwg),C=h(C,A));const l=this.ad();return C.$process_person_profile=l,l&&!o&&this.ld("_calculate_event_properties"),C}nd(A,I=!0,e=!1){var t;if(!this.persistence||!this.ad()||this.mh&&!e)return A;const o=this.persistence.get_initial_props(),B=(t=this.sessionPropsManager)===null||t===void 0?void 0:t.getSetOnceProps();let C=Qr({},o,B||{},A||{});const Q=this.config.sanitize_properties;return Q&&(Dt.error(Cwg),C=Q(C,"$set_once")),I&&(this.mh=!0),_p(C)?void 0:C}register(A,I){var e;(e=this.persistence)===null||e===void 0||e.register(A,I)}register_once(A,I,e){var t;(t=this.persistence)===null||t===void 0||t.register_once(A,I,e)}register_for_session(A){var I,e;(I=this.persistence)===null||I===void 0||I.syncCookieProperties(),this.rd(),(e=this.sessionPersistence)===null||e===void 0||e.register(A),Object.keys(A).forEach(t=>this.yh.add(t)),this.od()}unregister(A){var I;(I=this.persistence)===null||I===void 0||I.unregister(A)}unregister_for_session(A){var I;(I=this.sessionPersistence)===null||I===void 0||I.unregister(A),this.yh.delete(A),this.od()}ud(A,I){this.register({[A]:I})}Rh(){this.yh.forEach(A=>{var I;(I=this.sessionPersistence)===null||I===void 0||I.unregister(A)}),this.yh.clear(),this.od()}od(){var A;if(!this.bh)return;if(this.config.persistence==="memory"||!((A=this.sessionPersistence)===null||A===void 0)&&A.hi||!Ba.$t())return void Ba.Pt(this.bh);const I=[];this.yh.forEach(e=>I.push(e)),I.length>0?Ba.At(this.bh,I):Ba.Pt(this.bh)}getFeatureFlag(A,I){var e;return(e=this.featureFlags)===null||e===void 0?void 0:e.getFeatureFlag(A,I)}getFeatureFlagPayload(A){var I;return(I=this.featureFlags)===null||I===void 0?void 0:I.getFeatureFlagPayload(A)}getFeatureFlagResult(A,I){var e;return(e=this.featureFlags)===null||e===void 0?void 0:e.getFeatureFlagResult(A,I)}getAllFeatureFlags(){var A,I;return(A=(I=this.featureFlags)===null||I===void 0?void 0:I.getAllFeatureFlags())!==null&&A!==void 0?A:[]}isFeatureEnabled(A,I){var e,t;return(e=(t=this.featureFlags)===null||t===void 0?void 0:t.isFeatureEnabled(A,I))!==null&&e!==void 0?e:I?.defaultValue}reloadFeatureFlags(){var A;(A=this.featureFlags)===null||A===void 0||A.reloadFeatureFlags()}updateFlags(A,I,e){var t;(t=this.featureFlags)===null||t===void 0||t.updateFlags(A,I,e)}updateEarlyAccessFeatureEnrollment(A,I,e){var t;(t=this.featureFlags)===null||t===void 0||t.updateEarlyAccessFeatureEnrollment(A,I,e)}getEarlyAccessFeatures(A,I=!1,e){var t;return(t=this.featureFlags)===null||t===void 0?void 0:t.getEarlyAccessFeatures(A,I,e)}on(A,I){return this.ur.on(A,I)}onFeatureFlags(A){return this.featureFlags?this.featureFlags.onFeatureFlags(A):(A([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(A){return this.surveys?this.surveys.onSurveysLoaded(A):(A([],{isLoaded:!1,error:gH}),()=>{})}onSessionId(A){var I,e;return(I=(e=this.sessionManager)===null||e===void 0?void 0:e.onSessionId(A))!==null&&I!==void 0?I:()=>{}}getSurveys(A,I=!1){this.surveys?this.surveys.getSurveys(A,I):A([],{isLoaded:!1,error:gH})}getActiveMatchingSurveys(A,I=!1){this.surveys?this.surveys.getActiveMatchingSurveys(A,I):A([],{isLoaded:!1,error:gH})}onActiveMatchingSurveysChanged(A){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(A):(A([],{isLoaded:!1,error:gH}),()=>{})}renderSurvey(A,I){var e;(e=this.surveys)===null||e===void 0||e.renderSurvey(A,I)}displaySurvey(A,I=_zI){var e;(e=this.surveys)===null||e===void 0||e.displaySurvey(A,I)}cancelPendingSurvey(A){var I;(I=this.surveys)===null||I===void 0||I.cancelPendingSurvey(A)}canRenderSurvey(A){var I,e;return(I=(e=this.surveys)===null||e===void 0?void 0:e.canRenderSurvey(A))!==null&&I!==void 0?I:{visible:!1,disabledReason:gH}}canRenderSurveyAsync(A,I=!1){var e,t;return(e=(t=this.surveys)===null||t===void 0?void 0:t.canRenderSurveyAsync(A,I))!==null&&e!==void 0?e:Promise.resolve({visible:!1,disabledReason:gH})}hd(A){return!A||QV(A)?(Dt.critical("Unique user id has not been set in posthog.identify"),!1):A==="$posthog_cookieless"?(Dt.critical(`The string "${A}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(A.toLowerCase())&&!["undefined","null"].includes(A.toLowerCase())||(Dt.critical(`The string "${A}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(A,I,e){if(!this.__loaded||!this.persistence)return Dt.uninitializedWarning("posthog.identify");if($h(A)&&(A=A.toString(),Dt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.hd(A)||!this.ld("posthog.identify"))return;this.ah();const t=this.get_distinct_id(),o=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==t,B=this.rd(!1),C=this.persistence.ku();let Q=!1;try{const E=this.get_distinct_id();this.register({$user_id:A}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:E},""),A!==E&&A!==this.get_property("__alias")&&(this.unregister(YCA),this.register({distinct_id:A}));const n=(this.persistence.get_property("$user_state")||"anonymous")===TF,s=A!==E,r=!s&&n;if(s&&n){var i;const a=this.config.reuseAnonymousId?{distinct_id:A}:{distinct_id:A,$anon_distinct_id:E};this.persistence.set_property(Im,_CA),this.setPersonPropertiesForFlags({$set:I||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Su(),this.capture("$identify",a,{$set:I||{},$set_once:e||{}})&&(this.$h=tNA(A,I,e)),(i=this.featureFlags)===null||i===void 0||i.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:E)}else if(r){this.persistence.set_property(Im,_CA);const a=I||{},c=e||{};this.setPersonPropertiesForFlags({$set:a,$set_once:c},!1),this.config.cookieWinsOnConflict&&this.persistence.Su(),this.capture("$set",{$set:a,$set_once:c})&&(this.$h=tNA(A,I,e))}else(I||e)&&this.setPersonProperties(I,e);s||o||B?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(qF)):r&&(I||e)&&this.reloadFeatureFlags(),Q=!0}finally{C&&this.persistence.Cu(Q)}}setPersonProperties(A,I){if(!A&&!I||!this.ld("posthog.setPersonProperties"))return;const e=tNA(this.get_distinct_id(),A,I);this.$h!==e?(this.setPersonPropertiesForFlags({$set:A||{},$set_once:I||{}},!0),this.capture("$set",{$set:A||{},$set_once:I||{}})&&(this.$h=e)):Dt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(A){var I;const e=(aB(A)?A:[A]).filter(t=>UC(t)&&t.length>0);e.length!==0&&this.ld("posthog.unsetPersonProperties")&&((I=this.featureFlags)===null||I===void 0||I.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.$h=null)}group(A,I,e){var t;if(!A||!I)return void Dt.error("posthog.group requires a group type and group key");(t=this.persistence)===null||t===void 0||t.syncCookieProperties(),this.rd();const o=this.getGroups(),B=o[A]!==I;if(B&&this.resetGroupPropertiesForFlags(A),this.register({$groups:QI(QI({},o),{},{[A]:I})}),(B||e)&&this.ad()){const C={$group_type:A,$group_key:I};e&&(C.$group_set=e),this.capture(Ndg,C)}e&&this.setGroupPropertiesForFlags({[A]:e}),B&&!e&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(A,I=!0){var e;(e=this.featureFlags)===null||e===void 0||e.setPersonPropertiesForFlags(A,I)}resetPersonPropertiesForFlags(A=!0){var I;(I=this.featureFlags)===null||I===void 0||I.resetPersonPropertiesForFlags(A)}setGroupPropertiesForFlags(A,I=!0){var e;this.ld("posthog.setGroupPropertiesForFlags")&&((e=this.featureFlags)===null||e===void 0||e.setGroupPropertiesForFlags(A,I))}resetGroupPropertiesForFlags(A){var I;(I=this.featureFlags)===null||I===void 0||I.resetGroupPropertiesForFlags(A)}reset(A){const I=gm(A)?A:A?.resetDeviceID,e=gm(A)||A==null?void 0:A.bootstrap;this.dd(I,!1,e)}dd(A,I=!1,e){var t,o,B,C,Q,i;if(Dt.info("reset"),!this.__loaded)return Dt.uninitializedWarning("posthog.reset");const E=e?.sessionID;this.config.bootstrap=e||((t=this.Th)===null||t===void 0?void 0:t.bootstrap)||{},(o=this.featureFlags)===null||o===void 0||(B=o.updateConfig)===null||B===void 0||B.call(o,this.config,this.Qu());const n=this.get_property(ERA),s=this.get_property(nRA),r=this.get_property(dV);(C=this.sessionRecording)===null||C===void 0||C.flushBeforeIdentityReset();const a=this.is_capturing();I||this.consent.reset(),I||!a||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 c=(Q=this.persistence)===null||Q===void 0||(i=Q.ku)===null||i===void 0?void 0:i.call(Q),h=this.uh;this.uh=h||I;let l=!1;try{var D,d,y,w,u,G,m,p,k,S,R,x,N;if((D=this.persistence)===null||D===void 0||D.clear(),(d=this.sessionPersistence)===null||d===void 0||d.clear(),this.yh.clear(),this.od(),Le(r)||(S=this.persistence)===null||S===void 0||S.register({$session_recording_remote_config:r}),(y=this.surveys)===null||y===void 0||y.reset(),(w=this.featureFlags)===null||w===void 0||w.reset(),(u=this.conversations)===null||u===void 0||u.reset(),(G=this.logs)===null||G===void 0||G.reset(),(m=this.metrics)===null||m===void 0||m.reset(),(p=this.persistence)===null||p===void 0||p.set_property("$user_state","anonymous"),(k=this.sessionManager)===null||k===void 0||k.resetSessionId(),this.$h=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:uRA,$device_id:null},"");else{const b=this.config.get_device_id(Uf());this.register_once({distinct_id:b,$device_id:A?b:n},""),A||Le(s)||this.register({[nRA]:s})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),e&&(e.distinctID&&!this.nh()&&((N=this.persistence)===null||N===void 0||N.set_property("$user_state",e.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.distinctID})),(R=this.featureFlags)===null||R===void 0||R.initialize(),!rC(E)&&!(!((x=this.sessionManager)===null||x===void 0)&&x.setBootstrapSessionId(E,!0)))){const b=QI({},e);delete b.sessionID,this.config.bootstrap=b}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,l=!0}finally{var U,K;this.uh=h,c&&((U=this.persistence)===null||U===void 0||(K=U.Cu)===null||K===void 0||K.call(U,l))}var Y;this.cr&&((Y=this.conversations)===null||Y===void 0||Y.onRemoteConfig(this.cr)),this.reloadFeatureFlags()}shutdown(A){var I=this;return oa(function*(){if(!I.__loaded)return void Dt.uninitializedWarning("posthog.shutdown");I.gh=!0,clearTimeout(I.Fh),I.Fh=void 0;const e=I.jh;I.jh=void 0;for(const t of[()=>{var o;return(o=I.sessionRecording)===null||o===void 0?void 0:o.dispose()},()=>{var o;return(o=I.logs)===null||o===void 0?void 0:o.flushLogs("sendBeacon")},()=>{var o;return(o=I.metrics)===null||o===void 0?void 0:o.flush("sendBeacon")},()=>{var o;return(o=I.metrics)===null||o===void 0?void 0:o.dispose()},()=>{var o;return(o=I.logs)===null||o===void 0?void 0:o.dispose()},()=>{var o;return(o=I.surveys)===null||o===void 0?void 0:o.dispose()},()=>{var o;return(o=I.autocapture)===null||o===void 0?void 0:o.dispose()},()=>e?.(),()=>{var o;return(o=I.Mh)===null||o===void 0?void 0:o.unload()},()=>{var o;return(o=I.Ph)===null||o===void 0?void 0:o.unload()},()=>{var o;return(o=I.featureFlags)===null||o===void 0?void 0:o.destroy()},()=>{var o;return(o=I.persistence)===null||o===void 0?void 0:o.destroy()},()=>{var o;return(o=I.sessionPersistence)===null||o===void 0?void 0:o.destroy()}])try{const o=t();o&&Xh(o.then)&&o.then(void 0,B=>{Dt.error("Error during shutdown",B)})}catch(o){Dt.error("Error during shutdown",o)}})()}setIdentity(A,I){var e;delete this.config.identity_claims,this.config.identity_distinct_id=A,this.config.identity_hash=I,this.alias(A),(e=this.conversations)===null||e===void 0||e.vd()}clearIdentity(){var A;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(A=this.conversations)===null||A===void 0||A.fd()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var A,I;return(A=(I=this.sessionManager)===null||I===void 0?void 0:I.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&A!==void 0?A:""}get_session_replay_url(A){if(!this.sessionManager)return"";const{sessionId:I,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let t=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${I}`);if(A?.withTimestamp&&e){var o;const B=(o=A.timestampLookBack)!==null&&o!==void 0?o:10;if(!e)return t;t+=`?t=${Math.max(Math.floor((new Date().getTime()-e)/1e3)-B,0)}`}return t}alias(A,I){return A===this.get_property("$people_distinct_id")?(Dt.critical("Attempting to create alias for existing People user - aborting."),-2):this.ld("posthog.alias")?(Le(I)&&(I=this.get_distinct_id()),A!==I?(this.ud(YCA,A),this.capture("$create_alias",{alias:A,distinct_id:I})):(Dt.warn("alias matches current distinct_id - skipping api call."),this.identify(A),-1)):void 0}set_config(A){const I=QI({},this.config);if(yC(A)){var e,t,o,B,C,Q,i,E,n,s,r,a,c,h;Qr(this.config,swg(A));const w=this.fh();if(this.persistence){const G=this.config.persistence==="sessionStorage"||this.config.persistence==="memory";var l,D;if(G&&this.sessionPersistence!==this.persistence&&((l=this.sessionPersistence)===null||l===void 0||l.remove(),(D=this.sessionPersistence)===null||D===void 0||D.destroy()),this.persistence.update_config(this.config,I,w),G)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new qRA(QI(QI({},this.config),{},{persistence:"sessionStorage"}),w,!1);else{var d;(d=this.sessionPersistence)===null||d===void 0||d.update_config(QI(QI({},this.config),{},{persistence:"sessionStorage"}),QI(QI({},I),{},{persistence:"sessionStorage"}),w)}}const u=this.Ch(this.config.debug);var y;gm(u)&&(this.config.debug=u),gm(this.config.debug)&&(this.config.debug?(bp.DEBUG=!0,AE.$t()&&AE.At("ph_debug",!0),Dt.info("set_config",{config:A,oldConfig:I,newConfig:QI({},this.config)})):(bp.DEBUG=!1,AE.$t()&&AE.Pt("ph_debug"))),(e=this.featureFlags)===null||e===void 0||(t=e.updateConfig)===null||t===void 0||t.call(e,this.config,this.Qu()),(o=this.exceptionObserver)===null||o===void 0||o.onConfigChange(),(B=this.exceptions)===null||B===void 0||B.onConfigChange(),(C=this.metrics)===null||C===void 0||C.onConfigChange(),(Q=this.webMCP)===null||Q===void 0||Q.startIfEnabled(),(i=this.sessionRecording)===null||i===void 0||i.startIfEnabledOrStop(),(E=this.tracingHeaders)===null||E===void 0||E.startIfEnabledOrStop(),(n=this.autocapture)===null||n===void 0||n.startIfEnabled(),(s=this.heatmaps)===null||s===void 0||s.startIfEnabled(),("capture_pageview"in A||"disable_capture_url_hashes"in A)&&((y=this.historyAutocapture)===null||y===void 0||y.startIfEnabledOrStop()),(r=this.exceptionObserver)===null||r===void 0||r.startIfEnabledOrStop(),(a=this.deadClicksAutocapture)===null||a===void 0||a.startIfEnabledOrStop(),(c=this.surveys)===null||c===void 0||c.loadIfEnabled(),this.hh(),(h=this.externalIntegrations)===null||h===void 0||h.startIfEnabledOrStop(),!I.segment&&this.config.segment&&this.persistence&&tyg(this,JV,!1)}}_overrideSDKInfo(A,I){bp.LIB_NAME=A,bp.LIB_VERSION=I}startSessionRecording(A){const I=A===!0,e={sampling:I||!!A?.sampling,linked_flag:I||!!A?.linked_flag,url_trigger:I||!!A?.url_trigger,event_trigger:I||!!A?.event_trigger};var t,o,B,C,Q;Object.values(e).some(Boolean)&&((t=this.sessionManager)===null||t===void 0||t.checkAndGetSessionAndWindowId(),e.sampling&&((o=this.sessionRecording)===null||o===void 0||o.overrideSampling()),e.linked_flag&&((B=this.sessionRecording)===null||B===void 0||B.overrideLinkedFlag()),e.url_trigger&&((C=this.sessionRecording)===null||C===void 0||C.overrideTrigger("url")),e.event_trigger&&((Q=this.sessionRecording)===null||Q===void 0||Q.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var A;return!!(!((A=this.sessionRecording)===null||A===void 0)&&A.started)}captureException(A,I){try{if(!this.exceptions)return;const e=this.exceptions.buildProperties(A,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(QI(QI({},e),I))}catch{return}}addExceptionStep(A,I){var e;(e=this.exceptions)===null||e===void 0||e.addExceptionStep(A,I)}captureLog(A){var I;(I=this.logs)===null||I===void 0||I.captureLog(A)}get logger(){var A,I;return(A=(I=this.logs)===null||I===void 0?void 0:I.logger)!==null&&A!==void 0?A:aY.pd}startExceptionAutocapture(A){this.set_config({capture_exceptions:A==null||A})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(A){var I,e;return(I=(e=this.toolbar)===null||e===void 0?void 0:e.loadToolbar(A))!==null&&I!==void 0&&I}get_property(A){var I;return(I=this.persistence)===null||I===void 0?void 0:I.props[A]}getSessionProperty(A){var I;return(I=this.sessionPersistence)===null||I===void 0?void 0:I.props[A]}toString(){var A;let I=(A=this.config.name)!==null&&A!==void 0?A:PV;return I!==PV&&(I="posthog."+I),I}_isIdentified(){var A,I;return((A=this.persistence)===null||A===void 0?void 0:A.get_property("$user_state"))==="identified"||((I=this.sessionPersistence)===null||I===void 0?void 0:I.get_property("$user_state"))==="identified"}ad(){var A,I;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&_p(this.getGroups())&&!(!((A=this.persistence)===null||A===void 0||(A=A.props)===null||A===void 0)&&A.__alias)&&!(!((I=this.persistence)===null||I===void 0||(I=I.props)===null||I===void 0)&&I.$epp))}Vh(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.ad()||this.ld("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ld("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ld(A){return this.config.person_profiles==="never"?(Dt.error(A+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.sh(),this.ud(wRA,!0),!0)}fh(){if(this.config.cookieless_mode==="always")return!0;const A=this.consent.isOptedOut();return this.config.disable_persistence||A&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}hh(){var A,I;const e=this.fh();var t,o,B;return this.is_capturing()||(t=this.logs)===null||t===void 0||t.gd(),((A=this.persistence)===null||A===void 0?void 0:A.hi)!==e&&((o=this.persistence)===null||o===void 0||o.set_disabled(e)),((I=this.sessionPersistence)===null||I===void 0?void 0:I.hi)!==e&&((B=this.sessionPersistence)===null||B===void 0||B.set_disabled(e)),this.od(),e}opt_in_capturing(A){var I;if(this.config.cookieless_mode!=="always"){if(this.nh()){var e,t,o,B,C,Q;(e=this.sessionRecording)===null||e===void 0||e.dispose({discardBufferedEvents:!0}),this.dd(!0,!0),(t=this.sessionManager)===null||t===void 0||t.destroy(),(o=this.pageViewManager)===null||o===void 0||o.destroy(),this.sessionManager=new Wyg(this),this.pageViewManager=new Cyg(this),this.persistence&&(this.sessionPropsManager=new Zyg(this,this.sessionManager,this.persistence));const a=(B=(C=this.config.__extensionClasses)===null||C===void 0?void 0:C.sessionRecording)!==null&&B!==void 0?B:(Q=aY.__defaultExtensionClasses)===null||Q===void 0?void 0:Q.sessionRecording;var i,E;a&&(this.sessionRecording=this.ih(this.sessionRecording,new a(this)),this.cr&&((i=this.sessionRecording)===null||i===void 0||(E=i.onRemoteConfig)===null||E===void 0||E.call(i,this.cr)))}var n,s,r;this.consent.optInOut(!0),this.hh(),this.Hh(),(I=this.sessionRecording)===null||I===void 0||I.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((n=this.surveys)===null||n===void 0||n.loadIfEnabled(),(s=this.conversations)===null||s===void 0||s.loadIfEnabled()),(Le(A?.captureEventName)||A?.captureEventName)&&this.capture((r=A?.captureEventName)!==null&&r!==void 0?r:"$opt_in",A?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Uh()}else Dt.warn(Bwg)}opt_out_capturing(){this.config.cookieless_mode!=="always"?(this.consent.optInOut(!1),this.hh(),this.config.cookieless_mode==="on_reject"&&this.dh()):Dt.warn(Bwg)}dh(){var A,I;const e=this.sessionRecording;e?.dispose({discardBufferedEvents:!0}),this.get_distinct_id()!=="$posthog_cookieless"&&this.dd(!0,!0),this.register({distinct_id:uRA,$device_id:null}),this.th(e),this.sessionRecording=void 0,(A=this.sessionManager)===null||A===void 0||A.destroy(),(I=this.pageViewManager)===null||I===void 0||I.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Uh(),this.Hh()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const A=this.consent.consent;return A===1?"granted":A===0?"denied":"pending"}is_capturing(){return!this.uh&&(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.hh()}_is_bot(){return Rw?Vyg(Rw,this.config.custom_blocked_useragents):void 0}Uh(){ro&&(ro.visibilityState==="visible"?this.kh||(this.kh=!0,this.capture(pRA,{title:ro.title},{send_instantly:!0}),this.Sh&&(ro.removeEventListener(L9,this.Sh),this.Sh=null)):this.Sh||(this.Sh=this.Uh.bind(this),GE(ro,L9,this.Sh)))}debug(A){A===!1?(Me?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Me?.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}))}Qu(){const A=this.Th||{};return"advanced_disable_flags"in A?!!A.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Dt.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(I,e,t,o,B){const C=e in I&&!rC(I[e]),Q=t in I&&!rC(I[t]);return C?I[e]:!!Q&&(B&&B.warn(`Config field '${t}' is deprecated. Please use '${e}' instead. The old field will be removed in a future major version.`),I[t])})(A,"advanced_disable_flags","advanced_disable_decide",0,Dt)}Os(A){var I;if(rC(this.config.before_send))return A;const e=Object.keys((I=A.properties)!==null&&I!==void 0?I:{}).filter(ZWI),t=aB(this.config.before_send)?this.config.before_send:[this.config.before_send];let o=A;for(const B of t)try{if(o=B(o),rC(o)){const C=`Event '${A.event}' was rejected in beforeSend function`;return TWI(A.event)?Dt.warn(`${C}. This can cause unexpected behavior.`):Dt.info(C),null}o.properties&&!_p(o.properties)||Dt.warn(`Event '${A.event}' has no properties after beforeSend function, this is likely an error.`)}catch(C){return Dt.error(`Error in beforeSend function for event '${A.event}':`,C),null}for(const B of e)if(o.properties&&rC(o.properties[B]))return Dt.warn(`Event '${A.event}' had its '${B}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return o}getPageViewId(){var A;return(A=this.pageViewManager.Rl)===null||A===void 0?void 0:A.pageViewId}captureTraceFeedback(A,I){this.capture("$ai_feedback",{$ai_trace_id:String(A),$ai_feedback_text:I})}captureTraceMetric(A,I,e){this.capture("$ai_metric",{$ai_trace_id:String(A),$ai_metric_name:I,$ai_metric_value:String(e)})}Ch(A){const I=gm(A)&&!A,e=AE.$t()&&AE.Ot("ph_debug")==="true";return!I&&(!!e||A)}};KV.__defaultExtensionClasses={},KV.pd=(()=>{const g=()=>{};return{trace:g,debug:g,info:g,warn:g,error:g,fatal:g}})(),(function(g,A){for(let I=0;A.length>I;I++)g.prototype[A[I]]=vjI(g.prototype[A[I]])})(KV,["identify"]);var IXI=class{constructor(A){this._instance=A}refresh(A){const I=this._instance.config,e=yC(I.autocapture)?I.autocapture:void 0;A.enabled=!!I.autocapture,A.rageclick=I.rageclick,A.maskAllElementAttributes=I.mask_all_element_attributes,A.maskAllText=I.mask_all_text,A.disableCaptureUrlHashes=I.disable_capture_url_hashes,A.getCurrentUrl=I.get_current_url,A.remoteRequestsDisabled=this._instance.Qu(),A.url_allowlist=e?.url_allowlist,A.url_ignorelist=e?.url_ignorelist,A.dom_event_allowlist=e?.dom_event_allowlist,A.element_allowlist=e?.element_allowlist,A.css_selector_allowlist=e?.css_selector_allowlist,A.css_selector_ignorelist=e?.css_selector_ignorelist,A.element_attribute_ignorelist=e?.element_attribute_ignorelist,A.capture_copied_text=e?.capture_copied_text}};const LV=qr("[ExceptionAutocapture]"),awg=()=>{},rwg=g=>{var A;if(Xh(g))return(A=g.__posthog_layer__)!==null&&A!==void 0?A:g.__rrweb_layer__};function IH(g,A,I){try{if(!(A in g))return awg;const e={next:g[A]},t=I(function(...o){return e.next.apply(this,o)});return Xh(t)&&(t.prototype=t.prototype||{},Object.defineProperties(t,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:e}})),g[A]=t,()=>{if(g[A]===t)return void(g[A]=e.next);let o=g[A],B=rwg(o);for(;B;){if(B.next===t)return void(B.next=e.next);o=B.next,B=rwg(o)}}}catch{return awg}}const eXI=qr("[TracingHeaders]"),SY=qr("[Web Vitals]"),cwg=9e5,hwg=["CLS","FCP","INP","LCP"],tXI=["INP","LCP"],oXI=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],sNA="disabled",lwg="lazy_loading",VF=qr("[SessionRecording]"),BXI=[GRA,mRA,wdg,udg,Gdg,mdg,pdg,kdg,Mdg],CXI=qr("[Heatmaps]");function aNA(g){return yC(g)&&"clientX"in g&&"clientY"in g&&$h(g.clientX)&&$h(g.clientY)}const gQA=qr("[Product Tours]"),rNA=g=>{var A;return!g.config.disable_product_tours&&!!(!((A=g.persistence)===null||A===void 0)&&A.get_property(DRA))},QXI=["$set_once","$set"],JN=qr("[SiteApps]"),Dwg="Error while initializing PostHog app with config id ";function eH(g,A,I){if(rC(g))return!1;switch(I){case"exact":return g===A;case"contains":{const e=A.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(e,"i").test(g)}case"regex":try{return new RegExp(A).test(g)}catch{return!1}default:return!1}}var iXI=class{constructor(A){this.Ai=A,this._o=new Set,this.wo=new Set,this.ko=new XCA,this.So=(I,e)=>this.xo(I,e)&&this.$o(I,e)&&this.Co(I,e)&&this.To(I,e),this.xo=(I,e)=>!e?.event||I?.event===e?.event}init(){var A,I;Le((A=this.Ai)===null||A===void 0?void 0:A.subscribeCapture)||(this.Io=(I=this.Ai)===null||I===void 0?void 0:I.subscribeCapture((e,t)=>{this.on(e,t)}))}dispose(){var A,I,e;(A=this.Io)===null||A===void 0||A.call(this),this.Io=void 0,(I=this.Ai)===null||I===void 0||(e=I.setElementSelectors)===null||e===void 0||e.call(I,new Set,this),this.ko=new XCA}register(A){var I,e;if(!Le((I=this.Ai)===null||I===void 0?void 0:I.subscribeCapture)&&(A.forEach(t=>{var o;this._o.add(t),(o=t.steps)===null||o===void 0||o.forEach(B=>{this.wo.add(B?.event||"")})}),(e=this.Ai)===null||e===void 0?void 0:e.setElementSelectors)){const t=new Set;this._o.forEach(o=>{var B;(B=o.steps)===null||B===void 0||B.forEach(C=>{C?.selector&&t.add(C.selector)})}),this.Ai.setElementSelectors(t,this)}}replace(A){this._o.clear(),this.wo.clear(),this.register(A)}on(A,I){I!=null&&A.length!=0&&(this.wo.has(A)||this.wo.has(I.event))&&this._o.forEach(e=>{this.Mo(I,e)&&this.ko.emit("actionCaptured",e.name)})}Eo(A){this.onAction("actionCaptured",I=>A(I))}Mo(A,I){if(I?.steps==null)return!1;for(const e of I.steps)if(this.So(A,e))return!0;return!1}onAction(A,I){return this.ko.on(A,I)}$o(A,I){if(I?.url){var e;let B=A==null||(e=A.properties)===null||e===void 0?void 0:e.$current_url;if(!A?.properties||!("$current_url"in A.properties))try{var t,o;B=(t=this.Ai)===null||t===void 0||(o=t.getActionUrl)===null||o===void 0?void 0:o.call(t)}catch{return!1}if(!B||typeof B!="string"||!eH(B,I.url,I.url_matching||"contains"))return!1}return!0}Co(A,I){return!!this.Po(A,I)&&!!this.Ro(A,I)&&!!this.Ao(A,I)}Po(A,I){var e;if(!I?.href)return!0;const t=this.Fo(A);if(t.length>0)return t.some(B=>eH(B.href,I.href,I.href_matching||"exact"));const o=(A==null||(e=A.properties)===null||e===void 0?void 0:e.$elements_chain)||"";return!!o&&eH((function(B){const C=B.match(/(?::|")href="(.*?)"/);return C?C[1]:""})(o),I.href,I.href_matching||"exact")}Ro(A,I){var e;if(!I?.text)return!0;const t=this.Fo(A);if(t.length>0)return t.some(i=>eH(i.text,I.text,I.text_matching||"exact")||eH(i.$el_text,I.text,I.text_matching||"exact"));const o=(A==null||(e=A.properties)===null||e===void 0?void 0:e.$elements_chain)||"";return!!o&&(B=(function(i){const E=[],n=/(?::|")text="(.*?)"/g;let s;for(;!rC(s=n.exec(i));)E.includes(s[1])||E.push(s[1]);return E})(o),C=I.text,Q=I.text_matching||"exact",B.some(i=>eH(i,C,Q)));var B,C,Q}Ao(A,I){var e,t;if(!I?.selector)return!0;const o=A==null||(e=A.properties)===null||e===void 0?void 0:e.$element_selectors;if(o?.includes(I.selector))return!0;const B=(A==null||(t=A.properties)===null||t===void 0?void 0:t.$elements_chain)||"";if(I.selector_regex&&B)try{return new RegExp(I.selector_regex).test(B)}catch{}return!1}Fo(A){var I;return(A==null||(I=A.properties)===null||I===void 0?void 0:I.$elements)==null?[]:A?.properties.$elements}To(A,I){return!I?.properties||I.properties.length===0||$yg(I.properties.reduce((e,t)=>{const o=aB(t.value)?t.value.map(String):t.value!=null?[String(t.value)]:[];return e[t.key]={values:o,operator:t.operator||"exact"},e},{}),A?.properties)}},EXI=class{constructor(A,I){this.Oo=I,this.Do=[],this.Ai=A,this.Lo=new Map,this.No=new Map,this.qo=new Map}jo(){var A,I;this.Bo=(A=(I=this.Ai).subscribeSession)===null||A===void 0?void 0:A.call(I,e=>this.zo(e))}Ho(A){return!1}Uo(){return null}Wo(A){}Vo(){}Go(A,I){return!!A&&$yg(A.propertyFilters,I?.properties)}Qo(A,I){const e=new Map;return A.forEach(t=>{var o;(o=t.conditions)===null||o===void 0||(o=o[I])===null||o===void 0||(o=o.values)===null||o===void 0||o.forEach(B=>{if(B?.name){const C=e.get(B.name)||[];C.push(t.id),e.set(B.name,C)}})}),e}Zo(A,I,e){const t=(e===fV.Activation?this.Lo:this.No).get(A);let o=[];return this.Jo(B=>{o=B.filter(C=>t?.includes(C.id))}),o.filter(B=>{var C;const Q=(C=B.conditions)===null||C===void 0||(C=C[e])===null||C===void 0||(C=C.values)===null||C===void 0?void 0:C.find(i=>i.name===A);return this.Go(Q,I)})}register(A){this.Ko(A,!1)}replace(A){this.Ko(A,!0)}Ko(A,I){Le(this.Ai.subscribeCapture)||(this.Xo(A,I),this.Yo(A,I))}Yo(A,I){const e=A.filter(B=>{var C;return(C=B.conditions)===null||C===void 0||(C=C.actions)===null||C===void 0||(C=C.values)===null||C===void 0?void 0:C.length});var t;if(I&&this.qo.clear(),e.length===0)return void(I&&((t=this.ta)===null||t===void 0||t.replace([])));this.ta||(this.ta=new iXI(this.Ai),this.ta.init(),this.ta.Eo(B=>this.onAction(B)));const o=[];e.forEach(B=>{var C;(C=B.conditions)===null||C===void 0||(C=C.actions)===null||C===void 0||C.values.forEach(Q=>{if(o.push(Q),Q.name){var i;const E=(i=this.qo.get(Q.name))!==null&&i!==void 0?i:[];E.includes(B.id)||E.push(B.id),this.qo.set(Q.name,E)}})}),I?this.ta.replace(o):this.ta.register(o)}ea(A,I){I.forEach((e,t)=>{var o;const B=(o=A.get(t))!==null&&o!==void 0?o:[];e.forEach(C=>{B.includes(C)||B.push(C)}),A.set(t,B)})}Xo(A,I){var e,t,o;const B=A.filter(E=>{var n,s;return((n=E.conditions)===null||n===void 0?void 0:n.events)&&((s=E.conditions)===null||s===void 0||(s=s.events)===null||s===void 0||(s=s.values)===null||s===void 0?void 0:s.length)>0}),C=A.filter(E=>{var n,s;return((n=E.conditions)===null||n===void 0?void 0:n.cancelEvents)&&((s=E.conditions)===null||s===void 0||(s=s.cancelEvents)===null||s===void 0||(s=s.values)===null||s===void 0?void 0:s.length)>0}),Q=this.Qo(A,fV.Activation),i=this.Qo(A,fV.Cancellation);I?(this.Lo=Q,this.No=i):(this.ea(this.Lo,Q),this.ea(this.No,i)),(B.length!==0||C.length!==0||A.some(E=>{var n;return(n=E.conditions)===null||n===void 0||(n=n.actions)===null||n===void 0||(n=n.values)===null||n===void 0?void 0:n.length}))&&((e=this.Io)!==null&&e!==void 0||(this.Io=(t=(o=this.Ai).subscribeCapture)===null||t===void 0?void 0:t.call(o,(E,n)=>{this.onEvent(E,n)})))}onEvent(A,I){var e,t;const o=this.ia(),B=(I==null||(e=I.properties)===null||e===void 0?void 0:e.$survey_id)||(I==null||(t=I.properties)===null||t===void 0?void 0:t.$product_tour_id);if(B&&this.getActivatedIds().includes(B)){const Q=this.na(A,B,I);if(Q==="consume")return o.info("event consumed activated item, removing it",{event:A,itemId:B}),void this.sa([B]);if(Q==="persist")return o.info("shown item promoted to persisted activation",{event:A,itemId:B}),this.ra(B),void this.oa([B])}if(this.No.has(A)){const Q=this.Zo(A,I,fV.Cancellation);Q.length>0&&(o.info("cancel event matched, cancelling items",{event:A,itemsToCancel:Q.map(i=>i.id)}),this.sa(Q.map(i=>i.id)),Q.forEach(i=>this.aa(i.id)))}if(!this.Lo.has(A))return;o.info("event name matched",{event:A,eventPayload:I,items:this.Lo.get(A)});const C=this.Zo(A,I,fV.Activation);this.la(C.map(Q=>Q.id))}onAction(A){this.qo.has(A)&&this.la(this.qo.get(A)||[])}la(A){if(A.length===0)return;const I=!!this.Ai.getSessionId(),e=[];for(const t of A)I&&this.Ho(t)?this.ra(t)&&this.ua(t):e.push(t);e.length>0&&(this.Do=[...new Set([...this.Do,...e])]),this.ia().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.ca()}ra(A){this.Do=this.Do.filter(e=>e!==A);const I=this.ha();return!I.includes(A)&&(this.da([...I,A]),this.va(),!0)}sa(A){const I=new Set(A);this.Do=this.Do.filter(o=>!I.has(o));const e=this.fa(),t=e.filter(o=>!I.has(o));t.length!==e.length&&(this.da(t),t.length===0&&this.pa()),this.oa(A),this.ca()}ca(){try{var A;(A=this.Oo)===null||A===void 0||A.call(this)}catch(I){this.ia().error("Error while handling activated items change",I)}}ga(){const A=this.Uo();if(!A)return{};const I=this.Ai.getProperty(A);return I&&typeof I=="object"?I:{}}ua(A){if(!this.Uo())return;const I=this.ga();this.Wo(QI(QI({},I),{},{[A]:Date.now()}))}oa(A){if(!this.Uo())return;const I=this.ga(),e={};let t=!1;for(const[o,B]of Object.entries(I))A.includes(o)?t=!0:e[o]=B;t&&(_p(e)?this.Vo():this.Wo(e))}ma(){this.Uo()&&this.Vo()}getActivationTimestamp(A){if(!this.ha().includes(A))return;const I=this.ga()[A];return $h(I)?I:void 0}fa(){const A=this.ya();return this.Ai.getProperty(A)||[]}ha(){const A=this.fa();if(A.length===0)return[];const I=this.Ai.getProperty(this.ba()),e=this.Ai.getSessionId();return e&&I===e?A:[]}va(){const A=this.Ai.getSessionId();A&&this._a(A)}pa(){this.wa()}zo(A){const I=this.Ai.getProperty(this.ba());if(I&&I!==A){const e=this.fa(),t=this.ga();e.length>0&&(this.da([]),e.filter(o=>$h(t[o])).forEach(o=>this.aa(o))),this.pa(),this.ma(),e.length>0&&this.ca()}}getActivatedIds(){return[...new Set([...this.ha(),...this.Do])].filter(A=>!this.ka(A))}dispose(){var A,I,e;(A=this.Bo)===null||A===void 0||A.call(this),this.Bo=void 0,(I=this.Io)===null||I===void 0||I.call(this),this.Io=void 0,(e=this.ta)===null||e===void 0||e.dispose(),this.ta=void 0}reset(){this.Do=[],this.fa().length>0&&this.da([]),this.pa(),this.ma(),this.ca()}getEventToItemsMap(){return this.Lo}Sa(){return this.ta}},nXI=class extends EXI{constructor(A,I,e,t){var o;super({subscribeCapture(B){const C=A.onEvent(Q=>B(Q.event,Q));return()=>C.dispose()},subscribeSession(B){const C=A.onSession(B);return()=>C.dispose()},getSessionId(){var B;return(B=A.session)===null||B===void 0?void 0:B.sessionId},getProperty:B=>A.kv.get(B),getActionUrl:e?.getActionUrl,setElementSelectors:(o=e?.setElementSelectors)!==null&&o!==void 0?o:(B,C)=>{var Q;return(Q=A.getExtension("autocapture"))===null||Q===void 0?void 0:Q.setElementSelectors(B,C)}},t),this.xa=A,this.$a=I,this.jo()}ya(){return iRA}ba(){return KCA}Uo(){return LCA}Wo(A){this.xa.kv.set({[LCA]:A})}Vo(){this.xa.kv.remove(LCA)}Ho(A){var I;let e;this.Jo(o=>{e=o.find(B=>B.id===A)});const t=e==null||(I=e.appearance)===null||I===void 0?void 0:I.surveyPopupDelaySeconds;return $h(t)&&t>0}Ca(){return mM.SHOWN}Jo(A){this.$a.getSurveys(A)}aa(A){this.$a.cancelPendingSurvey(A)}ia(){return yn}da(A){this.xa.kv.set({[iRA]:A})}_a(A){this.xa.kv.set({[KCA]:A})}wa(){this.xa.kv.remove(KCA)}ka(){return!1}na(A,I,e){var t;if(A===mM.SENT&&(e==null||(t=e.properties)===null||t===void 0?void 0:t.$survey_completed)===!1)return"ignore";let o;return this.Jo(B=>{o=B.find(C=>C.id===I)}),!o||(function(B){var C;return zyg(B)&&!!(!((C=B.conditions)===null||C===void 0||(C=C.events)===null||C===void 0)&&C.repeatedActivation)||B.schedule==="always"})(o)?A===mM.SHOWN?"consume":"ignore":A===mM.SHOWN?"persist":A===mM.DISMISSED||A===mM.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}};const cNA=(g,A)=>g?.then?g.then(A):A(g),tH="SDK is not enabled or survey functionality is not yet loaded",dwg="Disabled. Not loading surveys.";var sXI=class{constructor(A){this.Ta=A,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ia=!1,this.Ma=!1,this.Ea=[],this.Pa=[],this.Ra=null,this.Aa=null,this.Ci=!1,this.Fa=new Set,this.onRemoteConfig=I=>{if(this.Ci||this.Ar.disableSurveys)return;if(!I.ok)return this.Ma=!0,this.Oa({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),yn.warn("Remote config unavailable. Not loading surveys.");const e=I.config.surveys;if(rC(e))return yn.warn("Flags not loaded yet. Not loading surveys.");this.Da=gm(e)?e:e.length>0,yn.info(`flags response received, isSurveysEnabled: ${this.Da}`),this.loadIfEnabled()},this.Oa=I=>{this.Pa.slice().forEach(e=>this.La(e,I))}}setup(A){if(!this.Ci)return this.Na=A,cNA(A.kv.initialize(),()=>{if(this.Na!==A||this.Ci)return;this.Na=void 0,this.xa=A;const I=A.onRemoteConfig(this.onRemoteConfig);this.Ci?I.dispose():(this.qa=I,this.loadIfEnabled())})}dispose(){var A,I,e,t,o;this.Ci||(this.Ci=!0,this.Na=void 0,this.xa=void 0,(A=this.qa)===null||A===void 0||A.dispose(),this.qa=void 0,(I=this._surveyEventReceiver)===null||I===void 0||I.dispose(),this._surveyEventReceiver=null,(e=this._surveyManager)===null||e===void 0||(t=e.dispose)===null||t===void 0||t.call(e),this._surveyManager=null,this.Ea=[],this.Pa.forEach(B=>{B.active=!1}),this.Pa=[],(o=this.ja)===null||o===void 0||o.call(this),this.ja=void 0,this.Ra=null,this.Fa.forEach(B=>clearTimeout(B)),this.Fa.clear())}get Ar(){return this.Ta.get()}getRenderContext(){if(!this.xa)return;const A=this;return{client:this.xa,get config(){return A.Ar},surveys:A}}initialize(){this.loadIfEnabled()}reset(){var A,I;(A=this._surveyManager)===null||A===void 0||(I=A.clearInMemoryInProgressSurveyState)===null||I===void 0||I.call(A);try{var e;(e=this._surveyEventReceiver)===null||e===void 0||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let o=0;o<localStorage.length;o++){const B=localStorage.key(o);(B?.startsWith("seenSurvey_")||B?.startsWith("inProgressSurvey_"))&&t.push(B)}t.forEach(o=>localStorage.removeItem(o))}catch{}this.Oa()}loadIfEnabled(){if(this.Ci||!this.xa)return;const A=this.Ar;if(this._surveyManager)return;if(this.Ia)return void yn.info("Already initializing surveys, skipping...");if(A.disableSurveys)return void yn.info(dwg);if(A.cookielessMode&&this.xa.isOptedOut)return void yn.info("Not loading surveys in cookieless mode without consent.");const I=this.Ta.getExtensions();if(!I)return void this.Ba("PostHog Extensions not found.");if(Le(this.Da)&&!A.advancedEnableSurveys)return;const e=this.Da||A.advancedEnableSurveys;this.Ia=!0,this.Ma=!1;try{const t=I.generateSurveys;if(t)return this.za(t,e),void(this.Ia=!1);const o=I.loadExternalDependency;if(!o)return this.Ba(QRA),void(this.Ia=!1);o(B=>{try{if(this.Ci)return;const C=this.Ta.getExtensions();B||!C?.generateSurveys?this.Ba("Could not load surveys script",B):this.za(C.generateSurveys,e)}finally{this.Ia=!1}})}catch(t){throw this.Ia=!1,this.Ba("Error initializing surveys",t),t}}za(A,I){var e;if(this.Ci)return;this._surveyManager=A(I),this._surveyEventReceiver=this.Ha(this.xa,this.Oa);const t=(e=this.xa)===null||e===void 0?void 0:e.kv.get(lV);t&&this.Ua(t),yn.info("Surveys loaded successfully"),this.Wa(),this.Oa(),this.Va({isLoaded:!0})}Ha(A,I){return new nXI(A,this,void 0,I)}Ba(A,I){this.Ma=!0,yn.error(A,I),this.Oa({isLoaded:!1,error:A}),this.Va({isLoaded:!1,error:A})}onSurveysLoaded(A){return this.Ea.push(A),this._surveyManager&&this.Va({isLoaded:!0}),()=>{this.Ea=this.Ea.filter(I=>I!==A)}}getSurveys(A,I=!1){if(this.Ci)return;const e=this.xa;if(!e)return A([],{isLoaded:!1,error:tH});if(this.Ar.disableSurveys)return yn.info(dwg),A([]);const t=e.kv.get(lV);if(t&&!I)return A(t,{isLoaded:!0}),void(this.Ga()&&this.getSurveys(()=>{},!0));if(this.Ra)return void this.Ra.then(({surveys:C,context:Q})=>{this.Ci||A(C,Q)}).catch(C=>yn.error("Error in survey callback",C));const o=e.sendRequest("/api/surveys/",{method:"GET",query:{token:e.projectToken},sentAt:"query",timeoutMs:this.Ar.requestTimeoutMs}).then(C=>{try{return this.Qa(e,C)}catch(Q){return yn.error("Error processing surveys response",Q),this.Qa(e,{statusCode:0,error:Q})}},C=>this.Qa(e,{statusCode:0,error:C}));this.Ra=o;const B=()=>{this.Ra===o&&(this.Ra=null)};o.then(C=>{B(),this.Ci||(this.Oa(C.context),A(C.surveys,C.context))},B).catch(C=>yn.error("Error in survey callback",C))}Qa(A,I){if(this.Ci)return{surveys:[],context:{isLoaded:!1,error:tH}};const e=I.statusCode;if(e!==200||!I.json){const o=`Surveys API could not be loaded, status: ${e}`;return e!==0?yn.error(o):I.error||yn.warn(o),this.Aa=Date.now(),{surveys:[],context:{isLoaded:!1,error:o}}}this.Aa=null;const t=I.json.surveys||[];return A.kv.set({[lV]:t,[PCA]:Date.now()}),this.Ua(t),{surveys:t,context:{isLoaded:!0}}}Ua(A){const I=A.filter(e=>(function(t){return!(!t.start_date||t.end_date)})(e)&&(zyg(e)||(function(t){var o;return!!(!((o=t.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0)&&o.length)})(e)));this.Za(I)}Za(A){var I;(I=this._surveyEventReceiver)===null||I===void 0||I.replace(A)}Ga(){return this.Ja()&&!this.Ra&&!this.Ka()}Ja(){var A;const I=(A=this.xa)===null||A===void 0?void 0:A.kv.get(PCA);return $h(I)&&Date.now()-I>3e5}Ka(){return $h(this.Aa)&&3e5>Date.now()-this.Aa}markSurveyAsSeen(A,I){var e;const t={id:A,current_iteration:(e=I?.iteration)!==null&&e!==void 0?e:null};gwg(t);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this.Oa()}Va(A){for(const I of this.Ea){if(this.Ci)return;try{A.isLoaded?this.getSurveys(I):I([],A)}catch(e){yn.error("Error in survey callback",e)}}}getActiveMatchingSurveys(A,I=!1){if(!rC(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(A,I);yn.warn("init was not called")}onActiveMatchingSurveysChanged(A){var I;if(this.Ci)return()=>{};const e={callback:A,active:!0,revision:0};this.Pa.push(e),this.Wa();const t=(I=this.xa)===null||I===void 0?void 0:I.kv.get(lV);return this.Ar.disableSurveys||!this._surveyManager&&this.Ma&&!this.Ia||!t&&!rC(this.Aa)&&!this.Ra?this.La(e,{isLoaded:!1}):this._surveyManager&&this.La(e),()=>{var o;e.active=!1,this.Pa=this.Pa.filter(B=>B!==e),this.Pa.length===0&&((o=this.ja)===null||o===void 0||o.call(this),this.ja=void 0)}}Wa(){var A,I,e;this._surveyManager&&this.Pa.length>0&&((A=this.ja)!==null&&A!==void 0||(this.ja=(I=(e=this.Ta).onMatchingConditionsChanged)===null||I===void 0?void 0:I.call(e,this.Oa)))}La(A,I){if(this.Ci||!A.active)return;const e=++A.revision,t=o=>{if(!this.Ci&&A.active&&e===A.revision)try{const B=I??{isLoaded:!0},C=JSON.stringify([o,B]);if(C===A.lastResult)return;A.lastResult=C,A.callback(o,B)}catch(B){yn.error("Error in active matching surveys callback",B)}};try{I&&!I.isLoaded?t([]):this.getActiveMatchingSurveys(t)}catch(o){yn.error("Error in active matching surveys callback",o)}}Xa(A){let I=null;return this.getSurveys(e=>{var t;I=(t=e.find(o=>o.id===A))!==null&&t!==void 0?t:null}),I}Ya(A){if(rC(this._surveyManager))return{eligible:!1,reason:tH};const I=typeof A=="string"?this.Xa(A):A;return I?this._surveyManager.checkSurveyEligibility(I):{eligible:!1,reason:"Survey not found"}}tl(A){var I;if(!(!((I=this.xa)===null||I===void 0)&&I.canCapture))return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(rC(this._surveyManager))return{eligible:!1,reason:tH};const e=typeof A=="string"?this.Xa(A):A;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(A){if(rC(this._surveyManager))return yn.warn("init was not called"),{visible:!1,disabledReason:tH};const I=this.tl(A);return{visible:I.eligible,disabledReason:I.reason}}canRenderSurveyAsync(A,I){return rC(this._surveyManager)?(yn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:tH})):new Promise(e=>{this.getSurveys(t=>{var o;const B=(o=t.find(C=>C.id===A))!==null&&o!==void 0?o:null;if(B){const C=this.tl(B);e({visible:C.eligible,disabledReason:C.reason})}else e({visible:!1,disabledReason:"Survey not found"})},I)})}renderSurvey(A,I,e){var t,o,B;if(!(!((t=this.xa)===null||t===void 0)&&t.canCapture))return;if(rC(this._surveyManager))return void yn.warn("init was not called");const C=typeof A=="string"?this.Xa(A):A;if(!C?.id)return void yn.warn("Survey not found");if(!YzI.includes(C.type))return void yn.warn(`Surveys of type ${C.type} cannot be rendered in the app`);const Q=(o=typeof document>"u"?void 0:document)===null||o===void 0?void 0:o.querySelector(I);if(Q){if(!((B=C.appearance)===null||B===void 0)&&B.surveyPopupDelaySeconds){yn.info(`Rendering survey ${C.id} with delay of ${C.appearance.surveyPopupDelaySeconds} seconds`);const i=setTimeout(()=>{var E,n,s;this.Fa.delete(i),!this.Ci&&(!((E=this.xa)===null||E===void 0)&&E.canCapture)&&(yn.info(`Rendering survey ${C.id} with delay of ${(n=C.appearance)===null||n===void 0?void 0:n.surveyPopupDelaySeconds} seconds`),(s=this._surveyManager)===null||s===void 0||s.renderSurvey(C,Q,e),yn.info(`Survey ${C.id} rendered`))},1e3*C.appearance.surveyPopupDelaySeconds);return void this.Fa.add(i)}this._surveyManager.renderSurvey(C,Q,e)}else yn.warn("Survey element not found")}displaySurvey(A,I){var e,t;if(!(!((e=this.xa)===null||e===void 0)&&e.canCapture))return;if(rC(this._surveyManager))return void yn.warn("init was not called");const o=this.Xa(A);if(!o)return void yn.warn("Survey not found");let B=o;if(!((t=o.appearance)===null||t===void 0)&&t.surveyPopupDelaySeconds&&I.ignoreDelay&&(B=QI(QI({},o),{},{appearance:QI(QI({},o.appearance),{},{surveyPopupDelaySeconds:0})})),I.displayType!==ORA.Popover&&I.initialResponses&&yn.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),I.ignoreConditions===!1){const C=this.Ya(o);if(!C.eligible)return void yn.warn("Survey is not eligible to be displayed: ",C.reason)}I.displayType!==ORA.Inline?this._surveyManager.handlePopoverSurvey(B,I):this.renderSurvey(B,I.selector,I.properties)}cancelPendingSurvey(A){rC(this._surveyManager)?yn.warn("init was not called"):this._surveyManager.cancelSurvey(A)}handlePageUnload(){var A,I;(A=this._surveyManager)===null||A===void 0||(I=A.handlePageUnload)===null||I===void 0||I.call(A)}},aXI=class{constructor(A){this._instance=A}get(){var A,I,e,t;const o=(A=this._instance)===null||A===void 0?void 0:A.config;return{disableSurveys:!!o?.disable_surveys,cookielessMode:!!o?.cookieless_mode,advancedEnableSurveys:!!o?.advanced_enable_surveys,requestTimeoutMs:(I=o?.surveys_request_timeout_ms)!==null&&I!==void 0?I:1e4,prefillFromUrl:!!(!(o==null||(e=o.surveys)===null||e===void 0)&&e.prefillFromUrl),automaticDisplay:!o?.disable_surveys_automatic_display,featureFlagEvaluation:!o?.advanced_disable_feature_flags,overrideLanguage:o?.override_display_language,prepareStylesheet:o?.prepare_external_dependency_stylesheet,get_current_url:o?.get_current_url,uiHost:(t=this._instance)===null||t===void 0||(t=t.requestRouter)===null||t===void 0?void 0:t.endpointFor("ui","")}}getExtensions(){const A=FB?.__PosthogExtensions__;if(!A||!this._instance)return;const I=this._instance,{generateSurveys:e,loadExternalDependency:t}=A;return{generateSurveys:e?o=>e(I,o):void 0,loadExternalDependency:t?o=>t(I,"surveys",o):void 0}}onMatchingConditionsChanged(A){var I,e;const t=(I=this._instance)===null||I===void 0?void 0:I._addCaptureHook(Q=>{Q!=="$pageview"&&Q!==mM.SHOWN&&Q!==mM.DISMISSED&&Q!==mM.SENT||A()}),o=()=>A();GE(Me,"PHSurveyShown",o);let B=!1;const C=(e=this._instance)===null||e===void 0?void 0:e.onFeatureFlags(()=>{B&&A()});return B=!0,()=>{B=!1,t?.(),C?.(),Me?.removeEventListener("PHSurveyShown",o)}}};const rXI=Me?.location?qCA(Me.location.hash,"__posthog")||qCA(location.hash,"state"):null,ywg="_postHogToolbarParams",wwg=qr("[Toolbar]"),uwg=qr("[FeatureFlags]"),fY=qr("[FeatureFlags]",{debugEnabled:!0}),hNA=`" failed. Feature flags didn't load in time.`,cXI=[502,504],Gwg=["click","keydown","wheel","touchstart","pointerdown"],mwg="connection_error",pwg=g=>{const A={};for(let I=0;g.length>I;I++)A[g[I]]=!0;return A},kwg=g=>{const A={};for(const[I,e]of HCA(g||{}))e&&(A[I]=e);return A};var hXI=class{constructor(A){this.name="featureFlags",this.md=!1,this.featureFlagEventHandlers=[],this.$=uwg,this.yd={},this.bd={},this._d=[],this.wd=new Set,this.kd=new Set,this.Sd=!1,this.xd=!1,this.$d=0,this.Cd=!1,this.Td=!1,this.Id=!1,this.Md=!1,this.Ed=!1,this.Pd=0,this.Rd=!1,this.rn=()=>{const I=this.Ad();this.Pd=0,I&&this.reloadFeatureFlags()},this.Fd=()=>{var I,e;const t=this.Od,o=(I=this.Dd)!==null&&I!==void 0?I:t;Le(t)||Le(o)||this.Ar.remoteRequestsDisabled||!this.Ld||this.Ld.visibilityState==="hidden"||Date.now()-((e=this.Nd)!==null&&e!==void 0?e:0)<o||(this.Dd=this.Rd||!this.Ar.idleRefreshBackoff?t:Math.min(2*o,36e5),this.Rd=!1,this.reloadFeatureFlags(),this.qd())},this.jd=()=>{this.Rd&&this.Dd===this.Od||this.Bd()},this.sn=()=>{var I;((I=this.Ld)===null||I===void 0?void 0:I.visibilityState)==="visible"&&this.Bd()},this.Ta=A}get zd(){}Hd(){this.xa&&this.Ud()}setup(A){try{this.Wd=typeof window>"u"?void 0:window,this.Ld=typeof document>"u"?void 0:document}catch{this.Wd=void 0,this.Ld=void 0}return this.Na=A,this.$=A.logger.createLogger("[FeatureFlags]"),cNA(A.kv.initialize(),()=>{this.Na===A&&(this.Na=void 0,this.xa=A,this.Vd(A))})}Vd(A){var I;if(this.xa===A)return this.Wd&&GE(this.Wd,"online",this.rn),this.Ud(),this.Gd=A.registerDynamicEventProperties(()=>this.Qd()?this.yd:this.bd),this.Zd=(I=this.zd)===null||I===void 0?void 0:I.onCrossTabFeatureFlagChange(()=>{this.Jd(),this.Kd(),this.Xd()}),this.Kd(),this.initialize()}Bd(){this.Rd=!0,this.Dd=this.Od,this.Fd()}Ud(){var A;const I=this.Ar.refreshIntervalMs,e=!this.Ar.remoteRequestsDisabled&&this.Ld&&!Le(I)&&I>0?I:void 0;this.Ar.idleRefreshBackoff||(this.Dd=e),e!==this.Od&&(this.Yd(),Le(e)||(this.Od=e,this.Dd=e,this.qd(),!((A=this.Ld)===null||A===void 0)&&A.addEventListener&&(GE(this.Ld,L9,this.sn),H9(Gwg,t=>{GE(this.Ld,t,this.jd,{capture:!0})}))))}qd(){Le(this.Od)||(Le(this.tv)||clearInterval(this.tv),this.Nd=Date.now(),this.tv=setInterval(this.Fd,this.Od))}Yd(){var A,I;Le(this.tv)||(clearInterval(this.tv),this.tv=void 0,(A=this.Ld)===null||A===void 0||(I=A.removeEventListener)===null||I===void 0||I.call(A,"visibilitychange",this.sn),H9(Gwg,e=>{var t,o;(t=this.Ld)===null||t===void 0||(o=t.removeEventListener)===null||o===void 0||o.call(t,e,this.jd,{capture:!0})})),this.Od=void 0,this.Dd=void 0,this.Rd=!1,this.Nd=void 0}destroy(){this.ev()}dispose(){this.ev()}ev(){var A,I,e;this.Yd(),this.$d++,this.Td=!1,this.Na=void 0,this.iv(this.wd,"cancelled"),this.iv(this.kd,"cancelled"),this.xa&&(this.nv(),(A=this.Gd)===null||A===void 0||A.dispose(),this.Gd=void 0,(I=this.Zd)===null||I===void 0||I.call(this),this.Zd=void 0,this._d=[],(e=this.Wd)===null||e===void 0||e.removeEventListener("online",this.rn),this.xa=void 0)}get Ar(){return this.Ta.get()}sv(A){var I;return this.rv&&A in this.rv?this.rv[A]:(I=this.xa)===null||I===void 0?void 0:I.kv.get(A)}Jd(){return!!this.rv&&(this.rv=void 0,!0)}ov(){var A;return!Le((A=this.xa)===null||A===void 0?void 0:A.kv.get("$enabled_feature_flags"))&&this.Jd()}At(A){this.av(()=>{var I;return(I=this.xa)===null||I===void 0?void 0:I.kv.set(A)})}lv(A,I,e){if(!this.zd||!A.$enabled_feature_flags)return;const t=this.sv("$enabled_feature_flags")||{},o=A.$enabled_feature_flags||{},B=I.flags||I.featureFlags,C=I.flags?Object.entries(I.flags).filter(([,l])=>!l?.failed).map(([l])=>l):[],Q=!!I.errorsWhileComputingFlags&&!!I.flags,i=Q?C:e&&!aB(B)?Object.keys(B||{}):Array.from(new Set([...Object.keys(t),...Object.keys(o)])),E=this.sv("$feature_flag_payloads")||{},n=A.$feature_flag_payloads||{},s=Q||e?i:Array.from(new Set([...Object.keys(E),...Object.keys(n)])),r=!Q&&!e,a=!!r||i,c=!!r||s,h={[vF]:a,[xf]:a,[O4]:c};A.$feature_flag_details&&(h[wY]=a);for(const l of[uY,q4,cV])Le(A[l])||(h[l]=!0);this.zd.markCrossTabFeatureFlagChanges(h)}Pt(A){this.av(()=>{var I;return(I=this.xa)===null||I===void 0?void 0:I.kv.remove(A)})}av(A){try{A()}catch(I){this.$.error("Failed to update feature flag persistence",I)}}Kd(){const A={};for(const t of[vF,O4,uY,UN]){const o=this.sv(t);Le(o)||(A[t]=o)}this.yd=A;const I=QI({},A),e=this.sv(xf);if(e)for(const[t,o]of Object.entries(e))I[`$feature/${t}`]=o;this.bd=I}Qd(){const A=this.Ar.cacheTtlMs;if(!A||0>=A)return!1;const I=this.sv(q4);return typeof I!="number"||Date.now()-I>A}uv(){return!!this.Qd()&&(this.Ed||this.xd||(this.Ed=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hv(){const A=this.Ar.evaluationContexts;return A?.length?A.filter(I=>{const e=I&&typeof I=="string"&&I.trim().length>0;return e||this.$.error("Invalid evaluation context found:",I,"Expected non-empty string"),e}):[]}dv(){const A=this.Ar.flagKeys;if(!Le(A))return A.filter(I=>{const e=I&&typeof I=="string"&&I.trim().length>0;return e||this.$.error("Invalid flag key found:",I,"Expected non-empty string"),e})}initialize(){var A,I;const e=this.Ar,t=(A=(I=e.bootstrap)===null||I===void 0?void 0:I.featureFlags)!==null&&A!==void 0?A:{};if(Object.keys(t).length){var o,B;const C=(o=(B=e.bootstrap)===null||B===void 0?void 0:B.featureFlagPayloads)!==null&&o!==void 0?o:{},Q=Object.keys(t).filter(E=>!Le(t[E])).reduce((E,n)=>(E[n]=t[n],E),{}),i=Object.keys(C).filter(E=>Q[E]).reduce((E,n)=>(E[n]=C[n],E),{});return this.vv({featureFlags:Q,featureFlagPayloads:i},void 0,{persist:!1})}}updateFlags(A,I,e){var t,o;const B=e?.merge&&(t=this.sv("$enabled_feature_flags"))!==null&&t!==void 0?t:{},C=e?.merge&&(o=this.sv("$feature_flag_payloads"))!==null&&o!==void 0?o:{},Q=QI(QI({},B),A),i=QI(QI({},C),I),E={};for(const[n,s]of Object.entries(Q))E[n]={key:n,enabled:UDg(s),variant:JDg(s),reason:void 0,metadata:Le(i?.[n])?void 0:{id:0,version:void 0,description:void 0,payload:i[n]}};this.vv({flags:E})}get hasLoadedFlags(){return this.Sd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const A=this.sv(wY),I=this.sv(UN),e=this.sv(GY);if(!e&&!I)return A||{};const t=Qr({},A||{}),o=[...new Set([...Object.keys(e||{}),...Object.keys(I||{})])];for(const Q of o){var B,C;const i=t[Q],E=I?.[Q],n=Le(E)?(B=i?.enabled)!==null&&B!==void 0&&B:!!E,s=Le(E)?i?.variant:typeof E=="string"?E:void 0,r=e?.[Q],a=QI(QI({},i),{},{enabled:n,variant:n?s??i?.variant:void 0});n!==i?.enabled&&(a.original_enabled=i?.enabled),s!==i?.variant&&(a.original_variant=i?.variant),r&&(a.metadata=QI(QI({},i?.metadata),{},{payload:r,original_payload:i==null||(C=i.metadata)===null||C===void 0?void 0:C.payload})),t[Q]=a}return this.md||(this.$.warn(" Overriding feature flag details!",{flagDetails:A,overriddenPayloads:e,finalDetails:t}),this.md=!0),t}getAllFeatureFlags(){const A=this.getFlagVariants(),I=this.getFlagPayloads();return Object.keys(A).map(e=>{const t=A[e];return{key:e,enabled:UDg(t),variant:JDg(t),payload:FDg(I[e])}})}getFlagVariants(){const A=this.sv(xf),I=this.sv(UN);if(!I)return A||{};const e=Qr({},A||{}),t=Object.keys(I);for(let o=0;t.length>o;o++)e[t[o]]=I[t[o]];return this.md||(this.$.warn(" Overriding feature flags!",{enabledFlags:A,overriddenFlags:I,finalFlags:e}),this.md=!0),e}getFlagPayloads(){const A=this.sv(O4),I=this.sv(GY);if(!I)return A||{};const e=Qr({},A||{}),t=Object.keys(I);for(let o=0;t.length>o;o++)e[t[o]]=I[t[o]];return this.md||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:A,overriddenPayloads:I,finalPayloads:e}),this.md=!0),e}reloadFeatureFlags(){this.Cd||this.Ar.featureFlagsDisabled||this.Ad()||(this.Id&&this.$.warn("reloadFeatureFlags() was called inside an onFeatureFlags callback. This callback also runs when flags change in other tabs, so this can cause a request loop."),this.xd&&(this.Td=!0),this.fv||(this._d.slice().forEach(A=>{try{A()}catch(I){this.$.error("Error while running feature flags reloading callback",I)}}),this.fv=setTimeout(()=>{this.pv()},5)))}reloadFeatureFlagsAsync(){return!this.xa||this.Cd||this.Ar.featureFlagsDisabled||this.Ar.remoteRequestsDisabled||this.Ad()?Promise.resolve({status:"skipped"}):new Promise(A=>{this.wd.add(A),this.reloadFeatureFlags()})}iv(A,I){A.forEach(e=>e({status:I})),A.clear()}nv(){clearTimeout(this.fv),this.fv=void 0}onReloading(A){return this._d.push(A),()=>{this._d=this._d.filter(I=>I!==A)}}ensureFlagsLoaded(){this.Sd||this.xd||this.fv||this.reloadFeatureFlags()}setAnonymousDistinctId(A){this.$anon_distinct_id=A}setReloadingPaused(A){this.Cd=A}resetFlagCallReported(){this.Pt(qF)}pv(A){var I;this.nv();const e=this.xa;if(!e||this.Ar.remoteRequestsDisabled||this.Ad())return void this.iv(this.wd,"skipped");if(this.xd)return void(this.Td=!0);const t={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:QI(QI(QI({},e.initialPersonProperties),this.sv("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.sv(T4),timezone:Qyg()};Le(e.deviceId)||(t.$device_id=e.deviceId),(A?.disableFlags||this.Ar.featureFlagsDisabled)&&(t.disable_flags=!0);const o=this.hv();o.length&&(t.evaluation_contexts=o);const B=this.dv();Le(B)||(t.flag_keys=B);const C=this.Ar.onlyEvaluateSurveyFeatureFlags,Q="/flags/?v=2"+(C?"&only_evaluate_survey_feature_flags=true":""),i=this.$d,E=this.wd;this.wd=new Set,this.kd=E,this.xd=!0;const n=()=>{this.Td&&(this.Td=!1,this.pv())},s=l=>{var D,d;const y=(D=l.json)!==null&&D!==void 0?D:{},w=l.statusCode!==200;if(this.xd=!1,i!==this.$d)return void n();if(this.gv(l.statusCode),w||this.Td||(this.$anon_distinct_id=void 0),t.disable_flags&&!this.Td)return void this.iv(E,"skipped");this.Md=!w;const u=[];l.error?u.push(l.error instanceof Error&&l.error.name==="AbortError"?"timeout":l.error instanceof Error?mwg:"unknown_error"):l.statusCode!==200&&u.push(`api_error_${l.statusCode}`),y.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");const G=!!(!((d=y.quotaLimited)===null||d===void 0)&&d.includes("feature_flags"));G&&u.push("quota_limited"),this.At({[rV]:u}),G?this.$.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."):t.disable_flags||this.vv(y,w,{partialResponse:C}),this.iv(E,t.disable_flags?"skipped":u.length||!y.flags&&!y.featureFlags?"error":"loaded"),n()},r=l=>{this.xd=!1,i===this.$d&&(this.At({[rV]:[mwg]}),this.$.error("Feature flag request failed",l),this.ov()&&this.Xd(!0),this.iv(E,"error")),n()};let a=(I=this.Ar.requestMaxRetries)!==null&&I!==void 0?I:1;const c=()=>a>0&&i===this.$d,h=()=>{if(i!==this.$d||!this.xa||this.Ar.remoteRequestsDisabled)return this.xd=!1,this.iv(E,"skipped"),void n();try{e.sendRequest(Q,{target:"flags",method:"POST",body:t,compression:this.Ar.compression,sentAt:"body",timeoutMs:this.Ar.requestTimeoutMs}).then(l=>{if((D=>cXI.includes(D.statusCode)||(d=>d.statusCode===0&&d.error instanceof Error&&d.error.name==="AbortError")(D))(l)&&c())return a--,void setTimeout(h,500);s(l)}).catch(r)}catch(l){r(l)}};h()}Ad(){return Eyg(this.Pd,3)}gv(A){this.Pd=nyg(A,this.Pd,3,()=>this.$.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(A,I={}){var e;if(I.fresh&&!this.Md)return;if(!(this.Sd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+A+hNA);if(this.uv())return;const t=this.getFeatureFlagResult(A,I);return(e=t?.variant)!==null&&e!==void 0?e:t?.enabled}getFeatureFlagDetails(A){return this.getFlagsWithDetails()[A]}getFeatureFlagPayload(A){const I=this.getFeatureFlagResult(A,{send_event:!1});return I?.payload}getFeatureFlagResult(A,I={}){if(I.fresh&&!this.Md)return;if(!(this.Sd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+A+hNA);if(this.uv())return;const e=this.getFlagVariants(),t=A in e,o=e[A],B=this.getFlagPayloads()[A],C=String(o),Q=this.sv("$feature_flag_request_id")||void 0,i=this.sv("$feature_flag_evaluated_at")||void 0;let E,n=this.sv("$flag_call_reported")||{};if(this.Ar.deduplicateCallsPerSession){var s;const R=(s=this.xa)===null||s===void 0||(s=s.session)===null||s===void 0?void 0:s.sessionId,x=this.sv(hV);R&&R!==x&&(n={},E=R)}if(!I.send_event&&"send_event"in I)E&&this.At({[qF]:n,[hV]:E});else{var r,a;const R=(r=this.xa)===null||r===void 0?void 0:r.canCapture;if(!R&&Object.keys(n).length>0&&(n={},this.At({[qF]:n})),R&&!(!((a=n[A])===null||a===void 0)&&a.includes(C))){var c,h,l,D,d,y,w,u,G,m,p,k,S;aB(n[A])?n[A].push(C):n[A]=[C],this.At(QI({[qF]:n},E?{[hV]:E}:{}));const x=this.getFeatureFlagDetails(A),N=[...(c=this.sv("$feature_flag_errors"))!==null&&c!==void 0?c:[]];Le(o)&&N.push("flag_missing");const U={$feature_flag:A,$feature_flag_response:o,$feature_flag_payload:B??null,$feature_flag_request_id:Q,$feature_flag_evaluated_at:i,$feature_flag_bootstrapped_response:(h=(l=this.Ar.bootstrap)===null||l===void 0||(l=l.featureFlags)===null||l===void 0?void 0:l[A])!==null&&h!==void 0?h:null,$feature_flag_bootstrapped_payload:(D=(d=this.Ar.bootstrap)===null||d===void 0||(d=d.featureFlagPayloads)===null||d===void 0?void 0:d[A])!==null&&D!==void 0?D:null,$used_bootstrap_value:!this.Md};Le(x==null||(y=x.metadata)===null||y===void 0?void 0:y.has_experiment)||(U.$feature_flag_has_experiment=x.metadata.has_experiment),Le(x==null||(w=x.metadata)===null||w===void 0?void 0:w.version)||(U.$feature_flag_version=x.metadata.version);const K=(u=x==null||(G=x.reason)===null||G===void 0?void 0:G.description)!==null&&u!==void 0?u:x==null||(m=x.reason)===null||m===void 0?void 0:m.code;K&&(U.$feature_flag_reason=K),!(x==null||(p=x.metadata)===null||p===void 0)&&p.id&&(U.$feature_flag_id=x.metadata.id),Le(x?.original_variant)&&Le(x?.original_enabled)||(U.$feature_flag_original_response=Le(x.original_variant)?x.original_enabled:x.original_variant),!(x==null||(k=x.metadata)===null||k===void 0)&&k.original_payload&&(U.$feature_flag_original_payload=x==null||(S=x.metadata)===null||S===void 0?void 0:S.original_payload),N.length&&(U.$feature_flag_error=N.join(",")),this.mv(U)}else E&&this.At({[qF]:n,[hV]:E})}return t?{key:A,enabled:!!o,variant:typeof o=="string"?o:void 0,payload:FDg(B)}:void 0}mv(A){try{var I;(I=this.xa)===null||I===void 0||I.capture("$feature_flag_called",A)}catch(e){this.$.error("Failed to capture feature flag call",e)}}getRemoteConfigPayload(A,I){this.yv(A,I)}yv(A,I){var e=this;return oa(function*(){const t=e.xa;if(!t)return;const o={distinct_id:t.distinctId,token:t.projectToken,person_properties:{$lib:t.library.name,$lib_version:t.library.version}},B=e.hv();B.length&&(o.evaluation_contexts=B);const C=e.dv();let Q;Le(C)||(o.flag_keys=C);try{var i;const E=(i=(yield t.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:o,compression:e.Ar.compression,sentAt:"body",timeoutMs:e.Ar.requestTimeoutMs})).json)===null||i===void 0?void 0:i.featureFlagPayloads;Q=E?.[A]||void 0}catch(E){return void e.$.error("Remote config feature flag request failed",E)}try{I(Q)}catch(E){e.$.error("Remote config feature flag callback failed",E)}})()}isFeatureEnabled(A,I={}){if(I.fresh&&!this.Md)return I.defaultValue;if(!(this.Sd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+A+hNA),I.defaultValue;const e=this.getFeatureFlag(A,I);return Le(e)?I.defaultValue:!!e}addFeatureFlagsHandler(A){this.featureFlagEventHandlers.push(A)}removeFeatureFlagsHandler(A){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(I=>I!==A)}receivedFeatureFlags(A,I,e){this.vv(A,I,e)}vv(A,I,e){if(!this.xa)return;this.Sd=!0;const t=((o,B={},C={},Q={},i,E=uwg)=>{const n=((y,w)=>{const u=y.flags;if(u){const G=Object.fromEntries(Object.keys(u).map(p=>{var k;return[p,(k=u[p].variant)!==null&&k!==void 0?k:u[p].enabled]})),m=Object.fromEntries(Object.keys(u).filter(p=>u[p].enabled).filter(p=>{var k;return!Le((k=u[p].metadata)===null||k===void 0?void 0:k.payload)}).map(p=>{var k;return[p,(k=u[p].metadata)===null||k===void 0?void 0:k.payload]}));return QI(QI({},y),{},{featureFlags:G,featureFlagPayloads:m})}return y.featureFlags&&w.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),y})(o,E),s=n.flags,r=n.featureFlags,a=n.featureFlagPayloads;if(!r)return;const c=o.requestId,h=o.evaluatedAt;if(aB(r)){E.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const y={};if(r)for(let w=0;r.length>w;w++)y[r[w]]=!0;return{[vF]:r,[xf]:y,[cV]:!1}}let l=r,D=a,d=s;if(i?.partialResponse){const y=Object.keys(l),w=D||{};l=QI(QI({},B),l),D=QI(QI({},C),w),y.forEach(u=>{u in w||D==null||delete D[u]}),d=QI(QI({},Q),d)}else if(o.errorsWhileComputingFlags)if(s){const y=new Set(Object.keys(s).filter(u=>{var G;return!(!((G=s[u])===null||G===void 0)&&G.failed)}));l=QI(QI({},B),Object.fromEntries(Object.entries(l).filter(([u])=>y.has(u))));const w=Object.fromEntries(Object.entries(D||{}).filter(([u])=>y.has(u)));D=QI(QI({},C),w),y.forEach(u=>{u in w||D==null||delete D[u]}),d=QI(QI({},Q),Object.fromEntries(Object.entries(d||{}).filter(([u])=>y.has(u))))}else l=QI(QI({},B),l),D=QI(QI({},C),D),d=QI(QI({},Q),d);return QI(QI({[vF]:Object.keys(kwg(l)),[xf]:l||{},[O4]:D||{},[wY]:d||{},[cV]:o.minimalFlagCalledEvents===!0},c?{[uY]:c}:{}),h?{[q4]:h}:{})})(A,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.$);if(t)if(e?.persist===!1){const o=!Le(this.xa.kv.get(xf));this.rv=t,o||this.At(t)}else this.Jd(),this.lv(t,A,!!e?.partialResponse),this.At(t);else I&&this.ov();I||(this.Ed=!1),this.Xd(I)}override(A,I=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:A,suppressWarning:I})}overrideFeatureFlags(A){this.bv(A)}bv(A){if(this.xa){if(A===!1)return this.Pt([UN,GY]),this.Xd(),void fY.info("All overrides cleared");if(aB(A))return this.At({[UN]:pwg(A)}),this.Xd(),void fY.info("Flag overrides set",{flags:A});if(A&&typeof A=="object"&&("flags"in A||"payloads"in A)){var I;const e=A;this.md=!!((I=e.suppressWarning)!==null&&I!==void 0&&I);const t={},o=e.flags,B=e.payloads;return o&&(t[UN]=aB(o)?pwg(o):o),B&&(t[GY]=B),Object.keys(t).length&&this.At(t),o===!1&&B===!1?this.Pt([UN,GY]):o===!1?this.Pt(UN):B===!1&&this.Pt(GY),this.Xd(),o===!1?fY.info("Flag overrides cleared"):o&&fY.info("Flag overrides set",{flags:o}),void(B===!1?fY.info("Payload overrides cleared"):B&&fY.info("Payload overrides set",{payloads:B}))}if(A&&typeof A=="object")return this.At({[UN]:A}),this.Xd(),void fY.info("Flag overrides set",{flags:A});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:A})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(A){if(this.addFeatureFlagsHandler(A),this.Sd){const{flags:I,flagVariants:e}=this._v();try{A(I,e)}catch(t){this.$.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(A)}updateEarlyAccessFeatureEnrollment(A,I,e){var t;const o=(this.sv("$early_access_features")||[]).find(E=>E.flagKey===A),B={[`$feature_enrollment/${A}`]:I},C={$feature_flag:A,$feature_enrollment:I,$set:B};o&&(C.$early_access_feature_name=o.name),e&&(C.$feature_enrollment_stage=e);const Q=QI(QI({},this.getFlagVariants()),{},{[A]:I});(t=this.zd)===null||t===void 0||t.markCrossTabFeatureFlagChanges({$active_feature_flags:[A],$enabled_feature_flags:[A],$stored_person_properties:Object.keys(B)}),this.At({[vF]:Object.keys(kwg(Q)),[xf]:Q,[Z4]:QI(QI({},this.sv("$stored_person_properties")||{}),B)}),this.Xd();try{var i;(i=this.xa)===null||i===void 0||i.capture("$feature_enrollment_update",C)}catch(E){this.$.error("Failed to capture early access feature enrollment",E)}}getEarlyAccessFeatures(A,I=!1,e){const t=this.sv(CRA);!t||I?this.wv(A,e):A(t)}wv(A,I){var e=this;return oa(function*(){const t=e.xa;if(!t)return;const o=I?`&${I.map(C=>`stage=${C}`).join("&")}`:"";let B;try{const C=yield t.sendRequest(`/api/early_access_features/?token=${t.projectToken}${o}`,{target:"api",method:"GET",sentAt:"query"});if(!C.json)return;B=C.json.earlyAccessFeatures,e.At({[CRA]:B})}catch(C){return void e.$.error("Early access feature request failed",C)}try{A(B)}catch(C){e.$.error("Early access feature callback failed",C)}})()}_v(){const A=this.getFlags(),I=this.getFlagVariants();return{flags:A.filter(e=>I[e]),flagVariants:Object.keys(I).filter(e=>I[e]).reduce((e,t)=>(e[t]=I[t],e),{})}}Xd(A){this.Kd();const{flags:I,flagVariants:e}=this._v(),t=this.Id;this.Id=!0,this.featureFlagEventHandlers.forEach(o=>{try{o(I,e,{errorsLoading:A})}catch(B){this.$.error("Error while running feature flags callback",B)}}),this.Id=t}setPersonPropertiesForFlags(A,I=!0){this.Sv(A,I)}Sv(A,I=!0){const e=this.sv("$stored_person_properties")||{},t=A?.$set||(A?.$set_once?{}:A),o=A?.$set_once,B={};if(o)for(const C in o)({}).hasOwnProperty.call(o,C)&&(C in e||(B[C]=o[C]));this.At({[Z4]:QI(QI(QI({},e),B),t)}),I&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(A,I=!0){const e=QI({},this.sv("$stored_person_properties")||{});A.forEach(t=>{delete e[t]}),this.At({[Z4]:e}),I&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(A=!0){this.Pt(Z4),A&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(A,I=!0){const e=this.sv("$stored_group_properties")||{},t=QI({},e);for(const o of Object.keys(A))t[o]=QI(QI({},e[o]),A[o]);this.At({[T4]:t}),I&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(A){if(A){const I=this.sv("$stored_group_properties")||{};this.At({[T4]:QI(QI({},I),{},{[A]:{}})})}else this.Pt(T4)}reset(){this.$d++,this.iv(this.wd,"cancelled"),this.iv(this.kd,"cancelled"),this.Td=!1,this.yd={},this.bd={},this.rv=void 0,this.Sd=!1,this.Cd=!1,this.Md=!1,this.$anon_distinct_id=void 0,this.nv(),this.md=!1,this.Pd=0}};const Mwg=qr("[FeatureFlags]");var lXI=class{constructor(A,I=!1){this.xv=!1,this.update(A,I)}update(A,I){this.$v=((e,t)=>{var o,B,C,Q,i,E,n,s;return{bootstrap:{featureFlags:(o=(B=e.bootstrap)===null||B===void 0?void 0:B.featureFlags)!==null&&o!==void 0?o:void 0,featureFlagPayloads:(C=(Q=e.bootstrap)===null||Q===void 0?void 0:Q.featureFlagPayloads)!==null&&C!==void 0?C:void 0},remoteRequestsDisabled:t,featureFlagsDisabled:!!e.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!e.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!e.advanced_feature_flags_dedup_per_session,cacheTtlMs:e.feature_flag_cache_ttl_ms,refreshIntervalMs:(i=e.remote_config_refresh_interval_ms)!==null&&i!==void 0?i:3e5,idleRefreshBackoff:Le(e.remote_config_refresh_interval_ms),requestTimeoutMs:e.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(E=e.feature_flag_request_max_retries)!==null&&E!==void 0?E:1),compression:e.disable_compression?void 0:"best-available",evaluationContexts:(n=(s=e.evaluation_contexts)!==null&&s!==void 0?s:e.evaluation_environments)!==null&&n!==void 0?n:[],flagKeys:aB(e.flag_keys)?e.flag_keys:void 0}})(A,I),!A.evaluation_environments||A.evaluation_contexts||this.xv||(Mwg.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.xv=!0),Le(A.flag_keys)||aB(A.flag_keys)||Mwg.error("Invalid flag_keys found:",A.flag_keys,"Expected array of non-empty strings")}get(){return this.$v}};const Swg=g=>U9(g)&&(g.name==="RangeError"&&g.message.indexOf("Maximum call stack size exceeded")===0||g.name==="InternalError"&&g.message==="too much recursion"),Pf=qr("[Error tracking]"),lNA="webkit-masked-url:",DXI=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],dXI=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",lNA],yXI=["__firefox__","__gCrWeb"],fwg="Refusing to render web experiment since the viewer is a likely bot",wXI={icontains:(g,A)=>A.toLowerCase().indexOf(g.toLowerCase())>-1,not_icontains:(g,A)=>A.toLowerCase().indexOf(g.toLowerCase())===-1,regex:(g,A)=>$CA(A,g),not_regex:(g,A)=>!$CA(A,g),exact:(g,A)=>A===g,is_not:(g,A)=>A!==g},E2=qr("[Conversations]"),RY="Conversations not available yet.";function Rwg(g,A){var I,e,t,o,B,C,Q;const i=(I=g?.flushIntervalMs)!==null&&I!==void 0?I:3e3,E=(e=g?.maxBufferSize)!==null&&e!==void 0?e:100,n=A?.consoleCapture?void 0:(t=g?.maxLogsPerInterval)!==null&&t!==void 0?t:1e3,s=Le(n)?Math.max(E,2048):Math.max(E,n),r=QI(QI({},(function(){let a="",c="";try{var h;const l="u">typeof globalThis?globalThis:"u">typeof window?window:void 0,D=l==null||(h=l.navigator)===null||h===void 0?void 0:h.userAgent;D&&([a,c]=aDg(D))}catch{}return(function(l,D){const d=(function(y){if(y)return{}.hasOwnProperty.call(zDg,y)?zDg[y]:y})(l);return QI(QI({},d?{"os.name":d}:{}),D?{"os.version":D}:{})})(a,c)})()),g?.resourceAttributes);return{serviceName:(o=(B=r?.["service.name"])!==null&&B!==void 0?B:g?.serviceName)!==null&&o!==void 0?o:A?.serviceNameDefault,serviceVersion:(C=r?.["service.version"])!==null&&C!==void 0?C:g?.serviceVersion,environment:(Q=r?.["deployment.environment"])!==null&&Q!==void 0?Q:g?.environment,resourceAttributes:r,beforeSend:g?.beforeSend,flushIntervalMs:i,maxBufferSize:E,maxQueueSize:s,maxBatchRecordsPerPost:100,rateCapWindowMs:i,maxLogsPerInterval:n,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const uXI=["debug","log","warn","error","info"],GXI=g=>{for(;g?.__rrweb_original__;)g=g.__rrweb_original__;return g},Nwg="console",xwg="__posthogHandledLogsRequestError",DNA=(g,A)=>{const I=g instanceof Error?g:new Error(A);return I[xwg]=!0,I},Fwg=g=>!!g&&typeof g=="object"&&g[xwg]===!0;var mXI=class{get Cv(){return QI(QI({},this.$),{},{error:(...A)=>{A.some(Fwg)||this.$.error(...A)}})}constructor(A,I){var e;this.Ta=A,this.Tv=I,this.name="logs",this.Iv=!1,this.Mv=!1,this.Ev=!1,this.$=qr("[logs]"),this.Ju=[],this.Pv=[],this.Pd=0,this.Rv=!1,this.Ci=!1,this.Av=[],this.Fv=[],this.Ov=!1,this.Dv=!1,this.Lv=!1,this.Nv=()=>{var t,o;this.Ci||(this.Pd=0,(t=this.qv)===null||t===void 0||t.onReconnect(),(o=this.jv)===null||o===void 0||o.onReconnect())},this.Iv=!!(!((e=A.get())===null||e===void 0)&&e.captureConsoleLogs)}get Bv(){return!0}zv(){}Hv(){if(!this.Lv){try{this.Wd=typeof window>"u"?void 0:window}catch{this.Wd=void 0}this.Wd&&(GE(this.Wd,"online",this.Nv),this.Lv=!0)}}Uv(A,I,e,t){this.Hv();const o=Rwg(this.Ta.get(),e);return[new cjI(this.Wv(A,I),o,this.Cv,()=>this.Tv(),B=>B(),void 0,t),o]}Vv(){const A=this.Ta.get();var I;return this.qv&&this.Gv===A||((I=this.qv)===null||I===void 0||I.reset(),this.Gv=A,[this.qv,this.Qv]=this.Uv(()=>this.Ju,e=>{this.Ju=e})),this.qv}Zv(){const A=this.Ta.get();var I;return this.jv&&this.Jv===A||((I=this.jv)===null||I===void 0||I.reset(),this.Jv=A,[this.jv,this.Kv]=this.Uv(()=>this.Pv,e=>{this.Pv=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Nwg)),this.jv}setup(A){if(!this.Ci&&!this.Rv)return this.Rv=!0,this.xa=A,this.$=A.logger.createLogger("[logs]"),cNA(A.kv.initialize(),()=>{this.Ci||this.Vd(A)})}Vd(A){var I;this.Hv(),!((I=this.Ta.get())===null||I===void 0)&&I.captureConsoleLogs&&(this.Iv=!0),(this.Iv||this.Ta.remoteConfigWillArrive&&A.kv.get(this.Ta.captureHintKey))&&this.Xv();let e=!1;const t=A.onRemoteConfig(o=>{var B;e=o.ok&&((B=o.config.logs)===null||B===void 0?void 0:B.captureConsoleLogs)===!0,this.onRemoteConfig(o)});this.Ci?t.dispose():(this.qa=t,e||this.loadIfEnabled())}dispose(){var A,I,e,t,o,B,C;this.Ci||(this.Ci=!0,this.Yv(),(A=this.qa)===null||A===void 0||A.dispose(),this.qa=void 0,this.xa=void 0,this.Ev=!1,(I=this.Wd)===null||I===void 0||I.removeEventListener("online",this.Nv),(e=this.tf)===null||e===void 0||e.call(this),this.tf=void 0,(t=this.qv)===null||t===void 0||t.clearQueue(),(o=this.jv)===null||o===void 0||o.clearQueue(),(B=this.qv)===null||B===void 0||B.reset(),(C=this.jv)===null||C===void 0||C.reset())}onRemoteConfig(A){var I,e;if(this.Ci)return;const t=A.ok?(I=A.config.logs)===null||I===void 0?void 0:I.captureConsoleLogs:void 0;rC(t)?this.ef():((e=this.xa)===null||e===void 0||e.kv.set(this.Ta.captureHintKey,!!t),t?(this.Iv=!0,this.Mv||this.Xv(),this.loadIfEnabled()):this.ef())}reset(){var A,I,e,t;this.Yv(),(A=this.qv)===null||A===void 0||A.clearQueue(),this.Ju=[],(I=this.qv)===null||I===void 0||I.reset(),(e=this.jv)===null||e===void 0||e.clearQueue(),this.Pv=[],(t=this.jv)===null||t===void 0||t.reset(),this.Pd=0}captureLog(A){!this.Ci&&this.xa&&this.Vv().captureLog(A)}captureConsoleLog(A){!this.Ci&&this.xa&&this.Zv().captureLog(A)}captureBufferedConsoleLog(A,I,e){!this.Ci&&this.xa&&this.Zv().captureLog(A,{context:I,occurredAtMs:e})}gd(){var A;this.Yv(),(A=this.jv)===null||A===void 0||A.clearQueue(),this.Pv=[]}ef(){this.Iv||this.Yv()}Xv(){var A;if(this.Ov||!(!((A=this.Wd)===null||A===void 0)&&A.console))return;const I=Rwg(this.Ta.get()).maxBufferSize;let e=!0;this.Fv.push(()=>{e=!1});for(const t of uXI){let o;try{o=GXI(this.Wd.console[t])}catch{continue}o&&this.Fv.push(IH(this.Wd.console,t,B=>{const C=(...Q)=>{try{e&&this.if(t,Q,I)}catch{}return B.apply(this.Wd.console,Q)};return C.__rrweb_original__=o,C}))}this.Ov=!0,this.nf=setTimeout(()=>{this.Yv()},3e4)}if(A,I,e){var t;if(this.Ov&&!this.Dv&&I.length!==0)if(!((t=this.xa)===null||t===void 0)&&t.canCapture){if(e>this.Av.length){this.Dv=!0;try{this.Av.push({level:A,args:I,occurredAtMs:Date.now(),context:this.Tv()})}finally{this.Dv=!1}}}else this.Yv()}Yv(){if(this.Av=[],this.Ov){this.Ov=!1,this.nf&&(clearTimeout(this.nf),this.nf=void 0);for(const A of this.Fv)A();this.Fv=[]}}sf(){const A=this.Av;return this.Yv(),A}get logger(){return this.rf||(this.rf={trace:(A,I)=>this.captureLog({body:A,level:"trace",attributes:I}),debug:(A,I)=>this.captureLog({body:A,level:"debug",attributes:I}),info:(A,I)=>this.captureLog({body:A,level:"info",attributes:I}),warn:(A,I)=>this.captureLog({body:A,level:"warn",attributes:I}),error:(A,I)=>this.captureLog({body:A,level:"error",attributes:I}),fatal:(A,I)=>this.captureLog({body:A,level:"fatal",attributes:I})}),this.rf}flushLogs(A){this.xa&&(A?this.af(A):(this.qv&&this.qv.flush().catch(I=>this.lf(I)),this.jv&&this.jv.flush().catch(I=>this.lf(I))))}flush(){var A=this;return oa(function*(){var I,e;const t=(I=A.qv)===null||I===void 0?void 0:I.flush().catch(B=>A.lf(B)),o=(e=A.jv)===null||e===void 0?void 0:e.flush().catch(B=>A.lf(B));yield t,yield o})()}lf(A){Fwg(A)||this.$.error("PostHog logs flush failed:",A)}loadIfEnabled(){if(this.Ci||!this.Iv||this.Mv||this.Ev)return;const A=this.zv();if(A){this.Ev=!0;try{A((I,e)=>{if(this.Ev=!1,!this.Ci&&this.Iv)if(I||!e)this.$.error("Could not load logs script",I),this.Yv();else{const t=this.sf();this.tf=e.initialize(this.xa),this.Mv=!0,t.length>0&&e.replay(this.xa,t)}})}catch(I){throw this.Ev=!1,I}}else this.Yv()}Wv(A,I){const e=this.xa;return{get isDisabled(){return!1},get optedOut(){return!e.canCapture},getPersistedProperty:t=>t===xN.LogsQueue?A():void 0,setPersistedProperty(t,o){t===xN.LogsQueue&&I(o??[])},js:t=>this.js(t),getLibraryId:()=>e.library.name,getLibraryVersion:()=>e.library.version}}js(A){return new Promise(I=>{if(Eyg(this.Pd,3))return void I({kind:"fatal",error:DNA(void 0,"logs endpoint is unreachable, dropping batch")});let e=!1;const t=C=>{e||(e=!0,clearTimeout(o),I(C))},o=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),t({kind:"retry-later",error:DNA(void 0,"logs request timed out")})},9e4),B=this.Bv;this.xa.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.xa.projectToken},body:A,compression:"best-available",timeoutMs:6e4}).then(C=>{var Q;const i=C.statusCode;this.uf(i,B),i>=200&&300>i?t({kind:"ok"}):i===413?t({kind:"too-large"}):i!==0&&i!==408&&i!==429&&500>i?t({kind:"fatal",error:new Error(`logs request failed with status ${i}`)}):i===0?(C.error||this.$.warn("Logs request failed before receiving an HTTP response"),t({kind:"retry-later",error:DNA(C.error,"logs request failed before receiving an HTTP response")})):t({kind:"retry-later",error:(Q=C.error)!==null&&Q!==void 0?Q:new Error(`logs request failed with status ${i}`)})},C=>{t({kind:"retry-later",error:C})})})}uf(A,I){(A!==0||I)&&(this.Pd=nyg(A,this.Pd,3,()=>this.$.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.")))}af(A){this.Ju.length>0&&this.cf(A,this.Ju,this.Qv,this.xa.library.name,I=>{this.Ju=I}),this.Pv.length>0&&this.cf(A,this.Pv,this.Kv,Nwg,I=>{this.Pv=I})}cf(A,I,e,t,o){if(I.length===0)return;const B=I.map(Q=>Q.record);o([]);const C=Adg(B,$Dg(e,this.xa.library.name,this.xa.library.version),t,this.xa.library.version);this.xa.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.xa.projectToken},body:C,compression:"best-available",transport:A,timeoutMs:6e4}).catch(Q=>this.lf(Q))}};const IQA=qr("[NetworkMetrics]"),dNA=()=>{var g;return!(Me==null||(g=Me.performance)===null||g===void 0)&&g.now?Me.performance.now():Date.now()},pXI={"http:":80,"https:":443},kXI=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),Uwg=(g,A)=>{var I;const e=String(A);return{method:String(g).toUpperCase(),url:((I=ZF(e))===null||I===void 0?void 0:I.href)||e}},yNA=(g,A,I,e,t,o,B=!1)=>{try{var C,Q;const i=t();if(!i)return;const E=I||void 0,n=dNA()-e,s=ZF(A.url);if(s&&s.protocol!=="http:"&&s.protocol!=="https:")return;const r={url:s?.href||A.url,method:A.method},a=Xh(i.name)?i.name(r):UC(i.name)?i.name:"http.client.request.duration";if(!a)return;const c=B&&!E?void 0:((l,D)=>l?400>l?void 0:String(l):D?.name||"_OTHER")(E,o),h=QI(QI(QI(QI(QI({},(l=>{const D=kXI.has(l)?l:"_OTHER";return QI({"http.request.method":D},D==="_OTHER"&&l!==D?{"http.request.method_original":l}:{})})(r.method)),s?(l=>{return{"server.address":l.hostname.startsWith("[")&&l.hostname.endsWith("]")?l.hostname.slice(1,-1):l.hostname,"server.port":Number(l.port)||pXI[l.protocol],"url.scheme":l.protocol.slice(0,-1),"url.template":(D=l.pathname,D.split("/").map(d=>(y=>/^\d+$/.test(y)||y.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(y))(d)?":id":d).join("/"))};var D})(s):{}),E?{"http.response.status_code":E}:{}),c?{"error.type":c}:{}),(C=i.attributes)===null||C===void 0?void 0:C.call(i,r,{status:E,durationMs:n}));(Q=g.metrics)===null||Q===void 0||Q.histogram(a,n,{unit:"ms",attributes:h})}catch(i){IQA.error("Failed to record network metric",i)}},Jwg=()=>{},MXI=(g,A)=>Xh(Me?.fetch)?IH(Me,"fetch",I=>function(...e){const t=dNA(),o=I.apply(this,e);if(!A())return o;try{var B,C,Q;const[i,E]=e,n=Uwg((B=(C=E?.method)!==null&&C!==void 0?C:i?.method)!==null&&B!==void 0?B:"GET",(Q=i?.url)!==null&&Q!==void 0?Q:i);return o.then(s=>(yNA(g,n,s?.status,t,A,void 0,!0),s),s=>{throw yNA(g,n,void 0,t,A,s),s})}catch(i){return IQA.error("Failed to observe fetch",i),o}}):Jwg,SXI=(g,A)=>{var I;const e=Me==null||(I=Me.XMLHttpRequest)===null||I===void 0?void 0:I.prototype;if(!e)return Jwg;const t=new WeakMap,o=IH(e,"open",C=>function(...Q){try{Uyg.has(this)||t.set(this,Uwg(Q[0],Q[1]))}catch(i){IQA.error("Failed to observe XHR open",i)}return C.apply(this,Q)}),B=IH(e,"send",C=>function(...Q){let i;try{const E=t.get(this);if(E&&A()){const n=dNA();i=()=>{this.removeEventListener("loadend",i),yNA(g,E,this.status,n,A)},GE(this,"loadend",i)}}catch(E){IQA.error("Failed to observe XHR send",E)}try{return C.apply(this,Q)}catch(E){throw i&&this.removeEventListener("loadend",i),E}});return()=>{o(),B()}},Pwg=new WeakMap,fXI=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),RXI={maxStringLength:2048,truncationSuffix:"..."},NXI={maxStringLength:2048,truncationSuffix:"..."};function Kwg(g){if(g)return g===!0?{intent:!0,model:!0}:{intent:g.intent!==!1,model:g.model!==!1}}function wNA(g,A){return{}.hasOwnProperty.call(g,A)}function uNA(g,A){const I=Object.create(g);return A&&Object.defineProperty(I,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:A}),I}function Lwg(g,A,I=!1){if(!UC(g))return;const e=g.trim();return e?(I?ODg(e,RXI):e).slice(0,A):void 0}function Ywg(g){try{return yC(g)&&g.isError===!0}catch{return!1}}function _wg(g){return ODg(g||"Unknown error",NXI).slice(0,2048)}function xXI(g,A){try{return _wg(A?(function(I){try{return!yC(I)||!aB(I.content)?void 0:I.content.filter(e=>yC(e)&&e.type==="text"&&UC(e.text)).map(e=>e.text).join(" ").trim()||void 0}catch{return}})(g):yC(g)&&UC(g.message)?g.message:UC(g)?g:String(g))}catch{return"Unknown error"}}function FXI(g,A,I){return A.errorResult?[{type:"Error",value:I,mechanism:{type:"generic",handled:!0,synthetic:!0,exception_id:0}}]:g.buildProperties(A.error,{handled:!0}).$exception_list.map(e=>QI(QI({},e),{},{value:_wg(e.value)}))}function UXI(g,A){if(A)return"Error";try{if(!yC(g))return"Error";let I=UC(g.name)?g.name.trim():"";const e=g.constructor;return I&&I!=="Error"||!Xh(e)||e.name==="Error"||(I=e.name),(I||"Error").slice(0,256)}catch{return"Error"}}function JXI(g,A){return{message:xXI(g,A),type:UXI(g,A)}}const eQA={featureFlags:class extends hXI{constructor(g){const A=new lXI(g.config,g.Qu());super(A),this.name=twg,this._instance=g,this.hf=A}get zd(){return this._instance.persistence}updateConfig(g,A){this.hf.update(g,A),this.Hd()}}},PXI={sessionRecording:class{get Ar(){return this._instance.config}get _c(){return this._instance.persistence}get started(){var g;return!!(!((g=this.df)===null||g===void 0)&&g.isStarted)}get status(){var g,A;return this.vf==="awaiting_config"||this.vf==="missing_config"?this.vf:(g=(A=this.df)===null||A===void 0?void 0:A.status)!==null&&g!==void 0?g:this.vf}constructor(g){if(this._instance=g,this._forceAllowLocalhostNetworkCapture=!1,this.vf=sNA,this.ff=void 0,this.pf=!1,this.Je=(()=>{var A,I;if(!ro?.visibilityState||ro.visibilityState==="visible")return!0;const e=Me==null||(A=Me.performance)===null||A===void 0||(I=A.getEntriesByType)===null||I===void 0?void 0:I.call(A,"visibility-state");return!e?.length||e.some(t=>t.name==="visible")})(),this.sn=()=>{var A,I;ro?.visibilityState==="visible"&&(this.Je=!0,(A=this.df)===null||A===void 0||(I=A.setDocumentWasEverVisible)===null||I===void 0||I.call(A,!0))},!this._instance.sessionManager)throw VF.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Ar.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');ro?.addEventListener&&GE(ro,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:g=!1}={}){var A;this.pf=!0,ro==null||(A=ro.removeEventListener)===null||A===void 0||A.call(ro,"visibilitychange",this.sn),g?this.gf(!0):this.stopRecording()}get mf(){var g;const A=!!(!((g=this._instance.get_property("$session_recording_remote_config"))===null||g===void 0)&&g.enabled),I=!this.Ar.disable_session_recording,e=this.Ar.disable_session_recording||this._instance.consent.isOptedOut();return Me&&A&&I&&!e}startIfEnabledOrStop(g){var A;if(this.pf||this.mf&&(!((A=this.df)===null||A===void 0)&&A.isStarted))return;const I=!Le(Object.assign)&&!Le(Array.from);this.mf&&I?(this.yf(g),VF.info("starting")):(this.vf=sNA,this.stopRecording())}yf(g){var A,I;if(this.mf)if(this.vf!=="awaiting_config"&&this.vf!=="missing_config"&&(this.vf=lwg),(FB==null||(A=FB.__PosthogExtensions__)===null||A===void 0||(A=A.rrweb)===null||A===void 0?void 0:A.record)&&((I=FB.__PosthogExtensions__)===null||I===void 0?void 0:I.initSessionRecording))this.bf(g);else{var e,t;const o=this._instance.sessionManager;(e=FB.__PosthogExtensions__)===null||e===void 0||(t=e.loadExternalDependency)===null||t===void 0||t.call(e,this._instance,this._f,B=>{if(!this.pf&&this.mf&&this._instance.sessionManager===o)return B?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),VF.error("could not load recorder",B)):void this.bf(g);this.vf="disabled"})}}stopRecording(){var g,A;(g=this.ff)===null||g===void 0||g.call(this),this.ff=void 0,(A=this.df)===null||A===void 0||A.stop()}gf(g=!1){var A,I;(A=this.ff)===null||A===void 0||A.call(this),this.ff=void 0,(I=this.df)===null||I===void 0||I.discard({discardProducerEvents:g})}wf(){var g,A;(g=this._c)===null||g===void 0||g.unregister("$session_is_sampled"),(A=this._c)===null||A===void 0||A.unregister("$replay_sample_rate")}kf(g,A){if(rC(g))return null;const I=$h(g)?g:parseFloat(g);return typeof(e=I)!="number"||!Number.isFinite(e)||0>e||e>1?(VF.warn(`${A} must be between 0 and 1. Ignoring invalid value:`,g),null):I;var e}Sf(g){if(this._c){var A,I;const e=this._c,t=()=>{var o;const B=g.sessionRecording===!1?void 0:g.sessionRecording,C=this.kf((o=this.Ar.session_recording)===null||o===void 0?void 0:o.sampleRate,"session_recording.sampleRate"),Q=this.kf(B?.sampleRate,"remote config sampleRate"),i=C??Q;rC(i)&&this.wf();const E=B?.minimumDurationMilliseconds;e.register({[dV]:QI(QI({cache_timestamp:Date.now(),enabled:!!B},B),{},{networkPayloadCapture:QI({capturePerformance:g.capturePerformance},B?.networkPayloadCapture),canvasRecording:{enabled:B?.recordCanvas,fps:B?.canvasFps,quality:B?.canvasQuality},sampleRate:i,minimumDurationMilliseconds:Le(E)?null:E,endpoint:B?.endpoint,triggerMatchType:B?.triggerMatchType,masking:B?.masking,urlTriggers:B?.urlTriggers,version:B?.version,triggerGroups:B?.triggerGroups})})};t(),(A=this.ff)===null||A===void 0||A.call(this),this.ff=(I=this._instance.sessionManager)===null||I===void 0?void 0:I.onSessionId(t)}}onRemoteConfig(g){const A=g.ok?g.config:void 0;return A&&"sessionRecording"in A?A.sessionRecording===!1?(this.Sf(A),void this.gf()):(this.Sf(A),void this.startIfEnabledOrStop()):(this.vf==="awaiting_config"&&(this.vf="missing_config",this._instance.register_for_session({[mRA]:!0}),VF.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(g,A="log"){var I;!((I=this.df)===null||I===void 0)&&I.log?this.df.log(g,A):VF.warn("log called before recorder was ready")}get _f(){var g,A;const I=(g=this._instance)===null||g===void 0||(g=g.persistence)===null||g===void 0?void 0:g.get_property(dV);return(I==null||(A=I.scriptConfig)===null||A===void 0?void 0:A.script)||"lazy-recorder"}xf(){const g=this._instance.get_property(dV);if(!g)return!1;let A;try{A=typeof g=="object"?g:JSON.parse(g)}catch(I){return VF.warn("persisted remote config for session recording is invalid and will be ignored",I),!1}return!rC(A.cache_timestamp)&&36e5>=Date.now()-A.cache_timestamp}bf(g){var A,I,e;if(!this.pf&&this.mf&&this._instance.sessionManager){if(!(!((A=FB.__PosthogExtensions__)===null||A===void 0)&&A.initSessionRecording))return VF.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[GRA]:!0});var t;if(this.df||(this.df=(t=FB.__PosthogExtensions__)===null||t===void 0?void 0:t.initSessionRecording(this._instance,this.Je),this.df._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.xf())return this.vf==="missing_config"||this.vf==="awaiting_config"?void 0:(this.vf="awaiting_config",VF.info("persisted remote config is stale, requesting fresh config before starting"),void new myg(this._instance).load());this.vf=lwg,(I=(e=this.df).setDocumentWasEverVisible)===null||I===void 0||I.call(e,this.Je),this.df.start(g)}else this.vf=sNA}onRRwebEmit(g){var A,I;(A=this.df)===null||A===void 0||(I=A.onRRwebEmit)===null||I===void 0||I.call(A,g)}overrideLinkedFlag(){var g,A;this.df||(A=this._c)===null||A===void 0||A.register({$replay_override_linked_flag:!0}),(g=this.df)===null||g===void 0||g.overrideLinkedFlag()}overrideSampling(){var g,A;this.df||(A=this._c)===null||A===void 0||A.register({$replay_override_sampling:!0}),(g=this.df)===null||g===void 0||g.overrideSampling()}overrideTrigger(g){var A,I;this.df||(I=this._c)===null||I===void 0||I.register({[g==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(A=this.df)===null||A===void 0||A.overrideTrigger(g)}get sdkDebugProperties(){var g;const A={};for(const e of BXI){var I;const t=(I=this._instance.sessionPersistence)===null||I===void 0?void 0:I.get_property(e);Le(t)||(A[e]=t)}return QI(QI({},A),((g=this.df)===null||g===void 0?void 0:g.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(g,A){var I;return!!(!((I=this.df)===null||I===void 0)&&I.tryAddCustomEvent(g,A))}flushBeforeIdentityReset(){var g,A;(g=this.df)===null||g===void 0||(A=g.flushBeforeIdentityReset)===null||A===void 0||A.call(g)}}},KXI={autocapture:class extends ZzI{constructor(g){super(new IXI(g)),this.instance=g}},historyAutocapture:class{constructor(g){this.$f=!1,this._instance=g,this.Cf=this.Tf()}initialize(){this.startIfEnabled()}get isEnabled(){const g=this.If();return!!(g.path||g.search||this.Mf(g))}startIfEnabled(){this.isEnabled&&(Dt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Cf=this.Tf(),this.startIfEnabled()}stop(){this.Ef&&this.Ef(),this.Ef=void 0,this.Pf&&this.Pf(),this.Pf=void 0,Dt.info("History API monitoring stopped")}monitorHistoryChanges(){Me&&Me.history&&(this.Rf("pushState"),this.Rf("replaceState"),this.Af(),this.Mf()&&this.Ff())}Rf(g){var A;if(!Me||!((A=Me.history[g])===null||A===void 0)&&A.__posthog_wrapped__)return;const I=this;IH(Me.history,g,e=>function(t,o,B){var C;I.Of(B)&&I.Df(),e.call(this,t,o,B),I.Lf(g,!I.$f&&(Me==null||(C=Me.event)===null||C===void 0?void 0:C.type)!=="popstate")})}Tf(){const g=Me?.location;if(g?.pathname)return{pathname:g.pathname,search:g.search,hash:g.hash}}If(){const g=this._instance.config.capture_pageview;return g==="history_change"?{path:!0}:yC(g)?g:{}}Mf(g=this.If()){return!!g.hash&&!this._instance.config.disable_capture_url_hashes}Nf(g){const A=this.If(),I=this.Cf;return!(!I||!(A.path&&g.pathname!==I.pathname||A.search&&g.search!==I.search||this.Mf(A)&&g.hash!==I.hash))}Lf(g,A=!1){try{A||this.Df();const I=this.Tf();if(!I)return;if(this.Nf(I)){const e=()=>this._instance.capture(pRA,{navigation_type:g});A?(this.qf=e,Promise.resolve().then(()=>this.Df())):e()}this.Cf=I}catch(I){Dt.error(`Error capturing ${g} pageview`,I)}}Of(g){var A,I;return!(rC(g)||!Me)&&((A=ZF(String(g)))===null||A===void 0?void 0:A.href)!==((I=Me.location)===null||I===void 0?void 0:I.href)}Df(){const g=this.qf;if(g){this.qf=void 0,this.$f=!0;try{g()}catch(A){Dt.error("Error capturing deferred pageview",A)}finally{this.$f=!1}this.Cf=this.Tf()}}Af(){if(this.Ef)return;const g=()=>{this.Lf("popstate")};GE(Me,"popstate",g),this.Ef=()=>{Me&&Me.removeEventListener("popstate",g)}}Ff(){if(this.Pf)return;const g=()=>{this.Lf("hashchange")};GE(Me,"hashchange",g),this.Pf=()=>{Me&&Me.removeEventListener("hashchange",g)}}},heatmaps:class{get Ar(){return this.instance.config}constructor(g){var A;this.jf=!1,this.ll=!1,this.Bf=null,this.instance=g,this.jf=!!(!((A=this.instance.persistence)===null||A===void 0)&&A.props[aRA]),this.rageclicks=new Iwg(g.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let g=5e3;return yC(this.Ar.capture_heatmaps)&&this.Ar.capture_heatmaps.flush_interval_milliseconds&&(g=this.Ar.capture_heatmaps.flush_interval_milliseconds),g}get isEnabled(){return rC(this.Ar.capture_heatmaps)?rC(this.Ar.enable_heatmaps)?this.jf:this.Ar.enable_heatmaps:this.Ar.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ll)return;CXI.info("starting..."),this.zf(),this.sn()}else{var g;clearInterval((g=this.Bf)!==null&&g!==void 0?g:void 0),this.Hf(),this.getAndClearBuffer()}}onRemoteConfig(g){if(!g.ok)return;const A=g.config;if(!("heatmaps"in A))return;const I=!!A.heatmaps;this.instance.persistence&&this.instance.persistence.register({[aRA]:I}),this.jf=I,this.startIfEnabled()}getAndClearBuffer(){const g=this.Rt;return this.Rt=void 0,g}Uf(g){aNA(g.originalEvent)&&this.$r(g.originalEvent,"deadclick")}sn(){this.Bf&&clearInterval(this.Bf),this.Bf=ro?.visibilityState==="visible"?setInterval(this.rc.bind(this),this.flushIntervalMilliseconds):null}zf(){Me&&ro&&(this.Wf=this.rc.bind(this),GE(Me,bCA,this.Wf),this.Vf=g=>this.$r(g||Me?.event),GE(ro,"click",this.Vf,{capture:!0}),this.Gf=g=>this.Qf(g||Me?.event),GE(ro,"mousemove",this.Gf,{capture:!0}),this.Zf=new eyg(this.instance,QzI,this.Uf.bind(this)),this.Zf.startIfEnabledOrStop(),this.Jf=this.sn.bind(this),GE(ro,L9,this.Jf),this.ll=!0)}Hf(){var g;Me&&ro&&(this.Wf&&Me.removeEventListener(bCA,this.Wf),this.Vf&&ro.removeEventListener("click",this.Vf,{capture:!0}),this.Gf&&ro.removeEventListener("mousemove",this.Gf,{capture:!0}),this.Jf&&ro.removeEventListener(L9,this.Jf),clearTimeout(this.Kf),(g=this.Zf)===null||g===void 0||g.stop(),this.ll=!1)}Xf(g,A){const I=this.instance.scrollManager.scrollY(),e=this.instance.scrollManager.scrollX(),t=this.instance.scrollManager.scrollElement(),o=(function(B,C,Q){let i=B;for(;i&&Jf(i)&&!Nw(i,"body");){if(i===Q)return!1;let r;try{var E,n,s;r=(E=(n=(s=i.ownerDocument)===null||s===void 0?void 0:s.defaultView)!==null&&n!==void 0?n:Me)===null||E===void 0?void 0:E.getComputedStyle(i).position}catch{return!1}if(yB(C,r))return!0;i=vdg(i)}return!1})(mV(g),["fixed","sticky"],t);return{x:g.clientX+(o?0:e),y:g.clientY+(o?0:I),target_fixed:o,type:A}}$r(g,A="click"){var I;if(Ydg(g.target)||!aNA(g))return;const e=this.Xf(g,A);!((I=this.rageclicks)===null||I===void 0)&&I.isRageClick(g.clientX,g.clientY,new Date().getTime())&&Wdg(mV(g),this.instance.config.rageclick)&&this.Qs(QI(QI({},e),{},{type:"rageclick"})),this.Qs(e)}Qf(g){!Ydg(g.target)&&aNA(g)&&(clearTimeout(this.Kf),this.Kf=setTimeout(()=>{this.Qs(this.Xf(g,"mousemove"))},500))}Qs(g){if(!Me)return;const A=this.Ar.disable_capture_url_hashes?v4(Me.location.href):Me.location.href,I=this.Ar.custom_personal_data_properties,e=this.Ar.mask_personal_data_properties?[...j9,...I||[]]:[],t=MV(A,e,SV);this.Rt=this.Rt||{},this.Rt[t]||(this.Rt[t]=[]),this.Rt[t].push(g)}rc(){this.Rt&&!_p(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:eyg,webVitalsAutocapture:class{constructor(g){var A;this._instance=g,this.jf=!1,this.ll=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Yf=(I=!1)=>{clearTimeout(this.tp),this.tp=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",QI({$current_url:this.Rt.url},this.Rt.metrics.reduce((e,t)=>QI(QI({},e),{},{[`$web_vitals_${t.name}_event`]:QI({},t),[`$web_vitals_${t.name}_value`]:t.value}),{})),I?{transport:"sendBeacon",send_instantly:!0}:void 0),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ep=I=>{var e;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},rC(I?.name)||rC(I?.value))return void SY.error("Invalid metric received",I);const t=typeof I.navigationURL=="string"?I.navigationURL:void 0,o=this.np(t);if(Le(o))return;const B=$h(I.navigationId)||typeof I.navigationId=="string"?`navigation:${I.navigationId}`:`url:${o}`;if(this.sp&&I.value>=this.sp)return void SY.error("Ignoring metric with value >= "+this.sp,I);this.Rt.navigationKey!==B&&(this.Yf(),this.tp=setTimeout(this.Yf,this.flushToCaptureTimeoutMs)),Le(this.Rt.navigationKey)&&(this.Rt.navigationKey=B,this.Rt.url=o),this.Rt.firstMetricTimestamp=Le(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const C=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0),Q=QI(QI(QI({},I),t?{navigationURL:o}:{}),{},{$current_url:o,timestamp:Date.now()});if(delete Q.entries,yC(I.attribution)&&this.attributionMetrics.indexOf(I.name)>-1){const i={};for(const E of oXI){const n=E==="url"&&typeof I.attribution[E]=="string"?this.np(I.attribution[E]):I.attribution[E];Le(n)||(i[E]=n)}Q.attribution=i}else delete Q.attribution;Le(C)||(Q.$session_id=C.sessionId,Q.$window_id=C.windowId),this.Rt.metrics.push(Q),this.Rt.metrics.length===this.allowedMetrics.length&&this.Yf()},this.rp=()=>{if(this.ll)return;let I,e,t,o,B=!1;const C=FB.__PosthogExtensions__,Q=C?.postHogWebVitalsCallbacksByFlavor,i=Q?.[this.op]||(this.op==="web-vitals"&&Le(Q)?C?.postHogWebVitalsCallbacks:void 0);if(!Le(i)){const r=i.withoutAttribution,a=this.attributionMetrics;B=!Le(r),I=a.indexOf("LCP")>-1?i.onLCP:r?.onLCP||i.onLCP,e=a.indexOf("CLS")>-1?i.onCLS:r?.onCLS||i.onCLS,t=a.indexOf("FCP")>-1?i.onFCP:r?.onFCP||i.onFCP,o=a.indexOf("INP")>-1?i.onINP:r?.onINP||i.onINP}if(!(I&&e&&t&&o))return void SY.error("web vitals callbacks not loaded - not starting");const E={reportSoftNavs:this.useSoftNavs},n=B&&this.attributionMetrics.indexOf("INP")>-1?QI(QI({},E),{},{includeProcessedEventEntries:!1}):E;this.allowedMetrics.indexOf("LCP")>-1&&I(this.ep.bind(this),E),this.allowedMetrics.indexOf("CLS")>-1&&e(this.ep.bind(this),E),this.allowedMetrics.indexOf("FCP")>-1&&t(this.ep.bind(this),E),this.allowedMetrics.indexOf("INP")>-1&&o(this.ep.bind(this),n);const s=Me?.document;GE(s,L9,()=>{s?.visibilityState==="hidden"&&this.Yf(!0)}),GE(Me,"pagehide",()=>this.Yf(!0)),this.ll=!0},this.jf=!!(!((A=this._instance.persistence)===null||A===void 0)&&A.props[hRA]),this.startIfEnabled()}get ap(){return this._instance.config.capture_performance}get allowedMetrics(){var g,A;const I=yC(this.ap)?(g=this.ap)===null||g===void 0?void 0:g.web_vitals_allowed_metrics:void 0;return rC(I)?((A=this._instance.persistence)===null||A===void 0?void 0:A.props.$web_vitals_allowed_metrics)||hwg:I}get flushToCaptureTimeoutMs(){return(yC(this.ap)?this.ap.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const g=yC(this.ap)?this.ap.web_vitals_attribution:void 0;return gm(g)?g?hwg:[]:aB(g)?g:tXI}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const g=yC(this.ap)?this.ap.__preview_web_vitals_soft_navs:void 0;return g!=null&&g}get sp(){const g=yC(this.ap)&&$h(this.ap.__web_vitals_max_value)?this.ap.__web_vitals_max_value:cwg;return g>0&&6e4>=g?cwg:g}get isEnabled(){const g=ta?.protocol;if(g!=="http:"&&g!=="https:")return SY.info("Web Vitals are disabled on non-http/https protocols"),!1;const A=yC(this.ap)?this.ap.web_vitals:gm(this.ap)?this.ap:void 0;return gm(A)?A:this.jf}startIfEnabled(){this.isEnabled&&!this.ll&&(SY.info("enabled, starting..."),this.Ml(this.rp))}onRemoteConfig(g){if(!g.ok)return;const A=g.config;if(!("capturePerformance"in A))return;const I=yC(A.capturePerformance)&&!!A.capturePerformance.web_vitals,e=yC(A.capturePerformance)?A.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[hRA]:I}),this._instance.persistence.register({[adg]:e})),this.jf=I,this.startIfEnabled()}get op(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ml(g){var A;const I=FB.__PosthogExtensions__,e=this.op,t=I?.postHogWebVitalsCallbacksByFlavor;t?.[e]||e==="web-vitals"&&Le(t)&&I?.postHogWebVitalsCallbacks?g():I==null||(A=I.loadExternalDependency)===null||A===void 0||A.call(I,this._instance,e,o=>{o?SY.error("failed to load script",o):g()})}np(g){const A=g||Me?.location.href;if(!A)return void SY.error("Could not determine current URL");const I=this._instance.config.disable_capture_url_hashes?v4(A):A,e=this._instance.config.custom_personal_data_properties,t=this._instance.config.mask_personal_data_properties?[...j9,...e||[]]:[];return MV(I,t,SV)}}},LXI={exceptionObserver:class{constructor(g){var A;this.rp=()=>{var I;if(!Me||!this.isEnabled||!(!((I=FB.__PosthogExtensions__)===null||I===void 0)&&I.errorWrappingFunctions))return;const e=FB.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,t=FB.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=FB.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.lp&&this.Ar.capture_unhandled_errors&&(this.lp=e(this.captureException.bind(this))),!this.up&&this.Ar.capture_unhandled_rejections&&(this.up=t(this.captureException.bind(this))),!this.cp&&this.Ar.capture_console_errors&&(this.cp=o(this.captureException.bind(this)))}catch(B){LV.error("failed to start",B),this.hp()}},this._instance=g,this.dp=!!(!((A=this._instance.persistence)===null||A===void 0)&&A.props[rRA]),this.wt=new jWI(QI(QI({},(function(I={}){var e,t,o,B;return{refillRate:(e=(t=I.exceptionRateLimiterRefillRate)!==null&&t!==void 0?t:I.__exceptionRateLimiterRefillRate)!==null&&e!==void 0?e:1,bucketSize:(o=(B=I.exceptionRateLimiterBucketSize)!==null&&B!==void 0?B:I.__exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:LV})),this.Ar=this.vp(),this.startIfEnabledOrStop()}vp(){const g=this._instance.config.capture_exceptions;let A={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return yC(g)?A=QI(QI({},A),g):(Le(g)?this.dp:g)&&(A=QI(QI({},A),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),A}get isEnabled(){return this.Ar.capture_console_errors||this.Ar.capture_unhandled_errors||this.Ar.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(LV.info("enabled"),this.hp(),this.Ml(this.rp)):this.hp()}Ml(g){var A,I,e;!((A=FB.__PosthogExtensions__)===null||A===void 0)&&A.errorWrappingFunctions?g():(I=FB.__PosthogExtensions__)===null||I===void 0||(e=I.loadExternalDependency)===null||e===void 0||e.call(I,this._instance,"exception-autocapture",t=>{if(t)return LV.error("failed to load script",t);g()})}hp(){var g,A,I;(g=this.lp)===null||g===void 0||g.call(this),this.lp=void 0,(A=this.up)===null||A===void 0||A.call(this),this.up=void 0,(I=this.cp)===null||I===void 0||I.call(this),this.cp=void 0}onRemoteConfig(g){if(!g.ok)return;const A=g.config;"autocaptureExceptions"in A&&(this.dp=!!A.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[rRA]:this.dp}),this.Ar=this.vp(),this.startIfEnabledOrStop())}onConfigChange(){this.Ar=this.vp()}captureException(g){try{var A,I,e;const t=(A=g==null||(I=g.$exception_list)===null||I===void 0||(I=I[0])===null||I===void 0?void 0:I.type)!==null&&A!==void 0?A:"Exception";if(this.wt.consumeRateLimit(t))return void LV.info("Skipping exception capture because of client rate limiting.",{exception:t});(e=this._instance.exceptions)===null||e===void 0||e.sendExceptionEvent(g)}catch{}}},exceptions:class{constructor(g){var A,I;this.fp=[],this.pp=new QVI([new GVI,new xVI,new pVI,new mVI,new RVI,new fVI,new MVI,new NVI],(function(e,...t){return(o,B=0)=>{const C=[],Q=o.split(`
241
241
  `),i=Math.min(Q.length,B+1e3),E=[];for(let r=B;i>r;r++){const a=Q[r];if(a.length>1024)continue;const c=fDg.test(a)?a.replace(fDg,"$1"):a;if(!c.match(/\S*Error: /)){for(const h of t){const l=h(c,e);if(l){C.push(l);const D=dVI(C);if(D){for(let d=E.length-1;d>=0;d--){const y=E[d];if(D.start>=y.start+y.length)break;E.pop()}E.push(D)}break}}if(wVI(C,E)>=50)break}}const n=[...E].sort((r,a)=>a.start-r.start),s=n[n.length-1];if(s){const r=RDg(C,s);C.splice(s.start-r,r);for(const a of n)a.start-=r}for(const r of n)yVI(C,r);return E.some(r=>r.start===0&&C.length===r.length)&&(function(r){const a=r.map(h=>`${h.function}|${h.filename}|${h.lineno}|${h.colno}|${h.module}`);let c=0;for(let h=1;a.length>h;h++)uVI(a,h,c)&&(c=h);r.push(...r.splice(0,c))})(C),(function(r){if(!r.length)return[];const a=Array.from(r);return a.reverse(),a.slice(0,50).map(c=>{return QI(QI({},c),{},{filename:c.filename||(h=a,h[h.length-1]||{}).filename,function:c.function||"?"});var h})})(C)}})("web:javascript",cVI,DVI)),this._instance=g,this.fp=(A=(I=this._instance.persistence)===null||I===void 0?void 0:I.get_property("$error_tracking_suppression_rules"))!==null&&A!==void 0?A:[],this.gp=NCA(this.mp()),this.yp=new UVI(this.gp)}onConfigChange(){this.gp=NCA(this.mp()),this.yp.setConfig(this.gp)}onRemoteConfig(g){var A,I,e;if(!g.ok)return;const t=g.config;if(!("errorTracking"in t))return;const o=(A=(I=t.errorTracking)===null||I===void 0?void 0:I.suppressionRules)!==null&&A!==void 0?A:[],B=(e=t.errorTracking)===null||e===void 0?void 0:e.captureExtensionExceptions;this.fp=o,this._instance.persistence&&this._instance.persistence.register({[ndg]:this.fp,[cRA]:B})}get bp(){var g;const A=!!this._instance.get_property(cRA),I=this._instance.config.error_tracking.captureExtensionExceptions;return(g=I??A)!==null&&g!==void 0&&g}buildProperties(g,A){return this.pp.buildFromUnknown(g,{syntheticException:A?.syntheticException,mechanism:{handled:A?.handled}})}addExceptionStep(g,A){if(this.gp.enabled)try{if(!UC(g)||g.trim().length===0)return void Pf.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:I,droppedKeys:e}=(function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};const o=[];return{sanitizedProperties:Object.keys(t).reduce((B,C)=>FVI.has(C)?(o.push(C),B):(B[C]=t[C],B),{}),droppedKeys:o}})(this._p(A));e.length>0&&Pf.warn("Ignoring reserved exception step fields",{droppedKeys:e}),this.yp.add(QI({[fCA]:g,[RCA]:new Date().toISOString()},I))}catch(I){Pf.error("Failed to add exception step. Ignoring breadcrumb.",I)}}sendExceptionEvent(g){try{const A=g.$exception_list;if(this.wp(A)){if(this.kp(A))return this.Sp("Exception dropped: matched a suppression rule"),void Pf.info("Skipping exception capture because a suppression rule matched");if(!this.bp&&this.xp(A))return this.Sp("Exception dropped: thrown by a browser extension"),void Pf.info("Skipping exception capture because it was thrown by an extension");if(!this.bp&&this.$p(A))return this.Sp("Exception dropped: thrown by an injected browser script"),void Pf.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Cp(A))return this.Sp("Exception dropped: thrown by the PostHog SDK"),void Pf.info("Skipping exception capture because it was thrown by the PostHog SDK")}const I=this.gp.enabled&&rC(g.$exception_steps)?this.Tp(g):g,e=(function(){if("u">typeof Nlg){var t;const B=(t=Nlg.env.POSTHOG_RELEASE_ID)===null||t===void 0?void 0:t.trim();if(B)return B}const o=globalThis._posthogReleaseId;return typeof o=="string"&&o.length>0?o:void 0})();e&&(I.$release_id=e);try{const t=this._instance.capture("$exception",I,{_noTruncate:!0,_batchKey:"exceptionEvent",ed:!0});return t&&this.yp.clear(),t}catch(t){return Swg(t)||Pf.error("Failed to capture exception event. Dropping this exception.",t),void this.yp.clear()}}catch(A){return void(Swg(A)||Pf.error("Failed to process exception event. Ignoring this exception.",A))}}Tp(g){try{const A=this.yp.getAttachable();return A.length===0?g:QI(QI({},g),{},{$exception_steps:A})}catch(A){return Pf.error("Failed to read buffered exception steps. Capturing exception without steps.",A),g}}Sp(g){this.gp.enabled&&this.yp.add({[fCA]:g,[RCA]:new Date().toISOString()})}_p(g){return yC(g)?QI({},g):{}}mp(){var g,A;return(g=(A=this._instance.config.error_tracking)===null||A===void 0?void 0:A.exception_steps)!==null&&g!==void 0?g:{}}kp(g){if(g.length===0)return!1;try{const A=g.reduce((I,{type:e,value:t})=>(UC(e)&&e.length>0&&I.$exception_types.push(e),UC(t)&&t.length>0&&I.$exception_values.push(t),I),{$exception_types:[],$exception_values:[]});return this.fp.some(I=>{const e=I.values.map(t=>{const o=Xyg[t.operator],B=A[t.key];if(!o||!B)return!1;const C=aB(t.value)?t.value:[t.value];return C.length>0&&o(C,B)});return I.type==="OR"?e.some(Boolean):e.every(Boolean)})}catch(A){return Pf.warn("Failed to evaluate suppression rules. Capturing the exception.",A),!1}}xp(g){const A=g.flatMap(e=>{var t,o;return(t=(o=e.stacktrace)===null||o===void 0?void 0:o.frames)!==null&&t!==void 0?t:[]}),I=A.filter(({filename:e})=>!!e&&dXI.some(t=>e.startsWith(t)));return I.length!==0&&(!I.every(({filename:e})=>!!e&&e.startsWith(lNA))||g.some(({type:e,value:t})=>e==="NoResponse"||UC(t)&&DXI.some(({value:o,exact:B})=>B?t===o:t.includes(o)))&&!A.some(({in_app:e,filename:t})=>e&&!t?.startsWith(lNA)))}$p(g){return g.some(({value:A})=>UC(A)&&yXI.some(I=>A.includes(I)))}Cp(g){if(g.length>0){var A,I,e,t;const o=(A=(I=g[0].stacktrace)===null||I===void 0?void 0:I.frames)!==null&&A!==void 0?A:[],B=o[o.length-1];return(e=B==null||(t=B.filename)===null||t===void 0?void 0:t.includes("posthog.com/static"))!==null&&e!==void 0&&e}return!1}wp(g){return!rC(g)&&aB(g)}}},YXI=QI({productTours:class{get _c(){return this._instance.persistence}constructor(g){this.Ip=null,this.Mp=null,this._instance=g}initialize(){this.loadIfEnabled()}onRemoteConfig(g){if(!g.ok)return;const A=g.config;if("productTours"in A){var I,e;if(this._c&&this._c.register({[DRA]:!!A.productTours}),!rNA(this._instance))return!this.Ip&&rC((I=this._c)===null||I===void 0?void 0:I.props.ph_product_tours)||gQA.info("product tours disabled; stopping and clearing cached tours"),(e=this.Ip)===null||e===void 0||e.stop(),this.Ip=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Ip&&rNA(this._instance)&&this.Ml(()=>this.Ep())}Ml(g){var A,I,e;!((A=FB.__PosthogExtensions__)===null||A===void 0)&&A.generateProductTours?g():(I=FB.__PosthogExtensions__)===null||I===void 0||(e=I.loadExternalDependency)===null||e===void 0||e.call(I,this._instance,"product-tours",t=>{t?gQA.error("Could not load product tours script",t):g()})}Ep(){var g;!this.Ip&&(!((g=FB.__PosthogExtensions__)===null||g===void 0)&&g.generateProductTours)&&(this.Ip=FB.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(g,A=!1){if(aB(this.Mp)&&!A)return void g(this.Mp,{isLoaded:!0});const I=this._c;if(I){const e=I.props[dRA];if(aB(e)&&!A)return this.Mp=e,void g(e,{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:e=>{if(!rNA(this._instance))return void g([],{isLoaded:!0});const t=e.statusCode;if(t!==200||!e.json){const B=`Product Tours API could not be loaded, status: ${t}`;return t===0?e.error||gQA.warn(B):gQA.error(B),void g([],{isLoaded:!1,error:B})}const o=aB(e.json.product_tours)?e.json.product_tours:[];this.Mp=o,I&&I.register({[dRA]:o}),g(o,{isLoaded:!0})}})}getActiveProductTours(g){rC(this.Ip)?g([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ip.getActiveProductTours(g)}showProductTour(g){var A;(A=this.Ip)===null||A===void 0||A.showTourById(g)}previewTour(g){this.Ip?this.Ip.previewTour(g):this.Ml(()=>{var A;this.Ep(),(A=this.Ip)===null||A===void 0||A.previewTour(g)})}dismissProductTour(){var g;(g=this.Ip)===null||g===void 0||g.dismissTour("user_clicked_skip")}nextStep(){var g;(g=this.Ip)===null||g===void 0||g.nextStep()}previousStep(){var g;(g=this.Ip)===null||g===void 0||g.previousStep()}clearCache(){var g;this.Mp=null,(g=this._c)===null||g===void 0||g.unregister("ph_product_tours")}resetTour(g){var A;(A=this.Ip)===null||A===void 0||A.resetTour(g)}resetAllTours(){var g;(g=this.Ip)===null||g===void 0||g.resetAllTours()}cancelPendingTour(g){var A;(A=this.Ip)===null||A===void 0||A.cancelPendingTour(g)}}},eQA),_XI={siteApps:class{constructor(g){this._instance=g,this.Pp=0,this.Rp=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ap(g,A){if(!A)return;const I=this.globalsForEvent(A);this.Rp.push(I),this.Rp.length>1e3&&(this.Rp=this.Rp.slice(10))}get siteAppLoaders(){var g;return(g=FB._POSTHOG_REMOTE_CONFIG)===null||g===void 0||(g=g[this._instance.config.token])===null||g===void 0?void 0:g.siteApps}initialize(){if(this.isEnabled){const g=this._instance._addCaptureHook(this.Ap.bind(this));this.Fp=()=>{g(),this.Rp=[],this.Fp=void 0}}}globalsForEvent(g){var A,I,e,t,o,B,C;if(!g)throw new Error("Event payload is required");const Q={},i=this._instance.get_property("$groups")||[],E=this._instance.get_property("$stored_group_properties")||{};for(const[r,a]of Object.entries(E))Q[r]={id:i[r],type:r,properties:a};const{$set_once:n,$set:s}=g;return{event:QI(QI({},_Dg(g,QXI)),{},{properties:QI(QI(QI({},g.properties),s?{$set:QI(QI({},(A=(I=g.properties)===null||I===void 0?void 0:I.$set)!==null&&A!==void 0?A:{}),s)}:{}),n?{$set_once:QI(QI({},(e=(t=g.properties)===null||t===void 0?void 0:t.$set_once)!==null&&e!==void 0?e:{}),n)}:{}),elements_chain:(o=(B=g.properties)===null||B===void 0?void 0:B.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(C=g.properties)===null||C===void 0?void 0:C.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:Q}}Op(g){var A;const I=(A=g.tagName)===null||A===void 0?void 0:A.toLowerCase();return I==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(g)||(JN.error("prepare_external_dependency_stylesheet returned null"),null):I==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(g)||(JN.error("prepare_external_dependency_script returned null"),null):g}Dp(){var g,A,I,e,t,o,B,C;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const Q=ro?.defaultView,i=Q==null||(g=Q.Node)===null||g===void 0?void 0:g.prototype;if(!Q||!i)return()=>{};if(this.Pp++,this.Lp)return this.Np();const E=[],n=this,s=new WeakSet,r=(h,l,D)=>{if(!h?.[l])return;const d=h[l];h[l]=D(d),E.push(()=>{h[l]=d})},a=h=>{if(s.has(h))return h;const l=n.Op(h);return l&&s.add(l),l},c=h=>h.map(l=>typeof l=="string"?l:a(l)).filter(l=>!fc(l));return r(i,"appendChild",h=>function(l){const D=a(l);return D?h.call(this,D):l}),r(i,"insertBefore",h=>function(l,D){const d=a(l);return d?h.call(this,d,D):l}),r(i,"replaceChild",h=>function(l,D){const d=a(l);return d?h.call(this,d,D):D}),[(A=Q.Element)===null||A===void 0?void 0:A.prototype,(I=Q.Document)===null||I===void 0?void 0:I.prototype,(e=Q.DocumentFragment)===null||e===void 0?void 0:e.prototype].forEach(h=>{r(h,"append",l=>function(...D){return l.apply(this,c(D))}),r(h,"prepend",l=>function(...D){return l.apply(this,c(D))})}),[(t=Q.Element)===null||t===void 0?void 0:t.prototype,(o=Q.CharacterData)===null||o===void 0?void 0:o.prototype,(B=Q.DocumentType)===null||B===void 0?void 0:B.prototype].forEach(h=>{r(h,"before",l=>function(...D){return l.apply(this,c(D))}),r(h,"after",l=>function(...D){return l.apply(this,c(D))}),r(h,"replaceWith",l=>function(...D){const d=c(D);return D.length&&!d.length?void 0:l.apply(this,d)})}),r((C=Q.Element)===null||C===void 0?void 0:C.prototype,"insertAdjacentElement",h=>function(l,D){const d=a(D);return d?h.call(this,l,d):null}),this.Lp=()=>{E.forEach(h=>h()),this.Lp=void 0},this.Np()}Np(){let g=!1;return()=>{var A;g||(g=!0,this.Pp--,this.Pp===0&&((A=this.Lp)===null||A===void 0||A.call(this)))}}qp(g,A=!0){const I=this.Dp();try{const e=g(I);return A&&I(),e}catch(e){throw I(),e}}setupSiteApp(g){const A=this.apps[g.id],I=()=>{var o;!A.errored&&this.Rp.length&&(JN.info(`Processing ${this.Rp.length} events for site app with id ${g.id}`),this.Rp.forEach(B=>this.qp(()=>{var C;return(C=A.processEvent)===null||C===void 0?void 0:C.call(A,B)})),A.processedBuffer=!0),Object.values(this.apps).every(B=>B.processedBuffer||B.errored)&&((o=this.Fp)===null||o===void 0||o.call(this))};let e=!1;const t=o=>{A.errored=!o,A.loaded=!0,JN.info(`Site app with id ${g.id} ${o?"loaded":"errored"}`),e&&I()};try{const{processEvent:o}=this.qp(B=>g.init({posthog:this._instance,callback(C){B(),t(C)}}),!1);o&&(A.processEvent=o),e=!0}catch(o){JN.error(Dwg+g.id,o),t(!1)}if(e&&A.loaded)try{I()}catch(o){JN.error(`Error while processing buffered events PostHog app with config id ${g.id}`,o),A.errored=!0}}jp(){const g=this.siteAppLoaders||[];for(const A of g)this.apps[A.id]={id:A.id,loaded:!1,errored:!1,processedBuffer:!1};for(const A of g)this.setupSiteApp(A)}Bp(g){if(Object.keys(this.apps).length===0)return;const A=this.globalsForEvent(g);for(const I of Object.values(this.apps))try{this.qp(()=>{var e;return(e=I.processEvent)===null||e===void 0?void 0:e.call(I,A)})}catch(e){JN.error(`Error while processing event ${g.event} for site app ${I.id}`,e)}}onRemoteConfig(g){var A,I,e;if(!((A=this.siteAppLoaders)===null||A===void 0)&&A.length)return this.isEnabled?(this.jp(),void this._instance.on("eventCaptured",C=>this.Bp(C))):void JN.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((I=this.Fp)===null||I===void 0||I.call(this),!g.ok)return;const t=g.config;if(!((e=t.siteApps)===null||e===void 0)&&e.length)if(this.isEnabled)for(const{id:C,url:Q}of t.siteApps){var o,B;FB[`__$$ph_site_app_${C}`]=this._instance,(o=FB.__PosthogExtensions__)===null||o===void 0||(B=o.loadSiteApp)===null||B===void 0||B.call(o,this._instance,Q,i=>{if(i)return JN.error(Dwg+C,i)})}else JN.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},bXI={tracingHeaders:class{constructor(g){this._instance=g,this.zp=void 0,this.Hp=void 0,this.Up=void 0,this.rp=()=>{const A=this.Wp();var I,e;A?(Le(this.zp)&&(this.zp=(I=FB.__PosthogExtensions__)===null||I===void 0||(I=I.tracingHeadersPatchFns)===null||I===void 0?void 0:I._patchXHR(A,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Le(this.Hp)&&(this.Hp=(e=FB.__PosthogExtensions__)===null||e===void 0||(e=e.tracingHeadersPatchFns)===null||e===void 0?void 0:e._patchFetch(A,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.hp()}}initialize(){this.startIfEnabledOrStop()}Ml(g){var A,I,e;!((A=FB.__PosthogExtensions__)===null||A===void 0)&&A.tracingHeadersPatchFns?g():(I=FB.__PosthogExtensions__)===null||I===void 0||(e=I.loadExternalDependency)===null||e===void 0||e.call(I,this._instance,"tracing-headers",t=>{if(t)return eXI.error("failed to load script",t);g()})}Vp(){var g,A;return(g=(A=this._instance.config.tracing_headers)!==null&&A!==void 0?A:this._instance.config.addTracingHeaders)!==null&&g!==void 0?g:this._instance.config.__add_tracing_headers}Wp(){const g=this.Vp();return aB(g)?(aB(this.Up)?this.Up.splice(0,this.Up.length,...g):this.Up=[...g],g.length>0?this.Up:void 0):(aB(this.Up)&&this.Up.splice(0),this.Up=g||void 0,this.Up)}hp(){var g,A;(g=this.zp)===null||g===void 0||g.call(this),(A=this.Hp)===null||A===void 0||A.call(this),this.zp=void 0,this.Hp=void 0}startIfEnabledOrStop(){this.Wp()?this.Ml(this.rp):this.hp()}}},HXI=QI({surveys:class extends sXI{constructor(g){super(new aXI(g))}}},eQA),vXI={toolbar:class{constructor(g){this.instance=g}Gp(g){FB.ph_toolbar_state=g}Qp(){var g;return(g=FB.ph_toolbar_state)!==null&&g!==void 0?g:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(g=void 0,A=void 0,I=void 0){var e,t;if(MRA(this.instance.config)||!Me||!ro)return!1;g=(e=g)!==null&&e!==void 0?e:Me.location,I=(t=I)!==null&&t!==void 0?t:Me.history;try{if(!A){try{Me.localStorage.setItem("test","test"),Me.localStorage.removeItem("test")}catch{return!1}A=Me?.localStorage}const o=rXI||qCA(g.hash,"__posthog")||qCA(g.hash,"state");let B;const C=o?yDg(()=>JSON.parse(atob(decodeURIComponent(o))))||yDg(()=>JSON.parse(decodeURIComponent(o))):null;return C&&C.action==="ph_authorize"?(B=C,B.source="url",B&&Object.keys(B).length>0&&(C.desiredHash?g.hash=C.desiredHash:I?I.replaceState(I.state,"",g.pathname+g.search):g.hash="")):(B=JSON.parse(A.getItem(ywg)||"{}"),B.source="localstorage",delete B.userIntent),!(!B.token||this.instance.config.token!==B.token||(this.loadToolbar(B),0))}catch{return!1}}Zp(g){const A=FB.ph_load_toolbar||FB.ph_load_editor;!rC(A)&&Xh(A)?A(g,this.instance):wwg.warn("No toolbar load function found")}loadToolbar(g){const A=!!ro?.getElementById("__POSTHOG_TOOLBAR__");if(!Me||A)return!1;const I=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,e=QI(QI({token:this.instance.config.token},g),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},I?{instrument:!1}:{});if(Me.localStorage.setItem(ywg,JSON.stringify(QI(QI({},e),{},{source:void 0}))),this.Qp()===2)this.Zp(e);else if(this.Qp()===0){var t,o;this.Gp(1),(t=FB.__PosthogExtensions__)===null||t===void 0||(o=t.loadExternalDependency)===null||o===void 0||o.call(t,this.instance,"toolbar",B=>{if(B)return wwg.error("[Toolbar] Failed to load",B),void this.Gp(0);this.Gp(2),this.Zp(e)}),GE(Me,"turbolinks:load",()=>{this.Gp(0),this.loadToolbar(e)})}return!0}Jp(g){return this.loadToolbar(g)}maybeLoadEditor(g=void 0,A=void 0,I=void 0){return this.maybeLoadToolbar(g,A,I)}}},qXI=QI({experiments:class Kp{get Ar(){return this._instance.config}constructor(A){this._instance=A,this.getWebExperimentsAndEvaluateDisplayLogic=(I=!1)=>{this.getWebExperiments(e=>{Kp.Kp("retrieved web experiments from the server"),this.Xp=new Map,e.forEach(t=>{if(t.feature_flag_key){var o;this.Xp&&(Kp.Kp("setting flag key ",t.feature_flag_key," to web experiment ",t),(o=this.Xp)===null||o===void 0||o.set(t.feature_flag_key,t));const B=this._instance.getFeatureFlag(t.feature_flag_key);UC(B)&&t.variants[B]&&this.Yp(t.name,B,t.variants[B].transforms)}else if(t.variants)for(const B in t.variants){const C=t.variants[B];Kp.tg(C,this._instance)&&this.Yp(t.name,B,C.transforms)}})},I)},this._instance.onFeatureFlags(I=>{this.onFeatureFlags(I)})}initialize(){}onFeatureFlags(A){if(this._is_bot())Kp.Kp(fwg);else if(!this.Ar.disable_web_experiments){if(rC(this.Xp))return this.Xp=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Kp.Kp("applying feature flags",A),A.forEach(I=>{var e;if(this.Xp&&(!((e=this.Xp)===null||e===void 0)&&e.has(I))){var t;const o=this._instance.getFeatureFlag(I),B=(t=this.Xp)===null||t===void 0?void 0:t.get(I);o&&B?.variants[o]&&this.Yp(B.name,o,B.variants[o].transforms)}})}}previewWebExperiment(){const A=Kp.getWindowLocation();if(A?.search){const I=V9(A?.search,"__experiment_id"),e=V9(A?.search,"__experiment_variant");I&&e&&(Kp.Kp(`previewing web experiments ${I} && ${e}`),this.getWebExperiments(t=>{this.eg(parseInt(I),e,t)},!1,!0))}}loadIfEnabled(){this.Ar.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(A,I,e){if(this.Ar.disable_web_experiments&&!e)return A([]);const t=this._instance.get_property("$web_experiments");if(t&&!I)return A(t);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Ar.token}`),method:"GET",timestampMode:"query",callback:o=>A(o.statusCode===200&&o.json&&o.json.experiments||[])})}eg(A,I,e){const t=e.filter(o=>o.id===A);t&&t.length>0&&(Kp.Kp(`Previewing web experiment [${t[0].name}] with variant [${I}]`),this.Yp(t[0].name,I,t[0].variants[I].transforms))}static tg(A,I){return!rC(A.conditions)&&Kp.ig(A,I)&&Kp.ng(A)}static ig(A,I){var e;if(rC(A.conditions)||rC((e=A.conditions)===null||e===void 0?void 0:e.url))return!0;const t=Kp.getWindowLocation();if(t){var o,B,C;const Q=Ldg(I,t.href);return!(!((o=A.conditions)===null||o===void 0)&&o.url)||wXI[(B=(C=A.conditions)===null||C===void 0?void 0:C.urlMatchType)!==null&&B!==void 0?B:"icontains"](A.conditions.url,Q)}return!1}static getWindowLocation(){return Me?.location}static ng(A){var I;if(rC(A.conditions)||rC((I=A.conditions)===null||I===void 0?void 0:I.utm))return!0;const e=syg();if(e.utm_source){var t,o,B,C,Q,i,E,n;const s=!(!((t=A.conditions)===null||t===void 0||(t=t.utm)===null||t===void 0)&&t.utm_campaign)||((o=A.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0?void 0:o.utm_campaign)==e.utm_campaign,r=!(!((B=A.conditions)===null||B===void 0||(B=B.utm)===null||B===void 0)&&B.utm_source)||((C=A.conditions)===null||C===void 0||(C=C.utm)===null||C===void 0?void 0:C.utm_source)==e.utm_source,a=!(!((Q=A.conditions)===null||Q===void 0||(Q=Q.utm)===null||Q===void 0)&&Q.utm_medium)||((i=A.conditions)===null||i===void 0||(i=i.utm)===null||i===void 0?void 0:i.utm_medium)==e.utm_medium,c=!(!((E=A.conditions)===null||E===void 0||(E=E.utm)===null||E===void 0)&&E.utm_term)||((n=A.conditions)===null||n===void 0||(n=n.utm)===null||n===void 0?void 0:n.utm_term)==e.utm_term;return s&&a&&c&&r}return!1}static Kp(A,...I){Dt.info(`[WebExperiments] ${A}`,I)}Yp(A,I,e){this._is_bot()?Kp.Kp(fwg):I!=="control"?e.forEach(t=>{if(t.selector){var o;Kp.Kp(`applying transform of variant ${I} for experiment ${A} `,t);const B=(o=document)===null||o===void 0?void 0:o.querySelectorAll(t.selector);B?.forEach(C=>{const Q=C;t.html&&(Q.innerHTML=t.html),t.css&&Q.setAttribute("style",t.css)})}}):Kp.Kp("Control variants leave the page unmodified.")}_is_bot(){return Rw&&this._instance?Vyg(Rw,this.Ar.custom_blocked_useragents):void 0}}},eQA),TXI={conversations:class{constructor(g){this._instance=g,this.sg=void 0,this._conversationsManager=null,this.rg=!1,this.ne=null,this.og=!1,this.ag=0}initialize(){this.loadIfEnabled()}onRemoteConfig(g){if(this._instance.config.disable_conversations||(this.lg=g.ok,!g.ok))return;const A=g.config.conversations;rC(A)||(gm(A)?this.sg=A:(this.sg=A.enabled,this.ne=A),this.loadIfEnabled())}reset(){var g;(g=this._conversationsManager)===null||g===void 0||g.reset(),this._conversationsManager=null,this.ag++,this.sg=void 0,this.ne=null,this.lg=void 0,this.og=!1}loadIfEnabled(){if(this._conversationsManager||this.rg||this._instance.config.disable_conversations||MRA(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const g=FB?.__PosthogExtensions__;if(g&&!Le(this.sg)&&this.sg)if(this.ne&&this.ne.token){this.rg=!0;try{const A=g.initConversations;if(A)return this.ug(A),void(this.rg=!1);const I=g.loadExternalDependency;if(!I)return void this.cg(QRA);const e=this.ag;I(this._instance,"conversations",t=>{if(e!==this.ag)return this.rg=!1,void this.loadIfEnabled();t||!g.initConversations?this.cg("Could not load conversations script",t):this.ug(g.initConversations),this.rg=!1})}catch(A){this.cg("Error initializing conversations",A),this.rg=!1}}else E2.error("Conversations enabled but missing token in remote config.")}ug(g){if(this.ne)try{this._conversationsManager=g(this.ne,this._instance),this.og=!1,E2.info("Conversations loaded successfully")}catch(A){this.cg("Error completing conversations initialization",A)}else E2.error("Cannot complete initialization: remote config is null")}cg(g,A){E2.error(g,A),this._conversationsManager=null,this.rg=!1,this.og=!0}show(){this._conversationsManager?this._conversationsManager.show():E2.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.sg===!0&&!fc(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":MRA(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.lg===!1?"remote_config_failed":Le(this.sg)?this.lg?"disabled_in_project":"remote_config_pending":this.sg?rC(this.ne)||!this.ne.token?"missing_token":FB?.__PosthogExtensions__?this.rg?"initializing":this.og?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var g,A;return(g=(A=this._conversationsManager)===null||A===void 0?void 0:A.isVisible())!==null&&g!==void 0&&g}sendMessage(g,A,I){var e=this;return oa(function*(){return e._conversationsManager?e._conversationsManager.sendMessage(g,A,I):(E2.warn(RY),null)})()}getMessages(g,A){var I=this;return oa(function*(){return I._conversationsManager?I._conversationsManager.getMessages(g,A):(E2.warn(RY),null)})()}markAsRead(g){var A=this;return oa(function*(){return A._conversationsManager?A._conversationsManager.markAsRead(g):(E2.warn(RY),null)})()}getTickets(g){var A=this;return oa(function*(){return A._conversationsManager?A._conversationsManager.getTickets(g):(E2.warn(RY),null)})()}requestRestoreLink(g){var A=this;return oa(function*(){return A._conversationsManager?A._conversationsManager.requestRestoreLink(g):(E2.warn(RY),null)})()}restoreFromToken(g){var A=this;return oa(function*(){return A._conversationsManager?A._conversationsManager.restoreFromToken(g):(E2.warn(RY),null)})()}restoreFromUrlToken(){var g=this;return oa(function*(){return g._conversationsManager?g._conversationsManager.restoreFromUrlToken():(E2.warn(RY),null)})()}getCurrentTicketId(){var g,A;return(g=(A=this._conversationsManager)===null||A===void 0?void 0:A.getCurrentTicketId())!==null&&g!==void 0?g:null}getWidgetSessionId(){var g,A;return(g=(A=this._conversationsManager)===null||A===void 0?void 0:A.getWidgetSessionId())!==null&&g!==void 0?g:null}vd(){var g;(g=this._conversationsManager)===null||g===void 0||g.setIdentity()}fd(){var g;(g=this._conversationsManager)===null||g===void 0||g.clearIdentity()}}},ZXI={logs:class extends mXI{constructor(g){super({get(){var A;return g==null||(A=g.config)===null||A===void 0?void 0:A.logs},captureHintKey:sdg,get remoteConfigWillArrive(){var A,I;return!(!((A=g.Qu)===null||A===void 0)&&A.call(g))||!!(!((I=FB._POSTHOG_REMOTE_CONFIG)===null||I===void 0||(I=I[g.config.token])===null||I===void 0)&&I.config)}},()=>(function(A){var I;const e={};if(e.distinctId=A.get_distinct_id(),A.sessionManager){const{sessionId:t,windowId:o,sessionStartTimestamp:B,lastActivityTimestamp:C}=A.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=t,e.windowId=o,rC(B)||(e.sessionStartTimestamp=B),rC(C)||(e.lastActivityTimestamp=C)}if(!(FB==null||(I=FB.location)===null||I===void 0)&&I.href&&(e.currentUrl=A.config.disable_capture_url_hashes?v4(FB.location.href):FB.location.href),A.featureFlags){const t=A.featureFlags.getFlags();t&&t.length>0&&(e.activeFeatureFlags=t)}return e})(g)),this._instance=g,this.name=owg,this.Hv()}get Bv(){return this._instance.__loaded}zv(){const g=qr("[logs]"),A=FB?.__PosthogExtensions__;if(!A)return void g.error("PostHog Extensions not found.");const I=A.loadExternalDependency;if(I)return e=>{I(this._instance,"logs",t=>{const o=A.logs;e(t,o?.initializeLogs?{initialize:B=>o.initializeLogs(B),replay(B,C){var Q;return(Q=o.replayConsoleBuffer)===null||Q===void 0?void 0:Q.call(o,B,C)}}:void 0)})};g.error(QRA)}}},OXI={metrics:class{constructor(g){this._instance=g,this.$=qr("[metrics]"),this.Ci=!1}initialize(){this.onConfigChange()}onConfigChange(){var g;if(this.Ci)return;const A=!!(!((g=this._instance.config.metrics)===null||g===void 0)&&g.network);A&&!this.hg?this.hg=(I=>{let e=!0;const t=()=>e?(C=>{var Q;const i=(Q=C.config.metrics)===null||Q===void 0?void 0:Q.network;return i===!0?{}:i||void 0})(I):void 0,o=MXI(I,t),B=SXI(I,t);return()=>{e=!1,o(),B()}})(this._instance):!A&&this.hg&&(this.hg(),this.hg=void 0)}Vv(){var g;const A=(g=this._instance)===null||g===void 0||(g=g.config)===null||g===void 0?void 0:g.metrics;var I;return this.qv&&this.Gv===A||((I=this.qv)===null||I===void 0||I.reset(),this.Gv=A,this.qv=new djI(this.Wv(),(function(e){var t,o,B,C,Q;const i=e?.resourceAttributes;return{serviceName:(t=i?.["service.name"])!==null&&t!==void 0?t:e?.serviceName,serviceVersion:(o=i?.["service.version"])!==null&&o!==void 0?o:e?.serviceVersion,environment:(B=i?.["deployment.environment"])!==null&&B!==void 0?B:e?.environment,resourceAttributes:i,beforeSend:e?.beforeSend,flushIntervalMs:(C=e?.flushIntervalMs)!==null&&C!==void 0?C:1e4,maxSeriesPerFlush:(Q=e?.maxSeriesPerFlush)!==null&&Q!==void 0?Q:1e3}})(A),this.$)),this.qv}count(g,A=1,I){this.Vv().count(g,A,I)}gauge(g,A,I){this.Vv().gauge(g,A,I)}histogram(g,A,I){this.Vv().histogram(g,A,I)}flush(g){if(!this.qv)return Promise.resolve();if(g){const A=this.qv.drainWindow();return A&&this.po(A,g),Promise.resolve()}return this.qv.flush().catch(A=>this.$.error("PostHog metrics flush failed:",A))}reset(){var g;(g=this.qv)===null||g===void 0||g.reset()}dispose(){var g,A;this.Ci=!0,(g=this.hg)===null||g===void 0||g.call(this),this.hg=void 0,(A=this.qv)===null||A===void 0||A.reset()}Wv(){const g=this._instance,A=this;return{get isDisabled(){return!1},get optedOut(){return!g.is_capturing()},po:I=>A.po(I),getLibraryId:()=>bp.LIB_NAME,getLibraryVersion:()=>bp.LIB_VERSION}}po(g,A){return new Promise(I=>{let e=!1;const t=B=>{e||(e=!0,clearTimeout(o),I(B))},o=setTimeout(()=>t({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(QI(QI({method:"POST",url:this.dg(),data:g,compression:"best-available",batchKey:"metrics"},A&&{transport:A}),{},{fireCallbackOnDrop:!0,callback(B){const C=B.statusCode;if(C>=200&&300>C)t({kind:"ok"});else if(C===413)t({kind:"too-large"});else if(C!==0&&C!==408&&C!==429&&500>C)t({kind:"fatal",error:new Error(`metrics request failed with status ${C}`)});else{var Q;t({kind:"retry-later",error:(Q=B.error)!==null&&Q!==void 0?Q:new Error(`metrics request failed with status ${C}`)})}}}))})}dg(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},WXI={webMCP:class{constructor(g){this._instance=g,this.vg=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.vg)return;const g=ro?.modelContext;if(!g||!Xh(g.registerTool))return;const A=Pwg.get(g);if(A)return A.instances.add(this._instance),void(this.vg=!0);const I={instances:new Set([this._instance])},e=g.registerTool,t=this;IH(g,"registerTool",o=>{const B=o;return function(C,...Q){let i=C;try{i=t.fg(C,I)}catch{return B.call(this,C,...Q)}return B.call(this,i,...Q)}}),g.registerTool!==e&&(Pwg.set(g,I),this.vg=!0)}fg(g,A){if(!g||!Xh(g.execute))return g;const I=g.execute,e=this,{tool:t,injected:o}=(function(B,C){const Q={intent:!1,model:!1},i=B.inputSchema;if(!(function(a){return!!Le(a)||yC(a)&&Object.keys(a).every(c=>fXI.has(c)||c.startsWith("x-"))&&a.additionalProperties!==!0&&!yC(a.additionalProperties)&&(!a.type||a.type==="object")&&(!a.properties||yC(a.properties))&&(!a.required||aB(a.required))})(i))return{tool:uNA(B),injected:Q};const E=i?.properties||{},n=a=>wNA(E,a)||aB(i?.required)&&i.required.includes(a);if(Q.intent=C.intent&&!n("context"),Q.model=C.model&&!n("llm_model"),!Q.intent&&!Q.model)return{tool:uNA(B),injected:Q};const s=QI({},E),r=aB(i?.required)?[...i.required]:[];return Q.intent&&(s.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".`},r.includes("context")||r.push("context")),Q.model&&(s.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.'},r.includes("llm_model")||r.push("llm_model")),{tool:uNA(B,QI(QI({},i),{},{type:i?.type||"object",properties:s,required:r})),injected:Q}})(g,(function(B){const C={intent:!1,model:!1};for(const Q of B.instances){const i=Kwg(Q.config.capture_webmcp);C.intent||(C.intent=i?.intent===!0),C.model||(C.model=i?.model===!0)}return C})(A));return Object.defineProperty(t,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...B){const C=new Date,Q=(function(r,a){if(!yC(r))return{};try{const c=a.intent?Lwg(r.context,2048,!0):void 0,h=a.model?Lwg(r.llm_model,256):void 0;return QI(QI({},c&&c!=="{}"?{intent:c}:{}),h&&h.toLowerCase()!=="unknown"?{model:h}:{})}catch{return{}}})(B[0],o),i=(function(r,a){const c=r[0];if(!yC(c))return r;try{const h=a.intent&&wNA(c,"context"),l=a.model&&wNA(c,"llm_model");if(!h&&!l)return r;const D=QI({},c);return h&&delete D.context,l&&delete D.llm_model,[D,...r.slice(1)]}catch{return r}})(B,o);let E;try{E=I.apply(this===t?g:this,i)}catch(r){throw e.pg(A,t,C,{error:r,errorResult:!1},Q),r}if((n=E)&&typeof n.then=="function")return Promise.resolve(E).then(r=>{const a=Ywg(r)?{error:r,errorResult:!0}:void 0;return e.pg(A,t,C,a,Q),r},r=>{throw e.pg(A,t,C,{error:r,errorResult:!1},Q),r});var n;const s=Ywg(E)?{error:E,errorResult:!0}:void 0;return e.pg(A,t,C,s,Q),E}}),t}pg(g,A,I,e,t){const o=Date.now()-I.getTime();let B;for(const Q of g.instances){var C;const i=Kwg(Q.config.capture_webmcp);if(i){e&&!B&&(B=JXI(e.error,e.errorResult));try{Q.capture("$mcp_tool_call",QI(QI(QI({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:A.name,$mcp_resource_name:A.name,$mcp_tool_description:A.description,$mcp_server_name:ta?.hostname,$mcp_duration_ms:o,$mcp_is_error:!!e},B?{$mcp_error_type:B.type,$mcp_error_message:B.message}:{}),i.intent&&t.intent?{$mcp_intent:t.intent,$mcp_intent_source:"context_parameter"}:{}),i.model&&t.model?{$mcp_llm_model:t.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:I})}catch{continue}if(e&&B&&Q.exceptions&&(!((C=Q.exceptionObserver)===null||C===void 0)&&C.isEnabled))try{const E={$exception_list:FXI(Q.exceptions,e,B.message),$exception_level:"error",$exception_source:"mcp.tool_call",$mcp_interface:"webmcp",$mcp_tool_name:A.name,$mcp_resource_name:A.name,$mcp_tool_description:A.description,$mcp_server_name:ta?.hostname};Q.exceptionObserver.captureException(E)}catch{}}}}}};KV.__defaultExtensionClasses=QI({},QI(QI(QI(QI(QI(QI(QI(QI(QI(QI(QI(QI(QI(QI({},eQA),PXI),KXI),LXI),YXI),_XI),HXI),bXI),vXI),qXI),TXI),ZXI),OXI),WXI));var oH=(function(){bp.SDK_DIST_CHANNEL="npm";const g=UV[PV]=new KV;return(function(){function A(){A.done||(A.done=!0,qyg=!1,dn(UV,function(I){I._dom_loaded()}))}ro?.addEventListener?ro.readyState==="complete"?A():GE(ro,"DOMContentLoaded",A,{capture:!1}):Me&&Dt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),g})();class NY extends Error{response;request;options;constructor(A,I,e){const t=A.status||A.status===0?A.status:"",o=A.statusText??"",B=`${t} ${o}`.trim(),C=B?`status code ${B}`:"an unknown error";super(`Request failed with ${C}: ${I.method} ${I.url}`),this.name="HTTPError",this.response=A,this.request=I,this.options=e}}class bwg extends Error{name="NonError";value;constructor(A){let I="Non-error value was thrown";try{typeof A=="string"?I=A:A&&typeof A=="object"&&"message"in A&&typeof A.message=="string"&&(I=A.message)}catch{}super(I),this.value=A}}class GNA extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(A){const I=A?.cause?A.cause instanceof Error?A.cause:new bwg(A.cause):void 0;super(A?.code?`Forced retry: ${A.code}`:"Forced retry",I?{cause:I}:void 0),this.customDelay=A?.delay,this.code=A?.code,this.customRequest=A?.request}}const Hwg=(()=>{let g=!1,A=!1;const I=typeof globalThis.ReadableStream=="function",e=typeof globalThis.Request=="function";if(I&&e)try{A=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return g=!0,"half"}}).headers.has("Content-Type")}catch(t){if(t instanceof Error&&t.message==="unsupported BodyInit type")return!1;throw t}return g&&!A})(),VXI=typeof globalThis.AbortController=="function",vwg=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",jXI=typeof globalThis.ReadableStream=="function",zXI=typeof globalThis.FormData=="function",qwg=["get","post","put","patch","head","delete"],XXI={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},mNA=2147483647,$XI=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Twg=Symbol("stop");class Zwg{options;constructor(A){this.options=A}}const A$I=g=>new Zwg(g),g$I={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},I$I={next:!0},e$I={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},t$I=g=>{if(!g)return 0;if(g instanceof FormData){let A=0;for(const[I,e]of g)A+=$XI,A+=new TextEncoder().encode(`Content-Disposition: form-data; name="${I}"`).length,A+=typeof e=="string"?new TextEncoder().encode(e).length:e.size;return A}if(g instanceof Blob)return g.size;if(g instanceof ArrayBuffer)return g.byteLength;if(typeof g=="string")return new TextEncoder().encode(g).length;if(g instanceof URLSearchParams)return new TextEncoder().encode(g.toString()).length;if("byteLength"in g)return g.byteLength;if(typeof g=="object"&&g!==null)try{const A=JSON.stringify(g);return new TextEncoder().encode(A).length}catch{return 0}return 0},Owg=(g,A,I)=>{let e,t=0;return g.pipeThrough(new TransformStream({transform(o,B){if(B.enqueue(o),e){t+=e.byteLength;let C=A===0?0:t/A;C>=1&&(C=1-Number.EPSILON),I?.({percent:C,totalBytes:Math.max(A,t),transferredBytes:t},e)}e=o},flush(){e&&(t+=e.byteLength,I?.({percent:1,totalBytes:Math.max(A,t),transferredBytes:t},e))}}))},o$I=(g,A)=>{if(!g.body)return g;if(g.status===204)return new Response(null,{status:g.status,statusText:g.statusText,headers:g.headers});const I=Math.max(0,Number(g.headers.get("content-length"))||0);return new Response(Owg(g.body,I,A),{status:g.status,statusText:g.statusText,headers:g.headers})},B$I=(g,A,I)=>{if(!g.body)return g;const e=t$I(I??g.body);return new Request(g,{duplex:"half",body:Owg(g.body,e,A)})},xY=g=>g!==null&&typeof g=="object",tQA=(...g)=>{for(const A of g)if((!xY(A)||Array.isArray(A))&&A!==void 0)throw new TypeError("The `options` argument must be an object");return pNA({},...g)},Wwg=(g={},A={})=>{const I=new globalThis.Headers(g),e=A instanceof globalThis.Headers,t=new globalThis.Headers(A);for(const[o,B]of t.entries())e&&B==="undefined"||B===void 0?I.delete(o):I.set(o,B);return I};function oQA(g,A,I){return Object.hasOwn(A,I)&&A[I]===void 0?[]:pNA(g[I]??[],A[I]??[])}const Vwg=(g={},A={})=>({beforeRequest:oQA(g,A,"beforeRequest"),beforeRetry:oQA(g,A,"beforeRetry"),afterResponse:oQA(g,A,"afterResponse"),beforeError:oQA(g,A,"beforeError")}),C$I=(g,A)=>{const I=new URLSearchParams;for(const e of[g,A])if(e!==void 0)if(e instanceof URLSearchParams)for(const[t,o]of e.entries())I.append(t,o);else if(Array.isArray(e))for(const t of e){if(!Array.isArray(t)||t.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");I.append(String(t[0]),String(t[1]))}else if(xY(e))for(const[t,o]of Object.entries(e))o!==void 0&&I.append(t,String(o));else{const t=new URLSearchParams(e);for(const[o,B]of t.entries())I.append(o,B)}return I},pNA=(...g)=>{let A={},I={},e={},t;const o=[];for(const B of g)if(Array.isArray(B))Array.isArray(A)||(A=[]),A=[...A,...B];else if(xY(B)){for(let[C,Q]of Object.entries(B)){if(C==="signal"&&Q instanceof globalThis.AbortSignal){o.push(Q);continue}if(C==="context"){if(Q!=null&&(!xY(Q)||Array.isArray(Q)))throw new TypeError("The `context` option must be an object");A={...A,context:Q==null?{}:{...A.context,...Q}};continue}if(C==="searchParams"){Q==null?t=void 0:t=t===void 0?Q:C$I(t,Q);continue}xY(Q)&&C in A&&(Q=pNA(A[C],Q)),A={...A,[C]:Q}}xY(B.hooks)&&(e=Vwg(e,B.hooks),A.hooks=e),xY(B.headers)&&(I=Wwg(I,B.headers),A.headers=I)}return t!==void 0&&(A.searchParams=t),o.length>0&&(o.length===1?A.signal=o[0]:vwg?A.signal=AbortSignal.any(o):A.signal=o.at(-1)),A},Q$I=g=>qwg.includes(g)?g.toUpperCase():g,jwg={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:g=>.3*2**(g-1)*1e3,jitter:void 0,retryOnTimeout:!1},i$I=(g={})=>{if(typeof g=="number")return{...jwg,limit:g};if(g.methods&&!Array.isArray(g.methods))throw new Error("retry.methods must be an array");if(g.methods&&=g.methods.map(I=>I.toLowerCase()),g.statusCodes&&!Array.isArray(g.statusCodes))throw new Error("retry.statusCodes must be an array");const A=Object.fromEntries(Object.entries(g).filter(([,I])=>I!==void 0));return{...jwg,...A}};class kNA extends Error{request;constructor(A){super(`Request timed out: ${A.method} ${A.url}`),this.name="TimeoutError",this.request=A}}async function E$I(g,A,I,e){return new Promise((t,o)=>{const B=setTimeout(()=>{I&&I.abort(),o(new kNA(g))},e.timeout);e.fetch(g,A).then(t).catch(o).then(()=>{clearTimeout(B)})})}async function n$I(g,{signal:A}){return new Promise((I,e)=>{A&&(A.throwIfAborted(),A.addEventListener("abort",t,{once:!0}));function t(){clearTimeout(o),e(A.reason)}const o=setTimeout(()=>{A?.removeEventListener("abort",t),I()},g)})}const s$I=(g,A)=>{const I={};for(const e in A)Object.hasOwn(A,e)&&!(e in e$I)&&!(e in g$I)&&(!(e in g)||e in I$I)&&(I[e]=A[e]);return I},a$I=g=>g===void 0?!1:Array.isArray(g)?g.length>0:g instanceof URLSearchParams?g.size>0:typeof g=="object"?Object.keys(g).length>0:typeof g=="string"?g.trim().length>0:!!g;function r$I(g){return g instanceof NY||g?.name===NY.name}function c$I(g){return g instanceof kNA||g?.name===kNA.name}let zwg=class Whg{static create(A,I){const e=new Whg(A,I),t=async()=>{if(typeof e.#A.timeout=="number"&&e.#A.timeout>mNA)throw new RangeError(`The \`timeout\` option cannot be greater than ${mNA}`);await Promise.resolve();let B=await e.#l();for(const C of e.#A.hooks.afterResponse){const Q=e.#a(B.clone());let i;try{i=await C(e.request,e.#i(),Q,{retryCount:e.#I})}catch(n){throw e.#o(Q),e.#o(B),n}if(i instanceof Zwg)throw e.#o(Q),e.#o(B),new GNA(i.options);const E=i instanceof globalThis.Response?i:B;Q!==E&&e.#o(Q),B!==E&&e.#o(B),B=E}if(e.#a(B),!B.ok&&(typeof e.#A.throwHttpErrors=="function"?e.#A.throwHttpErrors(B.status):e.#A.throwHttpErrors)){let C=new NY(B,e.request,e.#i());for(const Q of e.#A.hooks.beforeError)C=await Q(C,{retryCount:e.#I});throw C}if(e.#A.onDownloadProgress){if(typeof e.#A.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!jXI)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");const C=B.clone();return e.#o(B),o$I(C,e.#A.onDownloadProgress)}return B},o=e.#r(t).finally(()=>{const B=e.#B;e.#n(B?.body??void 0),e.#n(e.request.body??void 0)});for(const[B,C]of Object.entries(XXI))B==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[B]=async()=>{e.request.headers.set("accept",e.request.headers.get("accept")||C);const Q=await o;if(B==="json"){if(Q.status===204)return"";const i=await Q.text();return i===""?"":I.parseJson?I.parseJson(i):JSON.parse(i)}return Q[B]()});return o}static#C(A){return A&&typeof A=="object"&&!Array.isArray(A)&&!(A instanceof URLSearchParams)?Object.fromEntries(Object.entries(A).filter(([,I])=>I!==void 0)):A}request;#e;#I=0;#g;#A;#B;#t;#Q;constructor(A,I={}){if(this.#g=A,this.#A={...I,headers:Wwg(this.#g.headers,I.headers),hooks:Vwg({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},I.hooks),method:Q$I(I.method??this.#g.method??"GET"),prefixUrl:String(I.prefixUrl||""),retry:i$I(I.retry),throwHttpErrors:I.throwHttpErrors??!0,timeout:I.timeout??1e4,fetch:I.fetch??globalThis.fetch.bind(globalThis),context:I.context??{}},typeof this.#g!="string"&&!(this.#g instanceof URL||this.#g instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this.#A.prefixUrl&&typeof this.#g=="string"){if(this.#g.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this.#A.prefixUrl.endsWith("/")||(this.#A.prefixUrl+="/"),this.#g=this.#A.prefixUrl+this.#g}VXI&&vwg&&(this.#t=this.#A.signal??this.#g.signal,this.#e=new globalThis.AbortController,this.#A.signal=this.#t?AbortSignal.any([this.#t,this.#e.signal]):this.#e.signal),Hwg&&(this.#A.duplex="half"),this.#A.json!==void 0&&(this.#A.body=this.#A.stringifyJson?.(this.#A.json)??JSON.stringify(this.#A.json),this.#A.headers.set("content-type",this.#A.headers.get("content-type")??"application/json"));const e=I.headers&&new globalThis.Headers(I.headers).has("content-type");if(this.#g instanceof globalThis.Request&&(zXI&&this.#A.body instanceof globalThis.FormData||this.#A.body instanceof URLSearchParams)&&!e&&this.#A.headers.delete("content-type"),this.request=new globalThis.Request(this.#g,this.#A),a$I(this.#A.searchParams)){const o="?"+(typeof this.#A.searchParams=="string"?this.#A.searchParams.replace(/^\?/,""):new URLSearchParams(Whg.#C(this.#A.searchParams)).toString()),B=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,o);this.request=new globalThis.Request(B,this.#A)}if(this.#A.onUploadProgress){if(typeof this.#A.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!Hwg)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#c(this.request,this.#A.body??void 0)}}#E(){const A=this.#A.retry.delay(this.#I);let I=A;this.#A.retry.jitter===!0?I=Math.random()*A:typeof this.#A.retry.jitter=="function"&&(I=this.#A.retry.jitter(A),(!Number.isFinite(I)||I<0)&&(I=A));const e=this.#A.retry.backoffLimit??Number.POSITIVE_INFINITY;return Math.min(e,I)}async#h(A){if(this.#I++,this.#I>this.#A.retry.limit)throw A;const I=A instanceof Error?A:new bwg(A);if(I instanceof GNA)return I.customDelay??this.#E();if(!this.#A.retry.methods.includes(this.request.method.toLowerCase()))throw A;if(this.#A.retry.shouldRetry!==void 0){const e=await this.#A.retry.shouldRetry({error:I,retryCount:this.#I});if(e===!1)throw A;if(e===!0)return this.#E()}if(c$I(A)&&!this.#A.retry.retryOnTimeout)throw A;if(r$I(A)){if(!this.#A.retry.statusCodes.includes(A.response.status))throw A;const e=A.response.headers.get("Retry-After")??A.response.headers.get("RateLimit-Reset")??A.response.headers.get("X-RateLimit-Retry-After")??A.response.headers.get("X-RateLimit-Reset")??A.response.headers.get("X-Rate-Limit-Reset");if(e&&this.#A.retry.afterStatusCodes.includes(A.response.status)){let t=Number(e)*1e3;Number.isNaN(t)?t=Date.parse(e)-Date.now():t>=Date.parse("2024-01-01")&&(t-=Date.now());const o=this.#A.retry.maxRetryAfter??t;return t<o?t:o}if(A.response.status===413)throw A}return this.#E()}#a(A){return this.#A.parseJson&&(A.json=async()=>this.#A.parseJson(await A.text())),A}#n(A){A&&A.cancel().catch(()=>{})}#o(A){this.#n(A.body??void 0)}async#r(A){try{return await A()}catch(I){const e=Math.min(await this.#h(I),mNA);if(this.#I<1)throw I;if(await n$I(e,this.#t?{signal:this.#t}:{}),I instanceof GNA&&I.customRequest){const t=this.#A.signal?new globalThis.Request(I.customRequest,{signal:this.#A.signal}):new globalThis.Request(I.customRequest);this.#s(t)}for(const t of this.#A.hooks.beforeRetry){const o=await t({request:this.request,options:this.#i(),error:I,retryCount:this.#I});if(o instanceof globalThis.Request){this.#s(o);break}if(o instanceof globalThis.Response)return o;if(o===Twg)return}return this.#r(A)}}async#l(){this.#e?.signal.aborted&&(this.#e=new globalThis.AbortController,this.#A.signal=this.#t?AbortSignal.any([this.#t,this.#e.signal]):this.#e.signal,this.request=new globalThis.Request(this.request,{signal:this.#A.signal}));for(const I of this.#A.hooks.beforeRequest){const e=await I(this.request,this.#i(),{retryCount:this.#I});if(e instanceof Response)return e;if(e instanceof globalThis.Request){this.#s(e);break}}const A=s$I(this.request,this.#A);return this.#B=this.request,this.request=this.#B.clone(),this.#A.timeout===!1?this.#A.fetch(this.#B,A):E$I(this.#B,A,this.#e,this.#A)}#i(){if(!this.#Q){const{hooks:A,...I}=this.#A;this.#Q=Object.freeze(I)}return this.#Q}#s(A){this.#Q=void 0,this.request=this.#c(A)}#c(A,I){return!this.#A.onUploadProgress||!A.body?A:B$I(A,this.#A.onUploadProgress,I??this.#A.body??void 0)}};const MNA=g=>{const A=(I,e)=>zwg.create(I,tQA(g,e));for(const I of qwg)A[I]=(e,t)=>zwg.create(e,tQA(g,t,{method:I}));return A.create=I=>MNA(tQA(I)),A.extend=I=>(typeof I=="function"&&(I=I(g??{})),MNA(tQA(g,I))),A.stop=Twg,A.retry=A$I,A},h$I=MNA();class l$I extends NY{constructor(A,I,e,t){super(A,I,e),this.name="RegistryHTTPError",this.message=t}}function jF(g){return typeof window<"u"?window[g]:null}function FY(){const g=jF("TSCIRCUIT_REGISTRY_API_BASE_URL")||void 0||"https://registry-api.tscircuit.com",A=jF("TSCIRCUIT_REGISTRY_TOKEN");return h$I.create({prefixUrl:g,headers:{Authorization:`Bearer ${A}`},timeout:3e4,hooks:{afterResponse:[async(I,e,t)=>{if(t.ok)return t;let o=null;try{o=await t.clone().json()}catch(n){console.error("Failed to parse registry error response",n)}const B=o?.error?.message??o?.error?.error_message??o?.message,C=o?.error?.error_code??o?.error_code,Q=new URL(t.url),E=[`Registry request failed for ${`${Q.pathname}${Q.search}`} (${t.status})`];throw B&&E.push(`Server message: ${B}`),C&&E.push(`Error code: ${C}`),new l$I(t,I,e,E.join(" | "))}]}})}function BQA(){return!!jF("TSCIRCUIT_REGISTRY_TOKEN")}const CQA={get:(g,A)=>FY().get(g,A),post:(g,A)=>FY().post(g,A),put:(g,A)=>FY().put(g,A),delete:(g,A)=>FY().delete(g,A),patch:(g,A)=>FY().patch(g,A)},D$I="phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo",d$I="https://postpig.tscircuit.com",Xwg="runframe:anonymous-id",SNA=()=>typeof window<"u",$wg=g=>g.includes("localhost")||g.includes("127.0.0.1"),y$I=g=>{try{return new URL(g).hostname}catch{return null}},w$I=()=>{if(!SNA())return null;let g=null;return document.referrer&&(g=y$I(document.referrer)),g??window.location.hostname},u$I=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,G$I=()=>{if(!SNA())return null;try{const g=window.localStorage.getItem(Xwg);if(g)return g;const A=u$I();return window.localStorage.setItem(Xwg,A),A}catch{return null}},m$I=()=>jF("TSCIRCUIT_USE_RUNFRAME_FOR_CLI")===!0,Aug=()=>!SNA()||jF("TSCIRCUIT_TELEMETRY_DISABLED")===!0||$wg(window.location.hostname)&&!m$I()?!1:(oH.__loaded||oH.init(D$I,{api_host:d$I,person_profiles:"always"}),!0),p$I=()=>{if(!Aug())return null;const g=w$I(),A=g!=null&&!$wg(g);let I=null;A||(I=G$I());let e,t;return A?(e=`domain:${g}`,t="domain"):(e=void 0,I&&(e=`anonymous:${I}`),t="anonymous_id"),{embedDomain:g,anonymousId:I,distinctId:e,identityType:t}},k$I=(g,{source:A,...I})=>{const e=p$I();if(!e)return;const{embedDomain:t,anonymousId:o,distinctId:B,identityType:C}=e;if(B){const Q={};C==="domain"&&t&&(Q.embed_domain=t),C==="anonymous_id"&&o&&(Q.runframe_anonymous_id=o),oH.identify(B,Q)}oH.capture(g,{...I,source:A,embed_domain:t,runframe_anonymous_id:o,identity_type:C})},M$I=g=>{k$I("runframe_activity",g)};Aug();function S$I(g){const A=String.fromCodePoint(...g);return btoa(A)}var wl=Uint8Array,pM=Uint16Array,fNA=Int32Array,QQA=new wl([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]),iQA=new wl([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]),RNA=new wl([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gug=function(g,A){for(var I=new pM(31),e=0;e<31;++e)I[e]=A+=1<<g[e-1];for(var t=new fNA(I[30]),e=1;e<30;++e)for(var o=I[e];o<I[e+1];++o)t[o]=o-I[e]<<5|e;return{b:I,r:t}},Iug=gug(QQA,2),eug=Iug.b,NNA=Iug.r;eug[28]=258,NNA[258]=28;for(var tug=gug(iQA,0),f$I=tug.b,oug=tug.r,xNA=new pM(32768),Nc=0;Nc<32768;++Nc){var j4=(Nc&43690)>>1|(Nc&21845)<<1;j4=(j4&52428)>>2|(j4&13107)<<2,j4=(j4&61680)>>4|(j4&3855)<<4,xNA[Nc]=((j4&65280)>>8|(j4&255)<<8)>>1}for(var PN=(function(g,A,I){for(var e=g.length,t=0,o=new pM(A);t<e;++t)g[t]&&++o[g[t]-1];var B=new pM(A);for(t=1;t<A;++t)B[t]=B[t-1]+o[t-1]<<1;var C;if(I){C=new pM(1<<A);var Q=15-A;for(t=0;t<e;++t)if(g[t])for(var i=t<<4|g[t],E=A-g[t],n=B[g[t]-1]++<<E,s=n|(1<<E)-1;n<=s;++n)C[xNA[n]>>Q]=i}else for(C=new pM(e),t=0;t<e;++t)g[t]&&(C[t]=xNA[B[g[t]-1]++]>>15-g[t]);return C}),z4=new wl(288),Nc=0;Nc<144;++Nc)z4[Nc]=8;for(var Nc=144;Nc<256;++Nc)z4[Nc]=9;for(var Nc=256;Nc<280;++Nc)z4[Nc]=7;for(var Nc=280;Nc<288;++Nc)z4[Nc]=8;for(var YV=new wl(32),Nc=0;Nc<32;++Nc)YV[Nc]=5;var R$I=PN(z4,9,0),N$I=PN(z4,9,1),x$I=PN(YV,5,0),F$I=PN(YV,5,1),FNA=function(g){for(var A=g[0],I=1;I<g.length;++I)g[I]>A&&(A=g[I]);return A},Kf=function(g,A,I){var e=A/8|0;return(g[e]|g[e+1]<<8)>>(A&7)&I},UNA=function(g,A){var I=A/8|0;return(g[I]|g[I+1]<<8|g[I+2]<<16)>>(A&7)},JNA=function(g){return(g+7)/8|0},BH=function(g,A,I){return(A==null||A<0)&&(A=0),(I==null||I>g.length)&&(I=g.length),new wl(g.subarray(A,I))},U$I=["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"],vp=function(g,A,I){var e=new Error(A||U$I[g]);if(e.code=g,Error.captureStackTrace&&Error.captureStackTrace(e,vp),!I)throw e;return e},Bug=function(g,A,I,e){var t=g.length,o=0;if(!t||A.f&&!A.l)return I||new wl(0);var B=!I,C=B||A.i!=2,Q=A.i;B&&(I=new wl(t*3));var i=function(nA){var aA=I.length;if(nA>aA){var SA=new wl(Math.max(aA*2,nA));SA.set(I),I=SA}},E=A.f||0,n=A.p||0,s=A.b||0,r=A.l,a=A.d,c=A.m,h=A.n,l=t*8;do{if(!r){E=Kf(g,n,1);var D=Kf(g,n+1,3);if(n+=3,D)if(D==1)r=N$I,a=F$I,c=9,h=5;else if(D==2){var u=Kf(g,n,31)+257,G=Kf(g,n+10,15)+4,m=u+Kf(g,n+5,31)+1;n+=14;for(var p=new wl(m),k=new wl(19),S=0;S<G;++S)k[RNA[S]]=Kf(g,n+S*3,7);n+=G*3;for(var R=FNA(k),x=(1<<R)-1,N=PN(k,R,1),S=0;S<m;){var U=N[Kf(g,n,x)];n+=U&15;var d=U>>4;if(d<16)p[S++]=d;else{var K=0,Y=0;for(d==16?(Y=3+Kf(g,n,3),n+=2,K=p[S-1]):d==17?(Y=3+Kf(g,n,7),n+=3):d==18&&(Y=11+Kf(g,n,127),n+=7);Y--;)p[S++]=K}}var b=p.subarray(0,u),q=p.subarray(u);c=FNA(b),h=FNA(q),r=PN(b,c,1),a=PN(q,h,1)}else vp(1);else{var d=JNA(n)+4,y=g[d-4]|g[d-3]<<8,w=d+y;if(w>t){Q&&vp(0);break}C&&i(s+y),I.set(g.subarray(d,w),s),A.b=s+=y,A.p=n=w*8,A.f=E;continue}if(n>l){Q&&vp(0);break}}C&&i(s+131072);for(var j=(1<<c)-1,Z=(1<<h)-1,O=n;;O=n){var K=r[UNA(g,n)&j],AA=K>>4;if(n+=K&15,n>l){Q&&vp(0);break}if(K||vp(2),AA<256)I[s++]=AA;else if(AA==256){O=n,r=null;break}else{var tA=AA-254;if(AA>264){var S=AA-257,eA=QQA[S];tA=Kf(g,n,(1<<eA)-1)+eug[S],n+=eA}var QA=a[UNA(g,n)&Z],sA=QA>>4;QA||vp(3),n+=QA&15;var q=f$I[sA];if(sA>3){var eA=iQA[sA];q+=UNA(g,n)&(1<<eA)-1,n+=eA}if(n>l){Q&&vp(0);break}C&&i(s+131072);var dA=s+tA;if(s<q){var CA=o-q,hA=Math.min(q,dA);for(CA+s<0&&vp(3);s<hA;++s)I[s]=e[CA+s]}for(;s<dA;++s)I[s]=I[s-q]}}A.l=r,A.p=O,A.b=s,A.f=E,r&&(E=1,A.m=c,A.d=a,A.n=h)}while(!E);return s!=I.length&&B?BH(I,0,s):I.subarray(0,s)},zF=function(g,A,I){I<<=A&7;var e=A/8|0;g[e]|=I,g[e+1]|=I>>8},_V=function(g,A,I){I<<=A&7;var e=A/8|0;g[e]|=I,g[e+1]|=I>>8,g[e+2]|=I>>16},PNA=function(g,A){for(var I=[],e=0;e<g.length;++e)g[e]&&I.push({s:e,f:g[e]});var t=I.length,o=I.slice();if(!t)return{t:Eug,l:0};if(t==1){var B=new wl(I[0].s+1);return B[I[0].s]=1,{t:B,l:1}}I.sort(function(w,u){return w.f-u.f}),I.push({s:-1,f:25001});var C=I[0],Q=I[1],i=0,E=1,n=2;for(I[0]={s:-1,f:C.f+Q.f,l:C,r:Q};E!=t-1;)C=I[I[i].f<I[n].f?i++:n++],Q=I[i!=E&&I[i].f<I[n].f?i++:n++],I[E++]={s:-1,f:C.f+Q.f,l:C,r:Q};for(var s=o[0].s,e=1;e<t;++e)o[e].s>s&&(s=o[e].s);var r=new pM(s+1),a=KNA(I[E-1],r,0);if(a>A){var e=0,c=0,h=a-A,l=1<<h;for(o.sort(function(u,G){return r[G.s]-r[u.s]||u.f-G.f});e<t;++e){var D=o[e].s;if(r[D]>A)c+=l-(1<<a-r[D]),r[D]=A;else break}for(c>>=h;c>0;){var d=o[e].s;r[d]<A?c-=1<<A-r[d]++-1:++e}for(;e>=0&&c;--e){var y=o[e].s;r[y]==A&&(--r[y],++c)}a=A}return{t:new wl(r),l:a}},KNA=function(g,A,I){return g.s==-1?Math.max(KNA(g.l,A,I+1),KNA(g.r,A,I+1)):A[g.s]=I},Cug=function(g){for(var A=g.length;A&&!g[--A];);for(var I=new pM(++A),e=0,t=g[0],o=1,B=function(Q){I[e++]=Q},C=1;C<=A;++C)if(g[C]==t&&C!=A)++o;else{if(!t&&o>2){for(;o>138;o-=138)B(32754);o>2&&(B(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(B(t),--o;o>6;o-=6)B(8304);o>2&&(B(o-3<<5|8208),o=0)}for(;o--;)B(t);o=1,t=g[C]}return{c:I.subarray(0,e),n:A}},bV=function(g,A){for(var I=0,e=0;e<A.length;++e)I+=g[e]*A[e];return I},Qug=function(g,A,I){var e=I.length,t=JNA(A+2);g[t]=e&255,g[t+1]=e>>8,g[t+2]=g[t]^255,g[t+3]=g[t+1]^255;for(var o=0;o<e;++o)g[t+o+4]=I[o];return(t+4+e)*8},iug=function(g,A,I,e,t,o,B,C,Q,i,E){zF(A,E++,I),++t[256];for(var n=PNA(t,15),s=n.t,r=n.l,a=PNA(o,15),c=a.t,h=a.l,l=Cug(s),D=l.c,d=l.n,y=Cug(c),w=y.c,u=y.n,G=new pM(19),m=0;m<D.length;++m)++G[D[m]&31];for(var m=0;m<w.length;++m)++G[w[m]&31];for(var p=PNA(G,7),k=p.t,S=p.l,R=19;R>4&&!k[RNA[R-1]];--R);var x=i+5<<3,N=bV(t,z4)+bV(o,YV)+B,U=bV(t,s)+bV(o,c)+B+14+3*R+bV(G,k)+2*G[16]+3*G[17]+7*G[18];if(Q>=0&&x<=N&&x<=U)return Qug(A,E,g.subarray(Q,Q+i));var K,Y,b,q;if(zF(A,E,1+(U<N)),E+=2,U<N){K=PN(s,r,0),Y=s,b=PN(c,h,0),q=c;var j=PN(k,S,0);zF(A,E,d-257),zF(A,E+5,u-1),zF(A,E+10,R-4),E+=14;for(var m=0;m<R;++m)zF(A,E+3*m,k[RNA[m]]);E+=3*R;for(var Z=[D,w],O=0;O<2;++O)for(var AA=Z[O],m=0;m<AA.length;++m){var tA=AA[m]&31;zF(A,E,j[tA]),E+=k[tA],tA>15&&(zF(A,E,AA[m]>>5&127),E+=AA[m]>>12)}}else K=R$I,Y=z4,b=x$I,q=YV;for(var m=0;m<C;++m){var eA=e[m];if(eA>255){var tA=eA>>18&31;_V(A,E,K[tA+257]),E+=Y[tA+257],tA>7&&(zF(A,E,eA>>23&31),E+=QQA[tA]);var QA=eA&31;_V(A,E,b[QA]),E+=q[QA],QA>3&&(_V(A,E,eA>>5&8191),E+=iQA[QA])}else _V(A,E,K[eA]),E+=Y[eA]}return _V(A,E,K[256]),E+Y[256]},J$I=new fNA([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Eug=new wl(0),P$I=function(g,A,I,e,t,o){var B=o.z||g.length,C=new wl(e+B+5*(1+Math.ceil(B/7e3))+t),Q=C.subarray(e,C.length-t),i=o.l,E=(o.r||0)&7;if(A){E&&(Q[0]=o.r>>3);for(var n=J$I[A-1],s=n>>13,r=n&8191,a=(1<<I)-1,c=o.p||new pM(32768),h=o.h||new pM(a+1),l=Math.ceil(I/3),D=2*l,d=function(xA){return(g[xA]^g[xA+1]<<l^g[xA+2]<<D)&a},y=new fNA(25e3),w=new pM(288),u=new pM(32),G=0,m=0,p=o.i||0,k=0,S=o.w||0,R=0;p+2<B;++p){var x=d(p),N=p&32767,U=h[x];if(c[N]=U,h[x]=N,S<=p){var K=B-p;if((G>7e3||k>24576)&&(K>423||!i)){E=iug(g,Q,0,y,w,u,m,k,R,p-R,E),k=G=m=0,R=p;for(var Y=0;Y<286;++Y)w[Y]=0;for(var Y=0;Y<30;++Y)u[Y]=0}var b=2,q=0,j=r,Z=N-U&32767;if(K>2&&x==d(p-Z))for(var O=Math.min(s,K)-1,AA=Math.min(32767,p),tA=Math.min(258,K);Z<=AA&&--j&&N!=U;){if(g[p+b]==g[p+b-Z]){for(var eA=0;eA<tA&&g[p+eA]==g[p+eA-Z];++eA);if(eA>b){if(b=eA,q=Z,eA>O)break;for(var QA=Math.min(Z,eA-2),sA=0,Y=0;Y<QA;++Y){var dA=p-Z+Y&32767,CA=c[dA],hA=dA-CA&32767;hA>sA&&(sA=hA,U=dA)}}}N=U,U=c[N],Z+=N-U&32767}if(q){y[k++]=268435456|NNA[b]<<18|oug[q];var nA=NNA[b]&31,aA=oug[q]&31;m+=QQA[nA]+iQA[aA],++w[257+nA],++u[aA],S=p+b,++G}else y[k++]=g[p],++w[g[p]]}}for(p=Math.max(p,S);p<B;++p)y[k++]=g[p],++w[g[p]];E=iug(g,Q,i,y,w,u,m,k,R,p-R,E),i||(o.r=E&7|Q[E/8|0]<<3,E-=7,o.h=h,o.p=c,o.i=p,o.w=S)}else{for(var p=o.w||0;p<B+i;p+=65535){var SA=p+65535;SA>=B&&(Q[E/8|0]=i,SA=B),E=Qug(Q,E+1,g.subarray(p,SA))}o.i=B}return BH(C,0,e+JNA(E)+t)},K$I=(function(){for(var g=new Int32Array(256),A=0;A<256;++A){for(var I=A,e=9;--e;)I=(I&1&&-306674912)^I>>>1;g[A]=I}return g})(),L$I=function(){var g=-1;return{p:function(A){for(var I=g,e=0;e<A.length;++e)I=K$I[I&255^A[e]]^I>>>8;g=I},d:function(){return~g}}},nug=function(){var g=1,A=0;return{p:function(I){for(var e=g,t=A,o=I.length|0,B=0;B!=o;){for(var C=Math.min(B+2655,o);B<C;++B)t+=e+=I[B];e=(e&65535)+15*(e>>16),t=(t&65535)+15*(t>>16)}g=e,A=t},d:function(){return g%=65521,A%=65521,(g&255)<<24|(g&65280)<<8|(A&255)<<8|A>>8}}},sug=function(g,A,I,e,t){if(!t&&(t={l:1},A.dictionary)){var o=A.dictionary.subarray(-32768),B=new wl(o.length+g.length);B.set(o),B.set(g,o.length),g=B,t.w=o.length}return P$I(g,A.level==null?6:A.level,A.mem==null?t.l?Math.ceil(Math.max(8,Math.min(13,Math.log(g.length)))*1.5):20:12+A.mem,I,e,t)},HV=function(g,A,I){for(;I;++A)g[A]=I,I>>>=8},Y$I=function(g,A){var I=A.filename;if(g[0]=31,g[1]=139,g[2]=8,g[8]=A.level<2?4:A.level==9?2:0,g[9]=3,A.mtime!=0&&HV(g,4,Math.floor(new Date(A.mtime||Date.now())/1e3)),I){g[3]=8;for(var e=0;e<=I.length;++e)g[e+10]=I.charCodeAt(e)}},_$I=function(g){return 10+(g.filename?g.filename.length+1:0)},b$I=function(g,A){var I=A.level,e=I==0?0:I<6?1:I==9?3:2;if(g[0]=120,g[1]=e<<6|(A.dictionary&&32),g[1]|=31-(g[0]<<8|g[1])%31,A.dictionary){var t=nug();t.p(A.dictionary),HV(g,2,t.d())}},aug=function(g,A){return((g[0]&15)!=8||g[0]>>4>7||(g[0]<<8|g[1])%31)&&vp(6,"invalid zlib data"),(g[1]>>5&1)==+!A&&vp(6,"invalid zlib data: "+(g[1]&32?"need":"unexpected")+" dictionary"),(g[1]>>3&4)+2},LNA=(function(){function g(A,I){typeof A=="function"&&(I=A,A={}),this.ondata=I;var e=A&&A.dictionary&&A.dictionary.subarray(-32768);this.s={i:0,b:e?e.length:0},this.o=new wl(32768),this.p=new wl(0),e&&this.o.set(e)}return g.prototype.e=function(A){if(this.ondata||vp(5),this.d&&vp(4),!this.p.length)this.p=A;else if(A.length){var I=new wl(this.p.length+A.length);I.set(this.p),I.set(A,this.p.length),this.p=I}},g.prototype.c=function(A){this.s.i=+(this.d=A||!1);var I=this.s.b,e=Bug(this.p,this.s,this.o);this.ondata(BH(e,I,this.s.b),this.d),this.o=BH(e,this.s.b-32768),this.s.b=this.o.length,this.p=BH(this.p,this.s.p/8|0),this.s.p&=7},g.prototype.push=function(A,I){this.e(A),this.c(I)},g})();function rug(g,A){A||(A={});var I=L$I(),e=g.length;I.p(g);var t=sug(g,A,_$I(A),8),o=t.length;return Y$I(t,A),HV(t,o-8,I.d()),HV(t,o-4,e),t}function cug(g,A){A||(A={});var I=nug();I.p(g);var e=sug(g,A,A.dictionary?6:2,4);return b$I(e,A),HV(e,e.length-4,I.d()),e}var EQA=(function(){function g(A,I){LNA.call(this,A,I),this.v=A&&A.dictionary?2:1}return g.prototype.push=function(A,I){if(LNA.prototype.e.call(this,A),this.v){if(this.p.length<6&&!I)return;this.p=this.p.subarray(aug(this.p,this.v-1)),this.v=0}I&&(this.p.length<4&&vp(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),LNA.prototype.c.call(this,I)},g})();function H$I(g,A){return Bug(g.subarray(aug(g,A),-4),{i:2},A,A)}var hug=typeof TextEncoder<"u"&&new TextEncoder,v$I=typeof TextDecoder<"u"&&new TextDecoder,q$I=0;try{v$I.decode(Eug,{stream:!0}),q$I=1}catch{}function lug(g,A){var I;if(hug)return hug.encode(g);for(var e=g.length,t=new wl(g.length+(g.length>>1)),o=0,B=function(i){t[o++]=i},I=0;I<e;++I){if(o+5>t.length){var C=new wl(o+8+(e-I<<1));C.set(t),t=C}var Q=g.charCodeAt(I);Q<128||A?B(Q):Q<2048?(B(192|Q>>6),B(128|Q&63)):Q>55295&&Q<57344?(Q=65536+(Q&1047552)|g.charCodeAt(++I)&1023,B(240|Q>>18),B(128|Q>>12&63),B(128|Q>>6&63),B(128|Q&63)):(B(224|Q>>12),B(128|Q>>6&63),B(128|Q&63))}return BH(t,0,o)}function T$I(g,A){const I=JSON.stringify(g),e=rug(lug(I));return`https://tscircuit.com/editor?#data:application/gzip;base64,${S$I(e)}`}function rB(...g){return _WI(Nf(g))}const Dug=g=>g.replace(/_/g," ").replace(/\b\w/g,A=>A.toUpperCase()),YNA=BWI,nQA=gA.forwardRef(({className:g,...A},I)=>W.jsx(ylg,{ref:I,className:rB("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",g),...A}));nQA.displayName=ylg.displayName;const KN=gA.forwardRef(({className:g,...A},I)=>W.jsx(wlg,{ref:I,className:rB("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",g),...A}));KN.displayName=wlg.displayName;const dy=gA.forwardRef(({className:g,...A},I)=>W.jsx(ulg,{ref:I,className:rB("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",g),...A}));dy.displayName=ulg.displayName;function mI(g,A){return Array.isArray(A)?[g.a*A[0]+g.c*A[1]+g.e,g.b*A[0]+g.d*A[1]+g.f]:{x:g.a*A.x+g.c*A.y+g.e,y:g.b*A.x+g.d*A.y+g.f}}const Z$I=/^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 O$I(g){const A=g.match(Z$I);if(A===null||A.length<7)throw new Error(`'${g}' is not a matrix`);return{a:parseFloat(A[1]),b:parseFloat(A[2]),c:parseFloat(A[3]),d:parseFloat(A[4]),e:parseFloat(A[5]),f:parseFloat(A[6])}}function W$I(g){const{a:A,b:I,c:e,d:t,e:o,f:B}=g,C=A*t-I*e;return{a:t/C,b:I/-C,c:e/-C,d:A/C,e:(t*o-e*B)/-C,f:(I*o-A*B)/C}}function vV(g){return typeof g>"u"}function rD(g,A=0){return{a:1,c:0,e:g,b:0,d:1,f:A}}function qV(...g){g=Array.isArray(g[0])?g[0]:g;const A=(I,e)=>({a:I.a*e.a+I.c*e.b,c:I.a*e.c+I.c*e.d,e:I.a*e.e+I.c*e.f+I.e,b:I.b*e.a+I.d*e.b,d:I.b*e.c+I.d*e.d,f:I.b*e.e+I.d*e.f+I.f});switch(g.length){case 0:throw new Error("no matrices provided");case 1:return g[0];case 2:return A(g[0],g[1]);default:{const[I,e,...t]=g,o=A(I,e);return qV(o,...t)}}}function zn(...g){return qV(...g)}const{cos:V$I,sin:j$I}=Math;function LN(g,A,I){const e=V$I(g),t=j$I(g),o={a:e,c:-t,e:0,b:t,d:e,f:0};return vV(A)||vV(I)?o:qV([rD(A,I),o,rD(-A,-I)])}function qp(g,A=void 0,I=void 0,e=void 0){vV(A)&&(A=g);const t={a:g,c:0,e:0,b:0,d:A,f:0};return vV(I)||vV(e)?t:qV([rD(I,e),t,rD(-I,-e)])}function z$I(g){return YN(g)}function YN(g){return`matrix(${g.a},${g.b},${g.c},${g.d},${g.e},${g.f})`}function X$I(g,A=1e10){return{a:Math.round(g.a*A)/A,b:Math.round(g.b*A)/A,c:Math.round(g.c*A)/A,d:Math.round(g.d*A)/A,e:Math.round(g.e*A)/A,f:Math.round(g.f*A)/A}}function $$I(g,A){const I=g[0].x!=null?g[0].x:g[0][0],e=g[0].y!=null?g[0].y:g[0][1],t=A[0].x!=null?A[0].x:A[0][0],o=A[0].y!=null?A[0].y:A[0][1],B=g[1].x!=null?g[1].x:g[1][0],C=g[1].y!=null?g[1].y:g[1][1],Q=A[1].x!=null?A[1].x:A[1][0],i=A[1].y!=null?A[1].y:A[1][1],E=g[2].x!=null?g[2].x:g[2][0],n=g[2].y!=null?g[2].y:g[2][1],s=A[2].x!=null?A[2].x:A[2][0],r=A[2].y!=null?A[2].y:A[2][1],a={a:I-E,b:e-n,c:B-E,d:C-n,e:E,f:n},c={a:t-s,b:o-r,c:Q-s,d:i-r,e:s,f:r},h=W$I(a),l=qV([c,h]);return X$I(l)}function AAe(g,A){function I(){this.constructor=g}I.prototype=A.prototype,g.prototype=new I}function sQA(g,A,I,e){var t=Error.call(this,g);return Object.setPrototypeOf&&Object.setPrototypeOf(t,sQA.prototype),t.expected=A,t.found=I,t.location=e,t.name="SyntaxError",t}AAe(sQA,Error);function _NA(g,A,I){return I=I||" ",g.length>A?g:(A-=g.length,I+=I.repeat(A),g+I.slice(0,A))}sQA.prototype.format=function(g){var A="Error: "+this.message;if(this.location){var I=null,e;for(e=0;e<g.length;e++)if(g[e].source===this.location.source){I=g[e].text.split(/\r\n|\n|\r/g);break}var t=this.location.start,o=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(t):t,B=this.location.source+":"+o.line+":"+o.column;if(I){var C=this.location.end,Q=_NA("",o.line.toString().length," "),i=I[t.line-1],E=t.line===C.line?C.column:i.length+1,n=E-t.column||1;A+=`
242
242
  --> `+B+`
243
243
  `+Q+` |
@@ -5664,7 +5664,7 @@ test("${i} should solve problem correctly", () => {
5664
5664
  // Add more specific assertions based on expected output
5665
5665
  // expect(solver.netLabelPlacementSolver!.netLabelPlacements).toMatchInlineSnapshot()
5666
5666
  })
5667
- `,n=new Blob([E],{type:"text/plain"}),s=URL.createObjectURL(n),r=document.createElement("a");r.href=s,r.download=`${i}.test.ts`,r.click(),URL.revokeObjectURL(s)}catch(Q){alert(`Error generating test.ts for ${g.getSolverName()}: ${Q instanceof Error?Q.message:String(Q)}`)}e(!1)};return W.jsxs("div",{className:`relative ${A}`,ref:t,children:[W.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>e(!I),title:`Download options for ${g.getSolverName()}`,children:g.getSolverName()}),I&&W.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:[W.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:o,children:"Download JSON"}),W.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:B,children:"Download page.tsx"}),W.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:C,children:"Download test.ts"})]})]})},jUI=g=>g.activeSubSolver?[g,...jUI(g.activeSubSolver)]:[g],Huo=({solver:g})=>{const A=jUI(g);return W.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:A.map((I,e)=>W.jsxs("div",{className:"flex items-center",children:[e>0&&W.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),W.jsx(buo,{solver:I})]},I.getSolverName()))})},vuo=({solver:g,triggerRender:A,animationSpeed:I=25,renderer:e,onRendererChange:t,onAnimationSpeedChange:o,onDownloadVisualization:B,onSolverStarted:C,onSolverCompleted:Q})=>{const[i,E]=gA.useReducer(m=>!m,!1),n=gA.useRef(void 0),s=gA.useRef(null),r="solver-debugger-last-iteration",[a,c]=gA.useState(null),h=gA.useRef(null),l=gA.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"}],[]),D=()=>{const m=Math.max(1,I),p=I<1?Math.round(1/I):1;n.current=setInterval(()=>{if(g.solved||g.failed){n.current&&(clearInterval(n.current),n.current=void 0),E(),A(),Q&&g.solved&&Q(g);return}for(let k=0;k<p&&!(g.solved||g.failed);k++)g.step();A()},m)},d=()=>{n.current&&(clearInterval(n.current),n.current=void 0)},y=()=>{!g.solved&&!g.failed&&(g.step(),A())},w=()=>{!g.solved&&!g.failed&&(C&&C(g),g.solve(),A(),Q&&Q(g))},u=()=>{i?(d(),E()):(E(),D())},G=()=>{if(g.solved||g.failed||i)return;s.current===null&&typeof window<"u"&&(s.current=window.localStorage.getItem(r));const m=window.prompt("Step until which iteration?",s.current??`${g.iterations}`);if(m===null)return;s.current=m,typeof window<"u"&&window.localStorage.setItem(r,m);const p=Number(m);if(!Number.isFinite(p)){window.alert("Please enter a valid number for the iteration");return}for(;g.iterations<p&&!g.solved&&!g.failed;)g.step();A(),g.solved&&Q&&Q(g)};return gA.useEffect(()=>()=>{d()},[]),gA.useEffect(()=>{(g.solved||g.failed)&&i&&(d(),E())},[g.solved,g.failed,i]),gA.useEffect(()=>{i&&(d(),D())},[I,i]),gA.useEffect(()=>{if(typeof document>"u")return;const m=p=>{h.current&&!h.current.contains(p.target)&&c(null)};return document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m)}},[]),W.jsxs("div",{className:"space-y-2 p-2 border-b",children:[W.jsx("div",{className:"flex items-center",children:W.jsxs("div",{className:"flex items-center gap-2",ref:h,children:[W.jsxs("div",{className:"flex h-9 items-center space-x-1 rounded-md border border-slate-200 bg-white p-1 shadow-sm",children:[W.jsxs("div",{className:"relative",children:[W.jsx("button",{type:"button",onClick:()=>c(a==="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":a==="renderer"?"open":"closed",children:"Renderer"}),a==="renderer"&&W.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(m=>W.jsxs("button",{type:"button",onClick:()=>{t(m),c(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[m==="vector"?"Vector":"Canvas",e===m&&W.jsx("span",{className:"ml-auto text-xs text-slate-500",children:"✓"})]},m))})]}),W.jsxs("div",{className:"relative",children:[W.jsx("button",{type:"button",onClick:()=>c(a==="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":a==="debug"?"open":"closed",children:"Debug"}),a==="debug"&&W.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:W.jsx("button",{type:"button",onClick:()=>{B(),c(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:"Download Visualization"})})]}),W.jsxs("div",{className:"relative",children:[W.jsx("button",{type:"button",onClick:()=>c(a==="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":a==="animation"?"open":"closed",children:"Animation"}),a==="animation"&&W.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:l.map(m=>W.jsxs("button",{type:"button",onClick:()=>{o(m.value),c(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[m.label,W.jsx("span",{className:"ml-auto text-xs text-slate-500",children:m.description}),I===m.value&&W.jsx("span",{className:"ml-2 text-xs text-slate-500",children:"✓"})]},m.value))})]})]}),W.jsx(Huo,{solver:g})]})}),W.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[W.jsx("button",{onClick:y,disabled:g.solved||g.failed||i,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),W.jsx("button",{onClick:w,disabled:g.solved||g.failed||i,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),W.jsx("button",{onClick:u,disabled:g.solved||g.failed,className:`px-3 py-1 rounded text-white text-sm ${i?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:i?"Stop":"Animate"}),W.jsx("button",{onClick:G,disabled:g.solved||g.failed||i,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"}),W.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",g.iterations]}),g.timeToSolve!==void 0&&W.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(g.timeToSolve/1e3).toFixed(3),"s"]}),g.solved&&W.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),g.failed&&W.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),g.error&&W.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",g.error]})]})},quo=g=>g!==null&&"pipelineDef"in g&&Array.isArray(g.pipelineDef),Tuo=(g,A,I)=>{const e=g.currentPipelineStageIndex;return A<e?"Completed":A===e&&g.activeSubSolver?g.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},Zuo=(g,A)=>{const e=g.pipelineDef[A].solverName,t=Tuo(g,A),o=g[e],B=g.firstIterationOfStage?.[e]??(A===g.currentPipelineStageIndex?g.iterations:null),C=g.iterations;let Q=0;if(t==="Completed"){const s=g.pipelineDef[A+1],r=s?g.firstIterationOfStage?.[s.solverName]:void 0;r!==void 0&&B!==null?Q=r-B:B!==null&&(Q=C-B)}else t==="In Progress"&&B!==null&&(Q=C-B);const i=g.timeSpentOnStage?.[e]??0;let E=0;t==="Completed"?E=1:t==="In Progress"&&o&&(E=o.progress??0);const n=o?.stats??null;return{index:A,name:e,status:t,firstIteration:B,iterations:Q,progress:E,timeSpent:i,stats:n&&Object.keys(n).length>0?n:null,solverInstance:o??null}},Ouo=({status:g})=>{const A={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return W.jsx("span",{className:`font-medium ${A[g]}`,children:g})},Wuo=({progress:g})=>{if(g===0)return null;const A=Math.round(g*100);return W.jsxs("div",{className:"flex items-center gap-2",children:[W.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:W.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${A}%`}})}),W.jsxs("span",{className:"text-xs text-gray-500",children:[A,"%"]})]})},zUI=g=>{if(typeof g=="string")return g;if(typeof g=="number"||typeof g=="boolean"||typeof g=="bigint"||g==null)return String(g);if(typeof g=="object")try{return JSON.stringify(g)}catch{return String(g)}return String(g)},Vuo=g=>Object.entries(g).map(([A,I])=>`${A}: ${zUI(I)}`).join(", "),juo=({stats:g})=>{if(!g||Object.keys(g).length===0)return W.jsx("span",{children:"-"});const A=Object.entries(g),I=Vuo(g);return W.jsxs("details",{className:"cursor-pointer",children:[W.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:I}),W.jsx("div",{className:"mt-1 text-xs",children:A.map(([e,t])=>W.jsxs("div",{children:[e,": ",zUI(t)]},e))})]})},xBg=g=>{if(g===null||typeof g!="object")return g;if(Array.isArray(g))return g.map(xBg);const A={};for(const[I,e]of Object.entries(g))I.startsWith("_")||(A[I]=xBg(e));return A},zuo=(g,A)=>{try{if(typeof g.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${A}`);return}const I=xBg(g.getConstructorParams()),e=new Blob([JSON.stringify(I,null,2)],{type:"application/json"}),t=URL.createObjectURL(e),o=document.createElement("a");o.href=t,o.download=`${A}_input.json`,o.click(),URL.revokeObjectURL(t)}catch(I){alert(`Error downloading input for ${A}: ${I instanceof Error?I.message:String(I)}`)}},Xuo=({expanded:g})=>W.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 ${g?"rotate-90":""}`,children:W.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"})}),XUI=g=>{let A=g;for(;A.activeSubSolver;)A=A.activeSubSolver;return A},$UI=({solver:g,onStepUntilPhase:A,onDownloadInput:I,isNested:e=!1,indentLevel:t=0,triggerRender:o})=>{const[B,C]=gA.useState(new Set),Q=g.pipelineDef.map((h,l)=>Zuo(g,l)),i=h=>{C(l=>{const D=new Set(l);return D.has(h)?D.delete(h):D.add(h),D})},E=h=>{A?.(h)},n=h=>{h.solverInstance&&(I?I(h.solverInstance,h.name):zuo(h.solverInstance,h.name))},s=h=>`${(h/1e3).toFixed(2)}s`,r=()=>{if(!g.solved&&!g.failed){const h=g.activeSubSolver;for(;!g.solved&&!g.failed&&(g.step(),!(g.activeSubSolver&&g.activeSubSolver!==h)););o?.()}},a=()=>{if(!g.solved&&!g.failed){const h=XUI(g);for(;!g.solved&&!g.failed&&(g.step(),XUI(g)===h););o?.()}},c=t*24;return W.jsxs("div",{className:e?"":"border-t border-gray-200",children:[!e&&W.jsxs("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200 flex items-center justify-between",children:[W.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Stages"}),W.jsxs("div",{className:"flex gap-2",children:[W.jsx("button",{onClick:a,disabled:g.solved||g.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"}),W.jsx("button",{onClick:r,disabled:g.solved||g.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"})]})]}),W.jsx("div",{className:"overflow-x-auto",children:W.jsxs("table",{className:"w-full text-sm",children:[!e&&W.jsx("thead",{children:W.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stage"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),W.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",W.jsx("sub",{children:"0"})]}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),W.jsx("tbody",{children:Q.map(h=>{const l=quo(h.solverInstance),D=B.has(h.name);return W.jsxs(aC.Fragment,{children:[W.jsxs("tr",{className:`border-b border-gray-100 ${h.status==="In Progress"?"bg-yellow-50":""}`,children:[W.jsx("td",{className:"px-4 py-2",children:W.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:c},children:[l?W.jsx("button",{onClick:()=>i(h.name),className:"text-gray-500 hover:text-gray-700",title:D?"Collapse":"Expand",children:W.jsx(Xuo,{expanded:D})}):W.jsx("span",{className:"w-4"}),W.jsx("span",{className:"text-gray-400 w-6",children:String(h.index+1).padStart(2,"0")}),W.jsx("button",{onClick:()=>E(h.name),disabled:h.status==="Completed"||g.solved||g.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${h.name} completes`,children:W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:W.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"})})}),W.jsx("span",{className:"font-medium text-gray-900",children:h.name})]})}),W.jsx("td",{className:"px-4 py-2",children:W.jsx(Ouo,{status:h.status})}),W.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:h.firstIteration!==null?h.firstIteration:""}),W.jsx("td",{className:"px-4 py-2 text-gray-600",children:h.iterations}),W.jsx("td",{className:"px-4 py-2",children:W.jsx(Wuo,{progress:h.progress})}),W.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(h.timeSpent)}),W.jsx("td",{className:"px-4 py-2 text-gray-500",children:W.jsx(juo,{stats:h.stats})}),W.jsx("td",{className:"px-4 py-2",children:h.solverInstance?W.jsxs("button",{onClick:()=>n(h),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${h.name}`,children:[W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:W.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"})}),W.jsx("span",{children:"Input"})]}):null})]}),l&&D&&W.jsx("tr",{children:W.jsx("td",{colSpan:8,className:"p-0",children:W.jsx($UI,{solver:h.solverInstance,onStepUntilPhase:A,onDownloadInput:I,isNested:!0,indentLevel:t+1,triggerRender:o})})})]},h.name)})})]})})]})};function $uo({graphics:g}){const A=g.points??[],I=g.lines??[],e=g.rects??[],t=g.circles??[],o=g.texts??[];let B=Number.POSITIVE_INFINITY,C=Number.POSITIVE_INFINITY,Q=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const E=(h,l)=>{typeof h=="number"&&(h<B&&(B=h),h>Q&&(Q=h)),typeof l=="number"&&(l<C&&(C=l),l>i&&(i=l))};for(const h of A)E(h.x,h.y);for(const h of I){const l=h.points??[];for(const D of l)E(D.x,D.y)}for(const h of e){const l=h.x??0,D=h.y??0,d=h.width??0,y=h.height??0;E(l,D),E(l+d,D+y)}for(const h of t){const l=h.x??0,D=h.y??0,d=h.radius??1;E(l-d,D-d),E(l+d,D+d)}for(const h of o)E(h.x,h.y);(!isFinite(B)||!isFinite(C)||!isFinite(Q)||!isFinite(i))&&(B=-20,C=-20,Q=20,i=20);const n=10,s=B-n,r=C-n,a=Math.max(1,Q-B+2*n),c=Math.max(1,i-C+2*n);return W.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${s} ${r} ${a} ${c}`,role:"img","aria-label":"Graphics fallback",children:[e.map((h,l)=>W.jsx("rect",{x:h.x??0,y:h.y??0,width:h.width??0,height:h.height??0,fill:"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1},`rect-${l}`)),I.map((h,l)=>W.jsx("polyline",{fill:"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1,points:(h.points??[]).map(D=>`${D.x??0},${D.y??0}`).join(" ")},`line-${l}`)),t.map((h,l)=>W.jsx("circle",{cx:h.x??0,cy:h.y??0,r:h.radius??1.5,fill:h.fillColor??"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1},`circle-${l}`)),A.map((h,l)=>W.jsx("circle",{cx:h.x??0,cy:h.y??0,r:h.radius??1.5,fill:h.color??"black"},`point-${l}`)),o.map((h,l)=>W.jsx("text",{x:h.x??0,y:h.y??0,fontSize:h.fontSize??10,fill:h.color??"black",children:h.text??""},`text-${l}`))]})}var AGo=class extends aC.Component{constructor(g){super(g),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(g){console.error("InteractiveGraphics render error:",g)}render(){return this.state.hasError?this.props.fallback:this.props.children}},gGo=({solver:g,createSolver:A,animationSpeed:I=25,onSolverStarted:e,onSolverCompleted:t})=>{const[o,B]=gA.useReducer(D=>D+1,0),[C]=gA.useState(()=>{if(A)return A();if(!g)throw new Error("GenericSolverDebugger requires solver or createSolver");return g}),[Q,i]=gA.useState(()=>typeof window>"u"?"vector":window.localStorage.getItem("solver-utils-renderer")==="canvas"?"canvas":"vector"),[E,n]=gA.useState(I),s=gA.useMemo(()=>{try{return C.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(D){return console.error("Visualization error:",D),{points:[],lines:[],rects:[],circles:[]}}},[C,o]),r=gA.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);gA.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const D=document.createElement("script");D.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(D)}},[]),gA.useEffect(()=>{n(I)},[I]);const a=C.pipelineDef!==void 0,c=D=>{const d=C;if(!C.solved&&!C.failed){for(;!C.solved&&!C.failed&&d.currentPipelineStageIndex<=d.pipelineDef.findIndex(y=>y.solverName===D);)C.step();B()}},h=()=>{const D=JSON.stringify(s,null,2),d=new Blob([D],{type:"application/json"}),y=URL.createObjectURL(d),w=document.createElement("a");w.download="visualization.json",w.href=y,document.body.appendChild(w),w.click(),document.body.removeChild(w),URL.revokeObjectURL(y)},l=D=>{i(D),typeof window<"u"&&window.localStorage.setItem("solver-utils-renderer",D)};return W.jsxs("div",{children:[W.jsx(vuo,{solver:C,triggerRender:B,animationSpeed:E,renderer:Q,onRendererChange:l,onAnimationSpeedChange:n,onDownloadVisualization:h,onSolverStarted:e,onSolverCompleted:t}),r?W.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):W.jsx(AGo,{fallback:W.jsx($uo,{graphics:s}),children:Q==="canvas"?W.jsx(_uo,{graphics:s}):W.jsx(Kuo,{graphics:s})}),a&&W.jsx($UI,{solver:C,onStepUntilPhase:c,triggerRender:B})]})};const IGo=()=>{gA.useEffect(()=>{const g="tailwind-cdn-script";if(document.getElementById(g)||window.tailwind)return;const A=document.createElement("div");A.className="hidden",document.body.appendChild(A);const I=window.getComputedStyle(A).display==="none";if(document.body.removeChild(A),I)return;const e=document.createElement("script");e.id=g,e.src="https://cdn.tailwindcss.com",document.head.appendChild(e)},[])},eGo=1e3,Jk=(g,A)=>{const{fileName:I,mimeType:e="text/plain"}=A,t=g instanceof Blob?g:new Blob([g],{type:e}),o=URL.createObjectURL(t),B=document.createElement("a");B.href=o,B.download=I,B.target="_blank",B.rel="noopener noreferrer",B.style.display="none",document.body.appendChild(B),B.click(),document.body.removeChild(B),setTimeout(()=>{URL.revokeObjectURL(o)},eGo)},FBg=g=>{let A=g.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(A)&&(A=`_${A}`),A=A.slice(0,200),A||"untitled"},tGo=g=>{const A=g.solverConstructorArgs??[g.solverParams];if(g.solverName!=="AutoroutingPipelineSolver7_MultiGraph"||A.length!==1)return A;const[{input:I,options:e}]=A;return[I,e]},EF="https://github.com/tscircuit/tscircuit-autorouter/issues/new",AJI="https://github.com/tscircuit/copper-pour-solver/issues/new",gJI="https://github.com/tscircuit/calculate-packing/issues/new",oGo="https://github.com/tscircuit/matchpack/issues/new",IJI="https://github.com/tscircuit/schematic-trace-solver/issues/new?template=json-bug-report.yml",BGo={PackSolver2:gJI,LayoutPipelineSolver:oGo,AutoroutingPipelineSolver:EF,AssignableAutoroutingPipeline2:EF,AssignableAutoroutingPipeline3:EF,AutoroutingPipeline1_OriginalUnravel:EF,AutoroutingPipelineSolver3_HgPortPointPathing:EF,AutoroutingPipelineSolver4:EF,AutoroutingPipelineSolver5:EF,AutoroutingPipelineSolver7_MultiGraph:EF,AutoroutingPipelineSolver8:EF,CopperPourPipelineSolver:AJI,SchematicTracePipelineSolver:IJI},CGo=g=>g.toLowerCase().includes("pack")?wso:g.toLowerCase().includes("rout")?HNI:aso,eJI=g=>{const A=BGo[g];if(A)return A;const I=g.toLowerCase();return I.includes("autorout")?EF:I.includes("schematic")&&I.includes("trace")?IJI:I.includes("copperpour")?AJI:I.includes("pack")?gJI:null},QGo=g=>`${FBg(`${g.componentName}-${g.solverName}`)}-solver-input.json`,tJI=g=>{Jk(JSON.stringify(g.solverParams,null,2),{fileName:QGo(g),mimeType:"application/json"})},iGo=({solverEvent:g})=>{const A=eJI(g.solverName);return W.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:[W.jsxs($E,{type:"button",variant:"outline",size:"sm",onClick:()=>tJI(g),children:[W.jsx(QtA,{className:"rf-w-4 rf-h-4"}),"Download"]}),A?W.jsx($E,{asChild:!0,variant:"outline",size:"sm",children:W.jsxs("a",{href:A,target:"_blank",rel:"noopener noreferrer",children:[W.jsx(oGA,{className:"rf-w-4 rf-h-4"}),"Report"]})}):W.jsxs($E,{type:"button",variant:"outline",size:"sm",disabled:!0,title:"No report link configured for this solver",children:[W.jsx(oGA,{className:"rf-w-4 rf-h-4"}),"Report"]})]})},EGo=({solverEvent:g})=>{const A=eJI(g.solverName);return A?W.jsx($E,{asChild:!0,variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",children:W.jsx("a",{href:A,target:"_blank",rel:"noopener noreferrer",title:"Report solver bug","aria-label":"Report solver bug",children:W.jsx(oGA,{className:"rf-w-4 rf-h-4"})})}):W.jsx($E,{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:W.jsx(oGA,{className:"rf-w-4 rf-h-4"})})},nGo=({solverEvents:g=[]})=>{const[A,I]=gA.useState(null);IGo();const e=gA.useMemo(()=>{const C=new Map;for(const Q of g){const i=`${Q.componentName}-${Q.solverName}`;C.set(i,Q)}return C},[g]),t=gA.useMemo(()=>Array.from(e.keys()),[e]),o=A?e.get(A):null,B=gA.useMemo(()=>{if(!o)return{instance:null,error:null,classFound:!1};const C=vqA[o.solverName];if(!C)return{instance:null,error:`Solver class "${o.solverName}" not found in SOLVERS registry. Available: ${Object.keys(vqA).join(", ")}`,classFound:!1};try{return{instance:new C(...tGo(o)),error:null,classFound:!0}}catch(Q){const i=Q instanceof Error?Q.message:String(Q);return console.error("Failed to reconstruct solver:",Q),{instance:null,error:`Failed to instantiate solver: ${i}`,classFound:!0}}},[o]);return g.length===0?W.jsx("div",{className:"rf-p-4",children:W.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:W.jsxs("div",{className:"rf-p-4",children:[W.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),W.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."})]})})}):W.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[W.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[W.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:[t.length," ",t.length===1?"Solver":"Solvers"]}),t.map(C=>{const Q=e.get(C),i=A===C;return W.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${i?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>I(C),children:(()=>{const E=CGo(Q.solverName);return W.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[W.jsx(E,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),W.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[W.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:Q.componentName}),W.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:Q.solverName})]})]})})()},C)})]}),W.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:o?B.instance?W.jsxs("div",{className:"rf-flex rf-h-full rf-flex-col rf-overflow-y-auto",children:[W.jsx(iGo,{solverEvent:o}),W.jsx("div",{className:"rf-min-h-0 rf-flex-1",children:W.jsx(zR,{fallback:W.jsx("div",{className:"rf-p-4",children:W.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[W.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),W.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",o.solverName]})]})}),children:W.jsx(gGo,{solver:B.instance})})})]}):W.jsxs("div",{className:"rf-p-4",children:[W.jsxs("div",{className:"rf-mb-4",children:[W.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:o.solverName}),W.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",o.componentName]})]}),B.error&&W.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${B.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:W.jsx("p",{className:`rf-text-sm ${B.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:B.error})}),W.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[W.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:[W.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"}),W.jsxs("div",{className:"rf-flex rf-items-center rf-gap-1",children:[W.jsx(EGo,{solverEvent:o}),W.jsx($E,{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:()=>tJI(o),children:W.jsx(QtA,{className:"rf-w-4 rf-h-4"})})]})]}),W.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:W.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(o.solverParams,null,2)})})]})]}):W.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:W.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},sGo=new Map([["custom","Custom"],["fanout","Fanout"],["single_layer_fanout","Single layer fanout"],["tscircuit_simplify","Simplify"]]),aGo=new Set(["tscircuit","default","auto","auto_local"]);function rGo(g){if(g==="FanoutSolver")return"Fanout";if(g==="AutoroutingPipelineSolver11_Simplification")return"Simplify";const A=g.match(/^AutoroutingPipeline(?:Solver)?(\d+)(?:_|$)/);if(A)return`Pipeline${A[1]}`;const I=g.match(/^AssignableAutoroutingPipeline(\d+)$/);return I?`Assignable${I[1]}`:g}function cGo(g){const A=g.autorouterName?.trim(),I=A?.replace(/-/g,"_"),e=I&&sGo.get(I);if(e)return e;if(I&&!aGo.has(I))return A;const t=g.solverName?.trim();if(t)return rGo(t);const o=g.autorouterVersion?.trim();if(o){const B=o.match(/^beta[_-]pipeline(\d+)$/);return B?`Pipeline${B[1]}`:o==="latest"?"default":o}return A?"default":"Unknown"}const UBg="#fbbf24";function hGo(g){const A=g.endSimpleRouteJson?.traces??[],I=new Set(A.flatMap(t=>[t.pcb_trace_id,t.__replaces_pcb_trace_id].filter(o=>o!==void 0)));return[...(g.startSimpleRouteJson?.traces??[]).filter(t=>!I.has(t.pcb_trace_id)),...A]}function oJI(g){const A=new Map((g.startSimpleRouteJson?.traces??[]).map(I=>[I.pcb_trace_id,I]));return(g.endSimpleRouteJson?.traces??[]).filter(I=>{const e=A.get(I.pcb_trace_id);return!e||!!I.__replaces_pcb_trace_id&&I.__replaces_pcb_trace_id!==e.__replaces_pcb_trace_id||JSON.stringify(e.route)!==JSON.stringify(I.route)}).map(I=>I.pcb_trace_id)}function lGo(g,A){return{outer_diameter:g.via_diameter??A.minViaPadDiameter??A.min_via_pad_diameter??A.minViaDiameter??.6,hole_diameter:g.via_hole_diameter??A.minViaHoleDiameter??A.min_via_hole_diameter??.3}}function BJI(g,A){const I=[];for(const C of g.route)C.route_type==="wire"?I.push({...C,layer:C.layer}):C.route_type==="via"?I.push({route_type:"via",x:C.x,y:C.y,from_layer:C.from_layer,to_layer:C.to_layer,...lGo(C,A)}):C.route_type==="through_obstacle"&&I.push({route_type:"through_pad",start:{...C.start},end:{...C.end},width:C.width,start_layer:C.from_layer,end_layer:C.to_layer,pcb_smtpad_id:C.circuitJsonMetadata?.pcb_smtpad_id,pcb_plated_hole_id:C.circuitJsonMetadata?.pcb_plated_hole_id});const e=C=>{let Q=-1,i=Number.POSITIVE_INFINITY;return I.forEach((E,n)=>{if(E.route_type!=="wire")return;const s=Math.hypot(E.x-C.x,E.y-C.y);s<i&&(i=s,Q=n)}),Q},t=g.route.filter(C=>C.route_type==="jumper").map(C=>[e(C.start),e(C.end)].sort((Q,i)=>Q-i)).filter(([C,Q])=>C>=0&&Q>C).sort(([C],[Q])=>C-Q),o=[];let B=0;for(const[C,Q]of t)C>=B&&o.push(I.slice(B,C+1)),B=Math.max(B,Q);return B<I.length&&o.push(I.slice(B)),o}function DGo(g){const A=[],I=[],e=g.endSimpleRouteJson;if(!e)return{lines:A,circles:I};const t=new Set(oJI(g));for(const o of e.traces??[])if(t.has(o.pcb_trace_id))for(const B of BJI(o,e)){let C;for(const Q of B){if(Q.route_type==="through_pad"){C={...Q.end,layer:Q.end_layer,width:Q.width};continue}const i=Q.route_type==="wire"?Q.layer:Q.from_layer;C&&C.layer===i&&(C.x!==Q.x||C.y!==Q.y)&&A.push({points:[{x:C.x,y:C.y},{x:Q.x,y:Q.y}],strokeWidth:Q.route_type==="wire"?Q.width:C.width,strokeColor:UBg,layer:i}),Q.route_type==="via"&&I.push({center:{x:Q.x,y:Q.y},radius:Q.outer_diameter/2,stroke:UBg,fill:"transparent"}),C={x:Q.x,y:Q.y,layer:Q.route_type==="wire"?Q.layer:Q.to_layer,width:Q.route_type==="wire"?Q.width:C?.width??e.minTraceWidth}}}return{coordinateSystem:"cartesian",lines:A,circles:I}}function dGo(g){const A=JSON.stringify(g);let I=2166136261;for(let e=0;e<A.length;e++)I=Math.imul(I^A.charCodeAt(e),16777619);return(I>>>0).toString(36)}const yGo=new Set(["pcb_trace","pcb_via","pcb_copper_pour","pcb_ground_plane","pcb_ground_plane_region","pcb_thermal_spoke","pcb_breakout_point"]);function wGo(g,A,I){const e=I==="input"?A.startSimpleRouteJson??A.errorSimpleRouteJson:A.endSimpleRouteJson,t=g.filter(i=>!yGo.has(i.type)&&!i.type.endsWith("_error")&&!i.type.endsWith("_warning"));if(!e)return t;const o=I==="input"?e.traces??[]:hGo(A),B=new Set(g.filter(i=>i.type==="source_trace").map(i=>i.source_trace_id)),C=["top",...Array.from({length:Math.max(0,e.layerCount-2)},(i,E)=>`inner${E+1}`),...e.layerCount>1?["bottom"]:[]],Q=[];for(const i of o){const n=e.connections.find(r=>r.name===i.connection_name||r.source_trace_id===i.connection_name)?.source_trace_id??i.connection_name??"",s=BJI(i,e);for(const[r,a]of s.entries()){const c={type:"pcb_trace",pcb_trace_id:`${A.id}_${I}_${i.pcb_trace_id}_${r}_${dGo(a)}`,subcircuit_id:A.subcircuit_id??void 0,source_trace_id:B.has(n)?n:void 0,route:a};Q.push(c);for(const[h,l]of a.entries()){if(l.route_type!=="via")continue;const D=C.indexOf(l.from_layer),d=C.indexOf(l.to_layer),y={type:"pcb_via",pcb_via_id:`${c.pcb_trace_id}_via_${h}`,pcb_trace_id:c.pcb_trace_id,subcircuit_id:A.subcircuit_id??void 0,x:l.x,y:l.y,outer_diameter:l.outer_diameter,hole_diameter:l.hole_diameter,layers:D>=0&&d>=0?C.slice(Math.min(D,d),Math.max(D,d)+1):[l.from_layer,l.to_layer]};Q.push(y)}}}return[...t,...Q]}const JBg=(g,A)=>g.phaseName||`Phase ${g.phaseOrdinal??A+1}`,CJI=g=>g.componentDisplayName?.match(/name="([^"]+)"/)?.[1]?.replace(/^\./,"")||g.componentDisplayName||g.subcircuit_id||"Board",QJI=g=>g.startSimpleRouteJson??g.endSimpleRouteJson??g.errorSimpleRouteJson,uGo={is_showing_autorouting:!0,is_showing_rats_nest:!1,is_showing_drc_errors:!1,is_showing_drc_warnings:!1,is_showing_pcb_groups:!1},GGo=({circuitJson:g,phases:A=[],isRunning:I=!1})=>{const[e,t]=gA.useState(null),[o,B]=gA.useState("output"),[C,Q]=gA.useState(!0),[i,E]=gA.useState(!1),n=gA.useRef(null),[s,r]=gA.useState(480),a=e?A.findIndex(N=>N.id===e.id&&QJI(N)===QJI(e)):-1,c=a<0?A.length-1:a,h=A[c],l=a<0,D=!!h?.endSimpleRouteJson,d=h?.startSimpleRouteJson??h?.errorSimpleRouteJson,y=!!d,w=o==="output"&&!D?"input":o==="input"&&!y?"output":o,u=w==="input"?d:h?.endSimpleRouteJson,G=gA.useMemo(()=>!h||!u?null:wGo(g??[],h,w),[g,h,u,w]),m=gA.useMemo(()=>h&&w==="output"&&C?DGo(h):{lines:[],circles:[]},[h,w,C]);if(gA.useLayoutEffect(()=>{const N=n.current;if(!N)return;const U=()=>r(Math.max(360,N.clientHeight));U();const K=new ResizeObserver(U);return K.observe(N),()=>K.disconnect()},[!!h]),!h)return W.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:[W.jsx(HNI,{className:"rf-h-7 rf-w-7 rf-text-blue-500"}),W.jsx("h3",{className:"rf-text-base rf-font-medium",children:I?"Waiting for autorouting":"No autorouting captures"}),W.jsx("p",{className:"rf-max-w-md rf-text-sm rf-text-gray-500",children:I?"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 p=JBg(h,c),k=h.status==="running"&&I,S=!D,R=d?.connections.length,x=G?.filter(N=>N.type==="pcb_trace").length??0;return W.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:[W.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:[W.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:[W.jsx("span",{children:"Routing phases"}),W.jsx("span",{children:A.length})]}),W.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:A.map((N,U)=>{const K=oJI(N).length,Y=N.endSimpleRouteJson?`${K} ${K===1?"trace":"traces"} routed`:N.status==="error"?"Failed":N.status==="running"&&I?"Routing…":"No output";return W.jsxs("button",{type:"button","aria-pressed":U===c,title:`${CJI(N)} · ${Y}`,onClick:()=>t(N),className:rB("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",U===c?"rf-border-blue-200 rf-bg-blue-50":"rf-border-transparent hover:rf-bg-gray-50"),children:[W.jsx("span",{className:rB("rf-flex rf-h-5 rf-w-5 rf-shrink-0 rf-items-center rf-justify-center rf-rounded-full rf-text-[11px]",U===c?"rf-bg-blue-600 rf-text-white":"rf-bg-gray-100 rf-text-gray-500"),children:U+1}),W.jsxs("span",{className:"rf-min-w-0 rf-flex-1",children:[W.jsxs("span",{className:"rf-flex rf-items-center rf-gap-1",children:[W.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:JBg(N,U),children:JBg(N,U)}),N.status==="complete"?W.jsx(VZ,{"aria-label":"Captured",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-green-600"}):N.status==="error"?W.jsx(Htg,{"aria-label":"Failed",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-red-500"}):I?W.jsx(of,{"aria-label":"Routing",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-animate-spin rf-text-blue-500"}):null]}),W.jsxs("span",{className:"rf-block rf-text-[11px] rf-leading-4 rf-text-gray-500",children:[cGo(N)," · ",Y]})]})]},N.id)})})]}),W.jsxs("div",{className:"rf-flex rf-min-w-0 rf-flex-1 rf-flex-col",children:[W.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:[W.jsxs("h3",{className:"rf-mr-auto rf-flex rf-items-center rf-gap-2 rf-text-sm rf-font-medium",children:[p,W.jsxs("span",{className:"rf-text-xs rf-font-normal rf-text-gray-500",children:[c+1," of ",A.length]})]}),I&&W.jsx("button",{type:"button",onClick:()=>t(null),disabled:l,className:"rf-text-xs rf-text-blue-600 disabled:rf-text-gray-500",children:l?"Following latest":"Follow latest"}),W.jsx("div",{className:"rf-flex rf-rounded-md rf-bg-gray-100 rf-p-1","aria-label":"Phase snapshot",children:["input","output"].map(N=>W.jsx("button",{type:"button","aria-pressed":w===N,disabled:N==="input"?!y:!D,onClick:()=>B(N),className:rB("rf-rounded rf-px-3 rf-py-1 rf-text-xs disabled:rf-opacity-40",w===N?"rf-bg-white rf-text-gray-900 rf-shadow-sm":"rf-text-gray-500"),children:N==="input"?"Input":"Output"},N))})]}),W.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:[W.jsxs("label",{className:"rf-flex rf-items-center rf-gap-2",children:[W.jsx("input",{type:"checkbox",checked:C,disabled:w!=="output",onChange:N=>Q(N.target.checked),className:"rf-accent-blue-600"}),W.jsx("span",{"aria-hidden":"true",className:"rf-inline-block rf-h-0.5 rf-w-3",style:{backgroundColor:UBg}}),"Highlight changes (all layers)"]}),W.jsxs("span",{children:[w==="input"?"Before this phase":"After this phase"," ","· ",x," traces"]})]}),S&&W.jsx("div",{className:rB("rf-border-y rf-px-4 rf-py-2 rf-text-xs",h.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:h.status==="error"?`Routing failed: ${h.error?.message||"No output was captured."}`:k?"Routing in progress. Showing captured input until output is available.":"No output was captured for this phase. Showing the available input."}),W.jsx("div",{ref:n,className:"rf-relative rf-min-h-[360px] rf-flex-1","data-testid":"autorouting-pcb",children:G?W.jsx(Ytg,{circuitJson:G,height:s,allowEditing:!1,clickToInteractEnabled:!1,initialState:uGo,debugGraphics:m}):W.jsx("div",{className:"rf-p-6 rf-text-sm rf-text-gray-500",children:"No PCB snapshot available for this capture."})}),W.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:[W.jsxs("span",{children:[R===void 0?"Input unavailable":`${R} input connections`,` · ${CJI(h)}`]}),W.jsxs("div",{className:"rf-flex rf-items-center rf-gap-4",children:[W.jsxs("button",{type:"button",disabled:!u,onClick:()=>Jk(JSON.stringify(u,null,2),{fileName:`${h.id}-${w}.srj.json`,mimeType:"application/json"}),className:"rf-flex rf-items-center rf-gap-1 disabled:rf-opacity-40",children:[W.jsx(QtA,{className:"rf-h-3 rf-w-3"}),"Download SRJ"]}),W.jsxs("button",{type:"button","aria-expanded":i,onClick:()=>E(!i),className:"rf-flex rf-items-center rf-gap-1",children:[W.jsx(jZ,{className:rB("rf-h-3 rf-w-3",i&&"rf-rotate-90")}),"Inspect SRJ"]})]})]}),i&&W.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":`${p} ${w} SRJ`,children:u?JSON.stringify(u,null,2):"No snapshot captured."})]})]})},iJI=({errorMessage:g,errorStack:A,circuitJsonErrors:I})=>{gA.useEffect(()=>{if(jF("TSCIRCUIT_TELEMETRY_DISABLED")!==!0&&g){const e=new Error(g);A&&(e.stack=A);try{oH.captureException(e)}catch{}}},[g,A]),gA.useEffect(()=>{if(jF("TSCIRCUIT_TELEMETRY_DISABLED")!==!0&&I&&I.length>0)for(const e of I){const t=new Error(e.message||"Circuit JSON Error");e.stack&&(t.stack=e.stack);try{oH.captureException(t,{error_type:e.type})}catch{}}},[I])},mGo=g=>{gA.useEffect(()=>{try{M$I(g)}catch{}},[g.source,g.component,g.isWebEmbedded,g.activeTab])},EJI="0.0.3070",pGo={version:EJI},PBg={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},KBg=new Map,GmA=g=>{const A=KBg.get(g);return A?Object.fromEntries(Object.entries(A.stores).map(([I,e])=>[I,e.getState()])):{}},kGo=(g,A,I)=>{if(g===void 0)return{type:"untracked",connection:A.connect(I)};const e=KBg.get(I.name);if(e)return{type:"tracked",store:g,...e};const t={connection:A.connect(I),stores:{}};return KBg.set(I.name,t),{type:"tracked",store:g,...t}},nJI=(g,A={})=>(I,e,t)=>{const{enabled:o,anonymousActionType:B,store:C,...Q}=A;let i;try{i=(o??(PBg?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!i)return(PBg?"production":void 0)!=="production"&&o&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),g(I,e,t);const{connection:E,...n}=kGo(C,i,Q);let s=!0;t.setState=(c,h,l)=>{const D=I(c,h);if(!s)return D;const d=l===void 0?{type:B||"anonymous"}:typeof l=="string"?{type:l}:l;return C===void 0?(E?.send(d,e()),D):(E?.send({...d,type:`${C}/${d.type}`},{...GmA(Q.name),[C]:t.getState()}),D)};const r=(...c)=>{const h=s;s=!1,I(...c),s=h},a=g(t.setState,e,t);if(n.type==="untracked"?E?.init(a):(n.stores[n.store]=t,E?.init(Object.fromEntries(Object.entries(n.stores).map(([c,h])=>[c,c===n.store?a:h.getState()])))),t.dispatchFromDevtools&&typeof t.dispatch=="function"){let c=!1;const h=t.dispatch;t.dispatch=(...l)=>{(PBg?"production":void 0)!=="production"&&l[0].type==="__setState"&&!c&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),c=!0),h(...l)}}return E.subscribe(c=>{var h;switch(c.type){case"ACTION":if(typeof c.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return LBg(c.payload,l=>{if(l.type==="__setState"){if(C===void 0){r(l.state);return}Object.keys(l.state).length!==1&&console.error(`
5667
+ `,n=new Blob([E],{type:"text/plain"}),s=URL.createObjectURL(n),r=document.createElement("a");r.href=s,r.download=`${i}.test.ts`,r.click(),URL.revokeObjectURL(s)}catch(Q){alert(`Error generating test.ts for ${g.getSolverName()}: ${Q instanceof Error?Q.message:String(Q)}`)}e(!1)};return W.jsxs("div",{className:`relative ${A}`,ref:t,children:[W.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>e(!I),title:`Download options for ${g.getSolverName()}`,children:g.getSolverName()}),I&&W.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:[W.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:o,children:"Download JSON"}),W.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:B,children:"Download page.tsx"}),W.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:C,children:"Download test.ts"})]})]})},jUI=g=>g.activeSubSolver?[g,...jUI(g.activeSubSolver)]:[g],Huo=({solver:g})=>{const A=jUI(g);return W.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:A.map((I,e)=>W.jsxs("div",{className:"flex items-center",children:[e>0&&W.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),W.jsx(buo,{solver:I})]},I.getSolverName()))})},vuo=({solver:g,triggerRender:A,animationSpeed:I=25,renderer:e,onRendererChange:t,onAnimationSpeedChange:o,onDownloadVisualization:B,onSolverStarted:C,onSolverCompleted:Q})=>{const[i,E]=gA.useReducer(m=>!m,!1),n=gA.useRef(void 0),s=gA.useRef(null),r="solver-debugger-last-iteration",[a,c]=gA.useState(null),h=gA.useRef(null),l=gA.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"}],[]),D=()=>{const m=Math.max(1,I),p=I<1?Math.round(1/I):1;n.current=setInterval(()=>{if(g.solved||g.failed){n.current&&(clearInterval(n.current),n.current=void 0),E(),A(),Q&&g.solved&&Q(g);return}for(let k=0;k<p&&!(g.solved||g.failed);k++)g.step();A()},m)},d=()=>{n.current&&(clearInterval(n.current),n.current=void 0)},y=()=>{!g.solved&&!g.failed&&(g.step(),A())},w=()=>{!g.solved&&!g.failed&&(C&&C(g),g.solve(),A(),Q&&Q(g))},u=()=>{i?(d(),E()):(E(),D())},G=()=>{if(g.solved||g.failed||i)return;s.current===null&&typeof window<"u"&&(s.current=window.localStorage.getItem(r));const m=window.prompt("Step until which iteration?",s.current??`${g.iterations}`);if(m===null)return;s.current=m,typeof window<"u"&&window.localStorage.setItem(r,m);const p=Number(m);if(!Number.isFinite(p)){window.alert("Please enter a valid number for the iteration");return}for(;g.iterations<p&&!g.solved&&!g.failed;)g.step();A(),g.solved&&Q&&Q(g)};return gA.useEffect(()=>()=>{d()},[]),gA.useEffect(()=>{(g.solved||g.failed)&&i&&(d(),E())},[g.solved,g.failed,i]),gA.useEffect(()=>{i&&(d(),D())},[I,i]),gA.useEffect(()=>{if(typeof document>"u")return;const m=p=>{h.current&&!h.current.contains(p.target)&&c(null)};return document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m)}},[]),W.jsxs("div",{className:"space-y-2 p-2 border-b",children:[W.jsx("div",{className:"flex items-center",children:W.jsxs("div",{className:"flex items-center gap-2",ref:h,children:[W.jsxs("div",{className:"flex h-9 items-center space-x-1 rounded-md border border-slate-200 bg-white p-1 shadow-sm",children:[W.jsxs("div",{className:"relative",children:[W.jsx("button",{type:"button",onClick:()=>c(a==="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":a==="renderer"?"open":"closed",children:"Renderer"}),a==="renderer"&&W.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(m=>W.jsxs("button",{type:"button",onClick:()=>{t(m),c(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[m==="vector"?"Vector":"Canvas",e===m&&W.jsx("span",{className:"ml-auto text-xs text-slate-500",children:"✓"})]},m))})]}),W.jsxs("div",{className:"relative",children:[W.jsx("button",{type:"button",onClick:()=>c(a==="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":a==="debug"?"open":"closed",children:"Debug"}),a==="debug"&&W.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:W.jsx("button",{type:"button",onClick:()=>{B(),c(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:"Download Visualization"})})]}),W.jsxs("div",{className:"relative",children:[W.jsx("button",{type:"button",onClick:()=>c(a==="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":a==="animation"?"open":"closed",children:"Animation"}),a==="animation"&&W.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:l.map(m=>W.jsxs("button",{type:"button",onClick:()=>{o(m.value),c(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[m.label,W.jsx("span",{className:"ml-auto text-xs text-slate-500",children:m.description}),I===m.value&&W.jsx("span",{className:"ml-2 text-xs text-slate-500",children:"✓"})]},m.value))})]})]}),W.jsx(Huo,{solver:g})]})}),W.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[W.jsx("button",{onClick:y,disabled:g.solved||g.failed||i,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),W.jsx("button",{onClick:w,disabled:g.solved||g.failed||i,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),W.jsx("button",{onClick:u,disabled:g.solved||g.failed,className:`px-3 py-1 rounded text-white text-sm ${i?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:i?"Stop":"Animate"}),W.jsx("button",{onClick:G,disabled:g.solved||g.failed||i,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"}),W.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",g.iterations]}),g.timeToSolve!==void 0&&W.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(g.timeToSolve/1e3).toFixed(3),"s"]}),g.solved&&W.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),g.failed&&W.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),g.error&&W.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",g.error]})]})},quo=g=>g!==null&&"pipelineDef"in g&&Array.isArray(g.pipelineDef),Tuo=(g,A,I)=>{const e=g.currentPipelineStageIndex;return A<e?"Completed":A===e&&g.activeSubSolver?g.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},Zuo=(g,A)=>{const e=g.pipelineDef[A].solverName,t=Tuo(g,A),o=g[e],B=g.firstIterationOfStage?.[e]??(A===g.currentPipelineStageIndex?g.iterations:null),C=g.iterations;let Q=0;if(t==="Completed"){const s=g.pipelineDef[A+1],r=s?g.firstIterationOfStage?.[s.solverName]:void 0;r!==void 0&&B!==null?Q=r-B:B!==null&&(Q=C-B)}else t==="In Progress"&&B!==null&&(Q=C-B);const i=g.timeSpentOnStage?.[e]??0;let E=0;t==="Completed"?E=1:t==="In Progress"&&o&&(E=o.progress??0);const n=o?.stats??null;return{index:A,name:e,status:t,firstIteration:B,iterations:Q,progress:E,timeSpent:i,stats:n&&Object.keys(n).length>0?n:null,solverInstance:o??null}},Ouo=({status:g})=>{const A={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return W.jsx("span",{className:`font-medium ${A[g]}`,children:g})},Wuo=({progress:g})=>{if(g===0)return null;const A=Math.round(g*100);return W.jsxs("div",{className:"flex items-center gap-2",children:[W.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:W.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${A}%`}})}),W.jsxs("span",{className:"text-xs text-gray-500",children:[A,"%"]})]})},zUI=g=>{if(typeof g=="string")return g;if(typeof g=="number"||typeof g=="boolean"||typeof g=="bigint"||g==null)return String(g);if(typeof g=="object")try{return JSON.stringify(g)}catch{return String(g)}return String(g)},Vuo=g=>Object.entries(g).map(([A,I])=>`${A}: ${zUI(I)}`).join(", "),juo=({stats:g})=>{if(!g||Object.keys(g).length===0)return W.jsx("span",{children:"-"});const A=Object.entries(g),I=Vuo(g);return W.jsxs("details",{className:"cursor-pointer",children:[W.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:I}),W.jsx("div",{className:"mt-1 text-xs",children:A.map(([e,t])=>W.jsxs("div",{children:[e,": ",zUI(t)]},e))})]})},xBg=g=>{if(g===null||typeof g!="object")return g;if(Array.isArray(g))return g.map(xBg);const A={};for(const[I,e]of Object.entries(g))I.startsWith("_")||(A[I]=xBg(e));return A},zuo=(g,A)=>{try{if(typeof g.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${A}`);return}const I=xBg(g.getConstructorParams()),e=new Blob([JSON.stringify(I,null,2)],{type:"application/json"}),t=URL.createObjectURL(e),o=document.createElement("a");o.href=t,o.download=`${A}_input.json`,o.click(),URL.revokeObjectURL(t)}catch(I){alert(`Error downloading input for ${A}: ${I instanceof Error?I.message:String(I)}`)}},Xuo=({expanded:g})=>W.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 ${g?"rotate-90":""}`,children:W.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"})}),XUI=g=>{let A=g;for(;A.activeSubSolver;)A=A.activeSubSolver;return A},$UI=({solver:g,onStepUntilPhase:A,onDownloadInput:I,isNested:e=!1,indentLevel:t=0,triggerRender:o})=>{const[B,C]=gA.useState(new Set),Q=g.pipelineDef.map((h,l)=>Zuo(g,l)),i=h=>{C(l=>{const D=new Set(l);return D.has(h)?D.delete(h):D.add(h),D})},E=h=>{A?.(h)},n=h=>{h.solverInstance&&(I?I(h.solverInstance,h.name):zuo(h.solverInstance,h.name))},s=h=>`${(h/1e3).toFixed(2)}s`,r=()=>{if(!g.solved&&!g.failed){const h=g.activeSubSolver;for(;!g.solved&&!g.failed&&(g.step(),!(g.activeSubSolver&&g.activeSubSolver!==h)););o?.()}},a=()=>{if(!g.solved&&!g.failed){const h=XUI(g);for(;!g.solved&&!g.failed&&(g.step(),XUI(g)===h););o?.()}},c=t*24;return W.jsxs("div",{className:e?"":"border-t border-gray-200",children:[!e&&W.jsxs("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200 flex items-center justify-between",children:[W.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Stages"}),W.jsxs("div",{className:"flex gap-2",children:[W.jsx("button",{onClick:a,disabled:g.solved||g.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"}),W.jsx("button",{onClick:r,disabled:g.solved||g.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"})]})]}),W.jsx("div",{className:"overflow-x-auto",children:W.jsxs("table",{className:"w-full text-sm",children:[!e&&W.jsx("thead",{children:W.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stage"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),W.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",W.jsx("sub",{children:"0"})]}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),W.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),W.jsx("tbody",{children:Q.map(h=>{const l=quo(h.solverInstance),D=B.has(h.name);return W.jsxs(aC.Fragment,{children:[W.jsxs("tr",{className:`border-b border-gray-100 ${h.status==="In Progress"?"bg-yellow-50":""}`,children:[W.jsx("td",{className:"px-4 py-2",children:W.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:c},children:[l?W.jsx("button",{onClick:()=>i(h.name),className:"text-gray-500 hover:text-gray-700",title:D?"Collapse":"Expand",children:W.jsx(Xuo,{expanded:D})}):W.jsx("span",{className:"w-4"}),W.jsx("span",{className:"text-gray-400 w-6",children:String(h.index+1).padStart(2,"0")}),W.jsx("button",{onClick:()=>E(h.name),disabled:h.status==="Completed"||g.solved||g.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${h.name} completes`,children:W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:W.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"})})}),W.jsx("span",{className:"font-medium text-gray-900",children:h.name})]})}),W.jsx("td",{className:"px-4 py-2",children:W.jsx(Ouo,{status:h.status})}),W.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:h.firstIteration!==null?h.firstIteration:""}),W.jsx("td",{className:"px-4 py-2 text-gray-600",children:h.iterations}),W.jsx("td",{className:"px-4 py-2",children:W.jsx(Wuo,{progress:h.progress})}),W.jsx("td",{className:"px-4 py-2 text-gray-600",children:s(h.timeSpent)}),W.jsx("td",{className:"px-4 py-2 text-gray-500",children:W.jsx(juo,{stats:h.stats})}),W.jsx("td",{className:"px-4 py-2",children:h.solverInstance?W.jsxs("button",{onClick:()=>n(h),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${h.name}`,children:[W.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:W.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"})}),W.jsx("span",{children:"Input"})]}):null})]}),l&&D&&W.jsx("tr",{children:W.jsx("td",{colSpan:8,className:"p-0",children:W.jsx($UI,{solver:h.solverInstance,onStepUntilPhase:A,onDownloadInput:I,isNested:!0,indentLevel:t+1,triggerRender:o})})})]},h.name)})})]})})]})};function $uo({graphics:g}){const A=g.points??[],I=g.lines??[],e=g.rects??[],t=g.circles??[],o=g.texts??[];let B=Number.POSITIVE_INFINITY,C=Number.POSITIVE_INFINITY,Q=Number.NEGATIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const E=(h,l)=>{typeof h=="number"&&(h<B&&(B=h),h>Q&&(Q=h)),typeof l=="number"&&(l<C&&(C=l),l>i&&(i=l))};for(const h of A)E(h.x,h.y);for(const h of I){const l=h.points??[];for(const D of l)E(D.x,D.y)}for(const h of e){const l=h.x??0,D=h.y??0,d=h.width??0,y=h.height??0;E(l,D),E(l+d,D+y)}for(const h of t){const l=h.x??0,D=h.y??0,d=h.radius??1;E(l-d,D-d),E(l+d,D+d)}for(const h of o)E(h.x,h.y);(!isFinite(B)||!isFinite(C)||!isFinite(Q)||!isFinite(i))&&(B=-20,C=-20,Q=20,i=20);const n=10,s=B-n,r=C-n,a=Math.max(1,Q-B+2*n),c=Math.max(1,i-C+2*n);return W.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${s} ${r} ${a} ${c}`,role:"img","aria-label":"Graphics fallback",children:[e.map((h,l)=>W.jsx("rect",{x:h.x??0,y:h.y??0,width:h.width??0,height:h.height??0,fill:"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1},`rect-${l}`)),I.map((h,l)=>W.jsx("polyline",{fill:"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1,points:(h.points??[]).map(D=>`${D.x??0},${D.y??0}`).join(" ")},`line-${l}`)),t.map((h,l)=>W.jsx("circle",{cx:h.x??0,cy:h.y??0,r:h.radius??1.5,fill:h.fillColor??"none",stroke:h.strokeColor??"black",strokeWidth:h.strokeWidth??1},`circle-${l}`)),A.map((h,l)=>W.jsx("circle",{cx:h.x??0,cy:h.y??0,r:h.radius??1.5,fill:h.color??"black"},`point-${l}`)),o.map((h,l)=>W.jsx("text",{x:h.x??0,y:h.y??0,fontSize:h.fontSize??10,fill:h.color??"black",children:h.text??""},`text-${l}`))]})}var AGo=class extends aC.Component{constructor(g){super(g),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(g){console.error("InteractiveGraphics render error:",g)}render(){return this.state.hasError?this.props.fallback:this.props.children}},gGo=({solver:g,createSolver:A,animationSpeed:I=25,onSolverStarted:e,onSolverCompleted:t})=>{const[o,B]=gA.useReducer(D=>D+1,0),[C]=gA.useState(()=>{if(A)return A();if(!g)throw new Error("GenericSolverDebugger requires solver or createSolver");return g}),[Q,i]=gA.useState(()=>typeof window>"u"?"vector":window.localStorage.getItem("solver-utils-renderer")==="canvas"?"canvas":"vector"),[E,n]=gA.useState(I),s=gA.useMemo(()=>{try{return C.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(D){return console.error("Visualization error:",D),{points:[],lines:[],rects:[],circles:[]}}},[C,o]),r=gA.useMemo(()=>(s.rects?.length||0)===0&&(s.lines?.length||0)===0&&(s.points?.length||0)===0&&(s.circles?.length||0)===0,[s]);gA.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const D=document.createElement("script");D.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(D)}},[]),gA.useEffect(()=>{n(I)},[I]);const a=C.pipelineDef!==void 0,c=D=>{const d=C;if(!C.solved&&!C.failed){for(;!C.solved&&!C.failed&&d.currentPipelineStageIndex<=d.pipelineDef.findIndex(y=>y.solverName===D);)C.step();B()}},h=()=>{const D=JSON.stringify(s,null,2),d=new Blob([D],{type:"application/json"}),y=URL.createObjectURL(d),w=document.createElement("a");w.download="visualization.json",w.href=y,document.body.appendChild(w),w.click(),document.body.removeChild(w),URL.revokeObjectURL(y)},l=D=>{i(D),typeof window<"u"&&window.localStorage.setItem("solver-utils-renderer",D)};return W.jsxs("div",{children:[W.jsx(vuo,{solver:C,triggerRender:B,animationSpeed:E,renderer:Q,onRendererChange:l,onAnimationSpeedChange:n,onDownloadVisualization:h,onSolverStarted:e,onSolverCompleted:t}),r?W.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):W.jsx(AGo,{fallback:W.jsx($uo,{graphics:s}),children:Q==="canvas"?W.jsx(_uo,{graphics:s}):W.jsx(Kuo,{graphics:s})}),a&&W.jsx($UI,{solver:C,onStepUntilPhase:c,triggerRender:B})]})};const IGo=()=>{gA.useEffect(()=>{const g="tailwind-cdn-script";if(document.getElementById(g)||window.tailwind)return;const A=document.createElement("div");A.className="hidden",document.body.appendChild(A);const I=window.getComputedStyle(A).display==="none";if(document.body.removeChild(A),I)return;const e=document.createElement("script");e.id=g,e.src="https://cdn.tailwindcss.com",document.head.appendChild(e)},[])},eGo=1e3,Jk=(g,A)=>{const{fileName:I,mimeType:e="text/plain"}=A,t=g instanceof Blob?g:new Blob([g],{type:e}),o=URL.createObjectURL(t),B=document.createElement("a");B.href=o,B.download=I,B.target="_blank",B.rel="noopener noreferrer",B.style.display="none",document.body.appendChild(B),B.click(),document.body.removeChild(B),setTimeout(()=>{URL.revokeObjectURL(o)},eGo)},FBg=g=>{let A=g.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(A)&&(A=`_${A}`),A=A.slice(0,200),A||"untitled"},tGo=g=>{const A=g.solverConstructorArgs??[g.solverParams];if(g.solverName!=="AutoroutingPipelineSolver7_MultiGraph"||A.length!==1)return A;const[{input:I,options:e}]=A;return[I,e]},EF="https://github.com/tscircuit/tscircuit-autorouter/issues/new",AJI="https://github.com/tscircuit/copper-pour-solver/issues/new",gJI="https://github.com/tscircuit/calculate-packing/issues/new",oGo="https://github.com/tscircuit/matchpack/issues/new",IJI="https://github.com/tscircuit/schematic-trace-solver/issues/new?template=json-bug-report.yml",BGo={PackSolver2:gJI,LayoutPipelineSolver:oGo,AutoroutingPipelineSolver:EF,AssignableAutoroutingPipeline2:EF,AssignableAutoroutingPipeline3:EF,AutoroutingPipeline1_OriginalUnravel:EF,AutoroutingPipelineSolver3_HgPortPointPathing:EF,AutoroutingPipelineSolver4:EF,AutoroutingPipelineSolver5:EF,AutoroutingPipelineSolver7_MultiGraph:EF,AutoroutingPipelineSolver8:EF,CopperPourPipelineSolver:AJI,SchematicTracePipelineSolver:IJI},CGo=g=>g.toLowerCase().includes("pack")?wso:g.toLowerCase().includes("rout")?HNI:aso,eJI=g=>{const A=BGo[g];if(A)return A;const I=g.toLowerCase();return I.includes("autorout")?EF:I.includes("schematic")&&I.includes("trace")?IJI:I.includes("copperpour")?AJI:I.includes("pack")?gJI:null},QGo=g=>`${FBg(`${g.componentName}-${g.solverName}`)}-solver-input.json`,tJI=g=>{Jk(JSON.stringify(g.solverParams,null,2),{fileName:QGo(g),mimeType:"application/json"})},iGo=({solverEvent:g})=>{const A=eJI(g.solverName);return W.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:[W.jsxs($E,{type:"button",variant:"outline",size:"sm",onClick:()=>tJI(g),children:[W.jsx(QtA,{className:"rf-w-4 rf-h-4"}),"Download"]}),A?W.jsx($E,{asChild:!0,variant:"outline",size:"sm",children:W.jsxs("a",{href:A,target:"_blank",rel:"noopener noreferrer",children:[W.jsx(oGA,{className:"rf-w-4 rf-h-4"}),"Report"]})}):W.jsxs($E,{type:"button",variant:"outline",size:"sm",disabled:!0,title:"No report link configured for this solver",children:[W.jsx(oGA,{className:"rf-w-4 rf-h-4"}),"Report"]})]})},EGo=({solverEvent:g})=>{const A=eJI(g.solverName);return A?W.jsx($E,{asChild:!0,variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",children:W.jsx("a",{href:A,target:"_blank",rel:"noopener noreferrer",title:"Report solver bug","aria-label":"Report solver bug",children:W.jsx(oGA,{className:"rf-w-4 rf-h-4"})})}):W.jsx($E,{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:W.jsx(oGA,{className:"rf-w-4 rf-h-4"})})},nGo=({solverEvents:g=[]})=>{const[A,I]=gA.useState(null);IGo();const e=gA.useMemo(()=>{const C=new Map;for(const Q of g){const i=`${Q.componentName}-${Q.solverName}`;C.set(i,Q)}return C},[g]),t=gA.useMemo(()=>Array.from(e.keys()),[e]),o=A?e.get(A):null,B=gA.useMemo(()=>{if(!o)return{instance:null,error:null,classFound:!1};const C=vqA[o.solverName];if(!C)return{instance:null,error:`Solver class "${o.solverName}" not found in SOLVERS registry. Available: ${Object.keys(vqA).join(", ")}`,classFound:!1};try{return{instance:new C(...tGo(o)),error:null,classFound:!0}}catch(Q){const i=Q instanceof Error?Q.message:String(Q);return console.error("Failed to reconstruct solver:",Q),{instance:null,error:`Failed to instantiate solver: ${i}`,classFound:!0}}},[o]);return g.length===0?W.jsx("div",{className:"rf-p-4",children:W.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:W.jsxs("div",{className:"rf-p-4",children:[W.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),W.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."})]})})}):W.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[W.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[W.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:[t.length," ",t.length===1?"Solver":"Solvers"]}),t.map(C=>{const Q=e.get(C),i=A===C;return W.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${i?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>I(C),children:(()=>{const E=CGo(Q.solverName);return W.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[W.jsx(E,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),W.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[W.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:Q.componentName}),W.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:Q.solverName})]})]})})()},C)})]}),W.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:o?B.instance?W.jsxs("div",{className:"rf-flex rf-h-full rf-flex-col rf-overflow-y-auto",children:[W.jsx(iGo,{solverEvent:o}),W.jsx("div",{className:"rf-min-h-0 rf-flex-1",children:W.jsx(zR,{fallback:W.jsx("div",{className:"rf-p-4",children:W.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[W.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),W.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",o.solverName]})]})}),children:W.jsx(gGo,{solver:B.instance})})})]}):W.jsxs("div",{className:"rf-p-4",children:[W.jsxs("div",{className:"rf-mb-4",children:[W.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:o.solverName}),W.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",o.componentName]})]}),B.error&&W.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${B.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:W.jsx("p",{className:`rf-text-sm ${B.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:B.error})}),W.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[W.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:[W.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"}),W.jsxs("div",{className:"rf-flex rf-items-center rf-gap-1",children:[W.jsx(EGo,{solverEvent:o}),W.jsx($E,{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:()=>tJI(o),children:W.jsx(QtA,{className:"rf-w-4 rf-h-4"})})]})]}),W.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:W.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(o.solverParams,null,2)})})]})]}):W.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:W.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},sGo=new Map([["custom","Custom"],["fanout","Fanout"],["single_layer_fanout","Single layer fanout"],["tscircuit_simplify","Simplify"]]),aGo=new Set(["tscircuit","default","auto","auto_local"]);function rGo(g){if(g==="FanoutSolver")return"Fanout";if(g==="AutoroutingPipelineSolver11_Simplification")return"Simplify";const A=g.match(/^AutoroutingPipeline(?:Solver)?(\d+)(?:_|$)/);if(A)return`Pipeline${A[1]}`;const I=g.match(/^AssignableAutoroutingPipeline(\d+)$/);return I?`Assignable${I[1]}`:g}function cGo(g){const A=g.autorouterName?.trim(),I=A?.replace(/-/g,"_"),e=I&&sGo.get(I);if(e)return e;if(I&&!aGo.has(I))return A;const t=g.solverName?.trim();if(t)return rGo(t);const o=g.autorouterVersion?.trim();if(o){const B=o.match(/^beta[_-]pipeline(\d+)$/);return B?`Pipeline${B[1]}`:o==="latest"?"default":o}return A?"default":"Unknown"}const UBg="#fbbf24";function hGo(g){const A=g.endSimpleRouteJson?.traces??[],I=new Set(A.flatMap(t=>[t.pcb_trace_id,t.__replaces_pcb_trace_id].filter(o=>o!==void 0)));return[...(g.startSimpleRouteJson?.traces??[]).filter(t=>!I.has(t.pcb_trace_id)),...A]}function oJI(g){const A=new Map((g.startSimpleRouteJson?.traces??[]).map(I=>[I.pcb_trace_id,I]));return(g.endSimpleRouteJson?.traces??[]).filter(I=>{const e=A.get(I.pcb_trace_id);return!e||!!I.__replaces_pcb_trace_id&&I.__replaces_pcb_trace_id!==e.__replaces_pcb_trace_id||JSON.stringify(e.route)!==JSON.stringify(I.route)}).map(I=>I.pcb_trace_id)}function lGo(g,A){return{outer_diameter:g.via_diameter??A.minViaPadDiameter??A.min_via_pad_diameter??A.minViaDiameter??.6,hole_diameter:g.via_hole_diameter??A.minViaHoleDiameter??A.min_via_hole_diameter??.3}}function BJI(g,A){const I=[];for(const C of g.route)C.route_type==="wire"?I.push({...C,layer:C.layer}):C.route_type==="via"?I.push({route_type:"via",x:C.x,y:C.y,from_layer:C.from_layer,to_layer:C.to_layer,...lGo(C,A)}):C.route_type==="through_obstacle"&&I.push({route_type:"through_pad",start:{...C.start},end:{...C.end},width:C.width,start_layer:C.from_layer,end_layer:C.to_layer,pcb_smtpad_id:C.circuitJsonMetadata?.pcb_smtpad_id,pcb_plated_hole_id:C.circuitJsonMetadata?.pcb_plated_hole_id});const e=C=>{let Q=-1,i=Number.POSITIVE_INFINITY;return I.forEach((E,n)=>{if(E.route_type!=="wire")return;const s=Math.hypot(E.x-C.x,E.y-C.y);s<i&&(i=s,Q=n)}),Q},t=g.route.filter(C=>C.route_type==="jumper").map(C=>[e(C.start),e(C.end)].sort((Q,i)=>Q-i)).filter(([C,Q])=>C>=0&&Q>C).sort(([C],[Q])=>C-Q),o=[];let B=0;for(const[C,Q]of t)C>=B&&o.push(I.slice(B,C+1)),B=Math.max(B,Q);return B<I.length&&o.push(I.slice(B)),o}function DGo(g){const A=[],I=[],e=g.endSimpleRouteJson;if(!e)return{lines:A,circles:I};const t=new Set(oJI(g));for(const o of e.traces??[])if(t.has(o.pcb_trace_id))for(const B of BJI(o,e)){let C;for(const Q of B){if(Q.route_type==="through_pad"){C={...Q.end,layer:Q.end_layer,width:Q.width};continue}const i=Q.route_type==="wire"?Q.layer:Q.from_layer;C&&C.layer===i&&(C.x!==Q.x||C.y!==Q.y)&&A.push({points:[{x:C.x,y:C.y},{x:Q.x,y:Q.y}],strokeWidth:Q.route_type==="wire"?Q.width:C.width,strokeColor:UBg,layer:i}),Q.route_type==="via"&&I.push({center:{x:Q.x,y:Q.y},radius:Q.outer_diameter/2,stroke:UBg,fill:"transparent"}),C={x:Q.x,y:Q.y,layer:Q.route_type==="wire"?Q.layer:Q.to_layer,width:Q.route_type==="wire"?Q.width:C?.width??e.minTraceWidth}}}return{coordinateSystem:"cartesian",lines:A,circles:I}}function dGo(g){const A=JSON.stringify(g);let I=2166136261;for(let e=0;e<A.length;e++)I=Math.imul(I^A.charCodeAt(e),16777619);return(I>>>0).toString(36)}const yGo=new Set(["pcb_trace","pcb_via","pcb_copper_pour","pcb_ground_plane","pcb_ground_plane_region","pcb_thermal_spoke","pcb_breakout_point"]);function wGo(g,A,I){const e=I==="input"?A.startSimpleRouteJson??A.errorSimpleRouteJson:A.endSimpleRouteJson,t=g.filter(i=>!yGo.has(i.type)&&!i.type.endsWith("_error")&&!i.type.endsWith("_warning"));if(!e)return t;const o=I==="input"?e.traces??[]:hGo(A),B=new Set(g.filter(i=>i.type==="source_trace").map(i=>i.source_trace_id)),C=["top",...Array.from({length:Math.max(0,e.layerCount-2)},(i,E)=>`inner${E+1}`),...e.layerCount>1?["bottom"]:[]],Q=[];for(const i of o){const n=e.connections.find(r=>r.name===i.connection_name||r.source_trace_id===i.connection_name)?.source_trace_id??i.connection_name??"",s=BJI(i,e);for(const[r,a]of s.entries()){const c={type:"pcb_trace",pcb_trace_id:`${A.id}_${I}_${i.pcb_trace_id}_${r}_${dGo(a)}`,subcircuit_id:A.subcircuit_id??void 0,source_trace_id:B.has(n)?n:void 0,route:a};Q.push(c);for(const[h,l]of a.entries()){if(l.route_type!=="via")continue;const D=C.indexOf(l.from_layer),d=C.indexOf(l.to_layer),y={type:"pcb_via",pcb_via_id:`${c.pcb_trace_id}_via_${h}`,pcb_trace_id:c.pcb_trace_id,subcircuit_id:A.subcircuit_id??void 0,x:l.x,y:l.y,outer_diameter:l.outer_diameter,hole_diameter:l.hole_diameter,layers:D>=0&&d>=0?C.slice(Math.min(D,d),Math.max(D,d)+1):[l.from_layer,l.to_layer]};Q.push(y)}}}return[...t,...Q]}const JBg=(g,A)=>g.phaseName||`Phase ${g.phaseOrdinal??A+1}`,CJI=g=>g.componentDisplayName?.match(/name="([^"]+)"/)?.[1]?.replace(/^\./,"")||g.componentDisplayName||g.subcircuit_id||"Board",QJI=g=>g.startSimpleRouteJson??g.endSimpleRouteJson??g.errorSimpleRouteJson,uGo={is_showing_autorouting:!0,is_showing_rats_nest:!1,is_showing_drc_errors:!1,is_showing_drc_warnings:!1,is_showing_pcb_groups:!1},GGo=({circuitJson:g,phases:A=[],isRunning:I=!1})=>{const[e,t]=gA.useState(null),[o,B]=gA.useState("output"),[C,Q]=gA.useState(!0),[i,E]=gA.useState(!1),n=gA.useRef(null),[s,r]=gA.useState(480),a=e?A.findIndex(N=>N.id===e.id&&QJI(N)===QJI(e)):-1,c=a<0?A.length-1:a,h=A[c],l=a<0,D=!!h?.endSimpleRouteJson,d=h?.startSimpleRouteJson??h?.errorSimpleRouteJson,y=!!d,w=o==="output"&&!D?"input":o==="input"&&!y?"output":o,u=w==="input"?d:h?.endSimpleRouteJson,G=gA.useMemo(()=>!h||!u?null:wGo(g??[],h,w),[g,h,u,w]),m=gA.useMemo(()=>h&&w==="output"&&C?DGo(h):{lines:[],circles:[]},[h,w,C]);if(gA.useLayoutEffect(()=>{const N=n.current;if(!N)return;const U=()=>r(Math.max(360,N.clientHeight));U();const K=new ResizeObserver(U);return K.observe(N),()=>K.disconnect()},[!!h]),!h)return W.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:[W.jsx(HNI,{className:"rf-h-7 rf-w-7 rf-text-blue-500"}),W.jsx("h3",{className:"rf-text-base rf-font-medium",children:I?"Waiting for autorouting":"No autorouting captures"}),W.jsx("p",{className:"rf-max-w-md rf-text-sm rf-text-gray-500",children:I?"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 p=JBg(h,c),k=h.status==="running"&&I,S=!D,R=d?.connections.length,x=G?.filter(N=>N.type==="pcb_trace").length??0;return W.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:[W.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:[W.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:[W.jsx("span",{children:"Routing phases"}),W.jsx("span",{children:A.length})]}),W.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:A.map((N,U)=>{const K=oJI(N).length,Y=N.endSimpleRouteJson?`${K} ${K===1?"trace":"traces"} routed`:N.status==="error"?"Failed":N.status==="running"&&I?"Routing…":"No output";return W.jsxs("button",{type:"button","aria-pressed":U===c,title:`${CJI(N)} · ${Y}`,onClick:()=>t(N),className:rB("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",U===c?"rf-border-blue-200 rf-bg-blue-50":"rf-border-transparent hover:rf-bg-gray-50"),children:[W.jsx("span",{className:rB("rf-flex rf-h-5 rf-w-5 rf-shrink-0 rf-items-center rf-justify-center rf-rounded-full rf-text-[11px]",U===c?"rf-bg-blue-600 rf-text-white":"rf-bg-gray-100 rf-text-gray-500"),children:U+1}),W.jsxs("span",{className:"rf-min-w-0 rf-flex-1",children:[W.jsxs("span",{className:"rf-flex rf-items-center rf-gap-1",children:[W.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:JBg(N,U),children:JBg(N,U)}),N.status==="complete"?W.jsx(VZ,{"aria-label":"Captured",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-green-600"}):N.status==="error"?W.jsx(Htg,{"aria-label":"Failed",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-red-500"}):I?W.jsx(of,{"aria-label":"Routing",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-animate-spin rf-text-blue-500"}):null]}),W.jsxs("span",{className:"rf-block rf-text-[11px] rf-leading-4 rf-text-gray-500",children:[cGo(N)," · ",Y]})]})]},N.id)})})]}),W.jsxs("div",{className:"rf-flex rf-min-w-0 rf-flex-1 rf-flex-col",children:[W.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:[W.jsxs("h3",{className:"rf-mr-auto rf-flex rf-items-center rf-gap-2 rf-text-sm rf-font-medium",children:[p,W.jsxs("span",{className:"rf-text-xs rf-font-normal rf-text-gray-500",children:[c+1," of ",A.length]})]}),I&&W.jsx("button",{type:"button",onClick:()=>t(null),disabled:l,className:"rf-text-xs rf-text-blue-600 disabled:rf-text-gray-500",children:l?"Following latest":"Follow latest"}),W.jsx("div",{className:"rf-flex rf-rounded-md rf-bg-gray-100 rf-p-1","aria-label":"Phase snapshot",children:["input","output"].map(N=>W.jsx("button",{type:"button","aria-pressed":w===N,disabled:N==="input"?!y:!D,onClick:()=>B(N),className:rB("rf-rounded rf-px-3 rf-py-1 rf-text-xs disabled:rf-opacity-40",w===N?"rf-bg-white rf-text-gray-900 rf-shadow-sm":"rf-text-gray-500"),children:N==="input"?"Input":"Output"},N))})]}),W.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:[W.jsxs("label",{className:"rf-flex rf-items-center rf-gap-2",children:[W.jsx("input",{type:"checkbox",checked:C,disabled:w!=="output",onChange:N=>Q(N.target.checked),className:"rf-accent-blue-600"}),W.jsx("span",{"aria-hidden":"true",className:"rf-inline-block rf-h-0.5 rf-w-3",style:{backgroundColor:UBg}}),"Highlight changes (all layers)"]}),W.jsxs("span",{children:[w==="input"?"Before this phase":"After this phase"," ","· ",x," traces"]})]}),S&&W.jsx("div",{className:rB("rf-border-y rf-px-4 rf-py-2 rf-text-xs",h.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:h.status==="error"?`Routing failed: ${h.error?.message||"No output was captured."}`:k?"Routing in progress. Showing captured input until output is available.":"No output was captured for this phase. Showing the available input."}),W.jsx("div",{ref:n,className:"rf-relative rf-min-h-[360px] rf-flex-1","data-testid":"autorouting-pcb",children:G?W.jsx(Ytg,{circuitJson:G,height:s,allowEditing:!1,clickToInteractEnabled:!1,initialState:uGo,debugGraphics:m}):W.jsx("div",{className:"rf-p-6 rf-text-sm rf-text-gray-500",children:"No PCB snapshot available for this capture."})}),W.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:[W.jsxs("span",{children:[R===void 0?"Input unavailable":`${R} input connections`,` · ${CJI(h)}`]}),W.jsxs("div",{className:"rf-flex rf-items-center rf-gap-4",children:[W.jsxs("button",{type:"button",disabled:!u,onClick:()=>Jk(JSON.stringify(u,null,2),{fileName:`${h.id}-${w}.srj.json`,mimeType:"application/json"}),className:"rf-flex rf-items-center rf-gap-1 disabled:rf-opacity-40",children:[W.jsx(QtA,{className:"rf-h-3 rf-w-3"}),"Download SRJ"]}),W.jsxs("button",{type:"button","aria-expanded":i,onClick:()=>E(!i),className:"rf-flex rf-items-center rf-gap-1",children:[W.jsx(jZ,{className:rB("rf-h-3 rf-w-3",i&&"rf-rotate-90")}),"Inspect SRJ"]})]})]}),i&&W.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":`${p} ${w} SRJ`,children:u?JSON.stringify(u,null,2):"No snapshot captured."})]})]})},iJI=({errorMessage:g,errorStack:A,circuitJsonErrors:I})=>{gA.useEffect(()=>{if(jF("TSCIRCUIT_TELEMETRY_DISABLED")!==!0&&g){const e=new Error(g);A&&(e.stack=A);try{oH.captureException(e)}catch{}}},[g,A]),gA.useEffect(()=>{if(jF("TSCIRCUIT_TELEMETRY_DISABLED")!==!0&&I&&I.length>0)for(const e of I){const t=new Error(e.message||"Circuit JSON Error");e.stack&&(t.stack=e.stack);try{oH.captureException(t,{error_type:e.type})}catch{}}},[I])},mGo=g=>{gA.useEffect(()=>{try{M$I(g)}catch{}},[g.source,g.component,g.isWebEmbedded,g.activeTab])},EJI="0.0.3071",pGo={version:EJI},PBg={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},KBg=new Map,GmA=g=>{const A=KBg.get(g);return A?Object.fromEntries(Object.entries(A.stores).map(([I,e])=>[I,e.getState()])):{}},kGo=(g,A,I)=>{if(g===void 0)return{type:"untracked",connection:A.connect(I)};const e=KBg.get(I.name);if(e)return{type:"tracked",store:g,...e};const t={connection:A.connect(I),stores:{}};return KBg.set(I.name,t),{type:"tracked",store:g,...t}},nJI=(g,A={})=>(I,e,t)=>{const{enabled:o,anonymousActionType:B,store:C,...Q}=A;let i;try{i=(o??(PBg?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!i)return(PBg?"production":void 0)!=="production"&&o&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),g(I,e,t);const{connection:E,...n}=kGo(C,i,Q);let s=!0;t.setState=(c,h,l)=>{const D=I(c,h);if(!s)return D;const d=l===void 0?{type:B||"anonymous"}:typeof l=="string"?{type:l}:l;return C===void 0?(E?.send(d,e()),D):(E?.send({...d,type:`${C}/${d.type}`},{...GmA(Q.name),[C]:t.getState()}),D)};const r=(...c)=>{const h=s;s=!1,I(...c),s=h},a=g(t.setState,e,t);if(n.type==="untracked"?E?.init(a):(n.stores[n.store]=t,E?.init(Object.fromEntries(Object.entries(n.stores).map(([c,h])=>[c,c===n.store?a:h.getState()])))),t.dispatchFromDevtools&&typeof t.dispatch=="function"){let c=!1;const h=t.dispatch;t.dispatch=(...l)=>{(PBg?"production":void 0)!=="production"&&l[0].type==="__setState"&&!c&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),c=!0),h(...l)}}return E.subscribe(c=>{var h;switch(c.type){case"ACTION":if(typeof c.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return LBg(c.payload,l=>{if(l.type==="__setState"){if(C===void 0){r(l.state);return}Object.keys(l.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" } } }