@tscircuit/runframe 0.0.2799 → 0.0.2800
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.
|
@@ -237,7 +237,7 @@ You might need to use a local HTTP server (instead of file://): https://react.de
|
|
|
237
237
|
|
|
238
238
|
let root = createRoot(domContainer);
|
|
239
239
|
root.render(<App />);`),v.unstable_strictMode===!0&&(L=!0),v.identifierPrefix!==void 0&&(W=v.identifierPrefix),v.onUncaughtError!==void 0&&(ae=v.onUncaughtError),v.onCaughtError!==void 0&&(fe=v.onCaughtError),v.onRecoverableError!==void 0&&(ze=v.onRecoverableError),v.unstable_transitionCallbacks!==void 0&&(at=v.unstable_transitionCallbacks)),v=Tt(S,1,!1,null,null,L,W,ae,fe,ze,at,null),S[J0]=v.current,HE(S),new Q1(v)},iK.hydrateRoot=function(S,v,L){if(!_(S))throw Error("Target container is not a DOM element.");sp(S),v===void 0&&console.error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var W=!1,ae="",fe=n4,ze=Y0,at=Cm,Mt=null,Vt=null;return L!=null&&(L.unstable_strictMode===!0&&(W=!0),L.identifierPrefix!==void 0&&(ae=L.identifierPrefix),L.onUncaughtError!==void 0&&(fe=L.onUncaughtError),L.onCaughtError!==void 0&&(ze=L.onCaughtError),L.onRecoverableError!==void 0&&(at=L.onRecoverableError),L.unstable_transitionCallbacks!==void 0&&(Mt=L.unstable_transitionCallbacks),L.formState!==void 0&&(Vt=L.formState)),v=Tt(S,1,!0,v,L??null,W,ae,fe,ze,at,Mt,Vt),v.context=ln(null),L=v.current,W=Ld(L),W=st(W),ae=qh(W),ae.callback=null,_0(L,ae,W),L=W,v.current.lanes=L,Le(v,L),_u(v),S[J0]=v.current,HE(S),new x_(v)},iK.version="19.1.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})(),iK}var Ytt;function A2n(){if(Ytt)return wee.exports;Ytt=1;var t={env:{}};function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(t.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}}return t.env.NODE_ENV==="production"?(e(),wee.exports=s2n()):wee.exports=a2n(),wee.exports}var c2n=A2n(),te=_3();const Ns=oy(te),e5=V2({__proto__:null,default:Ns},[te]);var l2n=Object.defineProperty,WT=(t,e)=>l2n(t,"name",{value:e,configurable:!0}),Utt=!!(typeof window<"u"&&window.document&&window.document.createElement);function pr(t,e,{checkForDefaultPrevented:n=!0}={}){return WT(function(i){if(t?.(i),n===!1||!i||!i.defaultPrevented)return e?.(i)},"handleEvent")}WT(pr,"composeEventHandlers");function g2n(t){if(!Utt)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}WT(g2n,"getOwnerWindow");function KIe(t){if(!Utt)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}WT(KIe,"getOwnerDocument");function Ktt(t,e=!1){const{activeElement:n}=KIe(t);if(!n?.nodeName)return null;if(Vtt(n)&&n.contentDocument)return Ktt(n.contentDocument.body,e);if(e){const o=n.getAttribute("aria-activedescendant");if(o){const i=KIe(n).getElementById(o);if(i)return i}}return n}WT(Ktt,"getActiveElement");function Vtt(t){return t.tagName==="IFRAME"}WT(Vtt,"isFrame");var u2n=Object.defineProperty,t5=(t,e)=>u2n(t,"name",{value:e,configurable:!0});function d2n(t,e){const n=te.createContext(e);n.displayName=t+"Context";const o=t5(r=>{const{children:s,...a}=r,A=te.useMemo(()=>a,Object.values(a));return z.jsx(n.Provider,{value:A,children:s})},"Provider");o.displayName=t+"Provider";function i(r,s={}){const{optional:a=!1}=s,A=te.useContext(n);if(A)return A;if(e!==void 0)return e;if(!a)throw new Error(`\`${r}\` must be used within \`${t}\``)}return t5(i,"useContext"),[o,i]}t5(d2n,"createContext");function f3(t,e=[]){let n=[];function o(r,s){const a=te.createContext(s);a.displayName=r+"Context";const A=n.length;n=[...n,s];const c=t5(g=>{const{scope:u,children:h,...d}=g,p=u?.[t]?.[A]||a,m=te.useMemo(()=>d,Object.values(d));return z.jsx(p.Provider,{value:m,children:h})},"Provider");c.displayName=r+"Provider";function l(g,u,h={}){const{optional:d=!1}=h,p=u?.[t]?.[A]||a,m=te.useContext(p);if(m)return m;if(s!==void 0)return s;if(!d)throw new Error(`\`${g}\` must be used within \`${r}\``)}return t5(l,"useContext"),[c,l]}t5(o,"createContext");const i=t5(()=>{const r=n.map(s=>te.createContext(s));return t5(function(a){const A=a?.[t]||r;return te.useMemo(()=>({[`__scope${t}`]:{...a,[t]:A}}),[a,A])},"useScope")},"createScope");return i.scopeName=t,[o,ztt(i,...e)]}t5(f3,"createContextScope");function ztt(...t){const e=t[0];if(t.length===1)return e;const n=t5(()=>{const o=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return t5(function(r){const s=o.reduce((a,{useScope:A,scopeName:c})=>{const g=A(r)[`__scope${c}`];return{...a,...g}},{});return te.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}t5(ztt,"composeContextScopes");var h2n=Object.defineProperty,VIe=(t,e)=>h2n(t,"name",{value:e,configurable:!0});function zIe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}VIe(zIe,"setRef");function Jtt(...t){return e=>{let n=!1;const o=t.map(i=>{const r=zIe(i,e);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let i=0;i<o.length;i++){const r=o[i];typeof r=="function"?r():zIe(t[i],null)}}}}VIe(Jtt,"composeRefs");function ac(...t){return te.useCallback(Jtt(...t),t)}VIe(ac,"useComposedRefs");var p2n=Object.defineProperty,m4=(t,e)=>p2n(t,"name",{value:e,configurable:!0});function n9(t){const e=te.forwardRef((n,o)=>{let{children:i,...r}=n,s=null,a=!1;const A=[];JIe(i)&&typeof Ree=="function"&&(i=Ree(i._payload)),te.Children.forEach(i,u=>{if($tt(u)){a=!0;const h=u;let d="child"in h.props?h.props.child:h.props.children;JIe(d)&&typeof Ree=="function"&&(d=Ree(d._payload)),s=_2n(h,d),A.push(s?.props?.children)}else A.push(u)}),s?s=te.cloneElement(s,void 0,A):!a&&te.Children.count(i)===1&&te.isValidElement(i)&&(s=i);const c=s?Xtt(s):void 0,l=ac(o,c);if(!s){if(i||i===0)throw new Error(a?C2n(t):I2n(t));return i}const g=qtt(r,s.props??{});return s.type!==te.Fragment&&(g.ref=o?l:c),te.cloneElement(s,g)});return e.displayName=`${t}.Slot`,e}m4(n9,"createSlot");var m2n=n9("Slot"),Wtt=Symbol.for("radix.slottable");function jtt(t){const e=m4(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=Wtt,e}m4(jtt,"createSlottable");var _2n=m4((t,e)=>{if("child"in t.props){const n=t.props.child;return te.isValidElement(n)?te.cloneElement(n,void 0,t.props.children(n.props.children)):null}return te.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function qtt(t,e){const n={...e};for(const o in e){const i=t[o],r=e[o];/^on[A-Z]/.test(o)?i&&r?n[o]=(...a)=>{const A=r(...a);return i(...a),A}:i&&(n[o]=i):o==="style"?n[o]={...i,...r}:o==="className"&&(n[o]=[i,r].filter(Boolean).join(" "))}return{...t,...n}}m4(qtt,"mergeProps");function Xtt(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}m4(Xtt,"getElementRef");function $tt(t){return te.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Wtt}m4($tt,"isSlottable");var f2n=Symbol.for("react.lazy");function JIe(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===f2n&&"_payload"in t&&Ztt(t._payload)}m4(JIe,"isLazyComponent");function Ztt(t){return typeof t=="object"&&t!==null&&"then"in t}m4(Ztt,"isPromiseLike");var I2n=m4(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),C2n=m4(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Ree=e5[" use ".trim().toString()],y2n=Object.defineProperty,Tf=(t,e)=>y2n(t,"name",{value:e,configurable:!0});function Tee(t){const e=t+"CollectionProvider",[n,o]=f3(e),[i,r]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=Tf(p=>{const{scope:m,children:_}=p,f=te.useRef(null),I=te.useRef(new Map).current;return z.jsx(i,{scope:m,itemMap:I,collectionRef:f,children:_})},"CollectionProvider");s.displayName=e;const a=t+"CollectionSlot",A=n9(a),c=te.forwardRef((p,m)=>{const{scope:_,children:f}=p,I=r(a,_),C=ac(m,I.collectionRef);return z.jsx(A,{ref:C,children:f})});c.displayName=a;const l=t+"CollectionItemSlot",g="data-radix-collection-item",u=n9(l),h=te.forwardRef((p,m)=>{const{scope:_,children:f,...I}=p,C=te.useRef(null),y=ac(m,C),x=r(l,_);return te.useEffect(()=>(x.itemMap.set(C,{ref:C,...I}),()=>{x.itemMap.delete(C)})),z.jsx(u,{[g]:"",ref:y,children:f})});h.displayName=l;function d(p){const m=r(t+"CollectionConsumer",p);return te.useCallback(()=>{const f=m.collectionRef.current;if(!f)return[];const I=Array.from(f.querySelectorAll(`[${g}]`));return Array.from(m.itemMap.values()).sort((x,E)=>I.indexOf(x.ref.current)-I.indexOf(E.ref.current))},[m.collectionRef,m.itemMap])}return Tf(d,"useCollection"),[{Provider:s,Slot:c,ItemSlot:h},d,o]}Tf(Tee,"createCollection");var ent=new WeakMap,WIe=(_E=class extends Map{constructor(n){super(n);Att(this,r_);dee(this,r_,[...super.keys()]),ent.set(this,!0)}set(n,o){return ent.get(this)&&(this.has(n)?S0(this,r_)[S0(this,r_).indexOf(n)]=n:S0(this,r_).push(n)),super.set(n,o),this}insert(n,o,i){const r=this.has(o),s=S0(this,r_).length,a=jIe(n);let A=a>=0?a:s+a;const c=A<0||A>=s?-1:A;if(c===this.size||r&&c===this.size-1||c===-1)return this.set(o,i),this;const l=this.size+(r?0:1);a<0&&A++;const g=[...S0(this,r_)];let u,h=!1;for(let d=A;d<l;d++)if(A===d){let p=g[d];g[d]===o&&(p=g[d+1]),r&&this.delete(o),u=this.get(p),this.set(o,i)}else{!h&&g[d-1]===o&&(h=!0);const p=g[h?d:d-1],m=u;u=this.get(p),this.delete(p),this.set(p,m)}return this}with(n,o,i){const r=new _E(this);return r.insert(n,o,i),r}before(n){const o=S0(this,r_).indexOf(n)-1;if(!(o<0))return this.entryAt(o)}setBefore(n,o,i){const r=S0(this,r_).indexOf(n);return r===-1?this:this.insert(r,o,i)}after(n){let o=S0(this,r_).indexOf(n);if(o=o===-1||o===this.size-1?-1:o+1,o!==-1)return this.entryAt(o)}setAfter(n,o,i){const r=S0(this,r_).indexOf(n);return r===-1?this:this.insert(r+1,o,i)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return dee(this,r_,[]),super.clear()}delete(n){const o=super.delete(n);return o&&S0(this,r_).splice(S0(this,r_).indexOf(n),1),o}deleteAt(n){const o=this.keyAt(n);return o!==void 0?this.delete(o):!1}at(n){const o=kee(S0(this,r_),n);if(o!==void 0)return this.get(o)}entryAt(n){const o=kee(S0(this,r_),n);if(o!==void 0)return[o,this.get(o)]}indexOf(n){return S0(this,r_).indexOf(n)}keyAt(n){return kee(S0(this,r_),n)}from(n,o){const i=this.indexOf(n);if(i===-1)return;let r=i+o;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(n,o){const i=this.indexOf(n);if(i===-1)return;let r=i+o;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(n,o){let i=0;for(const r of this){if(Reflect.apply(n,o,[r,i,this]))return r;i++}}findIndex(n,o){let i=0;for(const r of this){if(Reflect.apply(n,o,[r,i,this]))return i;i++}return-1}filter(n,o){const i=[];let r=0;for(const s of this)Reflect.apply(n,o,[s,r,this])&&i.push(s),r++;return new _E(i)}map(n,o){const i=[];let r=0;for(const s of this)i.push([s[0],Reflect.apply(n,o,[s,r,this])]),r++;return new _E(i)}reduce(...n){const[o,i]=n;let r=0,s=i??this.at(0);for(const a of this)r===0&&n.length===1?s=a:s=Reflect.apply(o,this,[s,a,r,this]),r++;return s}reduceRight(...n){const[o,i]=n;let r=i??this.at(-1);for(let s=this.size-1;s>=0;s--){const a=this.at(s);s===this.size-1&&n.length===1?r=a:r=Reflect.apply(o,this,[r,a,s,this])}return r}toSorted(n){const o=[...this.entries()].sort(n);return new _E(o)}toReversed(){const n=new _E;for(let o=this.size-1;o>=0;o--){const i=this.keyAt(o),r=this.get(i);n.set(i,r)}return n}toSpliced(...n){const o=[...this.entries()];return o.splice(...n),new _E(o)}slice(n,o){const i=new _E;let r=this.size-1;if(n===void 0)return i;n<0&&(n=n+this.size),o!==void 0&&o>0&&(r=o-1);for(let s=n;s<=r;s++){const a=this.keyAt(s),A=this.get(a);i.set(a,A)}return i}every(n,o){let i=0;for(const r of this){if(!Reflect.apply(n,o,[r,i,this]))return!1;i++}return!0}some(n,o){let i=0;for(const r of this){if(Reflect.apply(n,o,[r,i,this]))return!0;i++}return!1}},r_=new WeakMap,Tf(_E,"OrderedDict"),_E);function kee(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=tnt(t,e);return n===-1?void 0:t[n]}Tf(kee,"at");function tnt(t,e){const n=t.length,o=jIe(e),i=o>=0?o:n+o;return i<0||i>=n?-1:i}Tf(tnt,"toSafeIndex");function jIe(t){return t!==t||t===0?0:Math.trunc(t)}Tf(jIe,"toSafeInteger");function x2n(t){const e=t+"CollectionProvider",[n,o]=f3(e),[i,r]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new WIe,setItemMap:Tf(()=>{},"setItemMap")}),s=Tf(({state:I,...C})=>I?z.jsx(A,{...C,state:I}):z.jsx(a,{...C}),"CollectionProvider");s.displayName=e;const a=Tf(I=>{const C=m();return z.jsx(A,{...I,state:C})},"CollectionInit");a.displayName=e+"Init";const A=Tf(I=>{const{scope:C,children:y,state:x}=I,E=te.useRef(null),[B,b]=te.useState(null),Q=ac(E,b),[w,M]=x;return te.useEffect(()=>{if(!B)return;const k=int(()=>{});return k.observe(B,{childList:!0,subtree:!0}),()=>{k.disconnect()}},[B]),z.jsx(i,{scope:C,itemMap:w,setItemMap:M,collectionRef:Q,collectionRefObject:E,collectionElement:B,children:y})},"CollectionProviderImpl");A.displayName=e+"Impl";const c=t+"CollectionSlot",l=n9(c),g=te.forwardRef((I,C)=>{const{scope:y,children:x}=I,E=r(c,y),B=ac(C,E.collectionRef);return z.jsx(l,{ref:B,children:x})});g.displayName=c;const u=t+"CollectionItemSlot",h="data-radix-collection-item",d=n9(u),p=te.forwardRef((I,C)=>{const{scope:y,children:x,...E}=I,B=te.useRef(null),[b,Q]=te.useState(null),w=ac(C,B,Q),M=r(u,y),{setItemMap:k}=M,R=te.useRef(E);nnt(R.current,E)||(R.current=E);const F=R.current;return te.useEffect(()=>{const G=F;return k(U=>b?U.has(b)?U.set(b,{...G,element:b}).toSorted(qIe):(U.set(b,{...G,element:b}),U.toSorted(qIe)):U),()=>{k(U=>!b||!U.has(b)?U:(U.delete(b),new WIe(U)))}},[b,F,k]),z.jsx(d,{[h]:"",ref:w,children:x})});p.displayName=u;function m(){return te.useState(new WIe)}Tf(m,"useInitCollection");function _(I){const{itemMap:C}=r(t+"CollectionConsumer",I);return C}return Tf(_,"useCollection"),[{Provider:s,Slot:g,ItemSlot:p},{createCollectionScope:o,useCollection:_,useInitCollection:m}]}Tf(x2n,"createCollection");function nnt(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;const n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(e,i)||t[i]!==e[i])return!1;return!0}Tf(nnt,"shallowEqual");function ont(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}Tf(ont,"isElementPreceding");function qIe(t,e){return!t[1].element||!e[1].element?0:ont(t[1].element,e[1].element)?-1:1}Tf(qIe,"sortByDocumentPosition");function int(t){return new MutationObserver(n=>{for(const o of n)if(o.type==="childList"){t();return}})}Tf(int,"getChildListObserver");var up=globalThis?.document?te.useLayoutEffect:()=>{},E2n=Object.defineProperty,B2n=(t,e)=>E2n(t,"name",{value:e,configurable:!0}),S2n=e5[" useId ".trim().toString()]||(()=>{}),b2n=0;function I3(t){const[e,n]=te.useState(S2n());return up(()=>{t||n(o=>o??String(b2n++))},[t]),t||(e?`radix-${e}`:"")}B2n(I3,"useId");var o9=UIe();const rnt=oy(o9);var Q2n=Object.defineProperty,v2n=(t,e)=>Q2n(t,"name",{value:e,configurable:!0}),P2n=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ac=P2n.reduce((t,e)=>{const n=n9(`Primitive.${e}`),o=te.forwardRef((i,r)=>{const{asChild:s,...a}=i,A=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),z.jsx(A,{...a,ref:r})});return o.displayName=`Primitive.${e}`,{...t,[e]:o}},{});function XIe(t,e){t&&o9.flushSync(()=>t.dispatchEvent(e))}v2n(XIe,"dispatchDiscreteCustomEvent");var w2n=Object.defineProperty,M2n=(t,e)=>w2n(t,"name",{value:e,configurable:!0});function C3(t){const e=te.useRef(t);return te.useEffect(()=>{e.current=t}),te.useMemo(()=>((...n)=>e.current?.(...n)),[])}M2n(C3,"useCallbackRef");var D2n=Object.defineProperty,N2n=(t,e)=>D2n(t,"name",{value:e,configurable:!0}),snt=e5[" useEffectEvent ".trim().toString()],ant=e5[" useInsertionEffect ".trim().toString()];function Ant(t){if(typeof snt=="function")return snt(t);const e=te.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof ant=="function"?ant(()=>{e.current=t}):up(()=>{e.current=t}),te.useMemo(()=>((...n)=>e.current?.(...n)),[])}N2n(Ant,"useEffectEvent");var R2n=Object.defineProperty,rK=(t,e)=>R2n(t,"name",{value:e,configurable:!0}),T2n=e5[" useInsertionEffect ".trim().toString()]||up;function i9({prop:t,defaultProp:e,onChange:n=rK(()=>{},"onChange"),caller:o}){const[i,r,s]=cnt({defaultProp:e,onChange:n}),a=t!==void 0,A=a?t:i,c=te.useCallback(l=>{if(a){const g=lnt(l)?l(t):l;g!==t&&s.current?.(g)}else r(l)},[a,t,r,s]);return[A,c]}rK(i9,"useControllableState");function cnt({defaultProp:t,onChange:e}){const[n,o]=te.useState(t),i=te.useRef(n),r=te.useRef(e);return T2n(()=>{r.current=e},[e]),te.useEffect(()=>{i.current!==n&&(r.current?.(n),i.current=n)},[n,i]),[n,o,r]}rK(cnt,"useUncontrolledState");function lnt(t){return typeof t=="function"}rK(lnt,"isFunction");var gnt=Symbol("RADIX:SYNC_STATE");function k2n(t,e,n,o){const{prop:i,defaultProp:r,onChange:s,caller:a}=e,A=i!==void 0,c=Ant(s),l=[{...n,state:r}];o&&l.push(o);const[g,u]=te.useReducer((m,_)=>{if(_.type===gnt)return{...m,state:_.state};const f=t(m,_);return A&&!Object.is(f.state,m.state)&&c(f.state),f},...l),h=g.state,d=te.useRef(h);te.useEffect(()=>{d.current!==h&&(d.current=h,A||c(h))},[h,d,A]);const p=te.useMemo(()=>i!==void 0?{...g,state:i}:g,[g,i]);return te.useEffect(()=>{A&&!Object.is(i,g.state)&&u({type:gnt,state:i})},[i,g.state,A]),[p,u]}rK(k2n,"useControllableStateReducer");var F2n=Object.defineProperty,L2n=(t,e)=>F2n(t,"name",{value:e,configurable:!0}),H2n=te.createContext(void 0);function sK(t){const e=te.useContext(H2n);return t||e||"ltr"}L2n(sK,"useDirection");var O2n=Object.defineProperty,$Ie=(t,e)=>O2n(t,"name",{value:e,configurable:!0}),ZIe=!1;function unt(){const[t,e]=te.useState(ZIe);return te.useEffect(()=>{ZIe||(ZIe=!0,e(!0))},[]),t}$Ie(unt,"useIsHydrated");var dnt=e5[" useSyncExternalStore ".trim().toString()];function hnt(){return()=>{}}$Ie(hnt,"subscribe");function pnt(){return dnt(hnt,()=>!0,()=>!1)}$Ie(pnt,"useIsHydratedModern");var G2n=typeof dnt=="function"?pnt:unt,Y2n=Object.defineProperty,cM=(t,e)=>Y2n(t,"name",{value:e,configurable:!0}),eCe="rovingFocusGroup.onEntryFocus",U2n={bubbles:!1,cancelable:!0},Fee="RovingFocusGroup",[tCe,mnt,K2n]=Tee(Fee),[V2n,Lee]=f3(Fee,[K2n]),[z2n,J2n]=V2n(Fee),W2n=te.forwardRef(cM(function(e,n){return z.jsx(tCe.Provider,{scope:e.__scopeRovingFocusGroup,children:z.jsx(tCe.Slot,{scope:e.__scopeRovingFocusGroup,children:z.jsx(j2n,{...e,ref:n})})})},"RovingFocusGroup")),j2n=te.forwardRef(cM(function(e,n){const{__scopeRovingFocusGroup:o,orientation:i,loop:r=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:A,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:g=!1,...u}=e,h=te.useRef(null),d=ac(n,h),p=sK(s),[m,_]=i9({prop:a,defaultProp:A??null,onChange:c,caller:Fee}),[f,I]=te.useState(!1),C=C3(l),y=mnt(o),x=te.useRef(!1),[E,B]=te.useState(0);return te.useEffect(()=>{const b=h.current;if(b)return b.addEventListener(eCe,C),()=>b.removeEventListener(eCe,C)},[C]),z.jsx(z2n,{scope:o,orientation:i,dir:p,loop:r,currentTabStopId:m,onItemFocus:te.useCallback(b=>_(b),[_]),onItemShiftTab:te.useCallback(()=>I(!0),[]),onFocusableItemAdd:te.useCallback(()=>B(b=>b+1),[]),onFocusableItemRemove:te.useCallback(()=>B(b=>b-1),[]),children:z.jsx(Ac.div,{tabIndex:f||E===0?-1:0,"data-orientation":i,...u,ref:d,style:{outline:"none",...e.style},onMouseDown:pr(e.onMouseDown,()=>{x.current=!0}),onFocus:pr(e.onFocus,b=>{const Q=!x.current;if(b.target===b.currentTarget&&Q&&!f){const w=new CustomEvent(eCe,U2n);if(b.currentTarget.dispatchEvent(w),!w.defaultPrevented){const M=y().filter(U=>U.focusable),k=M.find(U=>U.active),R=M.find(U=>U.id===m),G=[k,R,...M].filter(Boolean).map(U=>U.ref.current);nCe(G,g)}}x.current=!1}),onBlur:pr(e.onBlur,()=>I(!1))})})},"RovingFocusGroupImpl")),q2n="RovingFocusGroupItem",X2n=te.forwardRef(cM(function(e,n){const{__scopeRovingFocusGroup:o,focusable:i=!0,active:r=!1,tabStopId:s,children:a,...A}=e,c=I3(),l=s||c,g=J2n(q2n,o),u=g.currentTabStopId===l,h=mnt(o),{onFocusableItemAdd:d,onFocusableItemRemove:p,currentTabStopId:m}=g,_=G2n();return up(()=>{if(!(!_||!i))return d(),()=>p()},[_,i,d,p]),te.useEffect(()=>{if(!(_||!i))return d(),()=>p()},[_,i,d,p]),z.jsx(tCe.ItemSlot,{scope:o,id:l,focusable:i,active:r,children:z.jsx(Ac.span,{tabIndex:u?0:-1,"data-orientation":g.orientation,...A,ref:n,onMouseDown:pr(e.onMouseDown,f=>{i?g.onItemFocus(l):f.preventDefault()}),onFocus:pr(e.onFocus,()=>g.onItemFocus(l)),onKeyDown:pr(e.onKeyDown,f=>{if(f.key==="Tab"&&f.shiftKey){g.onItemShiftTab();return}if(f.target!==f.currentTarget)return;const I=fnt(f,g.orientation,g.dir);if(I!==void 0){if(f.metaKey||f.ctrlKey||f.altKey||f.shiftKey)return;f.preventDefault();let y=h().filter(x=>x.focusable).map(x=>x.ref.current);if(I==="last")y.reverse();else if(I==="prev"||I==="next"){I==="prev"&&y.reverse();const x=y.indexOf(f.currentTarget);y=g.loop?Int(y,x+1):y.slice(x+1)}setTimeout(()=>nCe(y))}}),children:typeof a=="function"?a({isCurrentTabStop:u,hasTabStop:m!=null}):a})})},"RovingFocusGroupItem")),$2n={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function _nt(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}cM(_nt,"getDirectionAwareKey");function fnt(t,e,n){const o=_nt(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return $2n[o]}cM(fnt,"getFocusIntent");function nCe(t,e=!1){const n=document.activeElement;for(const o of t)if(o===n||(o.focus({preventScroll:e}),document.activeElement!==n))return}cM(nCe,"focusFirst");function Int(t,e){return t.map((n,o)=>t[(e+o)%t.length])}cM(Int,"wrapArray");var Cnt=W2n,ynt=X2n,Z2n=Object.defineProperty,$6=(t,e)=>Z2n(t,"name",{value:e,configurable:!0});function xnt(t,e){return te.useReducer((n,o)=>e[n][o]??n,t)}$6(xnt,"useStateMachine");var _4=$6(t=>{const{present:e,children:n}=t,o=Ent(e),i=typeof n=="function"?n({present:o.isPresent}):te.Children.only(n),r=Bnt(o.ref,Snt(i));return typeof n=="function"||o.isPresent?te.cloneElement(i,{ref:r}):null},"Presence");function Ent(t){const[e,n]=te.useState(),o=te.useRef(null),i=te.useRef(t),r=te.useRef("none"),s=te.useRef(void 0),a=t?"mounted":"unmounted",[A,c]=xnt(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return te.useEffect(()=>{A==="mounted"?(r.current=s.current??jT(o.current),s.current=void 0):r.current="none"},[A]),up(()=>{const l=o.current,g=i.current;if(g!==t){const h=r.current,d=jT(l);t?(s.current=d,c("MOUNT")):d==="none"||l?.display==="none"?c("UNMOUNT"):c(g&&h!==d?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,c]),up(()=>{if(e){let l;const g=e.ownerDocument.defaultView??window,u=$6(d=>{const m=jT(o.current).includes(CSS.escape(d.animationName));if(d.target===e&&m&&(c("ANIMATION_END"),!i.current)){const _=e.style.animationFillMode;e.style.animationFillMode="forwards",l=g.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=_)})}},"handleAnimationEnd"),h=$6(d=>{d.target===e&&(r.current=jT(o.current))},"handleAnimationStart");return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",u),e.addEventListener("animationend",u),()=>{g.clearTimeout(l),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",u),e.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(A),ref:te.useCallback(l=>{if(l){const g=getComputedStyle(l);o.current=g,s.current=jT(g)}else o.current=null;n(l)},[])}}$6(Ent,"usePresence");function oCe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}$6(oCe,"setRef");function Bnt(...t){const e=te.useRef(t);return e.current=t,te.useCallback(n=>{const o=e.current;let i=!1;const r=o.map(s=>{const a=oCe(s,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let s=0;s<r.length;s++){const a=r[s];typeof a=="function"?a():oCe(o[s],null)}}},[])}$6(Bnt,"useStableComposedRefs");function jT(t){return t?.animationName||"none"}$6(jT,"getAnimationName");function Snt(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}$6(Snt,"getElementRef");var exn=Object.defineProperty,qT=(t,e)=>exn(t,"name",{value:e,configurable:!0}),iCe="Tabs",[txn,tor]=f3(iCe,[Lee]),bnt=Lee(),[nxn,rCe]=txn(iCe),oxn=te.forwardRef(qT(function(e,n){const{__scopeTabs:o,value:i,onValueChange:r,defaultValue:s,orientation:a="horizontal",dir:A,activationMode:c="automatic",...l}=e,g=sK(A),[u,h]=i9({prop:i,onChange:r,defaultProp:s??"",caller:iCe});return z.jsx(nxn,{scope:o,baseId:I3(),value:u,onValueChange:h,orientation:a,dir:g,activationMode:c,children:z.jsx(Ac.div,{dir:g,"data-orientation":a,...l,ref:n})})},"Tabs")),ixn="TabsList",rxn=te.forwardRef(qT(function(e,n){const{__scopeTabs:o,loop:i=!0,...r}=e,s=rCe(ixn,o),a=bnt(o);return z.jsx(Cnt,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:i,children:z.jsx(Ac.div,{role:"tablist","aria-orientation":s.orientation,...r,ref:n})})},"TabsList")),sxn="TabsTrigger",axn=te.forwardRef(qT(function(e,n){const{__scopeTabs:o,value:i,disabled:r=!1,...s}=e,a=rCe(sxn,o),A=bnt(o),c=sCe(a.baseId,i),l=aCe(a.baseId,i),g=i===a.value;return z.jsx(ynt,{asChild:!0,...A,focusable:!r,active:g,children:z.jsx(Ac.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":l,"data-state":g?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:c,...s,ref:n,onMouseDown:pr(e.onMouseDown,u=>{!r&&u.button===0&&u.ctrlKey===!1?a.onValueChange(i):u.preventDefault()}),onKeyDown:pr(e.onKeyDown,u=>{r||u.target!==u.currentTarget||[" ","Enter"].includes(u.key)&&a.onValueChange(i)}),onFocus:pr(e.onFocus,()=>{const u=a.activationMode!=="manual";!g&&!r&&u&&a.onValueChange(i)})})})},"TabsTrigger")),Axn="TabsContent",cxn=te.forwardRef(qT(function(e,n){const{__scopeTabs:o,value:i,forceMount:r,children:s,...a}=e,A=rCe(Axn,o),c=sCe(A.baseId,i),l=aCe(A.baseId,i),g=i===A.value,u=te.useRef(g);return te.useEffect(()=>{const h=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(h)},[]),z.jsx(_4,{present:r||g,children:({present:h})=>z.jsx(Ac.div,{"data-state":g?"active":"inactive","data-orientation":A.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:l,tabIndex:0,...a,ref:n,style:{...e.style,animationDuration:u.current?"0s":void 0},children:h&&s})})},"TabsContent"));function sCe(t,e){return`${t}-trigger-${e}`}qT(sCe,"makeTriggerId");function aCe(t,e){return`${t}-content-${e}`}qT(aCe,"makeContentId");var lxn=oxn,Qnt=rxn,vnt=axn,Pnt=cxn;function wnt(t){var e,n,o="";if(typeof t=="string"||typeof t=="number")o+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=wnt(t[e]))&&(o&&(o+=" "),o+=n)}else for(n in t)t[n]&&(o&&(o+=" "),o+=n);return o}function f4(){for(var t,e,n=0,o="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=wnt(t))&&(o&&(o+=" "),o+=e);return o}const ACe="-",gxn=t=>{const e=dxn(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=t;return{getClassGroupId:s=>{const a=s.split(ACe);return a[0]===""&&a.length!==1&&a.shift(),Mnt(a,e)||uxn(s)},getConflictingClassGroupIds:(s,a)=>{const A=n[s]||[];return a&&o[s]?[...A,...o[s]]:A}}},Mnt=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],o=e.nextPart.get(n),i=o?Mnt(t.slice(1),o):void 0;if(i)return i;if(e.validators.length===0)return;const r=t.join(ACe);return e.validators.find(({validator:s})=>s(r))?.classGroupId},Dnt=/^\[(.+)\]$/,uxn=t=>{if(Dnt.test(t)){const e=Dnt.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},dxn=t=>{const{theme:e,prefix:n}=t,o={nextPart:new Map,validators:[]};return pxn(Object.entries(t.classGroups),n).forEach(([r,s])=>{cCe(s,o,r,e)}),o},cCe=(t,e,n,o)=>{t.forEach(i=>{if(typeof i=="string"){const r=i===""?e:Nnt(e,i);r.classGroupId=n;return}if(typeof i=="function"){if(hxn(i)){cCe(i(o),e,n,o);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([r,s])=>{cCe(s,Nnt(e,r),n,o)})})},Nnt=(t,e)=>{let n=t;return e.split(ACe).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},hxn=t=>t.isThemeGetter,pxn=(t,e)=>e?t.map(([n,o])=>{const i=o.map(r=>typeof r=="string"?e+r:typeof r=="object"?Object.fromEntries(Object.entries(r).map(([s,a])=>[e+s,a])):r);return[n,i]}):t,mxn=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,o=new Map;const i=(r,s)=>{n.set(r,s),e++,e>t&&(e=0,o=n,n=new Map)};return{get(r){let s=n.get(r);if(s!==void 0)return s;if((s=o.get(r))!==void 0)return i(r,s),s},set(r,s){n.has(r)?n.set(r,s):i(r,s)}}},Rnt="!",_xn=t=>{const{separator:e,experimentalParseClassName:n}=t,o=e.length===1,i=e[0],r=e.length,s=a=>{const A=[];let c=0,l=0,g;for(let m=0;m<a.length;m++){let _=a[m];if(c===0){if(_===i&&(o||a.slice(m,m+r)===e)){A.push(a.slice(l,m)),l=m+r;continue}if(_==="/"){g=m;continue}}_==="["?c++:_==="]"&&c--}const u=A.length===0?a:a.substring(l),h=u.startsWith(Rnt),d=h?u.substring(1):u,p=g&&g>l?g-l:void 0;return{modifiers:A,hasImportantModifier:h,baseClassName:d,maybePostfixModifierPosition:p}};return n?a=>n({className:a,parseClassName:s}):s},fxn=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(o=>{o[0]==="["?(e.push(...n.sort(),o),n=[]):n.push(o)}),e.push(...n.sort()),e},Ixn=t=>({cache:mxn(t.cacheSize),parseClassName:_xn(t),...gxn(t)}),Cxn=/\s+/,yxn=(t,e)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:i}=e,r=[],s=t.trim().split(Cxn);let a="";for(let A=s.length-1;A>=0;A-=1){const c=s[A],{modifiers:l,hasImportantModifier:g,baseClassName:u,maybePostfixModifierPosition:h}=n(c);let d=!!h,p=o(d?u.substring(0,h):u);if(!p){if(!d){a=c+(a.length>0?" "+a:a);continue}if(p=o(u),!p){a=c+(a.length>0?" "+a:a);continue}d=!1}const m=fxn(l).join(":"),_=g?m+Rnt:m,f=_+p;if(r.includes(f))continue;r.push(f);const I=i(p,d);for(let C=0;C<I.length;++C){const y=I[C];r.push(_+y)}a=c+(a.length>0?" "+a:a)}return a};function xxn(){let t=0,e,n,o="";for(;t<arguments.length;)(e=arguments[t++])&&(n=Tnt(e))&&(o&&(o+=" "),o+=n);return o}const Tnt=t=>{if(typeof t=="string")return t;let e,n="";for(let o=0;o<t.length;o++)t[o]&&(e=Tnt(t[o]))&&(n&&(n+=" "),n+=e);return n};function Exn(t,...e){let n,o,i,r=s;function s(A){const c=e.reduce((l,g)=>g(l),t());return n=Ixn(c),o=n.cache.get,i=n.cache.set,r=a,a(A)}function a(A){const c=o(A);if(c)return c;const l=yxn(A,n);return i(A,l),l}return function(){return r(xxn.apply(null,arguments))}}const td=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},knt=/^\[(?:([a-z-]+):)?(.+)\]$/i,Bxn=/^\d+\/\d+$/,Sxn=new Set(["px","full","screen"]),bxn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Qxn=/\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$/,vxn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Pxn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,wxn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Z6=t=>XT(t)||Sxn.has(t)||Bxn.test(t),Ob=t=>$T(t,"length",Lxn),XT=t=>!!t&&!Number.isNaN(Number(t)),lCe=t=>$T(t,"number",XT),aK=t=>!!t&&Number.isInteger(Number(t)),Mxn=t=>t.endsWith("%")&&XT(t.slice(0,-1)),DA=t=>knt.test(t),Gb=t=>bxn.test(t),Dxn=new Set(["length","size","percentage"]),Nxn=t=>$T(t,Dxn,Fnt),Rxn=t=>$T(t,"position",Fnt),Txn=new Set(["image","url"]),kxn=t=>$T(t,Txn,Oxn),Fxn=t=>$T(t,"",Hxn),AK=()=>!0,$T=(t,e,n)=>{const o=knt.exec(t);return o?o[1]?typeof e=="string"?o[1]===e:e.has(o[1]):n(o[2]):!1},Lxn=t=>Qxn.test(t)&&!vxn.test(t),Fnt=()=>!1,Hxn=t=>Pxn.test(t),Oxn=t=>wxn.test(t),Gxn=Exn(()=>{const t=td("colors"),e=td("spacing"),n=td("blur"),o=td("brightness"),i=td("borderColor"),r=td("borderRadius"),s=td("borderSpacing"),a=td("borderWidth"),A=td("contrast"),c=td("grayscale"),l=td("hueRotate"),g=td("invert"),u=td("gap"),h=td("gradientColorStops"),d=td("gradientColorStopPositions"),p=td("inset"),m=td("margin"),_=td("opacity"),f=td("padding"),I=td("saturate"),C=td("scale"),y=td("sepia"),x=td("skew"),E=td("space"),B=td("translate"),b=()=>["auto","contain","none"],Q=()=>["auto","hidden","clip","visible","scroll"],w=()=>["auto",DA,e],M=()=>[DA,e],k=()=>["",Z6,Ob],R=()=>["auto",XT,DA],F=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],G=()=>["solid","dashed","dotted","double","none"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>["start","end","center","between","around","evenly","stretch"],J=()=>["","0",DA],ee=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>[XT,DA];return{cacheSize:500,separator:":",theme:{colors:[AK],spacing:[Z6,Ob],blur:["none","",Gb,DA],brightness:j(),borderColor:[t],borderRadius:["none","","full",Gb,DA],borderSpacing:M(),borderWidth:k(),contrast:j(),grayscale:J(),hueRotate:j(),invert:J(),gap:M(),gradientColorStops:[t],gradientColorStopPositions:[Mxn,Ob],inset:w(),margin:w(),opacity:j(),padding:M(),saturate:j(),scale:j(),sepia:J(),skew:j(),space:M(),translate:M()},classGroups:{aspect:[{aspect:["auto","square","video",DA]}],container:["container"],columns:[{columns:[Gb]}],"break-after":[{"break-after":ee()}],"break-before":[{"break-before":ee()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...F(),DA]}],overflow:[{overflow:Q()}],"overflow-x":[{"overflow-x":Q()}],"overflow-y":[{"overflow-y":Q()}],overscroll:[{overscroll:b()}],"overscroll-x":[{"overscroll-x":b()}],"overscroll-y":[{"overscroll-y":b()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[p]}],"inset-x":[{"inset-x":[p]}],"inset-y":[{"inset-y":[p]}],start:[{start:[p]}],end:[{end:[p]}],top:[{top:[p]}],right:[{right:[p]}],bottom:[{bottom:[p]}],left:[{left:[p]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",aK,DA]}],basis:[{basis:w()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",DA]}],grow:[{grow:J()}],shrink:[{shrink:J()}],order:[{order:["first","last","none",aK,DA]}],"grid-cols":[{"grid-cols":[AK]}],"col-start-end":[{col:["auto",{span:["full",aK,DA]},DA]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[AK]}],"row-start-end":[{row:["auto",{span:[aK,DA]},DA]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",DA]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",DA]}],gap:[{gap:[u]}],"gap-x":[{"gap-x":[u]}],"gap-y":[{"gap-y":[u]}],"justify-content":[{justify:["normal",...Y()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Y(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Y(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[f]}],px:[{px:[f]}],py:[{py:[f]}],ps:[{ps:[f]}],pe:[{pe:[f]}],pt:[{pt:[f]}],pr:[{pr:[f]}],pb:[{pb:[f]}],pl:[{pl:[f]}],m:[{m:[m]}],mx:[{mx:[m]}],my:[{my:[m]}],ms:[{ms:[m]}],me:[{me:[m]}],mt:[{mt:[m]}],mr:[{mr:[m]}],mb:[{mb:[m]}],ml:[{ml:[m]}],"space-x":[{"space-x":[E]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[E]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",DA,e]}],"min-w":[{"min-w":[DA,e,"min","max","fit"]}],"max-w":[{"max-w":[DA,e,"none","full","min","max","fit","prose",{screen:[Gb]},Gb]}],h:[{h:[DA,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[DA,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[DA,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[DA,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Gb,Ob]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",lCe]}],"font-family":[{font:[AK]}],"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",DA]}],"line-clamp":[{"line-clamp":["none",XT,lCe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Z6,DA]}],"list-image":[{"list-image":["none",DA]}],"list-style-type":[{list:["none","disc","decimal",DA]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Z6,Ob]}],"underline-offset":[{"underline-offset":["auto",Z6,DA]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",DA]}],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",DA]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...F(),Rxn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Nxn]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},kxn]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[d]}],"gradient-via-pos":[{via:[d]}],"gradient-to-pos":[{to:[d]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[r]}],"rounded-s":[{"rounded-s":[r]}],"rounded-e":[{"rounded-e":[r]}],"rounded-t":[{"rounded-t":[r]}],"rounded-r":[{"rounded-r":[r]}],"rounded-b":[{"rounded-b":[r]}],"rounded-l":[{"rounded-l":[r]}],"rounded-ss":[{"rounded-ss":[r]}],"rounded-se":[{"rounded-se":[r]}],"rounded-ee":[{"rounded-ee":[r]}],"rounded-es":[{"rounded-es":[r]}],"rounded-tl":[{"rounded-tl":[r]}],"rounded-tr":[{"rounded-tr":[r]}],"rounded-br":[{"rounded-br":[r]}],"rounded-bl":[{"rounded-bl":[r]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...G(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:G()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...G()]}],"outline-offset":[{"outline-offset":[Z6,DA]}],"outline-w":[{outline:[Z6,Ob]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:k()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Z6,Ob]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Gb,Fxn]}],"shadow-color":[{shadow:[AK]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...U(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":U()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[o]}],contrast:[{contrast:[A]}],"drop-shadow":[{"drop-shadow":["","none",Gb,DA]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[l]}],invert:[{invert:[g]}],saturate:[{saturate:[I]}],sepia:[{sepia:[y]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[A]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[l]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[I]}],"backdrop-sepia":[{"backdrop-sepia":[y]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",DA]}],duration:[{duration:j()}],ease:[{ease:["linear","in","out","in-out",DA]}],delay:[{delay:j()}],animate:[{animate:["none","spin","ping","pulse","bounce",DA]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[aK,DA]}],"translate-x":[{"translate-x":[B]}],"translate-y":[{"translate-y":[B]}],"skew-x":[{"skew-x":[x]}],"skew-y":[{"skew-y":[x]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",DA]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",DA]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",DA]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Z6,Ob,lCe]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}),Un="u">typeof window?window:void 0,nC="u">typeof globalThis?globalThis:Un,w_=nC?.navigator,No=nC?.document,nd=nC?.location,cK=nC?.fetch,gCe=nC?.XMLHttpRequest&&"withCredentials"in new nC.XMLHttpRequest?nC.XMLHttpRequest:void 0,Lnt=nC?.AbortController,Yxn=nC?.CompressionStream,iy=w_?.userAgent;function Hnt(){return!(!Un||Un.navigator.onLine===!1)}const lK=typeof globalThis<"u"?globalThis:Un;lK&&typeof self>"u"&&(lK.self=lK),lK&&typeof File>"u"&&(lK.File=function(){});const Gr=Un??{},Uxn="0.9.0",e8={DEBUG:!1,LIB_VERSION:Uxn,LIB_NAME:"browser-common"};var r9=(function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t})({}),uCe=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({});const Kxn=["$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"],Vxn=["token"];function ms(t,e){return t.indexOf(e)!==-1}const Hee=function(t){return t.trim()},dCe=function(t){return t.replace(/^\$/,"")};function Ont(t){var e;const n=[];return(e=JSON.stringify(t,function(o,i){if(typeof i=="bigint")return i.toString();if(typeof i!="function"&&typeof i!="symbol"){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&typeof i=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(i))return"[Circular]";n.push(i)}return i}}))!==null&&e!==void 0?e:"null"}const Gnt=Object.prototype,hCe=Gnt.hasOwnProperty,Oee=Gnt.toString,rs=Array.isArray||function(t){return Oee.call(t)==="[object Array]"},M_=t=>typeof t=="function",CA=t=>t===Object(t)&&!rs(t),z2=t=>{if(CA(t)){for(const e in t)if(hCe.call(t,e))return!1;return!0}return!1},Bo=t=>t===void 0,eA=t=>Oee.call(t)=="[object String]",gK=t=>eA(t)&&t.trim().length===0,od=t=>t===null,zs=t=>Bo(t)||od(t),zd=t=>Oee.call(t)=="[object Number]"&&t==t,t8=t=>zd(t)&&t>0,ry=t=>Oee.call(t)==="[object Boolean]",zxn=t=>ms(Kxn,t),Jxn=t=>ms(Vxn,t);function Ynt(t){return t===null||typeof t!="object"}function Gee(t,e){return{}.toString.call(t)===`[object ${e}]`}function ZT(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Unt(t,Error)}}function pCe(t){return"u">typeof Event&&Unt(t,Event)}function Unt(t,e){try{return t instanceof e}catch{return!1}}const Wxn=[!0,"true",1,"1","yes"],mCe=t=>ms(Wxn,t),jxn=[!1,"false",0,"0","no"];function Knt(t,e,n,o,i,r,s){try{var a=t[r](s),A=a.value}catch(c){return void n(c)}a.done?e(A):Promise.resolve(A).then(o,i)}function Vg(t){return function(){var e=this,n=arguments;return new Promise(function(o,i){var r=t.apply(e,n);function s(A){Knt(r,o,i,s,a,"next",A)}function a(A){Knt(r,o,i,s,a,"throw",A)}s(void 0)})}}const qxn=["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"],Vnt=function(t,e=[]){if(!t)return!1;const n=t.toLowerCase();return qxn.concat(e).some(o=>{const i=o.toLowerCase();return n.indexOf(i)!==-1})};function s9(t,e,n,o,i){return e>n&&(o.warn("min cannot be greater than max."),e=n),zd(t)?t>n?(o.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(o.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(o.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),s9(i??n,e,n,o))}var Xxn=class{constructor(e){this.C={},this.I=e.I,this.R=s9(e.bucketSize,0,100,e.$),this.A=s9(e.refillRate,0,this.R,e.$),this.O=s9(e.refillInterval,0,864e5,e.$)}F(e,n){const o=Math.floor((n-e.lastAccess)/this.O);o>0&&(e.tokens=Math.min(e.tokens+o*this.A,this.R),e.lastAccess=e.lastAccess+o*this.O)}consumeRateLimit(e){var n;const o=Date.now(),i=String(e);let r=this.C[i];return r?this.F(r,o):(r={tokens:this.R,lastAccess:o},this.C[i]=r),r.tokens===0||(r.tokens--,r.tokens===0&&((n=this.I)===null||n===void 0||n.call(this,e)),r.tokens===0)}stop(){this.C={}}};const ek="Mobile",uK="Android",Yee="Tablet",znt="Android Tablet",Jnt="iPad",Wnt="Apple Watch",Uee="Safari",Kee="BlackBerry",jnt="Samsung Internet",Vee="Chrome",qnt="Chrome iOS",Xnt="Internet Explorer",$nt="Internet Explorer Mobile",Znt="Opera",eot="Microsoft Edge",zee="Firefox",tot="Firefox iOS",Jee="Nintendo",Wee="PlayStation",jee="Xbox",not="Android Mobile",oot="Mobile Safari",_Ce="Windows",iot="Windows Phone",rot="Nokia",fCe="Ouya",$xn="Generic "+ek.toLowerCase(),sot="Generic "+Yee.toLowerCase(),ICe="Konqueror",aot="Oculus Browser",Aot="Vivaldi",cot="Yandex",lot="Whale",got="DuckDuckGo",uot="Pale Moon",dot="Waterfox",CCe="Brave",hot="Claude",pot="Codex",mot="ChatGPT",_ot="Google Search App",yCe=new RegExp("Version/(\\d+(\\.\\d+)?)"),xCe=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Zxn=new RegExp(jee,"i"),e3n=new RegExp("PlayStation \\w+","i"),t3n=new RegExp("Nintendo \\w+","i"),ECe=new RegExp("BlackBerry|PlayBook|BB10","i"),n3n={"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"},fot=function(t,e,n,o){return e=e||"",(function(r){return r?.brave?CCe:null})(n)||(o?.detectGoogleSearchApp&&ms(t,"GSA/")?_ot:ms(t," OPR/")&&ms(t,"Mini")?"Opera Mini":ms(t," OPR/")?Znt:ECe.test(t)?Kee:ms(t,"IEMobile")||ms(t,"WPDesktop")?$nt:ms(t,"OculusBrowser")?aot:ms(t,"SamsungBrowser")?jnt:ms(t,"Edge")||ms(t,"Edg/")?eot:ms(t,"Vivaldi/")?Aot:ms(t,"YaBrowser/")?cot:ms(t,"Whale/")?lot:ms(t,"DuckDuckGo/")||ms(t,"Ddg/")?got:ms(t,"Claude/")?hot:ms(t,"Codex/")?pot:ms(t,"ChatGPT/")?mot:ms(t,"FBIOS")?"Facebook Mobile":ms(t,"UCWEB")||ms(t,"UCBrowser")?"UC Browser":ms(t,"CriOS")?qnt:ms(t,"CrMo")||ms(t,Vee)?Vee:ms(t,uK)&&ms(t,Uee)?not:ms(t,"FxiOS")?tot:ms(t.toLowerCase(),ICe.toLowerCase())?ICe:ms(t,"Brave/")?CCe:((r,s)=>s&&ms(s,"Apple")||(function(a){return ms(a,Uee)&&!ms(a,Vee)&&!ms(a,uK)})(r))(t,e)?ms(t,ek)?oot:Uee:ms(t,"PaleMoon/")?uot:ms(t,"Waterfox/")?dot:ms(t,zee)?zee:ms(t,"MSIE")||ms(t,"Trident/")?Xnt:ms(t,"Gecko")?zee:"")},o3n={[$nt]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[eot]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Vee]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[qnt]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Uee]:[yCe],[oot]:[yCe],[Znt]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[zee]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[tot]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[ICe]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Kee]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),yCe],[not]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[jnt]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[aot]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Aot]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[cot]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[lot]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[CCe]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[hot]:[xCe],[pot]:[xCe],[mot]:[xCe],[got]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[uot]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[dot]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[_ot]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Xnt]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},i3n=function(t,e,n,o){const i=fot(t,e,n,o),r=o3n[i];if(Bo(r))return null;for(let s=0;r.length>s;s++){const a=t.match(r[s]);if(a)return parseFloat(a[a.length-2])}return null},Iot=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[jee,t&&t[1]||""]],[new RegExp(Jee,"i"),[Jee,""]],[new RegExp(Wee,"i"),[Wee,""]],[ECe,[Kee,""]],[new RegExp(_Ce,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[iot,""];if(new RegExp(ek).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){let o=n3n[n[1]]||"";return/arm/i.test(e)&&(o="RT"),[_Ce,o]}return[_Ce,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let e="";return t&&t.length>=3&&(e=Bo(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[uK,[t[2],t[3],t[4]||"0"].join(".")]:[uK,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Cot=function(t){for(let e=0;Iot.length>e;e++){const[n,o]=Iot[e],i=n.exec(t),r=i&&(M_(o)?o(i,t):o);if(r)return r}return["",""]},yot=function(t){return t3n.test(t)?Jee:e3n.test(t)?Wee:Zxn.test(t)?jee:new RegExp(fCe,"i").test(t)?fCe:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?iot:/iPad/.test(t)?Jnt:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Wnt:ECe.test(t)?Kee:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(rot,"i").test(t)?rot:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(ek).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?uK:znt:new RegExp("(pda|Mobile)","i").test(t)?$xn:new RegExp(Yee,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?sot:""},r3n=function(t,e){var n;const o=yot(t);return o===Jnt||o===znt||o==="Kobo"||o==="Kindle Fire"||o===sot?Yee:o===Jee||o===jee||o===Wee||o===fCe?"Console":o===Wnt?"Wearable":o?ek:e?.userAgentDataPlatform==="Android"&&((n=e?.maxTouchPoints)!==null&&n!==void 0?n:0)>0?600>Math.min((i=e?.screenWidth)!==null&&i!==void 0?i:0,(r=e?.screenHeight)!==null&&r!==void 0?r:0)/((s=e?.devicePixelRatio)!==null&&s!==void 0?s:1)?ek:Yee:"Desktop";var i,r,s},BCe=/\bFBAV\/(\d+(?:\.\d+)*)/i,xot=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",BCe],[/\bFBAN\/EMA\b/i,"Facebook Lite",BCe],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",BCe],[/\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"]],SCe="[Truncated]",dK="[Unserializable]";function tk(t){let e="";for(let n=0;t.length>n;n++){const o=t.charCodeAt(n);if(55296>o||o>56319)e+=56320>o||o>57343?t[n]:"�";else{const i=t.charCodeAt(n+1);56320>i||i>57343?e+="�":(e+=t[n]+t[n+1],n++)}}return e}function Eot(t,e){if(!e)return t;let n=[];try{n=Object.keys(e)}catch{n=[]}for(const o of n){let i;try{i=e[o]}catch{i=dK}Object.defineProperty(t,o,{value:i,enumerable:!0,writable:!0,configurable:!0})}return t}const qee=3e5;var Bot=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const n=this.isOpen(),o=Date.now(),i=Math.min(e.retryAfterMs,qee);if(!n)return this.ts=o,void(this.es=o+i);this.es=Math.max(this.es,Math.min(o+i,this.ts+qee))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const n=Math.min(qee,Math.max(0,this.es-e));return n===0&&this.reset(),n}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const s3n=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Sot(t,e){return typeof(n=t)=="string"&&s3n.test(n)?t:e();var n}function bot(t,e){const n=new Error(e);try{Object.defineProperty(n,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function Yb(t){return t&&t.split("#")[0]}function Qot(t){try{return t()}catch{return}}function vot(t,e){const n=setTimeout(t,e);return n!=null&&n.unref&&n?.unref(),n}function Pot(t,e,n){return wot.apply(this,arguments)}function wot(){return(wot=Vg(function*(t,e,n){let o;try{return yield Promise.race([t,new Promise((i,r)=>{o=vot(()=>{try{n?.(),i()}catch(s){r(s)}},e)})])}finally{clearTimeout(o)}})).apply(this,arguments)}let Xee,Mot,bCe;function a3n(t){const e=globalThis._posthogChunkIds;if(!e)return;const n=Object.keys(e);return bCe&&n.length===Mot||(Mot=n.length,bCe=n.reduce((o,i)=>{Xee||(Xee={});const r=Xee[i];if(r)o[r[0]]=r[1];else{const s=t(i);for(let a=s.length-1;a>=0;a--){const A=s[a],c=A?.filename,l=e[i];if(c&&l){o[c]=l,Xee[i]=[c,l];break}}}return o},{})),bCe}function hK(t){return hK=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hK(t)}function A3n(t,e,n){return(e=(function(o){var i=(function(r){if(hK(r)!="object"||!r)return r;var s=r[Symbol.toPrimitive];if(s!==void 0){var a=s.call(r,"string");if(hK(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)})(o);return hK(i)=="symbol"?i:i+""})(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Dot(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,o)}return n}function sn(t){for(var e=1;arguments.length>e;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Dot(Object(n),!0).forEach(function(o){A3n(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Dot(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}var c3n=class{constructor(e,n,o=[]){this.coercers=e,this.stackParser=n,this.modifiers=o}buildFromUnknown(e,n={}){const o=n&&n.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(o,n,0).apply(e),r=this.buildParsingContext(n),s=this.parseStacktrace(i,r);return{$exception_list:this.convertToExceptionList(s,o),$exception_level:"error"}}modifyFrames(e){var n=this;return Vg(function*(){for(const o of e)o.stacktrace&&o.stacktrace.frames&&rs(o.stacktrace.frames)&&(o.stacktrace.frames=yield n.applyModifiers(o.stacktrace.frames));return e})()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)===null||n===void 0?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var o;let i,r;if(e.cause!=null&&(i=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null)try{r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)}catch{}return sn(sn({},e),{},{cause:i,stack:r,errors:(o=e.errors)===null||o===void 0?void 0:o.map(s=>this.parseStacktrace(s,n))})}applyChunkIds(e,n){return e.map(o=>(o.filename&&n&&(o.chunk_id=n[o.filename]),o))}applyCoercers(e,n){for(const o of this.coercers)if(o.match(e))return o.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return Vg(function*(){let o=e;for(const i of n.modifiers)o=yield i(o);return o})()}convertToExceptionList(e,n){const o=[],i=(r,s,a)=>{var A;const c=o.length,l=s===void 0?sn(sn({type:typeof n.type=="string"&&n.type.length>0?n.type:"generic"},typeof n.handled=="boolean"?{handled:n.handled}:n.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof n.synthetic=="boolean"?n.synthetic:r.synthetic,exception_id:c}):{type:"chained",source:a,synthetic:r.synthetic,exception_id:c,parent_id:s},g={type:r.type,value:r.value,mechanism:l};r.stack&&(g.stacktrace={type:"raw",frames:r.stack}),o.push(g),r.cause&&i(r.cause,c,"cause");for(const u of(A=r.errors)!==null&&A!==void 0?A:[])i(u,c,"member")};return i(e),o}buildParsingContext(e){var n;return{chunkIdMap:a3n(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}getAggregateErrors(e){try{if(ZT(e)){let o=Object.getPrototypeOf(e);for(let i=0;o&&100>i;i++){var n;const r=(n=Object.getOwnPropertyDescriptor(o,"constructor"))===null||n===void 0?void 0:n.value;if(typeof r=="function"&&r.name==="AggregateError"){const s=e.errors;return rs(s)?s:void 0}o=Object.getPrototypeOf(o)}}}catch{}}buildCoercingContext(e,n,o=0){let i=0,r=0,s=!1;const a=new Set,A=[],c={},l=(h,d,p=0)=>{const m=g(d,p),_=m.apply;if(m.apply=E=>{A.push(h);try{return _(E)}finally{A.pop()}},p>4||p>0&&A.indexOf(h)!==-1)return this.coerceFallback(m);const f=typeof h=="object"&&h!==null||typeof h=="function";if(p===0&&i>=50||f&&a.has(h))return;f&&a.add(h),p===0&&i++;const I=this.getAggregateErrors(h);let C,y;s||(s=!!I);try{if(C=this.applyCoercers(h,m),!C)throw c}catch(E){if(E===c)return void(p===0&&i--);if(!s)throw E;C=this.coerceFallback(m)}if(!I||i>=50)return C;try{y=I.length}catch{return C}if(!Number.isInteger(y)||0>y||y>4294967295)return C;const x=[];for(let E=0;50>i&&1e3>r&&y>E;E++){let B;r++;try{B=m.next(I[E])}catch{i++,B=this.coerceFallback(g(d+1))}B&&x.push(B)}return sn(sn({},C),{},{errors:x})},g=(h,d=0)=>sn(sn({},n),{},{syntheticException:h==0?n.syntheticException:void 0,mechanism:h==0?e:{},apply(p){const m=l(p,h,d+1);if(!m)throw c;return m},next:p=>l(p,h+1)}),u=g(o);return sn(sn({},u),{},{apply:h=>{var d;return(d=l(h,o))!==null&&d!==void 0?d:this.coerceFallback(u)}})}};const l3n=/^([a-z][a-z0-9.+-]+):/i,g3n=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function u3n(t){if(!t||t==="<anonymous>")return!1;const e=l3n.exec(t);return!e||g3n.includes(e[1].toLowerCase())}function QCe(t,e,n,o,i){const r={platform:t,filename:e,function:n==="<anonymous>"?"?":n,in_app:u3n(e)};return Bo(o)||(r.lineno=o),Bo(i)||(r.colno=i),r}const Not=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,o=t.indexOf("safari-web-extension")!==-1;return n||o?[t.indexOf("@")!==-1?t.split("@")[0]:"?",n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},d3n=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,h3n=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,p3n=/\((\S*)(?::(\d+))(?::(\d+))\)/,m3n=(t,e)=>{const n=d3n.exec(t);if(n){const[,i,r,s]=n;return QCe(e,i,"?",+r,+s)}const o=h3n.exec(t);if(o){if(o[2]&&o[2].indexOf("eval")===0){const s=p3n.exec(o[2]);s&&(o[2]=s[1],o[3]=s[2],o[4]=s[3])}const[i,r]=Not(o[1]||"?",o[2]);return QCe(e,r,i,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},_3n=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,f3n=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,I3n=(t,e)=>{const n=_3n.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){const r=f3n.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}let o=n[3],i=n[1]||"?";return[i,o]=Not(i,o),QCe(e,o,i,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Rot=/\(error: (.*)\)/;function vCe(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function C3n(t){for(let e=1;10>=e;e++){const n=t.length-2*e;if(0>n)break;let o=!0;for(let i=0;e>i;i++)if(!vCe(t[n+i],t[n+e+i])){o=!1;break}if(o){for(let i=0;e>i;i++)t[n+i]=t[n+e+i];return t.length=n+e,{start:n,length:e}}}}function y3n(t,e){const n=e.start+e.length,o=kot(t,e);o&&t.splice(n+o===t.length?n:e.start,o)}function Tot(t,e){let n=e.start;for(;n>0&&vCe(t[n-1],t[n-1+e.length]);)n--;return e.start-n}function kot(t,e){const n=e.start+e.length;let o=n;for(;t.length>o&&vCe(t[o],t[o-e.length]);)o++;return o-n}function x3n(t,e){const n=e[0];let o=t.length-(n?Tot(t,n):0);for(const i of e)o-=kot(t,i);return o}function E3n(t,e,n){for(let o=0;t.length>o;o++){const i=t[(e+o)%t.length],r=t[(n+o)%t.length];if(i!==r)return r>i}return!1}var B3n=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){const o=eA(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:o?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${n}: ${e.message}`:n}isDOMException(e){return Gee(e,"DOMException")}isDOMError(e){return Gee(e,"DOMError")}},S3n=class{match(e){return ZT(e)}coerce(e,n){var o;const i=this.getStack(e),r=i===void 0?(o=n.syntheticException)===null||o===void 0?void 0:o.stack:void 0,s=!!r;return{type:this.getType(e),value:this.getMessage(e,n),stack:i??r,cause:e.cause?n.next(e.cause):void 0,synthetic:s}}getType(e){return e.name||e.constructor.name}getMessage(e,n){const o=e.message;return String(o.error&&typeof o.error.message=="string"?o.error.message:o)}getStack(e){try{const n=e.stacktrace;if(typeof n=="string"&&n.length>0)return n;const o=e.stack;return typeof o=="string"&&o.length>0?o:void 0}catch{return}}},b3n=class{match(e){return!!Gee(e,"ErrorEvent")&&(e.error!=null||this.ur(e))}coerce(e,n){var o;if(e.error!=null)return n.apply(e.error);const i=n.apply(e.message);return sn(sn({},i),{},{stack:(o=this.cr(e))!==null&&o!==void 0?o:i.stack,synthetic:!0})}ur(e){return eA(e.message)&&e.message.length>0}cr(e){var n,o;const i=e,r=(n=i.lineno)!==null&&n!==void 0?n:0,s=(o=i.colno)!==null&&o!==void 0?o:0;if(eA(i.filename)&&i.filename.length!==0&&r!==0)return`Error
|
|
240
|
-
at ${i.filename}:${r}:${s}`}};const Q3n=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var v3n=class{match(e){return typeof e=="string"}coerce(e,n){var o;const[i,r]=this.getInfos(e);return{type:i??"Error",value:r??e,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}getInfos(e){let n="Error",o=e;const i=e.match(Q3n);return i&&(n=i[1],o=i[2]),[n,o]}};const P3n=["fatal","error","warning","log","info","debug"];function Fot(t,e=40){const n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(let o=n.length;o>0;o--){const i=n.slice(0,o).join(", ");if(e>=i.length)return o===n.length?i:i.length>e?`${i.slice(0,e)}...`:i}return""}var w3n=class{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var o,i;const r=this.getErrorPropertyFromObject(e);return r?n.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(o=this.getStack(e))!==null&&o!==void 0?o:(i=n.syntheticException)===null||i===void 0?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(pCe(e))return e.constructor.name;const n="name"in e?e.name:void 0;return eA(n)&&!gK(n)?n:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let o=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(o+=` with message: '${e.message}'`),o}if("message"in e&&typeof e.message=="string")return e.message;const n=this.getObjectClassName(e);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${Fot(e)}`}isSeverityLevel(e){return eA(e)&&!gK(e)&&P3n.indexOf(e)>=0}getStack(e){try{return eA(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:eA(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const n in e)if({}.hasOwnProperty.call(e,n)){const o=e[n];if(ZT(o))return o}}getObjectClassName(e){try{const n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}},M3n=class{match(e){return pCe(e)}coerce(e,n){var o;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${Fot(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},D3n=class{match(e){return Ynt(e)}coerce(e,n){var o;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},N3n=class{match(e){return Gee(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!pCe(e))return!1;try{const n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var o;const i=this.getUnhandledRejectionReason(e);return Ynt(i)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}:n.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}};const $ee="$message",Zee="$timestamp",R3n=new Set([$ee,Zee]),PCe={enabled:!0,max_bytes:32768};function ete(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:PCe.enabled,max_bytes:k3n(t.max_bytes,PCe.max_bytes)}:sn({},PCe)}var T3n=class{constructor(e){this.ns=[],this.ss=0,this.Rr=ete(e)}setConfig(e){this.Rr=ete(e),this.rs()}add(e){const n=(function(i){let r;try{r=Ont(i)}catch{return}try{const s=JSON.parse(r);if(!CA(s))return;const a=s,A=a[$ee],c=a[Zee];return!eA(A)||A.trim().length===0||!eA(c)&&!zd(c)?void 0:{step:a,json:r}}catch{return}})(e);if(!n)return;const o=(function(i){if("u">typeof TextEncoder)return new TextEncoder().encode(i).length;const r=encodeURIComponent(i);let s=0;for(let a=0;r.length>a;a++)r[a]==="%"?(s+=1,a+=2):s+=1;return s})(n.json);o>this.Rr.max_bytes||(this.ns.push({step:n.step,bytes:o}),this.ss+=o,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Rr.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function k3n(t,e){if(!zd(t)||t===1/0||t===-1/0)return e;const n=Math.floor(t);return 0>n?e:n}const Lot=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function Hot(t){return typeof t=="string"||t}function Oot(t){return typeof t=="string"?t:void 0}const F3n=["$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","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Got="NativeGzipValidationError",wCe=t=>t.length>=2&&t[0]===31&&t[1]===139,Yot=(t,e)=>t===uCe.GZipJS||e===uCe.GZipJS||e==="gzip",Uot=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError";let pK;const tte=t=>{throw bot(Got,`Native gzip produced invalid output: ${t}`)},L3n=(Kot=Vg(function*(t,e){18>t.size&&tte("too-short");const n=new Uint8Array(yield t.slice(0,10).arrayBuffer());wCe(n)&&n[2]===8||tte("invalid-header");const o=new DataView(yield t.slice(t.size-8).arrayBuffer());o.getUint32(0,!0)!==(r=>{const s=(()=>{if(pK)return pK;pK=[];for(let A=0;256>A;A++){let c=A;for(let l=0;8>l;l++)c=1&c?3988292384^c>>>1:c>>>1;pK[A]=c>>>0}return pK})();let a=4294967295;for(let A=0;r.length>A;A++)a=s[255&(a^r[A])]^a>>>8;return(4294967295^a)>>>0})(e)&&tte("invalid-crc");const i=e.length>>>0;o.getUint32(4,!0)!==i&&tte("invalid-size")}),function(t,e){return Kot.apply(this,arguments)});var Kot;function MCe(){return MCe=Vg(function*(t,e=!0,n){try{const i=new TextEncoder().encode(t),r=new globalThis.CompressionStream("gzip"),s=r.writable.getWriter(),a=s.write(i).then(()=>s.close()).catch((o=Vg(function*(l){try{yield s.abort(l)}catch{}throw l}),function(l){return o.apply(this,arguments)})),A=new Response(r.readable).blob(),[c]=yield Promise.all([A,a]);return yield L3n(c,i),c}catch(i){if(n?.rethrow)throw i;return e&&console.error("Failed to gzip compress data",i),null}var o}),MCe.apply(this,arguments)}function Vot(t,e){if(t==null)return{};var n,o,i=(function(s,a){if(s==null)return{};var A={};for(var c in s)if({}.hasOwnProperty.call(s,c)){if(a.includes(c))continue;A[c]=s[c]}return A})(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;r.length>o;o++)e.includes(n=r[o])||{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}const H3n={}.propertyIsEnumerable;function nte(t,e){try{return zot(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function DCe(t,e,n,o){if(0>=n.remainingNodes)return{stringValue:SCe};if(n.remainingNodes--,ry(t))return{boolValue:t};if(typeof t=="bigint")return(function(i,r){const s=i.toString(),a=BigInt("9223372036854775808");return i>=a||-a>i?(r?.debug(`Attribute ${s} is outside the int64 range; encoding it as a string`),{stringValue:s}):{intValue:s}})(t,e);if(typeof t=="number"){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const i=BigInt(t).toString();return t>=9223372036854776e3||-9223372036854776e3>t?(e?.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:t}}if(typeof t=="string")return{stringValue:tk(t)};if(typeof t=="function")return{stringValue:"[Function]"};if(typeof t=="symbol")return{stringValue:String(t)};if(typeof t=="object"&&t!==null){if(n.ancestors.has(t))return{stringValue:"[Circular]"};if(o>=20)return{stringValue:SCe};if(t instanceof Date){const i=t.getTime(),r=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:typeof r=="string"?tk(r):String(r)}}n.ancestors.add(t);try{try{const i=t.toJSON;if(typeof i=="function")return DCe(i.call(t),e,n,o+1)}catch{}return rs(t)?{arrayValue:{values:O3n(t,e,n,o+1)}}:{kvlistValue:{values:zot(t,e,n,o+1)}}}finally{n.ancestors.delete(t)}}return{stringValue:tk(String(t))}}function O3n(t,e,n,o){const i=[],r=Math.min(t.length,1e3);let s=0;for(;r>s&&n.remainingNodes>0;s++)try{const a=s in t?t[s]:void 0;if(zs(a))continue;i.push(DCe(a,e,n,o))}catch{i.push({stringValue:dK})}return t.length>s&&i.push({stringValue:SCe}),i}function zot(t,e,n,o){const i=[];for(const r in t)if(H3n.call(t,r)){if(!r){e?.debug("Dropping an attribute with an empty key");continue}if(i.length>=1e3||0>=n.remainingNodes){e?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const s=t[r];if(od(s)||Bo(s))continue;i.push({key:tk(r),value:DCe(s,e,n,o)})}catch{i.push({key:tk(r),value:{stringValue:dK}})}}return i}function Jot(t,e,n){return sn(sn(sn(sn({},Eot({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":e,"telemetry.sdk.version":n})}const G3n=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function Wot(t,e){const n=Eot({},t),o={};for(const i of G3n)({}).hasOwnProperty.call(n,i)&&(o[i]=n[i],delete n[i]);return[...nte(n,e),...nte(o,e)]}const jot={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"},qot={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}},Y3n=qot.info;function U3n(t){try{return tk(String(t))}catch{return dK}}function K3n(t,e,n,o){const i=t.level||"info",{text:r,number:s}=qot[i]||Y3n,a=(function(u=Date.now()){return String(u)+"000000"})(zd(o)?o:void 0),A={};e.distinctId&&(A.posthogDistinctId=e.distinctId),e.sessionId&&(A.sessionId=e.sessionId),e.windowId&&(A["window.id"]=e.windowId),zs(e.sessionStartTimestamp)||(A.sessionStartTimestamp=String(e.sessionStartTimestamp)),zs(e.lastActivityTimestamp)||(A.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(A["url.full"]=e.currentUrl),e.screenName&&(A["screen.name"]=e.screenName),e.appState&&(A["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(A.feature_flags=e.activeFeatureFlags);const c=sn({},A),l=t.attributes;if(l){let u=[];try{u=Object.keys(l)}catch{u=[]}for(const h of u){let d;try{d=l[h]}catch{d=dK}Object.defineProperty(c,h,{value:d,enumerable:!0,writable:!0,configurable:!0})}}const g={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:s,severityText:r,body:{stringValue:U3n(t.body)},attributes:nte(c,n)};return t.trace_id&&(g.traceId=t.trace_id),t.span_id&&(g.spanId=t.span_id),Bo(t.trace_flags)||(g.flags=t.trace_flags),g}function Xot(t,e,n){return Jot(t,e,n)}function $ot(t,e,n,o){return{resourceLogs:[{resource:{attributes:Wot(e)},scopeLogs:[{scope:{name:n,version:o},logRecords:t}]}]}}var Zot=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=vot(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function eit(){return .75+.5*Math.random()}function tit(t,e,n,o){const i=Math.min(Math.max(0,e-1),6),r=t*Math.pow(2,i);return Math.round(Math.min(r,Math.max(o,t))*n)}var V3n=class{constructor(e,n,o,i,r,s=()=>Promise.resolve(),a){var A;this._instance=e,this.Rr=n,this.$=o,this.cs=i,this.ds=r,this.vs=s,this.fs=a,this.ps=new Zot(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new Bot,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=n.maxBufferSize,this.Is=Math.max((A=n.maxQueueSize)!==null&&A!==void 0?A:n.maxBufferSize,n.maxBufferSize),this.Ms=n.flushIntervalMs,this.Es=n.maxBatchRecordsPerPost,this.Ps=n.rateCapWindowMs,this.Rs=n.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(r9.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Rr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,n){var o;if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;const i=this.Os(e);if(i===null)return;if(!i.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const r={record:K3n(i,(o=n?.context)!==null&&o!==void 0?o:this.cs(),this.$,n?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){const n=this.Rr.beforeSend;if(!n)return e;const o=rs(n)?n:[n];let i=e;for(const r of o)try{const s=r(i);if(!s)return this.$.info("Log was rejected in beforeSend function"),null;i=s}catch(s){return this.$.error("Error in beforeSend function for log:",s),null}return i}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),n=e-this.xs;return this.Ps>n&&n>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return Vg(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return Vg(function*(){var n;e.ps.clear();let o=(n=e._instance.getPersistedProperty(r9.LogsQueue))!==null&&n!==void 0?n:[];if(o.length===0)return;const i=o.length;let r=0;for(;o.length>0&&i>r;){var s,a;const A=e._s;e.bs=0;const c=Math.min(o.length,e.Es),l=o.slice(0,c),g=$ot(l.map(h=>h.record),e.qs(),(s=e.fs)!==null&&s!==void 0?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),u=yield e._instance.js(g);if(e._s!==A)return;if(u.kind==="too-large"&&l.length>1)e.Es=Math.max(1,Math.floor(l.length/2)),e.$.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(u),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),u.kind==="retry-later"||(u.kind==="too-large"?e.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):u.kind==="ok"&&e.Rr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Rr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(l.length),o=(a=e._instance.getPersistedProperty(r9.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,u.kind==="fatal"))throw u.error}})()}Bs(e){var n=this;return Vg(function*(){var o;const i=Math.max(0,e-n.bs),r=(o=n._instance.getPersistedProperty(r9.LogsQueue))!==null&&o!==void 0?o:[];n._instance.setPersistedProperty(r9.LogsQueue,r.slice(i)),yield n.vs()})()}qs(){return Xot(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var n;if(this._instance.optedOut)return;const o=(n=this._instance.getPersistedProperty(r9.LogsQueue))!==null&&n!==void 0?n:[];this.Is>o.length||(o.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),o.push(e),this._instance.setPersistedProperty(r9.LogsQueue,o),this.Ts>o.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(tit(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(r9.LogsQueue);return!!e&&e.length>0}shutdown(e){var n=this;return Vg(function*(){n.ps.clear();const o=n.flush().catch(()=>{});e!==void 0?yield Pot(o,e):yield o})()}flushWithTimeout(e){var n=this;return Vg(function*(){const o=n.flush();yield Pot(o,e,()=>{o.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=eit(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const NCe=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function nit(t){return String(t)+"000000"}function oit(t,e,n,o){let i="";return o&&(i=Object.keys(o).sort().map(r=>`${JSON.stringify(r)}:${JSON.stringify(o[r])}`).join(",")),`${t}\0${e}\0${n??""}\0${i}`}var z3n=class{constructor(e,n,o){this._instance=e,this.Rr=n,this.$=o,this.zs=new Map,this.ps=new Zot(()=>this.flush().catch(i=>{this.$.error("Metrics flush failed:",i)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new Bot,this.ks=0,this.Ss=1,this.Gs=0}count(e,n=1,o){this.Zs({name:e,type:"count",value:n,unit:o?.unit,attributes:o?.attributes})}gauge(e,n,o){this.Zs({name:e,type:"gauge",value:n,unit:o?.unit,attributes:o?.attributes})}histogram(e,n,o){this.Zs({name:e,type:"histogram",value:n,unit:o?.unit,attributes:o?.attributes})}flush(){var e=this;const n=this.ys,o=(function(){var i=Vg(function*(){n&&(yield n.catch(()=>{})),yield e.Qs()});return function(){return i.apply(this,arguments)}})()().finally(()=>{this.ys===o&&(this.ys=null)});return this.ys=o,o}drainWindow(){if(this.zs.size===0)return null;const e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const n=this.Os(e);if(n===null)return;if(!n.name||typeof n.name!="string")return void this.$.warn("Dropping metric with empty name");if(typeof n.value!="number"||!Number.isFinite(n.value))return void this.$.warn(`Dropping metric '${n.name}': value must be a finite number`);if(n.type==="count"&&0>n.value)return void this.$.warn(`Dropping count '${n.name}': counters are monotonic, value must be >= 0`);let o,i;try{o=n.attributes?sn({},n.attributes):void 0,i=oit(n.type,n.name,n.unit,o)}catch(a){return void this.$.warn(`Dropping metric '${n.name}': attributes could not be serialized`,a)}let r=this.zs.get(i);if(!r){if(!this.Ks())return;r={name:n.name,type:n.type,unit:n.unit,attributes:o,windowStartMs:Date.now()},this.zs.set(i,r)}const s=this.Ws.get(n.name);s===void 0?this.Ws.set(n.name,n.type):s===n.type||this.Vs.has(n.name)||(this.Vs.add(n.name),this.$.warn(`Metric name '${n.name}' is already used as a ${s}; recording it as a ${n.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(r,n.value),this.Fs()}Ks(){return this.Rr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Rr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,n){switch(e.type){case"count":var o;e.total=((o=e.total)!==null&&o!==void 0?o:0)+n;break;case"gauge":e.last=n;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:n,max:n,bucketCounts:new Array(NCe.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=n,i.min=Math.min(i.min,n),i.max=Math.max(i.max,n),i.bucketCounts[(function(r,s){for(let a=0;s.length>a;a++)if(s[a]>=r)return a;return s.length})(n,NCe)]+=1;break}}}Os(e){const n=this.Rr.beforeSend;if(!n)return e;const o=rs(n)?n:[n];let i=e;for(const r of o)try{const s=r(i);if(!s)return this.$.info("Metric was rejected in beforeSend function"),null;i=s}catch(s){return this.$.error("Error in beforeSend function for metric:",s),null}return i}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(tit(this.Rr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return Vg(function*(){if(e.ps.clear(),e.zs.size===0)return;const n=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const o=e.Gs,i=yield e._instance.Ys(e.Js(n));if(o===e.Gs)switch(e.ws.record(i),i.kind==="retry-later"?(e.ks++,e.Ss=eit()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),i.kind){case"ok":return;case"retry-later":return e.ho(n),void e.ps.armNoEarlierThan(e.Hs());case"too-large":return void e.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.$.error("Failed to send metrics batch:",i.error)}})()}Js(e){return n=this.vo(e),o=(function(s,a,A){return Jot(s,a,A)})(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Wot(o)},scopeMetrics:[{scope:{name:i,version:r},metrics:n}]}]};var n,o,i,r}vo(e){const n=nit(Date.now()),o=new Map;for(const a of e.values()){var i;const A=oit(a.type,a.name,a.unit,void 0);let c=o.get(A);c||(c=sn({name:a.name},a.unit&&{unit:a.unit}),a.type==="count"?c.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:a.type==="gauge"?c.gauge={dataPoints:[]}:c.histogram={aggregationTemporality:1,dataPoints:[]},o.set(A,c));const l=nte((i=a.attributes)!==null&&i!==void 0?i:{},this.$),g=nit(a.windowStartMs);if(a.type==="count"){var r;const u={attributes:l,startTimeUnixNano:g,timeUnixNano:n,asDouble:(r=a.total)!==null&&r!==void 0?r:0};c.sum.dataPoints.push(u)}else if(a.type==="gauge"){var s;const u={attributes:l,timeUnixNano:n,asDouble:(s=a.last)!==null&&s!==void 0?s:0};c.gauge.dataPoints.push(u)}else a.hist&&c.histogram.dataPoints.push({attributes:l,startTimeUnixNano:g,timeUnixNano:n,count:a.hist.count,sum:a.hist.sum,min:a.hist.min,max:a.hist.max,bucketCounts:a.hist.bucketCounts,explicitBounds:NCe})}return Array.from(o.values())}ho(e){for(const[i,r]of e){const s=this.zs.get(i);if(s)switch(s.windowStartMs=Math.min(s.windowStartMs,r.windowStartMs),s.type){case"count":var n,o;s.total=((n=s.total)!==null&&n!==void 0?n:0)+((o=r.total)!==null&&o!==void 0?o:0);break;case"gauge":break;case"histogram":if(r.hist)if(s.hist){s.hist.count+=r.hist.count,s.hist.sum+=r.hist.sum,s.hist.min=Math.min(s.hist.min,r.hist.min),s.hist.max=Math.max(s.hist.max,r.hist.max);for(let a=0;s.hist.bucketCounts.length>a;a++)s.hist.bucketCounts[a]+=r.hist.bucketCounts[a]}else s.hist=r.hist}else this.Ks()&&this.zs.set(i,r)}}};const iit=(t,{debugEnabled:e}={})=>{const n={N(o,...i){Un&&(e8.DEBUG||Un.POSTHOG_DEBUG||e)&&!Bo(Un.console)&&Un.console&&("__rrweb_original__"in Un.console[o]?Un.console[o].__rrweb_original__:Un.console[o])(t,...i)},debug(...o){n.N("debug",...o)},info(...o){n.N("log",...o)},warn(...o){n.N("warn",...o)},error(...o){n.N("error",...o)},critical(...o){console.error(t,...o)},uninitializedWarning(o){n.error(`You must initialize PostHog before calling ${o}`)},createLogger:(o,i)=>iit(`${t} ${o}`,i)};return n},gi=iit("[PostHog.js]"),id=gi.createLogger,J3n=id("[ExternalScriptsLoader]"),ote=t=>{const e=No?.querySelectorAll("script");if(e){for(let n=0;e.length>n;n++)if(e[n].src===t||e[n].getAttribute("src")===t)return e[n]}},lM=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return J3n.warn(`${e} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const o=ote(e);if(o){if(o.__posthog_loading_callback_fired)return n();const r=o.__posthog_loading_error;return r?n(r):(o.addEventListener("load",s=>{o.__posthog_loading_callback_fired=!0,n(void 0,s)}),void o.addEventListener("error",s=>{o.__posthog_loading_error=s,n(s)}))}const i=()=>{if(!No)return n("document not found");if(ote(e))return lM(t,e,n);let r=No.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=a=>{r.__posthog_loading_callback_fired=!0,n(void 0,a)},r.onerror=a=>{r.__posthog_loading_error=a,n(a)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")No.head.appendChild(r);else{const a=No.querySelectorAll("body > script");var s;a.length>0?(s=a[0].parentNode)===null||s===void 0||s.insertBefore(r,a[0]):No.body.appendChild(r)}};No?.body?i():No?.addEventListener("DOMContentLoaded",i)},RCe={},rit=(t,e)=>{let n=`/static/${e}.js?v=${t.version}`;return e==="toolbar"&&(n=`${n}&t=${Math.floor(Date.now()/3e5)*3e5}`),t.requestRouter.endpointFor("assets",n)};Gr.__PosthogExtensions__=Gr.__PosthogExtensions__||{},Gr.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e==="remote-config"){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void lM(t,i,n)}const o=t.config.strict_script_versioning;if(o){const i=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=RCe[i];if(o==="fallback"&&r){if(ote(r))return void lM(t,r,n);delete RCe[i]}return void lM(t,i,o==="fallback"?(s,a)=>{if(s)if(typeof s=="string")n(s);else{var A;const c=rit(t,e);RCe[i]=c;const l=ote(i);l==null||(A=l.parentNode)===null||A===void 0||A.removeChild(l),lM(t,c,n)}else n(void 0,a)}:n)}lM(t,rit(t,e),n)},Gr.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{const o=t.requestRouter.endpointFor("api",e);lM(t,o,n)},e8.DEBUG=!1,e8.LIB_VERSION="1.434.11",e8.LIB_NAME="web";var Fm=e8;const W3n="$people_distinct_id",I4="distinct_id",TCe="$device_id",kCe="$device_model",ite="__alias",j3n="__cmpns",sit="$fbc",nk="$fbc_persistence",ait="$fbp",mK="$fbp_persistence",FCe="__timers",Ait="$autocapture_disabled_server_side",LCe="$heatmaps_enabled_server_side",HCe="$exception_capture_enabled_server_side",cit="$error_tracking_suppression_rules",OCe="$error_tracking_capture_extension_exceptions",GCe="$web_vitals_enabled_server_side",YCe="$dead_clicks_enabled_server_side",UCe="$product_tours_enabled_server_side",lit="$logs_capture_enabled_server_side",git="$web_vitals_allowed_metrics",_K="$session_recording_remote_config",q3n="$session_recording_enabled_server_side",X3n="$replay_sample_rate",$3n="$replay_override_sampling",Z3n="$replay_override_linked_flag",eEn="$replay_override_url_trigger",tEn="$replay_override_event_trigger",ok="$sesid",uit="$session_is_sampled",nEn="$session_past_minimum_duration",oEn="$session_recording_url_trigger_activated_session",iEn="$session_recording_event_trigger_activated_session",rEn="$debug_first_full_snapshot_timestamp",sEn="$sess_rec_flush_size",C4="$enabled_feature_flags",n8="$active_feature_flags",KCe="$early_access_features",gM="$feature_flag_details",Ub="$feature_flag_payloads",uM="$feature_flag_request_id",fK="$minimal_flag_called_events",a9="$override_feature_flags",dM="$override_feature_flag_payloads",Kb="$stored_person_properties",Vb="$stored_group_properties",dit="$groups",VCe="$surveys",rte="$surveys_loaded_at",hit="$surveys_activated",pit="$surveys_activated_session",mit="$surveys_activated_timestamps",zCe="ph_product_tours",aEn="$product_tours_activated",AEn="$product_tours_activated_session",cEn="$conversations_widget_session_id",lEn="$conversations_ticket_id",gEn="$conversations_widget_state",uEn="$conversations_user_traits",zb="$flag_call_reported",IK="$flag_call_reported_session_id",CK="$feature_flag_errors",Jb="$feature_flag_evaluated_at",sy="$user_state",JCe="$client_session_props",dEn="$capture_rate_limit",_it="$initial_campaign_params",fit="$initial_referrer_info",ik="$initial_person_info",WCe="$epp",jCe="$posthog_cookieless",Iit="$cookieless_mode",Cit="$sdk_debug_extensions_init_method",yit="$sdk_debug_extensions_init_time_ms",xit="$sdk_debug_recording_script_not_loaded",Eit="$sdk_debug_replay_stale_config",hEn="$sdk_debug_replay_event_trigger_status",pEn="$sdk_debug_replay_linked_flag_trigger_status",mEn="$sdk_debug_replay_matched_recording_trigger_groups",_En="$sdk_debug_replay_pending_trigger_conditions",fEn="$sdk_debug_replay_remote_trigger_matching_config",IEn="$sdk_debug_replay_trigger_groups_count",CEn="$sdk_debug_replay_url_trigger_status",yEn="$session_recording_start_reason",qCe="PostHog loadExternalDependency extension not found.",o8="anonymous",ste="identified",Bit="identified_only",yK="visibilitychange",ate="beforeunload",XCe="$pageview",Sit="$pageleave",bit="$identify",Qit="$groupidentify";function rk(t,e){rs(t)&&t.forEach(e)}function El(t,e){if(!zs(t))if(rs(t))t.forEach(e);else if((n=>n instanceof FormData)(t))t.forEach((n,o)=>e(n,o));else for(const n in t)hCe.call(t,n)&&e(t[n],n)}const Cg=function(t,...e){for(const n of e)for(const o in n)n[o]!==void 0&&(t[o]=n[o]);return t};function Ate(t){const e=Object.keys(t);let n=e.length;const o=new Array(n);for(;n--;)o[n]=[e[n],t[e[n]]];return o}const xEn=function(t){return function(...e){try{return t.apply(this,e)}catch(n){gi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),gi.critical(n)}}},$Ce=function(t){const e={};return El(t,function(n,o){(eA(n)&&n.length>0||zd(n))&&(e[o]=n)}),e};function vit(t){const e=sn({},t);for(const n of["name","message","stack","cause","errors"])try{n in t&&(e[n]=t[n])}catch{}return e}const EEn=["herokuapp.com","vercel.app","netlify.app"];function BEn(t){const e=t?.hostname;if(!eA(e))return!1;const n=e.split(".").slice(-2).join(".");for(const o of EEn)if(n===o)return!1;return!0}function dl(t,e,n,o){const{capture:i=!1,passive:r=!0}=o??{};t?.addEventListener(e,n,{capture:i,passive:r})}function ZCe(t){return t.name==="ph_toolbar_internal"}const xK=t=>{if(No){try{const e=t+"=",n=No.cookie.split(";").filter(o=>o.length);for(let o=0;n.length>o;o++){let i=n[o];for(;i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return zd(t)&&isFinite(t)&&Math.floor(t)===t});var SEn=class ctt{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,o,i){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(o)||!Number.isInteger(i)||0>e||0>n||0>o||0>i||e>0xffffffffffff||n>4095||o>1073741823||i>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|n>>>8,r[7]=n,r[8]=128|o>>>24,r[9]=o>>>16,r[10]=o>>>8,r[11]=o,r[12]=i>>>24,r[13]=i>>>16,r[14]=i>>>8,r[15]=i,new ctt(r)}toString(){let e="";for(let n=0;this.bytes.length>n;n++)e=e+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new ctt(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(let n=0;16>n;n++){const o=this.bytes[n]-e.bytes[n];if(o!==0)return Math.sign(o)}return 0}},bEn=class{generate(){const e=this.generateOrAbort();if(!Bo(e))return e;{this.Ct=0;const n=this.generateOrAbort();if(Bo(n))throw new Error("Could not generate UUID after timestamp reset");return n}}generateOrAbort(){const e=(()=>{const n=Date.now();return zd(n)&&isFinite(n)?Math.min(Math.max(Math.floor(n),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return SEn.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new QEn}};let Pit=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};Un&&!Bo(Un.crypto)&&crypto.getRandomValues&&(Pit=t=>crypto.getRandomValues(t));var QEn=class{nextUint32(){return this.Rt.length>this.$t||(Pit(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let wit;const y4=()=>vEn().toString(),vEn=()=>(wit||(wit=new bEn)).generate();let EK="";const PEn=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let sk=null;const rd={Et(){if(!od(sk))return sk;if(sk=!1,No)try{const t=`__ph_cookie_support_${y4()}`;rd.At(t,"xyz"),sk=xK(t)==='"xyz"',rd.Lt(t)}catch{sk=!1}return sk},Pt(t){gi.error("cookieStore error: "+t)},Ot:xK,Dt(t){let e;try{e=JSON.parse(rd.Ot(t))||{}}catch{}return e},At(t,e,n,o,i){if(!No)return!1;try{let r="",s="";const a=(function(c,l){if(l){let g=(function(u,h=No){if(EK)return EK;if(!h||["localhost","127.0.0.1"].includes(u))return"";const d=u.split(".");let p=Math.min(d.length,8);const m="dmn_chk_"+y4();for(;!EK&&p--;){const _=d.slice(p).join("."),f=m+"=1;domain=."+_+";path=/";h.cookie=f+";max-age=3",h.cookie.includes(m)&&(h.cookie=f+";max-age=0",EK=_)}return EK})(c);if(!g){const u=(h=>{const d=h.match(PEn);return d?d[0]:""})(c);u!==g&&gi.info("Warning: cookie subdomain discovery mismatch",u,g),g=u}return g?"; domain=."+g:""}return""})(No.location.hostname,o);if(n){const c=new Date;c.setTime(c.getTime()+864e5*n),r="; expires="+c.toUTCString()}i&&(s="; secure");const A=t+"="+encodeURIComponent(JSON.stringify(e))+r+"; SameSite=Lax; path=/"+a+s;return A.length>3686.4&&gi.warn("cookieStore warning: large cookie, len="+A.length),No.cookie=A,!0}catch{return!1}},Lt(t,e){if(No?.cookie&&(!e||!od(xK(t))))try{rd.At(t,"",-1,e)}catch{return}}};let eye=null;const cc={Et(){if(!od(eye))return eye;let t=!0;if(Bo(Un))t=!1;else try{const e="__mplssupport__";cc.At(e,"xyz"),cc.Ot(e)!=='"xyz"'&&(t=!1),cc.Lt(e)}catch{t=!1}return t||gi.error("localStorage unsupported; falling back to cookie store"),eye=t,t},Pt(t){gi.error("localStorage error: "+t)},Ot(t){try{return Un?.localStorage.getItem(t)}catch(e){cc.Pt(e)}return null},Dt(t){try{return JSON.parse(cc.Ot(t))||{}}catch{}return null},At(t,e){try{return Un?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){cc.Pt(n)}return!1},Lt(t){try{Un?.localStorage.removeItem(t)}catch(e){cc.Pt(e)}}},tye=[Kb,n8,C4,gM,Ub,uM,Jb,CK,zb],hM=[TCe,I4,ok,uit,WCe,ik,nk,sy],cte=t=>t+"_cpm",wEn=["__proto__","constructor","prototype"],nye=t=>{if(!CA(t))return{};const e={};return Object.keys(t).forEach(n=>{wEn.indexOf(n)===-1&&(e[n]=t[n])}),e},oye=(t,e=[])=>{const n={};return[...hM,...e].forEach(o=>{const i=t[o];Bo(i)||od(i)||i===""||(n[o]=i)}),n},Mit=t=>{let e=5381,n=2166136261;for(let o=0;t.length>o;o++){const i=t.charCodeAt(o);e=33*e^i,n=Math.imul(n^i,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(n>>>0).toString(36)},Dit=(t,e)=>({p:e,f:Mit(JSON.stringify(t))}),Nit=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const n=rd.Dt(cte(t)),o=n?.f===Mit(e)&&rs(n.p);return{properties:o?n.p:[],isValid:o}}catch{return{properties:[],isValid:!1}}},iye=(t,e)=>e+"|"+(rd.Ot(cte(t))||""),ak={},rye={Et:()=>!0,Pt(t){gi.error("memoryStorage error: "+t)},Ot:t=>t in ak?ak[t]:null,Dt:t=>t in ak?ak[t]:null,At:(t,e)=>(ak[t]=e,!0),Lt(t){delete ak[t]}};let pM=null;const j0={Et(){if(!od(pM))return pM;if(pM=!0,Bo(Un))pM=!1;else try{const t="__support__";j0.At(t,"xyz"),j0.Ot(t)!=='"xyz"'&&(pM=!1),j0.Lt(t)}catch{pM=!1}return pM},Pt(t){gi.error("sessionStorage error: ",t)},Ot(t){try{return Un?.sessionStorage.getItem(t)}catch(e){j0.Pt(e)}return null},Dt(t){try{return JSON.parse(j0.Ot(t))||null}catch{}return null},At(t,e){try{return Un?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){j0.Pt(n)}return!1},Lt(t){try{Un?.sessionStorage.removeItem(t)}catch(e){j0.Pt(e)}}};var MEn=class{constructor(e){this._instance=e}get Rr(){return this._instance.config}get consent(){return this.Lo()?0:this.No}isOptedOut(){return this.Rr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Rr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Rr.opt_out_capturing_by_default}optInOut(e){this.qo.At(this.jo,e?1:0,this.Rr.cookie_expiration,this.Rr.cross_subdomain_cookie,this.Rr.secure_cookie)}reset(){this.qo.Lt(this.jo,this.Rr.cross_subdomain_cookie)}get jo(){const{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:o}=this._instance.config;return o||(n?n+e:"__ph_opt_in_out_"+e)}get No(){const e=this.qo.Ot(this.jo);return mCe(e)?1:ms(jxn,e)?0:-1}get qo(){const e=this.Rr.opt_out_capturing_persistence_type,n=e==="localStorage"?cc:rd,o=n.Et()?n:rye;if(!this.Bo||this.Bo!==o){this.Bo=o;const i=e==="localStorage"?rd:cc;i.Ot(this.jo)&&(this.Bo.Ot(this.jo)||this.optInOut(mCe(i.Ot(this.jo))),i.Lt(this.jo,this.Rr.cross_subdomain_cookie))}return this.Bo}Lo(){return!!this.Rr.respect_dnt&&[w_?.doNotTrack,w_?.msDoNotTrack,Gr.doNotTrack,w_?.globalPrivacyControl].some(e=>mCe(e))}};function Rit(t,e){var n;const o=t==null||(n=t.config)===null||n===void 0?void 0:n.get_current_url;if(!M_(o))return e;try{const i=o(e);return eA(i)&&i?i:e}catch(i){return gi.error("Error in get_current_url, falling back to window.location.href",i),e}}function Tit(t){var e;return t instanceof Element&&(t.id==="__POSTHOG_TOOLBAR__"||!!(!((e=t.closest)===null||e===void 0)&&e.call(t,".toolbar-global-fade-container")))}function A9(t){return!!t&&t.nodeType===1}function H1(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function kit(t){return!!t&&t.nodeType===3}function sye(t){return!!t&&t.nodeType===11&&A9(t.host)}function aye(t){return t?Hee(t).split(/\s+/):[]}function Fit(t,e){const n=(function(o){var i;const r=Un==null||(i=Un.location)===null||i===void 0?void 0:i.href;return Bo(r)?void 0:Rit(o,r)})(e);return!!(n&&t&&t.some(o=>n.match(o)))}function Ak(t){let e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return aye(e)}function Lit(t){return zs(t)?null:Hee(t).split(/(\s+)/).filter(e=>QK(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function BK(t){let e="";return ck(t)&&!bK(t)&&t.childNodes&&t.childNodes.length&&El(t.childNodes,function(n){var o;kit(n)&&n.textContent&&(e+=(o=Lit(n.textContent))!==null&&o!==void 0?o:"")}),Hee(e)}function SK(t){var e;return Bo(t.target)?t.srcElement||null:!((e=t.target)===null||e===void 0)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}const Aye=["a","button","form","input","select","textarea","label"];function cye(t,e){const n=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!n&&n.call(t,e)}catch{return!1}}function lye(t,e){if(Bo(e))return!0;for(const n of t)if(e.some(o=>cye(n,o)))return!0;return!1}function Hit(t){const e=t.parentNode;return!(!e||!A9(e))&&e}const gye=[".ph-no-autocapture","[data-ph-no-autocapture]"],Oit=["next","previous","prev",">","<"],DEn=[...Oit,"+","-","−","–"],Git=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Yit=[".ph-no-rageclick",".ph-no-capture"],NEn=["","text","search","email","password","url","tel","number"];function Uit(t,e){if(!Un||uye(t))return!1;let n,o,i;var r,s;if(ry(e)?(n=!!e&&Yit,o=void 0,i=!1):(n=(r=e?.css_selector_ignorelist)!==null&&r!==void 0?r:Yit,o=e?.content_ignorelist,i=(s=e?.ignore_text_selection)!==null&&s!==void 0&&s),n===!1||i&&(function(A){return!(!A||!A9(A))&&(!!H1(A,"textarea")||(H1(A,"input")?ms(NEn,(A.getAttribute("type")||"").toLowerCase()):(function(c){var l;if(c.isContentEditable)return!0;const g=(l=c.getAttribute)===null||l===void 0?void 0:l.call(c,"contenteditable");return g==="true"||g===""})(A)))})(t))return!1;const{targetElementList:a}=Kit(t,!1);return!(function(A,c){if(A===!1||Bo(A))return!1;let l;if(A===!0)l=Oit;else{if(!rs(A))return!1;if(A.length>10)return gi.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;l=A.map(g=>g.toLowerCase())}return c.some(({safeText:g,ariaLabel:u})=>l.some(h=>Git(g,h)||Git(u,h)))})(o,a.map(A=>{var c;return{safeText:BK(A).toLowerCase(),ariaLabel:((c=A.getAttribute("aria-label"))===null||c===void 0?void 0:c.toLowerCase().trim())||""}}))&&!lye(a,n)}const uye=t=>!t||H1(t,"html")||!A9(t),Kit=(t,e)=>{if(!Un||uye(t))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const o=[t];let i=t;for(;i.parentNode&&!H1(i,"body");){if(sye(i.parentNode)){o.push(i.parentNode.host),i=i.parentNode.host;continue}const r=Hit(i);if(!r)break;if(e||Aye.indexOf(r.tagName.toLowerCase())>-1)n=!0;else try{const s=Un.getComputedStyle(r);s&&s.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}o.push(r),i=r}return{parentIsUsefulElement:n,targetElementList:o}};function ck(t){const e=new Set;let n=0;for(let r=t;r.parentNode&&!H1(r,"body");r=r.parentNode){if(n++>=1e3||e.has(r))return!1;e.add(r);const s=Ak(r);if(ms(s,"ph-sensitive")||ms(s,"ph-no-capture"))return!1}if(ms(Ak(t),"ph-include"))return!0;const o=t.type||"";if(eA(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}const i=t.name||t.id||"";return!eA(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,""))}function bK(t){return!!(H1(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||H1(t,"select")||H1(t,"textarea")||t.getAttribute("contenteditable")==="true")}const Vit=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}))$"),zit=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,REn=[16,15,14,13],TEn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Jit=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Wit=/[0-9A-Za-z_]/;function kEn(t){let e=0,n=!1;for(let o=t.length-1;o>=0;o--){let i=t.charCodeAt(o)-48;n&&(i*=2,i>9&&(i-=9)),e+=i,n=!n}return e%10==0}function QK(t,e=!0){return!(zs(t)||eA(t)&&(t=Hee(t),(e?Vit.test((t||"").replace(/[- ]/g,"")):(function(n){let o;for(zit.lastIndex=0;o=zit.exec(n);){const i=o[2];if(!i)continue;const r=i.replace(/[- ]/g,"");for(let s=0;r.length>s;s++)for(const a of REn){const A=s+a;if(r.length>=A){const c=r.slice(s,A);if(Vit.test(c)&&kEn(c))return!0}}}return!1})(t))||(e?TEn.test(t):(function(n){let o;for(Jit.lastIndex=0;o=Jit.exec(n);){const i=o[1],r=o[3];if(!(i&&r&&Wit.test(i)&&Wit.test(r)))return!0}return!1})(t))))}function jit(t){let e=BK(t);return e=`${e} ${qit(t)}`.trim(),QK(e)?e:""}function qit(t){let e="";return t&&t.childNodes&&t.childNodes.length&&El(t.childNodes,function(n){var o;if(n&&((o=n.tagName)===null||o===void 0?void 0:o.toLowerCase())==="span")try{const i=BK(n);e=`${e} ${i}`.trim(),n.childNodes&&n.childNodes.length&&(e=`${e} ${qit(n)}`.trim())}catch(i){gi.error("[AutoCapture]",i)}}),e}function Xit(t){return t.replace(/"|\\"/g,'\\"')}function FEn(t){const e=t.attr__class;if(e)return rs(e)?e:aye(e)}const lte=id("[Dead Clicks]"),LEn=()=>!0,HEn=t=>{var e;const n=!!(!((e=t.instance.persistence)===null||e===void 0)&&e.get_property(YCe)),o=t.instance.config.capture_dead_clicks;return ry(o)?o:!!CA(o)||n};var $it=class{get lazyLoadedDeadClicksAutocapture(){return this.Ho}constructor(e,n,o){this.instance=e,this.isEnabled=n,this.onCapture=o,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const n=e.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[YCe]:n.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Uo()}):this.stop()}zo(e){var n,o,i;!((n=Gr.__PosthogExtensions__)===null||n===void 0)&&n.initDeadClicksAutocapture?e():(o=Gr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this.instance,"dead-clicks-autocapture",r=>{r?lte.error("failed to load script",r):e()})}Uo(){var e;if(No){if(!this.Ho&&(!((e=Gr.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const n=CA(this.instance.config.capture_dead_clicks)?sn({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Ho=Gr.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Ho.start(No),lte.info("starting...")}}else lte.error("`document` not found. Cannot start.")}stop(){this.Ho&&(this.Ho.stop(),this.Ho=void 0,lte.info("stopping..."))}};const vK=id("[SegmentIntegration]");function Zit(t,e,n=!0){const o=t.config.segment;if(!o)return e();const{analytics:i,filterProperties:r}=(a=>M_(a.register))(s=o)?{analytics:s}:s;var s;(function(a,A,c,l){const g=h=>{const d=()=>h.anonymousId()||y4();a.config.get_device_id=d,l&&h.id()&&(a.register({distinct_id:h.id(),$device_id:d()}),a.persistence.set_property(sy,ste)),c(l?void 0:h.anonymousId()||void 0)},u=A.user();"then"in u&&M_(u.then)?u.then(g):g(u)})(t,i,a=>{i.register(((A,c,{filterProperties:l}={})=>{typeof Promise<"u"&&Promise.resolve||vK.warn("This browser does not have Promise support, and can not use the segment integration");const g=(u,h)=>{if(!h)return u;const d=!!c&&u.event.anonymousId===c&&!u.event.userId;d||u.event.userId||u.event.anonymousId===A.get_distinct_id()||(vK.info("No userId set, resetting PostHog"),A.reset()),d||(c=void 0),u.event.userId&&u.event.userId!==A.get_distinct_id()&&(vK.info("UserId set, identifying with PostHog"),A.identify(u.event.userId));let p=A.calculateEventProperties(h,u.event.properties);if(!zs(l)){const m=u.event.properties||{},_={};for(const I of Object.keys(p))hCe.call(m,I)||(_[I]=p[I]);const f=((I,C)=>{const y=rs(I)?I:[I];let x=sn({},C);for(const E of y)try{if(x=E(x),zs(x))return null}catch(B){return vK.error("Error in Segment filterProperties:",B),null}return x})(l,_);if(zs(f))return u;p=f}return u.event.properties=Object.assign({},p,u.event.properties),u};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(u){return g(u,u.event.event)},page(u){return g(u,XCe)},identify(u){return g(u,bit)},screen(u){return g(u,"$screen")}}})(t,a,{filterProperties:r})).then(()=>{e()},A=>{vK.error("Failed to register the Segment integration",A),e()})},n)}const ert="posthog-js";function trt(t,{organization:e,projectId:n,prefix:o,severityAllowList:i=["error"],sendExceptionsToPostHog:r=!0}={}){return s=>{var a,A,c,l,g;if(i!=="*"&&!i.includes(s.level)||!t.__loaded)return s;s.tags||(s.tags={});const u=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);s.tags["PostHog Person URL"]=u,t.sessionRecordingStarted()&&(s.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const h=((a=s.exception)===null||a===void 0?void 0:a.values)||[],d=h.map(_=>sn(sn({},_),{},{stacktrace:_.stacktrace?sn(sn({},_.stacktrace),{},{type:"raw",frames:(_.stacktrace.frames||[]).map(f=>sn(sn({},f),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:((A=h[0])===null||A===void 0?void 0:A.value)||s.message,$exception_type:(c=h[0])===null||c===void 0?void 0:c.type,$exception_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:((l=h[0])===null||l===void 0?void 0:l.value)||s.message,$sentry_exception_type:(g=h[0])===null||g===void 0?void 0:g.type,$sentry_tags:s.tags};var m;return e&&n&&(p.$sentry_url=(o||"https://sentry.io/organizations/")+e+"/issues/?project="+n+"&query="+s.event_id),r&&((m=t.exceptions)===null||m===void 0||m.sendExceptionEvent(p)),s}}var OEn=class{constructor(e,n,o,i,r,s){this.name=ert,this.setupOnce=function(a){a(trt(e,{organization:n,projectId:o,prefix:i,severityAllowList:r,sendExceptionsToPostHog:s==null||s}))}}},nrt=class{constructor(e){this.Wo=(n,o,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(gi.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:i}),this.Vo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Go()}Go(){var e;this.Zo=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Wo)}destroy(){var e;(e=this.Zo)===null||e===void 0||e.call(this),this.Zo=void 0}doPageView(e,n){var o;const i=this.Qo(e,n);return this.Vo={pathname:(o=Un?.location.pathname)!==null&&o!==void 0?o:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var n;return this.Qo(e,(n=this.Vo)===null||n===void 0?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Vo)===null||e===void 0?void 0:e.pageViewId}}Qo(e,n){const o=this.Vo;if(!o)return{$pageview_id:n};let i={$pageview_id:n,$prev_pageview_id:o.pageViewId};const r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:s,lastScrollY:a,maxScrollY:A,maxContentHeight:c,lastContentY:l,maxContentY:g}=r;if(!(Bo(s)||Bo(a)||Bo(A)||Bo(c)||Bo(l)||Bo(g))){s=Math.ceil(s),a=Math.ceil(a),A=Math.ceil(A),c=Math.ceil(c),l=Math.ceil(l),g=Math.ceil(g);const u=s>1?s9(a/s,0,1,gi):1,h=s>1?s9(A/s,0,1,gi):1,d=c>1?s9(l/c,0,1,gi):1,p=c>1?s9(g/c,0,1,gi):1;i=Cg(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:u,$prev_pageview_max_scroll:A,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:d,$prev_pageview_max_content:g,$prev_pageview_max_content_percentage:p})}}return o.pathname&&(i.$prev_pageview_pathname=o.pathname),o.timestamp&&(i.$prev_pageview_duration=(e.getTime()-o.timestamp.getTime())/1e3),i}};const PK=["flags","surveys"],GEn={[W3n]:{exposure:"hidden"},[ite]:{exposure:"hidden"},[j3n]:{exposure:"hidden"},[FCe]:{exposure:"hidden"},[nk]:{exposure:"hidden"},[mK]:{exposure:"hidden"},[Ait]:{exposure:"event"},[LCe]:{exposure:"hidden"},[lit]:{exposure:"hidden"},[HCe]:{exposure:"event"},[cit]:{exposure:"hidden"},[OCe]:{exposure:"event"},[GCe]:{exposure:"event"},[YCe]:{exposure:"event"},[UCe]:{exposure:"hidden"},[git]:{exposure:"event"},[_K]:{exposure:"hidden"},[q3n]:{exposure:"hidden"},[ok]:{exposure:"hidden"},[uit]:{exposure:"event"},[X3n]:{exposure:"event",shouldSkipFromEventProperties:t=>od(t)},[nEn]:{exposure:"event"},[oEn]:{exposure:"event"},[iEn]:{exposure:"event"},[rEn]:{exposure:"event"},[sEn]:{exposure:"hidden"},[C4]:{exposure:"hidden",storageGroup:"flags"},[n8]:{exposure:"hidden",storageGroup:"flags"},[KCe]:{exposure:"hidden"},[gM]:{exposure:"hidden",storageGroup:"flags"},[Ub]:{exposure:"hidden",storageGroup:"flags"},[uM]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[fK]:{exposure:"hidden",storageGroup:"flags"},[a9]:{exposure:"hidden"},[dM]:{exposure:"hidden"},[Kb]:{exposure:"hidden"},[Vb]:{exposure:"hidden"},[VCe]:{exposure:"hidden",storageGroup:"surveys"},[rte]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[hit]:{exposure:"event"},[pit]:{exposure:"hidden"},[mit]:{exposure:"hidden"},[zCe]:{exposure:"hidden"},[aEn]:{exposure:"hidden"},[AEn]:{exposure:"hidden"},[cEn]:{exposure:"event"},[lEn]:{exposure:"event"},[gEn]:{exposure:"event"},[uEn]:{exposure:"event"},[zb]:{exposure:"hidden"},[IK]:{exposure:"hidden"},[dit]:{exposure:"event"},[CK]:{exposure:"hidden"},[Jb]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[sy]:{exposure:"hidden"},[JCe]:{exposure:"hidden"},[dEn]:{exposure:"hidden"},[_it]:{exposure:"hidden"},[fit]:{exposure:"hidden"},[ik]:{exposure:"hidden"},[WCe]:{exposure:"hidden"},[$3n]:{exposure:"event"},[Z3n]:{exposure:"event"},[eEn]:{exposure:"event"},[tEn]:{exposure:"event"},[Cit]:{exposure:"event"},[yit]:{exposure:"event"},[xit]:{exposure:"event"},[Eit]:{exposure:"event"},[hEn]:{exposure:"event"},[pEn]:{exposure:"event"},[mEn]:{exposure:"event"},[_En]:{exposure:"event"},[fEn]:{exposure:"event"},[IEn]:{exposure:"event"},[CEn]:{exposure:"event"},[yEn]:{exposure:"event"}},YEn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],kf=t=>{const e=GEn[t];if(e)return e;for(const[n,o]of YEn)if(t.indexOf(n)===0)return o},lk=(t,e)=>{try{let n;return JSON.stringify(t,(o,i)=>{var r;return ZT(i)?((r=n)!==null&&r!==void 0||(n=new WeakMap),n.has(i)||n.set(i,vit(i)),n.get(i)):typeof i=="bigint"?i.toString():i},e)}catch{return Ont(t)}},Wb=t=>{const e=No?.createElement("a");return Bo(e)?null:(e.href=t,e)},gk=function(t,e){const n=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let o;for(let i=0;n.length>i;i++){const r=n[i].split("=");if(r[0]===e){o=r;break}}if(!rs(o)||2>o.length)return"";{let i=o[1];try{i=decodeURIComponent(i)}catch{gi.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")}},wK=function(t,e,n){if(!t||!e||!e.length)return t;const o=t.split("#"),i=o[1],r=(o[0]||"").split("?"),s=r[1],a=r[0],A=(s||"").split("&"),c=[];for(let g=0;A.length>g;g++){const u=A[g].split("=");rs(u)&&(e.includes(u[0])?c.push(u[0]+"="+n):c.push(A[g]))}let l=a;return s!=null&&(l+="?"+c.join("&")),i!=null&&(l+="#"+i),l},gte=function(t,e){const n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},ort=(t,e)=>t>=e&&Hnt(),irt=(t,e,n,o)=>{if(t===0){if(Hnt()){const i=e+1;return i===n&&o(),i}return e}return 0},uk=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],UEn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...uk],MK="<masked>",KEn=["li_fat_id"];function rrt(t,e,n){if(!No)return{};const o=e?[...uk,...n||[]]:[],i=srt(wK(No.URL,o,MK),t),r=(function(){const s={};return El(KEn,function(a){const A=xK(a);s[a]=A||null}),s})();return Cg(r,i)}function srt(t,e){const n=UEn.concat(e||[]),o={};return El(n,function(i){const r=gk(t,i);o[i]=r||null}),o}function art(t){const e=(function(i){return i?i.search("https?://(.*)google.([^/?]*)")===0?"google":i.search("https?://(.*)bing.com")===0?"bing":i.search("https?://(.*)yahoo.com")===0?"yahoo":i.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(t),n=e!="yahoo"?"q":"p",o={};if(!od(e)){o.$search_engine=e;const i=No?gk(No.referrer,n):"";i.length&&(o.ph_keyword=i)}return o}function Art(){return navigator.language||navigator.userLanguage}function VEn(){const t=Art();return typeof t=="string"?t.split("-")[0]:void 0}const ute="$direct";function crt(){return No?.referrer||ute}function lrt(t,e,n=!1){const o=t?[...uk,...e||[]]:[],i=n?Yb(nd?.href):nd?.href,r=i?.substring(0,1e3);return{r:crt().substring(0,1e3),u:r?wK(r,o,MK):void 0}}function grt(t,e=!1){var n;const{r:o,u:i}=t,r=e?Yb(i):i,s={$referrer:o,$referring_domain:o==null?void 0:o==ute?ute:(n=Wb(o))===null||n===void 0?void 0:n.host};if(r){s.$current_url=r;const a=Wb(r);s.$host=a?.host,s.$pathname=a?.pathname;const A=srt(r);Cg(s,A)}if(o){const a=art(o);Cg(s,a)}return s}function urt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function zEn(){try{return new Date().getTimezoneOffset()}catch{return}}const JEn={flags:Jb,surveys:rte},WEn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],dte=t=>`${t}_cookie_identity_change_pending`,hte=t=>{let e="",n=0;for(const o of t){const i=encodeURIComponent(JSON.stringify(o).slice(1,-1)).length;if(n+i>1e3)break;e+=o,n+=i}return e},Lm="main",i8=[C4,n8,gM,Ub,uM,Jb,fK,Kb],dye=t=>i8.indexOf(t)!==-1,drt=[nk,mK],hrt=t=>drt.indexOf(t)!==-1,jb=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch{return t===e}},dk=t=>{if(!t)return{};const e=JSON.parse(t);return CA(e)?e:{}},prt=(t,e)=>{El(t,(n,o)=>{const i=kf(o);i&&i.exposure!=="event"||{}.hasOwnProperty.call(e,o)||delete t[o]})};var hye=class{constructor(e,n,o=!0){if(this.Jo={},this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=!1,this.ia=new Map,this.na=!1,this.sa=!1,this.ra=!1,this.oa=new Set,this.aa=new Set,this.Rr=e,this.la=o,this.props={},this.ua=void 0,this.ha=(i=>{let r="";return i.token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"})(e),this.qo=this.ca(e),this.Yo=this.da(e),this.load(),this.va(),e.debug&&gi.info("Persistence loaded",e.persistence,sn({},this.props)),this.update_config(e,e,n),this.save(),Un){const i=()=>this.flush();dl(Un,"beforeunload",i,{capture:!1}),dl(Un,"pagehide",i,{capture:!1}),this.fa=r=>{if(this.Ko&&(!r.storageArea||r.storageArea===Un?.localStorage)&&r.key)if(r.key!==this.ha){if(this.Yo){const s=PK.find(a=>r.key===this.pa(a));s&&this.ga(r.key,s)}}else this.ga(r.key,Lm)},dl(Un,"storage",this.fa)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([n,o])=>{const i=this.ia.get(n);if(!dye(n)||i===!0)return;if(o===!0)return void this.ma(n,!0);const r=new Set(i||[]);o.forEach(s=>r.add(s)),r.size&&this.ma(n,r)})}onCrossTabFeatureFlagChange(e){return this.aa.add(e),()=>this.aa.delete(e)}destroy(){this.fa&&Un&&(Un.removeEventListener("storage",this.fa),this.fa=void 0),this.aa.clear()}ga(e,n,o=!0){if(this.mi)return!1;let i,r;try{if(r=cc.Ot(e),od(r)){const A=this.ya(n);return A.storageValue=null,n!==Lm&&(A.persisted=!1),!1}i=dk(r)}catch{return!1}const s=n===Lm?i:cc.Dt(this.ha);if(s&&this.ba(s))return!1;const a=this._a(i,n,o);return n===Lm&&this.Yo&&!jb(this.wa().main,i)||this.ka(i,n,!0,r),a}ba(e){const n=this.props[I4],o=e[I4];return!Bo(n)&&!Bo(o)&&n!==o}ka(e,n,o,i){const r=this.ya(n);r.storageValue=i,n!==Lm&&(r.persisted=o);try{r.fingerprint=this.Sa(e,n)}catch{r.fingerprint=void 0}}_a(e,n,o){let i=!1;return i8.forEach(r=>{var s;const a=(s=kf(r))===null||s===void 0?void 0:s.storageGroup;if(n===Lm&&this.Yo&&a||n!==Lm&&a!==n)return;const A=r in e,c=this.xa(r,A?e[r]:void 0),l=this.ia.has(r)?r in this.props:A;l===r in this.props&&jb(c,this.props[r])||(l?this.Ca(r,c,!1):this.$a(r,!1),i=!0)}),i&&o&&this.aa.forEach(r=>r()),i}Ta(){if(!this.Ko)return!1;try{this.ra=!1;const e=cc.Ot(this.ha),n=this.ya(Lm);let o,i=!1,r=!1;if(e!==n.storageValue)if(od(e))n.storageValue=null;else{if(o=dk(e),this.ra=!this.sa&&this.ba(o),this.ra)return!1;r=this._a(o,Lm,!1),!this.Yo||jb(this.wa().main,o)?this.ka(o,Lm,!0,e):n.storageValue=e,i=!0}return this.Yo&&PK.forEach(s=>{const a=cc.Ot(this.pa(s)),A=this.ya(s),c=o||{},l=i&&i8.some(u=>{var h;return((h=kf(u))===null||h===void 0?void 0:h.storageGroup)===s&&u in c});if(a===A.storageValue&&!l)return;if(od(a))return A.storageValue=null,A.persisted=!1,void(l&&(r=this._a(c,s,!1)||r));const g=dk(a);r=this._a(g,s,!1)||r,this.ka(g,s,!0,a)}),r}catch{return!1}}ma(e,n){this.ia.set(e,n);const o=kf(e);o?.volatile||(this.ya((this.Yo?o?.storageGroup:void 0)||Lm).fingerprint=void 0,this.Ia(e))}Ma(){i8.forEach(e=>this.ia.set(e,!0))}va(){if(this.Ko)try{const e=cc.Ot(this.ha),n=dk(e);this.ya(Lm).storageValue=e,i8.forEach(o=>{var i;const r=this.Yo?(i=kf(o))===null||i===void 0?void 0:i.storageGroup:void 0,s=r?cc.Ot(this.pa(r)):null;if(r){const A=this.ya(r);A.storageValue=s,A.persisted=!od(s)}const a=r&&!od(s)?dk(s):n;o in this.props?this.Ea(o,a[o],this.props[o]):o in a&&this.ma(o,!0)})}catch{}}xa(e,n){const o=this.ia.get(e);if(!o)return n;if(o===!0)return this.props[e];if(e==="$active_feature_flags"){const s=new Set(rs(n)?n:[]),a=new Set(rs(this.props[e])?this.props[e]:[]);return o.forEach(A=>a.has(A)?s.add(A):s.delete(A)),Array.from(s)}const i=CA(n)?sn({},n):{},r=CA(this.props[e])?this.props[e]:{};return o.forEach(s=>{s in r?i[s]=r[s]:delete i[s]}),i}Ea(e,n,o){if(!dye(e))return;const i=this.ia.get(e);if(i===!0)return;let r=n;if(this.Ko)try{var s;const A=this.Yo?(s=kf(e))===null||s===void 0?void 0:s.storageGroup:void 0,c=A?this.pa(A):this.ha;r=dk(cc.Ot(c))[e]}catch{}const a=new Set(i||[]);if(e==="$active_feature_flags"){if(!Bo(n)&&!rs(n)||!Bo(r)&&!rs(r)||!rs(o))return void this.ma(e,!0);const A=new Set(n||[]),c=new Set(r||[]),l=new Set(o);new Set([...A,...l]).forEach(g=>{A.has(g)!==l.has(g)&&a.add(g)}),a.forEach(g=>{c.has(g)===l.has(g)&&a.delete(g)})}else{if(!CA(o))return void(jb(r,o)?this.ia.delete(e):this.ma(e,!0));{if(!Bo(n)&&!CA(n)||Bo(n)&&z2(o)&&Bo(r))return void this.ma(e,!0);const A=CA(n)?n:{},c=CA(r)?r:{};new Set([...Object.keys(A),...Object.keys(o)]).forEach(l=>{l in A==l in o&&jb(A[l],o[l])||a.add(l)}),a.forEach(l=>{l in c==l in o&&jb(c[l],o[l])&&a.delete(l)})}}a.size?this.ma(e,a):this.ia.delete(e)}Pa(){var e;const n=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return zd(n)&&n>0?n:0}Ra(e){if(this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const n=oye(e,this.Rr.cookie_persisted_properties||[]),o=Dit(n,this.Rr.cookie_persisted_properties||[]),i=JSON.stringify(n)+"|"+JSON.stringify(o),r=rd.Ot(this.ha)||void 0;r&&iye(this.ha,r)===i&&(this.Aa=i,this.Fa=r)}catch{}else try{const n=rd.Ot(this.ha)||void 0;this.Aa=n?iye(this.ha,n):void 0,this.Fa=n}catch{}}syncCookieProperties(){return this.Oa(this.Rr)}Oa(e,n=!1){if(this.mi&&!n||this.ea||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let o;try{o=rd.Ot(this.ha)||void 0}catch{}if(!o||o===this.Fa)return!1;const i=iye(this.ha,o);let r;try{r=nye(JSON.parse(o))}catch{return!1}if((rd.Ot(this.ha)||void 0)!==o)return!1;this.Aa=i,this.Fa=o;const s=Nit(this.ha,o),a=[...hM,...s.properties],A={};if(Object.keys(r).forEach(m=>{const _=r[m];(Bo(_)||od(_)||_===""||m==="$user_state"&&_!=="anonymous"&&_!=="identified")&&(A[m]=!0,delete r[m])}),z2(r))return!1;const c="distinct_id"in r||r.$user_state==="anonymous"||r.$user_state==="identified",l=this.props,g=l[I4],u=l[sy],h=Cg({},l);[...hM,...e.cookie_persisted_properties||[]].forEach(m=>{if(a.indexOf(m)!==-1&&!(m in r)&&!A[m]&&(c||m!=="distinct_id"&&m!=="$user_state")){const _=h[m];(s.isValid||hM.indexOf(m)===-1||_!==!1&&_!==0)&&delete h[m]}}),this.props=Cg(h,r),i8.forEach(m=>{const _=m in this.props;m in l===_&&jb(l[m],this.props[m])||(_?this.Ea(m,l[m],this.props[m]):this.ma(m,!0))}),!c||"$user_state"in r||"$user_state"in this.props||this.Ca(sy,o8);const d=this.props[I4],p=this.props[sy];return!c||d===g&&p===u||(this.sa=!0,this.ta=!0,j0.At(dte(this.ha),!0),this.$a(Kb),this.$a(n8),this.$a(C4),this.$a(gM),this.$a(Ub),this.$a(uM),this.$a(Jb),this.$a(CK),this.$a(zb),p!=="anonymous"||u!=="identified"&&r.$user_state!=="anonymous"&&(Bo(g)||d===g)||(prt(this.props,r),this.$a(Vb)),p==="identified"?this.props.$user_id=d:delete this.props.$user_id,this.$a(ite)),!0}consumeCookieIdentityChange(){const e=dte(this.ha),n=this.ta||!!j0.Ot(e);return this.ta=!1,n&&j0.Lt(e),n}Da(e=!1){return!(this.ea||this.mi&&!e||!this.Rr.cookieWinsOnConflict||this.Rr.persistence.toLowerCase()!=="localstorage+cookie"||(this.ea=!0,0))}La(){this.ea&&(Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0),delete this.Jo[Lm],this.qa(!0))}ja(e=!0){if(this.ea)try{e?this.La():Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0)}finally{this.ea=!1}}isDisabled(){return!!this.mi}ca(e){WEn.indexOf(e.persistence.toLowerCase())===-1&&(gi.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const n=((a=[],A=!1)=>{const c=[...hM,...a];return sn(sn({},cc),{},{Dt(l){try{let u,h={};try{u=rd.Ot(l)||void 0,h=u?nye(JSON.parse(u)):{}}catch{}const d=JSON.parse(cc.Ot(l)||"{}");let p;if(A){const m=Nit(l,u),_=[...hM,...m.properties],f={};Object.keys(h).forEach(C=>{const y=h[C];od(y)||y===""||C==="$user_state"&&y!=="anonymous"&&y!=="identified"||(f[C]=y)});const I="distinct_id"in f||f.$user_state==="anonymous"||f.$user_state==="identified";if(Object.keys(f).length>0){var g;const C=d[I4],y=(g=d.$user_state)!==null&&g!==void 0?g:o8;c.forEach(x=>{if(_.indexOf(x)!==-1&&!(x in h)&&(I||x!=="distinct_id"&&x!=="$user_state")){const E=d[x];(m.isValid||hM.indexOf(x)===-1||E!==!1&&E!==0)&&delete d[x]}}),!I||"$user_state"in h||"$user_state"in d||(d[sy]=o8),!I||("distinct_id"in f?f[I4]:d[I4])===C&&("$user_state"in f?f[sy]:d[sy])===y||(tye.forEach(x=>delete d[x]),f.$user_state==="identified"&&"distinct_id"in f?d.$user_id=f[I4]:delete d.$user_id,f.$user_state!=="identified"&&(delete d[dit],delete d[Vb]),delete d.__alias)}p=Cg(d,f)}else p=Cg(h,d);return cc.At(l,p),p}catch{}return null},At(l,g,u,h,d,p){const m=cc.At(l,g,void 0,void 0,p);try{const _=oye(g,a);if(Object.keys(_).length){if(A){const f=cte(l),I=Dit(_,a);if(rd.At(f,I,u,h,d,p),rd.Ot(f)!==JSON.stringify(I)){rd.Lt(f,h);const C=oye(g);return rd.At(l,C,u,h,d,p),m}}rd.At(l,_,u,h,d,p)}}catch(_){cc.Pt(_)}return m},Lt(l,g){try{Un?.localStorage.removeItem(l),rd.Lt(l,g),rd.Lt(cte(l),g)}catch(u){cc.Pt(u)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let o,i=!1,r=!1;const s=e.persistence.toLowerCase();return s==="localstorage"&&cc.Et()?(o=cc,r=!0):s==="localstorage+cookie"&&n.Et()?(o=n,r=!0,i=!0):s==="sessionstorage"&&j0.Et()?o=j0:s==="memory"?o=rye:s==="cookie"&&rd.Et()?(o=rd,i=!0):n.Et()?(o=n,r=!0,i=!0):rd.Et()?(o=rd,i=!0):o=rye,this.Ko=r,this.Xo=i,o}pa(e){return`${this.ha}__${e}`}da(e){return this.Ko&&!!e.split_storage}properties(){const e={};return El(this.props,(n,o)=>{const i=kf(o);if(!i||i.exposure==="event"){var r;if(!(i==null||(r=i.shouldSkipFromEventProperties)===null||r===void 0)&&r.call(i,n))return;e[o]=n}}),e}load(e=!1){if(this.mi&&!e)return;const n=this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie",o=n?cc.Dt(this.ha):null;let i={};if(n)try{i=nye(rd.Dt(this.ha)),El(i,(A,c)=>{(Bo(A)||od(A)||A==="")&&delete i[c]})}catch{}const r=this.qo.Dt(this.ha);if(r&&(this.props=Cg({},r)),this.Yo&&this.Ba(),n&&r){var s,a;const A=o?.[I4],c=(s=o?.$user_state)!==null&&s!==void 0?s:o8,l=r[I4],g=(a=r.$user_state)!==null&&a!==void 0?a:o8;if(l!==A||g!==c){this.ta=!0,j0.At(dte(this.ha),!0);const u=Cg({},this.props);tye.forEach(d=>delete u[d]),g!=="anonymous"||c!=="identified"&&i.$user_state!=="anonymous"&&(Bo(A)||l===A)||(prt(u,i),delete u[Vb]),this.props=u;const h=new Set;tye.forEach(d=>{var p;const m=(p=kf(d))===null||p===void 0?void 0:p.storageGroup;m&&h.add(m)}),h.forEach(d=>{const p={};El(this.props,(m,_)=>{var f;((f=kf(_))===null||f===void 0?void 0:f.storageGroup)===d&&(p[_]=m)}),z2(p)?(cc.Lt(this.pa(d)),this.Jo[d]={}):cc.At(this.pa(d),p)&&(this.Jo[d]={persisted:!0,fingerprint:this.Sa(p,d)})})}}j0.Ot(dte(this.ha))&&(this.ta=!0)}Ba(){for(const e of PK){const n=cc.Dt(this.pa(e));if(n&&!z2(n)){const o=this.ya(e);o.persisted=!0,this.Ha(e)||(o.fingerprint=this.Sa(n,e)),this.za(e,n)||Cg(this.props,n)}}}Ha(e){return Object.keys(this.props).some(n=>{var o;return((o=kf(n))===null||o===void 0?void 0:o.storageGroup)===e})}za(e,n){const o=JEn[e];if(!o)return!1;const i=n[o],r=this.props[o];return zd(i)&&zd(r)&&r>i}refreshKey(e){var n;if(this.mi||this.oa.has(e))return;const o=this.Yo?(n=kf(e))===null||n===void 0?void 0:n.storageGroup:void 0,i=o?cc.Dt(this.pa(o)):this.qo.Dt(this.ha);if(i&&e in i)this.Ca(e,i[e],!1);else{if(o){const r=this.qo.Dt(this.ha);if(r&&e in r)return void this.Ca(e,r[e],!1)}this.$a(e,!1)}}save(){if(this.mi)return;const e=this.Pa();e>0?Bo(this.Na)&&(this.Na=setTimeout(()=>{this.Na=void 0,this.qa()},e)):this.qa()}flush(){Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0,this.qa())}qa(e=!1){if(this.mi||this.ea&&!e)return;e||(this.syncCookieProperties(),this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie"||drt.forEach(r=>this.refreshKey(r)));const n=!e&&!this.na;n||(this.ra=!1);const o=!!n&&this.Ta();if(this.ra)return void(this.Rr.debug&&gi.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Yo)return this.Ua(),void(o&&this.aa.forEach(r=>r()));const i=this.Wa(this.qo,this.ha,this.props,Lm);i==="written"&&this.Ra(this.props),i!=="failed"&&(this.ia.clear(),this.sa=!1,this.oa.clear()),o&&this.aa.forEach(r=>r())}Ua(){const{main:e,groups:n}=this.wa(),o=this.Wa(this.qo,this.ha,e,Lm);o==="written"&&this.Ra(e),o!=="failed"&&(this.sa=!1,this.oa.clear(),i8.forEach(r=>{var s;!((s=kf(r))===null||s===void 0)&&s.storageGroup||this.ia.delete(r)}));for(const r of PK){var i;const s=n[r];if(z2(s)&&!(!((i=this.Jo[r])===null||i===void 0)&&i.persisted)){i8.forEach(A=>{var c;((c=kf(A))===null||c===void 0?void 0:c.storageGroup)===r&&this.ia.delete(A)});continue}const a=this.Wa(cc,this.pa(r),s,r);a!=="failed"&&i8.forEach(A=>{const c=kf(A);c?.storageGroup!==r||a!=="written"&&c.volatile||this.ia.delete(A)})}}wa(){const e={},n={flags:{},surveys:{}};return El(this.props,(o,i)=>{var r;const s=(r=kf(i))===null||r===void 0?void 0:r.storageGroup;s?n[s][i]=o:e[i]=o}),{main:e,groups:n}}Sa(e,n){if(n===Lm)return JSON.stringify(e)+"|"+this.Va+"|"+this.Ga+"|"+this.Za;const o={};return El(e,(i,r)=>{var s;o[r]=!((s=kf(r))===null||s===void 0)&&s.volatile?"__volatile__":i}),JSON.stringify(o)}Wa(e,n,o,i){const r=this.ya(i);if(i!==Lm&&!r.dirty&&!Bo(r.fingerprint))return"skipped";let s;try{if(s=this.Sa(o,i),s===r.fingerprint)return r.dirty=!1,"skipped"}catch{s=void 0}return e.At(n,o,this.Va,this.Ga,this.Za,this.Rr.debug)?(r.dirty=!1,i!==Lm&&(r.persisted=!0),Bo(s)||(r.fingerprint=s),this.Ko&&(r.storageValue=cc.Ot(n)),"written"):(this.Rr.debug&&gi.warn(`failed to persist storage entry "${n}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ma(),Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0),this.qo.Lt(this.ha,!1),this.qo.Lt(this.ha,!0),!e&&this.la)for(const n of PK)cc.Lt(this.pa(n));e?delete this.Jo[Lm]:this.Jo={},this.Aa=void 0,this.Fa=void 0}clear(){this.remove(),this.props={}}register_once(e,n,o){if(CA(e)){this.syncCookieProperties(),Bo(n)&&(n="None"),this.Va=Bo(o)?this.Qa:o;let i=!1;if(El(e,(r,s)=>{this.props.hasOwnProperty(s)&&this.props[s]!==n||(this.Ca(s,r),i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(CA(e)){this.syncCookieProperties(),this.Va=Bo(n)?this.Qa:n;let o=!1;if(El(e,(i,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==i||CA(i)||rs(i))&&(this.Ca(r,i),o=!0)}),o)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const n=typeof e=="string"?[e]:e;let o=!1;for(const i of n)i in this.props&&(this.$a(i),o=!0);o&&this.save()}update_campaign_params(){const e=No?.URL;if(e===this.ua)return;const n=rrt(this.Rr.custom_campaign_params,this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties),o=!z2($Ce(n));return o&&this.register(n),this.ua=e,o?n:void 0}update_search_keyword(){this.register((function(){const e=No?.referrer;return e?art(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:crt(),$referring_domain:No?.referrer&&((e=Wb(No.referrer))===null||e===void 0?void 0:e.host)||ute},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=lrt(this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties,this.Rr.disable_capture_url_hashes);this.register_once({[ik]:this.Xo?{r:hte(e.r),u:e.u?hte(e.u):void 0}:e},void 0)}get_initial_props(){const e={};El([fit,_it],o=>{const i=this.props[o];i&&El(i,function(r,s){e["$initial_"+dCe(s)]=r})});const n=this.props[ik];if(n){const o=(function(i,r=!1){const s=grt(i,r),a={};return El(s,function(A,c){a[`$initial_${dCe(c)}`]=A}),a})(n,this.Rr.disable_capture_url_hashes);Cg(e,o)}return e}safe_merge(e){return El(this.props,function(n,o){o in e||(e[o]=n)}),e}update_config(e,n,o){const i=e.persistence!==n.persistence,r=!((d,p)=>{if(d.length!==p.length)return!1;const m=[...d].sort(),_=[...p].sort();return m.every((f,I)=>f===_[I])})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),s=i||r,a=e.cookieWinsOnConflict!==n.cookieWinsOnConflict,A=e.disable_persistence||!!o,c=!!this.mi&&!A;A||this.Oa(n,c),this.Rr=e,!A&&(i||r||a)&&(this.Aa=void 0,this.Fa=void 0,this.Oa(sn(sn({},e),{},{cookie_persisted_properties:n.cookie_persisted_properties}),c));const l=s||a?this.ca(e):this.qo;this.Ja();const g=this.da(e),u=s||g!==this.Yo,h=!A&&(u||e.cross_subdomain_cookie!==this.Ga||e.secure_cookie!==this.Za)&&this.Da(c);this.na=u;try{if(this.Qa=this.Va=e.cookie_expiration,this.set_disabled(A),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),u){const d=this.props;this.clear(),this.qo=l,this.Yo=g,this.props=d,this.save()}else a&&(this.qo=l,A||(delete this.Jo[Lm],this.qa()))}finally{this.na=!1,h&&this.ja()}}Ja(){const e=this.props[ik];if(!this.Xo||!CA(e)||typeof e.r!="string")return;const n=hte(e.r),o=typeof e.u=="string"?hte(e.u):e.u;n===e.r&&o===e.u||this.Ca(ik,sn(sn({},e),{},{r:n,u:o}))}set_disabled(e){this.mi=e,this.mi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Za&&(this.Za=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,n){const o=this.props.__timers||{};o[e]=n,this.Ca(FCe,o),this.save()}remove_event_timer(e){const n=this.props.__timers||{},o=n[e];return Bo(o)||(delete n[e],this.Ca(FCe,n),this.save()),o}get_property(e){return this.props[e]}set_property(e,n){this.Ca(e,n),this.save()}Ca(e,n,o=!0){var i;const r=this.props[e];this.props[e]=n,o&&(e!=="distinct_id"&&e!=="$user_state"||r===n||(this.sa=!0),hrt(e)&&!jb(r,n)&&this.oa.add(e),this.Ea(e,r,n),!((i=kf(e))===null||i===void 0)&&i.volatile||this.Ia(e))}$a(e,n=!0){delete this.props[e],n&&(dye(e)&&this.ma(e,!0),hrt(e)&&this.oa.add(e),this.Ia(e))}Ia(e){var n;const o=(n=kf(e))===null||n===void 0?void 0:n.storageGroup;o&&(this.ya(o).dirty=!0)}ya(e){return this.Jo[e]||(this.Jo[e]={})}};const y3={GZipJS:"gzip-js",Base64:"base64"},DK={Activation:"events",Cancellation:"cancelEvents"},pye={Popover:"popover",API:"api",Widget:"widget"},r8={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},mye={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},_ye={Popover:"popover",Inline:"inline"};function pte(t){let e=!0;return{dispose(){if(e){e=!1;const n=t();n&&M_(n.then)&&n.then(void 0,()=>{})}}}}const jEn={SHOWN:"product tour shown"},mrt={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},_rt=id("[RateLimiter]");var qEn=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{const o=n.text;if(o&&o.length)try{(JSON.parse(o).quota_limited||[]).forEach(i=>{_rt.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void _rt.warn(`could not rate limit - continuing. Error: "${i?.message}"`,{text:o})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var n,o,i;const{captureEventsBurstLimit:r,captureEventsPerSecond:s}=this,a=new Date().getTime(),A=(n=(o=this.instance.persistence)===null||o===void 0?void 0:o.get_property("$capture_rate_limit"))!==null&&n!==void 0?n:{tokens:r,last:a};A.tokens+=(a-A.last)/1e3*s,A.last=a,A.tokens>r&&(A.tokens=r);const c=1>A.tokens;if(c||e||(A.tokens=Math.max(0,A.tokens-1)),c&&!e){const l=(zd(A.dropped)?A.dropped:0)+1;A.dropped=l,!this.lastEventRateLimited&&this.Ka(l)&&(A.dropped=0)}return this.lastEventRateLimited=c,(i=this.instance.persistence)===null||i===void 0||i.set_property("$capture_rate_limit",A),{isRateLimited:c,remainingTokens:A.tokens}}Xa(e){const n=this.instance.config.property_denylist;return!rs(n)||!n.includes(e)}Ya(){var e;if(this.Xa("$current_url")&&this.Xa("$pathname")&&nd?.pathname)return`${(e=nd.origin)!==null&&e!==void 0?e:""}${nd.pathname}`}Ka(e){var n,o;const{captureEventsBurstLimit:i,captureEventsPerSecond:r}=this,s=this.Ya(),a=this.Xa("$session_id")?(n=(o=this.instance).get_session_id)===null||n===void 0?void 0:n.call(o):void 0,A=[`${e} event(s) dropped since the last warning`,s?`triggered on ${s}`:void 0,a?`session ${a}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${A}. Config is set to ${r} events per second and ${i} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}};const qb=id("[RemoteConfig]");var frt=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Gr._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}tl(e){var n,o,i;!((n=Gr.__PosthogExtensions__)===null||n===void 0)&&n.loadExternalDependency?(o=Gr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}el(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return qb.info("Using preloaded remote config",this.remoteConfig),void this.il(this.remoteConfig);if(this._instance.nl())return void qb.warn("Remote config is disabled. Falling back to local config.");this.tl(e=>{if(!e)return qb.info("No config found after loading remote JS config. Falling back to JSON."),void this.el(n=>{this.il(n.json,n)});this.il(e)})}catch(e){qb.error("Error loading remote config",e),this.il()}}il(e,n){!e&&n&&(n.statusCode===0?n.error||qb.warn("Failed to fetch remote config from PostHog."):qb.error("Failed to fetch remote config from PostHog."));try{this._instance.il(e?{ok:!0,config:e}:{ok:!1})}catch(i){qb.error("Error applying remote config",i)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var o;(o=this._instance.featureFlags)===null||o===void 0||o.ensureFlagsLoaded()}catch(i){qb.error("Error loading feature flags",i)}}},n5=Uint8Array,J2=Uint16Array,hk=Uint32Array,fye=new n5([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Iye=new n5([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Irt=new n5([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Crt=function(t,e){for(var n=new J2(31),o=0;31>o;++o)n[o]=e+=1<<t[o-1];var i=new hk(n[30]);for(o=1;30>o;++o)for(var r=n[o];n[o+1]>r;++r)i[r]=r-n[o]<<5|o;return[n,i]},yrt=Crt(fye,2),Cye=yrt[1];yrt[0][28]=258,Cye[258]=28;for(var xrt=Crt(Iye,0)[1],Ert=new J2(32768),sd=0;32768>sd;++sd){var pk=(43690&sd)>>>1|(21845&sd)<<1;Ert[sd]=((65280&(pk=(61680&(pk=(52428&pk)>>>2|(13107&pk)<<2))>>>4|(3855&pk)<<4))>>>8|(255&pk)<<8)>>>1}var NK=function(t,e,n){for(var o=t.length,i=0,r=new J2(e);o>i;++i)++r[t[i]-1];var s,a=new J2(e);for(i=0;e>i;++i)a[i]=a[i-1]+r[i-1]<<1;for(s=new J2(o),i=0;o>i;++i)s[i]=Ert[a[t[i]-1]++]>>>15-t[i];return s},mM=new n5(288);for(sd=0;144>sd;++sd)mM[sd]=8;for(sd=144;256>sd;++sd)mM[sd]=9;for(sd=256;280>sd;++sd)mM[sd]=7;for(sd=280;288>sd;++sd)mM[sd]=8;var mte=new n5(32);for(sd=0;32>sd;++sd)mte[sd]=5;var XEn=NK(mM,9),$En=NK(mte,5),Brt=function(t){return(t/8|0)+(7&t&&1)},Srt=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var o=new(t instanceof J2?J2:t instanceof hk?hk:n5)(n-e);return o.set(t.subarray(e,n)),o},s8=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8},RK=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8,t[o+2]|=n>>>16},yye=function(t,e){for(var n=[],o=0;t.length>o;++o)t[o]&&n.push({s:o,f:t[o]});var i=n.length,r=n.slice();if(!i)return[new n5(0),0];if(i==1){var s=new n5(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort(function(y,x){return y.f-x.f}),n.push({s:-1,f:25001});var a=n[0],A=n[1],c=0,l=1,g=2;for(n[0]={s:-1,f:a.f+A.f,l:a,r:A};l!=i-1;)a=n[n[g].f>n[c].f?c++:g++],A=n[c!=l&&n[g].f>n[c].f?c++:g++],n[l++]={s:-1,f:a.f+A.f,l:a,r:A};var u=r[0].s;for(o=1;i>o;++o)r[o].s>u&&(u=r[o].s);var h=new J2(u+1),d=xye(n[l-1],h,0);if(d>e){o=0;var p=0,m=d-e,_=1<<m;for(r.sort(function(y,x){return h[x.s]-h[y.s]||y.f-x.f});i>o;++o){var f=r[o].s;if(e>=h[f])break;p+=_-(1<<d-h[f]),h[f]=e}for(p>>>=m;p>0;){var I=r[o].s;e>h[I]?p-=1<<e-h[I]++-1:++o}for(;o>=0&&p;--o){var C=r[o].s;h[C]==e&&(--h[C],++p)}d=e}return[new n5(h),d]},xye=function(t,e,n){return t.s==-1?Math.max(xye(t.l,e,n+1),xye(t.r,e,n+1)):e[t.s]=n},brt=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new J2(++e),o=0,i=t[0],r=1,s=function(A){n[o++]=A},a=1;e>=a;++a)if(t[a]==i&&a!=e)++r;else{if(!i&&r>2){for(;r>138;r-=138)s(32754);r>2&&(s(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(s(i),--r;r>6;r-=6)s(8304);r>2&&(s(r-3<<5|8208),r=0)}for(;r--;)s(i);r=1,i=t[a]}return[n.subarray(0,o),e]},TK=function(t,e){for(var n=0,o=0;e.length>o;++o)n+=t[o]*e[o];return n},Eye=function(t,e,n){var o=n.length,i=Brt(e+2);t[i]=255&o,t[i+1]=o>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var r=0;o>r;++r)t[i+r+4]=n[r];return 8*(i+4+o)},Qrt=function(t,e,n,o,i,r,s,a,A,c,l){s8(e,l++,n),++i[256];for(var g=yye(i,15),u=g[0],h=g[1],d=yye(r,15),p=d[0],m=d[1],_=brt(u),f=_[0],I=_[1],C=brt(p),y=C[0],x=C[1],E=new J2(19),B=0;f.length>B;++B)E[31&f[B]]++;for(B=0;y.length>B;++B)E[31&y[B]]++;for(var b=yye(E,7),Q=b[0],w=b[1],M=19;M>4&&!Q[Irt[M-1]];--M);var k,R,F,G,U=c+5<<3,Y=TK(i,mM)+TK(r,mte)+s,J=TK(i,u)+TK(r,p)+s+14+3*M+TK(E,Q)+(2*E[16]+3*E[17]+7*E[18]);if(Y>=U&&J>=U)return Eye(e,l,t.subarray(A,A+c));if(s8(e,l,1+(Y>J)),l+=2,Y>J){k=NK(u,h),R=u,F=NK(p,m),G=p;var ee=NK(Q,w);for(s8(e,l,I-257),s8(e,l+5,x-1),s8(e,l+10,M-4),l+=14,B=0;M>B;++B)s8(e,l+3*B,Q[Irt[B]]);l+=3*M;for(var j=[f,y],X=0;2>X;++X){var ie=j[X];for(B=0;ie.length>B;++B)s8(e,l,ee[se=31&ie[B]]),l+=Q[se],se>15&&(s8(e,l,ie[B]>>>5&127),l+=ie[B]>>>12)}}else k=XEn,R=mM,F=$En,G=mte;for(B=0;a>B;++B)if(o[B]>255){var se;RK(e,l,k[257+(se=o[B]>>>18&31)]),l+=R[se+257],se>7&&(s8(e,l,o[B]>>>23&31),l+=fye[se]);var oe=31&o[B];RK(e,l,F[oe]),l+=G[oe],oe>3&&(RK(e,l,o[B]>>>5&8191),l+=Iye[oe])}else RK(e,l,k[o[B]]),l+=R[o[B]];return RK(e,l,k[256]),l+R[256]},ZEn=new hk([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),e5n=(function(){for(var t=new hk(256),e=0;256>e;++e){for(var n=e,o=9;--o;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),Bye=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function t5n(t,e){e===void 0&&(e={});var n=(function(){var g=4294967295;return{p(u){for(var h=g,d=0;u.length>d;++d)h=e5n[255&h^u[d]]^h>>>8;g=h},d(){return 4294967295^g}}})(),o=t.length;n.p(t);var i,r,s,a,A,c=(a=10+((i=e).filename&&i.filename.length+1||0),A=8,(function(g,u,h,d,p,m){var _=g.length,f=new n5(d+_+5*(1+Math.floor(_/7e3))+p),I=f.subarray(d,f.length-p),C=0;if(!u||8>_)for(var y=0;_>=y;y+=65535){var x=y+65535;_>x?C=Eye(I,C,g.subarray(y,x)):(I[y]=m,C=Eye(I,C,g.subarray(y,_)))}else{for(var E=ZEn[u-1],B=E>>>13,b=8191&E,Q=(1<<h)-1,w=new J2(32768),M=new J2(Q+1),k=Math.ceil(h/3),R=2*k,F=function(Ie){return(g[Ie]^g[Ie+1]<<k^g[Ie+2]<<R)&Q},G=new hk(25e3),U=new J2(288),Y=new J2(32),J=0,ee=0,j=(y=0,0),X=0,ie=0;_>y;++y){var se=F(y),oe=32767&y,ge=M[se];if(w[oe]=ge,M[se]=oe,y>=X){var de=_-y;if((J>7e3||j>24576)&&de>423){C=Qrt(g,I,0,G,U,Y,ee,j,ie,y-ie,C),j=J=ee=0,ie=y;for(var Ce=0;286>Ce;++Ce)U[Ce]=0;for(Ce=0;30>Ce;++Ce)Y[Ce]=0}var le=2,_e=0,he=b,ye=oe-ge&32767;if(de>2&&se==F(y-ye))for(var ve=Math.min(B,de)-1,Pe=Math.min(32767,y),me=Math.min(258,de);Pe>=ye&&--he&&oe!=ge;){if(g[y+le]==g[y+le-ye]){for(var Qe=0;me>Qe&&g[y+Qe]==g[y+Qe-ye];++Qe);if(Qe>le){if(le=Qe,_e=ye,Qe>ve)break;var we=Math.min(ye,Qe-2),Me=0;for(Ce=0;we>Ce;++Ce){var He=y-ye+Ce+32768&32767,ke=He-w[He]+32768&32767;ke>Me&&(Me=ke,ge=He)}}}ye+=(oe=ge)-(ge=w[oe])+32768&32767}if(_e){G[j++]=268435456|Cye[le]<<18|xrt[_e];var Se=31&Cye[le],Te=31&xrt[_e];ee+=fye[Se]+Iye[Te],++U[257+Se],++Y[Te],X=y+le,++J}else G[j++]=g[y],++U[g[y]]}}C=Qrt(g,I,m,G,U,Y,ee,j,ie,y-ie,C)}return Srt(f,0,d+Brt(C)+p)})(r=t,(s=e).level==null?6:s.level,s.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+s.mem,a,A,!0)),l=c.length;return(function(g,u){var h=u.filename;if(g[0]=31,g[1]=139,g[2]=8,g[8]=2>u.level?4:u.level==9?2:0,g[9]=3,u.mtime!=0&&Bye(g,4,Math.floor(new Date(u.mtime||Date.now())/1e3)),h){g[3]=8;for(var d=0;h.length>=d;++d)g[d+10]=h.charCodeAt(d)}})(c,e),Bye(c,l-8,n.d()),Bye(c,l-4,o),c}const n5n=!!gCe||!!cK,vrt=new WeakMap,Prt="text/plain";let Sye=0,_te=!1;const wrt=(t,e)=>{const[n,o]=t.split("#"),[i,r]=n.split("?");if(!r)return t;const s=r.split("&").filter(a=>a.split("=")[0]!==e).join("&");return`${i}${s?`?${s}`:""}${o?`#${o}`:""}`},kK=(t,e,n=!0)=>{var o;const[i,r]=t.split("?"),s=sn({},e),a=(o=r?.split("&").map(c=>{var l;const[g,u]=c.split("="),h=n&&(l=s[g])!==null&&l!==void 0?l:u;return delete s[g],`${g}=${h}`}))!==null&&o!==void 0?o:[],A=(function(c,l="&"){let g,u;const h=[];return El(c,function(d,p){Bo(d)||Bo(p)||p==="undefined"||(g=encodeURIComponent((m=>m instanceof File)(d)?d.name:d.toString()),u=encodeURIComponent(p),h[h.length]=u+"="+g)}),h.join(l)})(s);return A&&a.push(A),a.length>0?`${i}?${a.join("&")}`:i},bye=t=>{if(t.sl)return t.sl;const{data:e,compression:n}=t;if(!e)return;if(n===y3.GZipJS){const i=t5n((function(r){var s=r.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(r);for(var a=new n5(r.length+(r.length>>>1)),A=0,c=function(h){a[A++]=h},l=0;s>l;++l){if(A+5>a.length){var g=new n5(A+8+(s-l<<1));g.set(a),a=g}var u=r.charCodeAt(l);128>u?c(u):2048>u?(c(192|u>>>6),c(128|63&u)):u>55295&&57344>u?(c(240|(u=65536+(1047552&u)|1023&r.charCodeAt(++l))>>>18),c(128|u>>>12&63),c(128|u>>>6&63),c(128|63&u)):(c(224|u>>>12),c(128|u>>>6&63),c(128|63&u))}return Srt(a,0,A)})(lk(e)),{mtime:0});return{contentType:Prt,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===y3.Base64){const i=(function(s){return s&&btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g,(a,A)=>String.fromCharCode(parseInt(A,16))))})(lk(e)),r=(s=>"data="+encodeURIComponent(typeof s=="string"?s:lk(s)))(i);return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}const o=lk(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}},Mrt=t=>{const e=()=>t.transport==="sendBeacon"?{url:kK(t.url,{compression:y3.Base64}),encodedBody:bye(sn(sn({},t),{},{compression:y3.Base64,sl:void 0}))}:{url:wrt(t.url,"compression"),encodedBody:bye(sn(sn({},t),{},{compression:void 0,sl:void 0}))};let n;try{n=bye(t)}catch(i){if(Yot(t.compression,gk(t.url,"compression")))return gi.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return n&&Yot(t.compression,gk(t.url,"compression"))&&!((o=n.body)instanceof ArrayBuffer?wCe(new Uint8Array(o)):ArrayBuffer.isView(o)&&wCe(new Uint8Array(o.buffer,o.byteOffset,o.byteLength)))?(_te=!0,e()):{url:t.url,encodedBody:n};var o},Drt=t=>{try{return Mrt(t)}catch(n){var e;return gi.error(n),void((e=t.callback)===null||e===void 0||e.call(t,{statusCode:0,error:n}))}},o5n=(function(){var t=Vg(function*(e){const n=yield(function(i){return MCe.apply(this,arguments)})(lk(e.data),Fm.DEBUG,{rethrow:!0});if(!n)return e;const o=yield n.arrayBuffer();return sn(sn({},e),{},{sl:{contentType:Prt,body:o,estimatedSize:o.byteLength}})});return function(e){return t.apply(this,arguments)}})(),i5n=/Failed to fetch|NetworkError|Load failed/i,Nrt=t=>t?.name==="TypeError"&&i5n.test(t?.message||""),Rrt=t=>{try{const e=(function(n,o=Date.now()){if(typeof n!="string"||!n)return;const i=n.trim(),r=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(r)){const A=1e3*Math.min(Number(r),300);return A>0?A:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r))return;const s=/^\w{3} \w{3} /.test(r)?r+" GMT":r,a=Date.parse(s)-o;return Number.isFinite(a)&&a>0?Math.min(a,qee):void 0})(t());return Bo(e)?void 0:Math.min(e,3e4)}catch{return}},Trt=t=>{const e=Drt(t);if(!e)return;const n=new gCe;vrt.set(n,!0);const{url:o,encodedBody:i}=e;n.open(t.method||"GET",o,!0);const{contentType:r,body:s}=i??{};El(t.headers,function(a,A){n.setRequestHeader(A,a)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var a;const A={statusCode:n.status,text:n.responseText};if(n.status===200)try{A.json=JSON.parse(n.responseText)}catch{}(a=t.callback)===null||a===void 0||a.call(t,A,Rrt(()=>n.getResponseHeader("Retry-After")))}},n.send(s)},krt=t=>{const e=Drt(t);if(!e)return;const{url:n,encodedBody:o}=e,{contentType:i,body:r,estimatedSize:s}=o??{},a=new Headers;El(t.headers,function(d,p){a.append(p,d)}),i&&a.append("Content-Type",i);let A=null,c=!1;if(Lnt){const d=new Lnt;A={signal:d.signal,timeout:setTimeout(()=>{c=!0;try{d.abort(bot("AbortError","PostHog request timed out"+((p=t.timeout)?` after ${p}ms`:"")))}catch(m){g(m)}var p},t.timeout)}}let l=!1;const g=d=>{var p;l||(l=!0,c&&d?.name==="AbortError"||Nrt(d)?gi.warn(d):gi.error(d),(p=t.callback)===null||p===void 0||p.call(t,{statusCode:0,error:d}))};let u=0;const h=()=>{Sye-=u,u=0,A&&clearTimeout(A.timeout)};try{const d=sn({method:t?.method||"GET",headers:a,referrerPolicy:"strict-origin",body:r,signal:A?.signal},t.fetchOptions),p=s??(Bo(r)?0:void 0);d.keepalive=d.method==="POST"&&!t.rl&&d.keepalive!==!1&&d.body===r&&!Bo(p)&&p>=0&&52428.8>Sye+p,d.keepalive&&(u=p,Sye+=u),cK(n,d).then(m=>m.text().then(_=>{var f;if(l)return;const I={statusCode:m.status,text:_};if(m.status===200)try{I.json=JSON.parse(_)}catch(C){gi.error(C)}l=!0,h(),(f=t.callback)===null||f===void 0||f.call(t,I,Rrt(()=>m.headers.get("Retry-After")))})).catch(m=>{h(),g(m)}).finally(h)}catch(d){h(),g(d)}},Qye=t=>{try{var e;const{url:n,encodedBody:o}=Mrt(t),{contentType:i,body:r,estimatedSize:s}=o??{};if(!r)return;const a=r instanceof Blob?r:new Blob([r],{type:i});if(w_.sendBeacon(n,a))return;const A=rs(t.data)?t.data:(e=t.data)===null||e===void 0?void 0:e.batch;if(rs(A)&&A.length>1&&(s??0)>16384){const c=Math.ceil(A.length/2),l=g=>rs(t.data)?g:sn(sn({},t.data),{},{batch:g});return Qye(sn(sn({},t),{},{data:l(A.slice(0,c))})),void Qye(sn(sn({},t),{},{data:l(A.slice(c))}))}gi.warn(`Beacon of ~${s??0} bytes was rejected by the browser, falling back to ${cK?"fetch":"XHR"}`),cK?krt(sn(sn({},t),{},{rl:!0})):Trt(t)}catch(n){gi.warn("Beacon send failed",n)}},Frt=(t,e,n,o)=>{const i=o==="query"?e==="POST"?"sent_at":"_":void 0;return kK(n===y3.GZipJS?wrt(t,"compression"):t,sn(sn({},i?{[i]:Date.now().toString()}:{}),n===y3.GZipJS?{}:{compression:n}))},r5n=(()=>{const t=[];return cK&&t.push({transport:"fetch",method:krt}),gCe&&t.push({transport:"XHR",method:Trt}),w_?.sendBeacon&&t.push({transport:"sendBeacon",method:Qye}),t})();let Lrt=!n5n&&iy?.indexOf("MSIE")===-1&&iy?.indexOf("Mozilla")===-1;function Hrt(t,e,n){var o,i,r;n&&(e=sn(sn({},e),{},{callback:s=>n(s)})),t.__loaded?Lrt?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&((i=e.callback)===null||i===void 0||i.call(e,{statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=sn(sn({},t.config.request_headers),e.headers),e.compression=e.compression==="best-available"?(o=t.compression)!==null&&o!==void 0?o:e.compressionFallback:e.compression,(Bo(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((s,a)=>{var A,c,l;const g=sn(sn({},s),{},{callback:a??(m=>{var _;return(_=s.callback)===null||_===void 0?void 0:_.call(s,m)})});g.timeout=g.timeout||6e4;const u=(A=g.transport)!==null&&A!==void 0?A:"fetch";u==="sendBeacon"&&Bo(g.compression)&&g.data&&(g.compression=y3.Base64),g.method==="POST"&&g.data&&(g.timestampMode==="capture-body"?g.data=(m=>{var _,f;const I=(rs(m)?m:[m]).map(y=>sn(sn({},y),y.timestamp instanceof Date&&!isNaN(y.timestamp.getTime())?{timestamp:y.timestamp.toISOString()}:{})),C=I[0];return{api_key:(_=C==null||(f=C.properties)===null||f===void 0?void 0:f.token)!==null&&_!==void 0?_:C?.token,batch:I,sent_at:new Date().toISOString()}})(g.data):g.timestampMode==="body"&&(g.data=((m,_=new Date().toISOString())=>rs(m)?m.map(f=>sn(sn({},f),{},{sent_at:_})):sn(sn({},m),{},{sent_at:_}))(g.data))),g.url=Frt(g.url,g.method,g.compression,g.timestampMode);const h=r5n.filter(m=>!g.disableTransport||!m.transport||!g.disableTransport.includes(m.transport)),d=(c=(l=(function(m,_){for(let f=0;m.length>f;f++)if(_(m[f]))return m[f]})(h,m=>m.transport===u))===null||l===void 0?void 0:l.method)!==null&&c!==void 0?c:h[0].method;if(!d)throw new Error("No available transport method");const p=m=>{try{d(m)}catch(f){var _;Nrt(f)?gi.warn(f):gi.error(f),(_=g.callback)===null||_===void 0||_.call(g,{statusCode:0,error:f})}};u!=="sendBeacon"&&!g.preferSyncCompression&&g.data&&g.compression===y3.GZipJS&&Yxn&&typeof Promise<"u"&&!_te?o5n(g).then(m=>{p(m)}).catch(m=>{if(Uot(m))return _te=!0,void p(sn(sn({},g),{},{compression:void 0,url:Frt(s.url,s.method,void 0,s.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;const f="name"in _?String(_.name):"";return Uot(_)||f===Got})(m)&&(_te=!0),p(g)}):p(g)})(e,(s,a)=>{var A,c,l;t.rateLimiter.checkForLimiting(s),400>s.statusCode||(A=(c=t.config).on_request_error)===null||A===void 0||A.call(c,s),n?n(s,a):(l=e.callback)===null||l===void 0||l.call(e,s)})):e.fireCallbackOnDrop&&((r=e.callback)===null||r===void 0||r.call(e,{statusCode:0}))}var s5n=class{constructor(e,n){this.ol=!0,this.al=[],this.ll=s9(n?.flush_interval_ms||3e3,250,5e3,gi.createLogger("flush interval"),3e3),this.ul=e}enqueue(e){this.al.push(e),this.hl||this.cl()}unload(){this.dl();const e=this.al.length>0?this.vl():{},n=Object.values(e);[...n.filter(o=>o.url.indexOf("/e")===0),...n.filter(o=>o.url.indexOf("/e")!==0)].map(o=>{this.fl(o,"sendBeacon")})}enable(){this.ol=!1,this.cl()}cl(){this.ol||(this.hl=setTimeout(()=>{if(this.dl(),this.al.length>0){const e=this.vl();for(const n in e)this.fl(e[n])}},this.ll))}fl(e,n){try{this.ul(e,n)}catch(o){gi.error(o)}}dl(){clearTimeout(this.hl),this.hl=void 0}vl(){const e={};return El(this.al,n=>{var o;const i=n,r=((i?i.batchKey:null)||i.url)+(i.batchGroup?`:${i.batchGroup}`:"");Bo(e[r])&&(e[r]=sn(sn({},i),{},{data:[]})),(o=e[r].data)===null||o===void 0||o.push(i.data)}),this.al=[],e}};const a5n=["retriesPerformedSoFar"];var A5n=class{constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.al=[],this.al=[],this.ml=!0,this.resume()}resume(){if(!Bo(Un)&&"onLine"in Un.navigator){if(this.ml=Un.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.bl()},this._l=()=>{this.ml=!1},dl(Un,"online",this.yl),dl(Un,"offline",this._l)}}get length(){return this.al.length}retriableRequest(e,n){let{retriesPerformedSoFar:o}=e,i=Vot(e,a5n);t8(o)&&(i.url=kK(i.url,{retry_count:o})),Hrt(this._instance,n?sn(sn({},i),{},{transport:n}):i,(r,s)=>{var a;if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(o??0))return void this.Ls(sn({retriesPerformedSoFar:o},i),s);r.statusCode===0&&gi.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${o??0} retries.`)}(a=i.callback)===null||a===void 0||a.call(i,r)})}Ls(e,n){const o=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=o+1;const i=Math.max((function(a){const A=3e3*Math.pow(2,a),c=A/2,l=Math.min(18e5,A),g=(Math.random()-.5)*(l-c);return Math.ceil(l+g)})(o),n??0),r=Date.now()+i;this.al.push({retryAt:r,requestOptions:e});let s=`Enqueued failed request for retry in ${i}`;navigator.onLine||(s+=" (Browser is offline)"),gi.warn(s),this.pl||(this.pl=!0,this.wl())}wl(){if(this.kl&&clearTimeout(this.kl),this.al.length===0)return this.pl=!1,void(this.kl=void 0);this.kl=setTimeout(()=>{this.ml&&this.al.length>0&&this.bl(),this.wl()},this.gl)}bl(){const e=Date.now(),n=[],o=this.al.filter(i=>e>i.retryAt||(n.push(i),!1));if(this.al=n,o.length>0)for(const{requestOptions:i}of o)this.retriableRequest(i)}unload(){this.kl&&(clearTimeout(this.kl),this.kl=void 0),this.pl=!1,Bo(Un)||(this.yl&&(Un.removeEventListener("online",this.yl),this.yl=void 0),this._l&&(Un.removeEventListener("offline",this._l),this._l=void 0));for(const{requestOptions:e}of this.al)try{this._instance._send_request(sn(sn({},e),{},{transport:"sendBeacon"}))}catch(n){gi.error(n)}this.al=[]}},c5n=class{constructor(e){this._instance=e,this.Sl=()=>{var n,o,i,r;this.xl||(this.xl={});const s=this.scrollElement(),a=this.scrollY(),A=s?Math.max(0,s.scrollHeight-s.clientHeight):0,c=a+(s?.clientHeight||0),l=s?.scrollHeight||0;this.xl.lastScrollY=Math.ceil(a),this.xl.maxScrollY=Math.max(a,(n=this.xl.maxScrollY)!==null&&n!==void 0?n:0),this.xl.maxScrollHeight=Math.max(A,(o=this.xl.maxScrollHeight)!==null&&o!==void 0?o:0),this.xl.lastContentY=c,this.xl.maxContentY=Math.max(c,(i=this.xl.maxContentY)!==null&&i!==void 0?i:0),this.xl.maxContentHeight=Math.max(l,(r=this.xl.maxContentHeight)!==null&&r!==void 0?r:0)}}get Cl(){return this._instance.config.scroll_root_selector}getContext(){return this.xl}resetContext(){const e=this.xl;return this.xl=void 0,setTimeout(this.Sl,0),e}startMeasuringScrollPosition(){dl(Un,"scroll",this.Sl,{capture:!0}),dl(Un,"scrollend",this.Sl,{capture:!0}),dl(Un,"resize",this.Sl)}scrollElement(){if(this.Cl){const o=rs(this.Cl)?this.Cl:[this.Cl];for(const i of o){var e;const r=Un==null||(e=Un.document)===null||e===void 0?void 0:e.querySelector(i);if(r)return r}return}var n;return Un==null||(n=Un.document)===null||n===void 0?void 0:n.documentElement}$l(e){var n,o;const i=e==="y"?"scrollTop":"scrollLeft";if(this.Cl){const r=this.scrollElement();return r&&r[i]||0}return Un?e==="y"?Un.scrollY||Un.pageYOffset||((n=Un.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.scrollTop)||0:Un.scrollX||Un.pageXOffset||((o=Un.document)===null||o===void 0||(o=o.documentElement)===null||o===void 0?void 0:o.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}};const l5n=t=>lrt(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes);var Ort=class{constructor(e,n,o,i){this.Be=r=>{const s=this.Tl();if(s&&s.sessionId===r)return;const a={sessionId:r,props:this.Il(this._instance)};this.Ml.register({[JCe]:a})},this._instance=e,this.El=n,this.Ml=o,this.Il=i||l5n,this.El.onSessionId(this.Be)}Tl(){return this.Ml.props[JCe]}getSetOnceProps(){var e;const n=(e=this.Tl())===null||e===void 0?void 0:e.props;return n?"r"in n?grt(n,this._instance.config.disable_capture_url_hashes):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){const e={};return El($Ce(this.getSetOnceProps()),(n,o)=>{o==="$current_url"&&(o="url"),e[`$session_entry_${dCe(o)}`]=n}),e}},fte=class{on(e,n){return this.Pl[e]||(this.Pl[e]=[]),this.Pl[e].push(n),()=>{this.Pl[e]=this.Pl[e].filter(o=>o!==n)}}emit(e,n){for(const o of this.Pl[e]||[])o(n);for(const o of this.Pl["*"]||[])o(e,n)}constructor(){this.Pl={}}};const mk=id("[SessionId]"),Grt=864e5;var Yrt=class{on(e,n){return this.Rl.on(e,n)}constructor(e,n,o){var i;if(this.Al=null,this.Fl=null,this.Ol=[],this.Dl=void 0,this.Ll=!1,this.Rl=new fte,this.Nl=(s,a)=>!(!t8(s)||!t8(a))&&Math.abs(s-a)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rr=e.config,this.Ml=e.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.ql=void 0,this._sessionActivityTimestamp=null,this.jl=n||y4,this.Bl=o||y4;const r=this.Rr.persistence_name||this.Rr.token;if(this._sessionTimeoutMs=1e3*s9(this.Rr.session_idle_timeout_seconds||1800,60,36e3,mk.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hl(),this.zl="ph_"+r+"_window_id",this.Ul="ph_"+r+"_primary_window_exists",this.Wl()){const s=j0.Dt(this.zl),a=j0.Dt(this.Ul);s&&!a?this.He=s:j0.Lt(this.zl),j0.At(this.Ul,!0)}!((i=this.Rr.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Rr.bootstrap.sessionID),this.Vl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Bo(this.Ol)&&(this.Ol=[]),this.Ol.push(e),this.Xt&&e(this.Xt,this.He),()=>{this.Ol=this.Ol.filter(n=>n!==e)}}Wl(){return this.Rr.persistence!=="memory"&&!this.Ml.mi&&j0.Et()}Gl(e){e!==this.He&&(this.He=e,this.Wl()&&j0.At(this.zl,e))}Zl(){return this.He?this.He:this.Wl()?j0.Dt(this.zl):null}Ql(e){const n=this.Al;return!od(n)&&!od(e)&&5e3>Math.abs(e-n)}Jl(e,n,o){const i=n!==this._sessionActivityTimestamp,r=!(e!==this.Xt||o!==this._sessionStartTimestamp);this._sessionStartTimestamp=o,this._sessionActivityTimestamp=n,this.Xt=e,r&&!i||r&&this.Ql(n)||(this.Al=n,this.Ml.register({[ok]:[n,e,o]}))}Kl(){var e;const n=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return t8(n)&&n>0}Xl(){this.Kl()?this.Ml.refreshKey(ok):(this.Ml.flush(),this.Ml.load())}Yl(){var e;if(od(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Al)return;this.Xl();const[,n,o]=this.tu();n===this.Xt&&o===this._sessionStartTimestamp&&(this.Al=this._sessionActivityTimestamp,this.Ml.register({[ok]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Ml.flush())}eu(){const[e]=this.tu(),n=t8(e)?e:0,o=t8(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,o)}iu(e){return this.Xl(),this.Nl(e,this.eu())}tu(){const e=this.Ml.props[ok];return rs(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Al=null,this.ql=void 0,clearTimeout(this.nu),this.nu=void 0,this.Jl(null,null,null)}setBootstrapSessionId(e,n=!1){const o=((i,r=new Date().getTime())=>{try{const s=(a=>{const A=a.replace(/-/g,"");if(A.length!==32)throw new Error("Not a valid UUID");if(A[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(A.substring(0,12),16)})(i);return s>r+6e4?void mk.error("Bootstrap sessionID cannot be in the future"):s}catch(s){return void mk.error("Invalid sessionID in bootstrap",s)}})(e);return!Bo(o)&&(n?this.ql={sessionId:e,sessionStartTimestamp:o}:this.Jl(e,new Date().getTime(),o),!0)}destroy(){this.Ll=!0,this.Yl(),clearTimeout(this.nu),this.nu=void 0,this.Dl&&Un&&(Un.removeEventListener(ate,this.Dl,{capture:!1}),this.Dl=void 0),this.Ol=[]}Vl(){this.Dl=()=>{this.Yl(),this.Wl()&&j0.Lt(this.Ul)},dl(Un,ate,this.Dl,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,n=null,o=!1){if(this.Rr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const i=n||new Date().getTime(),r=this.Xt;if(o)this.Fl=i;else if(od(this.Fl)||this.Fl>i||i-this.Fl>=1e3){var s,a;(s=(a=this.Ml).syncCookieProperties)===null||s===void 0||s.call(a),this.Fl=i}let[,A,c]=this.tu();const l=!Bo(r)&&A!==r,g=this.eu();let u=this.Zl();const h=this.ql,d=!!h&&(h.sessionStartTimestamp>i+6e4||i-h.sessionStartTimestamp>Grt),p=h?d:t8(c)&&Math.abs(i-c)>Grt;let m=!1,_=l,f=!A||!!h;const I=A;let C=!f&&!e&&this.Nl(i,g);if(C&&(C=this.iu(i),C||mk.info("cross-tab refresh kept the session alive",{sessionId:A}),[,A,c]=this.tu(),C||(f=!A||!!h)),f||C||p){_=!1;const B=h&&!d;A=B?h.sessionId:this.jl(),u=this.Bl(),mk.info("new session ID assigned",{sessionId:A,windowId:u,bootstrapped:!!B,changeReason:{noSessionId:f,activityTimeout:C,sessionPastMaximumLength:p}}),c=B?h.sessionStartTimestamp:i,this.ql=void 0,m=!0}else u||(u=this.Bl(),m=!0),_=_||A!==I,_&&(mk.info("adopted cross-tab session id",{sessionId:A,windowId:u}),m=!0);const y=t8(g)&&e&&!p?g:i,x=t8(c)?c:new Date().getTime();this.Gl(u),this.Jl(A,y,x),e||this.Hl();const E={noSessionId:f,activityTimeout:C,sessionPastMaximumLength:p,crossTabAdoption:_};return m&&this.Ol.forEach(B=>B(A,u,E)),{sessionId:A,windowId:u,sessionStartTimestamp:x,changeReason:m?E:void 0,lastActivityTimestamp:g}}Hl(){this.Ll||(clearTimeout(this.nu),this.nu=setTimeout(()=>{if(!this.Ll)if(this.iu(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Rl.emit("forcedIdleReset",{idleSessionId:e})}else this.Hl()},1.1*this.sessionTimeoutMs))}};const Urt=function(t,e){if(!t)return!1;const n=t.userAgent;if(n&&Vnt(n,e))return!0;try{const o=t?.userAgentData;if(o?.brands&&o.brands.some(i=>Vnt(i?.brand,e)))return!0}catch{}return!!t.webdriver};function Krt(){return(Krt=Vg(function*(){const t=w_?.userAgentData;if(t?.getHighEntropyValues)try{const e=yield t.getHighEntropyValues(["model"]),n=e?.model;return eA(n)&&n.length>0?n:void 0}catch(e){return void gi.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function g5n(t,e){let n=`$survey_${e}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(n=`$survey_${e}/${t.id}/${t.current_iteration}`),n}function Vrt(t){var e;return!!(!((e=t.conditions)===null||e===void 0||(e=e.events)===null||e===void 0||(e=e.values)===null||e===void 0)&&e.length)}const Ite=(t,e)=>{if(!(n=>{try{new RegExp(n)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}},Cte=t=>t.toLowerCase(),zrt={exact:(t,e)=>e.some(n=>t.some(o=>n===o)),is_not:(t,e)=>e.every(n=>t.every(o=>n!==o)),regex:(t,e)=>e.some(n=>t.some(o=>Ite(n,o))),not_regex:(t,e)=>e.every(n=>t.every(o=>!Ite(n,o))),icontains:(t,e)=>e.map(Cte).some(n=>t.map(Cte).some(o=>n.includes(o))),not_icontains:(t,e)=>e.map(Cte).every(n=>t.map(Cte).every(o=>!n.includes(o))),gt:(t,e)=>e.some(n=>{const o=parseFloat(n);return!isNaN(o)&&t.some(i=>o>parseFloat(i))}),lt:(t,e)=>e.some(n=>{const o=parseFloat(n);return!isNaN(o)&&t.some(i=>o<parseFloat(i))})};function Jrt(t,e){return!t||Object.entries(t).every(([n,o])=>{const i=e?.[n];if(i==null)return!1;const r=zrt[o.operator];return!!r&&r(o.values.map(String),[String(i)])})}function vye(t,e,n){return lk({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}const Pye="custom",Wrt="i.posthog.com",u5n=/^\/static\//,d5n=["/s/","/e/","/i/"];var h5n=class{constructor(e){this.su={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let n=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace(`.${Wrt}`,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.su[this.apiHost]||(this.su[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":Pye),this.su[this.apiHost]}ru(e){if(!u5n.test(e))return;const n=this.instance.config.asset_host;return typeof n=="string"&&n.trim().replace(/\/$/,"")||void 0}ou(e){const n=Wb(e);return n?n.protocol+"//"+n.host+n.pathname:void 0}au(e,n,o){if(e==="ui")return o;let i=o;const r=this.instance.config.rewriteRequestPath;if(r){var s;const a=((s=Wb(o))===null||s===void 0?void 0:s.href)||o;i=r(new URL(a)).toString()}if(r&&e==="api"&&d5n.some(a=>n.indexOf(a)===0)){const a=this.ou(i);if(a){const A=this.apiHost;let c=this.lu;c?.apiHost===A&&c.rewriteRequestPath===r||(c={apiHost:A,rewriteRequestPath:r,urls:new Set},this.lu=c),c.urls.add(a)}}return i}isIngestionEndpoint(e){const n=this.lu,o=this.ou(e);return n?.apiHost===this.apiHost&&n.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!o&&n.urls.has(o)}endpointFor(e,n=""){if(n&&(n=n[0]==="/"?n:`/${n}`),e==="ui")return this.au(e,n,this.uiHost+n);if(e==="flags")return this.au(e,n,this.flagsApiHost+n);if(e==="assets"){const i=this.ru(n);if(i)return this.au(e,n,`${i}${n}`)}if(this.region===Pye)return this.au(e,n,this.apiHost+n);const o=Wrt+n;switch(e){case"assets":return this.au(e,n,`https://${this.region}-assets.${o}`);case"api":return this.au(e,n,`https://${this.region}.${o}`)}}};const Bl=id("[Surveys]"),jrt=t=>{try{const e=(n=>((o,i)=>`seenSurvey_${(function(r){return r.current_iteration&&r.current_iteration>0?`${r.id}_${r.current_iteration}`:r.id})(i)}`)(0,n))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(e){Bl.error("Failed to persist survey seen state",e)}},p5n=[pye.Popover,pye.Widget,pye.API],m5n={ignoreConditions:!1,ignoreDelay:!1,displayType:_ye.Popover},_5n=id("[PostHog ExternalIntegrations]"),f5n={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var I5n=class{constructor(e){this._instance=e}zo(e,n){var o,i;(o=Gr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,e,r=>{if(r)return _5n.error("failed to load script",r);n()})}startIfEnabledOrStop(){var e;for(const[r,s]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var n,o,i;s&&!(!((n=Gr.__PosthogExtensions__)===null||n===void 0||(n=n.integrations)===null||n===void 0)&&n[r])&&this.zo(f5n[r],()=>{var a;(a=Gr.__PosthogExtensions__)===null||a===void 0||(a=a.integrations)===null||a===void 0||(a=a[r])===null||a===void 0||a.start(this._instance)}),!s&&(!((o=Gr.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0)&&o[r])&&((i=Gr.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0||(i=i[r])===null||i===void 0||i.stop())}}},C5n=class{constructor(e,n){this.$=e,this.wo=n,this.uu=new Map,this.Io=!1}add(e){var n=this;return Vg(function*(){if(n.Io)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.uu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);n.uu.set(e.name,e);try{const o=e.setup(n.wo);o&&(yield o)}catch(o){const i=n.uu.get(e.name)===e;i&&n.uu.delete(e.name),n.$.error(`Failed to set up browser extension "${e.name}"`,o),i&&n.hu(e)}})()}getExtension(e){return this.uu.get(e)}dispose(){if(this.Io)return;this.Io=!0;const e=Array.from(this.uu.values()).reverse();this.uu.clear();for(const n of e)this.hu(n)}hu(e){try{var n;const o=(n=e.dispose)===null||n===void 0?void 0:n.call(e);o&&M_(o.then)&&o.then(void 0,i=>{this.$.error(`Failed to dispose browser extension "${e.name}"`,i)})}catch(o){this.$.error(`Failed to dispose browser extension "${e.name}"`,o)}}},y5n=class{constructor(e){this._instance=e}initialize(){}get(e){const n=this._instance.persistence;if(typeof e=="string")return n?.get_property(e);const o={};for(const i of e){const r=n?.get_property(i);Bo(r)||(o[i]=r)}return o}set(e,n){var o;(o=this._instance.persistence)===null||o===void 0||o.register(typeof e=="string"?{[e]:n}:e)}remove(e){var n;(n=this._instance.persistence)===null||n===void 0||n.unregister(e)}};const qrt="extensionsRemoteConfig";var x5n=class{constructor(e){this.instance=e,this.Io=!1,this.$=gi,this.cu=e.du,this.kv=new y5n(e),this.onEvent=n=>pte(this.instance.on("eventCaptured",o=>{try{n({event:o.event,properties:o.properties})}catch(i){this.$.error("Browser extension event listener failed",i)}})),this.onRemoteConfig=n=>{if(this.Io)return pte(()=>{});const o=r=>{try{n(r)}catch(s){this.$.error("Browser extension remote config listener failed",s)}},i=this.instance.vu.on(qrt,o);return this.cu&&o(this.cu),pte(i)},this.fu=new C5n(gi.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property(TCe);return typeof e=="string"?e:void 0}get library(){return{name:Fm.LIB_NAME,version:Fm.LIB_VERSION}}get initialPersonProperties(){var e,n;return(e=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,n,o,i;const r=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=r?.sessionId)!==null&&n!==void 0?n:"",windowId:(o=r?.windowId)!==null&&o!==void 0?o:"",sessionStartTimestamp:(i=r?.sessionStartTimestamp)!==null&&i!==void 0?i:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.fu.add(e)}getExtension(e){return this.fu.getExtension(e)}capture(e,n,o){o?this.instance.capture(e,n,{timestamp:o.timestamp,uuid:o.uuid,$set:o.set,$set_once:o.setOnce}):this.instance.capture(e,n)}registerDynamicEventProperties(e){return pte(this.instance.pu(e))}handleRemoteConfig(e){this.Io||(this.cu=e,this.instance.vu.emit(qrt,e))}sendRequest(e){var n=this;return Vg(function*(o,i={}){var r;const s=n.instance.requestRouter.endpointFor((r=i.target)!==null&&r!==void 0?r:"api",o),a={method:i.method,url:i.query?kK(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:i.target==="flags"&&i.compression==="best-available"?uCe.Base64:void 0,timestampMode:i.sentAt};return i.transport==="sendBeacon"?(n.instance._send_request(a),{statusCode:202}):new Promise(A=>{a.callback=A,n.instance._send_request(a)})}).apply(this,arguments)}dispose(){this.Io||(this.Io=!0,this.fu.dispose())}};const FK={};let wye=0;const LK=()=>{},Xrt='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',HK="Surveys module not available",$rt="sanitize_properties is deprecated. Use before_send instead",Zrt="Invalid value for property_denylist config: ",E5n=/^[A-Za-z0-9_-]{1,400}$/,est=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,tst=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,B5n=["token","distinct_id",Iit],OK="posthog",S5n=t=>{const e={};return t&&t!=="unset"&&("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0)),e},Mye=t=>{var e;return sn({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:BEn(No?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:LK,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:nd&&eA(nd?.search)&&nd.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:(Un==null||(e=Un.location)===null||e===void 0?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(n){gi.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Bit,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:LK},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:DEn,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:S5n(n),external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n),cookieWinsOnConflict:!(!n||n==="unset"||"2026-08-29">n)}))(t))},b5n=[["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"]],nst=t=>{const e={};for(const[i,r]of b5n)Bo(t[i])||(e[r]=t[i]);const n=Cg({},e,t),o=t.__preview_external_dependency_versioned_paths;return Bo(o)||(Bo(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),eA(o)&&Bo(t.asset_host)&&(n.asset_host=o)),rs(t.property_blacklist)&&(Bo(t.property_denylist)?n.property_denylist=t.property_blacklist:rs(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:gi.error(Zrt+t.property_denylist)),n};var Q5n=class{constructor(){this.__forceAllowLocalhost=!1}get gu(){return this.__forceAllowLocalhost}set gu(e){gi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},GK=class iM{mu(e){if(!e)return;const n=this.uu.indexOf(e);n!==-1&&this.uu.splice(n,1)}yu(e,n){var o;return this.mu(e),this.uu.push(n),(o=n.initialize)===null||o===void 0||o.call(n),n}bu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}_u(){if(this.wu||this.config.reuseAnonymousId||this.config.segment||this.bu())return;const e=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!e&&!this.config.disable_persistence||this.ku)return;let n,o,i;e?(n=`persistence is set to '${this.config.persistence}'`,o=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(n="persistence is disabled (disable_persistence is true)",o="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.wu=!0,console.warn("[PostHog.js]",`${n} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${o}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${i}`)}Su(){if(this.bu()||this.get_distinct_id()!=="$posthog_cookieless")return;const e=this.persistence;if(!e)return;this.xu()||e.load(!0);const n=this.get_distinct_id();if(!n||n==="$posthog_cookieless"){const o=this.config.get_device_id(y4());this.register({distinct_id:o,$device_id:o}),e.set_property(sy,o8)}this.Cu()}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.$u=!1,this.Tu=!1,this.webPerformance=new Q5n,this.Iu=!1,this.version=Fm.LIB_VERSION,this.Mu=new Set,this.Eu="",this.vu=new fte,this.uu=[],this.Pu=[],this.ku=!1,this.wu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Mye(),this.SentryIntegration=OEn,this.sentryIntegration=o=>(function(i,r){const s=trt(i,r);return{name:ert,processEvent:a=>s(a)}})(this,o),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new c5n(this),this.pageViewManager=new nrt(this),this.rateLimiter=new qEn(this),this.requestRouter=new h5n(this),this.consent=new MEn(this),this.externalIntegrations=new I5n(this);const n=(e=iM.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(o,i,r)=>{const s=eA(o)?{[o]:i}:o;this.setPersonProperties(s),r?.({})},set_once:(o,i,r)=>{const s=eA(o)?{[o]:i}:o;this.setPersonProperties(void 0,s),r?.({})}},this.on("eventCaptured",o=>gi.info(`send "${o?.event}"`,o))}init(e,n,o){if(o&&o!==OK){var i;const r=(i=FK[o])!==null&&i!==void 0?i:new iM;return r._init(e,n,o),FK[o]=r,FK[OK][o]=r,r}return this._init(e,n,o)}_init(e,n={},o){var i,r,s;const a=eA(e)?e.trim():"";if(!a)return gi.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var A;if(this.__loaded)return a!==((A=this.config)===null||A===void 0?void 0:A.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Mye(n.defaults),n.debug=this.Du(n.debug),this.Lu=n,this.Nu=[],n.person_profiles?this.Fu=n.person_profiles:n.process_person&&(this.Fu=n.process_person);const c=Mye(n.defaults),l=nst(n),g=Cg({},c,l,{name:o,token:a});CA(c.rageclick)&&CA(l.rageclick)&&(g.rageclick=Cg({},c.rageclick,l.rageclick)),CA(c.session_recording)&&CA(l.session_recording)&&(g.session_recording=Cg({},c.session_recording,l.session_recording)),this.set_config(g),this.config.on_xhr_error&&gi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:y3.GZipJS;const u=this.xu();if(this.persistence=new hye(this.config,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new hye(sn(sn({},this.config),{},{persistence:"sessionStorage"}),u,!1),this.Eu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!u&&j0.Et()){const _=j0.Dt(this.Eu);rs(_)&&_.forEach(f=>{eA(f)&&this.Mu.add(f)})}else j0.Lt(this.Eu);const h=sn({},this.persistence.props),d=sn({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new s5n((_,f)=>this.ju(_,f),this.config.request_queue_config),this.Bu=new A5n(this),this.__request_queue=[];const p=this.bu();p||(this.sessionManager=new Yrt(this),this.sessionPropsManager=new Ort(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((_,f,I)=>{(I?.activityTimeout||I?.sessionPastMaximumLength||I?.crossTabAdoption)&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(gi.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(p)},0)):(gi.info("Initializing extensions synchronously"),this.Uu(p)),Fm.DEBUG=Fm.DEBUG||this.config.debug,Fm.DEBUG&&gi.info("Starting in debug mode",{this:this,config:n,thisC:sn({},this.config),p:h,s:d}),this.config.identity_distinct_id&&!(!((i=n.bootstrap)===null||i===void 0)&&i.distinctID)&&(n.bootstrap=sn(sn({},n.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const m=(r=n.bootstrap)===null||r===void 0?void 0:r.distinctID;if(this.ku=!!m&&!gK(m),(s=n.bootstrap)===null||s===void 0?void 0:s.distinctID){const _=n.bootstrap.distinctID,f=this.get_distinct_id(),I=this.persistence.get_property(sy);if(n.bootstrap.isIdentifiedID&&f!=null&&f!==_&&I==="anonymous")this.identify(_);else if(n.bootstrap.isIdentifiedID&&f!=null&&f!==_&&I==="identified")gi.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 C=this.config.get_device_id(y4()),y=n.bootstrap.isIdentifiedID?C:_;this.persistence.set_property(sy,n.bootstrap.isIdentifiedID?ste:o8),this.register({distinct_id:_,$device_id:y})}}if(p)this.register_once({distinct_id:jCe,$device_id:null},"");else if(!this.get_distinct_id()){const _=this.config.get_device_id(y4());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(sy,o8)}return dl(Un,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),dl(Un,"pageshow",()=>{var _;this.$u=!1,this.Tu||(_=this.Bu)===null||_===void 0||_.resume()}),n.segment?Zit(this,()=>this.Wu()):this.Wu(),M_(this.config._onCapture)&&this.config._onCapture!==LK&&(gi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this.config.ip&&gi.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 Krt.apply(this,arguments)})().then(_=>{_&&this.register({[kCe]:_})}).catch(LK),this}Vu(e){const n=e;return eA(n.name)&&M_(n.setup)}Gu(e,n){this.Vu(e)?n.push(()=>{this.Zu().add(e).catch(()=>{var o;return(o=e.dispose)===null||o===void 0?void 0:o.call(e)}).catch(o=>{gi.error(`Failed to dispose browser extension "${e.name}"`,o)})}):this.uu.push(e)}zu(){var e,n,o;const i=(e=(n=this.config.__extensionClasses)===null||n===void 0?void 0:n.featureFlags)!==null&&e!==void 0?e:(o=iM.__defaultExtensionClasses)===null||o===void 0?void 0:o.featureFlags;var r,s,a;i&&(this.featureFlags&&this.featureFlags instanceof i||((r=this.Qu)===null||r===void 0||r.call(this),this.Qu=void 0,this.featureFlags=new i(this)),M_(this.featureFlags.onReloading)&&M_(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.vu.emit("featureFlagsReloading",!0)}),this.Zu().add(this.featureFlags)):(s=(a=this.featureFlags).initialize)===null||s===void 0||s.call(a))}Uu(e){const n=performance.now(),o=sn(sn({},iM.__defaultExtensionClasses),this.config.__extensionClasses),i=[];var r,s,a,A,c,l,g;o.exceptions&&this.uu.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new o.exceptions(this)),o.historyAutocapture&&this.uu.push(this.historyAutocapture=new o.historyAutocapture(this)),o.tracingHeaders&&this.uu.push(this.tracingHeaders=new o.tracingHeaders(this)),o.siteApps&&this.uu.push(this.siteApps=new o.siteApps(this)),o.sessionRecording&&!e&&this.uu.push(this.sessionRecording=new o.sessionRecording(this)),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),o.autocapture&&this.Gu(this.autocapture=new o.autocapture(this),i),o.surveys&&this.Gu(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new o.surveys(this),i),o.logs&&this.Gu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new o.logs(this),i),o.metrics&&this.uu.push(this.metrics=(A=this.metrics)!==null&&A!==void 0?A:new o.metrics(this)),o.conversations&&this.uu.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new o.conversations(this)),o.productTours&&this.uu.push(this.productTours=new o.productTours(this)),o.heatmaps&&this.uu.push(this.heatmaps=new o.heatmaps(this)),o.webVitalsAutocapture&&this.uu.push(this.webVitalsAutocapture=new o.webVitalsAutocapture(this)),o.exceptionObserver&&this.uu.push(this.exceptionObserver=new o.exceptionObserver(this)),o.deadClicksAutocapture&&this.uu.push(this.deadClicksAutocapture=new o.deadClicksAutocapture(this,HEn)),o.toolbar&&this.uu.push(this.toolbar=(l=this.toolbar)!==null&&l!==void 0?l:new o.toolbar(this)),o.experiments&&this.uu.push(this.experiments=(g=this.experiments)!==null&&g!==void 0?g:new o.experiments(this)),this.uu.forEach(u=>{u.initialize&&i.push(()=>{var h;(h=u.initialize)===null||h===void 0||h.call(u)})}),i.push(()=>{if(this.Ju){const u=this.Ju;this.Ju=void 0,this.uu.forEach(h=>{var d;return(d=h.onRemoteConfig)===null||d===void 0?void 0:d.call(h,u)})}}),this.Ku(i,n)}Ku(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout(()=>{this.Ku(e,n)},0);const i=e.shift();if(i)try{i()}catch(r){gi.error("Error initializing extension:",r)}}const o=Math.round(performance.now()-n);this.register_for_session({[Cit]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[yit]:o}),this.config.__preview_deferred_init_extensions&&gi.info(`PostHog extensions initialized (${o}ms)`)}il(e){var n;if(!No||!No.body)return gi.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.il(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=e),this.du=e,this.compression=void 0,e.ok){var o;const i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=ms(i.supportedCompression,y3.GZipJS)?y3.GZipJS:ms(i.supportedCompression,y3.Base64)?y3.Base64:void 0),!((o=i.analytics)===null||o===void 0)&&o.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:Bit}),(n=this.Xu)===null||n===void 0||n.handleRemoteConfig(e),this.uu.forEach(i=>{var r;return(r=i.onRemoteConfig)===null||r===void 0?void 0:r.call(i,e)})}Wu(){try{this.config.loaded(this)}catch(e){gi.critical("`loaded` function failed",e)}if(this.Yu(),this.config.internal_or_test_user_hostname&&nd?.hostname){const e=nd.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?e===n:n.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.bu())&&this.th()},1),this.eh=new frt(this),this.eh.load()}Yu(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.qu)===null||e===void 0||e.enable())}_dom_loaded(){this.is_capturing()&&rk(this.__request_queue,e=>this.ju(e)),this.__request_queue=[],this.Yu()}_handle_unload(){var e,n,o,i,r,s;this.$u=!0,(e=this.surveys)===null||e===void 0||(n=e.handlePageUnload)===null||n===void 0||n.call(e),(o=this.metrics)===null||o===void 0||o.flush("sendBeacon"),this.config.request_batching?(this.ih()&&this.capture(Sit),(i=this.logs)===null||i===void 0||i.flushLogs("sendBeacon"),(r=this.qu)===null||r===void 0||r.unload(),(s=this.Bu)===null||s===void 0||s.unload()):this.ih()&&this.capture(Sit,null,{transport:"sendBeacon"})}_send_request(e){Hrt(this,e)}ju(e,n){this.Bu?this.Bu.retriableRequest(e,n):this._send_request(n?sn(sn({},e),{},{transport:n}):e)}_execute_array(e){wye++;try{let n;const o=[],i=[],r=[];rk(e,a=>{if(a)if(n=a[0],rs(n))r.push(a);else if(M_(a))try{a.call(this)}catch(A){gi.error("Error executing queued PostHog call",a,A)}else rs(a)&&n==="alias"?o.push(a):rs(a)&&n.indexOf("capture")!==-1&&M_(this[n])?r.push(a):i.push(a)});const s=function(a,A){rk(a,function(c){try{if(rs(c[0])){let l=A;El(c,function(g){l=l[g[0]].apply(l,g.slice(1))})}else A[c[0]].apply(A,c.slice(1))}catch(l){gi.error("Error executing queued PostHog call",c,l)}})};s(o,this),s(i,this),s(r,this)}finally{wye--}}push(e){if(wye>0&&rs(e)&&eA(e[0])){const n=iM.prototype[e[0]];return void(M_(n)&&n.apply(this,e.slice(1)))}this._execute_array([e])}get nh(){return{property:sit,persistenceKey:nk,cookieName:"_fbc",pattern:est,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[nk]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(nk)}}}get sh(){return{property:ait,persistenceKey:mK,cookieName:"_fbp",pattern:tst,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[mK]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(mK)}}}rh(e){var n;const o=(n=this.persistence)===null||n===void 0?void 0:n.get_property(e.persistenceKey);return eA(o)&&e.pattern.test(o)?{value:o,delivered:!1}:CA(o)&&eA(o.value)&&e.pattern.test(o.value)?{value:o.value,delivered:o.delivered===!0}:void 0}oh(e,n,o){return n===o?.value?{value:n,pending:!o.delivered}:(e.register(n,!1),{value:n,pending:!0})}ah(e){if(!this.config.save_campaign_params||this.bu())return;const n=xK(e.cookieName);return eA(n)&&e.pattern.test(n)?n:void 0}uh(e,n,o,i){if(!this.persistence)return;const r=this.nh;this.persistence.refreshKey(r.persistenceKey);const s=this.rh(r);if(i)return void r.unregister();if(o)return eA(n)&&est.test(n)?this.oh(r,n,s):void r.unregister();const a=eA(e)&&E5n.test(e)?e:void 0,A=this.ah(r);return A&&((c,l,g)=>{const u=c.split(".");if(l)return u[3]===l;if(!g)return!0;const h=g.value.split(".");return u[3]===h[3]||Number(u[2])>Number(h[2])})(A,a,s)?this.oh(r,A,s):a?s?.value.split(".")[3]===a?{value:s.value,pending:!s.delivered}:this.oh(r,`fb.1.${Date.now()}.${a}`,s):s?{value:s.value,pending:!s.delivered}:void 0}hh(e,n,o){if(!this.persistence)return;const i=this.sh;this.persistence.refreshKey(i.persistenceKey);const r=this.rh(i);if(o)return void i.unregister();if(n)return eA(e)&&tst.test(e)?this.oh(i,e,r):void i.unregister();const s=this.ah(i);return s?this.oh(i,s,r):r?{value:r.value,pending:!r.delivered}:void 0}dh(e,n){if(!this.persistence)return;this.persistence.refreshKey(e.persistenceKey);const o=this.rh(e);o?.value!==n||o.delivered||e.register(n,!0)}capture(e,n,o){var i,r;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void gi.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Bo(e)||!eA(e))return void gi.error("No event name provided to posthog.capture");this.Su();const s=!this.config.opt_out_useragent_filter&&this._is_bot();if(s&&!this.config.__preview_capture_bot_pageviews)return;const a=o?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a?.isRateLimited)return void gi.critical("This capture call is ignored due to client rate limiting.");let A;n?.$current_url&&!eA(n?.$current_url)&&(gi.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),e!=="$exception"||o?.fh||gi.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(A=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const c=new Date,l=o?.timestamp||c,g=Sot(o?.uuid,y4);let u={uuid:g,event:e,properties:this.calculateEventProperties(e,n||{},l,g)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&s&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),a&&(u.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);const h=e==="$feature_flag_called"&&u.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;o?.$set&&!h&&(u.$set=o?.$set);const d=CA(n?.$set)?n.$set:void 0,p=rs(n?.$unset)?n.$unset:[],m=o?.$unset||[],_=R=>{var F;const G=!!o?.$set&&R in o.$set;return{hasProvided:G||!!d&&R in d,provided:G?o==null||(F=o.$set)===null||F===void 0?void 0:F[R]:d?.[R],unset:p.indexOf(R)!==-1||m.indexOf(R)!==-1}},f=_(sit),I=_(ait),C=[{channel:this.nh,hasProvided:f.hasProvided,update:this.uh(A?.fbclid,f.provided,f.hasProvided,f.unset)},{channel:this.sh,hasProvided:I.hasProvided,update:this.hh(I.provided,I.hasProvided,I.unset)}];for(const{channel:R,hasProvided:F,update:G}of C)G&&u.properties.$process_person_profile===!0&&G.pending&&!F&&!h&&(u.$set=sn({[R.property]:G.value},u.$set));const y=o?.$unset;y&&(u.$unset=y);const x=h?void 0:this.ph(o?.$set_once,e!==Qit,e===bit);if(x&&(u.$set_once=x),o?._noTruncate||(E=this.config.properties_string_max_length,u=(function(R,F){const G=new Set;return(function U(Y,J){if(Y!==Object(Y))return F?F(Y):Y;if(G.has(Y))return;let ee;if(G.add(Y),rs(Y))ee=[],rk(Y,j=>{ee.push(U(j))});else{const j={};El(ZT(Y)?vit(Y):Y,(X,ie)=>{G.has(X)||(j[ie]=U(X))}),ee=j}return ee})(R)})(u,R=>eA(R)?R.slice(0,E):R)),u.timestamp=l,Bo(o?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=c),h&&(u.properties=((R,F=[])=>{const G={},U=Y=>{R[Y]!==void 0&&(G[Y]=R[Y])};return F3n.forEach(U),F.forEach(U),G})(u.properties,B5n)),e===r8.DISMISSED||e===r8.SENT){const R=n?.[mye.SURVEY_ID],F=n?.[mye.SURVEY_ITERATION];jrt({id:R,current_iteration:F}),u.$set=sn(sn({},u.$set),{},{[g5n({id:R,current_iteration:F},e===r8.SENT?"responded":"dismissed")]:!0})}else e===r8.SHOWN&&(u.$set=sn(sn({},u.$set),{},{[mye.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var E;if(e===jEn.SHOWN){const R=n?.[mrt.TOUR_TYPE];R&&(u.$set=sn(sn({},u.$set),{},{[`${mrt.TOUR_LAST_SEEN_DATE}/${R}`]:new Date().toISOString()}))}const B=sn(sn({},u.properties.$set),u.$set);if(z2(B)||this.setPersonPropertiesForFlags(B),!zs(this.config.before_send)){const R=this.Os(u);if(!R)return;u=R,u.uuid=Sot(u.uuid,y4)}const b=C.filter(({channel:R,update:F})=>{var G,U,Y;const J=(G=(U=u.$set)===null||U===void 0?void 0:U[R.property])!==null&&G!==void 0?G:CA((Y=u.properties)===null||Y===void 0?void 0:Y.$set)?u.properties.$set[R.property]:void 0;return F?.pending&&J===F.value});this.vu.emit("eventCaptured",u);const Q=(i=o?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),w=o?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(Q),M=sn(sn(sn({method:"POST",url:Q,data:u,compression:"best-available",preferSyncCompression:o?.send_instantly,timestampMode:w?"body":"capture-body",batchKey:o?._batchKey},w&&(!((r=u.properties)===null||r===void 0)&&r.$session_id)?{batchGroup:u.properties.$session_id+(u.properties.$window_id?`-${u.properties.$window_id}`:"")}:{}),o?.transport?{transport:o.transport}:{}),b.length?{fireCallbackOnDrop:!0,callback:R=>{if(R.statusCode>=200&&300>R.statusCode)for(const{channel:F,update:G}of b)this.dh(F,G.value)}}:{});if(!this.config.request_batching||o&&!o?._batchKey||o?.send_instantly||b.length){var k;let R;!M.transport&&!M.callback&&z2((k=this.config.request_headers)!==null&&k!==void 0?k:{})&&this.$u&&(R="sendBeacon"),this.ju(M,R)}else this.qu.enqueue(M);return u}_addCaptureHook(e){return this.on("eventCaptured",n=>e(n.event,n))}getExtension(e){var n;return(n=this.Xu)===null||n===void 0?void 0:n.getExtension(e)}Zu(){var e;return(e=this.Xu)!==null&&e!==void 0?e:this.Xu=new x5n(this)}pu(e){this.Pu.push(e);let n=!0;return()=>{if(!n)return;n=!1;const o=this.Pu.indexOf(e);o!==-1&&this.Pu.splice(o,1)}}gh(e=!0){var n,o,i;return!!(!((n=this.persistence)===null||n===void 0)&&n.consumeCookieIdentityChange())&&(this.Ou=null,this.persistence.get_property("$user_state")==="anonymous"&&((i=this.sessionPersistence)===null||i===void 0||i.clear(),this.Mu.clear(),this.mh()),(o=this.featureFlags)===null||o===void 0||o.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,n,o,i,r){if(o=o||new Date,!this.persistence||!this.sessionPersistence)return n;this.persistence.syncCookieProperties(),this.gh();const s=r?void 0:this.persistence.remove_event_timer(e);let a=sn({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.bu()&&(a[Iit]=!0),e==="$snapshot"){const f=sn(sn({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=f.distinct_id,(!eA(a.distinct_id)&&!zd(a.distinct_id)||gK(a.distinct_id))&&gi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}const A=(function(f,I,C,y=!1){var x,E,B,b;if(!iy)return{};const Q=f?[...uk,...I||[]]:[],[w,M]=Cot(iy),[k,R]=(function(se){for(let oe=0;xot.length>oe;oe++){const[ge,de,Ce]=xot[oe],le=se.match(ge);if(le){const _e=Ce&&se.match(Ce)||le;return[de,_e?.[1]||""]}}return["",""]})(iy),F=(function(){const se="u">typeof navigator?navigator:void 0;return se?.brave?{brave:!0}:{}})(),G={};Bo(C)||(G.detectGoogleSearchApp=C);const U={},Y=(x=navigator)===null||x===void 0||(x=x.userAgentData)===null||x===void 0?void 0:x.platform,J=(E=navigator)===null||E===void 0?void 0:E.maxTouchPoints,ee=Un==null||(B=Un.screen)===null||B===void 0?void 0:B.width,j=Un==null||(b=Un.screen)===null||b===void 0?void 0:b.height,X=Un?.devicePixelRatio;Bo(Y)||(U.userAgentDataPlatform=Y),Bo(J)||(U.maxTouchPoints=J),Bo(ee)||(U.screenWidth=ee),Bo(j)||(U.screenHeight=j),Bo(X)||(U.devicePixelRatio=X);const ie=Cg($Ce({$os:w,$os_version:M,$browser:fot(iy,navigator.vendor,F,G),$webview_app:k,$webview_app_version:R,$device:yot(iy),$device_type:r3n(iy,U),$timezone:urt(),$timezone_offset:zEn()}),{$current_url:wK(y?Yb(nd?.href):nd?.href,Q,MK),$host:nd?.host,$pathname:nd?.pathname,$raw_user_agent:iy.length>1e3?iy.substring(0,997)+"...":iy,$browser_version:i3n(iy,navigator.vendor,F,G),$browser_language:Art(),$browser_language_prefix:VEn(),$screen_height:Un?.screen.height,$screen_width:Un?.screen.width,$viewport_height:Un?.innerHeight,$viewport_width:Un?.innerWidth,$lib:e8.LIB_NAME,$lib_version:e8.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return e8.SDK_DIST_CHANNEL&&(ie.$sdk_dist_channel=e8.SDK_DIST_CHANNEL),ie})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:f,windowId:I}=this.sessionManager.checkAndGetSessionAndWindowId(r,o.getTime(),!0);a.$session_id=f,a.$window_id=I}this.sessionPropsManager&&Cg(a,this.sessionPropsManager.getSessionProps());try{var c;this.sessionRecording&&Cg(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(c=this.Bu)===null||c===void 0?void 0:c.length}catch(f){a.$sdk_debug_error_capturing_properties=String(f)}let l;if(this.requestRouter.region===Pye&&(a.$lib_custom_api_host=this.config.api_host),l=e!=="$pageview"||r?e!=="$pageleave"||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(o):this.pageViewManager.doPageView(o,i),a=Cg(a,l),e==="$pageview"&&No&&(a.title=No.title),!Bo(s)){const f=o.getTime()-s;a.$duration=parseFloat((f/1e3).toFixed(3))}iy&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");const g=this.persistence.properties(),u=this.sessionPersistence.properties(),h=a.$groups,d=g.$groups;CA(h)&&!z2(h)&&(a.$groups=sn(sn({},CA(d)?d:{}),h)),El(["$referrer","$referring_domain"],f=>{f in g&&delete u[f]});const p={};if(this.Pu.length>0)for(const f of this.Pu.slice())try{Cg(p,f())}catch(I){gi.error("Failed to produce browser extension event properties",I)}a=Cg({},A,g,u,sn(sn({},p),a)),a.$is_identified=this._isIdentified(),rs(this.config.property_denylist)?El(this.config.property_denylist,function(f){delete a[f]}):gi.error(Zrt+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const m=this.config.sanitize_properties;m&&(gi.error($rt),a=m(a,e));const _=this.yh();return a.$process_person_profile=_,_&&!r&&this.bh("_calculate_event_properties"),a}ph(e,n=!0,o=!1){var i;if(!this.persistence||!this.yh()||this.Iu&&!o)return e;const r=this.persistence.get_initial_props(),s=(i=this.sessionPropsManager)===null||i===void 0?void 0:i.getSetOnceProps();let a=Cg({},r,s||{},e||{});const A=this.config.sanitize_properties;return A&&(gi.error($rt),a=A(a,"$set_once")),n&&(this.Iu=!0),z2(a)?void 0:a}register(e,n){var o;(o=this.persistence)===null||o===void 0||o.register(e,n)}register_once(e,n,o){var i;(i=this.persistence)===null||i===void 0||i.register_once(e,n,o)}register_for_session(e){var n,o;(n=this.persistence)===null||n===void 0||n.syncCookieProperties(),this.gh(),(o=this.sessionPersistence)===null||o===void 0||o.register(e),Object.keys(e).forEach(i=>this.Mu.add(i)),this.mh()}unregister(e){var n;(n=this.persistence)===null||n===void 0||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(e),this.Mu.delete(e),this.mh()}_h(e,n){this.register({[e]:n})}Hu(){this.Mu.forEach(e=>{var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(e)}),this.Mu.clear(),this.mh()}mh(){var e;if(!this.Eu)return;if(this.config.persistence==="memory"||!((e=this.sessionPersistence)===null||e===void 0)&&e.mi||!j0.Et())return void j0.Lt(this.Eu);const n=[];this.Mu.forEach(o=>n.push(o)),n.length>0?j0.At(this.Eu,n):j0.Lt(this.Eu)}getFeatureFlag(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlagResult(e,n)}getAllFeatureFlags(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,n){var o,i;return(o=(i=this.featureFlags)===null||i===void 0?void 0:i.isFeatureEnabled(e,n))!==null&&o!==void 0?o:n?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)===null||e===void 0||e.reloadFeatureFlags()}updateFlags(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateFlags(e,n,o)}updateEarlyAccessFeatureEnrollment(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateEarlyAccessFeatureEnrollment(e,n,o)}getEarlyAccessFeatures(e,n=!1,o){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getEarlyAccessFeatures(e,n,o)}on(e,n){return this.vu.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:HK}),()=>{})}onSessionId(e){var n,o;return(n=(o=this.sessionManager)===null||o===void 0?void 0:o.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n=!1){this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:HK})}getActiveMatchingSurveys(e,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:HK})}renderSurvey(e,n){var o;(o=this.surveys)===null||o===void 0||o.renderSurvey(e,n)}displaySurvey(e,n=m5n){var o;(o=this.surveys)===null||o===void 0||o.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)===null||n===void 0||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,o;return(n=(o=this.surveys)===null||o===void 0?void 0:o.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:HK}}canRenderSurveyAsync(e,n=!1){var o,i;return(o=(i=this.surveys)===null||i===void 0?void 0:i.canRenderSurveyAsync(e,n))!==null&&o!==void 0?o:Promise.resolve({visible:!1,disabledReason:HK})}wh(e){return!e||gK(e)?(gi.critical("Unique user id has not been set in posthog.identify"),!1):e==="$posthog_cookieless"?(gi.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(gi.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(e,n,o){if(!this.__loaded||!this.persistence)return gi.uninitializedWarning("posthog.identify");if(zd(e)&&(e=e.toString(),gi.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wh(e)||!this.bh("posthog.identify"))return;this.Su();const i=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,s=this.gh(!1),a=this.persistence.Da();let A=!1;try{const l=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property("__alias")&&(this.unregister(ite),this.register({distinct_id:e}));const g=(this.persistence.get_property("$user_state")||"anonymous")===o8,u=e!==l,h=!u&&g;if(u&&g){var c;const d=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:l};this.persistence.set_property(sy,ste),this.setPersonPropertiesForFlags({$set:n||{},$set_once:o||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$identify",d,{$set:n||{},$set_once:o||{}})&&(this.Ou=vye(e,n,o)),(c=this.featureFlags)===null||c===void 0||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(h){this.persistence.set_property(sy,ste);const d=n||{},p=o||{};this.setPersonPropertiesForFlags({$set:d,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$set",{$set:d,$set_once:p})&&(this.Ou=vye(e,n,o))}else(n||o)&&this.setPersonProperties(n,o);u||r||s?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(zb)):h&&(n||o)&&this.reloadFeatureFlags(),A=!0}finally{a&&this.persistence.ja(A)}}setPersonProperties(e,n){if(!e&&!n||!this.bh("posthog.setPersonProperties"))return;const o=vye(this.get_distinct_id(),e,n);this.Ou!==o?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:n||{}},!0),this.capture("$set",{$set:e||{},$set_once:n||{}})&&(this.Ou=o)):gi.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var n;const o=(rs(e)?e:[e]).filter(i=>eA(i)&&i.length>0);o.length!==0&&this.bh("posthog.unsetPersonProperties")&&((n=this.featureFlags)===null||n===void 0||n.unsetPersonPropertiesForFlags(o,!0),this.capture("$set",{$unset:o}),this.Ou=null)}group(e,n,o){var i;if(!e||!n)return void gi.error("posthog.group requires a group type and group key");(i=this.persistence)===null||i===void 0||i.syncCookieProperties(),this.gh();const r=this.getGroups(),s=r[e]!==n;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:sn(sn({},r),{},{[e]:n})}),(s||o)&&this.yh()){const a={$group_type:e,$group_key:n};o&&(a.$group_set=o),this.capture(Qit,a)}o&&this.setGroupPropertiesForFlags({[e]:o}),s&&!o&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n=!0){var o;(o=this.featureFlags)===null||o===void 0||o.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(e=!0){var n;(n=this.featureFlags)===null||n===void 0||n.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,n=!0){var o;this.bh("posthog.setGroupPropertiesForFlags")&&((o=this.featureFlags)===null||o===void 0||o.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)===null||n===void 0||n.resetGroupPropertiesForFlags(e)}reset(e){const n=ry(e)?e:e?.resetDeviceID,o=ry(e)||e==null?void 0:e.bootstrap;this.kh(n,!1,o)}kh(e,n=!1,o){var i,r,s,a,A,c;if(gi.info("reset"),!this.__loaded)return gi.uninitializedWarning("posthog.reset");const l=o?.sessionID;this.config.bootstrap=o||((i=this.Lu)===null||i===void 0?void 0:i.bootstrap)||{},(r=this.featureFlags)===null||r===void 0||(s=r.updateConfig)===null||s===void 0||s.call(r,this.config,this.nl());const g=this.get_property(TCe),u=this.get_property(kCe),h=this.get_property(_K);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();const d=this.is_capturing();this.consent.reset(),n||!d||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const p=(A=this.persistence)===null||A===void 0||(c=A.Da)===null||c===void 0?void 0:c.call(A);let m=!1;try{var _,f,I,C,y,x,E,B,b,Q,w,M,k;if((_=this.persistence)===null||_===void 0||_.clear(),(f=this.sessionPersistence)===null||f===void 0||f.clear(),this.Mu.clear(),this.mh(),Bo(h)||(Q=this.persistence)===null||Q===void 0||Q.register({$session_recording_remote_config:h}),(I=this.surveys)===null||I===void 0||I.reset(),(C=this.featureFlags)===null||C===void 0||C.reset(),(y=this.conversations)===null||y===void 0||y.reset(),(x=this.logs)===null||x===void 0||x.reset(),(E=this.metrics)===null||E===void 0||E.reset(),(B=this.persistence)===null||B===void 0||B.set_property("$user_state","anonymous"),(b=this.sessionManager)===null||b===void 0||b.resetSessionId(),this.Ou=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:jCe,$device_id:null},"");else{const G=this.config.get_device_id(y4());this.register_once({distinct_id:G,$device_id:e?G:g},""),e||Bo(u)||this.register({[kCe]:u})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),o&&(o.distinctID&&!this.bu()&&((k=this.persistence)===null||k===void 0||k.set_property("$user_state",o.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.distinctID})),(w=this.featureFlags)===null||w===void 0||w.initialize(),!zs(l)&&!(!((M=this.sessionManager)===null||M===void 0)&&M.setBootstrapSessionId(l,!0)))){const G=sn({},o);delete G.sessionID,this.config.bootstrap=G}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,m=!0}finally{var R,F;p&&((R=this.persistence)===null||R===void 0||(F=R.ja)===null||F===void 0||F.call(R,m))}this.reloadFeatureFlags()}shutdown(e){var n=this;return Vg(function*(){var o,i,r,s,a,A,c,l;if(n.__loaded){n.Tu=!0,n.Zu().dispose(),(o=n.sessionRecording)===null||o===void 0||o.dispose(),(i=n.logs)===null||i===void 0||i.flushLogs("sendBeacon"),(r=n.metrics)===null||r===void 0||r.flush("sendBeacon"),(s=n.metrics)===null||s===void 0||s.dispose(),(a=n.qu)===null||a===void 0||a.unload(),(A=n.Bu)===null||A===void 0||A.unload();try{var g;(g=n.featureFlags)===null||g===void 0||g.destroy()}catch(u){gi.error("Error while destroying feature flags",u)}(c=n.persistence)===null||c===void 0||c.destroy(),(l=n.sessionPersistence)===null||l===void 0||l.destroy()}else gi.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,n){var o;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=n,this.alias(e),(o=this.conversations)===null||o===void 0||o.Sh()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(e=this.conversations)===null||e===void 0||e.xh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";const{sessionId:n,sessionStartTimestamp:o}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let i=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${n}`);if(e?.withTimestamp&&o){var r;const s=(r=e.timestampLookBack)!==null&&r!==void 0?r:10;if(!o)return i;i+=`?t=${Math.max(Math.floor((new Date().getTime()-o)/1e3)-s,0)}`}return i}alias(e,n){return e===this.get_property("$people_distinct_id")?(gi.critical("Attempting to create alias for existing People user - aborting."),-2):this.bh("posthog.alias")?(Bo(n)&&(n=this.get_distinct_id()),e!==n?(this._h(ite,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(gi.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const n=sn({},this.config);if(CA(e)){var o,i,r,s,a,A,c,l,g,u,h,d,p,m;Cg(this.config,nst(e));const f=this.xu();(o=this.persistence)===null||o===void 0||o.update_config(this.config,n,f),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new hye(sn(sn({},this.config),{},{persistence:"sessionStorage"}),f,!1);const I=this.Du(this.config.debug);var _;ry(I)&&(this.config.debug=I),ry(this.config.debug)&&(this.config.debug?(Fm.DEBUG=!0,cc.Et()&&cc.At("ph_debug",!0),gi.info("set_config",{config:e,oldConfig:n,newConfig:sn({},this.config)})):(Fm.DEBUG=!1,cc.Et()&&cc.Lt("ph_debug"))),(i=this.featureFlags)===null||i===void 0||(r=i.updateConfig)===null||r===void 0||r.call(i,this.config,this.nl()),(s=this.exceptionObserver)===null||s===void 0||s.onConfigChange(),(a=this.exceptions)===null||a===void 0||a.onConfigChange(),(A=this.metrics)===null||A===void 0||A.onConfigChange(),(c=this.sessionRecording)===null||c===void 0||c.startIfEnabledOrStop(),(l=this.tracingHeaders)===null||l===void 0||l.startIfEnabledOrStop(),(g=this.autocapture)===null||g===void 0||g.startIfEnabled(),(u=this.heatmaps)===null||u===void 0||u.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&((_=this.historyAutocapture)===null||_===void 0||_.startIfEnabledOrStop()),(h=this.exceptionObserver)===null||h===void 0||h.startIfEnabledOrStop(),(d=this.deadClicksAutocapture)===null||d===void 0||d.startIfEnabledOrStop(),(p=this.surveys)===null||p===void 0||p.loadIfEnabled(),this.Cu(),(m=this.externalIntegrations)===null||m===void 0||m.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&Zit(this,LK,!1)}}_overrideSDKInfo(e,n){Fm.LIB_NAME=e,Fm.LIB_VERSION=n}startSessionRecording(e){const n=e===!0,o={sampling:n||!!e?.sampling,linked_flag:n||!!e?.linked_flag,url_trigger:n||!!e?.url_trigger,event_trigger:n||!!e?.event_trigger};var i,r,s,a,A;Object.values(o).some(Boolean)&&((i=this.sessionManager)===null||i===void 0||i.checkAndGetSessionAndWindowId(),o.sampling&&((r=this.sessionRecording)===null||r===void 0||r.overrideSampling()),o.linked_flag&&((s=this.sessionRecording)===null||s===void 0||s.overrideLinkedFlag()),o.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),o.event_trigger&&((A=this.sessionRecording)===null||A===void 0||A.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!!(!((e=this.sessionRecording)===null||e===void 0)&&e.started)}captureException(e,n){try{if(!this.exceptions)return;const o=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(sn(sn({},o),n))}catch{return}}addExceptionStep(e,n){var o;(o=this.exceptions)===null||o===void 0||o.addExceptionStep(e,n)}captureLog(e){var n;(n=this.logs)===null||n===void 0||n.captureLog(e)}get logger(){var e,n;return(e=(n=this.logs)===null||n===void 0?void 0:n.logger)!==null&&e!==void 0?e:iM.Ch}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,o;return(n=(o=this.toolbar)===null||o===void 0?void 0:o.loadToolbar(e))!==null&&n!==void 0&&n}get_property(e){var n;return(n=this.persistence)===null||n===void 0?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)===null||n===void 0?void 0:n.props[e]}toString(){var e;let n=(e=this.config.name)!==null&&e!==void 0?e:OK;return n!==OK&&(n="posthog."+n),n}_isIdentified(){var e,n;return((e=this.persistence)===null||e===void 0?void 0:e.get_property("$user_state"))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property("$user_state"))==="identified"}yh(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&z2(this.getGroups())&&!(!((e=this.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e.__alias)&&!(!((n=this.persistence)===null||n===void 0||(n=n.props)===null||n===void 0)&&n.$epp))}ih(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.yh()||this.bh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bh(e){return this.config.person_profiles==="never"?(gi.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._u(),this._h(WCe,!0),!0)}xu(){if(this.config.cookieless_mode==="always")return!0;const e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}Cu(){var e,n;const o=this.xu();var i,r,s;return this.is_capturing()||(i=this.logs)===null||i===void 0||i.$h(),((e=this.persistence)===null||e===void 0?void 0:e.mi)!==o&&((r=this.persistence)===null||r===void 0||r.set_disabled(o)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.mi)!==o&&((s=this.sessionPersistence)===null||s===void 0||s.set_disabled(o)),o&&(this.Mu.clear(),this.mh()),o}opt_in_capturing(e){var n;if(this.config.cookieless_mode!=="always"){if(this.bu()){var o,i,r,s,a,A;(o=this.sessionRecording)===null||o===void 0||o.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),(i=this.sessionManager)===null||i===void 0||i.destroy(),(r=this.pageViewManager)===null||r===void 0||r.destroy(),this.sessionManager=new Yrt(this),this.pageViewManager=new nrt(this),this.persistence&&(this.sessionPropsManager=new Ort(this,this.sessionManager,this.persistence));const h=(s=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&s!==void 0?s:(A=iM.__defaultExtensionClasses)===null||A===void 0?void 0:A.sessionRecording;var c,l;h&&(this.sessionRecording=this.yu(this.sessionRecording,new h(this)),this.du&&((c=this.sessionRecording)===null||c===void 0||(l=c.onRemoteConfig)===null||l===void 0||l.call(c,this.du)))}var g,u;this.consent.optInOut(!0),this.Cu(),this.Yu(),(n=this.sessionRecording)===null||n===void 0||n.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((g=this.surveys)===null||g===void 0||g.loadIfEnabled()),(Bo(e?.captureEventName)||e?.captureEventName)&&this.capture((u=e?.captureEventName)!==null&&u!==void 0?u:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else gi.warn(Xrt)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void gi.warn(Xrt);const e=this.config.cookieless_mode==="on_reject"?this.sessionRecording:void 0;var n,o;e?.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.Cu(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:jCe,$device_id:null}),this.mu(e),this.sessionRecording=void 0,(n=this.sessionManager)===null||n===void 0||n.destroy(),(o=this.pageViewManager)===null||o===void 0||o.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.th(),this.Yu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.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.Cu()}_is_bot(){return w_?Urt(w_,this.config.custom_blocked_useragents):void 0}th(){No&&(No.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(XCe,{title:No.title},{send_instantly:!0}),this.Au&&(No.removeEventListener(yK,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),dl(No,yK,this.Au)))}debug(e){e===!1?(Un?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Un?.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}))}nl(){const e=this.Lu||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(gi.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(n,o,i,r,s){const a=o in n&&!zs(n[o]),A=i in n&&!zs(n[i]);return a?n[o]:!!A&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${o}' instead. The old field will be removed in a future major version.`),n[i])})(e,"advanced_disable_flags","advanced_disable_decide",0,gi)}Os(e){var n;if(zs(this.config.before_send))return e;const o=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(Jxn),i=rs(this.config.before_send)?this.config.before_send:[this.config.before_send];let r=e;for(const s of i)try{if(r=s(r),zs(r)){const a=`Event '${e.event}' was rejected in beforeSend function`;return zxn(e.event)?gi.warn(`${a}. This can cause unexpected behavior.`):gi.info(a),null}r.properties&&!z2(r.properties)||gi.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return gi.error(`Error in beforeSend function for event '${e.event}':`,a),null}for(const s of o)if(r.properties&&zs(r.properties[s]))return gi.warn(`Event '${e.event}' had its '${s}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){var e;return(e=this.pageViewManager.Vo)===null||e===void 0?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,o){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(o)})}Du(e){const n=ry(e)&&!e,o=cc.Et()&&cc.Ot("ph_debug")==="true";return!n&&(!!o||e)}};GK.__defaultExtensionClasses={},GK.Ch=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),(function(t,e){for(let n=0;e.length>n;n++)t.prototype[e[n]]=xEn(t.prototype[e[n]])})(GK,["identify"]);var ost=class{constructor(e){this.disabled=e===!1;const n=CA(e)?e:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(e,n,o){if(this.disabled)return!1;const i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(n-i.y)<this.thresholdPx&&this.timeoutMs>o-i.timestamp){if(this.clicks.push({x:e,y:n,timestamp:o}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:o}];return!1}};const Dye="$copy_autocapture",Nye=id("[AutoCapture]");function Rye(t,e){return e.length>t?e.slice(0,t)+"...":e}function v5n(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do e=e.previousSibling;while(e&&!A9(e));return e}function P5n(t,{e,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:i,elementsChainAsString:r,disableCaptureUrlHashes:s}){var a,A;if(!A9(t))return{props:{}};const c=[t],l=new Set([t]);let g=t;for(;g.parentNode&&!H1(g,"body")&&1e3>c.length;){if(sye(g.parentNode)){const x=g.parentNode.host;if(l.has(x))break;l.add(x),c.push(x),g=x;continue}if(!A9(g.parentNode)||l.has(g.parentNode))break;l.add(g.parentNode),c.push(g.parentNode),g=g.parentNode}const u=e.type==="click"&&t.namespaceURI==="http://www.w3.org/2000/svg"?c.findIndex(x=>H1(x,"button")||H1(x,"a")):-1;u>0&&(o=o||c.slice(0,u+1).some(x=>!ck(x)||bK(x)));const h=[],d={};let p,m=!1,_=!1;if(El(c,x=>{const E=ck(x);if(H1(x,"a")&&!n&&!i?.includes("href")){const B=x.getAttribute("href");m=!!(E&&B&&QK(B))&&(s?Yb(B):B)}ms(Ak(x),"ph-no-capture")&&(_=!0),h.push((function(B,b,Q,w,M=!1){const k=B.tagName.toLowerCase(),R={tag_name:k};Aye.indexOf(k)>-1&&!Q&&(R.$el_text=k.toLowerCase()==="a"||k.toLowerCase()==="button"?Rye(1024,jit(B)):Rye(1024,BK(B)));const F=Ak(B);b||w?.includes("class")||0>=F.length||(R.classes=F.filter(function(J){return J!==""})),El(B.attributes,function(J){var ee;if((!bK(B)||["name","id","class","aria-label"].indexOf(J.name)!==-1)&&!w?.includes(J.name)&&!b&&QK(J.value)&&(!eA(ee=J.name)||ee.substring(0,10)!=="_ngcontent"&&ee.substring(0,7)!=="_nghost")){let j=J.value;J.name==="class"&&(j=aye(j).join(" ")),R["attr__"+J.name]=Rye(1024,J.name==="href"&&M?Yb(j):j)}});let G=1,U=1,Y=B;for(;Y=v5n(Y);)G++,Y.tagName===B.tagName&&U++;return R.nth_child=G,R.nth_of_type=U,R})(x,n,o,i,s)),El((function(B){if(!ck(B))return{};const b={};return El(B.attributes,function(Q){if(Q.name&&Q.name.indexOf("data-ph-capture-attribute")===0){const w=Q.name.replace("data-ph-capture-attribute-",""),M=Q.value;w&&M&&QK(M)&&(b[w]=M)}}),b})(x),(B,b)=>{({}).hasOwnProperty.call(d,b)||(d[b]=B)})}),_)return{props:{},explicitNoCapture:_};if(u>0&&(t=c[u],h.splice(0,u)),o||(h[0].$el_text=H1(t,"a")||H1(t,"button")?jit(t):BK(t)),m){var f,I;h[0].attr__href=m;const x=(f=Wb(m))===null||f===void 0?void 0:f.host,E=Un==null||(I=Un.location)===null||I===void 0?void 0:I.host;x&&E&&x!==E&&(p=m)}return{props:Cg((y=e.type,{$event_type:y,$ce_version:1}),r?{}:{$elements:h},{$elements_chain:(C=h,rs(C)?(function(x){return x.map(E=>{var B,b;let Q="";if(E.tag_name&&(Q+=E.tag_name),E.attr_class){E.attr_class.sort();for(const k of E.attr_class)Q+=`.${k.replace(/"/g,"")}`}const w=sn(sn(sn(sn({},E.text?{text:E.text}:{}),{},{"nth-child":(B=E.nth_child)!==null&&B!==void 0?B:0,"nth-of-type":(b=E.nth_of_type)!==null&&b!==void 0?b:0},E.href?{href:E.href}:{}),E.attr_id?{attr_id:E.attr_id}:{}),E.attributes),M={};return Ate(w).sort(([k],[R])=>(function(F,G){return G>F?-1:F>G?1:0})(k,R)).forEach(([k,R])=>M[Xit(k.toString())]=Xit(R.toString())),Q+=":",Q+=Ate(M).map(([k,R])=>`${k}="${R}"`).join(""),Q}).join(";")})((function(x){return x.map(E=>{var B,b;const Q={text:(B=E.$el_text)===null||B===void 0?void 0:B.slice(0,400),tag_name:E.tag_name,href:(b=E.attr__href)===null||b===void 0?void 0:b.slice(0,2048),attr_class:FEn(E),attr_id:E.attr__id,nth_child:E.nth_child,nth_of_type:E.nth_of_type,attributes:{}};return Ate(E).filter(([w])=>w.indexOf("attr__")===0).forEach(([w,M])=>Q.attributes[w]=M),Q})})(C)):"")},!((a=h[0])===null||a===void 0)&&a.$el_text?{$el_text:(A=h[0])===null||A===void 0?void 0:A.$el_text}:{},p&&e.type==="click"?{$external_click_url:p}:{},d),target:t};var C,y}var w5n=class{fo(){this.po=void 0,clearTimeout(this.mo),this.mo=void 0}yo(e){var n;if(!ck(e))return!0;const o=(n=this.bo().css_selector_ignorelist)!==null&&n!==void 0?n:gye,i=new Set;let r=e;for(;r;){if(i.size>=1e3||i.has(r))return!0;i.add(r);const s=r,a=Ak(s);if(ms(a,"ph-no-capture")||ms(a,"ph-sensitive")||bK(s)||o.some(c=>cye(s,c)))return!0;const A=r.parentNode;r=sye(A)?A.host:A&&A9(A)?A:null}return!1}_o(e){if(!this.isEnabled||e.type==="pointercancel")return void this.fo();if(e.type==="pointerdown"){this.fo();const i=SK(e);var n;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&A9(i)&&(this.po={target:i,excluded:this.yo(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(n=this.wo)===null||n===void 0?void 0:n.distinctId}))}const o=this.po;o&&(e.pointerId!==o.id||Math.abs(e.clientX-o.x)>5||Math.abs(e.clientY-o.y)>5?this.fo():e.type==="pointerup"&&(o.released=!0,this.mo=setTimeout(()=>this.fo(),0)))}ko(e){var n;const o=this.po;this.fo();const i=SK(e);if(o?.released&&o.target.isConnected&&o.distinctId===((n=this.wo)===null||n===void 0?void 0:n.distinctId)&&e.pointerId===o.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-o.x)&&5>=Math.abs(e.clientY-o.y)&&i&&(H1(i,"html")||H1(i,"body"))){var r;if(o.excluded)return null;const s=(r=this.bo().css_selector_ignorelist)!==null&&r!==void 0?r:gye;return[i,No?.documentElement,No?.body].some(a=>{if(!a)return!1;const A=Ak(a);return ms(A,"ph-no-capture")||ms(A,"ph-sensitive")||!ck(a)||bK(a)||s.some(c=>cye(a,c))})?null:o.target}}constructor(e){this.So=e,this.name="autocapture",this.xo=!1,this.Co=null,this.$o=!1,this.To=!1,this.Rr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Io=!1,this.So.refresh(this.Rr),this.rageclicks=new ost(this.Rr.rageclick),this.Mo=null}setup(e){this.Eo(),this.wo=e;const n=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.Io?n.dispose():(this.Po=n,this.startIfEnabled())}dispose(){var e;this.Io||(this.Io=!0,this.wo=void 0,(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,this.Ro())}bo(){return this.So.refresh(this.Rr),this.Rr}Eo(){var e,n;return this.bo(),this.Rr.url_allowlist=(e=this.Rr.url_allowlist)===null||e===void 0?void 0:e.map(o=>new RegExp(o)),this.Rr.url_ignorelist=(n=this.Rr.url_ignorelist)===null||n===void 0?void 0:n.map(o=>new RegExp(o)),this.Rr}Ao(){if(!this.isBrowserSupported())return void Nye.info("Disabling Automatic Event Collection because this browser is not supported");if(!Un||!No)return;const e=this.Fo=n=>{n=n||Un?.event;try{if(n.type==="blur")return void this.fo();if(n.type.indexOf("pointer")===0)return void this._o(n);const o=n.type==="click"?this.ko(n):void 0;if(od(o))return;this.Oo(n,"$autocapture",o)}catch(o){Nye.error("Failed to capture event",o)}};if(dl(Un,"blur",e),dl(No,"submit",e,{capture:!0}),dl(No,"change",e,{capture:!0}),dl(No,"click",e,{capture:!0}),El(["pointerdown","pointermove","pointerup","pointercancel"],n=>{dl(No,n,e,{capture:!0})}),this.bo().capture_copied_text){const n=this.Do=o=>{o=o||Un?.event;try{this.Oo(o,Dye)}catch(i){Nye.error("Failed to capture clipboard event",i)}};dl(No,"copy",n,{capture:!0}),dl(No,"cut",n,{capture:!0}),dl(No,"paste",n,{capture:!0})}}Ro(){this.fo(),this.Fo&&(Un?.removeEventListener("blur",this.Fo),El(["pointerdown","pointermove","pointerup","pointercancel"],e=>{No?.removeEventListener(e,this.Fo,!0)}),No?.removeEventListener("submit",this.Fo,!0),No?.removeEventListener("change",this.Fo,!0),No?.removeEventListener("click",this.Fo,!0),this.Fo=void 0),this.Do&&(No?.removeEventListener("copy",this.Do,!0),No?.removeEventListener("cut",this.Do,!0),No?.removeEventListener("paste",this.Do,!0),this.Do=void 0),this.xo=!1}startIfEnabled(){this.isEnabled||this.fo(),!this.Io&&this.wo&&this.isEnabled&&!this.xo&&(this.Ao(),this.xo=!0)}onRemoteConfig(e){if(this.Io)return;if(this.$o=!0,!e.ok)return void this.startIfEnabled();const n=e.config;n.elementsChainAsString&&(this.To=n.elementsChainAsString);const o=n.autocapture_opt_out;var i;ry(o)&&((i=this.wo)===null||i===void 0||i.kv.set("$autocapture_disabled_server_side",o),this.Co=o),this.startIfEnabled()}setElementSelectors(e){this.Mo=e}getElementSelectors(e,n){var o;const i=[];return(o=this.Mo)===null||o===void 0||o.forEach(r=>{const s=No?.querySelectorAll(r);s?.forEach(a=>{e!==a&&n!==a||ms(i,r)||i.push(r)})}),i}get isEnabled(){var e,n;if(this.Io)return!1;const o=(e=this.wo)===null||e===void 0?void 0:e.kv.get(Ait),i=this.Co,r=this.bo();if(!r.remoteRequestsDisabled&&!this.$o)return!1;const s=r.remoteRequestsDisabled&&!this.$o;if(od(i)&&!ry(o)&&!s)return!1;const a=(n=this.Co)!==null&&n!==void 0?n:!!o;return!!r.enabled&&!a}Oo(e,n="$autocapture",o){if(!this.isEnabled)return void this.fo();let i=o||SK(e);kit(i)&&(i=i.parentNode||null);const r=this.Eo();var s;n==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&r.rageclick&&(!((s=this.rageclicks)===null||s===void 0)&&s.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&Uit(i,r.rageclick)&&this.Oo(e,"$rageclick",o);const a=n===Dye,A=a?sn(sn({},r),{},{dom_event_allowlist:void 0}):r;if(i&&(function(u,h,d,p,m,_){var f;if(!Un||uye(u)||d?.url_allowlist&&!Fit(d.url_allowlist,_)||d?.url_ignorelist&&Fit(d.url_ignorelist,_))return!1;if(d?.dom_event_allowlist){const x=d.dom_event_allowlist;if(x&&!x.some(E=>h.type===E))return!1}const{parentIsUsefulElement:I,targetElementList:C}=Kit(u,p);if(!(function(x,E){const B=E?.element_allowlist;if(Bo(B))return!0;for(const b of x)if(B.some(Q=>b.tagName.toLowerCase()===Q))return!0;return!1})(C,d)||!lye(C,d?.css_selector_allowlist)||lye(C,(f=d?.css_selector_ignorelist)!==null&&f!==void 0?f:gye))return!1;try{const x=Un.getComputedStyle(u);if(x&&x.getPropertyValue("cursor")==="pointer"&&h.type==="click")return!0}catch{}const y=u.tagName.toLowerCase();switch(y){case"html":return!1;case"form":return(m||["submit"]).indexOf(h.type)>=0;case"input":case"select":case"textarea":return(m||["change","click"]).indexOf(h.type)>=0;default:return I?(m||["click"]).indexOf(h.type)>=0:(m||["click"]).indexOf(h.type)>=0&&(Aye.indexOf(y)>-1||u.getAttribute("contenteditable")==="true")}})(i,e,A,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var c;const{props:u,explicitNoCapture:h,target:d}=P5n(i,{e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(h)return!1;const p=this.getElementSelectors(i,d);if(p&&p.length>0&&(u.$element_selectors=p),n===Dye){const m=e.type||"clipboard";if(m!=="paste"){var l,g;const _=Un==null||(l=Un.getSelection())===null||l===void 0?void 0:l.toString(),f=Lit(_);if(!f)return!1;u.$selected_content=f,u.$clipboard_text_length=(g=_?.length)!==null&&g!==void 0?g:0}u.$copy_type=m}return(c=this.wo)===null||c===void 0||c.capture(n,u),!0}}isBrowserSupported(){return M_(No?.querySelectorAll)}},M5n=class{constructor(e){this._instance=e}refresh(e){const n=this._instance.config,o=CA(n.autocapture)?n.autocapture:void 0;e.enabled=!!n.autocapture,e.rageclick=n.rageclick,e.maskAllElementAttributes=n.mask_all_element_attributes,e.maskAllText=n.mask_all_text,e.disableCaptureUrlHashes=n.disable_capture_url_hashes,e.getCurrentUrl=n.get_current_url,e.remoteRequestsDisabled=this._instance.nl(),e.url_allowlist=o?.url_allowlist,e.url_ignorelist=o?.url_ignorelist,e.dom_event_allowlist=o?.dom_event_allowlist,e.element_allowlist=o?.element_allowlist,e.css_selector_allowlist=o?.css_selector_allowlist,e.css_selector_ignorelist=o?.css_selector_ignorelist,e.element_attribute_ignorelist=o?.element_attribute_ignorelist,e.capture_copied_text=o?.capture_copied_text}};const YK=id("[ExceptionAutocapture]"),ist=()=>{},rst=t=>{var e;if(M_(t))return(e=t.__posthog_layer__)!==null&&e!==void 0?e:t.__rrweb_layer__};function UK(t,e,n){try{if(!(e in t))return ist;const o={next:t[e]},i=n(function(...r){return o.next.apply(this,r)});return M_(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:o}})),t[e]=i,()=>{if(t[e]===i)return void(t[e]=o.next);let r=t[e],s=rst(r);for(;s;){if(s.next===i)return void(s.next=o.next);r=s.next,s=rst(r)}}}catch{return ist}}const D5n=id("[TracingHeaders]"),_M=id("[Web Vitals]"),sst=9e5,ast=["CLS","FCP","INP","LCP"],N5n=["INP","LCP"],R5n=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Tye="disabled",Ast="lazy_loading",a8=id("[SessionRecording]"),T5n=id("[Heatmaps]");function kye(t){return CA(t)&&"clientX"in t&&"clientY"in t&&zd(t.clientX)&&zd(t.clientY)}const yte=id("[Product Tours]"),Fye=t=>{var e;return!t.config.disable_product_tours&&!!(!((e=t.persistence)===null||e===void 0)&&e.get_property(UCe))},k5n=["$set_once","$set"],c9=id("[SiteApps]"),cst="Error while initializing PostHog app with config id ",lst=(t,e)=>t?.then?t.then(e):e(t),_k="SDK is not enabled or survey functionality is not yet loaded",gst="Disabled. Not loading surveys.";var F5n=class{constructor(e,n){this.So=e,this.Th=n,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=[],this.Eh=null,this.Ph=null,this.Io=!1,this.Rh=new Set,this.onRemoteConfig=o=>{if(this.Io||this.Rr.disableSurveys)return;if(!o.ok)return Bl.warn("Remote config unavailable. Not loading surveys.");const i=o.config.surveys;if(zs(i))return Bl.warn("Flags not loaded yet. Not loading surveys.");this.Ah=ry(i)?i:i.length>0,Bl.info(`flags response received, isSurveysEnabled: ${this.Ah}`),this.loadIfEnabled()}}setup(e){if(!this.Io)return this.Fh=e,lst(e.kv.initialize(),()=>{if(this.Fh!==e||this.Io)return;this.Fh=void 0,this.wo=e;const n=e.onRemoteConfig(this.onRemoteConfig);this.Io?n.dispose():(this.Po=n,this.loadIfEnabled())})}dispose(){var e,n,o,i;this.Io||(this.Io=!0,this.Fh=void 0,this.wo=void 0,(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,(n=this._surveyEventReceiver)===null||n===void 0||n.dispose(),this._surveyEventReceiver=null,(o=this._surveyManager)===null||o===void 0||(i=o.dispose)===null||i===void 0||i.call(o),this._surveyManager=null,this.Mh=[],this.Eh=null,this.Rh.forEach(r=>clearTimeout(r)),this.Rh.clear())}get Rr(){return this.So.get()}initialize(){this.loadIfEnabled()}reset(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.clearInMemoryInProgressSurveyState)===null||n===void 0||n.call(e);try{var o;(o=this._surveyEventReceiver)===null||o===void 0||o.reset(),localStorage.removeItem("lastSeenSurveyDate");const i=[];for(let r=0;r<localStorage.length;r++){const s=localStorage.key(r);(s?.startsWith("seenSurvey_")||s?.startsWith("inProgressSurvey_"))&&i.push(s)}i.forEach(r=>localStorage.removeItem(r))}catch{}}loadIfEnabled(){if(this.Io||!this.wo)return;const e=this.Rr;if(this._surveyManager)return;if(this.Ih)return void Bl.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void Bl.info(gst);if(e.cookielessMode&&this.So.isOptedOut())return void Bl.info("Not loading surveys in cookieless mode without consent.");const n=this.So.getExtensions();if(!n)return void Bl.error("PostHog Extensions not found.");if(Bo(this.Ah)&&!e.advancedEnableSurveys)return;const o=this.Ah||e.advancedEnableSurveys;this.Ih=!0;try{const i=n.generateSurveys;if(i)return this.Oh(i,o),void(this.Ih=!1);const r=n.loadExternalDependency;if(!r)return this.Dh(qCe),void(this.Ih=!1);r(s=>{try{if(this.Io)return;const a=this.So.getExtensions();s||!a?.generateSurveys?this.Dh("Could not load surveys script",s):this.Oh(a.generateSurveys,o)}finally{this.Ih=!1}})}catch(i){throw this.Ih=!1,this.Dh("Error initializing surveys",i),i}}Oh(e,n){this.Io||(this._surveyManager=e(n),this._surveyEventReceiver=this.So.createEventReceiver(),Bl.info("Surveys loaded successfully"),this.Lh({isLoaded:!0}))}Dh(e,n){Bl.error(e,n),this.Lh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Mh.push(e),this._surveyManager&&this.Lh({isLoaded:!0}),()=>{this.Mh=this.Mh.filter(n=>n!==e)}}getSurveys(e,n=!1){var o;const i=(o=this.wo)!==null&&o!==void 0?o:this.Th;if(!i||this.Io)return;if(this.Rr.disableSurveys)return Bl.info(gst),e([]);const r=i.kv.get(VCe);if(r&&!n)return e(r,{isLoaded:!0}),void(this.Nh()&&this.getSurveys(()=>{},!0));if(this.Eh)return void this.Eh.then(({surveys:A,context:c})=>{this.Io||e(A,c)}).catch(A=>Bl.error("Error in survey callback",A));const s=this.qh("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Rr.requestTimeoutMs}).then(A=>{try{return this.jh(i,A)}catch(c){return Bl.error("Error processing surveys response",c),this.jh(i,{statusCode:0,error:c})}},A=>this.jh(i,{statusCode:0,error:A}));this.Eh=s;const a=()=>{this.Eh===s&&(this.Eh=null)};s.then(A=>{a(),this.Io||e(A.surveys,A.context)},a).catch(A=>Bl.error("Error in survey callback",A))}qh(e,n){const o=this.wo;return o?o.sendRequest(e,n):new Promise(i=>i({statusCode:0,error:new Error(_k)}))}jh(e,n){if(this.Io)return{surveys:[],context:{isLoaded:!1,error:_k}};const o=n.statusCode;if(o!==200||!n.json){const a=`Surveys API could not be loaded, status: ${o}`;return o!==0?Bl.error(a):n.error||Bl.warn(a),this.Ph=Date.now(),{surveys:[],context:{isLoaded:!1,error:a}}}this.Ph=null;const i=n.json.surveys||[],r=i.filter(a=>(function(A){return!(!A.start_date||A.end_date)})(a)&&(Vrt(a)||(function(A){var c;return!!(!((c=A.conditions)===null||c===void 0||(c=c.actions)===null||c===void 0||(c=c.values)===null||c===void 0)&&c.length)})(a)));var s;return r.length>0&&((s=this._surveyEventReceiver)===null||s===void 0||s.register(r)),e.kv.set({[VCe]:i,[rte]:Date.now()}),{surveys:i,context:{isLoaded:!0}}}Nh(){return this.Bh()&&!this.Eh&&!this.Hh()}Bh(){var e,n;const o=(e=(n=this.wo)!==null&&n!==void 0?n:this.Th)===null||e===void 0?void 0:e.kv.get(rte);return zd(o)&&Date.now()-o>3e5}Hh(){return zd(this.Ph)&&3e5>Date.now()-this.Ph}markSurveyAsSeen(e,n){var o;const i={id:e,current_iteration:(o=n?.iteration)!==null&&o!==void 0?o:null};jrt(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Lh(e){for(const n of this.Mh)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(o){Bl.error("Error in survey callback",o)}}getActiveMatchingSurveys(e,n=!1){if(!zs(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);Bl.warn("init was not called")}zh(e){let n=null;return this.getSurveys(o=>{var i;n=(i=o.find(r=>r.id===e))!==null&&i!==void 0?i:null}),n}Uh(e){if(zs(this._surveyManager))return{eligible:!1,reason:_k};const n=typeof e=="string"?this.zh(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}Wh(e){if(!this.So.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(zs(this._surveyManager))return{eligible:!1,reason:_k};const n=typeof e=="string"?this.zh(e):e;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(zs(this._surveyManager))return Bl.warn("init was not called"),{visible:!1,disabledReason:_k};const n=this.Wh(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return zs(this._surveyManager)?(Bl.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:_k})):new Promise(o=>{this.getSurveys(i=>{var r;const s=(r=i.find(a=>a.id===e))!==null&&r!==void 0?r:null;if(s){const a=this.Wh(s);o({visible:a.eligible,disabledReason:a.reason})}else o({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(e,n,o){var i;if(!this.So.isCapturing())return;if(zs(this._surveyManager))return void Bl.warn("init was not called");const r=typeof e=="string"?this.zh(e):e;if(!r?.id)return void Bl.warn("Survey not found");if(!p5n.includes(r.type))return void Bl.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const s=No?.querySelector(n);if(s){if(!((i=r.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds){Bl.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const a=setTimeout(()=>{var A,c;this.Rh.delete(a),!this.Io&&this.So.isCapturing()&&(Bl.info(`Rendering survey ${r.id} with delay of ${(A=r.appearance)===null||A===void 0?void 0:A.surveyPopupDelaySeconds} seconds`),(c=this._surveyManager)===null||c===void 0||c.renderSurvey(r,s,o),Bl.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Rh.add(a)}this._surveyManager.renderSurvey(r,s,o)}else Bl.warn("Survey element not found")}displaySurvey(e,n){var o;if(!this.So.isCapturing())return;if(zs(this._surveyManager))return void Bl.warn("init was not called");const i=this.zh(e);if(!i)return void Bl.warn("Survey not found");let r=i;if(!((o=i.appearance)===null||o===void 0)&&o.surveyPopupDelaySeconds&&n.ignoreDelay&&(r=sn(sn({},i),{},{appearance:sn(sn({},i.appearance),{},{surveyPopupDelaySeconds:0})})),n.displayType!==_ye.Popover&&n.initialResponses&&Bl.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){const s=this.Uh(i);if(!s.eligible)return void Bl.warn("Survey is not eligible to be displayed: ",s.reason)}n.displayType!==_ye.Inline?this._surveyManager.handlePopoverSurvey(r,n):this.renderSurvey(r,n.selector,n.properties)}cancelPendingSurvey(e){zs(this._surveyManager)?Bl.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.handlePageUnload)===null||n===void 0||n.call(e)}};function fk(t,e,n){if(zs(t))return!1;switch(n){case"exact":return t===e;case"contains":{const o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(o,"i").test(t)}case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}var L5n=class{constructor(e){this._instance=e,this.Vh=new Set,this.Gh=new Set,this.Zh=new fte,this.Qh=(n,o)=>this.Jh(n,o)&&this.Kh(n,o)&&this.Xh(n,o)&&this.Yh(n,o),this.Jh=(n,o)=>!o?.event||n?.event===o?.event}init(){var e,n;Bo((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.tc=(n=this._instance)===null||n===void 0?void 0:n._addCaptureHook((o,i)=>{this.on(o,i)}))}dispose(){var e;(e=this.tc)===null||e===void 0||e.call(this),this.tc=void 0,this.Zh=new fte}register(e){var n,o;if(!Bo((n=this._instance)===null||n===void 0?void 0:n._addCaptureHook)&&(e.forEach(i=>{var r;this.Vh.add(i),(r=i.steps)===null||r===void 0||r.forEach(s=>{this.Gh.add(s?.event||"")})}),(o=this._instance)===null||o===void 0?void 0:o.autocapture)){const i=new Set;this.Vh.forEach(r=>{var s;(s=r.steps)===null||s===void 0||s.forEach(a=>{a?.selector&&i.add(a.selector)})}),this._instance.autocapture.setElementSelectors(i)}}replace(e){this.Vh.clear(),this.Gh.clear(),this.register(e)}on(e,n){n!=null&&e.length!=0&&(this.Gh.has(e)||this.Gh.has(n.event))&&this.Vh.forEach(o=>{this.ec(n,o)&&this.Zh.emit("actionCaptured",o.name)})}nc(e){this.onAction("actionCaptured",n=>e(n))}ec(e,n){if(n?.steps==null)return!1;for(const o of n.steps)if(this.Qh(e,o))return!0;return!1}onAction(e,n){return this.Zh.on(e,n)}Kh(e,n){if(n?.url){var o;const i=e==null||(o=e.properties)===null||o===void 0?void 0:o.$current_url;if(!i||typeof i!="string"||!fk(i,n.url,n.url_matching||"contains"))return!1}return!0}Xh(e,n){return!!this.sc(e,n)&&!!this.rc(e,n)&&!!this.oc(e,n)}sc(e,n){var o;if(!n?.href)return!0;const i=this.ac(e);if(i.length>0)return i.some(s=>fk(s.href,n.href,n.href_matching||"exact"));const r=(e==null||(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)||"";return!!r&&fk((function(s){const a=s.match(/(?::|")href="(.*?)"/);return a?a[1]:""})(r),n.href,n.href_matching||"exact")}rc(e,n){var o;if(!n?.text)return!0;const i=this.ac(e);if(i.length>0)return i.some(c=>fk(c.text,n.text,n.text_matching||"exact")||fk(c.$el_text,n.text,n.text_matching||"exact"));const r=(e==null||(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)||"";return!!r&&(s=(function(c){const l=[],g=/(?::|")text="(.*?)"/g;let u;for(;!zs(u=g.exec(c));)l.includes(u[1])||l.push(u[1]);return l})(r),a=n.text,A=n.text_matching||"exact",s.some(c=>fk(c,a,A)));var s,a,A}oc(e,n){var o,i;if(!n?.selector)return!0;const r=e==null||(o=e.properties)===null||o===void 0?void 0:o.$element_selectors;if(r?.includes(n.selector))return!0;const s=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";if(n.selector_regex&&s)try{return new RegExp(n.selector_regex).test(s)}catch{return!1}return!1}ac(e){var n;return(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements)==null?[]:e?.properties.$elements}Yh(e,n){return!n?.properties||n.properties.length===0||Jrt(n.properties.reduce((o,i)=>{const r=rs(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return o[i.key]={values:r,operator:i.operator||"exact"},o},{}),e?.properties)}},H5n=class{constructor(e){var n,o;this.lc=[],this._instance=e,this.uc=new Map,this.hc=new Map,this.cc=new Map,this.dc=(n=this._instance)===null||n===void 0||(o=n.onSessionId)===null||o===void 0?void 0:o.call(n,i=>this.vc(i))}fc(e){return!1}gc(){return null}mc(e){}yc(){}bc(e,n){return!!e&&Jrt(e.propertyFilters,n?.properties)}_c(e,n){const o=new Map;return e.forEach(i=>{var r;(r=i.conditions)===null||r===void 0||(r=r[n])===null||r===void 0||(r=r.values)===null||r===void 0||r.forEach(s=>{if(s?.name){const a=o.get(s.name)||[];a.push(i.id),o.set(s.name,a)}})}),o}wc(e,n,o){const i=(o===DK.Activation?this.uc:this.hc).get(e);let r=[];return this.kc(s=>{r=s.filter(a=>i?.includes(a.id))}),r.filter(s=>{var a;const A=(a=s.conditions)===null||a===void 0||(a=a[o])===null||a===void 0||(a=a.values)===null||a===void 0?void 0:a.find(c=>c.name===e);return this.bc(A,n)})}register(e){this.Sc(e,!1)}replace(e){this.Sc(e,!0)}Sc(e,n){var o;Bo((o=this._instance)===null||o===void 0?void 0:o._addCaptureHook)||(this.xc(e,n),this.Cc(e,n))}Cc(e,n){const o=e.filter(s=>{var a;return(a=s.conditions)===null||a===void 0||(a=a.actions)===null||a===void 0||(a=a.values)===null||a===void 0?void 0:a.length});var i;if(n&&this.cc.clear(),o.length===0)return void(n&&((i=this.$c)===null||i===void 0||i.replace([])));this.$c||(this.$c=new L5n(this._instance),this.$c.init(),this.$c.nc(s=>this.onAction(s)));const r=[];o.forEach(s=>{var a;(a=s.conditions)===null||a===void 0||(a=a.actions)===null||a===void 0||a.values.forEach(A=>{if(r.push(A),A.name){var c;const l=(c=this.cc.get(A.name))!==null&&c!==void 0?c:[];l.includes(s.id)||l.push(s.id),this.cc.set(A.name,l)}})}),n?this.$c.replace(r):this.$c.register(r)}Tc(e,n){n.forEach((o,i)=>{var r;const s=(r=e.get(i))!==null&&r!==void 0?r:[];o.forEach(a=>{s.includes(a)||s.push(a)}),e.set(i,s)})}xc(e,n){var o,i;const r=e.filter(c=>{var l,g;return((l=c.conditions)===null||l===void 0?void 0:l.events)&&((g=c.conditions)===null||g===void 0||(g=g.events)===null||g===void 0||(g=g.values)===null||g===void 0?void 0:g.length)>0}),s=e.filter(c=>{var l,g;return((l=c.conditions)===null||l===void 0?void 0:l.cancelEvents)&&((g=c.conditions)===null||g===void 0||(g=g.cancelEvents)===null||g===void 0||(g=g.values)===null||g===void 0?void 0:g.length)>0}),a=this._c(e,DK.Activation),A=this._c(e,DK.Cancellation);n?(this.uc=a,this.hc=A):(this.Tc(this.uc,a),this.Tc(this.hc,A)),(r.length!==0||s.length!==0)&&((o=this.tc)!==null&&o!==void 0||(this.tc=(i=this._instance)===null||i===void 0?void 0:i._addCaptureHook((c,l)=>{this.onEvent(c,l)})))}onEvent(e,n){var o,i;const r=this.Ic(),s=(n==null||(o=n.properties)===null||o===void 0?void 0:o.$survey_id)||(n==null||(i=n.properties)===null||i===void 0?void 0:i.$product_tour_id);if(s&&this.getActivatedIds().includes(s)){const A=this.Mc(e,s);if(A==="consume")return r.info("event consumed activated item, removing it",{event:e,itemId:s}),void this.Ec([s]);if(A==="persist")return r.info("shown item promoted to persisted activation",{event:e,itemId:s}),this.Pc(s),void this.Rc([s])}if(this.hc.has(e)){const A=this.wc(e,n,DK.Cancellation);A.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:A.map(c=>c.id)}),this.Ec(A.map(c=>c.id)),A.forEach(c=>this.Ac(c.id)))}if(!this.uc.has(e))return;r.info("event name matched",{event:e,eventPayload:n,items:this.uc.get(e)});const a=this.wc(e,n,DK.Activation);this.Fc(a.map(A=>A.id))}onAction(e){this.cc.has(e)&&this.Fc(this.cc.get(e)||[])}Fc(e){var n,o;if(e.length===0)return;const i=!!(!((n=this._instance)===null||n===void 0||(o=n.get_session_id)===null||o===void 0)&&o.call(n)),r=[];for(const s of e)i&&this.fc(s)?this.Pc(s)&&this.Oc(s):r.push(s);r.length>0&&(this.lc=[...new Set([...this.lc,...r])]),this.Ic().info("updating activated items",{activatedItems:this.getActivatedIds()})}Pc(e){this.lc=this.lc.filter(o=>o!==e);const n=this.Dc();return!n.includes(e)&&(this.Lc([...n,e]),this.Nc(),!0)}Ec(e){const n=new Set(e);this.lc=this.lc.filter(r=>!n.has(r));const o=this.qc(),i=o.filter(r=>!n.has(r));i.length!==o.length&&(this.Lc(i),i.length===0&&this.jc()),this.Rc(e)}Bc(){var e;const n=this.gc();if(!n)return{};const o=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[n];return o&&typeof o=="object"?o:{}}Oc(e){if(!this.gc())return;const n=this.Bc();this.mc(sn(sn({},n),{},{[e]:Date.now()}))}Rc(e){if(!this.gc())return;const n=this.Bc(),o={};let i=!1;for(const[r,s]of Object.entries(n))e.includes(r)?i=!0:o[r]=s;i&&(z2(o)?this.yc():this.mc(o))}Hc(){this.gc()&&this.yc()}getActivationTimestamp(e){if(!this.Dc().includes(e))return;const n=this.Bc()[e];return zd(n)?n:void 0}qc(){var e;const n=this.zc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[n])||[]}Dc(){var e,n,o;const i=this.qc();if(i.length===0)return[];const r=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.Uc()],s=(n=this._instance)===null||n===void 0||(o=n.get_session_id)===null||o===void 0?void 0:o.call(n);return s&&r===s?i:[]}Nc(){var e,n;const o=(e=this._instance)===null||e===void 0||(n=e.get_session_id)===null||n===void 0?void 0:n.call(e);o&&this.Wc(o)}jc(){this.Vc()}vc(e){var n;const o=(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0?void 0:n.props[this.Uc()];if(o&&o!==e){const i=this.qc(),r=this.Bc();i.length>0&&(this.Lc([]),i.filter(s=>zd(r[s])).forEach(s=>this.Ac(s))),this.jc(),this.Hc()}}getActivatedIds(){return[...new Set([...this.Dc(),...this.lc])].filter(e=>!this.Gc(e))}dispose(){var e,n,o;(e=this.dc)===null||e===void 0||e.call(this),this.dc=void 0,(n=this.tc)===null||n===void 0||n.call(this),this.tc=void 0,(o=this.$c)===null||o===void 0||o.dispose(),this.$c=void 0}reset(){this.lc=[],this.qc().length>0&&this.Lc([]),this.jc(),this.Hc()}getEventToItemsMap(){return this.uc}Zc(){return this.$c}},O5n=class extends H5n{constructor(e){super(e)}zc(){return hit}Uc(){return pit}gc(){return mit}mc(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated_timestamps:e})}yc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}fc(e){var n;let o;this.kc(r=>{o=r.find(s=>s.id===e)});const i=o==null||(n=o.appearance)===null||n===void 0?void 0:n.surveyPopupDelaySeconds;return zd(i)&&i>0}Qc(){return r8.SHOWN}kc(e){var n;(n=this._instance)===null||n===void 0||n.getSurveys(e)}Ac(e){var n;(n=this._instance)===null||n===void 0||n.cancelPendingSurvey(e)}Ic(){return Bl}Lc(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated:e})}Wc(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated_session:e})}Vc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}Gc(){return!1}Mc(e,n){let o;return this.kc(i=>{o=i.find(r=>r.id===n)}),!o||(function(i){var r;return Vrt(i)&&!!(!((r=i.conditions)===null||r===void 0||(r=r.events)===null||r===void 0)&&r.repeatedActivation)||i.schedule==="always"})(o)?e===r8.SHOWN?"consume":"ignore":e===r8.SHOWN?"persist":e===r8.DISMISSED||e===r8.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},G5n=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const n={};for(const o of e){const i=this._instance.get_property(o);Bo(i)||(n[o]=i)}return n}set(e,n){this._instance.register(typeof e=="string"?{[e]:n}:e)}remove(e){typeof e!="string"?e.forEach(n=>this._instance.unregister(n)):this._instance.unregister(e)}},Y5n=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=Gr?.__PosthogExtensions__;if(!e)return;const{generateSurveys:n,loadExternalDependency:o}=e;return{generateSurveys:n?i=>n(this._instance,i):void 0,loadExternalDependency:o?i=>o(this._instance,"surveys",i):void 0}}createEventReceiver(){return new O5n(this._instance)}};const U5n=Un?.location?gte(Un.location.hash,"__posthog")||gte(location.hash,"state"):null,ust="_postHogToolbarParams",dst=id("[Toolbar]"),hst=id("[FeatureFlags]");var K5n=class{constructor(e,n=!1){this.Jc=!1,this.update(e,n)}update(e,n){this.Kc=((o,i)=>{var r,s,a,A,c,l,g,u;return{bootstrap:{featureFlags:(r=(s=o.bootstrap)===null||s===void 0?void 0:s.featureFlags)!==null&&r!==void 0?r:void 0,featureFlagPayloads:(a=(A=o.bootstrap)===null||A===void 0?void 0:A.featureFlagPayloads)!==null&&a!==void 0?a:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!o.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!o.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!o.advanced_feature_flags_dedup_per_session,cacheTtlMs:o.feature_flag_cache_ttl_ms,refreshIntervalMs:(c=o.remote_config_refresh_interval_ms)!==null&&c!==void 0?c:3e5,idleRefreshBackoff:Bo(o.remote_config_refresh_interval_ms),requestTimeoutMs:o.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(l=o.feature_flag_request_max_retries)!==null&&l!==void 0?l:1),compression:o.disable_compression?void 0:"best-available",evaluationContexts:(g=(u=o.evaluation_contexts)!==null&&u!==void 0?u:o.evaluation_environments)!==null&&g!==void 0?g:[],flagKeys:rs(o.flag_keys)?o.flag_keys:void 0}})(e,n),!e.evaluation_environments||e.evaluation_contexts||this.Jc||(hst.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Jc=!0),Bo(e.flag_keys)||rs(e.flag_keys)||hst.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Kc}};const pst=id("[FeatureFlags]"),fM=id("[FeatureFlags]",{debugEnabled:!0}),Lye=`" failed. Feature flags didn't load in time.`,V5n=[502,504],mst=["click","keydown","wheel","touchstart","pointerdown"],_st="connection_error",fst=t=>{const e={};for(let n=0;t.length>n;n++)e[t[n]]=!0;return e},Ist=t=>{const e={};for(const[n,o]of Ate(t||{}))o&&(e[n]=o);return e},Cst=t=>ZT(t)&&(t.name==="RangeError"&&t.message.indexOf("Maximum call stack size exceeded")===0||t.name==="InternalError"&&t.message==="too much recursion"),x4=id("[Error tracking]"),Hye="webkit-masked-url:",z5n=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],J5n=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Hye],W5n=["__firefox__","__gCrWeb"],yst="Refusing to render web experiment since the viewer is a likely bot",j5n={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>Ite(e,t),not_regex:(t,e)=>!Ite(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},o5=id("[Conversations]"),IM="Conversations not available yet.";function xst(t,e){var n,o,i,r,s,a,A;const c=(n=t?.flushIntervalMs)!==null&&n!==void 0?n:3e3,l=(o=t?.maxBufferSize)!==null&&o!==void 0?o:100,g=e?.consoleCapture?void 0:(i=t?.maxLogsPerInterval)!==null&&i!==void 0?i:1e3,u=Bo(g)?Math.max(l,2048):Math.max(l,g),h=sn(sn({},(function(){let d="",p="";try{const m=w_?.userAgent;m&&([d,p]=Cot(m))}catch{}return(function(m,_){const f=(function(I){if(I)return{}.hasOwnProperty.call(jot,I)?jot[I]:I})(m);return sn(sn({},f?{"os.name":f}:{}),_?{"os.version":_}:{})})(d,p)})()),t?.resourceAttributes);return{serviceName:(r=(s=h?.["service.name"])!==null&&s!==void 0?s:t?.serviceName)!==null&&r!==void 0?r:e?.serviceNameDefault,serviceVersion:(a=h?.["service.version"])!==null&&a!==void 0?a:t?.serviceVersion,environment:(A=h?.["deployment.environment"])!==null&&A!==void 0?A:t?.environment,resourceAttributes:h,beforeSend:t?.beforeSend,flushIntervalMs:c,maxBufferSize:l,maxQueueSize:u,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:g,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const q5n=["debug","log","warn","error","info"],X5n=t=>{for(;t?.__rrweb_original__;)t=t.__rrweb_original__;return t},Est="console",Bst="__posthogHandledLogsRequestError",Oye=(t,e)=>{const n=t instanceof Error?t:new Error(e);return n[Bst]=!0,n},Sst=t=>!!t&&typeof t=="object"&&t[Bst]===!0,xte=id("[NetworkMetrics]"),Gye=()=>{var t;return!(Un==null||(t=Un.performance)===null||t===void 0)&&t.now?Un.performance.now():Date.now()},$5n={"http:":80,"https:":443},Z5n=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),bst=(t,e)=>{var n;const o=String(e);return{method:String(t).toUpperCase(),url:((n=Wb(o))===null||n===void 0?void 0:n.href)||o}},Yye=(t,e,n,o,i,r,s=!1)=>{try{var a,A;const c=i();if(!c)return;const l=n||void 0,g=Gye()-o,u=Wb(e.url);if(u&&u.protocol!=="http:"&&u.protocol!=="https:")return;const h={url:u?.href||e.url,method:e.method},d=M_(c.name)?c.name(h):eA(c.name)?c.name:"http.client.request.duration";if(!d)return;const p=s&&!l?void 0:((_,f)=>_?400>_?void 0:String(_):f?.name||"_OTHER")(l,r),m=sn(sn(sn(sn(sn({},(_=>{const f=Z5n.has(_)?_:"_OTHER";return sn({"http.request.method":f},f==="_OTHER"&&_!==f?{"http.request.method_original":_}:{})})(h.method)),u?(_=>{return{"server.address":_.hostname.startsWith("[")&&_.hostname.endsWith("]")?_.hostname.slice(1,-1):_.hostname,"server.port":Number(_.port)||$5n[_.protocol],"url.scheme":_.protocol.slice(0,-1),"url.template":(f=_.pathname,f.split("/").map(I=>(C=>/^\d+$/.test(C)||C.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(C))(I)?":id":I).join("/"))};var f})(u):{}),l?{"http.response.status_code":l}:{}),p?{"error.type":p}:{}),(a=c.attributes)===null||a===void 0?void 0:a.call(c,h,{status:l,durationMs:g}));(A=t.metrics)===null||A===void 0||A.histogram(d,g,{unit:"ms",attributes:m})}catch(c){xte.error("Failed to record network metric",c)}},Qst=()=>{},e4n=(t,e)=>M_(Un?.fetch)?UK(Un,"fetch",n=>function(...o){const i=Gye(),r=n.apply(this,o);if(!e())return r;try{var s,a,A;const[c,l]=o,g=bst((s=(a=l?.method)!==null&&a!==void 0?a:c?.method)!==null&&s!==void 0?s:"GET",(A=c?.url)!==null&&A!==void 0?A:c);return r.then(u=>(Yye(t,g,u?.status,i,e,void 0,!0),u),u=>{throw Yye(t,g,void 0,i,e,u),u})}catch(c){return xte.error("Failed to observe fetch",c),r}}):Qst,t4n=(t,e)=>{var n;const o=Un==null||(n=Un.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!o)return Qst;const i=new WeakMap,r=UK(o,"open",a=>function(...A){try{vrt.has(this)||i.set(this,bst(A[0],A[1]))}catch(c){xte.error("Failed to observe XHR open",c)}return a.apply(this,A)}),s=UK(o,"send",a=>function(...A){let c;try{const l=i.get(this);if(l&&e()){const g=Gye();c=()=>{this.removeEventListener("loadend",c),Yye(t,l,this.status,g,e)},dl(this,"loadend",c)}}catch(l){xte.error("Failed to observe XHR send",l)}try{return a.apply(this,A)}catch(l){throw c&&this.removeEventListener("loadend",c),l}});return()=>{r(),s()}},Ete={featureFlags:class{constructor(t){this.name="featureFlags",this.Xc=!1,this.featureFlagEventHandlers=[],this.$=pst,this.Yc={},this.td={},this.ed=[],this.nd=!1,this.sd=!1,this.rd=0,this.od=!1,this.ad=!1,this.ld=!1,this.ud=!1,this.hd=0,this.dd=!1,this.an=()=>{const e=this.vd();this.hd=0,e&&this.reloadFeatureFlags()},this.fd=()=>{var e,n;const o=this.pd,i=(e=this.gd)!==null&&e!==void 0?e:o;Bo(o)||Bo(i)||this.Rr.remoteRequestsDisabled||!No||No.visibilityState==="hidden"||Date.now()-((n=this.md)!==null&&n!==void 0?n:0)<i||(this.gd=this.dd||!this.Rr.idleRefreshBackoff?o:Math.min(2*i,36e5),this.dd=!1,this.reloadFeatureFlags(),this.yd())},this.bd=()=>{this.dd&&this.gd===this.pd||this._d()},this.ln=()=>{No?.visibilityState==="visible"&&this._d()},"get"in t?this.So=t:(this._instance=t,this.wd=new K5n(t.config,t.nl()),this.So=this.wd)}updateConfig(t,e){var n;(n=this.wd)===null||n===void 0||n.update(t,e),this.wo&&this.kd()}setup(t){return this.Fh=t,this.$=t.logger.createLogger("[FeatureFlags]"),lst(t.kv.initialize(),()=>{this.Fh===t&&(this.Fh=void 0,this.wo=t,this.Sd(t))})}Sd(t){var e;if(this.wo===t)return Un&&dl(Un,"online",this.an),this.kd(),this.xd=t.registerDynamicEventProperties(()=>this.Cd()?this.Yc:this.td),this.$d=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.onCrossTabFeatureFlagChange(()=>{this.Td(),this.Id(),this.Md()}),this.Id(),this.initialize()}_d(){this.dd=!0,this.gd=this.pd,this.fd()}kd(){const t=this.Rr.refreshIntervalMs,e=!this.Rr.remoteRequestsDisabled&&No&&!Bo(t)&&t>0?t:void 0;this.Rr.idleRefreshBackoff||(this.gd=e),e!==this.pd&&(this.Ed(),Bo(e)||(this.pd=e,this.gd=e,this.yd(),No?.addEventListener&&(dl(No,yK,this.ln),rk(mst,n=>{dl(No,n,this.bd,{capture:!0})}))))}yd(){Bo(this.pd)||(Bo(this.Pd)||clearInterval(this.Pd),this.md=Date.now(),this.Pd=setInterval(this.fd,this.pd))}Ed(){var t;Bo(this.Pd)||(clearInterval(this.Pd),this.Pd=void 0,No==null||(t=No.removeEventListener)===null||t===void 0||t.call(No,"visibilitychange",this.ln),rk(mst,e=>{var n;No==null||(n=No.removeEventListener)===null||n===void 0||n.call(No,e,this.bd,{capture:!0})})),this.pd=void 0,this.gd=void 0,this.dd=!1,this.md=void 0}destroy(){this.Rd()}dispose(){this.Rd()}Rd(){var t,e;this.Ed(),this.rd++,this.ad=!1,this.Fh=void 0,this.wo&&(this.Ad(),(t=this.xd)===null||t===void 0||t.dispose(),this.xd=void 0,(e=this.$d)===null||e===void 0||e.call(this),this.$d=void 0,this.ed=[],Un?.removeEventListener("online",this.an),this.wo=void 0)}get Rr(){return this.So.get()}Fd(t){var e;return this.Od&&t in this.Od?this.Od[t]:(e=this.wo)===null||e===void 0?void 0:e.kv.get(t)}Td(){return!!this.Od&&(this.Od=void 0,!0)}Dd(){var t;return!Bo((t=this.wo)===null||t===void 0?void 0:t.kv.get("$enabled_feature_flags"))&&this.Td()}At(t){this.Ld(()=>{var e;return(e=this.wo)===null||e===void 0?void 0:e.kv.set(t)})}Nd(t,e,n){var o;if(!(!((o=this._instance)===null||o===void 0)&&o.persistence)||!t.$enabled_feature_flags)return;const i=this.Fd("$enabled_feature_flags")||{},r=t.$enabled_feature_flags||{},s=e.flags||e.featureFlags,a=e.flags?Object.entries(e.flags).filter(([,_])=>!_?.failed).map(([_])=>_):[],A=!!e.errorsWhileComputingFlags&&!!e.flags,c=A?a:n&&!rs(s)?Object.keys(s||{}):Array.from(new Set([...Object.keys(i),...Object.keys(r)])),l=this.Fd("$feature_flag_payloads")||{},g=t.$feature_flag_payloads||{},u=A||n?c:Array.from(new Set([...Object.keys(l),...Object.keys(g)])),h=!A&&!n,d=!!h||c,p=!!h||u,m={[n8]:d,[C4]:d,[Ub]:p};t.$feature_flag_details&&(m[gM]=d);for(const _ of[uM,Jb,fK])Bo(t[_])||(m[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(m)}Lt(t){this.Ld(()=>{var e;return(e=this.wo)===null||e===void 0?void 0:e.kv.remove(t)})}Ld(t){try{t()}catch(e){this.$.error("Failed to update feature flag persistence",e)}}Id(){const t={};for(const o of[n8,Ub,uM,a9]){const i=this.Fd(o);Bo(i)||(t[o]=i)}this.Yc=t;const e=sn({},t),n=this.Fd(C4);if(n)for(const[o,i]of Object.entries(n))e[`$feature/${o}`]=i;this.td=e}Cd(){const t=this.Rr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.Fd(Jb);return typeof e!="number"||Date.now()-e>t}qd(){return!!this.Cd()&&(this.ud||this.sd||(this.ud=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}jd(){const t=this.Rr.evaluationContexts;return t?.length?t.filter(e=>{const n=e&&typeof e=="string"&&e.trim().length>0;return n||this.$.error("Invalid evaluation context found:",e,"Expected non-empty string"),n}):[]}Bd(){const t=this.Rr.flagKeys;if(!Bo(t))return t.filter(e=>{const n=e&&typeof e=="string"&&e.trim().length>0;return n||this.$.error("Invalid flag key found:",e,"Expected non-empty string"),n})}initialize(){var t,e;const n=this.Rr,o=(t=(e=n.bootstrap)===null||e===void 0?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(o).length){var i,r;const s=(i=(r=n.bootstrap)===null||r===void 0?void 0:r.featureFlagPayloads)!==null&&i!==void 0?i:{},a=Object.keys(o).filter(c=>!Bo(o[c])).reduce((c,l)=>(c[l]=o[l],c),{}),A=Object.keys(s).filter(c=>a[c]).reduce((c,l)=>(c[l]=s[l],c),{});return this.Hd({featureFlags:a,featureFlagPayloads:A},void 0,{persist:!1})}}updateFlags(t,e,n){var o,i;const r=n?.merge&&(o=this.Fd("$enabled_feature_flags"))!==null&&o!==void 0?o:{},s=n?.merge&&(i=this.Fd("$feature_flag_payloads"))!==null&&i!==void 0?i:{},a=sn(sn({},r),t),A=sn(sn({},s),e),c={};for(const[l,g]of Object.entries(a))c[l]={key:l,enabled:Hot(g),variant:Oot(g),reason:void 0,metadata:Bo(A?.[l])?void 0:{id:0,version:void 0,description:void 0,payload:A[l]}};this.Hd({flags:c})}get hasLoadedFlags(){return this.nd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.Fd(gM),e=this.Fd(a9),n=this.Fd(dM);if(!n&&!e)return t||{};const o=Cg({},t||{}),i=[...new Set([...Object.keys(n||{}),...Object.keys(e||{})])];for(const a of i){var r;const A=o[a],c=e?.[a],l=Bo(c)?(r=A?.enabled)!==null&&r!==void 0&&r:!!c,g=Bo(c)?A?.variant:typeof c=="string"?c:void 0,u=n?.[a],h=sn(sn({},A),{},{enabled:l,variant:l?g??A?.variant:void 0});var s;l!==A?.enabled&&(h.original_enabled=A?.enabled),g!==A?.variant&&(h.original_variant=A?.variant),u&&(h.metadata=sn(sn({},A?.metadata),{},{payload:u,original_payload:A==null||(s=A.metadata)===null||s===void 0?void 0:s.payload})),o[a]=h}return this.Xc||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:o}),this.Xc=!0),o}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(n=>{const o=t[n];return{key:n,enabled:Hot(o),variant:Oot(o),payload:Lot(e[n])}})}getFlagVariants(){const t=this.Fd(C4),e=this.Fd(a9);if(!e)return t||{};const n=Cg({},t||{}),o=Object.keys(e);for(let i=0;o.length>i;i++)n[o[i]]=e[o[i]];return this.Xc||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.Xc=!0),n}getFlagPayloads(){const t=this.Fd(Ub),e=this.Fd(dM);if(!e)return t||{};const n=Cg({},t||{}),o=Object.keys(e);for(let i=0;o.length>i;i++)n[o[i]]=e[o[i]];return this.Xc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.Xc=!0),n}reloadFeatureFlags(){this.od||this.Rr.featureFlagsDisabled||this.vd()||(this.sd&&(this.ad=!0),this.zd||(this.ed.slice().forEach(t=>{try{t()}catch(e){this.$.error("Error while running feature flags reloading callback",e)}}),this.zd=setTimeout(()=>{this.Ud()},5)))}Ad(){clearTimeout(this.zd),this.zd=void 0}onReloading(t){return this.ed.push(t),()=>{this.ed=this.ed.filter(e=>e!==t)}}ensureFlagsLoaded(){this.nd||this.sd||this.zd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.od=t}resetFlagCallReported(){this.Lt(zb)}Ud(t){this.Ad();const e=this.wo;if(!e||this.Rr.remoteRequestsDisabled||this.vd())return;if(this.sd)return void(this.ad=!0);const n={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:sn(sn(sn({},e.initialPersonProperties),this.Fd("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Fd(Vb),timezone:urt()};Bo(e.deviceId)||(n.$device_id=e.deviceId),(t?.disableFlags||this.Rr.featureFlagsDisabled)&&(n.disable_flags=!0);const o=this.jd();o.length&&(n.evaluation_contexts=o);const i=this.Bd();Bo(i)||(n.flag_keys=i);const r=this.Rr.onlyEvaluateSurveyFeatureFlags,s="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),a=this.rd;this.sd=!0;const A=()=>{this.ad&&(this.ad=!1,this.Ud())},c=d=>{var p,m;const _=(p=d.json)!==null&&p!==void 0?p:{},f=d.statusCode!==200;if(this.sd=!1,a!==this.rd)return void A();if(this.Wd(d.statusCode),f||this.ad||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.ad)return;this.ld=!f;const I=[];d.error?I.push(d.error instanceof Error&&d.error.name==="AbortError"?"timeout":d.error instanceof Error?_st:"unknown_error"):d.statusCode!==200&&I.push(`api_error_${d.statusCode}`),_.errorsWhileComputingFlags&&I.push("errors_while_computing_flags");const C=!!(!((m=_.quotaLimited)===null||m===void 0)&&m.includes("feature_flags"));C&&I.push("quota_limited"),this.At({[CK]:I}),C?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."):n.disable_flags||this.Hd(_,f,{partialResponse:r}),A()},l=d=>{this.sd=!1,a===this.rd&&(this.At({[CK]:[_st]}),this.$.error("Feature flag request failed",d),this.Dd()&&this.Md(!0)),A()};let g=this.Rr.requestMaxRetries;const u=()=>g>0&&a===this.rd,h=()=>{if(a!==this.rd||!this.wo||this.Rr.remoteRequestsDisabled)return this.sd=!1,void A();try{e.sendRequest(s,{target:"flags",method:"POST",body:n,compression:this.Rr.compression,sentAt:"body",timeoutMs:this.Rr.requestTimeoutMs}).then(d=>{if((p=>V5n.includes(p.statusCode)||(m=>m.statusCode===0&&m.error instanceof Error&&m.error.name==="AbortError")(p))(d)&&u())return g--,void setTimeout(h,500);c(d)}).catch(l)}catch(d){l(d)}};h()}vd(){return ort(this.hd,3)}Wd(t){this.hd=irt(t,this.hd,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(t,e={}){var n;if(e.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+Lye);if(this.qd())return;const o=this.getFeatureFlagResult(t,e);return(n=o?.variant)!==null&&n!==void 0?n:o?.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const e=this.getFeatureFlagResult(t,{send_event:!1});return e?.payload}getFeatureFlagResult(t,e={}){if(e.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+Lye);if(this.qd())return;const n=this.getFlagVariants(),o=t in n,i=n[t],r=this.getFlagPayloads()[t],s=String(i),a=this.Fd("$feature_flag_request_id")||void 0,A=this.Fd("$feature_flag_evaluated_at")||void 0;let c,l=this.Fd("$flag_call_reported")||{};if(this.Rr.deduplicateCallsPerSession){var g;const b=(g=this.wo)===null||g===void 0?void 0:g.session.sessionId,Q=this.Fd(IK);b&&b!==Q&&(l={},c=b)}if(e.send_event||!("send_event"in e))if(t in l&&l[t].includes(s))c&&this.At({[zb]:l,[IK]:c});else{var u,h,d,p,m,_,f,I,C,y,x,E;rs(l[t])?l[t].push(s):l[t]=[s],this.At(sn({[zb]:l},c?{[IK]:c}:{}));const b=this.getFeatureFlagDetails(t),Q=[...(u=this.Fd("$feature_flag_errors"))!==null&&u!==void 0?u:[]];Bo(i)&&Q.push("flag_missing");const w={$feature_flag:t,$feature_flag_response:i,$feature_flag_payload:r??null,$feature_flag_request_id:a,$feature_flag_evaluated_at:A,$feature_flag_bootstrapped_response:(h=(d=this.Rr.bootstrap)===null||d===void 0||(d=d.featureFlags)===null||d===void 0?void 0:d[t])!==null&&h!==void 0?h:null,$feature_flag_bootstrapped_payload:(p=(m=this.Rr.bootstrap)===null||m===void 0||(m=m.featureFlagPayloads)===null||m===void 0?void 0:m[t])!==null&&p!==void 0?p:null,$used_bootstrap_value:!this.ld};Bo(b==null||(_=b.metadata)===null||_===void 0?void 0:_.has_experiment)||(w.$feature_flag_has_experiment=b.metadata.has_experiment),Bo(b==null||(f=b.metadata)===null||f===void 0?void 0:f.version)||(w.$feature_flag_version=b.metadata.version);const M=(I=b==null||(C=b.reason)===null||C===void 0?void 0:C.description)!==null&&I!==void 0?I:b==null||(y=b.reason)===null||y===void 0?void 0:y.code;var B;M&&(w.$feature_flag_reason=M),!(b==null||(x=b.metadata)===null||x===void 0)&&x.id&&(w.$feature_flag_id=b.metadata.id),Bo(b?.original_variant)&&Bo(b?.original_enabled)||(w.$feature_flag_original_response=Bo(b.original_variant)?b.original_enabled:b.original_variant),!(b==null||(E=b.metadata)===null||E===void 0)&&E.original_payload&&(w.$feature_flag_original_payload=b==null||(B=b.metadata)===null||B===void 0?void 0:B.original_payload),Q.length&&(w.$feature_flag_error=Q.join(",")),this.Vd(w)}else c&&this.At({[zb]:l,[IK]:c});return o?{key:t,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:Lot(r)}:void 0}Vd(t){try{var e;(e=this.wo)===null||e===void 0||e.capture("$feature_flag_called",t)}catch(n){this.$.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(t,e){this.Gd(t,e)}Gd(t,e){var n=this;return Vg(function*(){const o=n.wo;if(!o)return;const i={distinct_id:o.distinctId,token:o.projectToken,person_properties:{$lib:o.library.name,$lib_version:o.library.version}},r=n.jd();r.length&&(i.evaluation_contexts=r);const s=n.Bd();let a;Bo(s)||(i.flag_keys=s);try{var A;const c=(A=(yield o.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:i,compression:n.Rr.compression,sentAt:"body",timeoutMs:n.Rr.requestTimeoutMs})).json)===null||A===void 0?void 0:A.featureFlagPayloads;a=c?.[t]||void 0}catch(c){return void n.$.error("Remote config feature flag request failed",c)}try{e(a)}catch(c){n.$.error("Remote config feature flag callback failed",c)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.ld)return e.defaultValue;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+Lye),e.defaultValue;const n=this.getFeatureFlag(t,e);return Bo(n)?e.defaultValue:!!n}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,n){this.Hd(t,e,n)}Hd(t,e,n){if(!this.wo)return;this.nd=!0;const o=((i,r={},s={},a={},A,c=pst)=>{const l=((I,C)=>{const y=I.flags;if(y){const x=Object.fromEntries(Object.keys(y).map(B=>{var b;return[B,(b=y[B].variant)!==null&&b!==void 0?b:y[B].enabled]})),E=Object.fromEntries(Object.keys(y).filter(B=>y[B].enabled).filter(B=>{var b;return!Bo((b=y[B].metadata)===null||b===void 0?void 0:b.payload)}).map(B=>{var b;return[B,(b=y[B].metadata)===null||b===void 0?void 0:b.payload]}));return sn(sn({},I),{},{featureFlags:x,featureFlagPayloads:E})}return I.featureFlags&&C.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),I})(i,c),g=l.flags,u=l.featureFlags,h=l.featureFlagPayloads;if(!u)return;const d=i.requestId,p=i.evaluatedAt;if(rs(u)){c.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const I={};if(u)for(let C=0;u.length>C;C++)I[u[C]]=!0;return{[n8]:u,[C4]:I,[fK]:!1}}let m=u,_=h,f=g;if(A?.partialResponse){const I=Object.keys(m),C=_||{};m=sn(sn({},r),m),_=sn(sn({},s),C),I.forEach(y=>{y in C||_==null||delete _[y]}),f=sn(sn({},a),f)}else if(i.errorsWhileComputingFlags)if(g){const I=new Set(Object.keys(g).filter(y=>{var x;return!(!((x=g[y])===null||x===void 0)&&x.failed)}));m=sn(sn({},r),Object.fromEntries(Object.entries(m).filter(([y])=>I.has(y))));const C=Object.fromEntries(Object.entries(_||{}).filter(([y])=>I.has(y)));_=sn(sn({},s),C),I.forEach(y=>{y in C||_==null||delete _[y]}),f=sn(sn({},a),Object.fromEntries(Object.entries(f||{}).filter(([y])=>I.has(y))))}else m=sn(sn({},r),m),_=sn(sn({},s),_),f=sn(sn({},a),f);return sn(sn({[n8]:Object.keys(Ist(m)),[C4]:m||{},[Ub]:_||{},[gM]:f||{},[fK]:i.minimalFlagCalledEvents===!0},d?{[uM]:d}:{}),p?{[Jb]:p}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.$);if(o)if(n?.persist===!1){const i=!Bo(this.wo.kv.get(C4));this.Od=o,i||this.At(o)}else this.Td(),this.Nd(o,t,!!n?.partialResponse),this.At(o);else e&&this.Dd();e||(this.ud=!1),this.Md(e)}override(t,e=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Zd(t)}Zd(t){if(this.wo){if(t===!1)return this.Lt([a9,dM]),this.Md(),void fM.info("All overrides cleared");if(rs(t))return this.At({[a9]:fst(t)}),this.Md(),void fM.info("Flag overrides set",{flags:t});if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var e;const n=t;this.Xc=!!((e=n.suppressWarning)!==null&&e!==void 0&&e);const o={},i=n.flags,r=n.payloads;return i&&(o[a9]=rs(i)?fst(i):i),r&&(o[dM]=r),Object.keys(o).length&&this.At(o),i===!1&&r===!1?this.Lt([a9,dM]):i===!1?this.Lt(a9):r===!1&&this.Lt(dM),this.Md(),i===!1?fM.info("Flag overrides cleared"):i&&fM.info("Flag overrides set",{flags:i}),void(r===!1?fM.info("Payload overrides cleared"):r&&fM.info("Payload overrides set",{payloads:r}))}if(t&&typeof t=="object")return this.At({[a9]:t}),this.Md(),void fM.info("Flag overrides set",{flags:t});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.nd){const{flags:e,flagVariants:n}=this.Qd();try{t(e,n)}catch(o){this.$.error("Error while running feature flags callback",o)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var o;const i=(this.Fd("$early_access_features")||[]).find(c=>c.flagKey===t),r={[`$feature_enrollment/${t}`]:e},s={$feature_flag:t,$feature_enrollment:e,$set:r};i&&(s.$early_access_feature_name=i.name),n&&(s.$feature_enrollment_stage=n);const a=sn(sn({},this.getFlagVariants()),{},{[t]:e});(o=this._instance)===null||o===void 0||(o=o.persistence)===null||o===void 0||o.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.At({[n8]:Object.keys(Ist(a)),[C4]:a,[Kb]:sn(sn({},this.Fd("$stored_person_properties")||{}),r)}),this.Md();try{var A;(A=this.wo)===null||A===void 0||A.capture("$feature_enrollment_update",s)}catch(c){this.$.error("Failed to capture early access feature enrollment",c)}}getEarlyAccessFeatures(t,e=!1,n){const o=this.Fd(KCe);!o||e?this.Jd(t,n):t(o)}Jd(t,e){var n=this;return Vg(function*(){const o=n.wo;if(!o)return;const i=e?`&${e.map(s=>`stage=${s}`).join("&")}`:"";let r;try{const s=yield o.sendRequest(`/api/early_access_features/?token=${o.projectToken}${i}`,{target:"api",method:"GET",sentAt:"query"});if(!s.json)return;r=s.json.earlyAccessFeatures,n.At({[KCe]:r})}catch(s){return void n.$.error("Early access feature request failed",s)}try{t(r)}catch(s){n.$.error("Early access feature callback failed",s)}})()}Qd(){const t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(n=>e[n]),flagVariants:Object.keys(e).filter(n=>e[n]).reduce((n,o)=>(n[o]=e[o],n),{})}}Md(t){this.Id();const{flags:e,flagVariants:n}=this.Qd();this.featureFlagEventHandlers.forEach(o=>{try{o(e,n,{errorsLoading:t})}catch(i){this.$.error("Error while running feature flags callback",i)}})}setPersonPropertiesForFlags(t,e=!0){this.Kd(t,e)}Kd(t,e=!0){const n=this.Fd("$stored_person_properties")||{},o=t?.$set||(t?.$set_once?{}:t),i=t?.$set_once,r={};if(i)for(const s in i)({}).hasOwnProperty.call(i,s)&&(s in n||(r[s]=i[s]));this.At({[Kb]:sn(sn(sn({},n),r),o)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const n=sn({},this.Fd("$stored_person_properties")||{});t.forEach(o=>{delete n[o]}),this.At({[Kb]:n}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(Kb),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const n=this.Fd("$stored_group_properties")||{},o=sn({},n);for(const i of Object.keys(t))o[i]=sn(sn({},n[i]),t[i]);this.At({[Vb]:o}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.Fd("$stored_group_properties")||{};this.At({[Vb]:sn(sn({},e),{},{[t]:{}})})}else this.Lt(Vb)}reset(){this.rd++,this.ad=!1,this.Yc={},this.td={},this.Od=void 0,this.nd=!1,this.od=!1,this.ld=!1,this.$anon_distinct_id=void 0,this.Ad(),this.Xc=!1,this.hd=0}}},n4n={sessionRecording:class{get Rr(){return this._instance.config}get Ml(){return this._instance.persistence}get started(){var t;return!!(!((t=this.Xd)===null||t===void 0)&&t.isStarted)}get status(){var t,e;return this.Yd==="awaiting_config"||this.Yd==="missing_config"?this.Yd:(t=(e=this.Xd)===null||e===void 0?void 0:e.status)!==null&&t!==void 0?t:this.Yd}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.Yd=Tye,this.tv=void 0,this.ev=!1,this.Xe=(()=>{var e,n;if(!No?.visibilityState||No.visibilityState==="visible")return!0;const o=Un==null||(e=Un.performance)===null||e===void 0||(n=e.getEntriesByType)===null||n===void 0?void 0:n.call(e,"visibility-state");return!o?.length||o.some(i=>i.name==="visible")})(),this.ln=()=>{var e,n;No?.visibilityState==="visible"&&(this.Xe=!0,(e=this.Xd)===null||e===void 0||(n=e.setDocumentWasEverVisible)===null||n===void 0||n.call(e,!0))},!this._instance.sessionManager)throw a8.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Rr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');No?.addEventListener&&dl(No,"visibilitychange",this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.ev=!0,No==null||(e=No.removeEventListener)===null||e===void 0||e.call(No,"visibilitychange",this.ln),t?this.iv(!0):this.stopRecording()}get nv(){var t;const e=!!(!((t=this._instance.get_property("$session_recording_remote_config"))===null||t===void 0)&&t.enabled),n=!this.Rr.disable_session_recording,o=this.Rr.disable_session_recording||this._instance.consent.isOptedOut();return Un&&e&&n&&!o}startIfEnabledOrStop(t){var e;if(this.ev||this.nv&&(!((e=this.Xd)===null||e===void 0)&&e.isStarted))return;const n=!Bo(Object.assign)&&!Bo(Array.from);this.nv&&n?(this.sv(t),a8.info("starting")):(this.Yd=Tye,this.stopRecording())}sv(t){var e,n;if(this.nv)if(this.Yd!=="awaiting_config"&&this.Yd!=="missing_config"&&(this.Yd=Ast),(Gr==null||(e=Gr.__PosthogExtensions__)===null||e===void 0||(e=e.rrweb)===null||e===void 0?void 0:e.record)&&((n=Gr.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording))this.rv(t);else{var o,i;const r=this._instance.sessionManager;(o=Gr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,this.ov,s=>{if(!this.ev&&this.nv&&this._instance.sessionManager===r)return s?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),a8.error("could not load recorder",s)):void this.rv(t);this.Yd="disabled"})}}stopRecording(){var t,e;(t=this.tv)===null||t===void 0||t.call(this),this.tv=void 0,(e=this.Xd)===null||e===void 0||e.stop()}iv(t=!1){var e,n;(e=this.tv)===null||e===void 0||e.call(this),this.tv=void 0,(n=this.Xd)===null||n===void 0||n.discard({discardProducerEvents:t})}av(){var t,e;(t=this.Ml)===null||t===void 0||t.unregister("$session_is_sampled"),(e=this.Ml)===null||e===void 0||e.unregister("$replay_sample_rate")}lv(t,e){if(zs(t))return null;const n=zd(t)?t:parseFloat(t);return typeof(o=n)!="number"||!Number.isFinite(o)||0>o||o>1?(a8.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):n;var o}uv(t){if(this.Ml){var e,n;const o=this.Ml,i=()=>{var r;const s=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.lv((r=this.Rr.session_recording)===null||r===void 0?void 0:r.sampleRate,"session_recording.sampleRate"),A=this.lv(s?.sampleRate,"remote config sampleRate"),c=a??A;zs(c)&&this.av();const l=s?.minimumDurationMilliseconds;o.register({[_K]:sn(sn({cache_timestamp:Date.now(),enabled:!!s},s),{},{networkPayloadCapture:sn({capturePerformance:t.capturePerformance},s?.networkPayloadCapture),canvasRecording:{enabled:s?.recordCanvas,fps:s?.canvasFps,quality:s?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:Bo(l)?null:l,endpoint:s?.endpoint,triggerMatchType:s?.triggerMatchType,masking:s?.masking,urlTriggers:s?.urlTriggers,version:s?.version,triggerGroups:s?.triggerGroups})})};i(),(e=this.tv)===null||e===void 0||e.call(this),this.tv=(n=this._instance.sessionManager)===null||n===void 0?void 0:n.onSessionId(i)}}onRemoteConfig(t){const e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.uv(e),void this.iv()):(this.uv(e),void this.startIfEnabledOrStop()):(this.Yd==="awaiting_config"&&(this.Yd="missing_config",this._instance.register_for_session({[Eit]:!0}),a8.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var n;!((n=this.Xd)===null||n===void 0)&&n.log?this.Xd.log(t,e):a8.warn("log called before recorder was ready")}get ov(){var t,e;const n=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.get_property(_K);return(n==null||(e=n.scriptConfig)===null||e===void 0?void 0:e.script)||"lazy-recorder"}hv(){const t=this._instance.get_property(_K);if(!t)return!1;let e;try{e=typeof t=="object"?t:JSON.parse(t)}catch(n){return a8.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!zs(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}rv(t){var e,n,o;if(!this.ev&&this.nv&&this._instance.sessionManager){if(!(!((e=Gr.__PosthogExtensions__)===null||e===void 0)&&e.initSessionRecording))return a8.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[xit]:!0});var i;if(this.Xd||(this.Xd=(i=Gr.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording(this._instance,this.Xe),this.Xd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.hv())return this.Yd==="missing_config"||this.Yd==="awaiting_config"?void 0:(this.Yd="awaiting_config",a8.info("persisted remote config is stale, requesting fresh config before starting"),void new frt(this._instance).load());this.Yd=Ast,(n=(o=this.Xd).setDocumentWasEverVisible)===null||n===void 0||n.call(o,this.Xe),this.Xd.start(t)}else this.Yd=Tye}onRRwebEmit(t){var e,n;(e=this.Xd)===null||e===void 0||(n=e.onRRwebEmit)===null||n===void 0||n.call(e,t)}overrideLinkedFlag(){var t,e;this.Xd||(e=this.Ml)===null||e===void 0||e.register({$replay_override_linked_flag:!0}),(t=this.Xd)===null||t===void 0||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Xd||(e=this.Ml)===null||e===void 0||e.register({$replay_override_sampling:!0}),(t=this.Xd)===null||t===void 0||t.overrideSampling()}overrideTrigger(t){var e,n;this.Xd||(n=this.Ml)===null||n===void 0||n.register({[t==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.Xd)===null||e===void 0||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.Xd)===null||t===void 0?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!!(!((n=this.Xd)===null||n===void 0)&&n.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;(t=this.Xd)===null||t===void 0||(e=t.flushBeforeIdentityReset)===null||e===void 0||e.call(t)}}},o4n={autocapture:class extends w5n{constructor(t){super(new M5n(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.dv=this.vv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.fv();return!!(t.path||t.search||this.pv(t))}startIfEnabled(){this.isEnabled&&(gi.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.dv=this.vv(),this.startIfEnabled()}stop(){this.gv&&this.gv(),this.gv=void 0,this.mv&&this.mv(),this.mv=void 0,gi.info("History API monitoring stopped")}monitorHistoryChanges(){Un&&Un.history&&(this.yv("pushState"),this.yv("replaceState"),this.bv(),this.pv()&&this._v())}yv(t){var e;if(!Un||!((e=Un.history[t])===null||e===void 0)&&e.__posthog_wrapped__)return;const n=this;UK(Un.history,t,o=>function(i,r,s){o.call(this,i,r,s),n.wv(t)})}vv(){const t=Un?.location;if(t?.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}fv(){const t=this._instance.config.capture_pageview;return t==="history_change"?{path:!0}:CA(t)?t:{}}pv(t=this.fv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Sv(t){const e=this.fv(),n=this.dv;return!(!n||!(e.path&&t.pathname!==n.pathname||e.search&&t.search!==n.search||this.pv(e)&&t.hash!==n.hash))}wv(t){try{const e=this.vv();if(!e)return;this.Sv(e)&&this._instance.capture(XCe,{navigation_type:t}),this.dv=e}catch(e){gi.error(`Error capturing ${t} pageview`,e)}}bv(){if(this.gv)return;const t=()=>{this.wv("popstate")};dl(Un,"popstate",t),this.gv=()=>{Un&&Un.removeEventListener("popstate",t)}}_v(){if(this.mv)return;const t=()=>{this.wv("hashchange")};dl(Un,"hashchange",t),this.mv=()=>{Un&&Un.removeEventListener("hashchange",t)}}},heatmaps:class{get Rr(){return this.instance.config}constructor(t){var e;this.xv=!1,this.xo=!1,this.Cv=null,this.instance=t,this.xv=!!(!((e=this.instance.persistence)===null||e===void 0)&&e.props[LCe]),this.rageclicks=new ost(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return CA(this.Rr.capture_heatmaps)&&this.Rr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Rr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return zs(this.Rr.capture_heatmaps)?zs(this.Rr.enable_heatmaps)?this.xv:this.Rr.enable_heatmaps:this.Rr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.xo)return;T5n.info("starting..."),this.$v(),this.ln()}else{var t;clearInterval((t=this.Cv)!==null&&t!==void 0?t:void 0),this.Tv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("heatmaps"in e))return;const n=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[LCe]:n}),this.xv=n,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Iv(t){kye(t.originalEvent)&&this.Tr(t.originalEvent,"deadclick")}ln(){this.Cv&&clearInterval(this.Cv),this.Cv=No?.visibilityState==="visible"?setInterval(this.bl.bind(this),this.flushIntervalMilliseconds):null}$v(){Un&&No&&(this.Mv=this.bl.bind(this),dl(Un,ate,this.Mv),this.Ev=t=>this.Tr(t||Un?.event),dl(No,"click",this.Ev,{capture:!0}),this.Pv=t=>this.Rv(t||Un?.event),dl(No,"mousemove",this.Pv,{capture:!0}),this.Av=new $it(this.instance,LEn,this.Iv.bind(this)),this.Av.startIfEnabledOrStop(),this.Fv=this.ln.bind(this),dl(No,yK,this.Fv),this.xo=!0)}Tv(){var t;Un&&No&&(this.Mv&&Un.removeEventListener(ate,this.Mv),this.Ev&&No.removeEventListener("click",this.Ev,{capture:!0}),this.Pv&&No.removeEventListener("mousemove",this.Pv,{capture:!0}),this.Fv&&No.removeEventListener(yK,this.Fv),clearTimeout(this.Ov),(t=this.Av)===null||t===void 0||t.stop(),this.xo=!1)}Dv(t,e){const n=this.instance.scrollManager.scrollY(),o=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),r=(function(s,a,A){let c=s;for(;c&&A9(c)&&!H1(c,"body");){if(c===A)return!1;let h;try{var l,g,u;h=(l=(g=(u=c.ownerDocument)===null||u===void 0?void 0:u.defaultView)!==null&&g!==void 0?g:Un)===null||l===void 0?void 0:l.getComputedStyle(c).position}catch{return!1}if(ms(a,h))return!0;c=Hit(c)}return!1})(SK(t),["fixed","sticky"],i);return{x:t.clientX+(r?0:o),y:t.clientY+(r?0:n),target_fixed:r,type:e}}Tr(t,e="click"){var n;if(Tit(t.target)||!kye(t))return;const o=this.Dv(t,e);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&Uit(SK(t),this.instance.config.rageclick)&&this.Zs(sn(sn({},o),{},{type:"rageclick"})),this.Zs(o)}Rv(t){!Tit(t.target)&&kye(t)&&(clearTimeout(this.Ov),this.Ov=setTimeout(()=>{this.Zs(this.Dv(t,"mousemove"))},500))}Zs(t){if(!Un)return;const e=this.Rr.disable_capture_url_hashes?Yb(Un.location.href):Un.location.href,n=this.Rr.custom_personal_data_properties,o=this.Rr.mask_personal_data_properties?[...uk,...n||[]]:[],i=wK(e,o,MK);this.Rt=this.Rt||{},this.Rt[i]||(this.Rt[i]=[]),this.Rt[i].push(t)}bl(){this.Rt&&!z2(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:$it,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.xv=!1,this.xo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Lv=()=>{clearTimeout(this.Nv),this.Nv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",sn({$current_url:this.Rt.url},this.Rt.metrics.reduce((n,o)=>sn(sn({},n),{},{[`$web_vitals_${o.name}_event`]:sn({},o),[`$web_vitals_${o.name}_value`]:o.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.qv=n=>{var o;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},zs(n?.name)||zs(n?.value))return void _M.error("Invalid metric received",n);const i=typeof n.navigationURL=="string"?n.navigationURL:void 0,r=this.jv(i);if(Bo(r))return;const s=zd(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${r}`;if(this.Bv&&n.value>=this.Bv)return void _M.error("Ignoring metric with value >= "+this.Bv,n);this.Rt.navigationKey!==s&&(this.Lv(),this.Nv=setTimeout(this.Lv,this.flushToCaptureTimeoutMs)),Bo(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=r),this.Rt.firstMetricTimestamp=Bo(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(o=this._instance.sessionManager)===null||o===void 0?void 0:o.checkAndGetSessionAndWindowId(!0),A=sn(sn(sn({},n),i?{navigationURL:r}:{}),{},{$current_url:r,timestamp:Date.now()});if(delete A.entries,CA(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){const c={};for(const l of R5n){const g=l==="url"&&typeof n.attribution[l]=="string"?this.jv(n.attribution[l]):n.attribution[l];Bo(g)||(c[l]=g)}A.attribution=c}else delete A.attribution;Bo(a)||(A.$session_id=a.sessionId,A.$window_id=a.windowId),this.Rt.metrics.push(A),this.Rt.metrics.length===this.allowedMetrics.length&&this.Lv()},this.Hv=()=>{if(this.xo)return;let n,o,i,r,s=!1;const a=Gr.__PosthogExtensions__,A=a?.postHogWebVitalsCallbacksByFlavor,c=A?.[this.zv]||(this.zv==="web-vitals"&&Bo(A)?a?.postHogWebVitalsCallbacks:void 0);if(!Bo(c)){const u=c.withoutAttribution,h=this.attributionMetrics;s=!Bo(u),n=h.indexOf("LCP")>-1?c.onLCP:u?.onLCP||c.onLCP,o=h.indexOf("CLS")>-1?c.onCLS:u?.onCLS||c.onCLS,i=h.indexOf("FCP")>-1?c.onFCP:u?.onFCP||c.onFCP,r=h.indexOf("INP")>-1?c.onINP:u?.onINP||c.onINP}if(!(n&&o&&i&&r))return void _M.error("web vitals callbacks not loaded - not starting");const l={reportSoftNavs:this.useSoftNavs},g=s&&this.attributionMetrics.indexOf("INP")>-1?sn(sn({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&n(this.qv.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&o(this.qv.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.qv.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&r(this.qv.bind(this),g),this.xo=!0},this.xv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[GCe]),this.startIfEnabled()}get Uv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const n=CA(this.Uv)?(t=this.Uv)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return zs(n)?((e=this._instance.persistence)===null||e===void 0?void 0:e.props.$web_vitals_allowed_metrics)||ast:n}get flushToCaptureTimeoutMs(){return(CA(this.Uv)?this.Uv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=CA(this.Uv)?this.Uv.web_vitals_attribution:void 0;return ry(t)?t?ast:[]:rs(t)?t:N5n}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=CA(this.Uv)?this.Uv.__preview_web_vitals_soft_navs:void 0;return t!=null&&t}get Bv(){const t=CA(this.Uv)&&zd(this.Uv.__web_vitals_max_value)?this.Uv.__web_vitals_max_value:sst;return t>0&&6e4>=t?sst:t}get isEnabled(){const t=nd?.protocol;if(t!=="http:"&&t!=="https:")return _M.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=CA(this.Uv)?this.Uv.web_vitals:ry(this.Uv)?this.Uv:void 0;return ry(e)?e:this.xv}startIfEnabled(){this.isEnabled&&!this.xo&&(_M.info("enabled, starting..."),this.zo(this.Hv))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const n=CA(e.capturePerformance)&&!!e.capturePerformance.web_vitals,o=CA(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[GCe]:n}),this._instance.persistence.register({[git]:o})),this.xv=n,this.startIfEnabled()}get zv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(t){var e;const n=Gr.__PosthogExtensions__,o=this.zv,i=n?.postHogWebVitalsCallbacksByFlavor;i?.[o]||o==="web-vitals"&&Bo(i)&&n?.postHogWebVitalsCallbacks?t():n==null||(e=n.loadExternalDependency)===null||e===void 0||e.call(n,this._instance,o,r=>{r?_M.error("failed to load script",r):t()})}jv(t){const e=t||Un?.location.href;if(!e)return void _M.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?Yb(e):e,o=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...uk,...o||[]]:[];return wK(n,i,MK)}}},i4n={exceptionObserver:class{constructor(t){var e;this.Hv=()=>{var n;if(!Un||!this.isEnabled||!(!((n=Gr.__PosthogExtensions__)===null||n===void 0)&&n.errorWrappingFunctions))return;const o=Gr.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Gr.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=Gr.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Wv&&this.Rr.capture_unhandled_errors&&(this.Wv=o(this.captureException.bind(this))),!this.Vv&&this.Rr.capture_unhandled_rejections&&(this.Vv=i(this.captureException.bind(this))),!this.Gv&&this.Rr.capture_console_errors&&(this.Gv=r(this.captureException.bind(this)))}catch(s){YK.error("failed to start",s),this.Zv()}},this._instance=t,this.Qv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[HCe]),this.wt=new Xxn(sn(sn({},(function(n={}){var o,i,r,s;return{refillRate:(o=(i=n.exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:n.__exceptionRateLimiterRefillRate)!==null&&o!==void 0?o:1,bucketSize:(r=(s=n.exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:n.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:YK})),this.Rr=this.Jv(),this.startIfEnabledOrStop()}Jv(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return CA(t)?e=sn(sn({},e),t):(Bo(t)?this.Qv:t)&&(e=sn(sn({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Rr.capture_console_errors||this.Rr.capture_unhandled_errors||this.Rr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(YK.info("enabled"),this.Zv(),this.zo(this.Hv)):this.Zv()}zo(t){var e,n,o;!((e=Gr.__PosthogExtensions__)===null||e===void 0)&&e.errorWrappingFunctions?t():(n=Gr.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"exception-autocapture",i=>{if(i)return YK.error("failed to load script",i);t()})}Zv(){var t,e,n;(t=this.Wv)===null||t===void 0||t.call(this),this.Wv=void 0,(e=this.Vv)===null||e===void 0||e.call(this),this.Vv=void 0,(n=this.Gv)===null||n===void 0||n.call(this),this.Gv=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.Qv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[HCe]:this.Qv}),this.Rr=this.Jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Rr=this.Jv()}captureException(t){try{var e,n,o;const i=(e=t==null||(n=t.$exception_list)===null||n===void 0||(n=n[0])===null||n===void 0?void 0:n.type)!==null&&e!==void 0?e:"Exception";if(this.wt.consumeRateLimit(i))return void YK.info("Skipping exception capture because of client rate limiting.",{exception:i});(o=this._instance.exceptions)===null||o===void 0||o.sendExceptionEvent(t)}catch{}}},exceptions:class{constructor(t){var e,n;this.Kv=[],this.Xv=new c3n([new B3n,new N3n,new b3n,new S3n,new M3n,new w3n,new v3n,new D3n],(function(o,...i){return(r,s=0)=>{const a=[],A=r.split(`
|
|
240
|
+
at ${i.filename}:${r}:${s}`}};const Q3n=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var v3n=class{match(e){return typeof e=="string"}coerce(e,n){var o;const[i,r]=this.getInfos(e);return{type:i??"Error",value:r??e,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}getInfos(e){let n="Error",o=e;const i=e.match(Q3n);return i&&(n=i[1],o=i[2]),[n,o]}};const P3n=["fatal","error","warning","log","info","debug"];function Fot(t,e=40){const n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(let o=n.length;o>0;o--){const i=n.slice(0,o).join(", ");if(e>=i.length)return o===n.length?i:i.length>e?`${i.slice(0,e)}...`:i}return""}var w3n=class{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var o,i;const r=this.getErrorPropertyFromObject(e);return r?n.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(o=this.getStack(e))!==null&&o!==void 0?o:(i=n.syntheticException)===null||i===void 0?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(pCe(e))return e.constructor.name;const n="name"in e?e.name:void 0;return eA(n)&&!gK(n)?n:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let o=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(o+=` with message: '${e.message}'`),o}if("message"in e&&typeof e.message=="string")return e.message;const n=this.getObjectClassName(e);return`${n&&n!=="Object"?`'${n}'`:"Object"} captured as exception with keys: ${Fot(e)}`}isSeverityLevel(e){return eA(e)&&!gK(e)&&P3n.indexOf(e)>=0}getStack(e){try{return eA(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:eA(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const n in e)if({}.hasOwnProperty.call(e,n)){const o=e[n];if(ZT(o))return o}}getObjectClassName(e){try{const n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}},M3n=class{match(e){return pCe(e)}coerce(e,n){var o;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${Fot(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},D3n=class{match(e){return Ynt(e)}coerce(e,n){var o;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},N3n=class{match(e){return Gee(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!pCe(e))return!1;try{const n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var o;const i=this.getUnhandledRejectionReason(e);return Ynt(i)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}:n.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}};const $ee="$message",Zee="$timestamp",R3n=new Set([$ee,Zee]),PCe={enabled:!0,max_bytes:32768};function ete(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:PCe.enabled,max_bytes:k3n(t.max_bytes,PCe.max_bytes)}:sn({},PCe)}var T3n=class{constructor(e){this.ns=[],this.ss=0,this.Rr=ete(e)}setConfig(e){this.Rr=ete(e),this.rs()}add(e){const n=(function(i){let r;try{r=Ont(i)}catch{return}try{const s=JSON.parse(r);if(!CA(s))return;const a=s,A=a[$ee],c=a[Zee];return!eA(A)||A.trim().length===0||!eA(c)&&!zd(c)?void 0:{step:a,json:r}}catch{return}})(e);if(!n)return;const o=(function(i){if("u">typeof TextEncoder)return new TextEncoder().encode(i).length;const r=encodeURIComponent(i);let s=0;for(let a=0;r.length>a;a++)r[a]==="%"?(s+=1,a+=2):s+=1;return s})(n.json);o>this.Rr.max_bytes||(this.ns.push({step:n.step,bytes:o}),this.ss+=o,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Rr.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function k3n(t,e){if(!zd(t)||t===1/0||t===-1/0)return e;const n=Math.floor(t);return 0>n?e:n}const Lot=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function Hot(t){return typeof t=="string"||t}function Oot(t){return typeof t=="string"?t:void 0}const F3n=["$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","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Got="NativeGzipValidationError",wCe=t=>t.length>=2&&t[0]===31&&t[1]===139,Yot=(t,e)=>t===uCe.GZipJS||e===uCe.GZipJS||e==="gzip",Uot=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError";let pK;const tte=t=>{throw bot(Got,`Native gzip produced invalid output: ${t}`)},L3n=(Kot=Vg(function*(t,e){18>t.size&&tte("too-short");const n=new Uint8Array(yield t.slice(0,10).arrayBuffer());wCe(n)&&n[2]===8||tte("invalid-header");const o=new DataView(yield t.slice(t.size-8).arrayBuffer());o.getUint32(0,!0)!==(r=>{const s=(()=>{if(pK)return pK;pK=[];for(let A=0;256>A;A++){let c=A;for(let l=0;8>l;l++)c=1&c?3988292384^c>>>1:c>>>1;pK[A]=c>>>0}return pK})();let a=4294967295;for(let A=0;r.length>A;A++)a=s[255&(a^r[A])]^a>>>8;return(4294967295^a)>>>0})(e)&&tte("invalid-crc");const i=e.length>>>0;o.getUint32(4,!0)!==i&&tte("invalid-size")}),function(t,e){return Kot.apply(this,arguments)});var Kot;function MCe(){return MCe=Vg(function*(t,e=!0,n){try{const i=new TextEncoder().encode(t),r=new globalThis.CompressionStream("gzip"),s=r.writable.getWriter(),a=s.write(i).then(()=>s.close()).catch((o=Vg(function*(l){try{yield s.abort(l)}catch{}throw l}),function(l){return o.apply(this,arguments)})),A=new Response(r.readable).blob(),[c]=yield Promise.all([A,a]);return yield L3n(c,i),c}catch(i){if(n?.rethrow)throw i;return e&&console.error("Failed to gzip compress data",i),null}var o}),MCe.apply(this,arguments)}function Vot(t,e){if(t==null)return{};var n,o,i=(function(s,a){if(s==null)return{};var A={};for(var c in s)if({}.hasOwnProperty.call(s,c)){if(a.includes(c))continue;A[c]=s[c]}return A})(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;r.length>o;o++)e.includes(n=r[o])||{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}const H3n={}.propertyIsEnumerable;function nte(t,e){try{return zot(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function DCe(t,e,n,o){if(0>=n.remainingNodes)return{stringValue:SCe};if(n.remainingNodes--,ry(t))return{boolValue:t};if(typeof t=="bigint")return(function(i,r){const s=i.toString(),a=BigInt("9223372036854775808");return i>=a||-a>i?(r?.debug(`Attribute ${s} is outside the int64 range; encoding it as a string`),{stringValue:s}):{intValue:s}})(t,e);if(typeof t=="number"){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const i=BigInt(t).toString();return t>=9223372036854776e3||-9223372036854776e3>t?(e?.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:t}}if(typeof t=="string")return{stringValue:tk(t)};if(typeof t=="function")return{stringValue:"[Function]"};if(typeof t=="symbol")return{stringValue:String(t)};if(typeof t=="object"&&t!==null){if(n.ancestors.has(t))return{stringValue:"[Circular]"};if(o>=20)return{stringValue:SCe};if(t instanceof Date){const i=t.getTime(),r=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:typeof r=="string"?tk(r):String(r)}}n.ancestors.add(t);try{try{const i=t.toJSON;if(typeof i=="function")return DCe(i.call(t),e,n,o+1)}catch{}return rs(t)?{arrayValue:{values:O3n(t,e,n,o+1)}}:{kvlistValue:{values:zot(t,e,n,o+1)}}}finally{n.ancestors.delete(t)}}return{stringValue:tk(String(t))}}function O3n(t,e,n,o){const i=[],r=Math.min(t.length,1e3);let s=0;for(;r>s&&n.remainingNodes>0;s++)try{const a=s in t?t[s]:void 0;if(zs(a))continue;i.push(DCe(a,e,n,o))}catch{i.push({stringValue:dK})}return t.length>s&&i.push({stringValue:SCe}),i}function zot(t,e,n,o){const i=[];for(const r in t)if(H3n.call(t,r)){if(!r){e?.debug("Dropping an attribute with an empty key");continue}if(i.length>=1e3||0>=n.remainingNodes){e?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const s=t[r];if(od(s)||Bo(s))continue;i.push({key:tk(r),value:DCe(s,e,n,o)})}catch{i.push({key:tk(r),value:{stringValue:dK}})}}return i}function Jot(t,e,n){return sn(sn(sn(sn({},Eot({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":e,"telemetry.sdk.version":n})}const G3n=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function Wot(t,e){const n=Eot({},t),o={};for(const i of G3n)({}).hasOwnProperty.call(n,i)&&(o[i]=n[i],delete n[i]);return[...nte(n,e),...nte(o,e)]}const jot={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"},qot={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}},Y3n=qot.info;function U3n(t){try{return tk(String(t))}catch{return dK}}function K3n(t,e,n,o){const i=t.level||"info",{text:r,number:s}=qot[i]||Y3n,a=(function(u=Date.now()){return String(u)+"000000"})(zd(o)?o:void 0),A={};e.distinctId&&(A.posthogDistinctId=e.distinctId),e.sessionId&&(A.sessionId=e.sessionId),e.windowId&&(A["window.id"]=e.windowId),zs(e.sessionStartTimestamp)||(A.sessionStartTimestamp=String(e.sessionStartTimestamp)),zs(e.lastActivityTimestamp)||(A.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(A["url.full"]=e.currentUrl),e.screenName&&(A["screen.name"]=e.screenName),e.appState&&(A["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(A.feature_flags=e.activeFeatureFlags);const c=sn({},A),l=t.attributes;if(l){let u=[];try{u=Object.keys(l)}catch{u=[]}for(const h of u){let d;try{d=l[h]}catch{d=dK}Object.defineProperty(c,h,{value:d,enumerable:!0,writable:!0,configurable:!0})}}const g={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:s,severityText:r,body:{stringValue:U3n(t.body)},attributes:nte(c,n)};return t.trace_id&&(g.traceId=t.trace_id),t.span_id&&(g.spanId=t.span_id),Bo(t.trace_flags)||(g.flags=t.trace_flags),g}function Xot(t,e,n){return Jot(t,e,n)}function $ot(t,e,n,o){return{resourceLogs:[{resource:{attributes:Wot(e)},scopeLogs:[{scope:{name:n,version:o},logRecords:t}]}]}}var Zot=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=vot(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function eit(){return .75+.5*Math.random()}function tit(t,e,n,o){const i=Math.min(Math.max(0,e-1),6),r=t*Math.pow(2,i);return Math.round(Math.min(r,Math.max(o,t))*n)}var V3n=class{constructor(e,n,o,i,r,s=()=>Promise.resolve(),a){var A;this._instance=e,this.Rr=n,this.$=o,this.cs=i,this.ds=r,this.vs=s,this.fs=a,this.ps=new Zot(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new Bot,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=n.maxBufferSize,this.Is=Math.max((A=n.maxQueueSize)!==null&&A!==void 0?A:n.maxBufferSize,n.maxBufferSize),this.Ms=n.flushIntervalMs,this.Es=n.maxBatchRecordsPerPost,this.Ps=n.rateCapWindowMs,this.Rs=n.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(r9.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Rr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,n){var o;if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;const i=this.Os(e);if(i===null)return;if(!i.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const r={record:K3n(i,(o=n?.context)!==null&&o!==void 0?o:this.cs(),this.$,n?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){const n=this.Rr.beforeSend;if(!n)return e;const o=rs(n)?n:[n];let i=e;for(const r of o)try{const s=r(i);if(!s)return this.$.info("Log was rejected in beforeSend function"),null;i=s}catch(s){return this.$.error("Error in beforeSend function for log:",s),null}return i}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),n=e-this.xs;return this.Ps>n&&n>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return Vg(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return Vg(function*(){var n;e.ps.clear();let o=(n=e._instance.getPersistedProperty(r9.LogsQueue))!==null&&n!==void 0?n:[];if(o.length===0)return;const i=o.length;let r=0;for(;o.length>0&&i>r;){var s,a;const A=e._s;e.bs=0;const c=Math.min(o.length,e.Es),l=o.slice(0,c),g=$ot(l.map(h=>h.record),e.qs(),(s=e.fs)!==null&&s!==void 0?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),u=yield e._instance.js(g);if(e._s!==A)return;if(u.kind==="too-large"&&l.length>1)e.Es=Math.max(1,Math.floor(l.length/2)),e.$.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(u),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),u.kind==="retry-later"||(u.kind==="too-large"?e.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):u.kind==="ok"&&e.Rr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Rr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(l.length),o=(a=e._instance.getPersistedProperty(r9.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,u.kind==="fatal"))throw u.error}})()}Bs(e){var n=this;return Vg(function*(){var o;const i=Math.max(0,e-n.bs),r=(o=n._instance.getPersistedProperty(r9.LogsQueue))!==null&&o!==void 0?o:[];n._instance.setPersistedProperty(r9.LogsQueue,r.slice(i)),yield n.vs()})()}qs(){return Xot(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var n;if(this._instance.optedOut)return;const o=(n=this._instance.getPersistedProperty(r9.LogsQueue))!==null&&n!==void 0?n:[];this.Is>o.length||(o.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),o.push(e),this._instance.setPersistedProperty(r9.LogsQueue,o),this.Ts>o.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(tit(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(r9.LogsQueue);return!!e&&e.length>0}shutdown(e){var n=this;return Vg(function*(){n.ps.clear();const o=n.flush().catch(()=>{});e!==void 0?yield Pot(o,e):yield o})()}flushWithTimeout(e){var n=this;return Vg(function*(){const o=n.flush();yield Pot(o,e,()=>{o.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=eit(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const NCe=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function nit(t){return String(t)+"000000"}function oit(t,e,n,o){let i="";return o&&(i=Object.keys(o).sort().map(r=>`${JSON.stringify(r)}:${JSON.stringify(o[r])}`).join(",")),`${t}\0${e}\0${n??""}\0${i}`}var z3n=class{constructor(e,n,o){this._instance=e,this.Rr=n,this.$=o,this.zs=new Map,this.ps=new Zot(()=>this.flush().catch(i=>{this.$.error("Metrics flush failed:",i)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new Bot,this.ks=0,this.Ss=1,this.Gs=0}count(e,n=1,o){this.Zs({name:e,type:"count",value:n,unit:o?.unit,attributes:o?.attributes})}gauge(e,n,o){this.Zs({name:e,type:"gauge",value:n,unit:o?.unit,attributes:o?.attributes})}histogram(e,n,o){this.Zs({name:e,type:"histogram",value:n,unit:o?.unit,attributes:o?.attributes})}flush(){var e=this;const n=this.ys,o=(function(){var i=Vg(function*(){n&&(yield n.catch(()=>{})),yield e.Qs()});return function(){return i.apply(this,arguments)}})()().finally(()=>{this.ys===o&&(this.ys=null)});return this.ys=o,o}drainWindow(){if(this.zs.size===0)return null;const e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const n=this.Os(e);if(n===null)return;if(!n.name||typeof n.name!="string")return void this.$.warn("Dropping metric with empty name");if(typeof n.value!="number"||!Number.isFinite(n.value))return void this.$.warn(`Dropping metric '${n.name}': value must be a finite number`);if(n.type==="count"&&0>n.value)return void this.$.warn(`Dropping count '${n.name}': counters are monotonic, value must be >= 0`);let o,i;try{o=n.attributes?sn({},n.attributes):void 0,i=oit(n.type,n.name,n.unit,o)}catch(a){return void this.$.warn(`Dropping metric '${n.name}': attributes could not be serialized`,a)}let r=this.zs.get(i);if(!r){if(!this.Ks())return;r={name:n.name,type:n.type,unit:n.unit,attributes:o,windowStartMs:Date.now()},this.zs.set(i,r)}const s=this.Ws.get(n.name);s===void 0?this.Ws.set(n.name,n.type):s===n.type||this.Vs.has(n.name)||(this.Vs.add(n.name),this.$.warn(`Metric name '${n.name}' is already used as a ${s}; recording it as a ${n.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(r,n.value),this.Fs()}Ks(){return this.Rr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Rr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,n){switch(e.type){case"count":var o;e.total=((o=e.total)!==null&&o!==void 0?o:0)+n;break;case"gauge":e.last=n;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:n,max:n,bucketCounts:new Array(NCe.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=n,i.min=Math.min(i.min,n),i.max=Math.max(i.max,n),i.bucketCounts[(function(r,s){for(let a=0;s.length>a;a++)if(s[a]>=r)return a;return s.length})(n,NCe)]+=1;break}}}Os(e){const n=this.Rr.beforeSend;if(!n)return e;const o=rs(n)?n:[n];let i=e;for(const r of o)try{const s=r(i);if(!s)return this.$.info("Metric was rejected in beforeSend function"),null;i=s}catch(s){return this.$.error("Error in beforeSend function for metric:",s),null}return i}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(tit(this.Rr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return Vg(function*(){if(e.ps.clear(),e.zs.size===0)return;const n=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const o=e.Gs,i=yield e._instance.Ys(e.Js(n));if(o===e.Gs)switch(e.ws.record(i),i.kind==="retry-later"?(e.ks++,e.Ss=eit()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),i.kind){case"ok":return;case"retry-later":return e.ho(n),void e.ps.armNoEarlierThan(e.Hs());case"too-large":return void e.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.$.error("Failed to send metrics batch:",i.error)}})()}Js(e){return n=this.vo(e),o=(function(s,a,A){return Jot(s,a,A)})(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Wot(o)},scopeMetrics:[{scope:{name:i,version:r},metrics:n}]}]};var n,o,i,r}vo(e){const n=nit(Date.now()),o=new Map;for(const a of e.values()){var i;const A=oit(a.type,a.name,a.unit,void 0);let c=o.get(A);c||(c=sn({name:a.name},a.unit&&{unit:a.unit}),a.type==="count"?c.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:a.type==="gauge"?c.gauge={dataPoints:[]}:c.histogram={aggregationTemporality:1,dataPoints:[]},o.set(A,c));const l=nte((i=a.attributes)!==null&&i!==void 0?i:{},this.$),g=nit(a.windowStartMs);if(a.type==="count"){var r;const u={attributes:l,startTimeUnixNano:g,timeUnixNano:n,asDouble:(r=a.total)!==null&&r!==void 0?r:0};c.sum.dataPoints.push(u)}else if(a.type==="gauge"){var s;const u={attributes:l,timeUnixNano:n,asDouble:(s=a.last)!==null&&s!==void 0?s:0};c.gauge.dataPoints.push(u)}else a.hist&&c.histogram.dataPoints.push({attributes:l,startTimeUnixNano:g,timeUnixNano:n,count:a.hist.count,sum:a.hist.sum,min:a.hist.min,max:a.hist.max,bucketCounts:a.hist.bucketCounts,explicitBounds:NCe})}return Array.from(o.values())}ho(e){for(const[i,r]of e){const s=this.zs.get(i);if(s)switch(s.windowStartMs=Math.min(s.windowStartMs,r.windowStartMs),s.type){case"count":var n,o;s.total=((n=s.total)!==null&&n!==void 0?n:0)+((o=r.total)!==null&&o!==void 0?o:0);break;case"gauge":break;case"histogram":if(r.hist)if(s.hist){s.hist.count+=r.hist.count,s.hist.sum+=r.hist.sum,s.hist.min=Math.min(s.hist.min,r.hist.min),s.hist.max=Math.max(s.hist.max,r.hist.max);for(let a=0;s.hist.bucketCounts.length>a;a++)s.hist.bucketCounts[a]+=r.hist.bucketCounts[a]}else s.hist=r.hist}else this.Ks()&&this.zs.set(i,r)}}};const iit=(t,{debugEnabled:e}={})=>{const n={N(o,...i){Un&&(e8.DEBUG||Un.POSTHOG_DEBUG||e)&&!Bo(Un.console)&&Un.console&&("__rrweb_original__"in Un.console[o]?Un.console[o].__rrweb_original__:Un.console[o])(t,...i)},debug(...o){n.N("debug",...o)},info(...o){n.N("log",...o)},warn(...o){n.N("warn",...o)},error(...o){n.N("error",...o)},critical(...o){console.error(t,...o)},uninitializedWarning(o){n.error(`You must initialize PostHog before calling ${o}`)},createLogger:(o,i)=>iit(`${t} ${o}`,i)};return n},gi=iit("[PostHog.js]"),id=gi.createLogger,J3n=id("[ExternalScriptsLoader]"),ote=t=>{const e=No?.querySelectorAll("script");if(e){for(let n=0;e.length>n;n++)if(e[n].src===t||e[n].getAttribute("src")===t)return e[n]}},lM=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return J3n.warn(`${e} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const o=ote(e);if(o){if(o.__posthog_loading_callback_fired)return n();const r=o.__posthog_loading_error;return r?n(r):(o.addEventListener("load",s=>{o.__posthog_loading_callback_fired=!0,n(void 0,s)}),void o.addEventListener("error",s=>{o.__posthog_loading_error=s,n(s)}))}const i=()=>{if(!No)return n("document not found");if(ote(e))return lM(t,e,n);let r=No.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=a=>{r.__posthog_loading_callback_fired=!0,n(void 0,a)},r.onerror=a=>{r.__posthog_loading_error=a,n(a)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")No.head.appendChild(r);else{const a=No.querySelectorAll("body > script");var s;a.length>0?(s=a[0].parentNode)===null||s===void 0||s.insertBefore(r,a[0]):No.body.appendChild(r)}};No?.body?i():No?.addEventListener("DOMContentLoaded",i)},RCe={},rit=(t,e)=>{let n=`/static/${e}.js?v=${t.version}`;return e==="toolbar"&&(n=`${n}&t=${Math.floor(Date.now()/3e5)*3e5}`),t.requestRouter.endpointFor("assets",n)};Gr.__PosthogExtensions__=Gr.__PosthogExtensions__||{},Gr.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e==="remote-config"){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void lM(t,i,n)}const o=t.config.strict_script_versioning;if(o){const i=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=RCe[i];if(o==="fallback"&&r){if(ote(r))return void lM(t,r,n);delete RCe[i]}return void lM(t,i,o==="fallback"?(s,a)=>{if(s)if(typeof s=="string")n(s);else{var A;const c=rit(t,e);RCe[i]=c;const l=ote(i);l==null||(A=l.parentNode)===null||A===void 0||A.removeChild(l),lM(t,c,n)}else n(void 0,a)}:n)}lM(t,rit(t,e),n)},Gr.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{const o=t.requestRouter.endpointFor("api",e);lM(t,o,n)},e8.DEBUG=!1,e8.LIB_VERSION="1.434.12",e8.LIB_NAME="web";var Fm=e8;const W3n="$people_distinct_id",I4="distinct_id",TCe="$device_id",kCe="$device_model",ite="__alias",j3n="__cmpns",sit="$fbc",nk="$fbc_persistence",ait="$fbp",mK="$fbp_persistence",FCe="__timers",Ait="$autocapture_disabled_server_side",LCe="$heatmaps_enabled_server_side",HCe="$exception_capture_enabled_server_side",cit="$error_tracking_suppression_rules",OCe="$error_tracking_capture_extension_exceptions",GCe="$web_vitals_enabled_server_side",YCe="$dead_clicks_enabled_server_side",UCe="$product_tours_enabled_server_side",lit="$logs_capture_enabled_server_side",git="$web_vitals_allowed_metrics",_K="$session_recording_remote_config",q3n="$session_recording_enabled_server_side",X3n="$replay_sample_rate",$3n="$replay_override_sampling",Z3n="$replay_override_linked_flag",eEn="$replay_override_url_trigger",tEn="$replay_override_event_trigger",ok="$sesid",uit="$session_is_sampled",nEn="$session_past_minimum_duration",oEn="$session_recording_url_trigger_activated_session",iEn="$session_recording_event_trigger_activated_session",rEn="$debug_first_full_snapshot_timestamp",sEn="$sess_rec_flush_size",C4="$enabled_feature_flags",n8="$active_feature_flags",KCe="$early_access_features",gM="$feature_flag_details",Ub="$feature_flag_payloads",uM="$feature_flag_request_id",fK="$minimal_flag_called_events",a9="$override_feature_flags",dM="$override_feature_flag_payloads",Kb="$stored_person_properties",Vb="$stored_group_properties",dit="$groups",VCe="$surveys",rte="$surveys_loaded_at",hit="$surveys_activated",pit="$surveys_activated_session",mit="$surveys_activated_timestamps",zCe="ph_product_tours",aEn="$product_tours_activated",AEn="$product_tours_activated_session",cEn="$conversations_widget_session_id",lEn="$conversations_ticket_id",gEn="$conversations_widget_state",uEn="$conversations_user_traits",zb="$flag_call_reported",IK="$flag_call_reported_session_id",CK="$feature_flag_errors",Jb="$feature_flag_evaluated_at",sy="$user_state",JCe="$client_session_props",dEn="$capture_rate_limit",_it="$initial_campaign_params",fit="$initial_referrer_info",ik="$initial_person_info",WCe="$epp",jCe="$posthog_cookieless",Iit="$cookieless_mode",Cit="$sdk_debug_extensions_init_method",yit="$sdk_debug_extensions_init_time_ms",xit="$sdk_debug_recording_script_not_loaded",Eit="$sdk_debug_replay_stale_config",hEn="$sdk_debug_replay_event_trigger_status",pEn="$sdk_debug_replay_linked_flag_trigger_status",mEn="$sdk_debug_replay_matched_recording_trigger_groups",_En="$sdk_debug_replay_pending_trigger_conditions",fEn="$sdk_debug_replay_remote_trigger_matching_config",IEn="$sdk_debug_replay_trigger_groups_count",CEn="$sdk_debug_replay_url_trigger_status",yEn="$session_recording_start_reason",qCe="PostHog loadExternalDependency extension not found.",o8="anonymous",ste="identified",Bit="identified_only",yK="visibilitychange",ate="beforeunload",XCe="$pageview",Sit="$pageleave",bit="$identify",Qit="$groupidentify";function rk(t,e){rs(t)&&t.forEach(e)}function El(t,e){if(!zs(t))if(rs(t))t.forEach(e);else if((n=>n instanceof FormData)(t))t.forEach((n,o)=>e(n,o));else for(const n in t)hCe.call(t,n)&&e(t[n],n)}const Cg=function(t,...e){for(const n of e)for(const o in n)n[o]!==void 0&&(t[o]=n[o]);return t};function Ate(t){const e=Object.keys(t);let n=e.length;const o=new Array(n);for(;n--;)o[n]=[e[n],t[e[n]]];return o}const xEn=function(t){return function(...e){try{return t.apply(this,e)}catch(n){gi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),gi.critical(n)}}},$Ce=function(t){const e={};return El(t,function(n,o){(eA(n)&&n.length>0||zd(n))&&(e[o]=n)}),e};function vit(t){const e=sn({},t);for(const n of["name","message","stack","cause","errors"])try{n in t&&(e[n]=t[n])}catch{}return e}const EEn=["herokuapp.com","vercel.app","netlify.app"];function BEn(t){const e=t?.hostname;if(!eA(e))return!1;const n=e.split(".").slice(-2).join(".");for(const o of EEn)if(n===o)return!1;return!0}function dl(t,e,n,o){const{capture:i=!1,passive:r=!0}=o??{};t?.addEventListener(e,n,{capture:i,passive:r})}function ZCe(t){return t.name==="ph_toolbar_internal"}const xK=t=>{if(No){try{const e=t+"=",n=No.cookie.split(";").filter(o=>o.length);for(let o=0;n.length>o;o++){let i=n[o];for(;i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return zd(t)&&isFinite(t)&&Math.floor(t)===t});var SEn=class ctt{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,o,i){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(o)||!Number.isInteger(i)||0>e||0>n||0>o||0>i||e>0xffffffffffff||n>4095||o>1073741823||i>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|n>>>8,r[7]=n,r[8]=128|o>>>24,r[9]=o>>>16,r[10]=o>>>8,r[11]=o,r[12]=i>>>24,r[13]=i>>>16,r[14]=i>>>8,r[15]=i,new ctt(r)}toString(){let e="";for(let n=0;this.bytes.length>n;n++)e=e+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new ctt(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(let n=0;16>n;n++){const o=this.bytes[n]-e.bytes[n];if(o!==0)return Math.sign(o)}return 0}},bEn=class{generate(){const e=this.generateOrAbort();if(!Bo(e))return e;{this.Ct=0;const n=this.generateOrAbort();if(Bo(n))throw new Error("Could not generate UUID after timestamp reset");return n}}generateOrAbort(){const e=(()=>{const n=Date.now();return zd(n)&&isFinite(n)?Math.min(Math.max(Math.floor(n),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return SEn.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new QEn}};let Pit=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};Un&&!Bo(Un.crypto)&&crypto.getRandomValues&&(Pit=t=>crypto.getRandomValues(t));var QEn=class{nextUint32(){return this.Rt.length>this.$t||(Pit(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let wit;const y4=()=>vEn().toString(),vEn=()=>(wit||(wit=new bEn)).generate();let EK="";const PEn=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let sk=null;const rd={Et(){if(!od(sk))return sk;if(sk=!1,No)try{const t=`__ph_cookie_support_${y4()}`;rd.At(t,"xyz"),sk=xK(t)==='"xyz"',rd.Lt(t)}catch{sk=!1}return sk},Pt(t){gi.error("cookieStore error: "+t)},Ot:xK,Dt(t){let e;try{e=JSON.parse(rd.Ot(t))||{}}catch{}return e},At(t,e,n,o,i){if(!No)return!1;try{let r="",s="";const a=(function(c,l){if(l){let g=(function(u,h=No){if(EK)return EK;if(!h||["localhost","127.0.0.1"].includes(u))return"";const d=u.split(".");let p=Math.min(d.length,8);const m="dmn_chk_"+y4();for(;!EK&&p--;){const _=d.slice(p).join("."),f=m+"=1;domain=."+_+";path=/";h.cookie=f+";max-age=3",h.cookie.includes(m)&&(h.cookie=f+";max-age=0",EK=_)}return EK})(c);if(!g){const u=(h=>{const d=h.match(PEn);return d?d[0]:""})(c);u!==g&&gi.info("Warning: cookie subdomain discovery mismatch",u,g),g=u}return g?"; domain=."+g:""}return""})(No.location.hostname,o);if(n){const c=new Date;c.setTime(c.getTime()+864e5*n),r="; expires="+c.toUTCString()}i&&(s="; secure");const A=t+"="+encodeURIComponent(JSON.stringify(e))+r+"; SameSite=Lax; path=/"+a+s;return A.length>3686.4&&gi.warn("cookieStore warning: large cookie, len="+A.length),No.cookie=A,!0}catch{return!1}},Lt(t,e){if(No?.cookie&&(!e||!od(xK(t))))try{rd.At(t,"",-1,e)}catch{return}}};let eye=null;const cc={Et(){if(!od(eye))return eye;let t=!0;if(Bo(Un))t=!1;else try{const e="__mplssupport__";cc.At(e,"xyz"),cc.Ot(e)!=='"xyz"'&&(t=!1),cc.Lt(e)}catch{t=!1}return t||gi.error("localStorage unsupported; falling back to cookie store"),eye=t,t},Pt(t){gi.error("localStorage error: "+t)},Ot(t){try{return Un?.localStorage.getItem(t)}catch(e){cc.Pt(e)}return null},Dt(t){try{return JSON.parse(cc.Ot(t))||{}}catch{}return null},At(t,e){try{return Un?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){cc.Pt(n)}return!1},Lt(t){try{Un?.localStorage.removeItem(t)}catch(e){cc.Pt(e)}}},tye=[Kb,n8,C4,gM,Ub,uM,Jb,CK,zb],hM=[TCe,I4,ok,uit,WCe,ik,nk,sy],cte=t=>t+"_cpm",wEn=["__proto__","constructor","prototype"],nye=t=>{if(!CA(t))return{};const e={};return Object.keys(t).forEach(n=>{wEn.indexOf(n)===-1&&(e[n]=t[n])}),e},oye=(t,e=[])=>{const n={};return[...hM,...e].forEach(o=>{const i=t[o];Bo(i)||od(i)||i===""||(n[o]=i)}),n},Mit=t=>{let e=5381,n=2166136261;for(let o=0;t.length>o;o++){const i=t.charCodeAt(o);e=33*e^i,n=Math.imul(n^i,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(n>>>0).toString(36)},Dit=(t,e)=>({p:e,f:Mit(JSON.stringify(t))}),Nit=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const n=rd.Dt(cte(t)),o=n?.f===Mit(e)&&rs(n.p);return{properties:o?n.p:[],isValid:o}}catch{return{properties:[],isValid:!1}}},iye=(t,e)=>e+"|"+(rd.Ot(cte(t))||""),ak={},rye={Et:()=>!0,Pt(t){gi.error("memoryStorage error: "+t)},Ot:t=>t in ak?ak[t]:null,Dt:t=>t in ak?ak[t]:null,At:(t,e)=>(ak[t]=e,!0),Lt(t){delete ak[t]}};let pM=null;const j0={Et(){if(!od(pM))return pM;if(pM=!0,Bo(Un))pM=!1;else try{const t="__support__";j0.At(t,"xyz"),j0.Ot(t)!=='"xyz"'&&(pM=!1),j0.Lt(t)}catch{pM=!1}return pM},Pt(t){gi.error("sessionStorage error: ",t)},Ot(t){try{return Un?.sessionStorage.getItem(t)}catch(e){j0.Pt(e)}return null},Dt(t){try{return JSON.parse(j0.Ot(t))||null}catch{}return null},At(t,e){try{return Un?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){j0.Pt(n)}return!1},Lt(t){try{Un?.sessionStorage.removeItem(t)}catch(e){j0.Pt(e)}}};var MEn=class{constructor(e){this._instance=e}get Rr(){return this._instance.config}get consent(){return this.Lo()?0:this.No}isOptedOut(){return this.Rr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Rr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Rr.opt_out_capturing_by_default}optInOut(e){this.qo.At(this.jo,e?1:0,this.Rr.cookie_expiration,this.Rr.cross_subdomain_cookie,this.Rr.secure_cookie)}reset(){this.qo.Lt(this.jo,this.Rr.cross_subdomain_cookie)}get jo(){const{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:o}=this._instance.config;return o||(n?n+e:"__ph_opt_in_out_"+e)}get No(){const e=this.qo.Ot(this.jo);return mCe(e)?1:ms(jxn,e)?0:-1}get qo(){const e=this.Rr.opt_out_capturing_persistence_type,n=e==="localStorage"?cc:rd,o=n.Et()?n:rye;if(!this.Bo||this.Bo!==o){this.Bo=o;const i=e==="localStorage"?rd:cc;i.Ot(this.jo)&&(this.Bo.Ot(this.jo)||this.optInOut(mCe(i.Ot(this.jo))),i.Lt(this.jo,this.Rr.cross_subdomain_cookie))}return this.Bo}Lo(){return!!this.Rr.respect_dnt&&[w_?.doNotTrack,w_?.msDoNotTrack,Gr.doNotTrack,w_?.globalPrivacyControl].some(e=>mCe(e))}};function Rit(t,e){var n;const o=t==null||(n=t.config)===null||n===void 0?void 0:n.get_current_url;if(!M_(o))return e;try{const i=o(e);return eA(i)&&i?i:e}catch(i){return gi.error("Error in get_current_url, falling back to window.location.href",i),e}}function Tit(t){var e;return t instanceof Element&&(t.id==="__POSTHOG_TOOLBAR__"||!!(!((e=t.closest)===null||e===void 0)&&e.call(t,".toolbar-global-fade-container")))}function A9(t){return!!t&&t.nodeType===1}function H1(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function kit(t){return!!t&&t.nodeType===3}function sye(t){return!!t&&t.nodeType===11&&A9(t.host)}function aye(t){return t?Hee(t).split(/\s+/):[]}function Fit(t,e){const n=(function(o){var i;const r=Un==null||(i=Un.location)===null||i===void 0?void 0:i.href;return Bo(r)?void 0:Rit(o,r)})(e);return!!(n&&t&&t.some(o=>n.match(o)))}function Ak(t){let e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return aye(e)}function Lit(t){return zs(t)?null:Hee(t).split(/(\s+)/).filter(e=>QK(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function BK(t){let e="";return ck(t)&&!bK(t)&&t.childNodes&&t.childNodes.length&&El(t.childNodes,function(n){var o;kit(n)&&n.textContent&&(e+=(o=Lit(n.textContent))!==null&&o!==void 0?o:"")}),Hee(e)}function SK(t){var e;return Bo(t.target)?t.srcElement||null:!((e=t.target)===null||e===void 0)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}const Aye=["a","button","form","input","select","textarea","label"];function cye(t,e){const n=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!n&&n.call(t,e)}catch{return!1}}function lye(t,e){if(Bo(e))return!0;for(const n of t)if(e.some(o=>cye(n,o)))return!0;return!1}function Hit(t){const e=t.parentNode;return!(!e||!A9(e))&&e}const gye=[".ph-no-autocapture","[data-ph-no-autocapture]"],Oit=["next","previous","prev",">","<"],DEn=[...Oit,"+","-","−","–"],Git=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Yit=[".ph-no-rageclick",".ph-no-capture"],NEn=["","text","search","email","password","url","tel","number"];function Uit(t,e){if(!Un||uye(t))return!1;let n,o,i;var r,s;if(ry(e)?(n=!!e&&Yit,o=void 0,i=!1):(n=(r=e?.css_selector_ignorelist)!==null&&r!==void 0?r:Yit,o=e?.content_ignorelist,i=(s=e?.ignore_text_selection)!==null&&s!==void 0&&s),n===!1||i&&(function(A){return!(!A||!A9(A))&&(!!H1(A,"textarea")||(H1(A,"input")?ms(NEn,(A.getAttribute("type")||"").toLowerCase()):(function(c){var l;if(c.isContentEditable)return!0;const g=(l=c.getAttribute)===null||l===void 0?void 0:l.call(c,"contenteditable");return g==="true"||g===""})(A)))})(t))return!1;const{targetElementList:a}=Kit(t,!1);return!(function(A,c){if(A===!1||Bo(A))return!1;let l;if(A===!0)l=Oit;else{if(!rs(A))return!1;if(A.length>10)return gi.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;l=A.map(g=>g.toLowerCase())}return c.some(({safeText:g,ariaLabel:u})=>l.some(h=>Git(g,h)||Git(u,h)))})(o,a.map(A=>{var c;return{safeText:BK(A).toLowerCase(),ariaLabel:((c=A.getAttribute("aria-label"))===null||c===void 0?void 0:c.toLowerCase().trim())||""}}))&&!lye(a,n)}const uye=t=>!t||H1(t,"html")||!A9(t),Kit=(t,e)=>{if(!Un||uye(t))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const o=[t];let i=t;for(;i.parentNode&&!H1(i,"body");){if(sye(i.parentNode)){o.push(i.parentNode.host),i=i.parentNode.host;continue}const r=Hit(i);if(!r)break;if(e||Aye.indexOf(r.tagName.toLowerCase())>-1)n=!0;else try{const s=Un.getComputedStyle(r);s&&s.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}o.push(r),i=r}return{parentIsUsefulElement:n,targetElementList:o}};function ck(t){const e=new Set;let n=0;for(let r=t;r.parentNode&&!H1(r,"body");r=r.parentNode){if(n++>=1e3||e.has(r))return!1;e.add(r);const s=Ak(r);if(ms(s,"ph-sensitive")||ms(s,"ph-no-capture"))return!1}if(ms(Ak(t),"ph-include"))return!0;const o=t.type||"";if(eA(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}const i=t.name||t.id||"";return!eA(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,""))}function bK(t){return!!(H1(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||H1(t,"select")||H1(t,"textarea")||t.getAttribute("contenteditable")==="true")}const Vit=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}))$"),zit=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,REn=[16,15,14,13],TEn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Jit=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Wit=/[0-9A-Za-z_]/;function kEn(t){let e=0,n=!1;for(let o=t.length-1;o>=0;o--){let i=t.charCodeAt(o)-48;n&&(i*=2,i>9&&(i-=9)),e+=i,n=!n}return e%10==0}function QK(t,e=!0){return!(zs(t)||eA(t)&&(t=Hee(t),(e?Vit.test((t||"").replace(/[- ]/g,"")):(function(n){let o;for(zit.lastIndex=0;o=zit.exec(n);){const i=o[2];if(!i)continue;const r=i.replace(/[- ]/g,"");for(let s=0;r.length>s;s++)for(const a of REn){const A=s+a;if(r.length>=A){const c=r.slice(s,A);if(Vit.test(c)&&kEn(c))return!0}}}return!1})(t))||(e?TEn.test(t):(function(n){let o;for(Jit.lastIndex=0;o=Jit.exec(n);){const i=o[1],r=o[3];if(!(i&&r&&Wit.test(i)&&Wit.test(r)))return!0}return!1})(t))))}function jit(t){let e=BK(t);return e=`${e} ${qit(t)}`.trim(),QK(e)?e:""}function qit(t){let e="";return t&&t.childNodes&&t.childNodes.length&&El(t.childNodes,function(n){var o;if(n&&((o=n.tagName)===null||o===void 0?void 0:o.toLowerCase())==="span")try{const i=BK(n);e=`${e} ${i}`.trim(),n.childNodes&&n.childNodes.length&&(e=`${e} ${qit(n)}`.trim())}catch(i){gi.error("[AutoCapture]",i)}}),e}function Xit(t){return t.replace(/"|\\"/g,'\\"')}function FEn(t){const e=t.attr__class;if(e)return rs(e)?e:aye(e)}const lte=id("[Dead Clicks]"),LEn=()=>!0,HEn=t=>{var e;const n=!!(!((e=t.instance.persistence)===null||e===void 0)&&e.get_property(YCe)),o=t.instance.config.capture_dead_clicks;return ry(o)?o:!!CA(o)||n};var $it=class{get lazyLoadedDeadClicksAutocapture(){return this.Ho}constructor(e,n,o){this.instance=e,this.isEnabled=n,this.onCapture=o,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const n=e.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[YCe]:n.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Uo()}):this.stop()}zo(e){var n,o,i;!((n=Gr.__PosthogExtensions__)===null||n===void 0)&&n.initDeadClicksAutocapture?e():(o=Gr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this.instance,"dead-clicks-autocapture",r=>{r?lte.error("failed to load script",r):e()})}Uo(){var e;if(No){if(!this.Ho&&(!((e=Gr.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const n=CA(this.instance.config.capture_dead_clicks)?sn({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Ho=Gr.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Ho.start(No),lte.info("starting...")}}else lte.error("`document` not found. Cannot start.")}stop(){this.Ho&&(this.Ho.stop(),this.Ho=void 0,lte.info("stopping..."))}};const vK=id("[SegmentIntegration]");function Zit(t,e,n=!0){const o=t.config.segment;if(!o)return e();const{analytics:i,filterProperties:r}=(a=>M_(a.register))(s=o)?{analytics:s}:s;var s;(function(a,A,c,l){const g=h=>{const d=()=>h.anonymousId()||y4();a.config.get_device_id=d,l&&h.id()&&(a.register({distinct_id:h.id(),$device_id:d()}),a.persistence.set_property(sy,ste)),c(l?void 0:h.anonymousId()||void 0)},u=A.user();"then"in u&&M_(u.then)?u.then(g):g(u)})(t,i,a=>{i.register(((A,c,{filterProperties:l}={})=>{typeof Promise<"u"&&Promise.resolve||vK.warn("This browser does not have Promise support, and can not use the segment integration");const g=(u,h)=>{if(!h)return u;const d=!!c&&u.event.anonymousId===c&&!u.event.userId;d||u.event.userId||u.event.anonymousId===A.get_distinct_id()||(vK.info("No userId set, resetting PostHog"),A.reset()),d||(c=void 0),u.event.userId&&u.event.userId!==A.get_distinct_id()&&(vK.info("UserId set, identifying with PostHog"),A.identify(u.event.userId));let p=A.calculateEventProperties(h,u.event.properties);if(!zs(l)){const m=u.event.properties||{},_={};for(const I of Object.keys(p))hCe.call(m,I)||(_[I]=p[I]);const f=((I,C)=>{const y=rs(I)?I:[I];let x=sn({},C);for(const E of y)try{if(x=E(x),zs(x))return null}catch(B){return vK.error("Error in Segment filterProperties:",B),null}return x})(l,_);if(zs(f))return u;p=f}return u.event.properties=Object.assign({},p,u.event.properties),u};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(u){return g(u,u.event.event)},page(u){return g(u,XCe)},identify(u){return g(u,bit)},screen(u){return g(u,"$screen")}}})(t,a,{filterProperties:r})).then(()=>{e()},A=>{vK.error("Failed to register the Segment integration",A),e()})},n)}const ert="posthog-js";function trt(t,{organization:e,projectId:n,prefix:o,severityAllowList:i=["error"],sendExceptionsToPostHog:r=!0}={}){return s=>{var a,A,c,l,g;if(i!=="*"&&!i.includes(s.level)||!t.__loaded)return s;s.tags||(s.tags={});const u=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);s.tags["PostHog Person URL"]=u,t.sessionRecordingStarted()&&(s.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const h=((a=s.exception)===null||a===void 0?void 0:a.values)||[],d=h.map(_=>sn(sn({},_),{},{stacktrace:_.stacktrace?sn(sn({},_.stacktrace),{},{type:"raw",frames:(_.stacktrace.frames||[]).map(f=>sn(sn({},f),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:((A=h[0])===null||A===void 0?void 0:A.value)||s.message,$exception_type:(c=h[0])===null||c===void 0?void 0:c.type,$exception_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:((l=h[0])===null||l===void 0?void 0:l.value)||s.message,$sentry_exception_type:(g=h[0])===null||g===void 0?void 0:g.type,$sentry_tags:s.tags};var m;return e&&n&&(p.$sentry_url=(o||"https://sentry.io/organizations/")+e+"/issues/?project="+n+"&query="+s.event_id),r&&((m=t.exceptions)===null||m===void 0||m.sendExceptionEvent(p)),s}}var OEn=class{constructor(e,n,o,i,r,s){this.name=ert,this.setupOnce=function(a){a(trt(e,{organization:n,projectId:o,prefix:i,severityAllowList:r,sendExceptionsToPostHog:s==null||s}))}}},nrt=class{constructor(e){this.Wo=(n,o,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(gi.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:i}),this.Vo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Go()}Go(){var e;this.Zo=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Wo)}destroy(){var e;(e=this.Zo)===null||e===void 0||e.call(this),this.Zo=void 0}doPageView(e,n){var o;const i=this.Qo(e,n);return this.Vo={pathname:(o=Un?.location.pathname)!==null&&o!==void 0?o:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var n;return this.Qo(e,(n=this.Vo)===null||n===void 0?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Vo)===null||e===void 0?void 0:e.pageViewId}}Qo(e,n){const o=this.Vo;if(!o)return{$pageview_id:n};let i={$pageview_id:n,$prev_pageview_id:o.pageViewId};const r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:s,lastScrollY:a,maxScrollY:A,maxContentHeight:c,lastContentY:l,maxContentY:g}=r;if(!(Bo(s)||Bo(a)||Bo(A)||Bo(c)||Bo(l)||Bo(g))){s=Math.ceil(s),a=Math.ceil(a),A=Math.ceil(A),c=Math.ceil(c),l=Math.ceil(l),g=Math.ceil(g);const u=s>1?s9(a/s,0,1,gi):1,h=s>1?s9(A/s,0,1,gi):1,d=c>1?s9(l/c,0,1,gi):1,p=c>1?s9(g/c,0,1,gi):1;i=Cg(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:u,$prev_pageview_max_scroll:A,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:d,$prev_pageview_max_content:g,$prev_pageview_max_content_percentage:p})}}return o.pathname&&(i.$prev_pageview_pathname=o.pathname),o.timestamp&&(i.$prev_pageview_duration=(e.getTime()-o.timestamp.getTime())/1e3),i}};const PK=["flags","surveys"],GEn={[W3n]:{exposure:"hidden"},[ite]:{exposure:"hidden"},[j3n]:{exposure:"hidden"},[FCe]:{exposure:"hidden"},[nk]:{exposure:"hidden"},[mK]:{exposure:"hidden"},[Ait]:{exposure:"event"},[LCe]:{exposure:"hidden"},[lit]:{exposure:"hidden"},[HCe]:{exposure:"event"},[cit]:{exposure:"hidden"},[OCe]:{exposure:"event"},[GCe]:{exposure:"event"},[YCe]:{exposure:"event"},[UCe]:{exposure:"hidden"},[git]:{exposure:"event"},[_K]:{exposure:"hidden"},[q3n]:{exposure:"hidden"},[ok]:{exposure:"hidden"},[uit]:{exposure:"event"},[X3n]:{exposure:"event",shouldSkipFromEventProperties:t=>od(t)},[nEn]:{exposure:"event"},[oEn]:{exposure:"event"},[iEn]:{exposure:"event"},[rEn]:{exposure:"event"},[sEn]:{exposure:"hidden"},[C4]:{exposure:"hidden",storageGroup:"flags"},[n8]:{exposure:"hidden",storageGroup:"flags"},[KCe]:{exposure:"hidden"},[gM]:{exposure:"hidden",storageGroup:"flags"},[Ub]:{exposure:"hidden",storageGroup:"flags"},[uM]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[fK]:{exposure:"hidden",storageGroup:"flags"},[a9]:{exposure:"hidden"},[dM]:{exposure:"hidden"},[Kb]:{exposure:"hidden"},[Vb]:{exposure:"hidden"},[VCe]:{exposure:"hidden",storageGroup:"surveys"},[rte]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[hit]:{exposure:"event"},[pit]:{exposure:"hidden"},[mit]:{exposure:"hidden"},[zCe]:{exposure:"hidden"},[aEn]:{exposure:"hidden"},[AEn]:{exposure:"hidden"},[cEn]:{exposure:"event"},[lEn]:{exposure:"event"},[gEn]:{exposure:"event"},[uEn]:{exposure:"event"},[zb]:{exposure:"hidden"},[IK]:{exposure:"hidden"},[dit]:{exposure:"event"},[CK]:{exposure:"hidden"},[Jb]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[sy]:{exposure:"hidden"},[JCe]:{exposure:"hidden"},[dEn]:{exposure:"hidden"},[_it]:{exposure:"hidden"},[fit]:{exposure:"hidden"},[ik]:{exposure:"hidden"},[WCe]:{exposure:"hidden"},[$3n]:{exposure:"event"},[Z3n]:{exposure:"event"},[eEn]:{exposure:"event"},[tEn]:{exposure:"event"},[Cit]:{exposure:"event"},[yit]:{exposure:"event"},[xit]:{exposure:"event"},[Eit]:{exposure:"event"},[hEn]:{exposure:"event"},[pEn]:{exposure:"event"},[mEn]:{exposure:"event"},[_En]:{exposure:"event"},[fEn]:{exposure:"event"},[IEn]:{exposure:"event"},[CEn]:{exposure:"event"},[yEn]:{exposure:"event"}},YEn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],kf=t=>{const e=GEn[t];if(e)return e;for(const[n,o]of YEn)if(t.indexOf(n)===0)return o},lk=(t,e)=>{try{let n;return JSON.stringify(t,(o,i)=>{var r;return ZT(i)?((r=n)!==null&&r!==void 0||(n=new WeakMap),n.has(i)||n.set(i,vit(i)),n.get(i)):typeof i=="bigint"?i.toString():i},e)}catch{return Ont(t)}},Wb=t=>{const e=No?.createElement("a");return Bo(e)?null:(e.href=t,e)},gk=function(t,e){const n=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let o;for(let i=0;n.length>i;i++){const r=n[i].split("=");if(r[0]===e){o=r;break}}if(!rs(o)||2>o.length)return"";{let i=o[1];try{i=decodeURIComponent(i)}catch{gi.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")}},wK=function(t,e,n){if(!t||!e||!e.length)return t;const o=t.split("#"),i=o[1],r=(o[0]||"").split("?"),s=r[1],a=r[0],A=(s||"").split("&"),c=[];for(let g=0;A.length>g;g++){const u=A[g].split("=");rs(u)&&(e.includes(u[0])?c.push(u[0]+"="+n):c.push(A[g]))}let l=a;return s!=null&&(l+="?"+c.join("&")),i!=null&&(l+="#"+i),l},gte=function(t,e){const n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},ort=(t,e)=>t>=e&&Hnt(),irt=(t,e,n,o)=>{if(t===0){if(Hnt()){const i=e+1;return i===n&&o(),i}return e}return 0},uk=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],UEn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...uk],MK="<masked>",KEn=["li_fat_id"];function rrt(t,e,n){if(!No)return{};const o=e?[...uk,...n||[]]:[],i=srt(wK(No.URL,o,MK),t),r=(function(){const s={};return El(KEn,function(a){const A=xK(a);s[a]=A||null}),s})();return Cg(r,i)}function srt(t,e){const n=UEn.concat(e||[]),o={};return El(n,function(i){const r=gk(t,i);o[i]=r||null}),o}function art(t){const e=(function(i){return i?i.search("https?://(.*)google.([^/?]*)")===0?"google":i.search("https?://(.*)bing.com")===0?"bing":i.search("https?://(.*)yahoo.com")===0?"yahoo":i.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(t),n=e!="yahoo"?"q":"p",o={};if(!od(e)){o.$search_engine=e;const i=No?gk(No.referrer,n):"";i.length&&(o.ph_keyword=i)}return o}function Art(){return navigator.language||navigator.userLanguage}function VEn(){const t=Art();return typeof t=="string"?t.split("-")[0]:void 0}const ute="$direct";function crt(){return No?.referrer||ute}function lrt(t,e,n=!1){const o=t?[...uk,...e||[]]:[],i=n?Yb(nd?.href):nd?.href,r=i?.substring(0,1e3);return{r:crt().substring(0,1e3),u:r?wK(r,o,MK):void 0}}function grt(t,e=!1){var n;const{r:o,u:i}=t,r=e?Yb(i):i,s={$referrer:o,$referring_domain:o==null?void 0:o==ute?ute:(n=Wb(o))===null||n===void 0?void 0:n.host};if(r){s.$current_url=r;const a=Wb(r);s.$host=a?.host,s.$pathname=a?.pathname;const A=srt(r);Cg(s,A)}if(o){const a=art(o);Cg(s,a)}return s}function urt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function zEn(){try{return new Date().getTimezoneOffset()}catch{return}}const JEn={flags:Jb,surveys:rte},WEn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],dte=t=>`${t}_cookie_identity_change_pending`,hte=t=>{let e="",n=0;for(const o of t){const i=encodeURIComponent(JSON.stringify(o).slice(1,-1)).length;if(n+i>1e3)break;e+=o,n+=i}return e},Lm="main",i8=[C4,n8,gM,Ub,uM,Jb,fK,Kb],dye=t=>i8.indexOf(t)!==-1,drt=[nk,mK],hrt=t=>drt.indexOf(t)!==-1,jb=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch{return t===e}},dk=t=>{if(!t)return{};const e=JSON.parse(t);return CA(e)?e:{}},prt=(t,e)=>{El(t,(n,o)=>{const i=kf(o);i&&i.exposure!=="event"||{}.hasOwnProperty.call(e,o)||delete t[o]})};var hye=class{constructor(e,n,o=!0){if(this.Jo={},this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=!1,this.ia=new Map,this.na=!1,this.sa=!1,this.ra=!1,this.oa=new Set,this.aa=new Set,this.Rr=e,this.la=o,this.props={},this.ua=void 0,this.ha=(i=>{let r="";return i.token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"})(e),this.qo=this.ca(e),this.Yo=this.da(e),this.load(),this.va(),e.debug&&gi.info("Persistence loaded",e.persistence,sn({},this.props)),this.update_config(e,e,n),this.save(),Un){const i=()=>this.flush();dl(Un,"beforeunload",i,{capture:!1}),dl(Un,"pagehide",i,{capture:!1}),this.fa=r=>{if(this.Ko&&(!r.storageArea||r.storageArea===Un?.localStorage)&&r.key)if(r.key!==this.ha){if(this.Yo){const s=PK.find(a=>r.key===this.pa(a));s&&this.ga(r.key,s)}}else this.ga(r.key,Lm)},dl(Un,"storage",this.fa)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([n,o])=>{const i=this.ia.get(n);if(!dye(n)||i===!0)return;if(o===!0)return void this.ma(n,!0);const r=new Set(i||[]);o.forEach(s=>r.add(s)),r.size&&this.ma(n,r)})}onCrossTabFeatureFlagChange(e){return this.aa.add(e),()=>this.aa.delete(e)}destroy(){this.fa&&Un&&(Un.removeEventListener("storage",this.fa),this.fa=void 0),this.aa.clear()}ga(e,n,o=!0){if(this.mi)return!1;let i,r;try{if(r=cc.Ot(e),od(r)){const A=this.ya(n);return A.storageValue=null,n!==Lm&&(A.persisted=!1),!1}i=dk(r)}catch{return!1}const s=n===Lm?i:cc.Dt(this.ha);if(s&&this.ba(s))return!1;const a=this._a(i,n,o);return n===Lm&&this.Yo&&!jb(this.wa().main,i)||this.ka(i,n,!0,r),a}ba(e){const n=this.props[I4],o=e[I4];return!Bo(n)&&!Bo(o)&&n!==o}ka(e,n,o,i){const r=this.ya(n);r.storageValue=i,n!==Lm&&(r.persisted=o);try{r.fingerprint=this.Sa(e,n)}catch{r.fingerprint=void 0}}_a(e,n,o){let i=!1;return i8.forEach(r=>{var s;const a=(s=kf(r))===null||s===void 0?void 0:s.storageGroup;if(n===Lm&&this.Yo&&a||n!==Lm&&a!==n)return;const A=r in e,c=this.xa(r,A?e[r]:void 0),l=this.ia.has(r)?r in this.props:A;l===r in this.props&&jb(c,this.props[r])||(l?this.Ca(r,c,!1):this.$a(r,!1),i=!0)}),i&&o&&this.aa.forEach(r=>r()),i}Ta(){if(!this.Ko)return!1;try{this.ra=!1;const e=cc.Ot(this.ha),n=this.ya(Lm);let o,i=!1,r=!1;if(e!==n.storageValue)if(od(e))n.storageValue=null;else{if(o=dk(e),this.ra=!this.sa&&this.ba(o),this.ra)return!1;r=this._a(o,Lm,!1),!this.Yo||jb(this.wa().main,o)?this.ka(o,Lm,!0,e):n.storageValue=e,i=!0}return this.Yo&&PK.forEach(s=>{const a=cc.Ot(this.pa(s)),A=this.ya(s),c=o||{},l=i&&i8.some(u=>{var h;return((h=kf(u))===null||h===void 0?void 0:h.storageGroup)===s&&u in c});if(a===A.storageValue&&!l)return;if(od(a))return A.storageValue=null,A.persisted=!1,void(l&&(r=this._a(c,s,!1)||r));const g=dk(a);r=this._a(g,s,!1)||r,this.ka(g,s,!0,a)}),r}catch{return!1}}ma(e,n){this.ia.set(e,n);const o=kf(e);o?.volatile||(this.ya((this.Yo?o?.storageGroup:void 0)||Lm).fingerprint=void 0,this.Ia(e))}Ma(){i8.forEach(e=>this.ia.set(e,!0))}va(){if(this.Ko)try{const e=cc.Ot(this.ha),n=dk(e);this.ya(Lm).storageValue=e,i8.forEach(o=>{var i;const r=this.Yo?(i=kf(o))===null||i===void 0?void 0:i.storageGroup:void 0,s=r?cc.Ot(this.pa(r)):null;if(r){const A=this.ya(r);A.storageValue=s,A.persisted=!od(s)}const a=r&&!od(s)?dk(s):n;o in this.props?this.Ea(o,a[o],this.props[o]):o in a&&this.ma(o,!0)})}catch{}}xa(e,n){const o=this.ia.get(e);if(!o)return n;if(o===!0)return this.props[e];if(e==="$active_feature_flags"){const s=new Set(rs(n)?n:[]),a=new Set(rs(this.props[e])?this.props[e]:[]);return o.forEach(A=>a.has(A)?s.add(A):s.delete(A)),Array.from(s)}const i=CA(n)?sn({},n):{},r=CA(this.props[e])?this.props[e]:{};return o.forEach(s=>{s in r?i[s]=r[s]:delete i[s]}),i}Ea(e,n,o){if(!dye(e))return;const i=this.ia.get(e);if(i===!0)return;let r=n;if(this.Ko)try{var s;const A=this.Yo?(s=kf(e))===null||s===void 0?void 0:s.storageGroup:void 0,c=A?this.pa(A):this.ha;r=dk(cc.Ot(c))[e]}catch{}const a=new Set(i||[]);if(e==="$active_feature_flags"){if(!Bo(n)&&!rs(n)||!Bo(r)&&!rs(r)||!rs(o))return void this.ma(e,!0);const A=new Set(n||[]),c=new Set(r||[]),l=new Set(o);new Set([...A,...l]).forEach(g=>{A.has(g)!==l.has(g)&&a.add(g)}),a.forEach(g=>{c.has(g)===l.has(g)&&a.delete(g)})}else{if(!CA(o))return void(jb(r,o)?this.ia.delete(e):this.ma(e,!0));{if(!Bo(n)&&!CA(n)||Bo(n)&&z2(o)&&Bo(r))return void this.ma(e,!0);const A=CA(n)?n:{},c=CA(r)?r:{};new Set([...Object.keys(A),...Object.keys(o)]).forEach(l=>{l in A==l in o&&jb(A[l],o[l])||a.add(l)}),a.forEach(l=>{l in c==l in o&&jb(c[l],o[l])&&a.delete(l)})}}a.size?this.ma(e,a):this.ia.delete(e)}Pa(){var e;const n=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return zd(n)&&n>0?n:0}Ra(e){if(this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const n=oye(e,this.Rr.cookie_persisted_properties||[]),o=Dit(n,this.Rr.cookie_persisted_properties||[]),i=JSON.stringify(n)+"|"+JSON.stringify(o),r=rd.Ot(this.ha)||void 0;r&&iye(this.ha,r)===i&&(this.Aa=i,this.Fa=r)}catch{}else try{const n=rd.Ot(this.ha)||void 0;this.Aa=n?iye(this.ha,n):void 0,this.Fa=n}catch{}}syncCookieProperties(){return this.Oa(this.Rr)}Oa(e,n=!1){if(this.mi&&!n||this.ea||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let o;try{o=rd.Ot(this.ha)||void 0}catch{}if(!o||o===this.Fa)return!1;const i=iye(this.ha,o);let r;try{r=nye(JSON.parse(o))}catch{return!1}if((rd.Ot(this.ha)||void 0)!==o)return!1;this.Aa=i,this.Fa=o;const s=Nit(this.ha,o),a=[...hM,...s.properties],A={};if(Object.keys(r).forEach(m=>{const _=r[m];(Bo(_)||od(_)||_===""||m==="$user_state"&&_!=="anonymous"&&_!=="identified")&&(A[m]=!0,delete r[m])}),z2(r))return!1;const c="distinct_id"in r||r.$user_state==="anonymous"||r.$user_state==="identified",l=this.props,g=l[I4],u=l[sy],h=Cg({},l);[...hM,...e.cookie_persisted_properties||[]].forEach(m=>{if(a.indexOf(m)!==-1&&!(m in r)&&!A[m]&&(c||m!=="distinct_id"&&m!=="$user_state")){const _=h[m];(s.isValid||hM.indexOf(m)===-1||_!==!1&&_!==0)&&delete h[m]}}),this.props=Cg(h,r),i8.forEach(m=>{const _=m in this.props;m in l===_&&jb(l[m],this.props[m])||(_?this.Ea(m,l[m],this.props[m]):this.ma(m,!0))}),!c||"$user_state"in r||"$user_state"in this.props||this.Ca(sy,o8);const d=this.props[I4],p=this.props[sy];return!c||d===g&&p===u||(this.sa=!0,this.ta=!0,j0.At(dte(this.ha),!0),this.$a(Kb),this.$a(n8),this.$a(C4),this.$a(gM),this.$a(Ub),this.$a(uM),this.$a(Jb),this.$a(CK),this.$a(zb),p!=="anonymous"||u!=="identified"&&r.$user_state!=="anonymous"&&(Bo(g)||d===g)||(prt(this.props,r),this.$a(Vb)),p==="identified"?this.props.$user_id=d:delete this.props.$user_id,this.$a(ite)),!0}consumeCookieIdentityChange(){const e=dte(this.ha),n=this.ta||!!j0.Ot(e);return this.ta=!1,n&&j0.Lt(e),n}Da(e=!1){return!(this.ea||this.mi&&!e||!this.Rr.cookieWinsOnConflict||this.Rr.persistence.toLowerCase()!=="localstorage+cookie"||(this.ea=!0,0))}La(){this.ea&&(Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0),delete this.Jo[Lm],this.qa(!0))}ja(e=!0){if(this.ea)try{e?this.La():Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0)}finally{this.ea=!1}}isDisabled(){return!!this.mi}ca(e){WEn.indexOf(e.persistence.toLowerCase())===-1&&(gi.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const n=((a=[],A=!1)=>{const c=[...hM,...a];return sn(sn({},cc),{},{Dt(l){try{let u,h={};try{u=rd.Ot(l)||void 0,h=u?nye(JSON.parse(u)):{}}catch{}const d=JSON.parse(cc.Ot(l)||"{}");let p;if(A){const m=Nit(l,u),_=[...hM,...m.properties],f={};Object.keys(h).forEach(C=>{const y=h[C];od(y)||y===""||C==="$user_state"&&y!=="anonymous"&&y!=="identified"||(f[C]=y)});const I="distinct_id"in f||f.$user_state==="anonymous"||f.$user_state==="identified";if(Object.keys(f).length>0){var g;const C=d[I4],y=(g=d.$user_state)!==null&&g!==void 0?g:o8;c.forEach(x=>{if(_.indexOf(x)!==-1&&!(x in h)&&(I||x!=="distinct_id"&&x!=="$user_state")){const E=d[x];(m.isValid||hM.indexOf(x)===-1||E!==!1&&E!==0)&&delete d[x]}}),!I||"$user_state"in h||"$user_state"in d||(d[sy]=o8),!I||("distinct_id"in f?f[I4]:d[I4])===C&&("$user_state"in f?f[sy]:d[sy])===y||(tye.forEach(x=>delete d[x]),f.$user_state==="identified"&&"distinct_id"in f?d.$user_id=f[I4]:delete d.$user_id,f.$user_state!=="identified"&&(delete d[dit],delete d[Vb]),delete d.__alias)}p=Cg(d,f)}else p=Cg(h,d);return cc.At(l,p),p}catch{}return null},At(l,g,u,h,d,p){const m=cc.At(l,g,void 0,void 0,p);try{const _=oye(g,a);if(Object.keys(_).length){if(A){const f=cte(l),I=Dit(_,a);if(rd.At(f,I,u,h,d,p),rd.Ot(f)!==JSON.stringify(I)){rd.Lt(f,h);const C=oye(g);return rd.At(l,C,u,h,d,p),m}}rd.At(l,_,u,h,d,p)}}catch(_){cc.Pt(_)}return m},Lt(l,g){try{Un?.localStorage.removeItem(l),rd.Lt(l,g),rd.Lt(cte(l),g)}catch(u){cc.Pt(u)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let o,i=!1,r=!1;const s=e.persistence.toLowerCase();return s==="localstorage"&&cc.Et()?(o=cc,r=!0):s==="localstorage+cookie"&&n.Et()?(o=n,r=!0,i=!0):s==="sessionstorage"&&j0.Et()?o=j0:s==="memory"?o=rye:s==="cookie"&&rd.Et()?(o=rd,i=!0):n.Et()?(o=n,r=!0,i=!0):rd.Et()?(o=rd,i=!0):o=rye,this.Ko=r,this.Xo=i,o}pa(e){return`${this.ha}__${e}`}da(e){return this.Ko&&!!e.split_storage}properties(){const e={};return El(this.props,(n,o)=>{const i=kf(o);if(!i||i.exposure==="event"){var r;if(!(i==null||(r=i.shouldSkipFromEventProperties)===null||r===void 0)&&r.call(i,n))return;e[o]=n}}),e}load(e=!1){if(this.mi&&!e)return;const n=this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie",o=n?cc.Dt(this.ha):null;let i={};if(n)try{i=nye(rd.Dt(this.ha)),El(i,(A,c)=>{(Bo(A)||od(A)||A==="")&&delete i[c]})}catch{}const r=this.qo.Dt(this.ha);if(r&&(this.props=Cg({},r)),this.Yo&&this.Ba(),n&&r){var s,a;const A=o?.[I4],c=(s=o?.$user_state)!==null&&s!==void 0?s:o8,l=r[I4],g=(a=r.$user_state)!==null&&a!==void 0?a:o8;if(l!==A||g!==c){this.ta=!0,j0.At(dte(this.ha),!0);const u=Cg({},this.props);tye.forEach(d=>delete u[d]),g!=="anonymous"||c!=="identified"&&i.$user_state!=="anonymous"&&(Bo(A)||l===A)||(prt(u,i),delete u[Vb]),this.props=u;const h=new Set;tye.forEach(d=>{var p;const m=(p=kf(d))===null||p===void 0?void 0:p.storageGroup;m&&h.add(m)}),h.forEach(d=>{const p={};El(this.props,(m,_)=>{var f;((f=kf(_))===null||f===void 0?void 0:f.storageGroup)===d&&(p[_]=m)}),z2(p)?(cc.Lt(this.pa(d)),this.Jo[d]={}):cc.At(this.pa(d),p)&&(this.Jo[d]={persisted:!0,fingerprint:this.Sa(p,d)})})}}j0.Ot(dte(this.ha))&&(this.ta=!0)}Ba(){for(const e of PK){const n=cc.Dt(this.pa(e));if(n&&!z2(n)){const o=this.ya(e);o.persisted=!0,this.Ha(e)||(o.fingerprint=this.Sa(n,e)),this.za(e,n)||Cg(this.props,n)}}}Ha(e){return Object.keys(this.props).some(n=>{var o;return((o=kf(n))===null||o===void 0?void 0:o.storageGroup)===e})}za(e,n){const o=JEn[e];if(!o)return!1;const i=n[o],r=this.props[o];return zd(i)&&zd(r)&&r>i}refreshKey(e){var n;if(this.mi||this.oa.has(e))return;const o=this.Yo?(n=kf(e))===null||n===void 0?void 0:n.storageGroup:void 0,i=o?cc.Dt(this.pa(o)):this.qo.Dt(this.ha);if(i&&e in i)this.Ca(e,i[e],!1);else{if(o){const r=this.qo.Dt(this.ha);if(r&&e in r)return void this.Ca(e,r[e],!1)}this.$a(e,!1)}}save(){if(this.mi)return;const e=this.Pa();e>0?Bo(this.Na)&&(this.Na=setTimeout(()=>{this.Na=void 0,this.qa()},e)):this.qa()}flush(){Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0,this.qa())}qa(e=!1){if(this.mi||this.ea&&!e)return;e||(this.syncCookieProperties(),this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie"||drt.forEach(r=>this.refreshKey(r)));const n=!e&&!this.na;n||(this.ra=!1);const o=!!n&&this.Ta();if(this.ra)return void(this.Rr.debug&&gi.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Yo)return this.Ua(),void(o&&this.aa.forEach(r=>r()));const i=this.Wa(this.qo,this.ha,this.props,Lm);i==="written"&&this.Ra(this.props),i!=="failed"&&(this.ia.clear(),this.sa=!1,this.oa.clear()),o&&this.aa.forEach(r=>r())}Ua(){const{main:e,groups:n}=this.wa(),o=this.Wa(this.qo,this.ha,e,Lm);o==="written"&&this.Ra(e),o!=="failed"&&(this.sa=!1,this.oa.clear(),i8.forEach(r=>{var s;!((s=kf(r))===null||s===void 0)&&s.storageGroup||this.ia.delete(r)}));for(const r of PK){var i;const s=n[r];if(z2(s)&&!(!((i=this.Jo[r])===null||i===void 0)&&i.persisted)){i8.forEach(A=>{var c;((c=kf(A))===null||c===void 0?void 0:c.storageGroup)===r&&this.ia.delete(A)});continue}const a=this.Wa(cc,this.pa(r),s,r);a!=="failed"&&i8.forEach(A=>{const c=kf(A);c?.storageGroup!==r||a!=="written"&&c.volatile||this.ia.delete(A)})}}wa(){const e={},n={flags:{},surveys:{}};return El(this.props,(o,i)=>{var r;const s=(r=kf(i))===null||r===void 0?void 0:r.storageGroup;s?n[s][i]=o:e[i]=o}),{main:e,groups:n}}Sa(e,n){if(n===Lm)return JSON.stringify(e)+"|"+this.Va+"|"+this.Ga+"|"+this.Za;const o={};return El(e,(i,r)=>{var s;o[r]=!((s=kf(r))===null||s===void 0)&&s.volatile?"__volatile__":i}),JSON.stringify(o)}Wa(e,n,o,i){const r=this.ya(i);if(i!==Lm&&!r.dirty&&!Bo(r.fingerprint))return"skipped";let s;try{if(s=this.Sa(o,i),s===r.fingerprint)return r.dirty=!1,"skipped"}catch{s=void 0}return e.At(n,o,this.Va,this.Ga,this.Za,this.Rr.debug)?(r.dirty=!1,i!==Lm&&(r.persisted=!0),Bo(s)||(r.fingerprint=s),this.Ko&&(r.storageValue=cc.Ot(n)),"written"):(this.Rr.debug&&gi.warn(`failed to persist storage entry "${n}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ma(),Bo(this.Na)||(clearTimeout(this.Na),this.Na=void 0),this.qo.Lt(this.ha,!1),this.qo.Lt(this.ha,!0),!e&&this.la)for(const n of PK)cc.Lt(this.pa(n));e?delete this.Jo[Lm]:this.Jo={},this.Aa=void 0,this.Fa=void 0}clear(){this.remove(),this.props={}}register_once(e,n,o){if(CA(e)){this.syncCookieProperties(),Bo(n)&&(n="None"),this.Va=Bo(o)?this.Qa:o;let i=!1;if(El(e,(r,s)=>{this.props.hasOwnProperty(s)&&this.props[s]!==n||(this.Ca(s,r),i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(CA(e)){this.syncCookieProperties(),this.Va=Bo(n)?this.Qa:n;let o=!1;if(El(e,(i,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==i||CA(i)||rs(i))&&(this.Ca(r,i),o=!0)}),o)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const n=typeof e=="string"?[e]:e;let o=!1;for(const i of n)i in this.props&&(this.$a(i),o=!0);o&&this.save()}update_campaign_params(){const e=No?.URL;if(e===this.ua)return;const n=rrt(this.Rr.custom_campaign_params,this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties),o=!z2($Ce(n));return o&&this.register(n),this.ua=e,o?n:void 0}update_search_keyword(){this.register((function(){const e=No?.referrer;return e?art(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:crt(),$referring_domain:No?.referrer&&((e=Wb(No.referrer))===null||e===void 0?void 0:e.host)||ute},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=lrt(this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties,this.Rr.disable_capture_url_hashes);this.register_once({[ik]:this.Xo?{r:hte(e.r),u:e.u?hte(e.u):void 0}:e},void 0)}get_initial_props(){const e={};El([fit,_it],o=>{const i=this.props[o];i&&El(i,function(r,s){e["$initial_"+dCe(s)]=r})});const n=this.props[ik];if(n){const o=(function(i,r=!1){const s=grt(i,r),a={};return El(s,function(A,c){a[`$initial_${dCe(c)}`]=A}),a})(n,this.Rr.disable_capture_url_hashes);Cg(e,o)}return e}safe_merge(e){return El(this.props,function(n,o){o in e||(e[o]=n)}),e}update_config(e,n,o){const i=e.persistence!==n.persistence,r=!((d,p)=>{if(d.length!==p.length)return!1;const m=[...d].sort(),_=[...p].sort();return m.every((f,I)=>f===_[I])})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),s=i||r,a=e.cookieWinsOnConflict!==n.cookieWinsOnConflict,A=e.disable_persistence||!!o,c=!!this.mi&&!A;A||this.Oa(n,c),this.Rr=e,!A&&(i||r||a)&&(this.Aa=void 0,this.Fa=void 0,this.Oa(sn(sn({},e),{},{cookie_persisted_properties:n.cookie_persisted_properties}),c));const l=s||a?this.ca(e):this.qo;this.Ja();const g=this.da(e),u=s||g!==this.Yo,h=!A&&(u||e.cross_subdomain_cookie!==this.Ga||e.secure_cookie!==this.Za)&&this.Da(c);this.na=u;try{if(this.Qa=this.Va=e.cookie_expiration,this.set_disabled(A),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),u){const d=this.props;this.clear(),this.qo=l,this.Yo=g,this.props=d,this.save()}else a&&(this.qo=l,A||(delete this.Jo[Lm],this.qa()))}finally{this.na=!1,h&&this.ja()}}Ja(){const e=this.props[ik];if(!this.Xo||!CA(e)||typeof e.r!="string")return;const n=hte(e.r),o=typeof e.u=="string"?hte(e.u):e.u;n===e.r&&o===e.u||this.Ca(ik,sn(sn({},e),{},{r:n,u:o}))}set_disabled(e){this.mi=e,this.mi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Za&&(this.Za=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,n){const o=this.props.__timers||{};o[e]=n,this.Ca(FCe,o),this.save()}remove_event_timer(e){const n=this.props.__timers||{},o=n[e];return Bo(o)||(delete n[e],this.Ca(FCe,n),this.save()),o}get_property(e){return this.props[e]}set_property(e,n){this.Ca(e,n),this.save()}Ca(e,n,o=!0){var i;const r=this.props[e];this.props[e]=n,o&&(e!=="distinct_id"&&e!=="$user_state"||r===n||(this.sa=!0),hrt(e)&&!jb(r,n)&&this.oa.add(e),this.Ea(e,r,n),!((i=kf(e))===null||i===void 0)&&i.volatile||this.Ia(e))}$a(e,n=!0){delete this.props[e],n&&(dye(e)&&this.ma(e,!0),hrt(e)&&this.oa.add(e),this.Ia(e))}Ia(e){var n;const o=(n=kf(e))===null||n===void 0?void 0:n.storageGroup;o&&(this.ya(o).dirty=!0)}ya(e){return this.Jo[e]||(this.Jo[e]={})}};const y3={GZipJS:"gzip-js",Base64:"base64"},DK={Activation:"events",Cancellation:"cancelEvents"},pye={Popover:"popover",API:"api",Widget:"widget"},r8={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},mye={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},_ye={Popover:"popover",Inline:"inline"};function pte(t){let e=!0;return{dispose(){if(e){e=!1;const n=t();n&&M_(n.then)&&n.then(void 0,()=>{})}}}}const jEn={SHOWN:"product tour shown"},mrt={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},_rt=id("[RateLimiter]");var qEn=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{const o=n.text;if(o&&o.length)try{(JSON.parse(o).quota_limited||[]).forEach(i=>{_rt.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void _rt.warn(`could not rate limit - continuing. Error: "${i?.message}"`,{text:o})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var n,o,i;const{captureEventsBurstLimit:r,captureEventsPerSecond:s}=this,a=new Date().getTime(),A=(n=(o=this.instance.persistence)===null||o===void 0?void 0:o.get_property("$capture_rate_limit"))!==null&&n!==void 0?n:{tokens:r,last:a};A.tokens+=(a-A.last)/1e3*s,A.last=a,A.tokens>r&&(A.tokens=r);const c=1>A.tokens;if(c||e||(A.tokens=Math.max(0,A.tokens-1)),c&&!e){const l=(zd(A.dropped)?A.dropped:0)+1;A.dropped=l,!this.lastEventRateLimited&&this.Ka(l)&&(A.dropped=0)}return this.lastEventRateLimited=c,(i=this.instance.persistence)===null||i===void 0||i.set_property("$capture_rate_limit",A),{isRateLimited:c,remainingTokens:A.tokens}}Xa(e){const n=this.instance.config.property_denylist;return!rs(n)||!n.includes(e)}Ya(){var e;if(this.Xa("$current_url")&&this.Xa("$pathname")&&nd?.pathname)return`${(e=nd.origin)!==null&&e!==void 0?e:""}${nd.pathname}`}Ka(e){var n,o;const{captureEventsBurstLimit:i,captureEventsPerSecond:r}=this,s=this.Ya(),a=this.Xa("$session_id")?(n=(o=this.instance).get_session_id)===null||n===void 0?void 0:n.call(o):void 0,A=[`${e} event(s) dropped since the last warning`,s?`triggered on ${s}`:void 0,a?`session ${a}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${A}. Config is set to ${r} events per second and ${i} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}};const qb=id("[RemoteConfig]");var frt=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Gr._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}tl(e){var n,o,i;!((n=Gr.__PosthogExtensions__)===null||n===void 0)&&n.loadExternalDependency?(o=Gr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}el(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return qb.info("Using preloaded remote config",this.remoteConfig),void this.il(this.remoteConfig);if(this._instance.nl())return void qb.warn("Remote config is disabled. Falling back to local config.");this.tl(e=>{if(!e)return qb.info("No config found after loading remote JS config. Falling back to JSON."),void this.el(n=>{this.il(n.json,n)});this.il(e)})}catch(e){qb.error("Error loading remote config",e),this.il()}}il(e,n){!e&&n&&(n.statusCode===0?n.error||qb.warn("Failed to fetch remote config from PostHog."):qb.error("Failed to fetch remote config from PostHog."));try{this._instance.il(e?{ok:!0,config:e}:{ok:!1})}catch(i){qb.error("Error applying remote config",i)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var o;(o=this._instance.featureFlags)===null||o===void 0||o.ensureFlagsLoaded()}catch(i){qb.error("Error loading feature flags",i)}}},n5=Uint8Array,J2=Uint16Array,hk=Uint32Array,fye=new n5([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Iye=new n5([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Irt=new n5([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Crt=function(t,e){for(var n=new J2(31),o=0;31>o;++o)n[o]=e+=1<<t[o-1];var i=new hk(n[30]);for(o=1;30>o;++o)for(var r=n[o];n[o+1]>r;++r)i[r]=r-n[o]<<5|o;return[n,i]},yrt=Crt(fye,2),Cye=yrt[1];yrt[0][28]=258,Cye[258]=28;for(var xrt=Crt(Iye,0)[1],Ert=new J2(32768),sd=0;32768>sd;++sd){var pk=(43690&sd)>>>1|(21845&sd)<<1;Ert[sd]=((65280&(pk=(61680&(pk=(52428&pk)>>>2|(13107&pk)<<2))>>>4|(3855&pk)<<4))>>>8|(255&pk)<<8)>>>1}var NK=function(t,e,n){for(var o=t.length,i=0,r=new J2(e);o>i;++i)++r[t[i]-1];var s,a=new J2(e);for(i=0;e>i;++i)a[i]=a[i-1]+r[i-1]<<1;for(s=new J2(o),i=0;o>i;++i)s[i]=Ert[a[t[i]-1]++]>>>15-t[i];return s},mM=new n5(288);for(sd=0;144>sd;++sd)mM[sd]=8;for(sd=144;256>sd;++sd)mM[sd]=9;for(sd=256;280>sd;++sd)mM[sd]=7;for(sd=280;288>sd;++sd)mM[sd]=8;var mte=new n5(32);for(sd=0;32>sd;++sd)mte[sd]=5;var XEn=NK(mM,9),$En=NK(mte,5),Brt=function(t){return(t/8|0)+(7&t&&1)},Srt=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var o=new(t instanceof J2?J2:t instanceof hk?hk:n5)(n-e);return o.set(t.subarray(e,n)),o},s8=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8},RK=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8,t[o+2]|=n>>>16},yye=function(t,e){for(var n=[],o=0;t.length>o;++o)t[o]&&n.push({s:o,f:t[o]});var i=n.length,r=n.slice();if(!i)return[new n5(0),0];if(i==1){var s=new n5(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort(function(y,x){return y.f-x.f}),n.push({s:-1,f:25001});var a=n[0],A=n[1],c=0,l=1,g=2;for(n[0]={s:-1,f:a.f+A.f,l:a,r:A};l!=i-1;)a=n[n[g].f>n[c].f?c++:g++],A=n[c!=l&&n[g].f>n[c].f?c++:g++],n[l++]={s:-1,f:a.f+A.f,l:a,r:A};var u=r[0].s;for(o=1;i>o;++o)r[o].s>u&&(u=r[o].s);var h=new J2(u+1),d=xye(n[l-1],h,0);if(d>e){o=0;var p=0,m=d-e,_=1<<m;for(r.sort(function(y,x){return h[x.s]-h[y.s]||y.f-x.f});i>o;++o){var f=r[o].s;if(e>=h[f])break;p+=_-(1<<d-h[f]),h[f]=e}for(p>>>=m;p>0;){var I=r[o].s;e>h[I]?p-=1<<e-h[I]++-1:++o}for(;o>=0&&p;--o){var C=r[o].s;h[C]==e&&(--h[C],++p)}d=e}return[new n5(h),d]},xye=function(t,e,n){return t.s==-1?Math.max(xye(t.l,e,n+1),xye(t.r,e,n+1)):e[t.s]=n},brt=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new J2(++e),o=0,i=t[0],r=1,s=function(A){n[o++]=A},a=1;e>=a;++a)if(t[a]==i&&a!=e)++r;else{if(!i&&r>2){for(;r>138;r-=138)s(32754);r>2&&(s(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(s(i),--r;r>6;r-=6)s(8304);r>2&&(s(r-3<<5|8208),r=0)}for(;r--;)s(i);r=1,i=t[a]}return[n.subarray(0,o),e]},TK=function(t,e){for(var n=0,o=0;e.length>o;++o)n+=t[o]*e[o];return n},Eye=function(t,e,n){var o=n.length,i=Brt(e+2);t[i]=255&o,t[i+1]=o>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var r=0;o>r;++r)t[i+r+4]=n[r];return 8*(i+4+o)},Qrt=function(t,e,n,o,i,r,s,a,A,c,l){s8(e,l++,n),++i[256];for(var g=yye(i,15),u=g[0],h=g[1],d=yye(r,15),p=d[0],m=d[1],_=brt(u),f=_[0],I=_[1],C=brt(p),y=C[0],x=C[1],E=new J2(19),B=0;f.length>B;++B)E[31&f[B]]++;for(B=0;y.length>B;++B)E[31&y[B]]++;for(var b=yye(E,7),Q=b[0],w=b[1],M=19;M>4&&!Q[Irt[M-1]];--M);var k,R,F,G,U=c+5<<3,Y=TK(i,mM)+TK(r,mte)+s,J=TK(i,u)+TK(r,p)+s+14+3*M+TK(E,Q)+(2*E[16]+3*E[17]+7*E[18]);if(Y>=U&&J>=U)return Eye(e,l,t.subarray(A,A+c));if(s8(e,l,1+(Y>J)),l+=2,Y>J){k=NK(u,h),R=u,F=NK(p,m),G=p;var ee=NK(Q,w);for(s8(e,l,I-257),s8(e,l+5,x-1),s8(e,l+10,M-4),l+=14,B=0;M>B;++B)s8(e,l+3*B,Q[Irt[B]]);l+=3*M;for(var j=[f,y],X=0;2>X;++X){var ie=j[X];for(B=0;ie.length>B;++B)s8(e,l,ee[se=31&ie[B]]),l+=Q[se],se>15&&(s8(e,l,ie[B]>>>5&127),l+=ie[B]>>>12)}}else k=XEn,R=mM,F=$En,G=mte;for(B=0;a>B;++B)if(o[B]>255){var se;RK(e,l,k[257+(se=o[B]>>>18&31)]),l+=R[se+257],se>7&&(s8(e,l,o[B]>>>23&31),l+=fye[se]);var oe=31&o[B];RK(e,l,F[oe]),l+=G[oe],oe>3&&(RK(e,l,o[B]>>>5&8191),l+=Iye[oe])}else RK(e,l,k[o[B]]),l+=R[o[B]];return RK(e,l,k[256]),l+R[256]},ZEn=new hk([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),e5n=(function(){for(var t=new hk(256),e=0;256>e;++e){for(var n=e,o=9;--o;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),Bye=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function t5n(t,e){e===void 0&&(e={});var n=(function(){var g=4294967295;return{p(u){for(var h=g,d=0;u.length>d;++d)h=e5n[255&h^u[d]]^h>>>8;g=h},d(){return 4294967295^g}}})(),o=t.length;n.p(t);var i,r,s,a,A,c=(a=10+((i=e).filename&&i.filename.length+1||0),A=8,(function(g,u,h,d,p,m){var _=g.length,f=new n5(d+_+5*(1+Math.floor(_/7e3))+p),I=f.subarray(d,f.length-p),C=0;if(!u||8>_)for(var y=0;_>=y;y+=65535){var x=y+65535;_>x?C=Eye(I,C,g.subarray(y,x)):(I[y]=m,C=Eye(I,C,g.subarray(y,_)))}else{for(var E=ZEn[u-1],B=E>>>13,b=8191&E,Q=(1<<h)-1,w=new J2(32768),M=new J2(Q+1),k=Math.ceil(h/3),R=2*k,F=function(Ie){return(g[Ie]^g[Ie+1]<<k^g[Ie+2]<<R)&Q},G=new hk(25e3),U=new J2(288),Y=new J2(32),J=0,ee=0,j=(y=0,0),X=0,ie=0;_>y;++y){var se=F(y),oe=32767&y,ge=M[se];if(w[oe]=ge,M[se]=oe,y>=X){var de=_-y;if((J>7e3||j>24576)&&de>423){C=Qrt(g,I,0,G,U,Y,ee,j,ie,y-ie,C),j=J=ee=0,ie=y;for(var Ce=0;286>Ce;++Ce)U[Ce]=0;for(Ce=0;30>Ce;++Ce)Y[Ce]=0}var le=2,_e=0,he=b,ye=oe-ge&32767;if(de>2&&se==F(y-ye))for(var ve=Math.min(B,de)-1,Pe=Math.min(32767,y),me=Math.min(258,de);Pe>=ye&&--he&&oe!=ge;){if(g[y+le]==g[y+le-ye]){for(var Qe=0;me>Qe&&g[y+Qe]==g[y+Qe-ye];++Qe);if(Qe>le){if(le=Qe,_e=ye,Qe>ve)break;var we=Math.min(ye,Qe-2),Me=0;for(Ce=0;we>Ce;++Ce){var He=y-ye+Ce+32768&32767,ke=He-w[He]+32768&32767;ke>Me&&(Me=ke,ge=He)}}}ye+=(oe=ge)-(ge=w[oe])+32768&32767}if(_e){G[j++]=268435456|Cye[le]<<18|xrt[_e];var Se=31&Cye[le],Te=31&xrt[_e];ee+=fye[Se]+Iye[Te],++U[257+Se],++Y[Te],X=y+le,++J}else G[j++]=g[y],++U[g[y]]}}C=Qrt(g,I,m,G,U,Y,ee,j,ie,y-ie,C)}return Srt(f,0,d+Brt(C)+p)})(r=t,(s=e).level==null?6:s.level,s.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+s.mem,a,A,!0)),l=c.length;return(function(g,u){var h=u.filename;if(g[0]=31,g[1]=139,g[2]=8,g[8]=2>u.level?4:u.level==9?2:0,g[9]=3,u.mtime!=0&&Bye(g,4,Math.floor(new Date(u.mtime||Date.now())/1e3)),h){g[3]=8;for(var d=0;h.length>=d;++d)g[d+10]=h.charCodeAt(d)}})(c,e),Bye(c,l-8,n.d()),Bye(c,l-4,o),c}const n5n=!!gCe||!!cK,vrt=new WeakMap,Prt="text/plain";let Sye=0,_te=!1;const wrt=(t,e)=>{const[n,o]=t.split("#"),[i,r]=n.split("?");if(!r)return t;const s=r.split("&").filter(a=>a.split("=")[0]!==e).join("&");return`${i}${s?`?${s}`:""}${o?`#${o}`:""}`},kK=(t,e,n=!0)=>{var o;const[i,r]=t.split("?"),s=sn({},e),a=(o=r?.split("&").map(c=>{var l;const[g,u]=c.split("="),h=n&&(l=s[g])!==null&&l!==void 0?l:u;return delete s[g],`${g}=${h}`}))!==null&&o!==void 0?o:[],A=(function(c,l="&"){let g,u;const h=[];return El(c,function(d,p){Bo(d)||Bo(p)||p==="undefined"||(g=encodeURIComponent((m=>m instanceof File)(d)?d.name:d.toString()),u=encodeURIComponent(p),h[h.length]=u+"="+g)}),h.join(l)})(s);return A&&a.push(A),a.length>0?`${i}?${a.join("&")}`:i},bye=t=>{if(t.sl)return t.sl;const{data:e,compression:n}=t;if(!e)return;if(n===y3.GZipJS){const i=t5n((function(r){var s=r.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(r);for(var a=new n5(r.length+(r.length>>>1)),A=0,c=function(h){a[A++]=h},l=0;s>l;++l){if(A+5>a.length){var g=new n5(A+8+(s-l<<1));g.set(a),a=g}var u=r.charCodeAt(l);128>u?c(u):2048>u?(c(192|u>>>6),c(128|63&u)):u>55295&&57344>u?(c(240|(u=65536+(1047552&u)|1023&r.charCodeAt(++l))>>>18),c(128|u>>>12&63),c(128|u>>>6&63),c(128|63&u)):(c(224|u>>>12),c(128|u>>>6&63),c(128|63&u))}return Srt(a,0,A)})(lk(e)),{mtime:0});return{contentType:Prt,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===y3.Base64){const i=(function(s){return s&&btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g,(a,A)=>String.fromCharCode(parseInt(A,16))))})(lk(e)),r=(s=>"data="+encodeURIComponent(typeof s=="string"?s:lk(s)))(i);return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}const o=lk(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}},Mrt=t=>{const e=()=>t.transport==="sendBeacon"?{url:kK(t.url,{compression:y3.Base64}),encodedBody:bye(sn(sn({},t),{},{compression:y3.Base64,sl:void 0}))}:{url:wrt(t.url,"compression"),encodedBody:bye(sn(sn({},t),{},{compression:void 0,sl:void 0}))};let n;try{n=bye(t)}catch(i){if(Yot(t.compression,gk(t.url,"compression")))return gi.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return n&&Yot(t.compression,gk(t.url,"compression"))&&!((o=n.body)instanceof ArrayBuffer?wCe(new Uint8Array(o)):ArrayBuffer.isView(o)&&wCe(new Uint8Array(o.buffer,o.byteOffset,o.byteLength)))?(_te=!0,e()):{url:t.url,encodedBody:n};var o},Drt=t=>{try{return Mrt(t)}catch(n){var e;return gi.error(n),void((e=t.callback)===null||e===void 0||e.call(t,{statusCode:0,error:n}))}},o5n=(function(){var t=Vg(function*(e){const n=yield(function(i){return MCe.apply(this,arguments)})(lk(e.data),Fm.DEBUG,{rethrow:!0});if(!n)return e;const o=yield n.arrayBuffer();return sn(sn({},e),{},{sl:{contentType:Prt,body:o,estimatedSize:o.byteLength}})});return function(e){return t.apply(this,arguments)}})(),i5n=/Failed to fetch|NetworkError|Load failed/i,Nrt=t=>t?.name==="TypeError"&&i5n.test(t?.message||""),Rrt=t=>{try{const e=(function(n,o=Date.now()){if(typeof n!="string"||!n)return;const i=n.trim(),r=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(r)){const A=1e3*Math.min(Number(r),300);return A>0?A:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r))return;const s=/^\w{3} \w{3} /.test(r)?r+" GMT":r,a=Date.parse(s)-o;return Number.isFinite(a)&&a>0?Math.min(a,qee):void 0})(t());return Bo(e)?void 0:Math.min(e,3e4)}catch{return}},Trt=t=>{const e=Drt(t);if(!e)return;const n=new gCe;vrt.set(n,!0);const{url:o,encodedBody:i}=e;n.open(t.method||"GET",o,!0);const{contentType:r,body:s}=i??{};El(t.headers,function(a,A){n.setRequestHeader(A,a)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var a;const A={statusCode:n.status,text:n.responseText};if(n.status===200)try{A.json=JSON.parse(n.responseText)}catch{}(a=t.callback)===null||a===void 0||a.call(t,A,Rrt(()=>n.getResponseHeader("Retry-After")))}},n.send(s)},krt=t=>{const e=Drt(t);if(!e)return;const{url:n,encodedBody:o}=e,{contentType:i,body:r,estimatedSize:s}=o??{},a=new Headers;El(t.headers,function(d,p){a.append(p,d)}),i&&a.append("Content-Type",i);let A=null,c=!1;if(Lnt){const d=new Lnt;A={signal:d.signal,timeout:setTimeout(()=>{c=!0;try{d.abort(bot("AbortError","PostHog request timed out"+((p=t.timeout)?` after ${p}ms`:"")))}catch(m){g(m)}var p},t.timeout)}}let l=!1;const g=d=>{var p;l||(l=!0,c&&d?.name==="AbortError"||Nrt(d)?gi.warn(d):gi.error(d),(p=t.callback)===null||p===void 0||p.call(t,{statusCode:0,error:d}))};let u=0;const h=()=>{Sye-=u,u=0,A&&clearTimeout(A.timeout)};try{const d=sn({method:t?.method||"GET",headers:a,referrerPolicy:"strict-origin",body:r,signal:A?.signal},t.fetchOptions),p=s??(Bo(r)?0:void 0);d.keepalive=d.method==="POST"&&!t.rl&&d.keepalive!==!1&&d.body===r&&!Bo(p)&&p>=0&&52428.8>Sye+p,d.keepalive&&(u=p,Sye+=u),cK(n,d).then(m=>m.text().then(_=>{var f;if(l)return;const I={statusCode:m.status,text:_};if(m.status===200)try{I.json=JSON.parse(_)}catch(C){gi.error(C)}l=!0,h(),(f=t.callback)===null||f===void 0||f.call(t,I,Rrt(()=>m.headers.get("Retry-After")))})).catch(m=>{h(),g(m)}).finally(h)}catch(d){h(),g(d)}},Qye=t=>{try{var e;const{url:n,encodedBody:o}=Mrt(t),{contentType:i,body:r,estimatedSize:s}=o??{};if(!r)return;const a=r instanceof Blob?r:new Blob([r],{type:i});if(w_.sendBeacon(n,a))return;const A=rs(t.data)?t.data:(e=t.data)===null||e===void 0?void 0:e.batch;if(rs(A)&&A.length>1&&(s??0)>16384){const c=Math.ceil(A.length/2),l=g=>rs(t.data)?g:sn(sn({},t.data),{},{batch:g});return Qye(sn(sn({},t),{},{data:l(A.slice(0,c))})),void Qye(sn(sn({},t),{},{data:l(A.slice(c))}))}gi.warn(`Beacon of ~${s??0} bytes was rejected by the browser, falling back to ${cK?"fetch":"XHR"}`),cK?krt(sn(sn({},t),{},{rl:!0})):Trt(t)}catch(n){gi.warn("Beacon send failed",n)}},Frt=(t,e,n,o)=>{const i=o==="query"?e==="POST"?"sent_at":"_":void 0;return kK(n===y3.GZipJS?wrt(t,"compression"):t,sn(sn({},i?{[i]:Date.now().toString()}:{}),n===y3.GZipJS?{}:{compression:n}))},r5n=(()=>{const t=[];return cK&&t.push({transport:"fetch",method:krt}),gCe&&t.push({transport:"XHR",method:Trt}),w_?.sendBeacon&&t.push({transport:"sendBeacon",method:Qye}),t})();let Lrt=!n5n&&iy?.indexOf("MSIE")===-1&&iy?.indexOf("Mozilla")===-1;function Hrt(t,e,n){var o,i,r;n&&(e=sn(sn({},e),{},{callback:s=>n(s)})),t.__loaded?Lrt?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&((i=e.callback)===null||i===void 0||i.call(e,{statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=sn(sn({},t.config.request_headers),e.headers),e.compression=e.compression==="best-available"?(o=t.compression)!==null&&o!==void 0?o:e.compressionFallback:e.compression,(Bo(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((s,a)=>{var A,c,l;const g=sn(sn({},s),{},{callback:a??(m=>{var _;return(_=s.callback)===null||_===void 0?void 0:_.call(s,m)})});g.timeout=g.timeout||6e4;const u=(A=g.transport)!==null&&A!==void 0?A:"fetch";u==="sendBeacon"&&Bo(g.compression)&&g.data&&(g.compression=y3.Base64),g.method==="POST"&&g.data&&(g.timestampMode==="capture-body"?g.data=(m=>{var _,f;const I=(rs(m)?m:[m]).map(y=>sn(sn({},y),y.timestamp instanceof Date&&!isNaN(y.timestamp.getTime())?{timestamp:y.timestamp.toISOString()}:{})),C=I[0];return{api_key:(_=C==null||(f=C.properties)===null||f===void 0?void 0:f.token)!==null&&_!==void 0?_:C?.token,batch:I,sent_at:new Date().toISOString()}})(g.data):g.timestampMode==="body"&&(g.data=((m,_=new Date().toISOString())=>rs(m)?m.map(f=>sn(sn({},f),{},{sent_at:_})):sn(sn({},m),{},{sent_at:_}))(g.data))),g.url=Frt(g.url,g.method,g.compression,g.timestampMode);const h=r5n.filter(m=>!g.disableTransport||!m.transport||!g.disableTransport.includes(m.transport)),d=(c=(l=(function(m,_){for(let f=0;m.length>f;f++)if(_(m[f]))return m[f]})(h,m=>m.transport===u))===null||l===void 0?void 0:l.method)!==null&&c!==void 0?c:h[0].method;if(!d)throw new Error("No available transport method");const p=m=>{try{d(m)}catch(f){var _;Nrt(f)?gi.warn(f):gi.error(f),(_=g.callback)===null||_===void 0||_.call(g,{statusCode:0,error:f})}};u!=="sendBeacon"&&!g.preferSyncCompression&&g.data&&g.compression===y3.GZipJS&&Yxn&&typeof Promise<"u"&&!_te?o5n(g).then(m=>{p(m)}).catch(m=>{if(Uot(m))return _te=!0,void p(sn(sn({},g),{},{compression:void 0,url:Frt(s.url,s.method,void 0,s.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;const f="name"in _?String(_.name):"";return Uot(_)||f===Got})(m)&&(_te=!0),p(g)}):p(g)})(e,(s,a)=>{var A,c,l;t.rateLimiter.checkForLimiting(s),400>s.statusCode||(A=(c=t.config).on_request_error)===null||A===void 0||A.call(c,s),n?n(s,a):(l=e.callback)===null||l===void 0||l.call(e,s)})):e.fireCallbackOnDrop&&((r=e.callback)===null||r===void 0||r.call(e,{statusCode:0}))}var s5n=class{constructor(e,n){this.ol=!0,this.al=[],this.ll=s9(n?.flush_interval_ms||3e3,250,5e3,gi.createLogger("flush interval"),3e3),this.ul=e}enqueue(e){this.al.push(e),this.hl||this.cl()}unload(){this.dl();const e=this.al.length>0?this.vl():{},n=Object.values(e);[...n.filter(o=>o.url.indexOf("/e")===0),...n.filter(o=>o.url.indexOf("/e")!==0)].map(o=>{this.fl(o,"sendBeacon")})}enable(){this.ol=!1,this.cl()}cl(){this.ol||(this.hl=setTimeout(()=>{if(this.dl(),this.al.length>0){const e=this.vl();for(const n in e)this.fl(e[n])}},this.ll))}fl(e,n){try{this.ul(e,n)}catch(o){gi.error(o)}}dl(){clearTimeout(this.hl),this.hl=void 0}vl(){const e={};return El(this.al,n=>{var o;const i=n,r=((i?i.batchKey:null)||i.url)+(i.batchGroup?`:${i.batchGroup}`:"");Bo(e[r])&&(e[r]=sn(sn({},i),{},{data:[]})),(o=e[r].data)===null||o===void 0||o.push(i.data)}),this.al=[],e}};const a5n=["retriesPerformedSoFar"];var A5n=class{constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.al=[],this.al=[],this.ml=!0,this.resume()}resume(){if(!Bo(Un)&&"onLine"in Un.navigator){if(this.ml=Un.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.bl()},this._l=()=>{this.ml=!1},dl(Un,"online",this.yl),dl(Un,"offline",this._l)}}get length(){return this.al.length}retriableRequest(e,n){let{retriesPerformedSoFar:o}=e,i=Vot(e,a5n);t8(o)&&(i.url=kK(i.url,{retry_count:o})),Hrt(this._instance,n?sn(sn({},i),{},{transport:n}):i,(r,s)=>{var a;if(r.statusCode!==200&&(400>r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(o??0))return void this.Ls(sn({retriesPerformedSoFar:o},i),s);r.statusCode===0&&gi.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${o??0} retries.`)}(a=i.callback)===null||a===void 0||a.call(i,r)})}Ls(e,n){const o=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=o+1;const i=Math.max((function(a){const A=3e3*Math.pow(2,a),c=A/2,l=Math.min(18e5,A),g=(Math.random()-.5)*(l-c);return Math.ceil(l+g)})(o),n??0),r=Date.now()+i;this.al.push({retryAt:r,requestOptions:e});let s=`Enqueued failed request for retry in ${i}`;navigator.onLine||(s+=" (Browser is offline)"),gi.warn(s),this.pl||(this.pl=!0,this.wl())}wl(){if(this.kl&&clearTimeout(this.kl),this.al.length===0)return this.pl=!1,void(this.kl=void 0);this.kl=setTimeout(()=>{this.ml&&this.al.length>0&&this.bl(),this.wl()},this.gl)}bl(){const e=Date.now(),n=[],o=this.al.filter(i=>e>i.retryAt||(n.push(i),!1));if(this.al=n,o.length>0)for(const{requestOptions:i}of o)this.retriableRequest(i)}unload(){this.kl&&(clearTimeout(this.kl),this.kl=void 0),this.pl=!1,Bo(Un)||(this.yl&&(Un.removeEventListener("online",this.yl),this.yl=void 0),this._l&&(Un.removeEventListener("offline",this._l),this._l=void 0));for(const{requestOptions:e}of this.al)try{this._instance._send_request(sn(sn({},e),{},{transport:"sendBeacon"}))}catch(n){gi.error(n)}this.al=[]}},c5n=class{constructor(e){this._instance=e,this.Sl=()=>{var n,o,i,r;this.xl||(this.xl={});const s=this.scrollElement(),a=this.scrollY(),A=s?Math.max(0,s.scrollHeight-s.clientHeight):0,c=a+(s?.clientHeight||0),l=s?.scrollHeight||0;this.xl.lastScrollY=Math.ceil(a),this.xl.maxScrollY=Math.max(a,(n=this.xl.maxScrollY)!==null&&n!==void 0?n:0),this.xl.maxScrollHeight=Math.max(A,(o=this.xl.maxScrollHeight)!==null&&o!==void 0?o:0),this.xl.lastContentY=c,this.xl.maxContentY=Math.max(c,(i=this.xl.maxContentY)!==null&&i!==void 0?i:0),this.xl.maxContentHeight=Math.max(l,(r=this.xl.maxContentHeight)!==null&&r!==void 0?r:0)}}get Cl(){return this._instance.config.scroll_root_selector}getContext(){return this.xl}resetContext(){const e=this.xl;return this.xl=void 0,setTimeout(this.Sl,0),e}startMeasuringScrollPosition(){dl(Un,"scroll",this.Sl,{capture:!0}),dl(Un,"scrollend",this.Sl,{capture:!0}),dl(Un,"resize",this.Sl)}scrollElement(){if(this.Cl){const o=rs(this.Cl)?this.Cl:[this.Cl];for(const i of o){var e;const r=Un==null||(e=Un.document)===null||e===void 0?void 0:e.querySelector(i);if(r)return r}return}var n;return Un==null||(n=Un.document)===null||n===void 0?void 0:n.documentElement}$l(e){var n,o;const i=e==="y"?"scrollTop":"scrollLeft";if(this.Cl){const r=this.scrollElement();return r&&r[i]||0}return Un?e==="y"?Un.scrollY||Un.pageYOffset||((n=Un.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.scrollTop)||0:Un.scrollX||Un.pageXOffset||((o=Un.document)===null||o===void 0||(o=o.documentElement)===null||o===void 0?void 0:o.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}};const l5n=t=>lrt(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes);var Ort=class{constructor(e,n,o,i){this.Be=r=>{const s=this.Tl();if(s&&s.sessionId===r)return;const a={sessionId:r,props:this.Il(this._instance)};this.Ml.register({[JCe]:a})},this._instance=e,this.El=n,this.Ml=o,this.Il=i||l5n,this.El.onSessionId(this.Be)}Tl(){return this.Ml.props[JCe]}getSetOnceProps(){var e;const n=(e=this.Tl())===null||e===void 0?void 0:e.props;return n?"r"in n?grt(n,this._instance.config.disable_capture_url_hashes):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){const e={};return El($Ce(this.getSetOnceProps()),(n,o)=>{o==="$current_url"&&(o="url"),e[`$session_entry_${dCe(o)}`]=n}),e}},fte=class{on(e,n){return this.Pl[e]||(this.Pl[e]=[]),this.Pl[e].push(n),()=>{this.Pl[e]=this.Pl[e].filter(o=>o!==n)}}emit(e,n){for(const o of this.Pl[e]||[])o(n);for(const o of this.Pl["*"]||[])o(e,n)}constructor(){this.Pl={}}};const mk=id("[SessionId]"),Grt=864e5;var Yrt=class{on(e,n){return this.Rl.on(e,n)}constructor(e,n,o){var i;if(this.Al=null,this.Fl=null,this.Ol=[],this.Dl=void 0,this.Ll=!1,this.Rl=new fte,this.Nl=(s,a)=>!(!t8(s)||!t8(a))&&Math.abs(s-a)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rr=e.config,this.Ml=e.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.ql=void 0,this._sessionActivityTimestamp=null,this.jl=n||y4,this.Bl=o||y4;const r=this.Rr.persistence_name||this.Rr.token;if(this._sessionTimeoutMs=1e3*s9(this.Rr.session_idle_timeout_seconds||1800,60,36e3,mk.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hl(),this.zl="ph_"+r+"_window_id",this.Ul="ph_"+r+"_primary_window_exists",this.Wl()){const s=j0.Dt(this.zl),a=j0.Dt(this.Ul);s&&!a?this.He=s:j0.Lt(this.zl),j0.At(this.Ul,!0)}!((i=this.Rr.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Rr.bootstrap.sessionID),this.Vl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Bo(this.Ol)&&(this.Ol=[]),this.Ol.push(e),this.Xt&&e(this.Xt,this.He),()=>{this.Ol=this.Ol.filter(n=>n!==e)}}Wl(){return this.Rr.persistence!=="memory"&&!this.Ml.mi&&j0.Et()}Gl(e){e!==this.He&&(this.He=e,this.Wl()&&j0.At(this.zl,e))}Zl(){return this.He?this.He:this.Wl()?j0.Dt(this.zl):null}Ql(e){const n=this.Al;return!od(n)&&!od(e)&&5e3>Math.abs(e-n)}Jl(e,n,o){const i=n!==this._sessionActivityTimestamp,r=!(e!==this.Xt||o!==this._sessionStartTimestamp);this._sessionStartTimestamp=o,this._sessionActivityTimestamp=n,this.Xt=e,r&&!i||r&&this.Ql(n)||(this.Al=n,this.Ml.register({[ok]:[n,e,o]}))}Kl(){var e;const n=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return t8(n)&&n>0}Xl(){this.Kl()?this.Ml.refreshKey(ok):(this.Ml.flush(),this.Ml.load())}Yl(){var e;if(od(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Al)return;this.Xl();const[,n,o]=this.tu();n===this.Xt&&o===this._sessionStartTimestamp&&(this.Al=this._sessionActivityTimestamp,this.Ml.register({[ok]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Ml.flush())}eu(){const[e]=this.tu(),n=t8(e)?e:0,o=t8(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,o)}iu(e){return this.Xl(),this.Nl(e,this.eu())}tu(){const e=this.Ml.props[ok];return rs(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Al=null,this.ql=void 0,clearTimeout(this.nu),this.nu=void 0,this.Jl(null,null,null)}setBootstrapSessionId(e,n=!1){const o=((i,r=new Date().getTime())=>{try{const s=(a=>{const A=a.replace(/-/g,"");if(A.length!==32)throw new Error("Not a valid UUID");if(A[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(A.substring(0,12),16)})(i);return s>r+6e4?void mk.error("Bootstrap sessionID cannot be in the future"):s}catch(s){return void mk.error("Invalid sessionID in bootstrap",s)}})(e);return!Bo(o)&&(n?this.ql={sessionId:e,sessionStartTimestamp:o}:this.Jl(e,new Date().getTime(),o),!0)}destroy(){this.Ll=!0,this.Yl(),clearTimeout(this.nu),this.nu=void 0,this.Dl&&Un&&(Un.removeEventListener(ate,this.Dl,{capture:!1}),this.Dl=void 0),this.Ol=[]}Vl(){this.Dl=()=>{this.Yl(),this.Wl()&&j0.Lt(this.Ul)},dl(Un,ate,this.Dl,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,n=null,o=!1){if(this.Rr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const i=n||new Date().getTime(),r=this.Xt;if(o)this.Fl=i;else if(od(this.Fl)||this.Fl>i||i-this.Fl>=1e3){var s,a;(s=(a=this.Ml).syncCookieProperties)===null||s===void 0||s.call(a),this.Fl=i}let[,A,c]=this.tu();const l=!Bo(r)&&A!==r,g=this.eu();let u=this.Zl();const h=this.ql,d=!!h&&(h.sessionStartTimestamp>i+6e4||i-h.sessionStartTimestamp>Grt),p=h?d:t8(c)&&Math.abs(i-c)>Grt;let m=!1,_=l,f=!A||!!h;const I=A;let C=!f&&!e&&this.Nl(i,g);if(C&&(C=this.iu(i),C||mk.info("cross-tab refresh kept the session alive",{sessionId:A}),[,A,c]=this.tu(),C||(f=!A||!!h)),f||C||p){_=!1;const B=h&&!d;A=B?h.sessionId:this.jl(),u=this.Bl(),mk.info("new session ID assigned",{sessionId:A,windowId:u,bootstrapped:!!B,changeReason:{noSessionId:f,activityTimeout:C,sessionPastMaximumLength:p}}),c=B?h.sessionStartTimestamp:i,this.ql=void 0,m=!0}else u||(u=this.Bl(),m=!0),_=_||A!==I,_&&(mk.info("adopted cross-tab session id",{sessionId:A,windowId:u}),m=!0);const y=t8(g)&&e&&!p?g:i,x=t8(c)?c:new Date().getTime();this.Gl(u),this.Jl(A,y,x),e||this.Hl();const E={noSessionId:f,activityTimeout:C,sessionPastMaximumLength:p,crossTabAdoption:_};return m&&this.Ol.forEach(B=>B(A,u,E)),{sessionId:A,windowId:u,sessionStartTimestamp:x,changeReason:m?E:void 0,lastActivityTimestamp:g}}Hl(){this.Ll||(clearTimeout(this.nu),this.nu=setTimeout(()=>{if(!this.Ll)if(this.iu(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Rl.emit("forcedIdleReset",{idleSessionId:e})}else this.Hl()},1.1*this.sessionTimeoutMs))}};const Urt=function(t,e){if(!t)return!1;const n=t.userAgent;if(n&&Vnt(n,e))return!0;try{const o=t?.userAgentData;if(o?.brands&&o.brands.some(i=>Vnt(i?.brand,e)))return!0}catch{}return!!t.webdriver};function Krt(){return(Krt=Vg(function*(){const t=w_?.userAgentData;if(t?.getHighEntropyValues)try{const e=yield t.getHighEntropyValues(["model"]),n=e?.model;return eA(n)&&n.length>0?n:void 0}catch(e){return void gi.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}function g5n(t,e){let n=`$survey_${e}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(n=`$survey_${e}/${t.id}/${t.current_iteration}`),n}function Vrt(t){var e;return!!(!((e=t.conditions)===null||e===void 0||(e=e.events)===null||e===void 0||(e=e.values)===null||e===void 0)&&e.length)}const Ite=(t,e)=>{if(!(n=>{try{new RegExp(n)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}},Cte=t=>t.toLowerCase(),zrt={exact:(t,e)=>e.some(n=>t.some(o=>n===o)),is_not:(t,e)=>e.every(n=>t.every(o=>n!==o)),regex:(t,e)=>e.some(n=>t.some(o=>Ite(n,o))),not_regex:(t,e)=>e.every(n=>t.every(o=>!Ite(n,o))),icontains:(t,e)=>e.map(Cte).some(n=>t.map(Cte).some(o=>n.includes(o))),not_icontains:(t,e)=>e.map(Cte).every(n=>t.map(Cte).every(o=>!n.includes(o))),gt:(t,e)=>e.some(n=>{const o=parseFloat(n);return!isNaN(o)&&t.some(i=>o>parseFloat(i))}),lt:(t,e)=>e.some(n=>{const o=parseFloat(n);return!isNaN(o)&&t.some(i=>o<parseFloat(i))})};function Jrt(t,e){return!t||Object.entries(t).every(([n,o])=>{const i=e?.[n];if(i==null)return!1;const r=zrt[o.operator];return!!r&&r(o.values.map(String),[String(i)])})}function vye(t,e,n){return lk({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}const Pye="custom",Wrt="i.posthog.com",u5n=/^\/static\//,d5n=["/s/","/e/","/i/"];var h5n=class{constructor(e){this.su={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let n=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace(`.${Wrt}`,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.su[this.apiHost]||(this.su[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":Pye),this.su[this.apiHost]}ru(e){if(!u5n.test(e))return;const n=this.instance.config.asset_host;return typeof n=="string"&&n.trim().replace(/\/$/,"")||void 0}ou(e){const n=Wb(e);return n?n.protocol+"//"+n.host+n.pathname:void 0}au(e,n,o){if(e==="ui")return o;let i=o;const r=this.instance.config.rewriteRequestPath;if(r){var s;const a=((s=Wb(o))===null||s===void 0?void 0:s.href)||o;i=r(new URL(a)).toString()}if(r&&e==="api"&&d5n.some(a=>n.indexOf(a)===0)){const a=this.ou(i);if(a){const A=this.apiHost;let c=this.lu;c?.apiHost===A&&c.rewriteRequestPath===r||(c={apiHost:A,rewriteRequestPath:r,urls:new Set},this.lu=c),c.urls.add(a)}}return i}isIngestionEndpoint(e){const n=this.lu,o=this.ou(e);return n?.apiHost===this.apiHost&&n.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!o&&n.urls.has(o)}endpointFor(e,n=""){if(n&&(n=n[0]==="/"?n:`/${n}`),e==="ui")return this.au(e,n,this.uiHost+n);if(e==="flags")return this.au(e,n,this.flagsApiHost+n);if(e==="assets"){const i=this.ru(n);if(i)return this.au(e,n,`${i}${n}`)}if(this.region===Pye)return this.au(e,n,this.apiHost+n);const o=Wrt+n;switch(e){case"assets":return this.au(e,n,`https://${this.region}-assets.${o}`);case"api":return this.au(e,n,`https://${this.region}.${o}`)}}};const Bl=id("[Surveys]"),jrt=t=>{try{const e=(n=>((o,i)=>`seenSurvey_${(function(r){return r.current_iteration&&r.current_iteration>0?`${r.id}_${r.current_iteration}`:r.id})(i)}`)(0,n))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(e){Bl.error("Failed to persist survey seen state",e)}},p5n=[pye.Popover,pye.Widget,pye.API],m5n={ignoreConditions:!1,ignoreDelay:!1,displayType:_ye.Popover},_5n=id("[PostHog ExternalIntegrations]"),f5n={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var I5n=class{constructor(e){this._instance=e}zo(e,n){var o,i;(o=Gr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,e,r=>{if(r)return _5n.error("failed to load script",r);n()})}startIfEnabledOrStop(){var e;for(const[r,s]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var n,o,i;s&&!(!((n=Gr.__PosthogExtensions__)===null||n===void 0||(n=n.integrations)===null||n===void 0)&&n[r])&&this.zo(f5n[r],()=>{var a;(a=Gr.__PosthogExtensions__)===null||a===void 0||(a=a.integrations)===null||a===void 0||(a=a[r])===null||a===void 0||a.start(this._instance)}),!s&&(!((o=Gr.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0)&&o[r])&&((i=Gr.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0||(i=i[r])===null||i===void 0||i.stop())}}},C5n=class{constructor(e,n){this.$=e,this.wo=n,this.uu=new Map,this.Io=!1}add(e){var n=this;return Vg(function*(){if(n.Io)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.uu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);n.uu.set(e.name,e);try{const o=e.setup(n.wo);o&&(yield o)}catch(o){const i=n.uu.get(e.name)===e;i&&n.uu.delete(e.name),n.$.error(`Failed to set up browser extension "${e.name}"`,o),i&&n.hu(e)}})()}getExtension(e){return this.uu.get(e)}dispose(){if(this.Io)return;this.Io=!0;const e=Array.from(this.uu.values()).reverse();this.uu.clear();for(const n of e)this.hu(n)}hu(e){try{var n;const o=(n=e.dispose)===null||n===void 0?void 0:n.call(e);o&&M_(o.then)&&o.then(void 0,i=>{this.$.error(`Failed to dispose browser extension "${e.name}"`,i)})}catch(o){this.$.error(`Failed to dispose browser extension "${e.name}"`,o)}}},y5n=class{constructor(e){this._instance=e}initialize(){}get(e){const n=this._instance.persistence;if(typeof e=="string")return n?.get_property(e);const o={};for(const i of e){const r=n?.get_property(i);Bo(r)||(o[i]=r)}return o}set(e,n){var o;(o=this._instance.persistence)===null||o===void 0||o.register(typeof e=="string"?{[e]:n}:e)}remove(e){var n;(n=this._instance.persistence)===null||n===void 0||n.unregister(e)}};const qrt="extensionsRemoteConfig";var x5n=class{constructor(e){this.instance=e,this.Io=!1,this.$=gi,this.cu=e.du,this.kv=new y5n(e),this.onEvent=n=>pte(this.instance.on("eventCaptured",o=>{try{n({event:o.event,properties:o.properties})}catch(i){this.$.error("Browser extension event listener failed",i)}})),this.onRemoteConfig=n=>{if(this.Io)return pte(()=>{});const o=r=>{try{n(r)}catch(s){this.$.error("Browser extension remote config listener failed",s)}},i=this.instance.vu.on(qrt,o);return this.cu&&o(this.cu),pte(i)},this.fu=new C5n(gi.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property(TCe);return typeof e=="string"?e:void 0}get library(){return{name:Fm.LIB_NAME,version:Fm.LIB_VERSION}}get initialPersonProperties(){var e,n;return(e=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,n,o,i;const r=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(n=r?.sessionId)!==null&&n!==void 0?n:"",windowId:(o=r?.windowId)!==null&&o!==void 0?o:"",sessionStartTimestamp:(i=r?.sessionStartTimestamp)!==null&&i!==void 0?i:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.fu.add(e)}getExtension(e){return this.fu.getExtension(e)}capture(e,n,o){o?this.instance.capture(e,n,{timestamp:o.timestamp,uuid:o.uuid,$set:o.set,$set_once:o.setOnce}):this.instance.capture(e,n)}registerDynamicEventProperties(e){return pte(this.instance.pu(e))}handleRemoteConfig(e){this.Io||(this.cu=e,this.instance.vu.emit(qrt,e))}sendRequest(e){var n=this;return Vg(function*(o,i={}){var r;const s=n.instance.requestRouter.endpointFor((r=i.target)!==null&&r!==void 0?r:"api",o),a={method:i.method,url:i.query?kK(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:i.target==="flags"&&i.compression==="best-available"?uCe.Base64:void 0,timestampMode:i.sentAt};return i.transport==="sendBeacon"?(n.instance._send_request(a),{statusCode:202}):new Promise(A=>{a.callback=A,n.instance._send_request(a)})}).apply(this,arguments)}dispose(){this.Io||(this.Io=!0,this.fu.dispose())}};const FK={};let wye=0;const LK=()=>{},Xrt='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',HK="Surveys module not available",$rt="sanitize_properties is deprecated. Use before_send instead",Zrt="Invalid value for property_denylist config: ",E5n=/^[A-Za-z0-9_-]{1,400}$/,est=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,tst=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,B5n=["token","distinct_id",Iit],OK="posthog",S5n=t=>{const e={};return t&&t!=="unset"&&("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0)),e},Mye=t=>{var e;return sn({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:BEn(No?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:LK,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:nd&&eA(nd?.search)&&nd.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:(Un==null||(e=Un.location)===null||e===void 0?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(n){gi.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Bit,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:LK},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:DEn,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:S5n(n),external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:n&&n>="2026-05-30"?250:0,split_storage:!(!n||"2026-05-30">n),detect_google_search_app:!(!n||"2026-05-30">n),disable_capture_url_hashes:!(!n||"2026-06-25">n),cookieWinsOnConflict:!(!n||n==="unset"||"2026-08-29">n)}))(t))},b5n=[["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"]],nst=t=>{const e={};for(const[i,r]of b5n)Bo(t[i])||(e[r]=t[i]);const n=Cg({},e,t),o=t.__preview_external_dependency_versioned_paths;return Bo(o)||(Bo(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),eA(o)&&Bo(t.asset_host)&&(n.asset_host=o)),rs(t.property_blacklist)&&(Bo(t.property_denylist)?n.property_denylist=t.property_blacklist:rs(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:gi.error(Zrt+t.property_denylist)),n};var Q5n=class{constructor(){this.__forceAllowLocalhost=!1}get gu(){return this.__forceAllowLocalhost}set gu(e){gi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},GK=class iM{mu(e){if(!e)return;const n=this.uu.indexOf(e);n!==-1&&this.uu.splice(n,1)}yu(e,n){var o;return this.mu(e),this.uu.push(n),(o=n.initialize)===null||o===void 0||o.call(n),n}bu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}_u(){if(this.wu||this.config.reuseAnonymousId||this.config.segment||this.bu())return;const e=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!e&&!this.config.disable_persistence||this.ku)return;let n,o,i;e?(n=`persistence is set to '${this.config.persistence}'`,o=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(n="persistence is disabled (disable_persistence is true)",o="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.wu=!0,console.warn("[PostHog.js]",`${n} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${o}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${i}`)}Su(){if(this.bu()||this.get_distinct_id()!=="$posthog_cookieless")return;const e=this.persistence;if(!e)return;this.xu()||e.load(!0);const n=this.get_distinct_id();if(!n||n==="$posthog_cookieless"){const o=this.config.get_device_id(y4());this.register({distinct_id:o,$device_id:o}),e.set_property(sy,o8)}this.Cu()}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.$u=!1,this.Tu=!1,this.webPerformance=new Q5n,this.Iu=!1,this.version=Fm.LIB_VERSION,this.Mu=new Set,this.Eu="",this.vu=new fte,this.uu=[],this.Pu=[],this.ku=!1,this.wu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Mye(),this.SentryIntegration=OEn,this.sentryIntegration=o=>(function(i,r){const s=trt(i,r);return{name:ert,processEvent:a=>s(a)}})(this,o),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new c5n(this),this.pageViewManager=new nrt(this),this.rateLimiter=new qEn(this),this.requestRouter=new h5n(this),this.consent=new MEn(this),this.externalIntegrations=new I5n(this);const n=(e=iM.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(o,i,r)=>{const s=eA(o)?{[o]:i}:o;this.setPersonProperties(s),r?.({})},set_once:(o,i,r)=>{const s=eA(o)?{[o]:i}:o;this.setPersonProperties(void 0,s),r?.({})}},this.on("eventCaptured",o=>gi.info(`send "${o?.event}"`,o))}init(e,n,o){if(o&&o!==OK){var i;const r=(i=FK[o])!==null&&i!==void 0?i:new iM;return r._init(e,n,o),FK[o]=r,FK[OK][o]=r,r}return this._init(e,n,o)}_init(e,n={},o){var i,r,s;const a=eA(e)?e.trim():"";if(!a)return gi.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var A;if(this.__loaded)return a!==((A=this.config)===null||A===void 0?void 0:A.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Mye(n.defaults),n.debug=this.Du(n.debug),this.Lu=n,this.Nu=[],n.person_profiles?this.Fu=n.person_profiles:n.process_person&&(this.Fu=n.process_person);const c=Mye(n.defaults),l=nst(n),g=Cg({},c,l,{name:o,token:a});CA(c.rageclick)&&CA(l.rageclick)&&(g.rageclick=Cg({},c.rageclick,l.rageclick)),CA(c.session_recording)&&CA(l.session_recording)&&(g.session_recording=Cg({},c.session_recording,l.session_recording)),this.set_config(g),this.config.on_xhr_error&&gi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:y3.GZipJS;const u=this.xu();if(this.persistence=new hye(this.config,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new hye(sn(sn({},this.config),{},{persistence:"sessionStorage"}),u,!1),this.Eu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!u&&j0.Et()){const _=j0.Dt(this.Eu);rs(_)&&_.forEach(f=>{eA(f)&&this.Mu.add(f)})}else j0.Lt(this.Eu);const h=sn({},this.persistence.props),d=sn({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new s5n((_,f)=>this.ju(_,f),this.config.request_queue_config),this.Bu=new A5n(this),this.__request_queue=[];const p=this.bu();p||(this.sessionManager=new Yrt(this),this.sessionPropsManager=new Ort(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((_,f,I)=>{(I?.activityTimeout||I?.sessionPastMaximumLength||I?.crossTabAdoption)&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(gi.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(p)},0)):(gi.info("Initializing extensions synchronously"),this.Uu(p)),Fm.DEBUG=Fm.DEBUG||this.config.debug,Fm.DEBUG&&gi.info("Starting in debug mode",{this:this,config:n,thisC:sn({},this.config),p:h,s:d}),this.config.identity_distinct_id&&!(!((i=n.bootstrap)===null||i===void 0)&&i.distinctID)&&(n.bootstrap=sn(sn({},n.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const m=(r=n.bootstrap)===null||r===void 0?void 0:r.distinctID;if(this.ku=!!m&&!gK(m),(s=n.bootstrap)===null||s===void 0?void 0:s.distinctID){const _=n.bootstrap.distinctID,f=this.get_distinct_id(),I=this.persistence.get_property(sy);if(n.bootstrap.isIdentifiedID&&f!=null&&f!==_&&I==="anonymous")this.identify(_);else if(n.bootstrap.isIdentifiedID&&f!=null&&f!==_&&I==="identified")gi.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 C=this.config.get_device_id(y4()),y=n.bootstrap.isIdentifiedID?C:_;this.persistence.set_property(sy,n.bootstrap.isIdentifiedID?ste:o8),this.register({distinct_id:_,$device_id:y})}}if(p)this.register_once({distinct_id:jCe,$device_id:null},"");else if(!this.get_distinct_id()){const _=this.config.get_device_id(y4());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(sy,o8)}return dl(Un,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),dl(Un,"pageshow",()=>{var _;this.$u=!1,this.Tu||(_=this.Bu)===null||_===void 0||_.resume()}),n.segment?Zit(this,()=>this.Wu()):this.Wu(),M_(this.config._onCapture)&&this.config._onCapture!==LK&&(gi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this.config.ip&&gi.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 Krt.apply(this,arguments)})().then(_=>{_&&this.register({[kCe]:_})}).catch(LK),this}Vu(e){const n=e;return eA(n.name)&&M_(n.setup)}Gu(e,n){this.Vu(e)?n.push(()=>{this.Zu().add(e).catch(()=>{var o;return(o=e.dispose)===null||o===void 0?void 0:o.call(e)}).catch(o=>{gi.error(`Failed to dispose browser extension "${e.name}"`,o)})}):this.uu.push(e)}zu(){var e,n,o;const i=(e=(n=this.config.__extensionClasses)===null||n===void 0?void 0:n.featureFlags)!==null&&e!==void 0?e:(o=iM.__defaultExtensionClasses)===null||o===void 0?void 0:o.featureFlags;var r,s,a;i&&(this.featureFlags&&this.featureFlags instanceof i||((r=this.Qu)===null||r===void 0||r.call(this),this.Qu=void 0,this.featureFlags=new i(this)),M_(this.featureFlags.onReloading)&&M_(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.vu.emit("featureFlagsReloading",!0)}),this.Zu().add(this.featureFlags)):(s=(a=this.featureFlags).initialize)===null||s===void 0||s.call(a))}Uu(e){const n=performance.now(),o=sn(sn({},iM.__defaultExtensionClasses),this.config.__extensionClasses),i=[];var r,s,a,A,c,l,g;o.exceptions&&this.uu.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new o.exceptions(this)),o.historyAutocapture&&this.uu.push(this.historyAutocapture=new o.historyAutocapture(this)),o.tracingHeaders&&this.uu.push(this.tracingHeaders=new o.tracingHeaders(this)),o.siteApps&&this.uu.push(this.siteApps=new o.siteApps(this)),o.sessionRecording&&!e&&this.uu.push(this.sessionRecording=new o.sessionRecording(this)),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),o.autocapture&&this.Gu(this.autocapture=new o.autocapture(this),i),o.surveys&&this.Gu(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new o.surveys(this),i),o.logs&&this.Gu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new o.logs(this),i),o.metrics&&this.uu.push(this.metrics=(A=this.metrics)!==null&&A!==void 0?A:new o.metrics(this)),o.conversations&&this.uu.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new o.conversations(this)),o.productTours&&this.uu.push(this.productTours=new o.productTours(this)),o.heatmaps&&this.uu.push(this.heatmaps=new o.heatmaps(this)),o.webVitalsAutocapture&&this.uu.push(this.webVitalsAutocapture=new o.webVitalsAutocapture(this)),o.exceptionObserver&&this.uu.push(this.exceptionObserver=new o.exceptionObserver(this)),o.deadClicksAutocapture&&this.uu.push(this.deadClicksAutocapture=new o.deadClicksAutocapture(this,HEn)),o.toolbar&&this.uu.push(this.toolbar=(l=this.toolbar)!==null&&l!==void 0?l:new o.toolbar(this)),o.experiments&&this.uu.push(this.experiments=(g=this.experiments)!==null&&g!==void 0?g:new o.experiments(this)),this.uu.forEach(u=>{u.initialize&&i.push(()=>{var h;(h=u.initialize)===null||h===void 0||h.call(u)})}),i.push(()=>{if(this.Ju){const u=this.Ju;this.Ju=void 0,this.uu.forEach(h=>{var d;return(d=h.onRemoteConfig)===null||d===void 0?void 0:d.call(h,u)})}}),this.Ku(i,n)}Ku(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout(()=>{this.Ku(e,n)},0);const i=e.shift();if(i)try{i()}catch(r){gi.error("Error initializing extension:",r)}}const o=Math.round(performance.now()-n);this.register_for_session({[Cit]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[yit]:o}),this.config.__preview_deferred_init_extensions&&gi.info(`PostHog extensions initialized (${o}ms)`)}il(e){var n;if(!No||!No.body)return gi.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.il(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=e),this.du=e,this.compression=void 0,e.ok){var o;const i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=ms(i.supportedCompression,y3.GZipJS)?y3.GZipJS:ms(i.supportedCompression,y3.Base64)?y3.Base64:void 0),!((o=i.analytics)===null||o===void 0)&&o.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:Bit}),(n=this.Xu)===null||n===void 0||n.handleRemoteConfig(e),this.uu.forEach(i=>{var r;return(r=i.onRemoteConfig)===null||r===void 0?void 0:r.call(i,e)})}Wu(){try{this.config.loaded(this)}catch(e){gi.critical("`loaded` function failed",e)}if(this.Yu(),this.config.internal_or_test_user_hostname&&nd?.hostname){const e=nd.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?e===n:n.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.bu())&&this.th()},1),this.eh=new frt(this),this.eh.load()}Yu(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.qu)===null||e===void 0||e.enable())}_dom_loaded(){this.is_capturing()&&rk(this.__request_queue,e=>this.ju(e)),this.__request_queue=[],this.Yu()}_handle_unload(){var e,n,o,i,r,s;this.$u=!0,(e=this.surveys)===null||e===void 0||(n=e.handlePageUnload)===null||n===void 0||n.call(e),(o=this.metrics)===null||o===void 0||o.flush("sendBeacon"),this.config.request_batching?(this.ih()&&this.capture(Sit),(i=this.logs)===null||i===void 0||i.flushLogs("sendBeacon"),(r=this.qu)===null||r===void 0||r.unload(),(s=this.Bu)===null||s===void 0||s.unload()):this.ih()&&this.capture(Sit,null,{transport:"sendBeacon"})}_send_request(e){Hrt(this,e)}ju(e,n){this.Bu?this.Bu.retriableRequest(e,n):this._send_request(n?sn(sn({},e),{},{transport:n}):e)}_execute_array(e){wye++;try{let n;const o=[],i=[],r=[];rk(e,a=>{if(a)if(n=a[0],rs(n))r.push(a);else if(M_(a))try{a.call(this)}catch(A){gi.error("Error executing queued PostHog call",a,A)}else rs(a)&&n==="alias"?o.push(a):rs(a)&&n.indexOf("capture")!==-1&&M_(this[n])?r.push(a):i.push(a)});const s=function(a,A){rk(a,function(c){try{if(rs(c[0])){let l=A;El(c,function(g){l=l[g[0]].apply(l,g.slice(1))})}else A[c[0]].apply(A,c.slice(1))}catch(l){gi.error("Error executing queued PostHog call",c,l)}})};s(o,this),s(i,this),s(r,this)}finally{wye--}}push(e){if(wye>0&&rs(e)&&eA(e[0])){const n=iM.prototype[e[0]];return void(M_(n)&&n.apply(this,e.slice(1)))}this._execute_array([e])}get nh(){return{property:sit,persistenceKey:nk,cookieName:"_fbc",pattern:est,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[nk]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(nk)}}}get sh(){return{property:ait,persistenceKey:mK,cookieName:"_fbp",pattern:tst,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[mK]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(mK)}}}rh(e){var n;const o=(n=this.persistence)===null||n===void 0?void 0:n.get_property(e.persistenceKey);return eA(o)&&e.pattern.test(o)?{value:o,delivered:!1}:CA(o)&&eA(o.value)&&e.pattern.test(o.value)?{value:o.value,delivered:o.delivered===!0}:void 0}oh(e,n,o){return n===o?.value?{value:n,pending:!o.delivered}:(e.register(n,!1),{value:n,pending:!0})}ah(e){if(!this.config.save_campaign_params||this.bu())return;const n=xK(e.cookieName);return eA(n)&&e.pattern.test(n)?n:void 0}uh(e,n,o,i){if(!this.persistence)return;const r=this.nh;this.persistence.refreshKey(r.persistenceKey);const s=this.rh(r);if(i)return void r.unregister();if(o)return eA(n)&&est.test(n)?this.oh(r,n,s):void r.unregister();const a=eA(e)&&E5n.test(e)?e:void 0,A=this.ah(r);return A&&((c,l,g)=>{const u=c.split(".");if(l)return u[3]===l;if(!g)return!0;const h=g.value.split(".");return u[3]===h[3]||Number(u[2])>Number(h[2])})(A,a,s)?this.oh(r,A,s):a?s?.value.split(".")[3]===a?{value:s.value,pending:!s.delivered}:this.oh(r,`fb.1.${Date.now()}.${a}`,s):s?{value:s.value,pending:!s.delivered}:void 0}hh(e,n,o){if(!this.persistence)return;const i=this.sh;this.persistence.refreshKey(i.persistenceKey);const r=this.rh(i);if(o)return void i.unregister();if(n)return eA(e)&&tst.test(e)?this.oh(i,e,r):void i.unregister();const s=this.ah(i);return s?this.oh(i,s,r):r?{value:r.value,pending:!r.delivered}:void 0}dh(e,n){if(!this.persistence)return;this.persistence.refreshKey(e.persistenceKey);const o=this.rh(e);o?.value!==n||o.delivered||e.register(n,!0)}capture(e,n,o){var i,r;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void gi.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Bo(e)||!eA(e))return void gi.error("No event name provided to posthog.capture");this.Su();const s=!this.config.opt_out_useragent_filter&&this._is_bot();if(s&&!this.config.__preview_capture_bot_pageviews)return;const a=o?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a?.isRateLimited)return void gi.critical("This capture call is ignored due to client rate limiting.");let A;n?.$current_url&&!eA(n?.$current_url)&&(gi.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),e!=="$exception"||o?.fh||gi.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(A=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const c=new Date,l=o?.timestamp||c,g=Sot(o?.uuid,y4);let u={uuid:g,event:e,properties:this.calculateEventProperties(e,n||{},l,g)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&s&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),a&&(u.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);const h=e==="$feature_flag_called"&&u.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;o?.$set&&!h&&(u.$set=o?.$set);const d=CA(n?.$set)?n.$set:void 0,p=rs(n?.$unset)?n.$unset:[],m=o?.$unset||[],_=R=>{var F;const G=!!o?.$set&&R in o.$set;return{hasProvided:G||!!d&&R in d,provided:G?o==null||(F=o.$set)===null||F===void 0?void 0:F[R]:d?.[R],unset:p.indexOf(R)!==-1||m.indexOf(R)!==-1}},f=_(sit),I=_(ait),C=[{channel:this.nh,hasProvided:f.hasProvided,update:this.uh(A?.fbclid,f.provided,f.hasProvided,f.unset)},{channel:this.sh,hasProvided:I.hasProvided,update:this.hh(I.provided,I.hasProvided,I.unset)}];for(const{channel:R,hasProvided:F,update:G}of C)G&&u.properties.$process_person_profile===!0&&G.pending&&!F&&!h&&(u.$set=sn({[R.property]:G.value},u.$set));const y=o?.$unset;y&&(u.$unset=y);const x=h?void 0:this.ph(o?.$set_once,e!==Qit,e===bit);if(x&&(u.$set_once=x),o?._noTruncate||(E=this.config.properties_string_max_length,u=(function(R,F){const G=new Set;return(function U(Y,J){if(Y!==Object(Y))return F?F(Y):Y;if(G.has(Y))return;let ee;if(G.add(Y),rs(Y))ee=[],rk(Y,j=>{ee.push(U(j))});else{const j={};El(ZT(Y)?vit(Y):Y,(X,ie)=>{G.has(X)||(j[ie]=U(X))}),ee=j}return ee})(R)})(u,R=>eA(R)?R.slice(0,E):R)),u.timestamp=l,Bo(o?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=c),h&&(u.properties=((R,F=[])=>{const G={},U=Y=>{R[Y]!==void 0&&(G[Y]=R[Y])};return F3n.forEach(U),F.forEach(U),G})(u.properties,B5n)),e===r8.DISMISSED||e===r8.SENT){const R=n?.[mye.SURVEY_ID],F=n?.[mye.SURVEY_ITERATION];jrt({id:R,current_iteration:F}),u.$set=sn(sn({},u.$set),{},{[g5n({id:R,current_iteration:F},e===r8.SENT?"responded":"dismissed")]:!0})}else e===r8.SHOWN&&(u.$set=sn(sn({},u.$set),{},{[mye.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var E;if(e===jEn.SHOWN){const R=n?.[mrt.TOUR_TYPE];R&&(u.$set=sn(sn({},u.$set),{},{[`${mrt.TOUR_LAST_SEEN_DATE}/${R}`]:new Date().toISOString()}))}const B=sn(sn({},u.properties.$set),u.$set);if(z2(B)||this.setPersonPropertiesForFlags(B),!zs(this.config.before_send)){const R=this.Os(u);if(!R)return;u=R,u.uuid=Sot(u.uuid,y4)}const b=C.filter(({channel:R,update:F})=>{var G,U,Y;const J=(G=(U=u.$set)===null||U===void 0?void 0:U[R.property])!==null&&G!==void 0?G:CA((Y=u.properties)===null||Y===void 0?void 0:Y.$set)?u.properties.$set[R.property]:void 0;return F?.pending&&J===F.value});this.vu.emit("eventCaptured",u);const Q=(i=o?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),w=o?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(Q),M=sn(sn(sn({method:"POST",url:Q,data:u,compression:"best-available",preferSyncCompression:o?.send_instantly,timestampMode:w?"body":"capture-body",batchKey:o?._batchKey},w&&(!((r=u.properties)===null||r===void 0)&&r.$session_id)?{batchGroup:u.properties.$session_id+(u.properties.$window_id?`-${u.properties.$window_id}`:"")}:{}),o?.transport?{transport:o.transport}:{}),b.length?{fireCallbackOnDrop:!0,callback:R=>{if(R.statusCode>=200&&300>R.statusCode)for(const{channel:F,update:G}of b)this.dh(F,G.value)}}:{});if(!this.config.request_batching||o&&!o?._batchKey||o?.send_instantly||b.length){var k;let R;!M.transport&&!M.callback&&z2((k=this.config.request_headers)!==null&&k!==void 0?k:{})&&this.$u&&(R="sendBeacon"),this.ju(M,R)}else this.qu.enqueue(M);return u}_addCaptureHook(e){return this.on("eventCaptured",n=>e(n.event,n))}getExtension(e){var n;return(n=this.Xu)===null||n===void 0?void 0:n.getExtension(e)}Zu(){var e;return(e=this.Xu)!==null&&e!==void 0?e:this.Xu=new x5n(this)}pu(e){this.Pu.push(e);let n=!0;return()=>{if(!n)return;n=!1;const o=this.Pu.indexOf(e);o!==-1&&this.Pu.splice(o,1)}}gh(e=!0){var n,o,i;return!!(!((n=this.persistence)===null||n===void 0)&&n.consumeCookieIdentityChange())&&(this.Ou=null,this.persistence.get_property("$user_state")==="anonymous"&&((i=this.sessionPersistence)===null||i===void 0||i.clear(),this.Mu.clear(),this.mh()),(o=this.featureFlags)===null||o===void 0||o.reset(),e&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,n,o,i,r){if(o=o||new Date,!this.persistence||!this.sessionPersistence)return n;this.persistence.syncCookieProperties(),this.gh();const s=r?void 0:this.persistence.remove_event_timer(e);let a=sn({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.bu()&&(a[Iit]=!0),e==="$snapshot"){const f=sn(sn({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=f.distinct_id,(!eA(a.distinct_id)&&!zd(a.distinct_id)||gK(a.distinct_id))&&gi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}const A=(function(f,I,C,y=!1){var x,E,B,b;if(!iy)return{};const Q=f?[...uk,...I||[]]:[],[w,M]=Cot(iy),[k,R]=(function(se){for(let oe=0;xot.length>oe;oe++){const[ge,de,Ce]=xot[oe],le=se.match(ge);if(le){const _e=Ce&&se.match(Ce)||le;return[de,_e?.[1]||""]}}return["",""]})(iy),F=(function(){const se="u">typeof navigator?navigator:void 0;return se?.brave?{brave:!0}:{}})(),G={};Bo(C)||(G.detectGoogleSearchApp=C);const U={},Y=(x=navigator)===null||x===void 0||(x=x.userAgentData)===null||x===void 0?void 0:x.platform,J=(E=navigator)===null||E===void 0?void 0:E.maxTouchPoints,ee=Un==null||(B=Un.screen)===null||B===void 0?void 0:B.width,j=Un==null||(b=Un.screen)===null||b===void 0?void 0:b.height,X=Un?.devicePixelRatio;Bo(Y)||(U.userAgentDataPlatform=Y),Bo(J)||(U.maxTouchPoints=J),Bo(ee)||(U.screenWidth=ee),Bo(j)||(U.screenHeight=j),Bo(X)||(U.devicePixelRatio=X);const ie=Cg($Ce({$os:w,$os_version:M,$browser:fot(iy,navigator.vendor,F,G),$webview_app:k,$webview_app_version:R,$device:yot(iy),$device_type:r3n(iy,U),$timezone:urt(),$timezone_offset:zEn()}),{$current_url:wK(y?Yb(nd?.href):nd?.href,Q,MK),$host:nd?.host,$pathname:nd?.pathname,$raw_user_agent:iy.length>1e3?iy.substring(0,997)+"...":iy,$browser_version:i3n(iy,navigator.vendor,F,G),$browser_language:Art(),$browser_language_prefix:VEn(),$screen_height:Un?.screen.height,$screen_width:Un?.screen.width,$viewport_height:Un?.innerHeight,$viewport_width:Un?.innerWidth,$lib:e8.LIB_NAME,$lib_version:e8.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return e8.SDK_DIST_CHANNEL&&(ie.$sdk_dist_channel=e8.SDK_DIST_CHANNEL),ie})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:f,windowId:I}=this.sessionManager.checkAndGetSessionAndWindowId(r,o.getTime(),!0);a.$session_id=f,a.$window_id=I}this.sessionPropsManager&&Cg(a,this.sessionPropsManager.getSessionProps());try{var c;this.sessionRecording&&Cg(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(c=this.Bu)===null||c===void 0?void 0:c.length}catch(f){a.$sdk_debug_error_capturing_properties=String(f)}let l;if(this.requestRouter.region===Pye&&(a.$lib_custom_api_host=this.config.api_host),l=e!=="$pageview"||r?e!=="$pageleave"||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(o):this.pageViewManager.doPageView(o,i),a=Cg(a,l),e==="$pageview"&&No&&(a.title=No.title),!Bo(s)){const f=o.getTime()-s;a.$duration=parseFloat((f/1e3).toFixed(3))}iy&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");const g=this.persistence.properties(),u=this.sessionPersistence.properties(),h=a.$groups,d=g.$groups;CA(h)&&!z2(h)&&(a.$groups=sn(sn({},CA(d)?d:{}),h)),El(["$referrer","$referring_domain"],f=>{f in g&&delete u[f]});const p={};if(this.Pu.length>0)for(const f of this.Pu.slice())try{Cg(p,f())}catch(I){gi.error("Failed to produce browser extension event properties",I)}a=Cg({},A,g,u,sn(sn({},p),a)),a.$is_identified=this._isIdentified(),rs(this.config.property_denylist)?El(this.config.property_denylist,function(f){delete a[f]}):gi.error(Zrt+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const m=this.config.sanitize_properties;m&&(gi.error($rt),a=m(a,e));const _=this.yh();return a.$process_person_profile=_,_&&!r&&this.bh("_calculate_event_properties"),a}ph(e,n=!0,o=!1){var i;if(!this.persistence||!this.yh()||this.Iu&&!o)return e;const r=this.persistence.get_initial_props(),s=(i=this.sessionPropsManager)===null||i===void 0?void 0:i.getSetOnceProps();let a=Cg({},r,s||{},e||{});const A=this.config.sanitize_properties;return A&&(gi.error($rt),a=A(a,"$set_once")),n&&(this.Iu=!0),z2(a)?void 0:a}register(e,n){var o;(o=this.persistence)===null||o===void 0||o.register(e,n)}register_once(e,n,o){var i;(i=this.persistence)===null||i===void 0||i.register_once(e,n,o)}register_for_session(e){var n,o;(n=this.persistence)===null||n===void 0||n.syncCookieProperties(),this.gh(),(o=this.sessionPersistence)===null||o===void 0||o.register(e),Object.keys(e).forEach(i=>this.Mu.add(i)),this.mh()}unregister(e){var n;(n=this.persistence)===null||n===void 0||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(e),this.Mu.delete(e),this.mh()}_h(e,n){this.register({[e]:n})}Hu(){this.Mu.forEach(e=>{var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(e)}),this.Mu.clear(),this.mh()}mh(){var e;if(!this.Eu)return;if(this.config.persistence==="memory"||!((e=this.sessionPersistence)===null||e===void 0)&&e.mi||!j0.Et())return void j0.Lt(this.Eu);const n=[];this.Mu.forEach(o=>n.push(o)),n.length>0?j0.At(this.Eu,n):j0.Lt(this.Eu)}getFeatureFlag(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlagResult(e,n)}getAllFeatureFlags(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,n){var o,i;return(o=(i=this.featureFlags)===null||i===void 0?void 0:i.isFeatureEnabled(e,n))!==null&&o!==void 0?o:n?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)===null||e===void 0||e.reloadFeatureFlags()}updateFlags(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateFlags(e,n,o)}updateEarlyAccessFeatureEnrollment(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateEarlyAccessFeatureEnrollment(e,n,o)}getEarlyAccessFeatures(e,n=!1,o){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getEarlyAccessFeatures(e,n,o)}on(e,n){return this.vu.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:HK}),()=>{})}onSessionId(e){var n,o;return(n=(o=this.sessionManager)===null||o===void 0?void 0:o.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n=!1){this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:HK})}getActiveMatchingSurveys(e,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:HK})}renderSurvey(e,n){var o;(o=this.surveys)===null||o===void 0||o.renderSurvey(e,n)}displaySurvey(e,n=m5n){var o;(o=this.surveys)===null||o===void 0||o.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)===null||n===void 0||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,o;return(n=(o=this.surveys)===null||o===void 0?void 0:o.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:HK}}canRenderSurveyAsync(e,n=!1){var o,i;return(o=(i=this.surveys)===null||i===void 0?void 0:i.canRenderSurveyAsync(e,n))!==null&&o!==void 0?o:Promise.resolve({visible:!1,disabledReason:HK})}wh(e){return!e||gK(e)?(gi.critical("Unique user id has not been set in posthog.identify"),!1):e==="$posthog_cookieless"?(gi.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(gi.critical(`The string "${e}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(e,n,o){if(!this.__loaded||!this.persistence)return gi.uninitializedWarning("posthog.identify");if(zd(e)&&(e=e.toString(),gi.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wh(e)||!this.bh("posthog.identify"))return;this.Su();const i=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,s=this.gh(!1),a=this.persistence.Da();let A=!1;try{const l=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property("__alias")&&(this.unregister(ite),this.register({distinct_id:e}));const g=(this.persistence.get_property("$user_state")||"anonymous")===o8,u=e!==l,h=!u&&g;if(u&&g){var c;const d=this.config.reuseAnonymousId?{distinct_id:e}:{distinct_id:e,$anon_distinct_id:l};this.persistence.set_property(sy,ste),this.setPersonPropertiesForFlags({$set:n||{},$set_once:o||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$identify",d,{$set:n||{},$set_once:o||{}})&&(this.Ou=vye(e,n,o)),(c=this.featureFlags)===null||c===void 0||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(h){this.persistence.set_property(sy,ste);const d=n||{},p=o||{};this.setPersonPropertiesForFlags({$set:d,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$set",{$set:d,$set_once:p})&&(this.Ou=vye(e,n,o))}else(n||o)&&this.setPersonProperties(n,o);u||r||s?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(zb)):h&&(n||o)&&this.reloadFeatureFlags(),A=!0}finally{a&&this.persistence.ja(A)}}setPersonProperties(e,n){if(!e&&!n||!this.bh("posthog.setPersonProperties"))return;const o=vye(this.get_distinct_id(),e,n);this.Ou!==o?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:n||{}},!0),this.capture("$set",{$set:e||{},$set_once:n||{}})&&(this.Ou=o)):gi.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(e){var n;const o=(rs(e)?e:[e]).filter(i=>eA(i)&&i.length>0);o.length!==0&&this.bh("posthog.unsetPersonProperties")&&((n=this.featureFlags)===null||n===void 0||n.unsetPersonPropertiesForFlags(o,!0),this.capture("$set",{$unset:o}),this.Ou=null)}group(e,n,o){var i;if(!e||!n)return void gi.error("posthog.group requires a group type and group key");(i=this.persistence)===null||i===void 0||i.syncCookieProperties(),this.gh();const r=this.getGroups(),s=r[e]!==n;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:sn(sn({},r),{},{[e]:n})}),(s||o)&&this.yh()){const a={$group_type:e,$group_key:n};o&&(a.$group_set=o),this.capture(Qit,a)}o&&this.setGroupPropertiesForFlags({[e]:o}),s&&!o&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n=!0){var o;(o=this.featureFlags)===null||o===void 0||o.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(e=!0){var n;(n=this.featureFlags)===null||n===void 0||n.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,n=!0){var o;this.bh("posthog.setGroupPropertiesForFlags")&&((o=this.featureFlags)===null||o===void 0||o.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)===null||n===void 0||n.resetGroupPropertiesForFlags(e)}reset(e){const n=ry(e)?e:e?.resetDeviceID,o=ry(e)||e==null?void 0:e.bootstrap;this.kh(n,!1,o)}kh(e,n=!1,o){var i,r,s,a,A,c;if(gi.info("reset"),!this.__loaded)return gi.uninitializedWarning("posthog.reset");const l=o?.sessionID;this.config.bootstrap=o||((i=this.Lu)===null||i===void 0?void 0:i.bootstrap)||{},(r=this.featureFlags)===null||r===void 0||(s=r.updateConfig)===null||s===void 0||s.call(r,this.config,this.nl());const g=this.get_property(TCe),u=this.get_property(kCe),h=this.get_property(_K);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();const d=this.is_capturing();this.consent.reset(),n||!d||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const p=(A=this.persistence)===null||A===void 0||(c=A.Da)===null||c===void 0?void 0:c.call(A);let m=!1;try{var _,f,I,C,y,x,E,B,b,Q,w,M,k;if((_=this.persistence)===null||_===void 0||_.clear(),(f=this.sessionPersistence)===null||f===void 0||f.clear(),this.Mu.clear(),this.mh(),Bo(h)||(Q=this.persistence)===null||Q===void 0||Q.register({$session_recording_remote_config:h}),(I=this.surveys)===null||I===void 0||I.reset(),(C=this.featureFlags)===null||C===void 0||C.reset(),(y=this.conversations)===null||y===void 0||y.reset(),(x=this.logs)===null||x===void 0||x.reset(),(E=this.metrics)===null||E===void 0||E.reset(),(B=this.persistence)===null||B===void 0||B.set_property("$user_state","anonymous"),(b=this.sessionManager)===null||b===void 0||b.resetSessionId(),this.Ou=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:jCe,$device_id:null},"");else{const G=this.config.get_device_id(y4());this.register_once({distinct_id:G,$device_id:e?G:g},""),e||Bo(u)||this.register({[kCe]:u})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),o&&(o.distinctID&&!this.bu()&&((k=this.persistence)===null||k===void 0||k.set_property("$user_state",o.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.distinctID})),(w=this.featureFlags)===null||w===void 0||w.initialize(),!zs(l)&&!(!((M=this.sessionManager)===null||M===void 0)&&M.setBootstrapSessionId(l,!0)))){const G=sn({},o);delete G.sessionID,this.config.bootstrap=G}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,m=!0}finally{var R,F;p&&((R=this.persistence)===null||R===void 0||(F=R.ja)===null||F===void 0||F.call(R,m))}this.reloadFeatureFlags()}shutdown(e){var n=this;return Vg(function*(){var o,i,r,s,a,A,c,l;if(n.__loaded){n.Tu=!0,n.Zu().dispose(),(o=n.sessionRecording)===null||o===void 0||o.dispose(),(i=n.logs)===null||i===void 0||i.flushLogs("sendBeacon"),(r=n.metrics)===null||r===void 0||r.flush("sendBeacon"),(s=n.metrics)===null||s===void 0||s.dispose(),(a=n.qu)===null||a===void 0||a.unload(),(A=n.Bu)===null||A===void 0||A.unload();try{var g;(g=n.featureFlags)===null||g===void 0||g.destroy()}catch(u){gi.error("Error while destroying feature flags",u)}(c=n.persistence)===null||c===void 0||c.destroy(),(l=n.sessionPersistence)===null||l===void 0||l.destroy()}else gi.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,n){var o;delete this.config.identity_claims,this.config.identity_distinct_id=e,this.config.identity_hash=n,this.alias(e),(o=this.conversations)===null||o===void 0||o.Sh()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(e=this.conversations)===null||e===void 0||e.xh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";const{sessionId:n,sessionStartTimestamp:o}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let i=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${n}`);if(e?.withTimestamp&&o){var r;const s=(r=e.timestampLookBack)!==null&&r!==void 0?r:10;if(!o)return i;i+=`?t=${Math.max(Math.floor((new Date().getTime()-o)/1e3)-s,0)}`}return i}alias(e,n){return e===this.get_property("$people_distinct_id")?(gi.critical("Attempting to create alias for existing People user - aborting."),-2):this.bh("posthog.alias")?(Bo(n)&&(n=this.get_distinct_id()),e!==n?(this._h(ite,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(gi.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){const n=sn({},this.config);if(CA(e)){var o,i,r,s,a,A,c,l,g,u,h,d,p,m;Cg(this.config,nst(e));const f=this.xu();(o=this.persistence)===null||o===void 0||o.update_config(this.config,n,f),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new hye(sn(sn({},this.config),{},{persistence:"sessionStorage"}),f,!1);const I=this.Du(this.config.debug);var _;ry(I)&&(this.config.debug=I),ry(this.config.debug)&&(this.config.debug?(Fm.DEBUG=!0,cc.Et()&&cc.At("ph_debug",!0),gi.info("set_config",{config:e,oldConfig:n,newConfig:sn({},this.config)})):(Fm.DEBUG=!1,cc.Et()&&cc.Lt("ph_debug"))),(i=this.featureFlags)===null||i===void 0||(r=i.updateConfig)===null||r===void 0||r.call(i,this.config,this.nl()),(s=this.exceptionObserver)===null||s===void 0||s.onConfigChange(),(a=this.exceptions)===null||a===void 0||a.onConfigChange(),(A=this.metrics)===null||A===void 0||A.onConfigChange(),(c=this.sessionRecording)===null||c===void 0||c.startIfEnabledOrStop(),(l=this.tracingHeaders)===null||l===void 0||l.startIfEnabledOrStop(),(g=this.autocapture)===null||g===void 0||g.startIfEnabled(),(u=this.heatmaps)===null||u===void 0||u.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&((_=this.historyAutocapture)===null||_===void 0||_.startIfEnabledOrStop()),(h=this.exceptionObserver)===null||h===void 0||h.startIfEnabledOrStop(),(d=this.deadClicksAutocapture)===null||d===void 0||d.startIfEnabledOrStop(),(p=this.surveys)===null||p===void 0||p.loadIfEnabled(),this.Cu(),(m=this.externalIntegrations)===null||m===void 0||m.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&Zit(this,LK,!1)}}_overrideSDKInfo(e,n){Fm.LIB_NAME=e,Fm.LIB_VERSION=n}startSessionRecording(e){const n=e===!0,o={sampling:n||!!e?.sampling,linked_flag:n||!!e?.linked_flag,url_trigger:n||!!e?.url_trigger,event_trigger:n||!!e?.event_trigger};var i,r,s,a,A;Object.values(o).some(Boolean)&&((i=this.sessionManager)===null||i===void 0||i.checkAndGetSessionAndWindowId(),o.sampling&&((r=this.sessionRecording)===null||r===void 0||r.overrideSampling()),o.linked_flag&&((s=this.sessionRecording)===null||s===void 0||s.overrideLinkedFlag()),o.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),o.event_trigger&&((A=this.sessionRecording)===null||A===void 0||A.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!!(!((e=this.sessionRecording)===null||e===void 0)&&e.started)}captureException(e,n){try{if(!this.exceptions)return;const o=this.exceptions.buildProperties(e,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(sn(sn({},o),n))}catch{return}}addExceptionStep(e,n){var o;(o=this.exceptions)===null||o===void 0||o.addExceptionStep(e,n)}captureLog(e){var n;(n=this.logs)===null||n===void 0||n.captureLog(e)}get logger(){var e,n;return(e=(n=this.logs)===null||n===void 0?void 0:n.logger)!==null&&e!==void 0?e:iM.Ch}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,o;return(n=(o=this.toolbar)===null||o===void 0?void 0:o.loadToolbar(e))!==null&&n!==void 0&&n}get_property(e){var n;return(n=this.persistence)===null||n===void 0?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)===null||n===void 0?void 0:n.props[e]}toString(){var e;let n=(e=this.config.name)!==null&&e!==void 0?e:OK;return n!==OK&&(n="posthog."+n),n}_isIdentified(){var e,n;return((e=this.persistence)===null||e===void 0?void 0:e.get_property("$user_state"))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property("$user_state"))==="identified"}yh(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&z2(this.getGroups())&&!(!((e=this.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e.__alias)&&!(!((n=this.persistence)===null||n===void 0||(n=n.props)===null||n===void 0)&&n.$epp))}ih(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.yh()||this.bh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bh(e){return this.config.person_profiles==="never"?(gi.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._u(),this._h(WCe,!0),!0)}xu(){if(this.config.cookieless_mode==="always")return!0;const e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}Cu(){var e,n;const o=this.xu();var i,r,s;return this.is_capturing()||(i=this.logs)===null||i===void 0||i.$h(),((e=this.persistence)===null||e===void 0?void 0:e.mi)!==o&&((r=this.persistence)===null||r===void 0||r.set_disabled(o)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.mi)!==o&&((s=this.sessionPersistence)===null||s===void 0||s.set_disabled(o)),o&&(this.Mu.clear(),this.mh()),o}opt_in_capturing(e){var n;if(this.config.cookieless_mode!=="always"){if(this.bu()){var o,i,r,s,a,A;(o=this.sessionRecording)===null||o===void 0||o.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),(i=this.sessionManager)===null||i===void 0||i.destroy(),(r=this.pageViewManager)===null||r===void 0||r.destroy(),this.sessionManager=new Yrt(this),this.pageViewManager=new nrt(this),this.persistence&&(this.sessionPropsManager=new Ort(this,this.sessionManager,this.persistence));const h=(s=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&s!==void 0?s:(A=iM.__defaultExtensionClasses)===null||A===void 0?void 0:A.sessionRecording;var c,l;h&&(this.sessionRecording=this.yu(this.sessionRecording,new h(this)),this.du&&((c=this.sessionRecording)===null||c===void 0||(l=c.onRemoteConfig)===null||l===void 0||l.call(c,this.du)))}var g,u;this.consent.optInOut(!0),this.Cu(),this.Yu(),(n=this.sessionRecording)===null||n===void 0||n.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((g=this.surveys)===null||g===void 0||g.loadIfEnabled()),(Bo(e?.captureEventName)||e?.captureEventName)&&this.capture((u=e?.captureEventName)!==null&&u!==void 0?u:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else gi.warn(Xrt)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void gi.warn(Xrt);const e=this.config.cookieless_mode==="on_reject"?this.sessionRecording:void 0;var n,o;e?.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.Cu(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:jCe,$device_id:null}),this.mu(e),this.sessionRecording=void 0,(n=this.sessionManager)===null||n===void 0||n.destroy(),(o=this.pageViewManager)===null||o===void 0||o.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.th(),this.Yu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.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.Cu()}_is_bot(){return w_?Urt(w_,this.config.custom_blocked_useragents):void 0}th(){No&&(No.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(XCe,{title:No.title},{send_instantly:!0}),this.Au&&(No.removeEventListener(yK,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),dl(No,yK,this.Au)))}debug(e){e===!1?(Un?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Un?.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}))}nl(){const e=this.Lu||{};return"advanced_disable_flags"in e?!!e.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(gi.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(n,o,i,r,s){const a=o in n&&!zs(n[o]),A=i in n&&!zs(n[i]);return a?n[o]:!!A&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${o}' instead. The old field will be removed in a future major version.`),n[i])})(e,"advanced_disable_flags","advanced_disable_decide",0,gi)}Os(e){var n;if(zs(this.config.before_send))return e;const o=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(Jxn),i=rs(this.config.before_send)?this.config.before_send:[this.config.before_send];let r=e;for(const s of i)try{if(r=s(r),zs(r)){const a=`Event '${e.event}' was rejected in beforeSend function`;return zxn(e.event)?gi.warn(`${a}. This can cause unexpected behavior.`):gi.info(a),null}r.properties&&!z2(r.properties)||gi.warn(`Event '${e.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return gi.error(`Error in beforeSend function for event '${e.event}':`,a),null}for(const s of o)if(r.properties&&zs(r.properties[s]))return gi.warn(`Event '${e.event}' had its '${s}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){var e;return(e=this.pageViewManager.Vo)===null||e===void 0?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,o){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(o)})}Du(e){const n=ry(e)&&!e,o=cc.Et()&&cc.Ot("ph_debug")==="true";return!n&&(!!o||e)}};GK.__defaultExtensionClasses={},GK.Ch=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),(function(t,e){for(let n=0;e.length>n;n++)t.prototype[e[n]]=xEn(t.prototype[e[n]])})(GK,["identify"]);var ost=class{constructor(e){this.disabled=e===!1;const n=CA(e)?e:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(e,n,o){if(this.disabled)return!1;const i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(n-i.y)<this.thresholdPx&&this.timeoutMs>o-i.timestamp){if(this.clicks.push({x:e,y:n,timestamp:o}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:o}];return!1}};const Dye="$copy_autocapture",Nye=id("[AutoCapture]");function Rye(t,e){return e.length>t?e.slice(0,t)+"...":e}function v5n(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do e=e.previousSibling;while(e&&!A9(e));return e}function P5n(t,{e,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:i,elementsChainAsString:r,disableCaptureUrlHashes:s}){var a,A;if(!A9(t))return{props:{}};const c=[t],l=new Set([t]);let g=t;for(;g.parentNode&&!H1(g,"body")&&1e3>c.length;){if(sye(g.parentNode)){const x=g.parentNode.host;if(l.has(x))break;l.add(x),c.push(x),g=x;continue}if(!A9(g.parentNode)||l.has(g.parentNode))break;l.add(g.parentNode),c.push(g.parentNode),g=g.parentNode}const u=e.type==="click"&&t.namespaceURI==="http://www.w3.org/2000/svg"?c.findIndex(x=>H1(x,"button")||H1(x,"a")):-1;u>0&&(o=o||c.slice(0,u+1).some(x=>!ck(x)||bK(x)));const h=[],d={};let p,m=!1,_=!1;if(El(c,x=>{const E=ck(x);if(H1(x,"a")&&!n&&!i?.includes("href")){const B=x.getAttribute("href");m=!!(E&&B&&QK(B))&&(s?Yb(B):B)}ms(Ak(x),"ph-no-capture")&&(_=!0),h.push((function(B,b,Q,w,M=!1){const k=B.tagName.toLowerCase(),R={tag_name:k};Aye.indexOf(k)>-1&&!Q&&(R.$el_text=k.toLowerCase()==="a"||k.toLowerCase()==="button"?Rye(1024,jit(B)):Rye(1024,BK(B)));const F=Ak(B);b||w?.includes("class")||0>=F.length||(R.classes=F.filter(function(J){return J!==""})),El(B.attributes,function(J){var ee;if((!bK(B)||["name","id","class","aria-label"].indexOf(J.name)!==-1)&&!w?.includes(J.name)&&!b&&QK(J.value)&&(!eA(ee=J.name)||ee.substring(0,10)!=="_ngcontent"&&ee.substring(0,7)!=="_nghost")){let j=J.value;J.name==="class"&&(j=aye(j).join(" ")),R["attr__"+J.name]=Rye(1024,J.name==="href"&&M?Yb(j):j)}});let G=1,U=1,Y=B;for(;Y=v5n(Y);)G++,Y.tagName===B.tagName&&U++;return R.nth_child=G,R.nth_of_type=U,R})(x,n,o,i,s)),El((function(B){if(!ck(B))return{};const b={};return El(B.attributes,function(Q){if(Q.name&&Q.name.indexOf("data-ph-capture-attribute")===0){const w=Q.name.replace("data-ph-capture-attribute-",""),M=Q.value;w&&M&&QK(M)&&(b[w]=M)}}),b})(x),(B,b)=>{({}).hasOwnProperty.call(d,b)||(d[b]=B)})}),_)return{props:{},explicitNoCapture:_};if(u>0&&(t=c[u],h.splice(0,u)),o||(h[0].$el_text=H1(t,"a")||H1(t,"button")?jit(t):BK(t)),m){var f,I;h[0].attr__href=m;const x=(f=Wb(m))===null||f===void 0?void 0:f.host,E=Un==null||(I=Un.location)===null||I===void 0?void 0:I.host;x&&E&&x!==E&&(p=m)}return{props:Cg((y=e.type,{$event_type:y,$ce_version:1}),r?{}:{$elements:h},{$elements_chain:(C=h,rs(C)?(function(x){return x.map(E=>{var B,b;let Q="";if(E.tag_name&&(Q+=E.tag_name),E.attr_class){E.attr_class.sort();for(const k of E.attr_class)Q+=`.${k.replace(/"/g,"")}`}const w=sn(sn(sn(sn({},E.text?{text:E.text}:{}),{},{"nth-child":(B=E.nth_child)!==null&&B!==void 0?B:0,"nth-of-type":(b=E.nth_of_type)!==null&&b!==void 0?b:0},E.href?{href:E.href}:{}),E.attr_id?{attr_id:E.attr_id}:{}),E.attributes),M={};return Ate(w).sort(([k],[R])=>(function(F,G){return G>F?-1:F>G?1:0})(k,R)).forEach(([k,R])=>M[Xit(k.toString())]=Xit(R.toString())),Q+=":",Q+=Ate(M).map(([k,R])=>`${k}="${R}"`).join(""),Q}).join(";")})((function(x){return x.map(E=>{var B,b;const Q={text:(B=E.$el_text)===null||B===void 0?void 0:B.slice(0,400),tag_name:E.tag_name,href:(b=E.attr__href)===null||b===void 0?void 0:b.slice(0,2048),attr_class:FEn(E),attr_id:E.attr__id,nth_child:E.nth_child,nth_of_type:E.nth_of_type,attributes:{}};return Ate(E).filter(([w])=>w.indexOf("attr__")===0).forEach(([w,M])=>Q.attributes[w]=M),Q})})(C)):"")},!((a=h[0])===null||a===void 0)&&a.$el_text?{$el_text:(A=h[0])===null||A===void 0?void 0:A.$el_text}:{},p&&e.type==="click"?{$external_click_url:p}:{},d),target:t};var C,y}var w5n=class{fo(){this.po=void 0,clearTimeout(this.mo),this.mo=void 0}yo(e){var n;if(!ck(e))return!0;const o=(n=this.bo().css_selector_ignorelist)!==null&&n!==void 0?n:gye,i=new Set;let r=e;for(;r;){if(i.size>=1e3||i.has(r))return!0;i.add(r);const s=r,a=Ak(s);if(ms(a,"ph-no-capture")||ms(a,"ph-sensitive")||bK(s)||o.some(c=>cye(s,c)))return!0;const A=r.parentNode;r=sye(A)?A.host:A&&A9(A)?A:null}return!1}_o(e){if(!this.isEnabled||e.type==="pointercancel")return void this.fo();if(e.type==="pointerdown"){this.fo();const i=SK(e);var n;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&A9(i)&&(this.po={target:i,excluded:this.yo(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(n=this.wo)===null||n===void 0?void 0:n.distinctId}))}const o=this.po;o&&(e.pointerId!==o.id||Math.abs(e.clientX-o.x)>5||Math.abs(e.clientY-o.y)>5?this.fo():e.type==="pointerup"&&(o.released=!0,this.mo=setTimeout(()=>this.fo(),0)))}ko(e){var n;const o=this.po;this.fo();const i=SK(e);if(o?.released&&o.target.isConnected&&o.distinctId===((n=this.wo)===null||n===void 0?void 0:n.distinctId)&&e.pointerId===o.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-o.x)&&5>=Math.abs(e.clientY-o.y)&&i&&(H1(i,"html")||H1(i,"body"))){var r;if(o.excluded)return null;const s=(r=this.bo().css_selector_ignorelist)!==null&&r!==void 0?r:gye;return[i,No?.documentElement,No?.body].some(a=>{if(!a)return!1;const A=Ak(a);return ms(A,"ph-no-capture")||ms(A,"ph-sensitive")||!ck(a)||bK(a)||s.some(c=>cye(a,c))})?null:o.target}}constructor(e){this.So=e,this.name="autocapture",this.xo=!1,this.Co=null,this.$o=!1,this.To=!1,this.Rr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Io=!1,this.So.refresh(this.Rr),this.rageclicks=new ost(this.Rr.rageclick),this.Mo=null}setup(e){this.Eo(),this.wo=e;const n=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.Io?n.dispose():(this.Po=n,this.startIfEnabled())}dispose(){var e;this.Io||(this.Io=!0,this.wo=void 0,(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,this.Ro())}bo(){return this.So.refresh(this.Rr),this.Rr}Eo(){var e,n;return this.bo(),this.Rr.url_allowlist=(e=this.Rr.url_allowlist)===null||e===void 0?void 0:e.map(o=>new RegExp(o)),this.Rr.url_ignorelist=(n=this.Rr.url_ignorelist)===null||n===void 0?void 0:n.map(o=>new RegExp(o)),this.Rr}Ao(){if(!this.isBrowserSupported())return void Nye.info("Disabling Automatic Event Collection because this browser is not supported");if(!Un||!No)return;const e=this.Fo=n=>{n=n||Un?.event;try{if(n.type==="blur")return void this.fo();if(n.type.indexOf("pointer")===0)return void this._o(n);const o=n.type==="click"?this.ko(n):void 0;if(od(o))return;this.Oo(n,"$autocapture",o)}catch(o){Nye.error("Failed to capture event",o)}};if(dl(Un,"blur",e),dl(No,"submit",e,{capture:!0}),dl(No,"change",e,{capture:!0}),dl(No,"click",e,{capture:!0}),El(["pointerdown","pointermove","pointerup","pointercancel"],n=>{dl(No,n,e,{capture:!0})}),this.bo().capture_copied_text){const n=this.Do=o=>{o=o||Un?.event;try{this.Oo(o,Dye)}catch(i){Nye.error("Failed to capture clipboard event",i)}};dl(No,"copy",n,{capture:!0}),dl(No,"cut",n,{capture:!0}),dl(No,"paste",n,{capture:!0})}}Ro(){this.fo(),this.Fo&&(Un?.removeEventListener("blur",this.Fo),El(["pointerdown","pointermove","pointerup","pointercancel"],e=>{No?.removeEventListener(e,this.Fo,!0)}),No?.removeEventListener("submit",this.Fo,!0),No?.removeEventListener("change",this.Fo,!0),No?.removeEventListener("click",this.Fo,!0),this.Fo=void 0),this.Do&&(No?.removeEventListener("copy",this.Do,!0),No?.removeEventListener("cut",this.Do,!0),No?.removeEventListener("paste",this.Do,!0),this.Do=void 0),this.xo=!1}startIfEnabled(){this.isEnabled||this.fo(),!this.Io&&this.wo&&this.isEnabled&&!this.xo&&(this.Ao(),this.xo=!0)}onRemoteConfig(e){if(this.Io)return;if(this.$o=!0,!e.ok)return void this.startIfEnabled();const n=e.config;n.elementsChainAsString&&(this.To=n.elementsChainAsString);const o=n.autocapture_opt_out;var i;ry(o)&&((i=this.wo)===null||i===void 0||i.kv.set("$autocapture_disabled_server_side",o),this.Co=o),this.startIfEnabled()}setElementSelectors(e){this.Mo=e}getElementSelectors(e,n){var o;const i=[];return(o=this.Mo)===null||o===void 0||o.forEach(r=>{const s=No?.querySelectorAll(r);s?.forEach(a=>{e!==a&&n!==a||ms(i,r)||i.push(r)})}),i}get isEnabled(){var e,n;if(this.Io)return!1;const o=(e=this.wo)===null||e===void 0?void 0:e.kv.get(Ait),i=this.Co,r=this.bo();if(!r.remoteRequestsDisabled&&!this.$o)return!1;const s=r.remoteRequestsDisabled&&!this.$o;if(od(i)&&!ry(o)&&!s)return!1;const a=(n=this.Co)!==null&&n!==void 0?n:!!o;return!!r.enabled&&!a}Oo(e,n="$autocapture",o){if(!this.isEnabled)return void this.fo();let i=o||SK(e);kit(i)&&(i=i.parentNode||null);const r=this.Eo();var s;n==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&r.rageclick&&(!((s=this.rageclicks)===null||s===void 0)&&s.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&Uit(i,r.rageclick)&&this.Oo(e,"$rageclick",o);const a=n===Dye,A=a?sn(sn({},r),{},{dom_event_allowlist:void 0}):r;if(i&&(function(u,h,d,p,m,_){var f;if(!Un||uye(u)||d?.url_allowlist&&!Fit(d.url_allowlist,_)||d?.url_ignorelist&&Fit(d.url_ignorelist,_))return!1;if(d?.dom_event_allowlist){const x=d.dom_event_allowlist;if(x&&!x.some(E=>h.type===E))return!1}const{parentIsUsefulElement:I,targetElementList:C}=Kit(u,p);if(!(function(x,E){const B=E?.element_allowlist;if(Bo(B))return!0;for(const b of x)if(B.some(Q=>b.tagName.toLowerCase()===Q))return!0;return!1})(C,d)||!lye(C,d?.css_selector_allowlist)||lye(C,(f=d?.css_selector_ignorelist)!==null&&f!==void 0?f:gye))return!1;try{const x=Un.getComputedStyle(u);if(x&&x.getPropertyValue("cursor")==="pointer"&&h.type==="click")return!0}catch{}const y=u.tagName.toLowerCase();switch(y){case"html":return!1;case"form":return(m||["submit"]).indexOf(h.type)>=0;case"input":case"select":case"textarea":return(m||["change","click"]).indexOf(h.type)>=0;default:return I?(m||["click"]).indexOf(h.type)>=0:(m||["click"]).indexOf(h.type)>=0&&(Aye.indexOf(y)>-1||u.getAttribute("contenteditable")==="true")}})(i,e,A,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var c;const{props:u,explicitNoCapture:h,target:d}=P5n(i,{e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(h)return!1;const p=this.getElementSelectors(i,d);if(p&&p.length>0&&(u.$element_selectors=p),n===Dye){const m=e.type||"clipboard";if(m!=="paste"){var l,g;const _=Un==null||(l=Un.getSelection())===null||l===void 0?void 0:l.toString(),f=Lit(_);if(!f)return!1;u.$selected_content=f,u.$clipboard_text_length=(g=_?.length)!==null&&g!==void 0?g:0}u.$copy_type=m}return(c=this.wo)===null||c===void 0||c.capture(n,u),!0}}isBrowserSupported(){return M_(No?.querySelectorAll)}},M5n=class{constructor(e){this._instance=e}refresh(e){const n=this._instance.config,o=CA(n.autocapture)?n.autocapture:void 0;e.enabled=!!n.autocapture,e.rageclick=n.rageclick,e.maskAllElementAttributes=n.mask_all_element_attributes,e.maskAllText=n.mask_all_text,e.disableCaptureUrlHashes=n.disable_capture_url_hashes,e.getCurrentUrl=n.get_current_url,e.remoteRequestsDisabled=this._instance.nl(),e.url_allowlist=o?.url_allowlist,e.url_ignorelist=o?.url_ignorelist,e.dom_event_allowlist=o?.dom_event_allowlist,e.element_allowlist=o?.element_allowlist,e.css_selector_allowlist=o?.css_selector_allowlist,e.css_selector_ignorelist=o?.css_selector_ignorelist,e.element_attribute_ignorelist=o?.element_attribute_ignorelist,e.capture_copied_text=o?.capture_copied_text}};const YK=id("[ExceptionAutocapture]"),ist=()=>{},rst=t=>{var e;if(M_(t))return(e=t.__posthog_layer__)!==null&&e!==void 0?e:t.__rrweb_layer__};function UK(t,e,n){try{if(!(e in t))return ist;const o={next:t[e]},i=n(function(...r){return o.next.apply(this,r)});return M_(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:o}})),t[e]=i,()=>{if(t[e]===i)return void(t[e]=o.next);let r=t[e],s=rst(r);for(;s;){if(s.next===i)return void(s.next=o.next);r=s.next,s=rst(r)}}}catch{return ist}}const D5n=id("[TracingHeaders]"),_M=id("[Web Vitals]"),sst=9e5,ast=["CLS","FCP","INP","LCP"],N5n=["INP","LCP"],R5n=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Tye="disabled",Ast="lazy_loading",a8=id("[SessionRecording]"),T5n=id("[Heatmaps]");function kye(t){return CA(t)&&"clientX"in t&&"clientY"in t&&zd(t.clientX)&&zd(t.clientY)}const yte=id("[Product Tours]"),Fye=t=>{var e;return!t.config.disable_product_tours&&!!(!((e=t.persistence)===null||e===void 0)&&e.get_property(UCe))},k5n=["$set_once","$set"],c9=id("[SiteApps]"),cst="Error while initializing PostHog app with config id ",lst=(t,e)=>t?.then?t.then(e):e(t),_k="SDK is not enabled or survey functionality is not yet loaded",gst="Disabled. Not loading surveys.";var F5n=class{constructor(e,n){this.So=e,this.Th=n,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=[],this.Eh=null,this.Ph=null,this.Io=!1,this.Rh=new Set,this.onRemoteConfig=o=>{if(this.Io||this.Rr.disableSurveys)return;if(!o.ok)return Bl.warn("Remote config unavailable. Not loading surveys.");const i=o.config.surveys;if(zs(i))return Bl.warn("Flags not loaded yet. Not loading surveys.");this.Ah=ry(i)?i:i.length>0,Bl.info(`flags response received, isSurveysEnabled: ${this.Ah}`),this.loadIfEnabled()}}setup(e){if(!this.Io)return this.Fh=e,lst(e.kv.initialize(),()=>{if(this.Fh!==e||this.Io)return;this.Fh=void 0,this.wo=e;const n=e.onRemoteConfig(this.onRemoteConfig);this.Io?n.dispose():(this.Po=n,this.loadIfEnabled())})}dispose(){var e,n,o,i;this.Io||(this.Io=!0,this.Fh=void 0,this.wo=void 0,(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,(n=this._surveyEventReceiver)===null||n===void 0||n.dispose(),this._surveyEventReceiver=null,(o=this._surveyManager)===null||o===void 0||(i=o.dispose)===null||i===void 0||i.call(o),this._surveyManager=null,this.Mh=[],this.Eh=null,this.Rh.forEach(r=>clearTimeout(r)),this.Rh.clear())}get Rr(){return this.So.get()}initialize(){this.loadIfEnabled()}reset(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.clearInMemoryInProgressSurveyState)===null||n===void 0||n.call(e);try{var o;(o=this._surveyEventReceiver)===null||o===void 0||o.reset(),localStorage.removeItem("lastSeenSurveyDate");const i=[];for(let r=0;r<localStorage.length;r++){const s=localStorage.key(r);(s?.startsWith("seenSurvey_")||s?.startsWith("inProgressSurvey_"))&&i.push(s)}i.forEach(r=>localStorage.removeItem(r))}catch{}}loadIfEnabled(){if(this.Io||!this.wo)return;const e=this.Rr;if(this._surveyManager)return;if(this.Ih)return void Bl.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void Bl.info(gst);if(e.cookielessMode&&this.So.isOptedOut())return void Bl.info("Not loading surveys in cookieless mode without consent.");const n=this.So.getExtensions();if(!n)return void Bl.error("PostHog Extensions not found.");if(Bo(this.Ah)&&!e.advancedEnableSurveys)return;const o=this.Ah||e.advancedEnableSurveys;this.Ih=!0;try{const i=n.generateSurveys;if(i)return this.Oh(i,o),void(this.Ih=!1);const r=n.loadExternalDependency;if(!r)return this.Dh(qCe),void(this.Ih=!1);r(s=>{try{if(this.Io)return;const a=this.So.getExtensions();s||!a?.generateSurveys?this.Dh("Could not load surveys script",s):this.Oh(a.generateSurveys,o)}finally{this.Ih=!1}})}catch(i){throw this.Ih=!1,this.Dh("Error initializing surveys",i),i}}Oh(e,n){this.Io||(this._surveyManager=e(n),this._surveyEventReceiver=this.So.createEventReceiver(),Bl.info("Surveys loaded successfully"),this.Lh({isLoaded:!0}))}Dh(e,n){Bl.error(e,n),this.Lh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Mh.push(e),this._surveyManager&&this.Lh({isLoaded:!0}),()=>{this.Mh=this.Mh.filter(n=>n!==e)}}getSurveys(e,n=!1){var o;const i=(o=this.wo)!==null&&o!==void 0?o:this.Th;if(!i||this.Io)return;if(this.Rr.disableSurveys)return Bl.info(gst),e([]);const r=i.kv.get(VCe);if(r&&!n)return e(r,{isLoaded:!0}),void(this.Nh()&&this.getSurveys(()=>{},!0));if(this.Eh)return void this.Eh.then(({surveys:A,context:c})=>{this.Io||e(A,c)}).catch(A=>Bl.error("Error in survey callback",A));const s=this.qh("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Rr.requestTimeoutMs}).then(A=>{try{return this.jh(i,A)}catch(c){return Bl.error("Error processing surveys response",c),this.jh(i,{statusCode:0,error:c})}},A=>this.jh(i,{statusCode:0,error:A}));this.Eh=s;const a=()=>{this.Eh===s&&(this.Eh=null)};s.then(A=>{a(),this.Io||e(A.surveys,A.context)},a).catch(A=>Bl.error("Error in survey callback",A))}qh(e,n){const o=this.wo;return o?o.sendRequest(e,n):new Promise(i=>i({statusCode:0,error:new Error(_k)}))}jh(e,n){if(this.Io)return{surveys:[],context:{isLoaded:!1,error:_k}};const o=n.statusCode;if(o!==200||!n.json){const a=`Surveys API could not be loaded, status: ${o}`;return o!==0?Bl.error(a):n.error||Bl.warn(a),this.Ph=Date.now(),{surveys:[],context:{isLoaded:!1,error:a}}}this.Ph=null;const i=n.json.surveys||[],r=i.filter(a=>(function(A){return!(!A.start_date||A.end_date)})(a)&&(Vrt(a)||(function(A){var c;return!!(!((c=A.conditions)===null||c===void 0||(c=c.actions)===null||c===void 0||(c=c.values)===null||c===void 0)&&c.length)})(a)));var s;return r.length>0&&((s=this._surveyEventReceiver)===null||s===void 0||s.register(r)),e.kv.set({[VCe]:i,[rte]:Date.now()}),{surveys:i,context:{isLoaded:!0}}}Nh(){return this.Bh()&&!this.Eh&&!this.Hh()}Bh(){var e,n;const o=(e=(n=this.wo)!==null&&n!==void 0?n:this.Th)===null||e===void 0?void 0:e.kv.get(rte);return zd(o)&&Date.now()-o>3e5}Hh(){return zd(this.Ph)&&3e5>Date.now()-this.Ph}markSurveyAsSeen(e,n){var o;const i={id:e,current_iteration:(o=n?.iteration)!==null&&o!==void 0?o:null};jrt(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Lh(e){for(const n of this.Mh)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(o){Bl.error("Error in survey callback",o)}}getActiveMatchingSurveys(e,n=!1){if(!zs(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);Bl.warn("init was not called")}zh(e){let n=null;return this.getSurveys(o=>{var i;n=(i=o.find(r=>r.id===e))!==null&&i!==void 0?i:null}),n}Uh(e){if(zs(this._surveyManager))return{eligible:!1,reason:_k};const n=typeof e=="string"?this.zh(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}Wh(e){if(!this.So.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(zs(this._surveyManager))return{eligible:!1,reason:_k};const n=typeof e=="string"?this.zh(e):e;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(zs(this._surveyManager))return Bl.warn("init was not called"),{visible:!1,disabledReason:_k};const n=this.Wh(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return zs(this._surveyManager)?(Bl.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:_k})):new Promise(o=>{this.getSurveys(i=>{var r;const s=(r=i.find(a=>a.id===e))!==null&&r!==void 0?r:null;if(s){const a=this.Wh(s);o({visible:a.eligible,disabledReason:a.reason})}else o({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(e,n,o){var i;if(!this.So.isCapturing())return;if(zs(this._surveyManager))return void Bl.warn("init was not called");const r=typeof e=="string"?this.zh(e):e;if(!r?.id)return void Bl.warn("Survey not found");if(!p5n.includes(r.type))return void Bl.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const s=No?.querySelector(n);if(s){if(!((i=r.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds){Bl.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const a=setTimeout(()=>{var A,c;this.Rh.delete(a),!this.Io&&this.So.isCapturing()&&(Bl.info(`Rendering survey ${r.id} with delay of ${(A=r.appearance)===null||A===void 0?void 0:A.surveyPopupDelaySeconds} seconds`),(c=this._surveyManager)===null||c===void 0||c.renderSurvey(r,s,o),Bl.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Rh.add(a)}this._surveyManager.renderSurvey(r,s,o)}else Bl.warn("Survey element not found")}displaySurvey(e,n){var o;if(!this.So.isCapturing())return;if(zs(this._surveyManager))return void Bl.warn("init was not called");const i=this.zh(e);if(!i)return void Bl.warn("Survey not found");let r=i;if(!((o=i.appearance)===null||o===void 0)&&o.surveyPopupDelaySeconds&&n.ignoreDelay&&(r=sn(sn({},i),{},{appearance:sn(sn({},i.appearance),{},{surveyPopupDelaySeconds:0})})),n.displayType!==_ye.Popover&&n.initialResponses&&Bl.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){const s=this.Uh(i);if(!s.eligible)return void Bl.warn("Survey is not eligible to be displayed: ",s.reason)}n.displayType!==_ye.Inline?this._surveyManager.handlePopoverSurvey(r,n):this.renderSurvey(r,n.selector,n.properties)}cancelPendingSurvey(e){zs(this._surveyManager)?Bl.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.handlePageUnload)===null||n===void 0||n.call(e)}};function fk(t,e,n){if(zs(t))return!1;switch(n){case"exact":return t===e;case"contains":{const o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(o,"i").test(t)}case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}var L5n=class{constructor(e){this._instance=e,this.Vh=new Set,this.Gh=new Set,this.Zh=new fte,this.Qh=(n,o)=>this.Jh(n,o)&&this.Kh(n,o)&&this.Xh(n,o)&&this.Yh(n,o),this.Jh=(n,o)=>!o?.event||n?.event===o?.event}init(){var e,n;Bo((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.tc=(n=this._instance)===null||n===void 0?void 0:n._addCaptureHook((o,i)=>{this.on(o,i)}))}dispose(){var e;(e=this.tc)===null||e===void 0||e.call(this),this.tc=void 0,this.Zh=new fte}register(e){var n,o;if(!Bo((n=this._instance)===null||n===void 0?void 0:n._addCaptureHook)&&(e.forEach(i=>{var r;this.Vh.add(i),(r=i.steps)===null||r===void 0||r.forEach(s=>{this.Gh.add(s?.event||"")})}),(o=this._instance)===null||o===void 0?void 0:o.autocapture)){const i=new Set;this.Vh.forEach(r=>{var s;(s=r.steps)===null||s===void 0||s.forEach(a=>{a?.selector&&i.add(a.selector)})}),this._instance.autocapture.setElementSelectors(i)}}replace(e){this.Vh.clear(),this.Gh.clear(),this.register(e)}on(e,n){n!=null&&e.length!=0&&(this.Gh.has(e)||this.Gh.has(n.event))&&this.Vh.forEach(o=>{this.ec(n,o)&&this.Zh.emit("actionCaptured",o.name)})}nc(e){this.onAction("actionCaptured",n=>e(n))}ec(e,n){if(n?.steps==null)return!1;for(const o of n.steps)if(this.Qh(e,o))return!0;return!1}onAction(e,n){return this.Zh.on(e,n)}Kh(e,n){if(n?.url){var o;const i=e==null||(o=e.properties)===null||o===void 0?void 0:o.$current_url;if(!i||typeof i!="string"||!fk(i,n.url,n.url_matching||"contains"))return!1}return!0}Xh(e,n){return!!this.sc(e,n)&&!!this.rc(e,n)&&!!this.oc(e,n)}sc(e,n){var o;if(!n?.href)return!0;const i=this.ac(e);if(i.length>0)return i.some(s=>fk(s.href,n.href,n.href_matching||"exact"));const r=(e==null||(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)||"";return!!r&&fk((function(s){const a=s.match(/(?::|")href="(.*?)"/);return a?a[1]:""})(r),n.href,n.href_matching||"exact")}rc(e,n){var o;if(!n?.text)return!0;const i=this.ac(e);if(i.length>0)return i.some(c=>fk(c.text,n.text,n.text_matching||"exact")||fk(c.$el_text,n.text,n.text_matching||"exact"));const r=(e==null||(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)||"";return!!r&&(s=(function(c){const l=[],g=/(?::|")text="(.*?)"/g;let u;for(;!zs(u=g.exec(c));)l.includes(u[1])||l.push(u[1]);return l})(r),a=n.text,A=n.text_matching||"exact",s.some(c=>fk(c,a,A)));var s,a,A}oc(e,n){var o,i;if(!n?.selector)return!0;const r=e==null||(o=e.properties)===null||o===void 0?void 0:o.$element_selectors;if(r?.includes(n.selector))return!0;const s=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";if(n.selector_regex&&s)try{return new RegExp(n.selector_regex).test(s)}catch{return!1}return!1}ac(e){var n;return(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements)==null?[]:e?.properties.$elements}Yh(e,n){return!n?.properties||n.properties.length===0||Jrt(n.properties.reduce((o,i)=>{const r=rs(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return o[i.key]={values:r,operator:i.operator||"exact"},o},{}),e?.properties)}},H5n=class{constructor(e){var n,o;this.lc=[],this._instance=e,this.uc=new Map,this.hc=new Map,this.cc=new Map,this.dc=(n=this._instance)===null||n===void 0||(o=n.onSessionId)===null||o===void 0?void 0:o.call(n,i=>this.vc(i))}fc(e){return!1}gc(){return null}mc(e){}yc(){}bc(e,n){return!!e&&Jrt(e.propertyFilters,n?.properties)}_c(e,n){const o=new Map;return e.forEach(i=>{var r;(r=i.conditions)===null||r===void 0||(r=r[n])===null||r===void 0||(r=r.values)===null||r===void 0||r.forEach(s=>{if(s?.name){const a=o.get(s.name)||[];a.push(i.id),o.set(s.name,a)}})}),o}wc(e,n,o){const i=(o===DK.Activation?this.uc:this.hc).get(e);let r=[];return this.kc(s=>{r=s.filter(a=>i?.includes(a.id))}),r.filter(s=>{var a;const A=(a=s.conditions)===null||a===void 0||(a=a[o])===null||a===void 0||(a=a.values)===null||a===void 0?void 0:a.find(c=>c.name===e);return this.bc(A,n)})}register(e){this.Sc(e,!1)}replace(e){this.Sc(e,!0)}Sc(e,n){var o;Bo((o=this._instance)===null||o===void 0?void 0:o._addCaptureHook)||(this.xc(e,n),this.Cc(e,n))}Cc(e,n){const o=e.filter(s=>{var a;return(a=s.conditions)===null||a===void 0||(a=a.actions)===null||a===void 0||(a=a.values)===null||a===void 0?void 0:a.length});var i;if(n&&this.cc.clear(),o.length===0)return void(n&&((i=this.$c)===null||i===void 0||i.replace([])));this.$c||(this.$c=new L5n(this._instance),this.$c.init(),this.$c.nc(s=>this.onAction(s)));const r=[];o.forEach(s=>{var a;(a=s.conditions)===null||a===void 0||(a=a.actions)===null||a===void 0||a.values.forEach(A=>{if(r.push(A),A.name){var c;const l=(c=this.cc.get(A.name))!==null&&c!==void 0?c:[];l.includes(s.id)||l.push(s.id),this.cc.set(A.name,l)}})}),n?this.$c.replace(r):this.$c.register(r)}Tc(e,n){n.forEach((o,i)=>{var r;const s=(r=e.get(i))!==null&&r!==void 0?r:[];o.forEach(a=>{s.includes(a)||s.push(a)}),e.set(i,s)})}xc(e,n){var o,i;const r=e.filter(c=>{var l,g;return((l=c.conditions)===null||l===void 0?void 0:l.events)&&((g=c.conditions)===null||g===void 0||(g=g.events)===null||g===void 0||(g=g.values)===null||g===void 0?void 0:g.length)>0}),s=e.filter(c=>{var l,g;return((l=c.conditions)===null||l===void 0?void 0:l.cancelEvents)&&((g=c.conditions)===null||g===void 0||(g=g.cancelEvents)===null||g===void 0||(g=g.values)===null||g===void 0?void 0:g.length)>0}),a=this._c(e,DK.Activation),A=this._c(e,DK.Cancellation);n?(this.uc=a,this.hc=A):(this.Tc(this.uc,a),this.Tc(this.hc,A)),(r.length!==0||s.length!==0)&&((o=this.tc)!==null&&o!==void 0||(this.tc=(i=this._instance)===null||i===void 0?void 0:i._addCaptureHook((c,l)=>{this.onEvent(c,l)})))}onEvent(e,n){var o,i;const r=this.Ic(),s=(n==null||(o=n.properties)===null||o===void 0?void 0:o.$survey_id)||(n==null||(i=n.properties)===null||i===void 0?void 0:i.$product_tour_id);if(s&&this.getActivatedIds().includes(s)){const A=this.Mc(e,s);if(A==="consume")return r.info("event consumed activated item, removing it",{event:e,itemId:s}),void this.Ec([s]);if(A==="persist")return r.info("shown item promoted to persisted activation",{event:e,itemId:s}),this.Pc(s),void this.Rc([s])}if(this.hc.has(e)){const A=this.wc(e,n,DK.Cancellation);A.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:A.map(c=>c.id)}),this.Ec(A.map(c=>c.id)),A.forEach(c=>this.Ac(c.id)))}if(!this.uc.has(e))return;r.info("event name matched",{event:e,eventPayload:n,items:this.uc.get(e)});const a=this.wc(e,n,DK.Activation);this.Fc(a.map(A=>A.id))}onAction(e){this.cc.has(e)&&this.Fc(this.cc.get(e)||[])}Fc(e){var n,o;if(e.length===0)return;const i=!!(!((n=this._instance)===null||n===void 0||(o=n.get_session_id)===null||o===void 0)&&o.call(n)),r=[];for(const s of e)i&&this.fc(s)?this.Pc(s)&&this.Oc(s):r.push(s);r.length>0&&(this.lc=[...new Set([...this.lc,...r])]),this.Ic().info("updating activated items",{activatedItems:this.getActivatedIds()})}Pc(e){this.lc=this.lc.filter(o=>o!==e);const n=this.Dc();return!n.includes(e)&&(this.Lc([...n,e]),this.Nc(),!0)}Ec(e){const n=new Set(e);this.lc=this.lc.filter(r=>!n.has(r));const o=this.qc(),i=o.filter(r=>!n.has(r));i.length!==o.length&&(this.Lc(i),i.length===0&&this.jc()),this.Rc(e)}Bc(){var e;const n=this.gc();if(!n)return{};const o=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[n];return o&&typeof o=="object"?o:{}}Oc(e){if(!this.gc())return;const n=this.Bc();this.mc(sn(sn({},n),{},{[e]:Date.now()}))}Rc(e){if(!this.gc())return;const n=this.Bc(),o={};let i=!1;for(const[r,s]of Object.entries(n))e.includes(r)?i=!0:o[r]=s;i&&(z2(o)?this.yc():this.mc(o))}Hc(){this.gc()&&this.yc()}getActivationTimestamp(e){if(!this.Dc().includes(e))return;const n=this.Bc()[e];return zd(n)?n:void 0}qc(){var e;const n=this.zc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[n])||[]}Dc(){var e,n,o;const i=this.qc();if(i.length===0)return[];const r=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.Uc()],s=(n=this._instance)===null||n===void 0||(o=n.get_session_id)===null||o===void 0?void 0:o.call(n);return s&&r===s?i:[]}Nc(){var e,n;const o=(e=this._instance)===null||e===void 0||(n=e.get_session_id)===null||n===void 0?void 0:n.call(e);o&&this.Wc(o)}jc(){this.Vc()}vc(e){var n;const o=(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0?void 0:n.props[this.Uc()];if(o&&o!==e){const i=this.qc(),r=this.Bc();i.length>0&&(this.Lc([]),i.filter(s=>zd(r[s])).forEach(s=>this.Ac(s))),this.jc(),this.Hc()}}getActivatedIds(){return[...new Set([...this.Dc(),...this.lc])].filter(e=>!this.Gc(e))}dispose(){var e,n,o;(e=this.dc)===null||e===void 0||e.call(this),this.dc=void 0,(n=this.tc)===null||n===void 0||n.call(this),this.tc=void 0,(o=this.$c)===null||o===void 0||o.dispose(),this.$c=void 0}reset(){this.lc=[],this.qc().length>0&&this.Lc([]),this.jc(),this.Hc()}getEventToItemsMap(){return this.uc}Zc(){return this.$c}},O5n=class extends H5n{constructor(e){super(e)}zc(){return hit}Uc(){return pit}gc(){return mit}mc(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated_timestamps:e})}yc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}fc(e){var n;let o;this.kc(r=>{o=r.find(s=>s.id===e)});const i=o==null||(n=o.appearance)===null||n===void 0?void 0:n.surveyPopupDelaySeconds;return zd(i)&&i>0}Qc(){return r8.SHOWN}kc(e){var n;(n=this._instance)===null||n===void 0||n.getSurveys(e)}Ac(e){var n;(n=this._instance)===null||n===void 0||n.cancelPendingSurvey(e)}Ic(){return Bl}Lc(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated:e})}Wc(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated_session:e})}Vc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}Gc(){return!1}Mc(e,n){let o;return this.kc(i=>{o=i.find(r=>r.id===n)}),!o||(function(i){var r;return Vrt(i)&&!!(!((r=i.conditions)===null||r===void 0||(r=r.events)===null||r===void 0)&&r.repeatedActivation)||i.schedule==="always"})(o)?e===r8.SHOWN?"consume":"ignore":e===r8.SHOWN?"persist":e===r8.DISMISSED||e===r8.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},G5n=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const n={};for(const o of e){const i=this._instance.get_property(o);Bo(i)||(n[o]=i)}return n}set(e,n){this._instance.register(typeof e=="string"?{[e]:n}:e)}remove(e){typeof e!="string"?e.forEach(n=>this._instance.unregister(n)):this._instance.unregister(e)}},Y5n=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=Gr?.__PosthogExtensions__;if(!e)return;const{generateSurveys:n,loadExternalDependency:o}=e;return{generateSurveys:n?i=>n(this._instance,i):void 0,loadExternalDependency:o?i=>o(this._instance,"surveys",i):void 0}}createEventReceiver(){return new O5n(this._instance)}};const U5n=Un?.location?gte(Un.location.hash,"__posthog")||gte(location.hash,"state"):null,ust="_postHogToolbarParams",dst=id("[Toolbar]"),hst=id("[FeatureFlags]");var K5n=class{constructor(e,n=!1){this.Jc=!1,this.update(e,n)}update(e,n){this.Kc=((o,i)=>{var r,s,a,A,c,l,g,u;return{bootstrap:{featureFlags:(r=(s=o.bootstrap)===null||s===void 0?void 0:s.featureFlags)!==null&&r!==void 0?r:void 0,featureFlagPayloads:(a=(A=o.bootstrap)===null||A===void 0?void 0:A.featureFlagPayloads)!==null&&a!==void 0?a:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!o.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!o.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!o.advanced_feature_flags_dedup_per_session,cacheTtlMs:o.feature_flag_cache_ttl_ms,refreshIntervalMs:(c=o.remote_config_refresh_interval_ms)!==null&&c!==void 0?c:3e5,idleRefreshBackoff:Bo(o.remote_config_refresh_interval_ms),requestTimeoutMs:o.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(l=o.feature_flag_request_max_retries)!==null&&l!==void 0?l:1),compression:o.disable_compression?void 0:"best-available",evaluationContexts:(g=(u=o.evaluation_contexts)!==null&&u!==void 0?u:o.evaluation_environments)!==null&&g!==void 0?g:[],flagKeys:rs(o.flag_keys)?o.flag_keys:void 0}})(e,n),!e.evaluation_environments||e.evaluation_contexts||this.Jc||(hst.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Jc=!0),Bo(e.flag_keys)||rs(e.flag_keys)||hst.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Kc}};const pst=id("[FeatureFlags]"),fM=id("[FeatureFlags]",{debugEnabled:!0}),Lye=`" failed. Feature flags didn't load in time.`,V5n=[502,504],mst=["click","keydown","wheel","touchstart","pointerdown"],_st="connection_error",fst=t=>{const e={};for(let n=0;t.length>n;n++)e[t[n]]=!0;return e},Ist=t=>{const e={};for(const[n,o]of Ate(t||{}))o&&(e[n]=o);return e},Cst=t=>ZT(t)&&(t.name==="RangeError"&&t.message.indexOf("Maximum call stack size exceeded")===0||t.name==="InternalError"&&t.message==="too much recursion"),x4=id("[Error tracking]"),Hye="webkit-masked-url:",z5n=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],J5n=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Hye],W5n=["__firefox__","__gCrWeb"],yst="Refusing to render web experiment since the viewer is a likely bot",j5n={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>Ite(e,t),not_regex:(t,e)=>!Ite(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},o5=id("[Conversations]"),IM="Conversations not available yet.";function xst(t,e){var n,o,i,r,s,a,A;const c=(n=t?.flushIntervalMs)!==null&&n!==void 0?n:3e3,l=(o=t?.maxBufferSize)!==null&&o!==void 0?o:100,g=e?.consoleCapture?void 0:(i=t?.maxLogsPerInterval)!==null&&i!==void 0?i:1e3,u=Bo(g)?Math.max(l,2048):Math.max(l,g),h=sn(sn({},(function(){let d="",p="";try{const m=w_?.userAgent;m&&([d,p]=Cot(m))}catch{}return(function(m,_){const f=(function(I){if(I)return{}.hasOwnProperty.call(jot,I)?jot[I]:I})(m);return sn(sn({},f?{"os.name":f}:{}),_?{"os.version":_}:{})})(d,p)})()),t?.resourceAttributes);return{serviceName:(r=(s=h?.["service.name"])!==null&&s!==void 0?s:t?.serviceName)!==null&&r!==void 0?r:e?.serviceNameDefault,serviceVersion:(a=h?.["service.version"])!==null&&a!==void 0?a:t?.serviceVersion,environment:(A=h?.["deployment.environment"])!==null&&A!==void 0?A:t?.environment,resourceAttributes:h,beforeSend:t?.beforeSend,flushIntervalMs:c,maxBufferSize:l,maxQueueSize:u,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:g,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const q5n=["debug","log","warn","error","info"],X5n=t=>{for(;t?.__rrweb_original__;)t=t.__rrweb_original__;return t},Est="console",Bst="__posthogHandledLogsRequestError",Oye=(t,e)=>{const n=t instanceof Error?t:new Error(e);return n[Bst]=!0,n},Sst=t=>!!t&&typeof t=="object"&&t[Bst]===!0,xte=id("[NetworkMetrics]"),Gye=()=>{var t;return!(Un==null||(t=Un.performance)===null||t===void 0)&&t.now?Un.performance.now():Date.now()},$5n={"http:":80,"https:":443},Z5n=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),bst=(t,e)=>{var n;const o=String(e);return{method:String(t).toUpperCase(),url:((n=Wb(o))===null||n===void 0?void 0:n.href)||o}},Yye=(t,e,n,o,i,r,s=!1)=>{try{var a,A;const c=i();if(!c)return;const l=n||void 0,g=Gye()-o,u=Wb(e.url);if(u&&u.protocol!=="http:"&&u.protocol!=="https:")return;const h={url:u?.href||e.url,method:e.method},d=M_(c.name)?c.name(h):eA(c.name)?c.name:"http.client.request.duration";if(!d)return;const p=s&&!l?void 0:((_,f)=>_?400>_?void 0:String(_):f?.name||"_OTHER")(l,r),m=sn(sn(sn(sn(sn({},(_=>{const f=Z5n.has(_)?_:"_OTHER";return sn({"http.request.method":f},f==="_OTHER"&&_!==f?{"http.request.method_original":_}:{})})(h.method)),u?(_=>{return{"server.address":_.hostname.startsWith("[")&&_.hostname.endsWith("]")?_.hostname.slice(1,-1):_.hostname,"server.port":Number(_.port)||$5n[_.protocol],"url.scheme":_.protocol.slice(0,-1),"url.template":(f=_.pathname,f.split("/").map(I=>(C=>/^\d+$/.test(C)||C.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(C))(I)?":id":I).join("/"))};var f})(u):{}),l?{"http.response.status_code":l}:{}),p?{"error.type":p}:{}),(a=c.attributes)===null||a===void 0?void 0:a.call(c,h,{status:l,durationMs:g}));(A=t.metrics)===null||A===void 0||A.histogram(d,g,{unit:"ms",attributes:m})}catch(c){xte.error("Failed to record network metric",c)}},Qst=()=>{},e4n=(t,e)=>M_(Un?.fetch)?UK(Un,"fetch",n=>function(...o){const i=Gye(),r=n.apply(this,o);if(!e())return r;try{var s,a,A;const[c,l]=o,g=bst((s=(a=l?.method)!==null&&a!==void 0?a:c?.method)!==null&&s!==void 0?s:"GET",(A=c?.url)!==null&&A!==void 0?A:c);return r.then(u=>(Yye(t,g,u?.status,i,e,void 0,!0),u),u=>{throw Yye(t,g,void 0,i,e,u),u})}catch(c){return xte.error("Failed to observe fetch",c),r}}):Qst,t4n=(t,e)=>{var n;const o=Un==null||(n=Un.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!o)return Qst;const i=new WeakMap,r=UK(o,"open",a=>function(...A){try{vrt.has(this)||i.set(this,bst(A[0],A[1]))}catch(c){xte.error("Failed to observe XHR open",c)}return a.apply(this,A)}),s=UK(o,"send",a=>function(...A){let c;try{const l=i.get(this);if(l&&e()){const g=Gye();c=()=>{this.removeEventListener("loadend",c),Yye(t,l,this.status,g,e)},dl(this,"loadend",c)}}catch(l){xte.error("Failed to observe XHR send",l)}try{return a.apply(this,A)}catch(l){throw c&&this.removeEventListener("loadend",c),l}});return()=>{r(),s()}},Ete={featureFlags:class{constructor(t){this.name="featureFlags",this.Xc=!1,this.featureFlagEventHandlers=[],this.$=pst,this.Yc={},this.td={},this.ed=[],this.nd=!1,this.sd=!1,this.rd=0,this.od=!1,this.ad=!1,this.ld=!1,this.ud=!1,this.hd=0,this.dd=!1,this.an=()=>{const e=this.vd();this.hd=0,e&&this.reloadFeatureFlags()},this.fd=()=>{var e,n;const o=this.pd,i=(e=this.gd)!==null&&e!==void 0?e:o;Bo(o)||Bo(i)||this.Rr.remoteRequestsDisabled||!No||No.visibilityState==="hidden"||Date.now()-((n=this.md)!==null&&n!==void 0?n:0)<i||(this.gd=this.dd||!this.Rr.idleRefreshBackoff?o:Math.min(2*i,36e5),this.dd=!1,this.reloadFeatureFlags(),this.yd())},this.bd=()=>{this.dd&&this.gd===this.pd||this._d()},this.ln=()=>{No?.visibilityState==="visible"&&this._d()},"get"in t?this.So=t:(this._instance=t,this.wd=new K5n(t.config,t.nl()),this.So=this.wd)}updateConfig(t,e){var n;(n=this.wd)===null||n===void 0||n.update(t,e),this.wo&&this.kd()}setup(t){return this.Fh=t,this.$=t.logger.createLogger("[FeatureFlags]"),lst(t.kv.initialize(),()=>{this.Fh===t&&(this.Fh=void 0,this.wo=t,this.Sd(t))})}Sd(t){var e;if(this.wo===t)return Un&&dl(Un,"online",this.an),this.kd(),this.xd=t.registerDynamicEventProperties(()=>this.Cd()?this.Yc:this.td),this.$d=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.onCrossTabFeatureFlagChange(()=>{this.Td(),this.Id(),this.Md()}),this.Id(),this.initialize()}_d(){this.dd=!0,this.gd=this.pd,this.fd()}kd(){const t=this.Rr.refreshIntervalMs,e=!this.Rr.remoteRequestsDisabled&&No&&!Bo(t)&&t>0?t:void 0;this.Rr.idleRefreshBackoff||(this.gd=e),e!==this.pd&&(this.Ed(),Bo(e)||(this.pd=e,this.gd=e,this.yd(),No?.addEventListener&&(dl(No,yK,this.ln),rk(mst,n=>{dl(No,n,this.bd,{capture:!0})}))))}yd(){Bo(this.pd)||(Bo(this.Pd)||clearInterval(this.Pd),this.md=Date.now(),this.Pd=setInterval(this.fd,this.pd))}Ed(){var t;Bo(this.Pd)||(clearInterval(this.Pd),this.Pd=void 0,No==null||(t=No.removeEventListener)===null||t===void 0||t.call(No,"visibilitychange",this.ln),rk(mst,e=>{var n;No==null||(n=No.removeEventListener)===null||n===void 0||n.call(No,e,this.bd,{capture:!0})})),this.pd=void 0,this.gd=void 0,this.dd=!1,this.md=void 0}destroy(){this.Rd()}dispose(){this.Rd()}Rd(){var t,e;this.Ed(),this.rd++,this.ad=!1,this.Fh=void 0,this.wo&&(this.Ad(),(t=this.xd)===null||t===void 0||t.dispose(),this.xd=void 0,(e=this.$d)===null||e===void 0||e.call(this),this.$d=void 0,this.ed=[],Un?.removeEventListener("online",this.an),this.wo=void 0)}get Rr(){return this.So.get()}Fd(t){var e;return this.Od&&t in this.Od?this.Od[t]:(e=this.wo)===null||e===void 0?void 0:e.kv.get(t)}Td(){return!!this.Od&&(this.Od=void 0,!0)}Dd(){var t;return!Bo((t=this.wo)===null||t===void 0?void 0:t.kv.get("$enabled_feature_flags"))&&this.Td()}At(t){this.Ld(()=>{var e;return(e=this.wo)===null||e===void 0?void 0:e.kv.set(t)})}Nd(t,e,n){var o;if(!(!((o=this._instance)===null||o===void 0)&&o.persistence)||!t.$enabled_feature_flags)return;const i=this.Fd("$enabled_feature_flags")||{},r=t.$enabled_feature_flags||{},s=e.flags||e.featureFlags,a=e.flags?Object.entries(e.flags).filter(([,_])=>!_?.failed).map(([_])=>_):[],A=!!e.errorsWhileComputingFlags&&!!e.flags,c=A?a:n&&!rs(s)?Object.keys(s||{}):Array.from(new Set([...Object.keys(i),...Object.keys(r)])),l=this.Fd("$feature_flag_payloads")||{},g=t.$feature_flag_payloads||{},u=A||n?c:Array.from(new Set([...Object.keys(l),...Object.keys(g)])),h=!A&&!n,d=!!h||c,p=!!h||u,m={[n8]:d,[C4]:d,[Ub]:p};t.$feature_flag_details&&(m[gM]=d);for(const _ of[uM,Jb,fK])Bo(t[_])||(m[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(m)}Lt(t){this.Ld(()=>{var e;return(e=this.wo)===null||e===void 0?void 0:e.kv.remove(t)})}Ld(t){try{t()}catch(e){this.$.error("Failed to update feature flag persistence",e)}}Id(){const t={};for(const o of[n8,Ub,uM,a9]){const i=this.Fd(o);Bo(i)||(t[o]=i)}this.Yc=t;const e=sn({},t),n=this.Fd(C4);if(n)for(const[o,i]of Object.entries(n))e[`$feature/${o}`]=i;this.td=e}Cd(){const t=this.Rr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.Fd(Jb);return typeof e!="number"||Date.now()-e>t}qd(){return!!this.Cd()&&(this.ud||this.sd||(this.ud=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}jd(){const t=this.Rr.evaluationContexts;return t?.length?t.filter(e=>{const n=e&&typeof e=="string"&&e.trim().length>0;return n||this.$.error("Invalid evaluation context found:",e,"Expected non-empty string"),n}):[]}Bd(){const t=this.Rr.flagKeys;if(!Bo(t))return t.filter(e=>{const n=e&&typeof e=="string"&&e.trim().length>0;return n||this.$.error("Invalid flag key found:",e,"Expected non-empty string"),n})}initialize(){var t,e;const n=this.Rr,o=(t=(e=n.bootstrap)===null||e===void 0?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(o).length){var i,r;const s=(i=(r=n.bootstrap)===null||r===void 0?void 0:r.featureFlagPayloads)!==null&&i!==void 0?i:{},a=Object.keys(o).filter(c=>!Bo(o[c])).reduce((c,l)=>(c[l]=o[l],c),{}),A=Object.keys(s).filter(c=>a[c]).reduce((c,l)=>(c[l]=s[l],c),{});return this.Hd({featureFlags:a,featureFlagPayloads:A},void 0,{persist:!1})}}updateFlags(t,e,n){var o,i;const r=n?.merge&&(o=this.Fd("$enabled_feature_flags"))!==null&&o!==void 0?o:{},s=n?.merge&&(i=this.Fd("$feature_flag_payloads"))!==null&&i!==void 0?i:{},a=sn(sn({},r),t),A=sn(sn({},s),e),c={};for(const[l,g]of Object.entries(a))c[l]={key:l,enabled:Hot(g),variant:Oot(g),reason:void 0,metadata:Bo(A?.[l])?void 0:{id:0,version:void 0,description:void 0,payload:A[l]}};this.Hd({flags:c})}get hasLoadedFlags(){return this.nd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.Fd(gM),e=this.Fd(a9),n=this.Fd(dM);if(!n&&!e)return t||{};const o=Cg({},t||{}),i=[...new Set([...Object.keys(n||{}),...Object.keys(e||{})])];for(const a of i){var r;const A=o[a],c=e?.[a],l=Bo(c)?(r=A?.enabled)!==null&&r!==void 0&&r:!!c,g=Bo(c)?A?.variant:typeof c=="string"?c:void 0,u=n?.[a],h=sn(sn({},A),{},{enabled:l,variant:l?g??A?.variant:void 0});var s;l!==A?.enabled&&(h.original_enabled=A?.enabled),g!==A?.variant&&(h.original_variant=A?.variant),u&&(h.metadata=sn(sn({},A?.metadata),{},{payload:u,original_payload:A==null||(s=A.metadata)===null||s===void 0?void 0:s.payload})),o[a]=h}return this.Xc||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:o}),this.Xc=!0),o}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(n=>{const o=t[n];return{key:n,enabled:Hot(o),variant:Oot(o),payload:Lot(e[n])}})}getFlagVariants(){const t=this.Fd(C4),e=this.Fd(a9);if(!e)return t||{};const n=Cg({},t||{}),o=Object.keys(e);for(let i=0;o.length>i;i++)n[o[i]]=e[o[i]];return this.Xc||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.Xc=!0),n}getFlagPayloads(){const t=this.Fd(Ub),e=this.Fd(dM);if(!e)return t||{};const n=Cg({},t||{}),o=Object.keys(e);for(let i=0;o.length>i;i++)n[o[i]]=e[o[i]];return this.Xc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.Xc=!0),n}reloadFeatureFlags(){this.od||this.Rr.featureFlagsDisabled||this.vd()||(this.sd&&(this.ad=!0),this.zd||(this.ed.slice().forEach(t=>{try{t()}catch(e){this.$.error("Error while running feature flags reloading callback",e)}}),this.zd=setTimeout(()=>{this.Ud()},5)))}Ad(){clearTimeout(this.zd),this.zd=void 0}onReloading(t){return this.ed.push(t),()=>{this.ed=this.ed.filter(e=>e!==t)}}ensureFlagsLoaded(){this.nd||this.sd||this.zd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.od=t}resetFlagCallReported(){this.Lt(zb)}Ud(t){this.Ad();const e=this.wo;if(!e||this.Rr.remoteRequestsDisabled||this.vd())return;if(this.sd)return void(this.ad=!0);const n={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:sn(sn(sn({},e.initialPersonProperties),this.Fd("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Fd(Vb),timezone:urt()};Bo(e.deviceId)||(n.$device_id=e.deviceId),(t?.disableFlags||this.Rr.featureFlagsDisabled)&&(n.disable_flags=!0);const o=this.jd();o.length&&(n.evaluation_contexts=o);const i=this.Bd();Bo(i)||(n.flag_keys=i);const r=this.Rr.onlyEvaluateSurveyFeatureFlags,s="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),a=this.rd;this.sd=!0;const A=()=>{this.ad&&(this.ad=!1,this.Ud())},c=d=>{var p,m;const _=(p=d.json)!==null&&p!==void 0?p:{},f=d.statusCode!==200;if(this.sd=!1,a!==this.rd)return void A();if(this.Wd(d.statusCode),f||this.ad||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.ad)return;this.ld=!f;const I=[];d.error?I.push(d.error instanceof Error&&d.error.name==="AbortError"?"timeout":d.error instanceof Error?_st:"unknown_error"):d.statusCode!==200&&I.push(`api_error_${d.statusCode}`),_.errorsWhileComputingFlags&&I.push("errors_while_computing_flags");const C=!!(!((m=_.quotaLimited)===null||m===void 0)&&m.includes("feature_flags"));C&&I.push("quota_limited"),this.At({[CK]:I}),C?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."):n.disable_flags||this.Hd(_,f,{partialResponse:r}),A()},l=d=>{this.sd=!1,a===this.rd&&(this.At({[CK]:[_st]}),this.$.error("Feature flag request failed",d),this.Dd()&&this.Md(!0)),A()};let g=this.Rr.requestMaxRetries;const u=()=>g>0&&a===this.rd,h=()=>{if(a!==this.rd||!this.wo||this.Rr.remoteRequestsDisabled)return this.sd=!1,void A();try{e.sendRequest(s,{target:"flags",method:"POST",body:n,compression:this.Rr.compression,sentAt:"body",timeoutMs:this.Rr.requestTimeoutMs}).then(d=>{if((p=>V5n.includes(p.statusCode)||(m=>m.statusCode===0&&m.error instanceof Error&&m.error.name==="AbortError")(p))(d)&&u())return g--,void setTimeout(h,500);c(d)}).catch(l)}catch(d){l(d)}};h()}vd(){return ort(this.hd,3)}Wd(t){this.hd=irt(t,this.hd,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(t,e={}){var n;if(e.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+Lye);if(this.qd())return;const o=this.getFeatureFlagResult(t,e);return(n=o?.variant)!==null&&n!==void 0?n:o?.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const e=this.getFeatureFlagResult(t,{send_event:!1});return e?.payload}getFeatureFlagResult(t,e={}){if(e.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+Lye);if(this.qd())return;const n=this.getFlagVariants(),o=t in n,i=n[t],r=this.getFlagPayloads()[t],s=String(i),a=this.Fd("$feature_flag_request_id")||void 0,A=this.Fd("$feature_flag_evaluated_at")||void 0;let c,l=this.Fd("$flag_call_reported")||{};if(this.Rr.deduplicateCallsPerSession){var g;const b=(g=this.wo)===null||g===void 0?void 0:g.session.sessionId,Q=this.Fd(IK);b&&b!==Q&&(l={},c=b)}if(e.send_event||!("send_event"in e))if(t in l&&l[t].includes(s))c&&this.At({[zb]:l,[IK]:c});else{var u,h,d,p,m,_,f,I,C,y,x,E;rs(l[t])?l[t].push(s):l[t]=[s],this.At(sn({[zb]:l},c?{[IK]:c}:{}));const b=this.getFeatureFlagDetails(t),Q=[...(u=this.Fd("$feature_flag_errors"))!==null&&u!==void 0?u:[]];Bo(i)&&Q.push("flag_missing");const w={$feature_flag:t,$feature_flag_response:i,$feature_flag_payload:r??null,$feature_flag_request_id:a,$feature_flag_evaluated_at:A,$feature_flag_bootstrapped_response:(h=(d=this.Rr.bootstrap)===null||d===void 0||(d=d.featureFlags)===null||d===void 0?void 0:d[t])!==null&&h!==void 0?h:null,$feature_flag_bootstrapped_payload:(p=(m=this.Rr.bootstrap)===null||m===void 0||(m=m.featureFlagPayloads)===null||m===void 0?void 0:m[t])!==null&&p!==void 0?p:null,$used_bootstrap_value:!this.ld};Bo(b==null||(_=b.metadata)===null||_===void 0?void 0:_.has_experiment)||(w.$feature_flag_has_experiment=b.metadata.has_experiment),Bo(b==null||(f=b.metadata)===null||f===void 0?void 0:f.version)||(w.$feature_flag_version=b.metadata.version);const M=(I=b==null||(C=b.reason)===null||C===void 0?void 0:C.description)!==null&&I!==void 0?I:b==null||(y=b.reason)===null||y===void 0?void 0:y.code;var B;M&&(w.$feature_flag_reason=M),!(b==null||(x=b.metadata)===null||x===void 0)&&x.id&&(w.$feature_flag_id=b.metadata.id),Bo(b?.original_variant)&&Bo(b?.original_enabled)||(w.$feature_flag_original_response=Bo(b.original_variant)?b.original_enabled:b.original_variant),!(b==null||(E=b.metadata)===null||E===void 0)&&E.original_payload&&(w.$feature_flag_original_payload=b==null||(B=b.metadata)===null||B===void 0?void 0:B.original_payload),Q.length&&(w.$feature_flag_error=Q.join(",")),this.Vd(w)}else c&&this.At({[zb]:l,[IK]:c});return o?{key:t,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:Lot(r)}:void 0}Vd(t){try{var e;(e=this.wo)===null||e===void 0||e.capture("$feature_flag_called",t)}catch(n){this.$.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(t,e){this.Gd(t,e)}Gd(t,e){var n=this;return Vg(function*(){const o=n.wo;if(!o)return;const i={distinct_id:o.distinctId,token:o.projectToken,person_properties:{$lib:o.library.name,$lib_version:o.library.version}},r=n.jd();r.length&&(i.evaluation_contexts=r);const s=n.Bd();let a;Bo(s)||(i.flag_keys=s);try{var A;const c=(A=(yield o.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:i,compression:n.Rr.compression,sentAt:"body",timeoutMs:n.Rr.requestTimeoutMs})).json)===null||A===void 0?void 0:A.featureFlagPayloads;a=c?.[t]||void 0}catch(c){return void n.$.error("Remote config feature flag request failed",c)}try{e(a)}catch(c){n.$.error("Remote config feature flag callback failed",c)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.ld)return e.defaultValue;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+Lye),e.defaultValue;const n=this.getFeatureFlag(t,e);return Bo(n)?e.defaultValue:!!n}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,n){this.Hd(t,e,n)}Hd(t,e,n){if(!this.wo)return;this.nd=!0;const o=((i,r={},s={},a={},A,c=pst)=>{const l=((I,C)=>{const y=I.flags;if(y){const x=Object.fromEntries(Object.keys(y).map(B=>{var b;return[B,(b=y[B].variant)!==null&&b!==void 0?b:y[B].enabled]})),E=Object.fromEntries(Object.keys(y).filter(B=>y[B].enabled).filter(B=>{var b;return!Bo((b=y[B].metadata)===null||b===void 0?void 0:b.payload)}).map(B=>{var b;return[B,(b=y[B].metadata)===null||b===void 0?void 0:b.payload]}));return sn(sn({},I),{},{featureFlags:x,featureFlagPayloads:E})}return I.featureFlags&&C.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),I})(i,c),g=l.flags,u=l.featureFlags,h=l.featureFlagPayloads;if(!u)return;const d=i.requestId,p=i.evaluatedAt;if(rs(u)){c.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const I={};if(u)for(let C=0;u.length>C;C++)I[u[C]]=!0;return{[n8]:u,[C4]:I,[fK]:!1}}let m=u,_=h,f=g;if(A?.partialResponse){const I=Object.keys(m),C=_||{};m=sn(sn({},r),m),_=sn(sn({},s),C),I.forEach(y=>{y in C||_==null||delete _[y]}),f=sn(sn({},a),f)}else if(i.errorsWhileComputingFlags)if(g){const I=new Set(Object.keys(g).filter(y=>{var x;return!(!((x=g[y])===null||x===void 0)&&x.failed)}));m=sn(sn({},r),Object.fromEntries(Object.entries(m).filter(([y])=>I.has(y))));const C=Object.fromEntries(Object.entries(_||{}).filter(([y])=>I.has(y)));_=sn(sn({},s),C),I.forEach(y=>{y in C||_==null||delete _[y]}),f=sn(sn({},a),Object.fromEntries(Object.entries(f||{}).filter(([y])=>I.has(y))))}else m=sn(sn({},r),m),_=sn(sn({},s),_),f=sn(sn({},a),f);return sn(sn({[n8]:Object.keys(Ist(m)),[C4]:m||{},[Ub]:_||{},[gM]:f||{},[fK]:i.minimalFlagCalledEvents===!0},d?{[uM]:d}:{}),p?{[Jb]:p}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.$);if(o)if(n?.persist===!1){const i=!Bo(this.wo.kv.get(C4));this.Od=o,i||this.At(o)}else this.Td(),this.Nd(o,t,!!n?.partialResponse),this.At(o);else e&&this.Dd();e||(this.ud=!1),this.Md(e)}override(t,e=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Zd(t)}Zd(t){if(this.wo){if(t===!1)return this.Lt([a9,dM]),this.Md(),void fM.info("All overrides cleared");if(rs(t))return this.At({[a9]:fst(t)}),this.Md(),void fM.info("Flag overrides set",{flags:t});if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var e;const n=t;this.Xc=!!((e=n.suppressWarning)!==null&&e!==void 0&&e);const o={},i=n.flags,r=n.payloads;return i&&(o[a9]=rs(i)?fst(i):i),r&&(o[dM]=r),Object.keys(o).length&&this.At(o),i===!1&&r===!1?this.Lt([a9,dM]):i===!1?this.Lt(a9):r===!1&&this.Lt(dM),this.Md(),i===!1?fM.info("Flag overrides cleared"):i&&fM.info("Flag overrides set",{flags:i}),void(r===!1?fM.info("Payload overrides cleared"):r&&fM.info("Payload overrides set",{payloads:r}))}if(t&&typeof t=="object")return this.At({[a9]:t}),this.Md(),void fM.info("Flag overrides set",{flags:t});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.nd){const{flags:e,flagVariants:n}=this.Qd();try{t(e,n)}catch(o){this.$.error("Error while running feature flags callback",o)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var o;const i=(this.Fd("$early_access_features")||[]).find(c=>c.flagKey===t),r={[`$feature_enrollment/${t}`]:e},s={$feature_flag:t,$feature_enrollment:e,$set:r};i&&(s.$early_access_feature_name=i.name),n&&(s.$feature_enrollment_stage=n);const a=sn(sn({},this.getFlagVariants()),{},{[t]:e});(o=this._instance)===null||o===void 0||(o=o.persistence)===null||o===void 0||o.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.At({[n8]:Object.keys(Ist(a)),[C4]:a,[Kb]:sn(sn({},this.Fd("$stored_person_properties")||{}),r)}),this.Md();try{var A;(A=this.wo)===null||A===void 0||A.capture("$feature_enrollment_update",s)}catch(c){this.$.error("Failed to capture early access feature enrollment",c)}}getEarlyAccessFeatures(t,e=!1,n){const o=this.Fd(KCe);!o||e?this.Jd(t,n):t(o)}Jd(t,e){var n=this;return Vg(function*(){const o=n.wo;if(!o)return;const i=e?`&${e.map(s=>`stage=${s}`).join("&")}`:"";let r;try{const s=yield o.sendRequest(`/api/early_access_features/?token=${o.projectToken}${i}`,{target:"api",method:"GET",sentAt:"query"});if(!s.json)return;r=s.json.earlyAccessFeatures,n.At({[KCe]:r})}catch(s){return void n.$.error("Early access feature request failed",s)}try{t(r)}catch(s){n.$.error("Early access feature callback failed",s)}})()}Qd(){const t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(n=>e[n]),flagVariants:Object.keys(e).filter(n=>e[n]).reduce((n,o)=>(n[o]=e[o],n),{})}}Md(t){this.Id();const{flags:e,flagVariants:n}=this.Qd();this.featureFlagEventHandlers.forEach(o=>{try{o(e,n,{errorsLoading:t})}catch(i){this.$.error("Error while running feature flags callback",i)}})}setPersonPropertiesForFlags(t,e=!0){this.Kd(t,e)}Kd(t,e=!0){const n=this.Fd("$stored_person_properties")||{},o=t?.$set||(t?.$set_once?{}:t),i=t?.$set_once,r={};if(i)for(const s in i)({}).hasOwnProperty.call(i,s)&&(s in n||(r[s]=i[s]));this.At({[Kb]:sn(sn(sn({},n),r),o)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const n=sn({},this.Fd("$stored_person_properties")||{});t.forEach(o=>{delete n[o]}),this.At({[Kb]:n}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(Kb),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const n=this.Fd("$stored_group_properties")||{},o=sn({},n);for(const i of Object.keys(t))o[i]=sn(sn({},n[i]),t[i]);this.At({[Vb]:o}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.Fd("$stored_group_properties")||{};this.At({[Vb]:sn(sn({},e),{},{[t]:{}})})}else this.Lt(Vb)}reset(){this.rd++,this.ad=!1,this.Yc={},this.td={},this.Od=void 0,this.nd=!1,this.od=!1,this.ld=!1,this.$anon_distinct_id=void 0,this.Ad(),this.Xc=!1,this.hd=0}}},n4n={sessionRecording:class{get Rr(){return this._instance.config}get Ml(){return this._instance.persistence}get started(){var t;return!!(!((t=this.Xd)===null||t===void 0)&&t.isStarted)}get status(){var t,e;return this.Yd==="awaiting_config"||this.Yd==="missing_config"?this.Yd:(t=(e=this.Xd)===null||e===void 0?void 0:e.status)!==null&&t!==void 0?t:this.Yd}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.Yd=Tye,this.tv=void 0,this.ev=!1,this.Xe=(()=>{var e,n;if(!No?.visibilityState||No.visibilityState==="visible")return!0;const o=Un==null||(e=Un.performance)===null||e===void 0||(n=e.getEntriesByType)===null||n===void 0?void 0:n.call(e,"visibility-state");return!o?.length||o.some(i=>i.name==="visible")})(),this.ln=()=>{var e,n;No?.visibilityState==="visible"&&(this.Xe=!0,(e=this.Xd)===null||e===void 0||(n=e.setDocumentWasEverVisible)===null||n===void 0||n.call(e,!0))},!this._instance.sessionManager)throw a8.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Rr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');No?.addEventListener&&dl(No,"visibilitychange",this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.ev=!0,No==null||(e=No.removeEventListener)===null||e===void 0||e.call(No,"visibilitychange",this.ln),t?this.iv(!0):this.stopRecording()}get nv(){var t;const e=!!(!((t=this._instance.get_property("$session_recording_remote_config"))===null||t===void 0)&&t.enabled),n=!this.Rr.disable_session_recording,o=this.Rr.disable_session_recording||this._instance.consent.isOptedOut();return Un&&e&&n&&!o}startIfEnabledOrStop(t){var e;if(this.ev||this.nv&&(!((e=this.Xd)===null||e===void 0)&&e.isStarted))return;const n=!Bo(Object.assign)&&!Bo(Array.from);this.nv&&n?(this.sv(t),a8.info("starting")):(this.Yd=Tye,this.stopRecording())}sv(t){var e,n;if(this.nv)if(this.Yd!=="awaiting_config"&&this.Yd!=="missing_config"&&(this.Yd=Ast),(Gr==null||(e=Gr.__PosthogExtensions__)===null||e===void 0||(e=e.rrweb)===null||e===void 0?void 0:e.record)&&((n=Gr.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording))this.rv(t);else{var o,i;const r=this._instance.sessionManager;(o=Gr.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,this.ov,s=>{if(!this.ev&&this.nv&&this._instance.sessionManager===r)return s?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),a8.error("could not load recorder",s)):void this.rv(t);this.Yd="disabled"})}}stopRecording(){var t,e;(t=this.tv)===null||t===void 0||t.call(this),this.tv=void 0,(e=this.Xd)===null||e===void 0||e.stop()}iv(t=!1){var e,n;(e=this.tv)===null||e===void 0||e.call(this),this.tv=void 0,(n=this.Xd)===null||n===void 0||n.discard({discardProducerEvents:t})}av(){var t,e;(t=this.Ml)===null||t===void 0||t.unregister("$session_is_sampled"),(e=this.Ml)===null||e===void 0||e.unregister("$replay_sample_rate")}lv(t,e){if(zs(t))return null;const n=zd(t)?t:parseFloat(t);return typeof(o=n)!="number"||!Number.isFinite(o)||0>o||o>1?(a8.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):n;var o}uv(t){if(this.Ml){var e,n;const o=this.Ml,i=()=>{var r;const s=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.lv((r=this.Rr.session_recording)===null||r===void 0?void 0:r.sampleRate,"session_recording.sampleRate"),A=this.lv(s?.sampleRate,"remote config sampleRate"),c=a??A;zs(c)&&this.av();const l=s?.minimumDurationMilliseconds;o.register({[_K]:sn(sn({cache_timestamp:Date.now(),enabled:!!s},s),{},{networkPayloadCapture:sn({capturePerformance:t.capturePerformance},s?.networkPayloadCapture),canvasRecording:{enabled:s?.recordCanvas,fps:s?.canvasFps,quality:s?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:Bo(l)?null:l,endpoint:s?.endpoint,triggerMatchType:s?.triggerMatchType,masking:s?.masking,urlTriggers:s?.urlTriggers,version:s?.version,triggerGroups:s?.triggerGroups})})};i(),(e=this.tv)===null||e===void 0||e.call(this),this.tv=(n=this._instance.sessionManager)===null||n===void 0?void 0:n.onSessionId(i)}}onRemoteConfig(t){const e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?e.sessionRecording===!1?(this.uv(e),void this.iv()):(this.uv(e),void this.startIfEnabledOrStop()):(this.Yd==="awaiting_config"&&(this.Yd="missing_config",this._instance.register_for_session({[Eit]:!0}),a8.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var n;!((n=this.Xd)===null||n===void 0)&&n.log?this.Xd.log(t,e):a8.warn("log called before recorder was ready")}get ov(){var t,e;const n=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.get_property(_K);return(n==null||(e=n.scriptConfig)===null||e===void 0?void 0:e.script)||"lazy-recorder"}hv(){const t=this._instance.get_property(_K);if(!t)return!1;let e;try{e=typeof t=="object"?t:JSON.parse(t)}catch(n){return a8.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!zs(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}rv(t){var e,n,o;if(!this.ev&&this.nv&&this._instance.sessionManager){if(!(!((e=Gr.__PosthogExtensions__)===null||e===void 0)&&e.initSessionRecording))return a8.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[xit]:!0});var i;if(this.Xd||(this.Xd=(i=Gr.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording(this._instance,this.Xe),this.Xd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.hv())return this.Yd==="missing_config"||this.Yd==="awaiting_config"?void 0:(this.Yd="awaiting_config",a8.info("persisted remote config is stale, requesting fresh config before starting"),void new frt(this._instance).load());this.Yd=Ast,(n=(o=this.Xd).setDocumentWasEverVisible)===null||n===void 0||n.call(o,this.Xe),this.Xd.start(t)}else this.Yd=Tye}onRRwebEmit(t){var e,n;(e=this.Xd)===null||e===void 0||(n=e.onRRwebEmit)===null||n===void 0||n.call(e,t)}overrideLinkedFlag(){var t,e;this.Xd||(e=this.Ml)===null||e===void 0||e.register({$replay_override_linked_flag:!0}),(t=this.Xd)===null||t===void 0||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Xd||(e=this.Ml)===null||e===void 0||e.register({$replay_override_sampling:!0}),(t=this.Xd)===null||t===void 0||t.overrideSampling()}overrideTrigger(t){var e,n;this.Xd||(n=this.Ml)===null||n===void 0||n.register({[t==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.Xd)===null||e===void 0||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.Xd)===null||t===void 0?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!!(!((n=this.Xd)===null||n===void 0)&&n.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;(t=this.Xd)===null||t===void 0||(e=t.flushBeforeIdentityReset)===null||e===void 0||e.call(t)}}},o4n={autocapture:class extends w5n{constructor(t){super(new M5n(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.dv=this.vv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.fv();return!!(t.path||t.search||this.pv(t))}startIfEnabled(){this.isEnabled&&(gi.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.dv=this.vv(),this.startIfEnabled()}stop(){this.gv&&this.gv(),this.gv=void 0,this.mv&&this.mv(),this.mv=void 0,gi.info("History API monitoring stopped")}monitorHistoryChanges(){Un&&Un.history&&(this.yv("pushState"),this.yv("replaceState"),this.bv(),this.pv()&&this._v())}yv(t){var e;if(!Un||!((e=Un.history[t])===null||e===void 0)&&e.__posthog_wrapped__)return;const n=this;UK(Un.history,t,o=>function(i,r,s){o.call(this,i,r,s),n.wv(t)})}vv(){const t=Un?.location;if(t?.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}fv(){const t=this._instance.config.capture_pageview;return t==="history_change"?{path:!0}:CA(t)?t:{}}pv(t=this.fv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Sv(t){const e=this.fv(),n=this.dv;return!(!n||!(e.path&&t.pathname!==n.pathname||e.search&&t.search!==n.search||this.pv(e)&&t.hash!==n.hash))}wv(t){try{const e=this.vv();if(!e)return;this.Sv(e)&&this._instance.capture(XCe,{navigation_type:t}),this.dv=e}catch(e){gi.error(`Error capturing ${t} pageview`,e)}}bv(){if(this.gv)return;const t=()=>{this.wv("popstate")};dl(Un,"popstate",t),this.gv=()=>{Un&&Un.removeEventListener("popstate",t)}}_v(){if(this.mv)return;const t=()=>{this.wv("hashchange")};dl(Un,"hashchange",t),this.mv=()=>{Un&&Un.removeEventListener("hashchange",t)}}},heatmaps:class{get Rr(){return this.instance.config}constructor(t){var e;this.xv=!1,this.xo=!1,this.Cv=null,this.instance=t,this.xv=!!(!((e=this.instance.persistence)===null||e===void 0)&&e.props[LCe]),this.rageclicks=new ost(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return CA(this.Rr.capture_heatmaps)&&this.Rr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Rr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return zs(this.Rr.capture_heatmaps)?zs(this.Rr.enable_heatmaps)?this.xv:this.Rr.enable_heatmaps:this.Rr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.xo)return;T5n.info("starting..."),this.$v(),this.ln()}else{var t;clearInterval((t=this.Cv)!==null&&t!==void 0?t:void 0),this.Tv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("heatmaps"in e))return;const n=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[LCe]:n}),this.xv=n,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Iv(t){kye(t.originalEvent)&&this.Tr(t.originalEvent,"deadclick")}ln(){this.Cv&&clearInterval(this.Cv),this.Cv=No?.visibilityState==="visible"?setInterval(this.bl.bind(this),this.flushIntervalMilliseconds):null}$v(){Un&&No&&(this.Mv=this.bl.bind(this),dl(Un,ate,this.Mv),this.Ev=t=>this.Tr(t||Un?.event),dl(No,"click",this.Ev,{capture:!0}),this.Pv=t=>this.Rv(t||Un?.event),dl(No,"mousemove",this.Pv,{capture:!0}),this.Av=new $it(this.instance,LEn,this.Iv.bind(this)),this.Av.startIfEnabledOrStop(),this.Fv=this.ln.bind(this),dl(No,yK,this.Fv),this.xo=!0)}Tv(){var t;Un&&No&&(this.Mv&&Un.removeEventListener(ate,this.Mv),this.Ev&&No.removeEventListener("click",this.Ev,{capture:!0}),this.Pv&&No.removeEventListener("mousemove",this.Pv,{capture:!0}),this.Fv&&No.removeEventListener(yK,this.Fv),clearTimeout(this.Ov),(t=this.Av)===null||t===void 0||t.stop(),this.xo=!1)}Dv(t,e){const n=this.instance.scrollManager.scrollY(),o=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),r=(function(s,a,A){let c=s;for(;c&&A9(c)&&!H1(c,"body");){if(c===A)return!1;let h;try{var l,g,u;h=(l=(g=(u=c.ownerDocument)===null||u===void 0?void 0:u.defaultView)!==null&&g!==void 0?g:Un)===null||l===void 0?void 0:l.getComputedStyle(c).position}catch{return!1}if(ms(a,h))return!0;c=Hit(c)}return!1})(SK(t),["fixed","sticky"],i);return{x:t.clientX+(r?0:o),y:t.clientY+(r?0:n),target_fixed:r,type:e}}Tr(t,e="click"){var n;if(Tit(t.target)||!kye(t))return;const o=this.Dv(t,e);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&Uit(SK(t),this.instance.config.rageclick)&&this.Zs(sn(sn({},o),{},{type:"rageclick"})),this.Zs(o)}Rv(t){!Tit(t.target)&&kye(t)&&(clearTimeout(this.Ov),this.Ov=setTimeout(()=>{this.Zs(this.Dv(t,"mousemove"))},500))}Zs(t){if(!Un)return;const e=this.Rr.disable_capture_url_hashes?Yb(Un.location.href):Un.location.href,n=this.Rr.custom_personal_data_properties,o=this.Rr.mask_personal_data_properties?[...uk,...n||[]]:[],i=wK(e,o,MK);this.Rt=this.Rt||{},this.Rt[i]||(this.Rt[i]=[]),this.Rt[i].push(t)}bl(){this.Rt&&!z2(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:$it,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.xv=!1,this.xo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Lv=()=>{clearTimeout(this.Nv),this.Nv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",sn({$current_url:this.Rt.url},this.Rt.metrics.reduce((n,o)=>sn(sn({},n),{},{[`$web_vitals_${o.name}_event`]:sn({},o),[`$web_vitals_${o.name}_value`]:o.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.qv=n=>{var o;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},zs(n?.name)||zs(n?.value))return void _M.error("Invalid metric received",n);const i=typeof n.navigationURL=="string"?n.navigationURL:void 0,r=this.jv(i);if(Bo(r))return;const s=zd(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${r}`;if(this.Bv&&n.value>=this.Bv)return void _M.error("Ignoring metric with value >= "+this.Bv,n);this.Rt.navigationKey!==s&&(this.Lv(),this.Nv=setTimeout(this.Lv,this.flushToCaptureTimeoutMs)),Bo(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=r),this.Rt.firstMetricTimestamp=Bo(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(o=this._instance.sessionManager)===null||o===void 0?void 0:o.checkAndGetSessionAndWindowId(!0),A=sn(sn(sn({},n),i?{navigationURL:r}:{}),{},{$current_url:r,timestamp:Date.now()});if(delete A.entries,CA(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){const c={};for(const l of R5n){const g=l==="url"&&typeof n.attribution[l]=="string"?this.jv(n.attribution[l]):n.attribution[l];Bo(g)||(c[l]=g)}A.attribution=c}else delete A.attribution;Bo(a)||(A.$session_id=a.sessionId,A.$window_id=a.windowId),this.Rt.metrics.push(A),this.Rt.metrics.length===this.allowedMetrics.length&&this.Lv()},this.Hv=()=>{if(this.xo)return;let n,o,i,r,s=!1;const a=Gr.__PosthogExtensions__,A=a?.postHogWebVitalsCallbacksByFlavor,c=A?.[this.zv]||(this.zv==="web-vitals"&&Bo(A)?a?.postHogWebVitalsCallbacks:void 0);if(!Bo(c)){const u=c.withoutAttribution,h=this.attributionMetrics;s=!Bo(u),n=h.indexOf("LCP")>-1?c.onLCP:u?.onLCP||c.onLCP,o=h.indexOf("CLS")>-1?c.onCLS:u?.onCLS||c.onCLS,i=h.indexOf("FCP")>-1?c.onFCP:u?.onFCP||c.onFCP,r=h.indexOf("INP")>-1?c.onINP:u?.onINP||c.onINP}if(!(n&&o&&i&&r))return void _M.error("web vitals callbacks not loaded - not starting");const l={reportSoftNavs:this.useSoftNavs},g=s&&this.attributionMetrics.indexOf("INP")>-1?sn(sn({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&n(this.qv.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&o(this.qv.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.qv.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&r(this.qv.bind(this),g),this.xo=!0},this.xv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[GCe]),this.startIfEnabled()}get Uv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const n=CA(this.Uv)?(t=this.Uv)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return zs(n)?((e=this._instance.persistence)===null||e===void 0?void 0:e.props.$web_vitals_allowed_metrics)||ast:n}get flushToCaptureTimeoutMs(){return(CA(this.Uv)?this.Uv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=CA(this.Uv)?this.Uv.web_vitals_attribution:void 0;return ry(t)?t?ast:[]:rs(t)?t:N5n}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=CA(this.Uv)?this.Uv.__preview_web_vitals_soft_navs:void 0;return t!=null&&t}get Bv(){const t=CA(this.Uv)&&zd(this.Uv.__web_vitals_max_value)?this.Uv.__web_vitals_max_value:sst;return t>0&&6e4>=t?sst:t}get isEnabled(){const t=nd?.protocol;if(t!=="http:"&&t!=="https:")return _M.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=CA(this.Uv)?this.Uv.web_vitals:ry(this.Uv)?this.Uv:void 0;return ry(e)?e:this.xv}startIfEnabled(){this.isEnabled&&!this.xo&&(_M.info("enabled, starting..."),this.zo(this.Hv))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const n=CA(e.capturePerformance)&&!!e.capturePerformance.web_vitals,o=CA(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[GCe]:n}),this._instance.persistence.register({[git]:o})),this.xv=n,this.startIfEnabled()}get zv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(t){var e;const n=Gr.__PosthogExtensions__,o=this.zv,i=n?.postHogWebVitalsCallbacksByFlavor;i?.[o]||o==="web-vitals"&&Bo(i)&&n?.postHogWebVitalsCallbacks?t():n==null||(e=n.loadExternalDependency)===null||e===void 0||e.call(n,this._instance,o,r=>{r?_M.error("failed to load script",r):t()})}jv(t){const e=t||Un?.location.href;if(!e)return void _M.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?Yb(e):e,o=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...uk,...o||[]]:[];return wK(n,i,MK)}}},i4n={exceptionObserver:class{constructor(t){var e;this.Hv=()=>{var n;if(!Un||!this.isEnabled||!(!((n=Gr.__PosthogExtensions__)===null||n===void 0)&&n.errorWrappingFunctions))return;const o=Gr.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Gr.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=Gr.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Wv&&this.Rr.capture_unhandled_errors&&(this.Wv=o(this.captureException.bind(this))),!this.Vv&&this.Rr.capture_unhandled_rejections&&(this.Vv=i(this.captureException.bind(this))),!this.Gv&&this.Rr.capture_console_errors&&(this.Gv=r(this.captureException.bind(this)))}catch(s){YK.error("failed to start",s),this.Zv()}},this._instance=t,this.Qv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[HCe]),this.wt=new Xxn(sn(sn({},(function(n={}){var o,i,r,s;return{refillRate:(o=(i=n.exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:n.__exceptionRateLimiterRefillRate)!==null&&o!==void 0?o:1,bucketSize:(r=(s=n.exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:n.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:YK})),this.Rr=this.Jv(),this.startIfEnabledOrStop()}Jv(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return CA(t)?e=sn(sn({},e),t):(Bo(t)?this.Qv:t)&&(e=sn(sn({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Rr.capture_console_errors||this.Rr.capture_unhandled_errors||this.Rr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(YK.info("enabled"),this.Zv(),this.zo(this.Hv)):this.Zv()}zo(t){var e,n,o;!((e=Gr.__PosthogExtensions__)===null||e===void 0)&&e.errorWrappingFunctions?t():(n=Gr.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"exception-autocapture",i=>{if(i)return YK.error("failed to load script",i);t()})}Zv(){var t,e,n;(t=this.Wv)===null||t===void 0||t.call(this),this.Wv=void 0,(e=this.Vv)===null||e===void 0||e.call(this),this.Vv=void 0,(n=this.Gv)===null||n===void 0||n.call(this),this.Gv=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.Qv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[HCe]:this.Qv}),this.Rr=this.Jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Rr=this.Jv()}captureException(t){try{var e,n,o;const i=(e=t==null||(n=t.$exception_list)===null||n===void 0||(n=n[0])===null||n===void 0?void 0:n.type)!==null&&e!==void 0?e:"Exception";if(this.wt.consumeRateLimit(i))return void YK.info("Skipping exception capture because of client rate limiting.",{exception:i});(o=this._instance.exceptions)===null||o===void 0||o.sendExceptionEvent(t)}catch{}}},exceptions:class{constructor(t){var e,n;this.Kv=[],this.Xv=new c3n([new B3n,new N3n,new b3n,new S3n,new M3n,new w3n,new v3n,new D3n],(function(o,...i){return(r,s=0)=>{const a=[],A=r.split(`
|
|
241
241
|
`),c=Math.min(A.length,s+1e3),l=[];for(let h=s;c>h;h++){const d=A[h];if(d.length>1024)continue;const p=Rot.test(d)?d.replace(Rot,"$1"):d;if(!p.match(/\S*Error: /)){for(const m of i){const _=m(p,o);if(_){a.push(_);const f=C3n(a);if(f){for(let I=l.length-1;I>=0;I--){const C=l[I];if(f.start>=C.start+C.length)break;l.pop()}l.push(f)}break}}if(x3n(a,l)>=50)break}}const g=[...l].sort((h,d)=>d.start-h.start),u=g[g.length-1];if(u){const h=Tot(a,u);a.splice(u.start-h,h);for(const d of g)d.start-=h}for(const h of g)y3n(a,h);return l.some(h=>h.start===0&&a.length===h.length)&&(function(h){const d=h.map(m=>`${m.function}|${m.filename}|${m.lineno}|${m.colno}|${m.module}`);let p=0;for(let m=1;d.length>m;m++)E3n(d,m,p)&&(p=m);h.push(...h.splice(0,p))})(a),(function(h){if(!h.length)return[];const d=Array.from(h);return d.reverse(),d.slice(0,50).map(p=>{return sn(sn({},p),{},{filename:p.filename||(m=d,m[m.length-1]||{}).filename,function:p.function||"?"});var m})})(a)}})("web:javascript",m3n,I3n)),this._instance=t,this.Kv=(e=(n=this._instance.persistence)===null||n===void 0?void 0:n.get_property("$error_tracking_suppression_rules"))!==null&&e!==void 0?e:[],this.Yv=ete(this.tf()),this.ef=new T3n(this.Yv)}onConfigChange(){this.Yv=ete(this.tf()),this.ef.setConfig(this.Yv)}onRemoteConfig(t){var e,n,o;if(!t.ok)return;const i=t.config;if(!("errorTracking"in i))return;const r=(e=(n=i.errorTracking)===null||n===void 0?void 0:n.suppressionRules)!==null&&e!==void 0?e:[],s=(o=i.errorTracking)===null||o===void 0?void 0:o.captureExtensionExceptions;this.Kv=r,this._instance.persistence&&this._instance.persistence.register({[cit]:this.Kv,[OCe]:s})}get if(){var t;const e=!!this._instance.get_property(OCe),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.Xv.buildFromUnknown(t,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(t,e){if(this.Yv.enabled)try{if(!eA(t)||t.trim().length===0)return void x4.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:n,droppedKeys:o}=(function(i){if(!i)return{sanitizedProperties:{},droppedKeys:[]};const r=[];return{sanitizedProperties:Object.keys(i).reduce((s,a)=>R3n.has(a)?(r.push(a),s):(s[a]=i[a],s),{}),droppedKeys:r}})(this.nf(e));o.length>0&&x4.warn("Ignoring reserved exception step fields",{droppedKeys:o}),this.ef.add(sn({[$ee]:t,[Zee]:new Date().toISOString()},n))}catch(n){x4.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.sf(e)){if(this.rf(e))return this.af("Exception dropped: matched a suppression rule"),void x4.info("Skipping exception capture because a suppression rule matched");if(!this.if&&this.lf(e))return this.af("Exception dropped: thrown by a browser extension"),void x4.info("Skipping exception capture because it was thrown by an extension");if(!this.if&&this.uf(e))return this.af("Exception dropped: thrown by an injected browser script"),void x4.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.hf(e))return this.af("Exception dropped: thrown by the PostHog SDK"),void x4.info("Skipping exception capture because it was thrown by the PostHog SDK")}const n=this.Yv.enabled&&zs(t.$exception_steps)?this.cf(t):t,o=(function(){const i=globalThis._posthogReleaseId;return typeof i=="string"&&i.length>0?i:void 0})();o&&(n.$release_id=o);try{const i=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",fh:!0});return i&&this.ef.clear(),i}catch(i){return Cst(i)||x4.error("Failed to capture exception event. Dropping this exception.",i),void this.ef.clear()}}catch(e){return void(Cst(e)||x4.error("Failed to process exception event. Ignoring this exception.",e))}}cf(t){try{const e=this.ef.getAttachable();return e.length===0?t:sn(sn({},t),{},{$exception_steps:e})}catch(e){return x4.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}af(t){this.Yv.enabled&&this.ef.add({[$ee]:t,[Zee]:new Date().toISOString()})}nf(t){return CA(t)?sn({},t):{}}tf(){var t,e;return(t=(e=this._instance.config.error_tracking)===null||e===void 0?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}rf(t){if(t.length===0)return!1;try{const e=t.reduce((n,{type:o,value:i})=>(eA(o)&&o.length>0&&n.$exception_types.push(o),eA(i)&&i.length>0&&n.$exception_values.push(i),n),{$exception_types:[],$exception_values:[]});return this.Kv.some(n=>{const o=n.values.map(i=>{const r=zrt[i.operator],s=e[i.key];if(!r||!s)return!1;const a=rs(i.value)?i.value:[i.value];return a.length>0&&r(a,s)});return n.type==="OR"?o.some(Boolean):o.every(Boolean)})}catch(e){return x4.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}lf(t){const e=t.flatMap(o=>{var i,r;return(i=(r=o.stacktrace)===null||r===void 0?void 0:r.frames)!==null&&i!==void 0?i:[]}),n=e.filter(({filename:o})=>!!o&&J5n.some(i=>o.startsWith(i)));return n.length!==0&&(!n.every(({filename:o})=>!!o&&o.startsWith(Hye))||t.some(({type:o,value:i})=>o==="NoResponse"||eA(i)&&z5n.some(({value:r,exact:s})=>s?i===r:i.includes(r)))&&!e.some(({in_app:o,filename:i})=>o&&!i?.startsWith(Hye)))}uf(t){return t.some(({value:e})=>eA(e)&&W5n.some(n=>e.includes(n)))}hf(t){if(t.length>0){var e,n,o,i;const r=(e=(n=t[0].stacktrace)===null||n===void 0?void 0:n.frames)!==null&&e!==void 0?e:[],s=r[r.length-1];return(o=s==null||(i=s.filename)===null||i===void 0?void 0:i.includes("posthog.com/static"))!==null&&o!==void 0&&o}return!1}sf(t){return!zs(t)&&rs(t)}}},r4n=sn({productTours:class{get Ml(){return this._instance.persistence}constructor(t){this.df=null,this.vf=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if("productTours"in e){var n,o;if(this.Ml&&this.Ml.register({[UCe]:!!e.productTours}),!Fye(this._instance))return!this.df&&zs((n=this.Ml)===null||n===void 0?void 0:n.props.ph_product_tours)||yte.info("product tours disabled; stopping and clearing cached tours"),(o=this.df)===null||o===void 0||o.stop(),this.df=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.df&&Fye(this._instance)&&this.zo(()=>this.ff())}zo(t){var e,n,o;!((e=Gr.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours?t():(n=Gr.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"product-tours",i=>{i?yte.error("Could not load product tours script",i):t()})}ff(){var t;!this.df&&(!((t=Gr.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours)&&(this.df=Gr.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(rs(this.vf)&&!e)return void t(this.vf,{isLoaded:!0});const n=this.Ml;if(n){const o=n.props[zCe];if(rs(o)&&!e)return this.vf=o,void t(o,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:o=>{if(!Fye(this._instance))return void t([],{isLoaded:!0});const i=o.statusCode;if(i!==200||!o.json){const s=`Product Tours API could not be loaded, status: ${i}`;return i===0?o.error||yte.warn(s):yte.error(s),void t([],{isLoaded:!1,error:s})}const r=rs(o.json.product_tours)?o.json.product_tours:[];this.vf=r,n&&n.register({[zCe]:r}),t(r,{isLoaded:!0})}})}getActiveProductTours(t){zs(this.df)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.df.getActiveProductTours(t)}showProductTour(t){var e;(e=this.df)===null||e===void 0||e.showTourById(t)}previewTour(t){this.df?this.df.previewTour(t):this.zo(()=>{var e;this.ff(),(e=this.df)===null||e===void 0||e.previewTour(t)})}dismissProductTour(){var t;(t=this.df)===null||t===void 0||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.df)===null||t===void 0||t.nextStep()}previousStep(){var t;(t=this.df)===null||t===void 0||t.previousStep()}clearCache(){var t;this.vf=null,(t=this.Ml)===null||t===void 0||t.unregister("ph_product_tours")}resetTour(t){var e;(e=this.df)===null||e===void 0||e.resetTour(t)}resetAllTours(){var t;(t=this.df)===null||t===void 0||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.df)===null||e===void 0||e.cancelPendingTour(t)}}},Ete),s4n={siteApps:class{constructor(t){this._instance=t,this.pf=0,this.gf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}mf(t,e){if(!e)return;const n=this.globalsForEvent(e);this.gf.push(n),this.gf.length>1e3&&(this.gf=this.gf.slice(10))}get siteAppLoaders(){var t;return(t=Gr._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(t=t[this._instance.config.token])===null||t===void 0?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.mf.bind(this));this.yf=()=>{t(),this.gf=[],this.yf=void 0}}}globalsForEvent(t){var e,n,o,i,r,s,a;if(!t)throw new Error("Event payload is required");const A={},c=this._instance.get_property("$groups")||[],l=this._instance.get_property("$stored_group_properties")||{};for(const[h,d]of Object.entries(l))A[h]={id:c[h],type:h,properties:d};const{$set_once:g,$set:u}=t;return{event:sn(sn({},Vot(t,k5n)),{},{properties:sn(sn(sn({},t.properties),u?{$set:sn(sn({},(e=(n=t.properties)===null||n===void 0?void 0:n.$set)!==null&&e!==void 0?e:{}),u)}:{}),g?{$set_once:sn(sn({},(o=(i=t.properties)===null||i===void 0?void 0:i.$set_once)!==null&&o!==void 0?o:{}),g)}:{}),elements_chain:(r=(s=t.properties)===null||s===void 0?void 0:s.$elements_chain)!==null&&r!==void 0?r:"",distinct_id:(a=t.properties)===null||a===void 0?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:A}}bf(t){var e;const n=(e=t.tagName)===null||e===void 0?void 0:e.toLowerCase();return n==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(c9.error("prepare_external_dependency_stylesheet returned null"),null):n==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(c9.error("prepare_external_dependency_script returned null"),null):t}_f(){var t,e,n,o,i,r,s,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const A=No?.defaultView,c=A==null||(t=A.Node)===null||t===void 0?void 0:t.prototype;if(!A||!c)return()=>{};if(this.pf++,this.wf)return this.kf();const l=[],g=this,u=new WeakSet,h=(m,_,f)=>{if(!m?.[_])return;const I=m[_];m[_]=f(I),l.push(()=>{m[_]=I})},d=m=>{if(u.has(m))return m;const _=g.bf(m);return _&&u.add(_),_},p=m=>m.map(_=>typeof _=="string"?_:d(_)).filter(_=>!od(_));return h(c,"appendChild",m=>function(_){const f=d(_);return f?m.call(this,f):_}),h(c,"insertBefore",m=>function(_,f){const I=d(_);return I?m.call(this,I,f):_}),h(c,"replaceChild",m=>function(_,f){const I=d(_);return I?m.call(this,I,f):f}),[(e=A.Element)===null||e===void 0?void 0:e.prototype,(n=A.Document)===null||n===void 0?void 0:n.prototype,(o=A.DocumentFragment)===null||o===void 0?void 0:o.prototype].forEach(m=>{h(m,"append",_=>function(...f){return _.apply(this,p(f))}),h(m,"prepend",_=>function(...f){return _.apply(this,p(f))})}),[(i=A.Element)===null||i===void 0?void 0:i.prototype,(r=A.CharacterData)===null||r===void 0?void 0:r.prototype,(s=A.DocumentType)===null||s===void 0?void 0:s.prototype].forEach(m=>{h(m,"before",_=>function(...f){return _.apply(this,p(f))}),h(m,"after",_=>function(...f){return _.apply(this,p(f))}),h(m,"replaceWith",_=>function(...f){const I=p(f);return f.length&&!I.length?void 0:_.apply(this,I)})}),h((a=A.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",m=>function(_,f){const I=d(f);return I?m.call(this,_,I):null}),this.wf=()=>{l.forEach(m=>m()),this.wf=void 0},this.kf()}kf(){let t=!1;return()=>{var e;t||(t=!0,this.pf--,this.pf===0&&((e=this.wf)===null||e===void 0||e.call(this)))}}Sf(t,e=!0){const n=this._f();try{const o=t(n);return e&&n(),o}catch(o){throw n(),o}}setupSiteApp(t){const e=this.apps[t.id],n=()=>{var r;!e.errored&&this.gf.length&&(c9.info(`Processing ${this.gf.length} events for site app with id ${t.id}`),this.gf.forEach(s=>this.Sf(()=>{var a;return(a=e.processEvent)===null||a===void 0?void 0:a.call(e,s)})),e.processedBuffer=!0),Object.values(this.apps).every(s=>s.processedBuffer||s.errored)&&((r=this.yf)===null||r===void 0||r.call(this))};let o=!1;const i=r=>{e.errored=!r,e.loaded=!0,c9.info(`Site app with id ${t.id} ${r?"loaded":"errored"}`),o&&n()};try{const{processEvent:r}=this.Sf(s=>t.init({posthog:this._instance,callback(a){s(),i(a)}}),!1);r&&(e.processEvent=r),o=!0}catch(r){c9.error(cst+t.id,r),i(!1)}if(o&&e.loaded)try{n()}catch(r){c9.error(`Error while processing buffered events PostHog app with config id ${t.id}`,r),e.errored=!0}}xf(){const t=this.siteAppLoaders||[];for(const e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(const e of t)this.setupSiteApp(e)}Cf(t){if(Object.keys(this.apps).length===0)return;const e=this.globalsForEvent(t);for(const n of Object.values(this.apps))try{this.Sf(()=>{var o;return(o=n.processEvent)===null||o===void 0?void 0:o.call(n,e)})}catch(o){c9.error(`Error while processing event ${t.event} for site app ${n.id}`,o)}}onRemoteConfig(t){var e,n,o;if(!((e=this.siteAppLoaders)===null||e===void 0)&&e.length)return this.isEnabled?(this.xf(),void this._instance.on("eventCaptured",a=>this.Cf(a))):void c9.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.yf)===null||n===void 0||n.call(this),!t.ok)return;const i=t.config;if(!((o=i.siteApps)===null||o===void 0)&&o.length)if(this.isEnabled)for(const{id:a,url:A}of i.siteApps){var r,s;Gr[`__$$ph_site_app_${a}`]=this._instance,(r=Gr.__PosthogExtensions__)===null||r===void 0||(s=r.loadSiteApp)===null||s===void 0||s.call(r,this._instance,A,c=>{if(c)return c9.error(cst+a,c)})}else c9.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},a4n={tracingHeaders:class{constructor(t){this._instance=t,this.$f=void 0,this.Tf=void 0,this.If=void 0,this.Hv=()=>{const e=this.Mf();var n,o;e?(Bo(this.$f)&&(this.$f=(n=Gr.__PosthogExtensions__)===null||n===void 0||(n=n.tracingHeadersPatchFns)===null||n===void 0?void 0:n._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Bo(this.Tf)&&(this.Tf=(o=Gr.__PosthogExtensions__)===null||o===void 0||(o=o.tracingHeadersPatchFns)===null||o===void 0?void 0:o._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Zv()}}initialize(){this.startIfEnabledOrStop()}zo(t){var e,n,o;!((e=Gr.__PosthogExtensions__)===null||e===void 0)&&e.tracingHeadersPatchFns?t():(n=Gr.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"tracing-headers",i=>{if(i)return D5n.error("failed to load script",i);t()})}Ef(){var t,e;return(t=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&t!==void 0?t:this._instance.config.__add_tracing_headers}Mf(){const t=this.Ef();return rs(t)?(rs(this.If)?this.If.splice(0,this.If.length,...t):this.If=[...t],t.length>0?this.If:void 0):(rs(this.If)&&this.If.splice(0),this.If=t||void 0,this.If)}Zv(){var t,e;(t=this.$f)===null||t===void 0||t.call(this),(e=this.Tf)===null||e===void 0||e.call(this),this.$f=void 0,this.Tf=void 0}startIfEnabledOrStop(){this.Mf()?this.zo(this.Hv):this.Zv()}}},A4n=sn({surveys:class extends F5n{constructor(t){var e;super(new Y5n(t),(e=t,{get projectToken(){return e.config.token},kv:new G5n(e)})),this._instance=t}qh(t,e){const n=e.query?kK(t,e.query):t;return new Promise(o=>{var i;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor((i=e.target)!==null&&i!==void 0?i:"api",n),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:o})})}}},Ete),c4n={toolbar:class{constructor(t){this.instance=t}Pf(t){Gr.ph_toolbar_state=t}Rf(){var t;return(t=Gr.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,e=void 0,n=void 0){var o,i;if(ZCe(this.instance.config)||!Un||!No)return!1;t=(o=t)!==null&&o!==void 0?o:Un.location,n=(i=n)!==null&&i!==void 0?i:Un.history;try{if(!e){try{Un.localStorage.setItem("test","test"),Un.localStorage.removeItem("test")}catch{return!1}e=Un?.localStorage}const r=U5n||gte(t.hash,"__posthog")||gte(t.hash,"state");let s;const a=r?Qot(()=>JSON.parse(atob(decodeURIComponent(r))))||Qot(()=>JSON.parse(decodeURIComponent(r))):null;return a&&a.action==="ph_authorize"?(s=a,s.source="url",s&&Object.keys(s).length>0&&(a.desiredHash?t.hash=a.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):(s=JSON.parse(e.getItem(ust)||"{}"),s.source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}Af(t){const e=Gr.ph_load_toolbar||Gr.ph_load_editor;!zs(e)&&M_(e)?e(t,this.instance):dst.warn("No toolbar load function found")}loadToolbar(t){const e=!!No?.getElementById("__POSTHOG_TOOLBAR__");if(!Un||e)return!1;const n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,o=sn(sn({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(Un.localStorage.setItem(ust,JSON.stringify(sn(sn({},o),{},{source:void 0}))),this.Rf()===2)this.Af(o);else if(this.Rf()===0){var i,r;this.Pf(1),(i=Gr.__PosthogExtensions__)===null||i===void 0||(r=i.loadExternalDependency)===null||r===void 0||r.call(i,this.instance,"toolbar",s=>{if(s)return dst.error("[Toolbar] Failed to load",s),void this.Pf(0);this.Pf(2),this.Af(o)}),dl(Un,"turbolinks:load",()=>{this.Pf(0),this.loadToolbar(o)})}return!0}Ff(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,n=void 0){return this.maybeLoadToolbar(t,e,n)}}},l4n=sn({experiments:class K2{get Rr(){return this._instance.config}constructor(e){this._instance=e,this.getWebExperimentsAndEvaluateDisplayLogic=(n=!1)=>{this.getWebExperiments(o=>{K2.Of("retrieved web experiments from the server"),this.Df=new Map,o.forEach(i=>{if(i.feature_flag_key){var r;this.Df&&(K2.Of("setting flag key ",i.feature_flag_key," to web experiment ",i),(r=this.Df)===null||r===void 0||r.set(i.feature_flag_key,i));const s=this._instance.getFeatureFlag(i.feature_flag_key);eA(s)&&i.variants[s]&&this.Lf(i.name,s,i.variants[s].transforms)}else if(i.variants)for(const s in i.variants){const a=i.variants[s];K2.Nf(a,this._instance)&&this.Lf(i.name,s,a.transforms)}})},n)},this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}initialize(){}onFeatureFlags(e){if(this._is_bot())K2.Of(yst);else if(!this.Rr.disable_web_experiments){if(zs(this.Df))return this.Df=new Map,this.loadIfEnabled(),void this.previewWebExperiment();K2.Of("applying feature flags",e),e.forEach(n=>{var o;if(this.Df&&(!((o=this.Df)===null||o===void 0)&&o.has(n))){var i;const r=this._instance.getFeatureFlag(n),s=(i=this.Df)===null||i===void 0?void 0:i.get(n);r&&s?.variants[r]&&this.Lf(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){const e=K2.getWindowLocation();if(e?.search){const n=gk(e?.search,"__experiment_id"),o=gk(e?.search,"__experiment_variant");n&&o&&(K2.Of(`previewing web experiments ${n} && ${o}`),this.getWebExperiments(i=>{this.qf(parseInt(n),o,i)},!1,!0))}}loadIfEnabled(){this.Rr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,o){if(this.Rr.disable_web_experiments&&!o)return e([]);const i=this._instance.get_property("$web_experiments");if(i&&!n)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Rr.token}`),method:"GET",timestampMode:"query",callback:r=>e(r.statusCode===200&&r.json&&r.json.experiments||[])})}qf(e,n,o){const i=o.filter(r=>r.id===e);i&&i.length>0&&(K2.Of(`Previewing web experiment [${i[0].name}] with variant [${n}]`),this.Lf(i[0].name,n,i[0].variants[n].transforms))}static Nf(e,n){return!zs(e.conditions)&&K2.jf(e,n)&&K2.Bf(e)}static jf(e,n){var o;if(zs(e.conditions)||zs((o=e.conditions)===null||o===void 0?void 0:o.url))return!0;const i=K2.getWindowLocation();if(i){var r,s,a;const A=Rit(n,i.href);return!(!((r=e.conditions)===null||r===void 0)&&r.url)||j5n[(s=(a=e.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,A)}return!1}static getWindowLocation(){return Un?.location}static Bf(e){var n;if(zs(e.conditions)||zs((n=e.conditions)===null||n===void 0?void 0:n.utm))return!0;const o=rrt();if(o.utm_source){var i,r,s,a,A,c,l,g;const u=!(!((i=e.conditions)===null||i===void 0||(i=i.utm)===null||i===void 0)&&i.utm_campaign)||((r=e.conditions)===null||r===void 0||(r=r.utm)===null||r===void 0?void 0:r.utm_campaign)==o.utm_campaign,h=!(!((s=e.conditions)===null||s===void 0||(s=s.utm)===null||s===void 0)&&s.utm_source)||((a=e.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0?void 0:a.utm_source)==o.utm_source,d=!(!((A=e.conditions)===null||A===void 0||(A=A.utm)===null||A===void 0)&&A.utm_medium)||((c=e.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0?void 0:c.utm_medium)==o.utm_medium,p=!(!((l=e.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0)&&l.utm_term)||((g=e.conditions)===null||g===void 0||(g=g.utm)===null||g===void 0?void 0:g.utm_term)==o.utm_term;return u&&d&&p&&h}return!1}static Of(e,...n){gi.info(`[WebExperiments] ${e}`,n)}Lf(e,n,o){this._is_bot()?K2.Of(yst):n!=="control"?o.forEach(i=>{if(i.selector){var r;K2.Of(`applying transform of variant ${n} for experiment ${e} `,i);const s=(r=document)===null||r===void 0?void 0:r.querySelectorAll(i.selector);s?.forEach(a=>{const A=a;i.html&&(A.innerHTML=i.html),i.css&&A.setAttribute("style",i.css)})}}):K2.Of("Control variants leave the page unmodified.")}_is_bot(){return w_&&this._instance?Urt(w_,this.Rr.custom_blocked_useragents):void 0}}},Ete),g4n={conversations:class{constructor(t){this._instance=t,this.Hf=void 0,this._conversationsManager=null,this.zf=!1,this.ne=null,this.Uf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations||(this.Wf=t.ok,!t.ok))return;const e=t.config.conversations;zs(e)||(ry(e)?this.Hf=e:(this.Hf=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;(t=this._conversationsManager)===null||t===void 0||t.reset(),this._conversationsManager=null,this.Hf=void 0,this.ne=null,this.Wf=void 0,this.Uf=!1}loadIfEnabled(){if(this._conversationsManager||this.zf||this._instance.config.disable_conversations||ZCe(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=Gr?.__PosthogExtensions__;if(t&&!Bo(this.Hf)&&this.Hf)if(this.ne&&this.ne.token){this.zf=!0;try{const e=t.initConversations;if(e)return this.Vf(e),void(this.zf=!1);const n=t.loadExternalDependency;if(!n)return void this.Gf(qCe);n(this._instance,"conversations",o=>{o||!t.initConversations?this.Gf("Could not load conversations script",o):this.Vf(t.initConversations),this.zf=!1})}catch(e){this.Gf("Error initializing conversations",e),this.zf=!1}}else o5.error("Conversations enabled but missing token in remote config.")}Vf(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.Uf=!1,o5.info("Conversations loaded successfully")}catch(e){this.Gf("Error completing conversations initialization",e)}else o5.error("Cannot complete initialization: remote config is null")}Gf(t,e){o5.error(t,e),this._conversationsManager=null,this.zf=!1,this.Uf=!0}show(){this._conversationsManager?this._conversationsManager.show():o5.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Hf===!0&&!od(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":ZCe(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Wf===!1?"remote_config_failed":Bo(this.Hf)?this.Wf?"disabled_in_project":"remote_config_pending":this.Hf?zs(this.ne)||!this.ne.token?"missing_token":Gr?.__PosthogExtensions__?this.zf?"initializing":this.Uf?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return(t=(e=this._conversationsManager)===null||e===void 0?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,n){var o=this;return Vg(function*(){return o._conversationsManager?o._conversationsManager.sendMessage(t,e,n):(o5.warn(IM),null)})()}getMessages(t,e){var n=this;return Vg(function*(){return n._conversationsManager?n._conversationsManager.getMessages(t,e):(o5.warn(IM),null)})()}markAsRead(t){var e=this;return Vg(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(o5.warn(IM),null)})()}getTickets(t){var e=this;return Vg(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(o5.warn(IM),null)})()}requestRestoreLink(t){var e=this;return Vg(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(o5.warn(IM),null)})()}restoreFromToken(t){var e=this;return Vg(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(o5.warn(IM),null)})()}restoreFromUrlToken(){var t=this;return Vg(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(o5.warn(IM),null)})()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)===null||e===void 0?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)===null||e===void 0?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}Sh(){var t;(t=this._conversationsManager)===null||t===void 0||t.setIdentity()}xh(){var t;(t=this._conversationsManager)===null||t===void 0||t.clearIdentity()}}},u4n={logs:class{constructor(t){var e;this._instance=t,this.name="logs",this.Zf=!1,this.Qf=!1,this.Jf=!1,this.$=id("[logs]"),this.Kf=sn(sn({},this.$),{},{error:(...n)=>{n.some(Sst)||this.$.error(...n)}}),this.al=[],this.Xf=[],this.hd=0,this.Io=!1,this.Yf=[],this.tp=[],this.ep=!1,this.np=!1,this.sp=()=>{var n,o;this.Io||(this.hd=0,(n=this.rp)===null||n===void 0||n.onReconnect(),(o=this.op)===null||o===void 0||o.onReconnect())},this._instance&&(!((e=this._instance.config.logs)===null||e===void 0)&&e.captureConsoleLogs)&&(this.Zf=!0),Un&&dl(Un,"online",this.sp)}ap(t,e,n,o){var i;const r=xst((i=this._instance)===null||i===void 0||(i=i.config)===null||i===void 0?void 0:i.logs,n);return[new V3n(this.lp(t,e),r,this.Kf,()=>this.up(),s=>s(),void 0,o),r]}hp(){var t;const e=(t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.logs;var n;return this.rp&&this.cp===e||((n=this.rp)===null||n===void 0||n.reset(),this.cp=e,[this.rp,this.dp]=this.ap(()=>this.al,o=>{this.al=o})),this.rp}vp(){var t;const e=(t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.logs;var n;return this.op&&this.fp===e||((n=this.op)===null||n===void 0||n.reset(),this.fp=e,[this.op,this.pp]=this.ap(()=>this.Xf,o=>{this.Xf=o},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Est)),this.op}setup(t){var e;if(this.Io)return;this.wo=t,!((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0||(e=e.logs)===null||e===void 0)&&e.captureConsoleLogs&&(this.Zf=!0),(this.Zf||this.gp()&&this.mp())&&this.yp();let n=!1;const o=t.onRemoteConfig(i=>{var r;n=i.ok&&((r=i.config.logs)===null||r===void 0?void 0:r.captureConsoleLogs)===!0,this.onRemoteConfig(i)});this.Io?o.dispose():(this.Po=o,n||this.loadIfEnabled())}dispose(){var t,e,n,o;this.Io||(this.Io=!0,this.bp(),(t=this.Po)===null||t===void 0||t.dispose(),this.Po=void 0,this.wo=void 0,this.Jf=!1,Un?.removeEventListener("online",this.sp),(e=this._p)===null||e===void 0||e.call(this),this._p=void 0,(n=this.rp)===null||n===void 0||n.reset(),(o=this.op)===null||o===void 0||o.reset())}onRemoteConfig(t){var e,n;if(this.Io)return;const o=t.ok?(e=t.config.logs)===null||e===void 0?void 0:e.captureConsoleLogs:void 0;zs(o)?this.wp():((n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$logs_capture_enabled_server_side:!!o}),o?(this.Zf=!0,this.Qf||this.yp(),this.loadIfEnabled()):this.wp())}reset(){var t,e,n,o;this.bp(),(t=this.rp)===null||t===void 0||t.clearQueue(),this.al=[],(e=this.rp)===null||e===void 0||e.reset(),(n=this.op)===null||n===void 0||n.clearQueue(),this.Xf=[],(o=this.op)===null||o===void 0||o.reset(),this.hd=0}captureLog(t){this.Io||this.hp().captureLog(t)}captureConsoleLog(t){this.Io||this.vp().captureLog(t)}captureBufferedConsoleLog(t,e,n){this.Io||this.vp().captureLog(t,{context:e,occurredAtMs:n})}mp(){var t;return!!(!((t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t[lit])}gp(){var t,e,n;return!(!((t=this._instance)===null||t===void 0||(e=t.nl)===null||e===void 0)&&e.call(t))||!!(!((n=Gr._POSTHOG_REMOTE_CONFIG)===null||n===void 0||(n=n[this._instance.config.token])===null||n===void 0)&&n.config)}$h(){var t;this.bp(),(t=this.op)===null||t===void 0||t.clearQueue(),this.Xf=[]}wp(){this.Zf||this.bp()}yp(){var t;if(this.ep||!Gr?.console)return;const e=xst((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.logs).maxBufferSize;let n=!0;this.tp.push(()=>{n=!1});for(const o of q5n){let i;try{i=X5n(Gr.console[o])}catch{continue}i&&this.tp.push(UK(Gr.console,o,r=>{const s=(...a)=>{try{n&&this.kp(o,a,e)}catch{}return r.apply(Gr.console,a)};return s.__rrweb_original__=i,s}))}this.ep=!0,this.Sp=setTimeout(()=>{this.bp()},3e4)}kp(t,e,n){var o;if(this.ep&&!this.np&&e.length!==0)if(!((o=this._instance)===null||o===void 0)&&o.is_capturing()){if(n>this.Yf.length){this.np=!0;try{this.Yf.push({level:t,args:e,occurredAtMs:Date.now(),context:this.up()})}finally{this.np=!1}}}else this.bp()}bp(){if(this.Yf=[],this.ep){this.ep=!1,this.Sp&&(clearTimeout(this.Sp),this.Sp=void 0);for(const t of this.tp)t();this.tp=[]}}xp(){const t=this.Yf;return this.bp(),t}get logger(){return this.Cp||(this.Cp={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.Cp}flushLogs(t){t?this.$p(t):(this.rp&&this.rp.flush().catch(e=>this.Tp(e)),this.op&&this.op.flush().catch(e=>this.Tp(e)))}Tp(t){Sst(t)||this.$.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Io||!this.Zf||this.Qf||this.Jf)return;const t=Gr?.__PosthogExtensions__;if(!t)return this.$.error("PostHog Extensions not found."),void this.bp();const e=t.loadExternalDependency;if(!e)return this.$.error(qCe),void this.bp();this.Jf=!0;try{e(this._instance,"logs",n=>{if(this.Jf=!1,this.Io||!this.Zf)return;const o=t.logs;if(n||!o?.initializeLogs)this.$.error("Could not load logs script",n),this.bp();else{var i;const a=this.xp();var r,s;this._p=o.initializeLogs((i=this.wo)!==null&&i!==void 0?i:this._instance),this.Qf=!0,a.length>0&&((r=o.replayConsoleBuffer)===null||r===void 0||r.call(o,(s=this.wo)!==null&&s!==void 0?s:this._instance,a))}})}catch(n){throw this.Jf=!1,n}}lp(t,e){const n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:o=>o===r9.LogsQueue?t():void 0,setPersistedProperty(o,i){var r;o===r9.LogsQueue&&e((r=i)!==null&&r!==void 0?r:[])},js:o=>this.js(o),getLibraryId:()=>Fm.LIB_NAME,getLibraryVersion:()=>Fm.LIB_VERSION}}js(t){return new Promise(e=>{if(ort(this.hd,3))return void e({kind:"fatal",error:Oye(void 0,"logs endpoint is unreachable, dropping batch")});let n=!1;const o=r=>{n||(n=!0,clearTimeout(i),e(r))},i=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),o({kind:"retry-later",error:Oye(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Ip(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:r=>{const s=r.statusCode;if(this.Mp(s),s>=200&&300>s)o({kind:"ok"});else if(s===413)o({kind:"too-large"});else if(s!==0&&s!==408&&s!==429&&500>s)o({kind:"fatal",error:new Error(`logs request failed with status ${s}`)});else{var a;s===0?(r.error||this.$.warn("Logs request failed before receiving an HTTP response"),o({kind:"retry-later",error:Oye(r.error,"logs request failed before receiving an HTTP response")})):o({kind:"retry-later",error:(a=r.error)!==null&&a!==void 0?a:new Error(`logs request failed with status ${s}`)})}}})})}Mp(t){(t!==0||this._instance.__loaded)&&(this.hd=irt(t,this.hd,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.")))}$p(t){this.al.length>0&&this.Ep(t,this.al,this.dp,Fm.LIB_NAME,e=>{this.al=e}),this.Xf.length>0&&this.Ep(t,this.Xf,this.pp,Est,e=>{this.Xf=e})}Ep(t,e,n,o,i){if(e.length===0)return;const r=e.map(a=>a.record);i([]);const s=$ot(r,Xot(n,Fm.LIB_NAME,Fm.LIB_VERSION),o,Fm.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Ip(),data:s,compression:"best-available",batchKey:"logs",transport:t})}Ip(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}up(){var t;const e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:n,windowId:o,sessionStartTimestamp:i,lastActivityTimestamp:r}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=n,e.windowId=o,zs(i)||(e.sessionStartTimestamp=i),zs(r)||(e.lastActivityTimestamp=r)}if(!(Gr==null||(t=Gr.location)===null||t===void 0)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?Yb(Gr.location.href):Gr.location.href),this._instance.featureFlags){const n=this._instance.featureFlags.getFlags();n&&n.length>0&&(e.activeFeatureFlags=n)}return e}}},d4n={metrics:class{constructor(t){this._instance=t,this.$=id("[metrics]"),this.Io=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.Io)return;const e=!!(!((t=this._instance.config.metrics)===null||t===void 0)&&t.network);e&&!this.Pp?this.Pp=(n=>{let o=!0;const i=()=>o?(a=>{var A;const c=(A=a.config.metrics)===null||A===void 0?void 0:A.network;return c===!0?{}:c||void 0})(n):void 0,r=e4n(n,i),s=t4n(n,i);return()=>{o=!1,r(),s()}})(this._instance):!e&&this.Pp&&(this.Pp(),this.Pp=void 0)}hp(){var t;const e=(t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.metrics;var n;return this.rp&&this.cp===e||((n=this.rp)===null||n===void 0||n.reset(),this.cp=e,this.rp=new z3n(this.lp(),(function(o){var i,r,s,a,A;const c=o?.resourceAttributes;return{serviceName:(i=c?.["service.name"])!==null&&i!==void 0?i:o?.serviceName,serviceVersion:(r=c?.["service.version"])!==null&&r!==void 0?r:o?.serviceVersion,environment:(s=c?.["deployment.environment"])!==null&&s!==void 0?s:o?.environment,resourceAttributes:c,beforeSend:o?.beforeSend,flushIntervalMs:(a=o?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(A=o?.maxSeriesPerFlush)!==null&&A!==void 0?A:1e3}})(e),this.$)),this.rp}count(t,e=1,n){this.hp().count(t,e,n)}gauge(t,e,n){this.hp().gauge(t,e,n)}histogram(t,e,n){this.hp().histogram(t,e,n)}flush(t){if(!this.rp)return Promise.resolve();if(t){const e=this.rp.drainWindow();return e&&this.Ys(e,t),Promise.resolve()}return this.rp.flush().catch(e=>this.$.error("PostHog metrics flush failed:",e))}reset(){var t;(t=this.rp)===null||t===void 0||t.reset()}dispose(){var t,e;this.Io=!0,(t=this.Pp)===null||t===void 0||t.call(this),this.Pp=void 0,(e=this.rp)===null||e===void 0||e.reset()}lp(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ys:n=>e.Ys(n),getLibraryId:()=>Fm.LIB_NAME,getLibraryVersion:()=>Fm.LIB_VERSION}}Ys(t,e){return new Promise(n=>{let o=!1;const i=s=>{o||(o=!0,clearTimeout(r),n(s))},r=setTimeout(()=>i({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(sn(sn({method:"POST",url:this.Rp(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e}),{},{fireCallbackOnDrop:!0,callback(s){const a=s.statusCode;if(a>=200&&300>a)i({kind:"ok"});else if(a===413)i({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)i({kind:"fatal",error:new Error(`metrics request failed with status ${a}`)});else{var A;i({kind:"retry-later",error:(A=s.error)!==null&&A!==void 0?A:new Error(`metrics request failed with status ${a}`)})}}}))})}Rp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};GK.__defaultExtensionClasses=sn({},sn(sn(sn(sn(sn(sn(sn(sn(sn(sn(sn(sn(sn({},Ete),n4n),o4n),i4n),r4n),s4n),A4n),a4n),c4n),l4n),g4n),u4n),d4n));var Ik=(function(){Fm.SDK_DIST_CHANNEL="npm";const t=FK[OK]=new GK;return(function(){function e(){e.done||(e.done=!0,Lrt=!1,El(FK,function(n){n._dom_loaded()}))}No?.addEventListener?No.readyState==="complete"?e():dl(No,"DOMContentLoaded",e,{capture:!1}):Un&&gi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),t})();class CM extends Error{response;request;options;constructor(e,n,o){const i=e.status||e.status===0?e.status:"",r=e.statusText??"",s=`${i} ${r}`.trim(),a=s?`status code ${s}`:"an unknown error";super(`Request failed with ${a}: ${n.method} ${n.url}`),this.name="HTTPError",this.response=e,this.request=n,this.options=o}}class vst extends Error{name="NonError";value;constructor(e){let n="Non-error value was thrown";try{typeof e=="string"?n=e:e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"&&(n=e.message)}catch{}super(n),this.value=e}}class Uye extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const n=e?.cause?e.cause instanceof Error?e.cause:new vst(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",n?{cause:n}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}}const Pst=(()=>{let t=!1,e=!1;const n=typeof globalThis.ReadableStream=="function",o=typeof globalThis.Request=="function";if(n&&o)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return t&&!e})(),h4n=typeof globalThis.AbortController=="function",wst=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",p4n=typeof globalThis.ReadableStream=="function",m4n=typeof globalThis.FormData=="function",Mst=["get","post","put","patch","head","delete"],_4n={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Kye=2147483647,f4n=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Dst=Symbol("stop");class Nst{options;constructor(e){this.options=e}}const I4n=t=>new Nst(t),C4n={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},y4n={next:!0},x4n={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},E4n=t=>{if(!t)return 0;if(t instanceof FormData){let e=0;for(const[n,o]of t)e+=f4n,e+=new TextEncoder().encode(`Content-Disposition: form-data; name="${n}"`).length,e+=typeof o=="string"?new TextEncoder().encode(o).length:o.size;return e}if(t instanceof Blob)return t.size;if(t instanceof ArrayBuffer)return t.byteLength;if(typeof t=="string")return new TextEncoder().encode(t).length;if(t instanceof URLSearchParams)return new TextEncoder().encode(t.toString()).length;if("byteLength"in t)return t.byteLength;if(typeof t=="object"&&t!==null)try{const e=JSON.stringify(t);return new TextEncoder().encode(e).length}catch{return 0}return 0},Rst=(t,e,n)=>{let o,i=0;return t.pipeThrough(new TransformStream({transform(r,s){if(s.enqueue(r),o){i+=o.byteLength;let a=e===0?0:i/e;a>=1&&(a=1-Number.EPSILON),n?.({percent:a,totalBytes:Math.max(e,i),transferredBytes:i},o)}o=r},flush(){o&&(i+=o.byteLength,n?.({percent:1,totalBytes:Math.max(e,i),transferredBytes:i},o))}}))},B4n=(t,e)=>{if(!t.body)return t;if(t.status===204)return new Response(null,{status:t.status,statusText:t.statusText,headers:t.headers});const n=Math.max(0,Number(t.headers.get("content-length"))||0);return new Response(Rst(t.body,n,e),{status:t.status,statusText:t.statusText,headers:t.headers})},S4n=(t,e,n)=>{if(!t.body)return t;const o=E4n(n??t.body);return new Request(t,{duplex:"half",body:Rst(t.body,o,e)})},yM=t=>t!==null&&typeof t=="object",Bte=(...t)=>{for(const e of t)if((!yM(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return Vye({},...t)},Tst=(t={},e={})=>{const n=new globalThis.Headers(t),o=e instanceof globalThis.Headers,i=new globalThis.Headers(e);for(const[r,s]of i.entries())o&&s==="undefined"||s===void 0?n.delete(r):n.set(r,s);return n};function Ste(t,e,n){return Object.hasOwn(e,n)&&e[n]===void 0?[]:Vye(t[n]??[],e[n]??[])}const kst=(t={},e={})=>({beforeRequest:Ste(t,e,"beforeRequest"),beforeRetry:Ste(t,e,"beforeRetry"),afterResponse:Ste(t,e,"afterResponse"),beforeError:Ste(t,e,"beforeError")}),b4n=(t,e)=>{const n=new URLSearchParams;for(const o of[t,e])if(o!==void 0)if(o instanceof URLSearchParams)for(const[i,r]of o.entries())n.append(i,r);else if(Array.isArray(o))for(const i of o){if(!Array.isArray(i)||i.length!==2)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");n.append(String(i[0]),String(i[1]))}else if(yM(o))for(const[i,r]of Object.entries(o))r!==void 0&&n.append(i,String(r));else{const i=new URLSearchParams(o);for(const[r,s]of i.entries())n.append(r,s)}return n},Vye=(...t)=>{let e={},n={},o={},i;const r=[];for(const s of t)if(Array.isArray(s))Array.isArray(e)||(e=[]),e=[...e,...s];else if(yM(s)){for(let[a,A]of Object.entries(s)){if(a==="signal"&&A instanceof globalThis.AbortSignal){r.push(A);continue}if(a==="context"){if(A!=null&&(!yM(A)||Array.isArray(A)))throw new TypeError("The `context` option must be an object");e={...e,context:A==null?{}:{...e.context,...A}};continue}if(a==="searchParams"){A==null?i=void 0:i=i===void 0?A:b4n(i,A);continue}yM(A)&&a in e&&(A=Vye(e[a],A)),e={...e,[a]:A}}yM(s.hooks)&&(o=kst(o,s.hooks),e.hooks=o),yM(s.headers)&&(n=Tst(n,s.headers),e.headers=n)}return i!==void 0&&(e.searchParams=i),r.length>0&&(r.length===1?e.signal=r[0]:wst?e.signal=AbortSignal.any(r):e.signal=r.at(-1)),e},Q4n=t=>Mst.includes(t)?t.toUpperCase():t,Fst={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3,jitter:void 0,retryOnTimeout:!1},v4n=(t={})=>{if(typeof t=="number")return{...Fst,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.methods&&=t.methods.map(n=>n.toLowerCase()),t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");const e=Object.fromEntries(Object.entries(t).filter(([,n])=>n!==void 0));return{...Fst,...e}};class zye extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}}async function P4n(t,e,n,o){return new Promise((i,r)=>{const s=setTimeout(()=>{n&&n.abort(),r(new zye(t))},o.timeout);o.fetch(t,e).then(i).catch(r).then(()=>{clearTimeout(s)})})}async function w4n(t,{signal:e}){return new Promise((n,o)=>{e&&(e.throwIfAborted(),e.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(r),o(e.reason)}const r=setTimeout(()=>{e?.removeEventListener("abort",i),n()},t)})}const M4n=(t,e)=>{const n={};for(const o in e)Object.hasOwn(e,o)&&!(o in x4n)&&!(o in C4n)&&(!(o in t)||o in y4n)&&(n[o]=e[o]);return n},D4n=t=>t===void 0?!1:Array.isArray(t)?t.length>0:t instanceof URLSearchParams?t.size>0:typeof t=="object"?Object.keys(t).length>0:typeof t=="string"?t.trim().length>0:!!t;function N4n(t){return t instanceof CM||t?.name===CM.name}function R4n(t){return t instanceof zye||t?.name===zye.name}let Lst=class ltt{static create(e,n){const o=new ltt(e,n),i=async()=>{if(typeof o.#e.timeout=="number"&&o.#e.timeout>Kye)throw new RangeError(`The \`timeout\` option cannot be greater than ${Kye}`);await Promise.resolve();let s=await o.#_();for(const a of o.#e.hooks.afterResponse){const A=o.#d(s.clone());let c;try{c=await a(o.request,o.#c(),A,{retryCount:o.#n})}catch(g){throw o.#r(A),o.#r(s),g}if(c instanceof Nst)throw o.#r(A),o.#r(s),new Uye(c.options);const l=c instanceof globalThis.Response?c:s;A!==l&&o.#r(A),s!==l&&o.#r(s),s=l}if(o.#d(s),!s.ok&&(typeof o.#e.throwHttpErrors=="function"?o.#e.throwHttpErrors(s.status):o.#e.throwHttpErrors)){let a=new CM(s,o.request,o.#c());for(const A of o.#e.hooks.beforeError)a=await A(a,{retryCount:o.#n});throw a}if(o.#e.onDownloadProgress){if(typeof o.#e.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!p4n)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");const a=s.clone();return o.#r(s),B4n(a,o.#e.onDownloadProgress)}return s},r=o.#h(i).finally(()=>{const s=o.#s;o.#g(s?.body??void 0),o.#g(o.request.body??void 0)});for(const[s,a]of Object.entries(_4n))s==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(r[s]=async()=>{o.request.headers.set("accept",o.request.headers.get("accept")||a);const A=await r;if(s==="json"){if(A.status===204)return"";const c=await A.text();return c===""?"":n.parseJson?n.parseJson(c):JSON.parse(c)}return A[s]()});return r}static#a(e){return e&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof URLSearchParams)?Object.fromEntries(Object.entries(e).filter(([,n])=>n!==void 0)):e}request;#o;#n=0;#t;#e;#s;#i;#A;constructor(e,n={}){if(this.#t=e,this.#e={...n,headers:Tst(this.#t.headers,n.headers),hooks:kst({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},n.hooks),method:Q4n(n.method??this.#t.method??"GET"),prefixUrl:String(n.prefixUrl||""),retry:v4n(n.retry),throwHttpErrors:n.throwHttpErrors??!0,timeout:n.timeout??1e4,fetch:n.fetch??globalThis.fetch.bind(globalThis),context:n.context??{}},typeof this.#t!="string"&&!(this.#t instanceof URL||this.#t instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this.#e.prefixUrl&&typeof this.#t=="string"){if(this.#t.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this.#e.prefixUrl.endsWith("/")||(this.#e.prefixUrl+="/"),this.#t=this.#e.prefixUrl+this.#t}h4n&&wst&&(this.#i=this.#e.signal??this.#t.signal,this.#o=new globalThis.AbortController,this.#e.signal=this.#i?AbortSignal.any([this.#i,this.#o.signal]):this.#o.signal),Pst&&(this.#e.duplex="half"),this.#e.json!==void 0&&(this.#e.body=this.#e.stringifyJson?.(this.#e.json)??JSON.stringify(this.#e.json),this.#e.headers.set("content-type",this.#e.headers.get("content-type")??"application/json"));const o=n.headers&&new globalThis.Headers(n.headers).has("content-type");if(this.#t instanceof globalThis.Request&&(m4n&&this.#e.body instanceof globalThis.FormData||this.#e.body instanceof URLSearchParams)&&!o&&this.#e.headers.delete("content-type"),this.request=new globalThis.Request(this.#t,this.#e),D4n(this.#e.searchParams)){const r="?"+(typeof this.#e.searchParams=="string"?this.#e.searchParams.replace(/^\?/,""):new URLSearchParams(ltt.#a(this.#e.searchParams)).toString()),s=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,r);this.request=new globalThis.Request(s,this.#e)}if(this.#e.onUploadProgress){if(typeof this.#e.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!Pst)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#p(this.request,this.#e.body??void 0)}}#l(){const e=this.#e.retry.delay(this.#n);let n=e;this.#e.retry.jitter===!0?n=Math.random()*e:typeof this.#e.retry.jitter=="function"&&(n=this.#e.retry.jitter(e),(!Number.isFinite(n)||n<0)&&(n=e));const o=this.#e.retry.backoffLimit??Number.POSITIVE_INFINITY;return Math.min(o,n)}async#m(e){if(this.#n++,this.#n>this.#e.retry.limit)throw e;const n=e instanceof Error?e:new vst(e);if(n instanceof Uye)return n.customDelay??this.#l();if(!this.#e.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(this.#e.retry.shouldRetry!==void 0){const o=await this.#e.retry.shouldRetry({error:n,retryCount:this.#n});if(o===!1)throw e;if(o===!0)return this.#l()}if(R4n(e)&&!this.#e.retry.retryOnTimeout)throw e;if(N4n(e)){if(!this.#e.retry.statusCodes.includes(e.response.status))throw e;const o=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(o&&this.#e.retry.afterStatusCodes.includes(e.response.status)){let i=Number(o)*1e3;Number.isNaN(i)?i=Date.parse(o)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());const r=this.#e.retry.maxRetryAfter??i;return i<r?i:r}if(e.response.status===413)throw e}return this.#l()}#d(e){return this.#e.parseJson&&(e.json=async()=>this.#e.parseJson(await e.text())),e}#g(e){e&&e.cancel().catch(()=>{})}#r(e){this.#g(e.body??void 0)}async#h(e){try{return await e()}catch(n){const o=Math.min(await this.#m(n),Kye);if(this.#n<1)throw n;if(await w4n(o,this.#i?{signal:this.#i}:{}),n instanceof Uye&&n.customRequest){const i=this.#e.signal?new globalThis.Request(n.customRequest,{signal:this.#e.signal}):new globalThis.Request(n.customRequest);this.#u(i)}for(const i of this.#e.hooks.beforeRetry){const r=await i({request:this.request,options:this.#c(),error:n,retryCount:this.#n});if(r instanceof globalThis.Request){this.#u(r);break}if(r instanceof globalThis.Response)return r;if(r===Dst)return}return this.#h(e)}}async#_(){this.#o?.signal.aborted&&(this.#o=new globalThis.AbortController,this.#e.signal=this.#i?AbortSignal.any([this.#i,this.#o.signal]):this.#o.signal,this.request=new globalThis.Request(this.request,{signal:this.#e.signal}));for(const n of this.#e.hooks.beforeRequest){const o=await n(this.request,this.#c(),{retryCount:this.#n});if(o instanceof Response)return o;if(o instanceof globalThis.Request){this.#u(o);break}}const e=M4n(this.request,this.#e);return this.#s=this.request,this.request=this.#s.clone(),this.#e.timeout===!1?this.#e.fetch(this.#s,e):P4n(this.#s,e,this.#o,this.#e)}#c(){if(!this.#A){const{hooks:e,...n}=this.#e;this.#A=Object.freeze(n)}return this.#A}#u(e){this.#A=void 0,this.request=this.#p(e)}#p(e,n){return!this.#e.onUploadProgress||!e.body?e:S4n(e,this.#e.onUploadProgress,n??this.#e.body??void 0)}};const Jye=t=>{const e=(n,o)=>Lst.create(n,Bte(t,o));for(const n of Mst)e[n]=(o,i)=>Lst.create(o,Bte(t,i,{method:n}));return e.create=n=>Jye(Bte(n)),e.extend=n=>(typeof n=="function"&&(n=n(t??{})),Jye(Bte(t,n))),e.stop=Dst,e.retry=I4n,e},T4n=Jye();class k4n extends CM{constructor(e,n,o,i){super(e,n,o),this.name="RegistryHTTPError",this.message=i}}function KK(t){return typeof window<"u"?window[t]:null}function xM(){const t=KK("TSCIRCUIT_REGISTRY_API_BASE_URL")||void 0||"https://registry-api.tscircuit.com",e=KK("TSCIRCUIT_REGISTRY_TOKEN");return T4n.create({prefixUrl:t,headers:{Authorization:`Bearer ${e}`},timeout:3e4,hooks:{afterResponse:[async(n,o,i)=>{if(i.ok)return i;let r=null;try{r=await i.clone().json()}catch(g){console.error("Failed to parse registry error response",g)}const s=r?.error?.message??r?.error?.error_message??r?.message,a=r?.error?.error_code??r?.error_code,A=new URL(i.url),l=[`Registry request failed for ${`${A.pathname}${A.search}`} (${i.status})`];throw s&&l.push(`Server message: ${s}`),a&&l.push(`Error code: ${a}`),new k4n(i,n,o,l.join(" | "))}]}})}function bte(){return!!KK("TSCIRCUIT_REGISTRY_TOKEN")}const Qte={get:(t,e)=>xM().get(t,e),post:(t,e)=>xM().post(t,e),put:(t,e)=>xM().put(t,e),delete:(t,e)=>xM().delete(t,e),patch:(t,e)=>xM().patch(t,e)},F4n="phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo",L4n="https://postpig.tscircuit.com",Hst="runframe:anonymous-id",Wye=()=>typeof window<"u",Ost=t=>t.includes("localhost")||t.includes("127.0.0.1"),H4n=t=>{try{return new URL(t).hostname}catch{return null}},O4n=()=>{if(!Wye())return null;let t=null;return document.referrer&&(t=H4n(document.referrer)),t??window.location.hostname},G4n=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,Y4n=()=>{if(!Wye())return null;try{const t=window.localStorage.getItem(Hst);if(t)return t;const e=G4n();return window.localStorage.setItem(Hst,e),e}catch{return null}},U4n=()=>KK("TSCIRCUIT_USE_RUNFRAME_FOR_CLI")===!0,Gst=()=>!Wye()||Ost(window.location.hostname)&&!U4n()?!1:(Ik.__loaded||Ik.init(F4n,{api_host:L4n,person_profiles:"always"}),!0),K4n=()=>{if(!Gst())return null;const t=O4n(),e=t!=null&&!Ost(t);let n=null;e||(n=Y4n());let o,i;return e?(o=`domain:${t}`,i="domain"):(o=void 0,n&&(o=`anonymous:${n}`),i="anonymous_id"),{embedDomain:t,anonymousId:n,distinctId:o,identityType:i}},V4n=(t,{source:e,...n})=>{const o=K4n();if(!o)return;const{embedDomain:i,anonymousId:r,distinctId:s,identityType:a}=o;if(s){const A={};a==="domain"&&i&&(A.embed_domain=i),a==="anonymous_id"&&r&&(A.runframe_anonymous_id=r),Ik.identify(s,A)}Ik.capture(t,{...n,source:e,embed_domain:i,runframe_anonymous_id:r,identity_type:a})},z4n=t=>{V4n("runframe_activity",t)};Gst();function J4n(t){const e=String.fromCodePoint(...t);return btoa(e)}var Xp=Uint8Array,x3=Uint16Array,jye=Int32Array,vte=new Xp([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]),Pte=new Xp([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]),qye=new Xp([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Yst=function(t,e){for(var n=new x3(31),o=0;o<31;++o)n[o]=e+=1<<t[o-1];for(var i=new jye(n[30]),o=1;o<30;++o)for(var r=n[o];r<n[o+1];++r)i[r]=r-n[o]<<5|o;return{b:n,r:i}},Ust=Yst(vte,2),Kst=Ust.b,Xye=Ust.r;Kst[28]=258,Xye[258]=28;for(var Vst=Yst(Pte,0),W4n=Vst.b,zst=Vst.r,$ye=new x3(32768),ad=0;ad<32768;++ad){var Xb=(ad&43690)>>1|(ad&21845)<<1;Xb=(Xb&52428)>>2|(Xb&13107)<<2,Xb=(Xb&61680)>>4|(Xb&3855)<<4,$ye[ad]=((Xb&65280)>>8|(Xb&255)<<8)>>1}for(var l9=(function(t,e,n){for(var o=t.length,i=0,r=new x3(e);i<o;++i)t[i]&&++r[t[i]-1];var s=new x3(e);for(i=1;i<e;++i)s[i]=s[i-1]+r[i-1]<<1;var a;if(n){a=new x3(1<<e);var A=15-e;for(i=0;i<o;++i)if(t[i])for(var c=i<<4|t[i],l=e-t[i],g=s[t[i]-1]++<<l,u=g|(1<<l)-1;g<=u;++g)a[$ye[g]>>A]=c}else for(a=new x3(o),i=0;i<o;++i)t[i]&&(a[i]=$ye[s[t[i]-1]++]>>15-t[i]);return a}),$b=new Xp(288),ad=0;ad<144;++ad)$b[ad]=8;for(var ad=144;ad<256;++ad)$b[ad]=9;for(var ad=256;ad<280;++ad)$b[ad]=7;for(var ad=280;ad<288;++ad)$b[ad]=8;for(var VK=new Xp(32),ad=0;ad<32;++ad)VK[ad]=5;var j4n=l9($b,9,0),q4n=l9($b,9,1),X4n=l9(VK,5,0),$4n=l9(VK,5,1),Zye=function(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},E4=function(t,e,n){var o=e/8|0;return(t[o]|t[o+1]<<8)>>(e&7)&n},e2e=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(e&7)},t2e=function(t){return(t+7)/8|0},Ck=function(t,e,n){return(e==null||e<0)&&(e=0),(n==null||n>t.length)&&(n=t.length),new Xp(t.subarray(e,n))},Z4n=["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"],W2=function(t,e,n){var o=new Error(e||Z4n[t]);if(o.code=t,Error.captureStackTrace&&Error.captureStackTrace(o,W2),!n)throw o;return o},Jst=function(t,e,n,o){var i=t.length,r=0;if(!i||e.f&&!e.l)return n||new Xp(0);var s=!n,a=s||e.i!=2,A=e.i;s&&(n=new Xp(i*3));var c=function(he){var ye=n.length;if(he>ye){var ve=new Xp(Math.max(ye*2,he));ve.set(n),n=ve}},l=e.f||0,g=e.p||0,u=e.b||0,h=e.l,d=e.d,p=e.m,m=e.n,_=i*8;do{if(!h){l=E4(t,g,1);var f=E4(t,g+1,3);if(g+=3,f)if(f==1)h=q4n,d=$4n,p=9,m=5;else if(f==2){var x=E4(t,g,31)+257,E=E4(t,g+10,15)+4,B=x+E4(t,g+5,31)+1;g+=14;for(var b=new Xp(B),Q=new Xp(19),w=0;w<E;++w)Q[qye[w]]=E4(t,g+w*3,7);g+=E*3;for(var M=Zye(Q),k=(1<<M)-1,R=l9(Q,M,1),w=0;w<B;){var F=R[E4(t,g,k)];g+=F&15;var I=F>>4;if(I<16)b[w++]=I;else{var G=0,U=0;for(I==16?(U=3+E4(t,g,3),g+=2,G=b[w-1]):I==17?(U=3+E4(t,g,7),g+=3):I==18&&(U=11+E4(t,g,127),g+=7);U--;)b[w++]=G}}var Y=b.subarray(0,x),J=b.subarray(x);p=Zye(Y),m=Zye(J),h=l9(Y,p,1),d=l9(J,m,1)}else W2(1);else{var I=t2e(g)+4,C=t[I-4]|t[I-3]<<8,y=I+C;if(y>i){A&&W2(0);break}a&&c(u+C),n.set(t.subarray(I,y),u),e.b=u+=C,e.p=g=y*8,e.f=l;continue}if(g>_){A&&W2(0);break}}a&&c(u+131072);for(var ee=(1<<p)-1,j=(1<<m)-1,X=g;;X=g){var G=h[e2e(t,g)&ee],ie=G>>4;if(g+=G&15,g>_){A&&W2(0);break}if(G||W2(2),ie<256)n[u++]=ie;else if(ie==256){X=g,h=null;break}else{var se=ie-254;if(ie>264){var w=ie-257,oe=vte[w];se=E4(t,g,(1<<oe)-1)+Kst[w],g+=oe}var ge=d[e2e(t,g)&j],de=ge>>4;ge||W2(3),g+=ge&15;var J=W4n[de];if(de>3){var oe=Pte[de];J+=e2e(t,g)&(1<<oe)-1,g+=oe}if(g>_){A&&W2(0);break}a&&c(u+131072);var Ce=u+se;if(u<J){var le=r-J,_e=Math.min(J,Ce);for(le+u<0&&W2(3);u<_e;++u)n[u]=o[le+u]}for(;u<Ce;++u)n[u]=n[u-J]}}e.l=h,e.p=X,e.b=u,e.f=l,h&&(l=1,e.m=p,e.d=d,e.n=m)}while(!l);return u!=n.length&&s?Ck(n,0,u):n.subarray(0,u)},A8=function(t,e,n){n<<=e&7;var o=e/8|0;t[o]|=n,t[o+1]|=n>>8},zK=function(t,e,n){n<<=e&7;var o=e/8|0;t[o]|=n,t[o+1]|=n>>8,t[o+2]|=n>>16},n2e=function(t,e){for(var n=[],o=0;o<t.length;++o)t[o]&&n.push({s:o,f:t[o]});var i=n.length,r=n.slice();if(!i)return{t:Xst,l:0};if(i==1){var s=new Xp(n[0].s+1);return s[n[0].s]=1,{t:s,l:1}}n.sort(function(y,x){return y.f-x.f}),n.push({s:-1,f:25001});var a=n[0],A=n[1],c=0,l=1,g=2;for(n[0]={s:-1,f:a.f+A.f,l:a,r:A};l!=i-1;)a=n[n[c].f<n[g].f?c++:g++],A=n[c!=l&&n[c].f<n[g].f?c++:g++],n[l++]={s:-1,f:a.f+A.f,l:a,r:A};for(var u=r[0].s,o=1;o<i;++o)r[o].s>u&&(u=r[o].s);var h=new x3(u+1),d=o2e(n[l-1],h,0);if(d>e){var o=0,p=0,m=d-e,_=1<<m;for(r.sort(function(x,E){return h[E.s]-h[x.s]||x.f-E.f});o<i;++o){var f=r[o].s;if(h[f]>e)p+=_-(1<<d-h[f]),h[f]=e;else break}for(p>>=m;p>0;){var I=r[o].s;h[I]<e?p-=1<<e-h[I]++-1:++o}for(;o>=0&&p;--o){var C=r[o].s;h[C]==e&&(--h[C],++p)}d=e}return{t:new Xp(h),l:d}},o2e=function(t,e,n){return t.s==-1?Math.max(o2e(t.l,e,n+1),o2e(t.r,e,n+1)):e[t.s]=n},Wst=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new x3(++e),o=0,i=t[0],r=1,s=function(A){n[o++]=A},a=1;a<=e;++a)if(t[a]==i&&a!=e)++r;else{if(!i&&r>2){for(;r>138;r-=138)s(32754);r>2&&(s(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(s(i),--r;r>6;r-=6)s(8304);r>2&&(s(r-3<<5|8208),r=0)}for(;r--;)s(i);r=1,i=t[a]}return{c:n.subarray(0,o),n:e}},JK=function(t,e){for(var n=0,o=0;o<e.length;++o)n+=t[o]*e[o];return n},jst=function(t,e,n){var o=n.length,i=t2e(e+2);t[i]=o&255,t[i+1]=o>>8,t[i+2]=t[i]^255,t[i+3]=t[i+1]^255;for(var r=0;r<o;++r)t[i+r+4]=n[r];return(i+4+o)*8},qst=function(t,e,n,o,i,r,s,a,A,c,l){A8(e,l++,n),++i[256];for(var g=n2e(i,15),u=g.t,h=g.l,d=n2e(r,15),p=d.t,m=d.l,_=Wst(u),f=_.c,I=_.n,C=Wst(p),y=C.c,x=C.n,E=new x3(19),B=0;B<f.length;++B)++E[f[B]&31];for(var B=0;B<y.length;++B)++E[y[B]&31];for(var b=n2e(E,7),Q=b.t,w=b.l,M=19;M>4&&!Q[qye[M-1]];--M);var k=c+5<<3,R=JK(i,$b)+JK(r,VK)+s,F=JK(i,u)+JK(r,p)+s+14+3*M+JK(E,Q)+2*E[16]+3*E[17]+7*E[18];if(A>=0&&k<=R&&k<=F)return jst(e,l,t.subarray(A,A+c));var G,U,Y,J;if(A8(e,l,1+(F<R)),l+=2,F<R){G=l9(u,h,0),U=u,Y=l9(p,m,0),J=p;var ee=l9(Q,w,0);A8(e,l,I-257),A8(e,l+5,x-1),A8(e,l+10,M-4),l+=14;for(var B=0;B<M;++B)A8(e,l+3*B,Q[qye[B]]);l+=3*M;for(var j=[f,y],X=0;X<2;++X)for(var ie=j[X],B=0;B<ie.length;++B){var se=ie[B]&31;A8(e,l,ee[se]),l+=Q[se],se>15&&(A8(e,l,ie[B]>>5&127),l+=ie[B]>>12)}}else G=j4n,U=$b,Y=X4n,J=VK;for(var B=0;B<a;++B){var oe=o[B];if(oe>255){var se=oe>>18&31;zK(e,l,G[se+257]),l+=U[se+257],se>7&&(A8(e,l,oe>>23&31),l+=vte[se]);var ge=oe&31;zK(e,l,Y[ge]),l+=J[ge],ge>3&&(zK(e,l,oe>>5&8191),l+=Pte[ge])}else zK(e,l,G[oe]),l+=U[oe]}return zK(e,l,G[256]),l+U[256]},eBn=new jye([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Xst=new Xp(0),tBn=function(t,e,n,o,i,r){var s=r.z||t.length,a=new Xp(o+s+5*(1+Math.ceil(s/7e3))+i),A=a.subarray(o,a.length-i),c=r.l,l=(r.r||0)&7;if(e){l&&(A[0]=r.r>>3);for(var g=eBn[e-1],u=g>>13,h=g&8191,d=(1<<n)-1,p=r.p||new x3(32768),m=r.h||new x3(d+1),_=Math.ceil(n/3),f=2*_,I=function(Pe){return(t[Pe]^t[Pe+1]<<_^t[Pe+2]<<f)&d},C=new jye(25e3),y=new x3(288),x=new x3(32),E=0,B=0,b=r.i||0,Q=0,w=r.w||0,M=0;b+2<s;++b){var k=I(b),R=b&32767,F=m[k];if(p[R]=F,m[k]=R,w<=b){var G=s-b;if((E>7e3||Q>24576)&&(G>423||!c)){l=qst(t,A,0,C,y,x,B,Q,M,b-M,l),Q=E=B=0,M=b;for(var U=0;U<286;++U)y[U]=0;for(var U=0;U<30;++U)x[U]=0}var Y=2,J=0,ee=h,j=R-F&32767;if(G>2&&k==I(b-j))for(var X=Math.min(u,G)-1,ie=Math.min(32767,b),se=Math.min(258,G);j<=ie&&--ee&&R!=F;){if(t[b+Y]==t[b+Y-j]){for(var oe=0;oe<se&&t[b+oe]==t[b+oe-j];++oe);if(oe>Y){if(Y=oe,J=j,oe>X)break;for(var ge=Math.min(j,oe-2),de=0,U=0;U<ge;++U){var Ce=b-j+U&32767,le=p[Ce],_e=Ce-le&32767;_e>de&&(de=_e,F=Ce)}}}R=F,F=p[R],j+=R-F&32767}if(J){C[Q++]=268435456|Xye[Y]<<18|zst[J];var he=Xye[Y]&31,ye=zst[J]&31;B+=vte[he]+Pte[ye],++y[257+he],++x[ye],w=b+Y,++E}else C[Q++]=t[b],++y[t[b]]}}for(b=Math.max(b,w);b<s;++b)C[Q++]=t[b],++y[t[b]];l=qst(t,A,c,C,y,x,B,Q,M,b-M,l),c||(r.r=l&7|A[l/8|0]<<3,l-=7,r.h=m,r.p=p,r.i=b,r.w=w)}else{for(var b=r.w||0;b<s+c;b+=65535){var ve=b+65535;ve>=s&&(A[l/8|0]=c,ve=s),l=jst(A,l+1,t.subarray(b,ve))}r.i=s}return Ck(a,0,o+t2e(l)+i)},nBn=(function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var n=e,o=9;--o;)n=(n&1&&-306674912)^n>>>1;t[e]=n}return t})(),oBn=function(){var t=-1;return{p:function(e){for(var n=t,o=0;o<e.length;++o)n=nBn[n&255^e[o]]^n>>>8;t=n},d:function(){return~t}}},$st=function(){var t=1,e=0;return{p:function(n){for(var o=t,i=e,r=n.length|0,s=0;s!=r;){for(var a=Math.min(s+2655,r);s<a;++s)i+=o+=n[s];o=(o&65535)+15*(o>>16),i=(i&65535)+15*(i>>16)}t=o,e=i},d:function(){return t%=65521,e%=65521,(t&255)<<24|(t&65280)<<8|(e&255)<<8|e>>8}}},Zst=function(t,e,n,o,i){if(!i&&(i={l:1},e.dictionary)){var r=e.dictionary.subarray(-32768),s=new Xp(r.length+t.length);s.set(r),s.set(t,r.length),t=s,i.w=r.length}return tBn(t,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,n,o,i)},WK=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},iBn=function(t,e){var n=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:e.level==9?2:0,t[9]=3,e.mtime!=0&&WK(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var o=0;o<=n.length;++o)t[o+10]=n.charCodeAt(o)}},rBn=function(t){return 10+(t.filename?t.filename.length+1:0)},sBn=function(t,e){var n=e.level,o=n==0?0:n<6?1:n==9?3:2;if(t[0]=120,t[1]=o<<6|(e.dictionary&&32),t[1]|=31-(t[0]<<8|t[1])%31,e.dictionary){var i=$st();i.p(e.dictionary),WK(t,2,i.d())}},eat=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&W2(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&W2(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2},i2e=(function(){function t(e,n){typeof e=="function"&&(n=e,e={}),this.ondata=n;var o=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:o?o.length:0},this.o=new Xp(32768),this.p=new Xp(0),o&&this.o.set(o)}return t.prototype.e=function(e){if(this.ondata||W2(5),this.d&&W2(4),!this.p.length)this.p=e;else if(e.length){var n=new Xp(this.p.length+e.length);n.set(this.p),n.set(e,this.p.length),this.p=n}},t.prototype.c=function(e){this.s.i=+(this.d=e||!1);var n=this.s.b,o=Jst(this.p,this.s,this.o);this.ondata(Ck(o,n,this.s.b),this.d),this.o=Ck(o,this.s.b-32768),this.s.b=this.o.length,this.p=Ck(this.p,this.s.p/8|0),this.s.p&=7},t.prototype.push=function(e,n){this.e(e),this.c(n)},t})();function r2e(t,e){e||(e={});var n=oBn(),o=t.length;n.p(t);var i=Zst(t,e,rBn(e),8),r=i.length;return iBn(i,e),WK(i,r-8,n.d()),WK(i,r-4,o),i}function tat(t,e){e||(e={});var n=$st();n.p(t);var o=Zst(t,e,e.dictionary?6:2,4);return sBn(o,e),WK(o,o.length-4,n.d()),o}var wte=(function(){function t(e,n){i2e.call(this,e,n),this.v=e&&e.dictionary?2:1}return t.prototype.push=function(e,n){if(i2e.prototype.e.call(this,e),this.v){if(this.p.length<6&&!n)return;this.p=this.p.subarray(eat(this.p,this.v-1)),this.v=0}n&&(this.p.length<4&&W2(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),i2e.prototype.c.call(this,n)},t})();function aBn(t,e){return Jst(t.subarray(eat(t,e),-4),{i:2},e,e)}var nat=typeof TextEncoder<"u"&&new TextEncoder,ABn=typeof TextDecoder<"u"&&new TextDecoder,cBn=0;try{ABn.decode(Xst,{stream:!0}),cBn=1}catch{}function s2e(t,e){var n;if(nat)return nat.encode(t);for(var o=t.length,i=new Xp(t.length+(t.length>>1)),r=0,s=function(c){i[r++]=c},n=0;n<o;++n){if(r+5>i.length){var a=new Xp(r+8+(o-n<<1));a.set(i),i=a}var A=t.charCodeAt(n);A<128||e?s(A):A<2048?(s(192|A>>6),s(128|A&63)):A>55295&&A<57344?(A=65536+(A&1047552)|t.charCodeAt(++n)&1023,s(240|A>>18),s(128|A>>12&63),s(128|A>>6&63),s(128|A&63)):(s(224|A>>12),s(128|A>>6&63),s(128|A&63))}return Ck(i,0,r)}function lBn(t,e){const n=JSON.stringify(t),o=r2e(s2e(n));return`https://tscircuit.com/editor?#data:application/gzip;base64,${J4n(o)}`}function Kr(...t){return Gxn(f4(t))}const oat=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),a2e=lxn,Mte=te.forwardRef(({className:t,...e},n)=>z.jsx(Qnt,{ref:n,className:Kr("rf-inline-flex rf-h-9 rf-items-center rf-justify-center rf-rounded-lg rf-bg-zinc-100 rf-p-1 rf-text-zinc-500 dark:rf-bg-zinc-800 dark:rf-text-zinc-400",t),...e}));Mte.displayName=Qnt.displayName;const g9=te.forwardRef(({className:t,...e},n)=>z.jsx(vnt,{ref:n,className:Kr("rf-inline-flex rf-items-center rf-justify-center rf-whitespace-nowrap rf-rounded-md rf-px-3 rf-py-1 rf-text-sm rf-font-medium rf-ring-offset-white rf-transition-all focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 disabled:rf-pointer-events-none disabled:rf-opacity-50 data-[state=active]:rf-bg-white data-[state=active]:rf-text-zinc-950 data-[state=active]:rf-shadow dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300 dark:data-[state=active]:rf-bg-zinc-950 dark:data-[state=active]:rf-text-zinc-50",t),...e}));g9.displayName=vnt.displayName;const O1=te.forwardRef(({className:t,...e},n)=>z.jsx(Pnt,{ref:n,className:Kr("rf-h-full rf-mt-2 rf-ring-offset-white focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300",t),...e}));O1.displayName=Pnt.displayName;const gBn="T1RUTwAJAIAAAwAQQ0ZGIFhQSpcAAAcwAABJ3U9TLzJqmmVhAAABAAAAAGBjbWFwFN0WswAABEwAAALEaGVhZC1P1HwAAACcAAAANmhoZWEDrgI1AAAA1AAAACRobXR44xAAAAAAURAAAAFQbWF4cABUUAAAAAD4AAAABm5hbWUZQ94BAAABYAAAAutwb3N0AAMAAAAABxAAAAAgAAEAAAABAADb+Z65Xw889QADA+gAAAAA5e9IsgAAAADl70iy/9P/PwKHAvkAAAADAAIAAAAAAAAAAQAAA6z/LAAAArQAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAFQAAFAAAFQAAAADArQB9AAFAAACigK7AAAAjAKKArsAAAHfADEBAgAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAABYWFhYAEAAIQB6A6z/LAAAAvkAwQAAAAEAAAAAAiwC1wAAAAAAAAAAACIBngABAAAAAAAAAAEAWQABAAAAAAABABEAAAABAAAAAAACAAcAMwABAAAAAAADABsA/AABAAAAAAAEABkASAABAAAAAAAFAAsA2wABAAAAAAAGABgAkwABAAAAAAAHAAEAWQABAAAAAAAIAAEAWQABAAAAAAAJAAEAWQABAAAAAAAKAAEAWQABAAAAAAALAAEAWQABAAAAAAAMAAEAWQABAAAAAAANAAEAWQABAAAAAAAOAAEAWQABAAAAAAAQABEAAAABAAAAAAARAAcAMwADAAEECQAAAAIAgwADAAEECQABACIAEQADAAEECQACAA4AOgADAAEECQADADYBFwADAAEECQAEADIAYQADAAEECQAFABYA5gADAAEECQAGADAAqwADAAEECQAHAAIAgwADAAEECQAIAAIAgwADAAEECQAJAAIAgwADAAEECQAKAAIAgwADAAEECQALAAIAgwADAAEECQAMAAIAgwADAAEECQANAAIAgwADAAEECQAOAAIAgwADAAEECQAQACIAEQADAAEECQARAA4AOlRzY2lyY3VpdEFscGhhYmV0AFQAcwBjAGkAcgBjAHUAaQB0AEEAbABwAGgAYQBiAGUAdFJlZ3VsYXIAUgBlAGcAdQBsAGEAclRzY2lyY3VpdEFscGhhYmV0IFJlZ3VsYXIAVABzAGMAaQByAGMAdQBpAHQAQQBsAHAAaABhAGIAZQB0ACAAUgBlAGcAdQBsAGEAclRzY2lyY3VpdEFscGhhYmV0UmVndWxhcgBUAHMAYwBpAHIAYwB1AGkAdABBAGwAcABoAGEAYgBlAHQAUgBlAGcAdQBsAGEAclZlcnNpb24gMC4xAFYAZQByAHMAaQBvAG4AIAAwAC4AMSA6VHNjaXJjdWl0QWxwaGFiZXQgUmVndWxhcgAgADoAVABzAGMAaQByAGMAdQBpAHQAQQBsAHAAaABhAGIAZQB0ACAAUgBlAGcAdQBsAGEAcgAAAAABAAMAAQAAAAwABAK4AAAAqgCAAAYAKgAAACEAIgAjACQAJwAoACkAKgArACwALQAuAC8AMAAxADIAMwA0ADUANgA3ADgAOQA8AD0APgBBAEIAQwBEAEUARgBHAEgASQBKAEsATABNAE4ATwBQAFEAUgBTAFQAVQBWAFcAWABZAFoAWwBcAF0AXgBfAGEAYgBjAGQAZQBmAGcAaABpAGoAawBsAG0AbgBvAHAAcQByAHMAdAB1AHYAdwB4AHkAev//AAAAAAAhACIAIwAkACcAKAApACoAKwAsAC0ALgAvADAAMQAyADMANAA1ADYANwA4ADkAPAA9AD4AQQBCAEMARABFAEYARwBIAEkASgBLAEwATQBOAE8AUABRAFIAUwBUAFUAVgBXAFgAWQBaAFsAXABdAF4AXwBhAGIAYwBkAGUAZgBnAGgAaQBqAGsAbABtAG4AbwBwAHEAcgBzAHQAdQB2AHcAeAB5AHr//wAA/+D/4P/g/+D/3v/e/97/3v/e/97/3v/e/97/3v/e/97/3v/e/97/3v/e/97/3v/c/9z/3P/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9r/2v/a/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2f/Z/9n/2QABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEABAEAAQEBGVRzY2lyY3VpdEFscGhhYmV0UmVndWxhcgABAQEo+BsA+BwC+B0D+B4Ei/tV+kD5SAUdAAABOQ8dAAAB4BGLHQAASd0SAFcBAQwlNj0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkFZlcnNpb24gMC4xVHNjaXJjdWl0QWxwaGFiZXQgUmVndWxhclRzY2lyY3VpdEFscGhhYmV0UmVndWxhciEiIyQnKCkqKywtLi8wMTIzNDU2Nzg5PD0+QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVpbXF1eX2FiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6AAAAAYsBjAGNAY4BjwGQAZEBkgGTAZQBlQGWAZcBmAGZAZoBmwGcAZ0BngGfAaABoQGiAaMBpAGlAaYBpwGoAakBqgGrAawBrQGuAa8BsAGxAbIBswG0AbUBtgG3AbgBuQG6AbsBvAG9Ab4BvwHAAcEBwgHDAcQBxQHGAccByAHJAcoBywHMAc0BzgHPAdAB0QHSAdMB1AHVAdYB1wHYAdkB2gHbAdwB3QBUAgABAAQAeADuAgwFUgWPBmUHOwffCGMIzwkMCUgJhQq1CzwMhg5ADwwQUBHfEt8U3hYZFqIXFxeiGEIZtBsIHCccsh0sHpIfGh9XIC8gtiEFIjwjJSRTJWUmviftKXQp2CqzK0gsfS0ILW8uPy6iLuAvQy+2L/IxEDItM0A0XjWWNlQ39zjFOTk59zp9Oro76Dy1Pd8+/EAaQJVCDELOQ49EGEVZReRGgUdR+UgO+Uj37vlBFYv8VgWIewWBfQV8ggV6iAV6jgV8lAWBmQWImwWL+FYFjpsFlZkFmpQFnI8FnIcFmoIFlX0FL/z3Fe+LBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqIBSeLBXqOBX2UBYGZBYebBY+bBZWZBZmUBQ75SPdm+UEVi/uBBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3gQWOmwWVmQWalAWcjwWchwWaggWVfQX3p3sVi/uBBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3gQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Uj3XvcoFYAiBYZ7BYB/BXyDBXmJBXqQBX6VBYOaBYmbBZPgBSR/BXqMBXuSBX+YBYaaBYycBZOaBZiVBZyRBfcPmgWe91QFKH8FeYwFfJIFf5gFhZoFjZwFkpkFmZYFm5EF9wyZBZ33RgWQmgWWmAWakwWdjQWchgWYgQWUfAWMewV7+zIF9zifBZr3JgWQmgWWmAWbkwWcjQWchgWZgQWTfAWNewV++xMF8JcFnIoFm4QFl34FkHwFinoFg30FfoAFeoUF+w19BXj7VQXslwWdigWahAWXfwWRewWKegWDfQV+gAV6hgX7CnwFfvscBYZ7BX9/BXyDBXqJBXqQBX2VBYOaBYmbBZf3CQX7MM0V9zifBZ/3VAX7OHcFDvlI9/T5XhWL/awFiHoFgX4FfIEFeogFeo4FfJUFgpgFh5wFi/msBY+bBZSZBZqUBZyOBZyIBZqCBZV9BfcB+2YVNd0FgpkFiJsFjpsFlZkFmpQFnI4FnIcFmoIF4DkFlX0FjnoFh3sFgX4FfYIFeYgFeo4FQ9sV+z+bBXuQBX2VBYOaBYmbBZCbBZeYBZqTBZ2MBfc+ewWchgWZgAWTfQWMegWGfAWAfgV8gwX7LqUVKjgFe4MFeogFeo8FfZUFgpkFiJwFkJsFlZgF7d4FmpMFnI0FnIcFmYEFlH0FjnsFh3sFLD4VZvsHBYN8BX2BBXqGBXqMBXuTBYCYBYabBY2bBa/3CAWTmQWZlgWckAWciQWbgwWWfwWQewVkIRWkSQWNegWHewWAfgV8gwV6iQV6jwV9lQWCmQVyzQWJmwWPmwWWmQWakwWcjQWchwWZgQWdTxXUWgWXfwWRewWKewWEfAV+fwV7hgV5iwV7kgVCvQV/lwWFmgWLnAWTmgWYlgWbkQWdigXTWhX3fFkFm4QFl38FkXwFi3oFhHwFfoAFe4UFeYwF+3y8BXuSBX+XBYWaBYycBZKaBZeWBZyRBfedUhXVWgWWfwWSewWKewWEfAV+fwV6hgV6iwV7kgVCvAV/mAWFmgWLnAWTmgWXlgWckQWcigX2PBWjOAWMewWGewV/fgV8hAV5igV6kAV+lgWDmQVz3gWKmwWQmwWXmAWakgWdjAWbhgWZgAWp+xAVW/sHBYF9BX2BBXqIBXmOBX2UBYGYBYebBY6cBbz3BwWUmQWalQWcjgWciAWaggWVfQWPewU/+y8V+w5aBXqHBXmOBX2UBYGZBYebBY6bBZWZBZmUBfcOvQWcjgWciAWaggWVfgWPewWIewWBfQX7M00V+zObBXuQBX2WBYOZBYqcBZCaBZaYBZuTBZyMBfczewWchgWYgAWTfAWNewWFewWAfwV7gwX7VqAVNb0Ff5YFg5oFi5sFkZsFl5cFm5IFnIsFnIYF4FkFmIAFknwFjHoFhXwFf38Fe4QFeYoF+wzZFWbuBYmbBY+bBZaYBZqUBZyNBZyHBZmBBZR9BbAnBY17BYd7BYB+BXyDBXmIBXqQBX2VBQ75SPfu+UEVi/uBBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3gQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Uj4Ko0VsmUFlX0FjnsFh3sFgX0FfYIFeYgFeo8FfZQFYrMFio0FiYwFY7sFiowFiowFYsMFiowFiowFY8oFio4FiY0FbcoFio4FiY4Fd8oFi44Fio0FgcMFi5IFi5IFlcMFjI0Fi44Fn8oFjY4FjI4FqcoFjY0FjI4Fs8oFjIwFjIwFtMMFjIwFjIwFs7sFjYwFjI0FtLMFmZQFnI8FnYgFmYIFlX0Fj3sFiHsFgX0FZGUFZV4FZFUFZE8Fb1AFeFEFg10Fk10FnlEFp1AFsk8FslUFDvlI95tWFYqJBWJjBX2CBXqHBXmOBX2UBYGZBYebBY6bBZWZBbKxBbG4BbLBBbLHBafGBZ7FBZO5BYO5BXjFBW/GBWTHBWTBBWW4BWSxBYGZBYibBY+bBZWZBZqUBZyOBZyHBZmCBbRjBYyJBY2KBbRbBYuKBY2KBbNTBYyKBYyKBbRMBYuIBY2JBapMBYuIBY2IBZ9MBYuIBYyJBZVTBYuEBYuEBYFTBYqJBYuIBXdMBYmIBYuIBWxMBYmJBYuIBWJMBYqKBYqKBWNTBYmKBYuKBWJbBQ75SPeU+FUV+zRWBXqIBXqPBX2VBYKZBYicBY+bBZaYBZqTBfc5wgUh9yQFhJoFi5sFkZsFmJYFm5IFnIsFm4UFmIAF8fsfBfH3HwWYlgWbkQWciwWchAWXgAWRewWLewWEfAUh+yQF9zlUBZqDBZZ+BY97BYh6BYJ9BX2BBXqHBXqOBfs0wAWL+yoFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFDvlI95T39hWL90sFjpwFlZgFmpUFnI4FnIgFmoEFlX4FjnoFi/tLBfdpiwWciAWaggWVfQWOewWIegWBfgV8ggV6hwX7aYsFi/tLBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv3SwX7aYsFeo8FfJQFgZgFiJwFjpsFlZkFmpQFnI4FDvlI96puFcJVBZV9BY56BYd7BYF+BXyCBXqIBXqOBX2VBTXfBYeRBYaRBYuMBYqMBYqSBYmSBYyMBYqMBY2SBYyTBYyLBYuMBZCRBY+RBfc/9zwFmpUFnI4FnIgFmoMFlX0Fj3sFiHsFgX0FDvlI90L35RX3kosFnIgFmoIFlX0FjnsFiHsFgX0FfIIFeogF+5KLBXqOBXyUBYGZBYibBY6bBZWZBZqUBQ75SPf/7RX7D4sFeY4FfZQFgZkFiJsFjpsFlZkFmZQFnY4F9w+LBZyIBZmCBZV9BY97BYd7BYF9BX2CBQ75SKOAFfhx+WMFl5cFm5EFnYwFm4UFmIAFknwFjHoFhXwF/HH9YwV/fwV7hQV5igV7kQV+lgWEmgWKnAUO+Uj4CfkPFUOeBUN4BUZQBWMvBYH7JQWj+wwFxi0F2F0FyYsF2LkFxukFo/cMBYH3JQVj5wVq9x4VjYoFkYgFkYgFjIoFjYoF4EEFi4sFjIoFj4UFkIUFi4oFjIoFuSEFjIQFjYUFlvsyBYqGBYuGBXH7GQWIhQWJhAVH+wIFiYoFiokFhocFh4YFiYoFiooFKVEFh4kFiIkFhooFh4oFh4sFh4oFM4sFh4wFh4sFh4wFhowFiI0Fh40FKcUFiowFiYwFh5AFho8Fio0FiowFRvcCBYmSBYiRBXH3GQWLkAWKkAWW9zIFjZEFjJIFufUFjIwFi4wFkJEFj5EFjIwFjIsF39UFjYwFjIwFkY4FkY4FjYwFjYsF6aMFjowFjowFkYoFkYwFjooFjooF6XMFDvlI9/v5ZRWQjgWNjAWNjAWSiwWSjQWMigWNiwWSigWSiQWMigWNiwWRhwWQhwWMigWNigWOhQWPhQWMigWLiQWMhQWNhAWL/REFh3sFgX0FfYIFeogFeY4FfZQFgZkFiJsFi/i2BTRFBXuDBXqJBXqPBX2WBYOZBYmbBY+bBZaYBfc19xUFDvlI90rmFffoiwWdiAWZggWVfQWOewWIewWBfQV9ggV5iAX8TosFg4wFg4wFiowFiosFhY8FhI8Fi4sFiowFhpEFh5EFi4wFiowFipIFiZIFi4wFi4wFjJIFjJIFjIwFi4wFj5EFj5EF9zn3PgX3L/dKBcTlBZezBYueBYOqBXeiBV6dBUaQBWaGBVBzBWttBX9mBYN9BX6ABXqGBXmNBXyTBYCYBYaaBYycBZu6BYuMBYyNBY+QBY6RBYyMBYyNBbi2BYuLBYuLBZOQBZKQBYuLBYuLBdWoBZCNBZGMBbqSBZCKBZCMBd2FBZKJBZKKBclxBYyKBY2LBZCHBZGHBYyKBY2JBaxlBYyKBYuKBY+FBY6EBYuKBYyKBZdeBYuFBYyGBYptBYqGBYuGBX1ZBYiFBYmGBUwpBYmJBYqJBfsy+04FiooFiooFDvlI9wqUFYeMBVObBXySBX+YBYabBY2bBZOaBZmVBZuQBZ2KBcB8BdeABeiJBb2WBdGxBbW2BZy5BYOvBWWzBUStBTSiBT2UBYiMBYiLBYWOBYaMBYmNBYiNBYePBYeOBYmOBYmNBYmQBYmQBYuOBYqOBYuQBYuRBYyNBYuOBY2QBY2QBY2NBY2OBY+PBY+PBY6MBY2NBZCNBZGNBY6LBY6MBduVBeKdBdGpBauoBZGqBXWtBV2uBUagBTyPBUp2BVZxBWhxBXyEBXmKBXuQBX2WBYOZBYqcBZCaBZeYBbCnBY+MBY6OBceoBY6MBY6NBdikBZOMBZSMBemGBZCKBZGKBd1yBZKIBZOHBcVeBZCGBZCGBa9UBY2EBY6FBYuKBYyKBYqEBYuDBYBQBYmHBYqHBYmIBYmHBYiIBYiHBVxfBYWGBYSHBUduBdFqBZGGBZKHBcBUBYyIBY6JBY2GBY6HBYuIBY2HBZZQBYuJBYyIBYqFBYuGBYqIBYuJBXNKBYuLBYuLBYeEBYaEBYuLBYuLBVZUBYWHBYaHBTlfBYWJBYWIBU19BYWLBYWKBSeNBYiMBYiLBTmWBQ75SPgF98IVi+oFj5sFlJgFmpUFnI4FnIgFmoEFlX4FjnsFiywF6YsFnIcFmoIFlX0FjnsFiHsFgX0FfIIFeogFLYsFi/s9BYh7BYF9BXyCBXqIBXqOBXyUBYKZBYebBYv3PQX71IsFhIwFhYwFiYwFiYsFhY8FhY0Fio0FiYwFh5AFh5AFi40FiY0FipEFiZEFi40Fi40FjJEFjJEFjI0Fi40Fj5EFjpAF+Ab4PgWYlgWcjwWcigWbgwWWfgWQfAWKegWCfQX7yfv5BQ75SKn5QRWOmwWVmQWalAWcjwX4WIsFnIcFmoIFlX0FjnsFiHsFgX0FfIIFeogF/CuLBYv7dwX3HakFk4sFk4wF9x57BZOIBZOJBcJuBZGGBZGHBbFiBYyJBYyKBY6FBY+FBYuKBYyJBaj7BAWLigWLigWLhAWMhAWKigWLiQV9UQWLiwWLigWHhAWIhAWLiwWKigVnXgWFhQWFhgVFYQWFiQWFiAU5dQWGigWGigU+hwWFjAWGiwVKlwWGjQWGjAVWogWGjgWFjwVUugWAmAWHmwWOmwWUmQWZlQWcjwWciQWaggW9YQW0eQXCgQXNjgXSngXFrgWlqwWUswVz5wVxpwVjoAX7DZkF+01iBYaLBYaKBYeMBYiKBYaNBYaMBYiNBYeMBYePBYeNBYmOBYiNBYmQBYiPBYuOBYmPBYuPBYqQBQ75SPch96QVi4sFi4sFbW4FioMFnlkFm24FtWEFtHIFzoEF2o8FxaMFsqoFnrMFjaoFf7MFeKwFcqQFZ5sFUJcFU44FU4MFU28F+yxcFYqPBYyRBYy5BYuLBYuLBY7cBY2RBYyRBafaBYyNBYuNBbTfBZCSBZCRBcC7BY6NBY2NBdC4BZGOBZCOBdykBYyLBYuLBeKlBZ2NBZuGBZmBBZN8BY17BYZ7BYB+BXyDBTRyBUFzBU9kBV5jBWdABXJEBYp7BZGOBZCPBdGtBZKNBZKOBc6UBZCLBY+LBcuJBY+KBY+LBc58BZCKBZCJBbt2BZKGBZKHBa5oBY6GBY+GBaNhBYyHBY2HBZpZBYyEBYyFBYlbBYuLBYuLBYmDBYmDBYuLBYuLBW9UBYuKBYqKBYaGBYeFBYqKBYqLBVhiBYaIBYaIBUNtBYOJBYOJBS+GBYeMBYaLBTmXBYqLBYqLBYSOBYOOBYuLBYqLBVasBYiPBYaNBVq8BYeQBYeQBXaxBYqOBYqOBXXHBYqSBYmTBQ75SPfP90gVg/saBYd7BYF+BXyCBXmJBXqPBX2VBYKZBYmbBZL3HAWMjQWLjQWc9wcFi4wFjI0Fms0FjI0Fi4wFnsYFjIwFi40FoL4FjIwFi40ForcFjIwFi40Fo7EFjIwFjI0FoqoFjI0FjIwFoqYFjYwF+96LBXmOBX2UBYGZBYibBY6bBZWZBZmUBZ2PBfhfiwWQigWQigWOigWPigWPiAWQiQWOiQWNiQWOhwWPhwWMiAWNiAWMhgWNhgWLiAWMiAWJhgWLhgWKiAWKiAWIhwWJhgWIiQWJiAWHiAWHiAVqeQV9gQVkaAV3dAV2bgV1aAV2YgV4WwV5UwV8TAUO+Uj3pvf2FUR0BUpaBXBZBYleBaZdBcVnBdlzBciJBeCmBb6wBaLEBYLEBWK1BTi2BVKfBdH3sxU4kQVLgAVXcwVrXQWVaQW4ZQW/bAXDeAWwlgXetQWdpgWMwwV1rwVr9wEVi4sFk4gFk4kFi4sFjIsF0GgFjokFj4kFjocFj4gFjYgFjYgFrVIFjIkFjYgFjIYFjYYFiogFjIgFiTwFi4gFi4kFiYUFioYFiYkFiogFbVwFiYkFiYgFh4gFh4cFiIoFiYkFUm4F0mYFkIcFkYcFw1IFjYcFj4gFjIcFjYgFjIYFjIcFmDoFi4kFi4kFioUFi4UFiokFiokFbDwFiYcFiogFh4cFiYgFiIgFiIkFR1sFhYgFhYcFJ2sFg4oFg4oFP40FhY0FhIsFMqcFho4FhY0FQ7gFio0FiYwFho8Fh5AFio0FiYwFZc0Fio4Fio4FipAFiZAFjI4Fio4Fjs0Fi4wFi4sFjZMFjZIFi4wFi4sFr80Fi4wFjIwFkJAFkJEFi4wFjIsF2sYFkY4Fko8FmI8FaZ8FiI4Fh40FUrwFiY0FiI4FiY8FiI8Fio4FiY4FeMsFi40Fi4wFipIFi5IFi4wFi4wFjpIFjZIFjIsFjI0Fu9IFjo4FjY4Fj44Fj44Fjo0Fjo0F0KsFkYwFkY0F15gFkIsFkYwF7YQFDvlI+Fr4mBWVnQV8xwVwqwVfoAVIkwVHgwVTdAVnagV+XwWYYAWvaQXDdAXMhAXMmgW8qgVf/BoVi4oFZ0IFgX4FfIIFeYgFeo8FfZUFgpkFiJsFj5sFr9QFtuoFwPcXBYuLBYuMBZKcBT55BYOKBYKLBTuUBYWNBYWMBUWoBYSPBYSQBVm6BYqNBYmMBYiQBYeQBYuOBYqNBXfNBYqOBYqOBYyQBYqQBYyOBYyPBZ/NBYyNBYuNBY+QBY6QBY2NBYyNBb26BZKPBZKQBdGnBZGMBZGNBduVBZGKBZGMBduBBZKJBZKJBcdvBYyKBYyLBZGGBZGHBYuKBYyKBbNcBYyKBYyKBY6FBY6FBYuJBYyKBZ83BYuFBYyEBYqJBYuJBYmFBYmGBYqHBUH7SAVW+xgFi4oFiooFXysFDvlI9y/3yxX4OvtDBZqBBZR9BY57BYd7BYF9BXyCBXqJBXqOBfyY92oFhI8FhY8FiowFiowFh5EFh5EFi4wFiosFipMFiZIFi4wFi4wFjZIFjJIFjIwFi4wFj5EFj5EFjIwFjIsFkY8Fko8F+Jj3agWcjwWciAWaggWVfgWPewWIegWCfQV8ggUO+Ui2+GkV+JiLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfyYiwV6jgV8lAWBmQWImwWOmwWVmQWalAWc+4gV+JiLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfyYiwV6jgV8lAWBmQWImwWOmwWVmQWalAUO+Uj44/fpFYyKBY+FBY+FBYuKBYyKBYyEBY2EBYuKBYuKBYmEBYqDBYqLBYuKBYeFBYeFBYqKBYqKBYWHBYSHBfyY+2oFeogFeo0FfJQFgZkFh5sFjpsFlJkFmpUF+Dv3QwX8O/dDBXyUBYKZBYicBY+bBZWYBZqUBZyOBZyHBfiY+2oFkocFkYcFDvlI+Ev3kxWGigX7q4sFi4sFLPtyBYF9BX2CBXqIBXmOBX2UBYGYBYecBY6bBfek+REFkJIFkJIFi4sFi4sFko8FkpAFi4sFjIsFk40Fk40FjIsFi4sFk4kFlIoFi4sFi4sFkoYFkocFjIsFi4sFkIQFj4QF97r9EQWPewWIegWBfgV9gQV6iAV5jgV9lAWBmAX7IvfIFfsB94AFJvuABQ75SPe++GUV2bYFlMsFTL8F+weeBSmGBYv7VgX32vxEFYSJBYmLBYmLBfv7hwWKiwWLiwWDjAWCjQWLiwWLiwWEjwWEkAWKiwWLiwWGkgWHkQWLjAWKiwWKkwWJkgWLjAWLiwWL+QoFjJIFjZIFi4wFi4wFkJEFjpEFjIwFjIwFkY8FkY8FjYsFjIwFkowFk40F9yWTBZCKBZCLBfcZdQWOigWPigWQiQWQiQWNiQWOiQXlQQWNiAWPiQWNhwWOhwWMhwWNiAWLhgWMhwWLhwWLhwV9+wAFiokFi4gFiIYFiYYFiYkFiogFh4cFh4cFiIoFiYkFSGYF9wJmBY6JBY+KBY+IBY+JBY2IBY6IBdE3BY6GBY6FBYyJBYuKBYyEBYyEBYX7AAWLiQWLiQWJhQWJhQWKiQWKiQVsWwWIiQWKiAWHiAWHhwWIigWIiQU+ZAWJigWJigVu3BXEqAWeqAWP3QVYyQX7JLsF+1CWBYv7nAUO+Uj4ZPclFaDbBZOZBZiXBZuQBZ2KBZuEBZd/BZF7BYp7BXIwBYqIBYqHBYiHBYmHBYiIBYmIBUNLBYiJBYmJBYaJBYaIBYiLBYiJBSl1BYuLBYuLBYOLBYKLBYuLBYuLBfsEnAWJiwWKjAWEjQWEjgWKjAWKiwVRsQWFkQWFkQVU3QWLiwWLiwWIkwWIkgWLiwWLiwVm918Fi5MFi5MFuvdeBYyMBYuNBY+RBY2RBY2MBYyNBc7XBYyMBYuLBZGQBZKQBYuLBYuLBdGsBZKNBZKOBdqVBYyLBYyLBZOKBZKLBYyKBY2LBfVqBYyLBYyLBZKHBZGHBYyLBYyKBcNZBYyLBYuKBZCFBY+FBYyKBYuLBapEBY57BYh7BYF9BXyCBXqIBXqOBXyVBYGYBXDJBWKwBTSlBU6EBVVxBVRNBWD7TAWt+04FuUgFtG8F6H0F2JwFDvlI93uVFYaKBfs1iAWLiwWKiwWDjAWDjQWKiwWLiwWEjwWEjwWLjAWKiwWHkgWGkQWLjAWLiwWJkwWJkgWMjAWKiwWT+QQFjJAFi5EFjY0Fi48Fj48FjY8FjY4FjY0FkI4Fj44Fjo0FjowFkIwFkY0F7pgFj4sFjowF14kFkYoFkIsF9xBrBYuLBYuLBZOHBZKIBYyLBYuKBeZIBYyKBYuLBZCFBZGFBYuLBYuKBb8wBY2FBY6GBaAsBYuHBYyHBY1EBYqHBYuIBYJOBYmHBYqHBXhXBYeFBYmGBUw8BYWGBYWGBTdZBYWJBYWIBfsdaAV53hX3EasF0rUFwM4Fm7UFlMAFicsFeOAFXtoFPsQF+wGnBUiMBVGDBYX8tAUO+Uj3EeUV+CGLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfxOiwV6jgV8lAWCmQWHmwWL99MFi/fSBY+bBZSZBZqUBZyPBfhOiwWchwWaggWVfQWOewWIewWBfQV8ggV6iAX8IYsFi/t+BfeciwWdiAWZggWVfQWOewWIegWBfgV9ggV5hwX7nIsFDvlI9xf32hWL+6oFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/kRBY+bBZWZBZmUBZyPBZ2HBYyKBfgviwWciAWZggWVfQWPewWHewWBfQV9ggV6iAX8FYsFi/t4BffQiwWdiAWZggWVfQWOewWIewWBfQV9ggV5hwUO+Uj4fve0Ffs1iwV6jwV9lAWBmQWImwWOmwWVmQWZlAWdjgX3bIsFj4oFkIsFj4kFj4oFj4kFj4kFjogFj4kFjYgFjocFjYgFjYcFjIcFjYcFi4cFjIcFiocFi4cFXvtaBYqJBYuIBYiGBYiGBYmJBYqJBUtGBYmKBYqJBYWIBYaHBYmKBYmKBTpwBYqLBYuKBYOKBYOKBYqLBYqLBTWSBYSNBYSNBTmuBYWOBYaOBUfCBYaQBYaQBV/QBYuMBYqMBYmRBYiSBYuMBYuMBXf3UgWLkQWLkgWx90IFjIwFi40FjpEFjpEFjIwFjI0FzdsFjIwFi4wFkZAFkY8FjIwFjIsF37QFi4sFi4sFk40Fk44Fi4sFi4sF9xeVBZKKBZGLBfcQcQWbhQWXfwWRfAWLegWEfAV+gAV7hQV5iwX7CKMF+weCBUhrBVZJBWj7MwWe+0IFrlUFxFwF0W4Fz4UFx6AFvL8FDvlI+H74OhWL95sFj5sFlJkFmpQFnI8FnIcFmoIFlX0FjnsFi/0RBYh7BYF9BXyCBXqIBXqOBXyUBYKZBYebBYv3tgX8DosFi/u2BYd7BYJ9BXyCBXqIBXqOBXyUBYGZBYibBYv34AWL98UFjpsFlZkFmpQFnI8FnIcFmoIFlH0Fj3sFi/ubBQ75SPfu+UEVi/0RBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv5EQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Ui/9z4Vio4Fia8FjpsFlJkFmZUFnY4FnIkFmoIFlX4Fj3sFjGsFkXIFlXYFmXkFnX0FunoFzoQFu5EFwp8FoJkFnJ0Fl6EFk70FivhxBY6bBZWZBZqUBZyPBZyHBZqCBZR+BY96BYz8dAWKiAWLiAWCTgWJhQWJhAV5awWHhgWIhwVycQWHiAWIiAVtdwWGiQWGiAVKcwWGigWFigVRhAWGiwWGiwU8kwWFjAWFjAVRoQWFjwWFjQVvoQWHjwWHjgV2pQWJkAWIjwV+qAWKkAWJjwWEqwUO+Uj3Uff3FfsBOQWL+3UFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/kRBY+bBZWZBZmUBZyPBZ2HBZmCBZV9BY57BYv7xAX4Hve7BZuSBZyNBZyGBZiABZR8BYx7BYZ7BX9/Bfui+14F9+b70AWVfQWPewWHewWCfQV8ggV6iAV6jgV8lAUO+Uj3DOUV+CuLBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqIBfxYiwV6jgV9lAWBmQWHmwWL+REFj5sFlZkFmZQFnI8FnYcFmYIFlX0FjnsFDvlI+KH5WxWOjwWNjQWNjQWRjQWPjgWOjAWOjAWRjAWRjAWOigWOiwWQiQWRigWNigWOigWQhwWPiAWNiQWNiQWOhgWOhgWMiQWMiAWLhgWNhQWL/REFh3sFgX0FfYIFeogFeY4FfZQFgZkFiJsFi/h1BftD+6wFiYkFiokFhocFh4cFiYkFiYoFhYkFhYgFiYsFiIoFhYwFhYoFiIwFiYsFhY4FhY0FiYwFiY0Fh48Fho8Fio0FiY0F+0P3rAWL/HUFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/kRBY2RBYuQBYyOBYyNBY6QBY6QBY2NBY2NBY+OBZCPBY6MBY2MBZGMBZCNBY6LBY6MBZGKBZGKBY6KBY6KBY+IBZGJBY2JBY2JBY6HBY+HBfdw+/UF93D39QUO+Uj4e/dPFYT4hgWOmwWVmQWZlAWcjwWdiAWZggWVfQWPewWU/REFioYFi4cFiocFiocFiYgFiYcFiIgFiIcFiIkFiIgFh4kFh4kFh4oFh4oFhosFh4oFhosFh4sFh40Fh4wFh40Fh4wFiI4Fh44FiI4FiI4F/BT4oQWL/IkFh3sFgn0FfIIFeogFeo4FfJQFgZkFiJsFi/kRBYyPBYuPBYyPBYyPBY6PBYyOBY6OBY6PBY6NBY6OBZCNBY+NBY+MBY6NBZCLBZCMBY+KBY+LBY+JBZCKBY+JBY6KBY+IBY+IBY2IBY6IBQ75SPgblBWFiAWJiwWJiwUzgAWKiwWKigWEjAWDjAWKiwWKiwUypQWJjAWIjAWGjgWGjgWJjQWJjAU62gWJjgWIjgWJjwWIjwWLjwWJjgVP96AFi40Fi4wFi5IFi5IFjIwFi40FxPddBY2PBYyPBY6OBY2PBY6NBY6PBdHEBYyMBYyMBZKOBZGOBY2LBYyMBfcOqQWPiwWPjAWQigWPjAWPiQWPiwX3B2cFjIoFjYsFkYcFkYgFjIoFjYkFzkoFjYgFjYkFjocFjYYFjIgFjIgFxfuJBYuDBYuDBW/7LgWIhAWJhQVYMgWKiQWLigWGhgWGhgWKigWKigUwTgWJigWKigUg0BXOkwXUvAW11gWl9x8FVvd1BVm8BTCoBShzBVdgBVj7RgXD+4sFy00FDvlI93j3xxWJigX7AooFi/uVBYd7BYF9BX2CBXqIBXmOBX2UBYGZBYibBYv5BQWMkQWMkgWMjAWLjQWPkQWOkAWNjAWMjQWQjwWRjwWNiwWMjAWSjQWRjAX3HZcFjosFj4sF9w6EBY+KBZCLBdp2BY+KBY+KBa96BZCIBZCIBcRbBYuKBYuLBZCFBZCEBYuLBYyLBaRXBY2EBY2EBZA/BYuJBYuJBYqFBYqFBYqJBYuJBXRcBYqJBYqJBYeHBYeFBYmKBYqKBWhxBYWIBYWIBVN2BYeKBYeJBTp8BYiLBYmLBfsCggWF4BX1kwXWmQW5nAWgmwWZpwWGxAV6sAVesQVxlwVEnQX7BpIFL4MFi/uJBQ75SPiTtRXQOQWTfAWNewWFewWAfwV7gwV6igV6kAV+lQVRzwVUYAWIigWJiQWGiQWGiAWHiwWIigU1fgWJjAWJigWEjAWFiwWJjAWIiwU0qQWJjAWIjAWGjgWGjgWJjgWJjAU75AWKjgWJjQWJkAWIkAWLjgWKjQVQ98MFi4sFi4sFi5MFi5MFi4sFi4wFw/d2BY2OBYyPBY2PBY6PBY2OBY2OBdDLBY2MBYyNBZGOBZGOBY2MBY2MBfcLrAWRjAWRjAWNigWOjAWRiQWRigX3BGMFjYoFjooFj4cFkYgFjIkFjYoFzUEFjIkFjYkFjYYFjoYFjIgFjIkFw/uoBYuEBYuEBW/7QgWJhQWJhQX7K0AVMfUFg5oFipsFkJsFlpcFm5MFnIwFnIYFmIEF0zcFmqkFpfc1BVb3lgVZxAU0qgUucQVXWgVY+2IFwvuvBctDBcx2BcmUBQ75SPfz+EoV3JcFrpgFoJsFlqIFjLMFfbkFgZYFd5gFcZUFQZsF+xSQBfsofgWL+10F90g8FftIhQWL+7cFh3oFgn4FfIEFeogFeo4FfJUFgZgFiJwFi/j8BYyRBYyRBYyNBYuNBY+QBY6RBY2MBYyNBZGOBZCPBY2MBY2MBZGMBZKNBfdUmwWOiwWOjAX3G4UFj4oFj4sF3HoFj4kFj4sFrX0Fj4kFj4kFp3kFj4cFkIgFoHQFi4oFjIsFjoQFj4UFi4oFjIoFnU0FjIUFjIUFiVQFi4sFiYMFiYMFi4sFeWQFiooFi4oFhoUFhoUFiosFi4oFaXAFhIgFhYcFXXoFhooFhokFNX8F94H7rQWTfQWNegWGewV/fwV8gwV5igV6kAV+lgX7nPfLBYOaBQ75SOXBFYaOBYqNBYiNBYmQBYeQBVr3AQWHnAWOmwWVmQWZlAWcjgWdiAWZggWVfgW3KgXNaQX3IIcF7bgFq/AFdsUFS68F+4ezBYiNBYiLBYaNBYaNBYmOBYiMBUu+BYiPBYiOBYmOBYiOBYqQBYmOBXrHBYuPBYqOBYuQBYuPBYyPBYyPBbT3DAWOkAWNkAWNjQWMjQWQjwWPjwXvzAWRjgWQjgWOiwWNjAWRiwWRjAX3R4IFjYoFjIwFkogFkooFjIoFjYoFkIcFkYcFjIoFjIoF1zAFknwFjXoFhXwFgH4Fe4QFeYoFe5AFfpYFTNYF+yOTBUBaBWssBZVoBbZoBfeDYwWTiQWTiAXfWgWQhwWQhwWNiQWMigWOhQWOhgWrNgWLhgWNhwWLhwWLiAWKhgWKhgVi+xgFi4oFiooFh4UFiIQFiosFiooFhYYFhYcFiosFiooF+xJRBYmLBYqKBYSKBYSJBYmLBYmLBfs2jwWJjAWJiwWFjQWEjAWJjAWJjAUzuQUO+Uj3yflsFfeiiwWchwWaggWVfQWOewWIewWBfQV8ggV6iAX7dYsFi/znBYh7BYF9BX2CBXmIBXqOBXyUBYKZBYebBYv45wX7hYsFeo4FfJQFgZkFiJsFjpsFlZkFmpQFnI8FDvlI+HT3hxWQ+E4Fj5sFlZkFmZQFnY4FnIcFmYIFlX0FjnsFhvxQBYqIBYyJBYFHBYqHBYqGBXdYBYmIBYmHBX53BYiHBYiIBW1sBYWHBYaHBVhxBYSJBYSJBU2BBYWLBYSLBTOUBYaNBYWMBUWlBYWPBYWOBVyvBYeQBYWQBWjCBYiRBYiRBXnSBYqPBYqOBYTsBYuNBYuMBYr39wWOmwWVmQWalAWcjwWchwWaggWVfgWOegWM+/UFki8Fm00Fp2EFr28FxXYF14IFu5MFsJ4FoqIFk5cFnLYFDvlI99H3NRX3a/ivBZSZBZqVBZyPBZyIBZqCBZV+BY97BYh6BfuS/REFi4sFi4oFhoUFh4QFi4sFiooFhIcFhYYFiosFi4sFg4kFg4oFiosFi4sFg4wFgowFi4wFiosFhI8FhI8Fi4sFi4wFhpEFhpEFi4wFi4sF+7j5EgWHmwWOmwWVmQWZlAWcjwWciAWaggWVfQUO+Uj4dvdYFdf4gwWQmwWXlwWbkgWcjAWchgWYgAWTfAWMegUq/REFiYcFioYFiYgFiocFiIgFiIcFiIkFiIgFh4kFh4kFh4oFh4kFh4sFhooFh4sFh4sFho0Fh4sFh40Fh40FiI4Fh40FiI4FiI4FiY8FiI4F+0b3/wX7Ofv2BYiHBYiGBYmJBYmJBYaIBYeHBYiKBYiKBYaKBYWJBYiLBYiLBYWMBYaLBYiNBYiLBYaOBYaOBYmNBYiNBYiPBYiPBYqOBYmOBYqQBYmQBTv5CQWNnAWTmQWYlgWckAWcigWbhAWWfgWRewXH/G8F9x/3vgWPkAWPkQWMjAWMjAWRjwWRjwWNiwWMjAWSjAWSjQWNiwWMiwWSiQWTigWMiwWMigWRhwWSiAWMigWMigWPhQWPhQUO+Uj3/Pf/FfeZ+7QFlH0FjXsFhnsFgH4FfIMFeYkFeo8FfpYF+5D3qQX7kPupBX6ABXqHBXmNBXyTBYCYBYabBY2bBZSZBfeZ97QF+5/3uwWCmQWJnAWQmwWWlwWalAWdjAWchwWYgQX3lvuxBfeW97EFmZUFm48FnYoFmoIFln8FkHsFiXoFgn0FDvlI9+j4EhWV++EFiHsFgn0FfYEFeogFeY0FfJQFgZkFh5sFgffjBfud96cFgpkFiJsFj5sFlpkFmpMFnI4FnIcFmYEF94n7kQX3k/eQBZqVBZyPBZyIBZqCBZV+BY96BYh7BYJ9BQ75SPci5RX4KosFnYgFmYIFlX0FjnsFiHsFgX0FfYIFeYgF/IKLBYWMBYaLBYiMBYeMBYeOBYaNBYmNBYiNBYiPBYePBYqOBYmOBYqQBYmPBYuPBYuOBYyQBYuQBYyOBYyOBY6PBY2QBfhP+M4F/CqLBXmOBX2UBYGZBYibBY6bBZWZBZmUBZ2PBfiCiwWRigWQigWOigWPigWPiQWQiAWNiQWOiQWOhwWPhwWMiAWNiAWMhwWNhgWLiAWLhwWKhgWLhgWKiAWKiAWIhwWJhgUO+Uj3h3QV9zaLBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqHBftjiwV5jwV9lAWBmQWImwWL+Z8FjpsFlZkFmZQFnY4F92OLBZyIBZmCBZV9BY97BYd7BYF9BX2CBXqIBfs2iwUO+Ujw+VgV+HH9YwWRfAWKegWEfAV+gAV7hQV5jAV7kQV/lwX8cfljBYWaBYycBZKaBZiWBZuRBZ2KBZuFBQ75SPhWShWHewWBfQV9ggV6hwX7Y4sFeY8FfZQFgZkFiJsFjpsFlZkFmZQFnY4F9zaLBYv5SwX7NosFeY4FfZQFgZkFiJsFjpsFlZkFmZQFnY4F92OLBZyIBZmCBZV9BY97BQ75SPeo+WQVko8FjIsFjIwFkowFk40FjIoFjIwFk4kFkooFjIoFjIsFkocFkYcF9577ggWVfgWPewWIegWBfQV9ggV6hwV6jgV8lAX7f/dmBft/+2YFfIIFeogFeo8FfZQFgZkFiJwFj5sFlZgF9573ggUO+UiL+wEV+O6LBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBfzuiwV6jgV8lAWBmQWImwWOmwWVmQWalAUO+Uj4POoVxcIFi/eQBVLBBVCnBS+LBVBvBUxQBWsvBYtQBaswBcpPBcdvBeaLBfcIZhWHiAWFhwVAZwWKigWJigWEigWFiQWJjAWJigX7BYsFiYwFiYoFhI0FhYwFiYwFiYwFQK8FhY8FhY8FP9MFiowFiowFiJEFh5EFiowFiowFZvYFipIFipIFi9IFjJIFjJEFsPcABYyNBYyMBY+RBY6RBYyMBYyMBdfTBZGPBZGPBdeuBYyMBY2MBZKMBZKNBYyKBY2MBfcFiwWMigWNjAWSiQWSigWMigWNigXWaAWQhwWQiAWLjwWPnAWUmAWalQWcjgWciAWagQWVfgWOegWL/IoFiHsFgX4FfIEFeogFeo4FfJUFgpgFh5sFDvlI9xOvFYaOBYuKBYd6BYF+BX2CBXqHBXmPBX2UBYGYBYicBYv5OAWOmwWVmQWZlAWdjgWciAWZggWVfQWPewWL+3YFkI4FkY8F1asFjIsFjIsFko0Fk40FjIoFjIwF9wSLBYyLBYuLBZOJBZOJBYyLBYuLBddrBZCHBZKIBdZKBYyKBY2KBY6FBY+GBYyJBYyKBbApBYyEBYyEBYtLBYqEBYqDBWYrBYqKBYqJBYeGBYiFBYmKBYqJBUBLBYWIBYWHBUBqBYqLBYqLBYSJBYOJBYqLBYqLBfsEiwWKjAWKigWDjQWEjQWKiwWKiwVBrAWA9w0VwlwFxnEF54sFx6UFycAFqdoFi70FbdsFTcAFT6QFL4sFUHIFVFwFDvlI+DLqFczNBZqVBZyPBZyIBZqDBZV9BY97BYl7BYF9BUVDBYWHBYWHBUZmBYiLBYmJBYWKBYWJBYiMBYmKBSGLBYmMBYiKBYWNBYWMBYmNBYmLBUSwBYWPBYWPBUXTBYqMBYqMBYeRBYeRBYuMBYqMBWn2BYqRBYqSBYvSBYyRBYySBa33AAWMjAWLjAWPkQWPkQWMjAWMjAXR0wWRjwWRjwXSrwWNiwWNjQWRjAWSjQWNigWNjAX1iwWNigWNjAWSiQWRigWNiQWNiwXRZwWRhwWRhwXRQwWVfQWNewWHewWBfQV8gwV6iAV6jwV8lQVKzQVWpgU3iwVVcAVRUAVtLgWLUAWoLwXGUAXCbwXdiwUO+Uj4PfUVwroFi/dxBVS6BVCkBS+LBU9yBU1WBW07BYtZBak8BclWBcdxBeeLBfcGYhWGiAWFhwVBagWKiwWKiwWEiQWDiQWKjAWKigX7BIsFiosFiosFhI0Fg40FiosFiosFQKwFhY8Fho4FP8sFio0FiYwFiJEFh5AFio0FiowFZusFipMFipIFi8sFjJIFjJIFsO0FjIwFjI0Fj5AFjpEFjYwFjIwF18wFkY4FkI8F16sFi4sFjIsFk40Fk40Fi4sFjIsF9wSLBYyKBYyMBZOJBZKJBYyLBYyLBdVrBZGHBZCIBYv3dgWPmwWVmQWZlAWcjgWdiAWZggWVfQWOewWL/TgFiHoFgX4FfYIFeYcFeo8FfZQFgZgFh5wFDvlI9x74IBV8YQX4GIsFg5QFZs0FbaYFS6cFJosFSm8F93r7/BXXzgWZlAWdjgWchwWZggWVfQWNegWIewWAfgU6QwWGiAWFhwU8ZgWJiwWKigWEigWEiQWJiwWKiwX7DYsFiosFiosFg40FhIwFiowFiosFOrAFhY8FhY4FO9MFiYwFiowFh5EFh5AFi40Fio0FY/YFipIFipIFi9IFjJIFjJIFs/cABYyNBYuNBY+QBY+QBYyNBY2MBdvTBZKOBZCPBdyvBYyLBYyMBZOMBZKNBYyLBYyLBfcNiwWMiwWMiwWTiQWSigWMigWMiwXbZwWQhwWRiAW1ZwWPhQWQhQWyRAWQewWJegWDfQV/ggWUhQWVfgWOegWIewWBfQV9ggV5iAX8SYsFi3UFrDAFz08FzG4F8IsFDvlI97n4VhWL/CQFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/gkBfsGiwV6jgV8lQWCmAWHmwWPnAWUmAWalQWcjgX3BosFi8AFi40Fi40FjZEFjJEFjY0Fi4wFwOoFkZEFkJEFi4sFi4wFk44Fko8F9asFkowFkowF9YsFnIgFmoIFlX0FjnsFiHsFgX0FfIIFeogFKIsFOXIFZEUFi2EF9zuLBZyIBZqBBZV+BY56BYh7BYF+BXyBBXqIBQ75SPg99yMVwroFi/dxBVS7BVCkBS+LBU9yBU1WBW06BYtaBak7BclWBcdxBeeLBfcGYhWGiAWFhwVBagWKiwWKigWEigWDiQWKiwWKiwX7BIsFiosFiosFg40FhIwFiowFiosFQKwFhY8FhY4FQMwFiowFiYwFiJEFh5AFio0FiowFZuwFipIFipIFi8wFjJIFjJIFsOwFjI0FjI0Fj5AFjpAFjY0FjIwF1swFko4FkI8F16sFi4sFjIwFk4wFk40Fi4sFjIsF9wSLBYyLBYyLBZOJBZKKBYyKBYyLBdVrBZGHBZCIBYuLBY+cBZWYBZmVBZyOBZ2IBZmBBZV+BY56BYv8mAWKhAWKhAVmKgWKigWKiQWHhgWIhQWJigWKiQVlawWFhwWFhwVBbAWKigWKiwWEiQWDigWKiwWKiwX7BIsFiosFi4sFg4wFg40FiosFi4sFP6sFho8FhI8FQMsFio0FiYwFiJAFh5AFio0Fio0FZuwFiZwFj5sFlZgFm5QFnI0FnIcFmYEFlH0FrDQFyVYFx3EF54sFxqUFpKAFqdoFDvlI+L34CRWNhAWL+9AFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/fIBW7TBVqfBSyLBU1yBS49BYv7vQWIewWBfQV8ggV6iAV6jgV8lAWBmQWImwWL+SwFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/uSBbKsBZGOBZGPBdeqBYyLBYuMBZOMBZONBYyLBYuLBfcGiwWMiwWLiwWTiQWTigWMigWLiwXXbAWLiwWLiwWShgWShwWLigWMiwWPhAWQhQWLigWLiwWxLAUO+Uj3mfmIFduLBZyIBZqCBZV9BY57BYh7BYF9BXyCBXqIBTuLBXqOBXyUBYGZBYibBY6bBZWZBZqUBfH7mRWL/E4FiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/hOBY6cBZWYBZqVBZyOBZyIBZqBBZV+BQ75SPgV+YgVyYsFnIgFmoIFlX0FjnsFiHsFgX0FfIIFeogFTYsFeo4FfJQFgpkFh5sFj5sFlJkFmpQF+wn+MhWGigWIjQWHiwUpqQV8kwWAmAWGmwWNmwWUmQWZlgWbjwWdiQXhcQXpoQWhyQWL+I4Fj5sFlJkFmpQFnI8FnIcFmoIFlX0FjnsFi/yVBYqEBYqFBWswBYiGBYmHBYmIBYmIBYeIBYeIBYiJBYiJBYaKBYaJBfsXbQWIiwWHigUO+Uj3f/eMFfsRLwWLIQWIewWBfQV8ggV6iAV6jgV8lAWCmQWHmwWL+SwFj5sFlJkFmpQFnI4FnIgFmoIFlX0FjnsFi/xXBff495sFm5IFnIwFnIYFmIEFk3wFjHoFhnwFgH4F+2v7MgX3mPtwBZV+BZB7BYh7BYJ9BX2BBXqHBXqNBXyTBQ75SPfu+WMVi/0xBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv5MQWOmwWVmQWalAWcjwWchwWaggWVfQUO+Uj43/iYFZCGBYuKBYyJBYyFBY2EBYuKBYyJBYv8WwWHewWBfQV9ggV6iAV5jgV9lAWBmQWImwWL+EgFfJYFXIsFdHgFVDEFi/vmBYh7BYF9BX2CBXmIBXqOBX2UBYGZBYebBYv36gVo4wV1nAVdiwVzeAVVMQWL++YFh3sFgX0FfYIFeogFeY4FfZQFgZkFiJsFi/h9BY6cBZWYBZmVBZ2OBZyIBZmBBZV+BY2ABa2mBZGOBZGPBY2LBYyMBZKLBZKNBduLBZKJBZKLBYyKBY2LBZGHBZGIBbZoBYyJBY2KBY+GBY+GBYuJBY2JBZN1BZynBZCQBZCRBbWtBZGPBZGPBY2LBYyMBZKLBZKNBdyLBZKJBZKLBYyKBY2LBZGHBZGIBbZoBYyKBYyKBQ75SPi++B0VjIUFi/vyBYh7BYF9BXyCBXqIBXqOBXyUBYGZBYibBYv36wVt3QVaoQUtiwVPcAUsMwWL++AFiHsFgX0FfIIFeogFeo4FfJQFgZkFiJsFi/h9BY6cBZWYBZqVBZyOBZyIBZqBBZV+BY56BYtlBbCtBZKPBZCPBdiuBYyLBYyMBZKMBZONBYyLBYyLBfcGiwWMiwWNiwWSiQWSigWMigWNiwXWaAWMiwWLiwWShgWRhgWMiwWLiwWPhAWPhAWLiwWLiwWyIQUO+Uj37Ph4FTWLBVRwBU9PBWwvBYtQBaowBcdPBcNvBeCLBcKnBcfHBarmBYvGBWznBU/HBWH3AxWNjAWRiQWSigWNiQWNiwXTaAWRhgWRhwXTQwWLigWMiwWPhAWPhQWLigWMigWv+wAFjIUFjIQFi0QFioQFioUFZyAFiooFi4oFh4QFh4UFiosFi4oFQ0MFhYcFhYcFQ2YFiYsFiYkFhYoFhIkFiYwFiYoF+wCLBYmMBYmKBYSNBYWMBYmNBYmLBUOwBYWPBYWPBUPTBYuMBYqLBYeRBYeSBYuMBYqMBWf2BYqRBYqSBYvSBYySBYyRBa/3AAWMjAWLjAWPkQWPkgWMiwWLjAXT0wWSjwWQkAXTrgWNiwWNjQWSjAWRjQWNigWNjAX3AIsFDvlI9xTXFYWPBYv7dQWHewWCfQV8ggV6iAV6jgV8lAWBmQWImwWL+TMFjpwFlZgFmpUFnI4FnIgFmoEFlH4Fj3oFi4sFkY8FkI4F1asFjIsFjIwFk4wFko0FjIsFjIsF9wSLBYyLBYuLBZOJBZOKBYyKBYuLBdZsBZGHBZGHBdZLBY2KBYyJBY+GBY+GBYuJBY2JBa8rBY2EBYyDBYtLBYqEBYmEBWYsBYqJBYuJBYeGBYeFBYqKBYmKBUBLBYWHBYaIBUBqBYqLBYqKBYOKBYSJBYqLBYqLBfsEiwWKiwWKiwWDjQWEjAWKjAWKiwVBrAWA9w0VwlwFxnEF54sFx6UFyb8FqdoFi7wFbdsFTb8FT6QFL4sFUHIFVFwFDvlI+D33JRXCugWL924FVLoFUKQFL4sFT3IFTVcFbTsFi1oFqTwFyVcFx3EF54sF9wZiFYaIBYWHBUFqBYqLBYqLBYSJBYOJBYqMBYqKBfsEiwWKjAWKigWEjQWDjQWKiwWKiwVArAWGjgWFjwVAywWJjAWKjQWHkAWHkAWLjQWKjQVm6gWJkgWKkwWLywWMkgWNkgWw6wWMjQWLjQWPkAWPkQWMjAWNjAXWywWRjwWRjwXWqgWLiwWMjAWTjAWTjQWLiwWMiwX3BIsFjIsFjIsFkokFk4oFjIoFjIsF1WwFkIcFkYgFi4sFj5sFlJkFmpQFnI4FnIgFmoIFlX0FjnsFi/00BYh7BYF9BXyCBXqIBXqOBXyUBYKZBYebBQ75SPfp+MsVk40F9yaLBZyIBZmBBZV+BY96BYd7BYF+BX2BBXqIBfsdiwU4bgU5TwViNAWL+6MFiHsFgX0FfYIFeYgFeo4FfZQFgZkFh5sFi/h9BY+cBZWYBZmVBZyOBZ2IBZmBBZV+BY56BYtWBdTABZGNBZGPBeutBQ75SO6nFYSQBYuLBYuMBYeSBYeSBXLSBYmcBY+bBZaYBZuTBZyNBZyGBZmBBZN9BZ9TBbt0BfWLBeSsBbuhBYuoBVHCBfsBygX7BIsFiYsFiosFhI0FhIwFiowFiYwFQK8FhY8Fho8FiowFiYwFiJEFh5EFi4wFio0FipEFipIFi9IFjJMFjZMFi4sFi4wFkJEFj5IF1tMFjIsFjIwFkY8Fko8FjIsFi4wF764Fk4wFk40F9xGLBYyKBY2MBZKJBZKKBYyKBY2KBdZoBZmBBZN8BY17BYd7BYB+BXyDBXmJBXqPBUqqBSGLBTluBVRWBYtuBbN4BfcGiwWOigWPiwWQiQWQigWOigWPiQX3EEQFj4cFkIgF1kQFj4QFkIQFi4sFi4sFjYMFjIMFi0MFioUFioQFiooFi4kFh4UFiIYFiYoFiokFhYgFhoYFQGgFiYsFiYkFJ2cFg4oFg4kF+xGLBYmMBYmKBYWNBYSMBYmMBYqMBUCvBQ75SPdd+DEV+wyLBXqOBXyUBYGZBYibBY6bBZWZBZqUBZyOBfcMiwWL9zcFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/s3BfdDiwWciAWaggWVfQWOewWIewWBfQV8ggV6iAX7Q4sFi/uCBbNMBeF0BfOLBZyHBZqCBZV9BY57BYh7BYF9BXyCBXqIBfsCiwWFjAWFjAX7AqgFg48FhI4Fi4sFiowFhpEFhZAFVOIFio4FiY4FipAFiZAFjI4Fio4FDvlI+GX3SRWL9+AFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/x9BYh6BYF+BXyBBXqIBXqOBXyVBYGYBYicBYuyBWZpBYWHBYWHBT9oBYmKBYqKBYSKBYSJBYmMBYqKBfsGiwWJjAWKigWEjQWEjAWJjAWKjAU/rgWEkAWEkAWLiwWLiwWHkgWHkgVk9AWKkgWKkQWL9/IFjpsFlZkFmpQFnI4FnIgFmoIFlX0FjnsFi/vrBak6Bb10BeeLBcinBQ75SPfB9xcV92j4JgWWmAWakwWcjQWchwWZgQWUfQWNegWHewX7kfxyBYiHBYiGBYiJBYqJBYaIBYaIBYiKBYiKBYaKBYWKBYiLBYiLBYWMBYaMBYiMBYiMBYaOBYaOBYqNBYiNBYiQBYiPBfuQ+HIFhpsFjZwFlJkFmZUFnI8FnIkFmoMFln4FDvlI+Fj3TRX29+kFk5oFmZUFm5AFnYoFmoMFl34FkHsFiXsF+yr8cgWIhwWKhwWIiAWKhwWHiQWIhwWHiQWIiQWGiQWHiQWHiwWHigWHiwWGiwWHjAWHiwWHjQWGjQWIjQWHjQWIjwWIjQWJjwWIjgWKjwWIjwUg9+kFIPvpBYiHBYqHBYiIBYmHBYiJBYiHBYeJBYiJBYaJBYeJBYeLBYeKBYeLBYaLBYeMBYeLBYeNBYaNBYiNBYeNBYiPBYiNBYmPBYiOBYqPBYiPBfsq+HIFiZsFkJsFl5gFmpMFnYwFm4YFmYEFk3wF9wD76QX29+kFjY8FjI8Fjo4FjY8Fj44Fjo4Fjo0Fj40Fj40Fj40Fj4sFj4wFkIsFkIsFj4oFj4sFj4kFkIkFjokFjokFjogFj4gFjYcFjogFjIcFjYcFDvlI+AL3pxX3evtlBZV+BY97BYh7BYF9BX2BBXqIBXmOBX2UBft992YF+337ZgV9ggV5iAV6jgV9lQWBmQWImwWPmwWVmAX3evdlBft692UFgZgFh5sFjpwFlZgFmZUFnI4FnYgFmYMF9337ZwX3ffdnBZmTBZ2OBZyIBZmBBZV+BY56BYd7BYF+BQ75SOj7TxWDigWLiwWLiwVjiwV6jgV8lAWBmQWImwWOmwWVmQWalAWcjgWqiwXLpQXOwQXJ7gX7dfg4BYebBY2bBZSaBZiVBZyPBZ2JBZqDBZZ+BfdX/AEF91n4AQWWmAWakwWdjQWbhwWZgQWUfAWNewWGewX7gfxMBYuKBYqJBT37EQWGhQWGhgU9TAWEiAWGhwU8bAWLiwWLiwUO+Uj3UtkV98+LBZ2IBZmCBZV9BY57BYh7BYF9BX2CBXmIBfwsiwWEjAWFiwWJjQWIiwWGjgWGjgWJjQWJjAWHkAWHkAWKjQWKjQWKkQWJkAWLjgWLjQWMkQWLkQWNjQWLjQWPkAWOkQX38vguBfvPiwV5jgV9lAWBmQWImwWOmwWVmQWZlAWdjgX4LIsFkooFkYsFjYoFjooFkIgFkYgFjIkFjYoFj4YFj4YFjIkFjIkFjIUFjYYFi4gFi4kFioUFi4UFiYkFi4kFh4YFiIYFDgAAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAAK0AAACtAAAArQAAA==";var A2e,iat;function uBn(){if(iat)return A2e;iat=1,A2e=function(n){return n!=null&&(t(n)||e(n)||!!n._isBuffer)};function t(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function e(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&t(n.slice(0,0))}return A2e}var c2e,rat;function dBn(){if(rat)return c2e;rat=1;var t=uBn(),e=Object.prototype.toString;return c2e=function(o){if(typeof o>"u")return"undefined";if(o===null)return"null";if(o===!0||o===!1||o instanceof Boolean)return"boolean";if(typeof o=="string"||o instanceof String)return"string";if(typeof o=="number"||o instanceof Number)return"number";if(typeof o=="function"||o instanceof Function)return"function";if(typeof Array.isArray<"u"&&Array.isArray(o))return"array";if(o instanceof RegExp)return"regexp";if(o instanceof Date)return"date";var i=e.call(o);return i==="[object RegExp]"?"regexp":i==="[object Date]"?"date":i==="[object Arguments]"?"arguments":i==="[object Error]"?"error":t(o)?"buffer":i==="[object Set]"?"set":i==="[object WeakSet]"?"weakset":i==="[object Map]"?"map":i==="[object WeakMap]"?"weakmap":i==="[object Symbol]"?"symbol":i==="[object Int8Array]"?"int8array":i==="[object Uint8Array]"?"uint8array":i==="[object Uint8ClampedArray]"?"uint8clampedarray":i==="[object Int16Array]"?"int16array":i==="[object Uint16Array]"?"uint16array":i==="[object Int32Array]"?"int32array":i==="[object Uint32Array]"?"uint32array":i==="[object Float32Array]"?"float32array":i==="[object Float64Array]"?"float64array":"object"},c2e}var l2e={exports:{}},sat;function hBn(){return sat||(sat=1,(function(t){(function(){function e(n,o){if(typeof o!="function")return n;var i={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(i[o(r,n[r])||r]=n[r]);return i}t.exports?t.exports=e:window.rename=e})()})(l2e)),l2e.exports}var g2e,aat;function pBn(){if(aat)return g2e;aat=1;var t=dBn(),e=hBn();return g2e=function n(o,i){var r=t(o);if(r!=="object"&&r!=="array")throw new Error("expected an object");var s=[];r==="object"&&(o=e(o,i),s={});for(var a in o)if(o.hasOwnProperty(a)){var A=o[a];t(A)==="object"||t(A)==="array"?s[a]=n(A,i):s[a]=A}return s},g2e}var mBn=pBn();const _Bn=oy(mBn);var u2e={exports:{}},Aat;function cat(){return Aat||(Aat=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function o(){}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(n=!1));function i(s,a,A){this.fn=s,this.context=a,this.once=A||!1}function r(){this._events=new o,this._eventsCount=0}r.prototype.eventNames=function(){var a=[],A,c;if(this._eventsCount===0)return a;for(c in A=this._events)e.call(A,c)&&a.push(n?c.slice(1):c);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(A)):a},r.prototype.listeners=function(a,A){var c=n?n+a:a,l=this._events[c];if(A)return!!l;if(!l)return[];if(l.fn)return[l.fn];for(var g=0,u=l.length,h=new Array(u);g<u;g++)h[g]=l[g].fn;return h},r.prototype.emit=function(a,A,c,l,g,u){var h=n?n+a:a;if(!this._events[h])return!1;var d=this._events[h],p=arguments.length,m,_;if(d.fn){switch(d.once&&this.removeListener(a,d.fn,void 0,!0),p){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,A),!0;case 3:return d.fn.call(d.context,A,c),!0;case 4:return d.fn.call(d.context,A,c,l),!0;case 5:return d.fn.call(d.context,A,c,l,g),!0;case 6:return d.fn.call(d.context,A,c,l,g,u),!0}for(_=1,m=new Array(p-1);_<p;_++)m[_-1]=arguments[_];d.fn.apply(d.context,m)}else{var f=d.length,I;for(_=0;_<f;_++)switch(d[_].once&&this.removeListener(a,d[_].fn,void 0,!0),p){case 1:d[_].fn.call(d[_].context);break;case 2:d[_].fn.call(d[_].context,A);break;case 3:d[_].fn.call(d[_].context,A,c);break;case 4:d[_].fn.call(d[_].context,A,c,l);break;default:if(!m)for(I=1,m=new Array(p-1);I<p;I++)m[I-1]=arguments[I];d[_].fn.apply(d[_].context,m)}}return!0},r.prototype.on=function(a,A,c){var l=new i(A,c||this),g=n?n+a:a;return this._events[g]?this._events[g].fn?this._events[g]=[this._events[g],l]:this._events[g].push(l):(this._events[g]=l,this._eventsCount++),this},r.prototype.once=function(a,A,c){var l=new i(A,c||this,!0),g=n?n+a:a;return this._events[g]?this._events[g].fn?this._events[g]=[this._events[g],l]:this._events[g].push(l):(this._events[g]=l,this._eventsCount++),this},r.prototype.removeListener=function(a,A,c,l){var g=n?n+a:a;if(!this._events[g])return this;if(!A)return--this._eventsCount===0?this._events=new o:delete this._events[g],this;var u=this._events[g];if(u.fn)u.fn===A&&(!l||u.once)&&(!c||u.context===c)&&(--this._eventsCount===0?this._events=new o:delete this._events[g]);else{for(var h=0,d=[],p=u.length;h<p;h++)(u[h].fn!==A||l&&!u[h].once||c&&u[h].context!==c)&&d.push(u[h]);d.length?this._events[g]=d.length===1?d[0]:d:--this._eventsCount===0?this._events=new o:delete this._events[g]}return this},r.prototype.removeAllListeners=function(a){var A;return a?(A=n?n+a:a,this._events[A]&&(--this._eventsCount===0?this._events=new o:delete this._events[A])):(this._events=new o,this._eventsCount=0),this},r.prototype.off=r.prototype.removeListener,r.prototype.addListener=r.prototype.on,r.prototype.setMaxListeners=function(){return this},r.prefixed=n,r.EventEmitter=r,t.exports=r})(u2e)),u2e.exports}var d2e,lat;function fBn(){if(lat)return d2e;lat=1;function t(c,l,g){return l in c?Object.defineProperty(c,l,{value:g,enumerable:!0,configurable:!0,writable:!0}):c[l]=g,c}var e=cat(),n=function(){},o={data:"state-data",cdata:"state-cdata",tagBegin:"state-tag-begin",tagName:"state-tag-name",tagEnd:"state-tag-end",attributeNameStart:"state-attribute-name-start",attributeName:"state-attribute-name",attributeNameEnd:"state-attribute-name-end",attributeValueBegin:"state-attribute-value-begin",attributeValue:"state-attribute-value"},i={lt:"action-lt",gt:"action-gt",space:"action-space",equal:"action-equal",quote:"action-quote",slash:"action-slash",char:"action-char",error:"action-error"},r={text:"text",openTag:"open-tag",closeTag:"close-tag",attributeName:"attribute-name",attributeValue:"attribute-value"},s={" ":i.space," ":i.space,"\n":i.space,"\r":i.space,"<":i.lt,">":i.gt,'"':i.quote,"'":i.quote,"=":i.equal,"/":i.slash},a=function(l){return s[l]||i.char},A=function(l){var g,u,h,d,p,m,_,f,I,C;l=Object.assign({debug:!1},l);var y=new e,x=o.data,E="",B="",b="",Q="",w="",M="",k=function(G,U){if(!(B[0]==="?"||B[0]==="!")){var Y={type:G,value:U};l.debug&&console.log("emit:",Y),y.emit("data",Y)}};y.stateMachine=(C={},t(C,o.data,(g={},t(g,i.lt,function(){E.trim()&&k(r.text,E),B="",w=!1,x=o.tagBegin}),t(g,i.char,function(F){E+=F}),g)),t(C,o.cdata,t({},i.char,function(F){E+=F,E.substr(-3)==="]]>"&&(k(r.text,E.slice(0,-3)),E="",x=o.data)})),t(C,o.tagBegin,(u={},t(u,i.space,n),t(u,i.char,function(F){B=F,x=o.tagName}),t(u,i.slash,function(){B="",w=!0}),u)),t(C,o.tagName,(h={},t(h,i.space,function(){w?x=o.tagEnd:(x=o.attributeNameStart,k(r.openTag,B))}),t(h,i.gt,function(){k(w?r.closeTag:r.openTag,B),E="",x=o.data}),t(h,i.slash,function(){x=o.tagEnd,k(r.openTag,B)}),t(h,i.char,function(F){B+=F,B==="![CDATA["&&(x=o.cdata,E="",B="")}),h)),t(C,o.tagEnd,(d={},t(d,i.gt,function(){k(r.closeTag,B),E="",x=o.data}),t(d,i.char,n),d)),t(C,o.attributeNameStart,(p={},t(p,i.char,function(F){b=F,x=o.attributeName}),t(p,i.gt,function(){E="",x=o.data}),t(p,i.space,n),t(p,i.slash,function(){w=!0,x=o.tagEnd}),p)),t(C,o.attributeName,(m={},t(m,i.space,function(){x=o.attributeNameEnd}),t(m,i.equal,function(){k(r.attributeName,b),x=o.attributeValueBegin}),t(m,i.gt,function(){Q="",k(r.attributeName,b),k(r.attributeValue,Q),E="",x=o.data}),t(m,i.slash,function(){w=!0,Q="",k(r.attributeName,b),k(r.attributeValue,Q),x=o.tagEnd}),t(m,i.char,function(F){b+=F}),m)),t(C,o.attributeNameEnd,(_={},t(_,i.space,n),t(_,i.equal,function(){k(r.attributeName,b),x=o.attributeValueBegin}),t(_,i.gt,function(){Q="",k(r.attributeName,b),k(r.attributeValue,Q),E="",x=o.data}),t(_,i.char,function(F){Q="",k(r.attributeName,b),k(r.attributeValue,Q),b=F,x=o.attributeName}),_)),t(C,o.attributeValueBegin,(f={},t(f,i.space,n),t(f,i.quote,function(F){M=F,Q="",x=o.attributeValue}),t(f,i.gt,function(){Q="",k(r.attributeValue,Q),E="",x=o.data}),t(f,i.char,function(F){M="",Q=F,x=o.attributeValue}),f)),t(C,o.attributeValue,(I={},t(I,i.space,function(F){M?Q+=F:(k(r.attributeValue,Q),x=o.attributeNameStart)}),t(I,i.quote,function(F){M===F?(k(r.attributeValue,Q),x=o.attributeNameStart):Q+=F}),t(I,i.gt,function(F){M?Q+=F:(k(r.attributeValue,Q),E="",x=o.data)}),t(I,i.slash,function(F){M?Q+=F:(k(r.attributeValue,Q),w=!0,x=o.tagEnd)}),t(I,i.char,function(F){Q+=F}),I)),C);var R=function(G){l.debug&&console.log(x,G);var U=y.stateMachine[x],Y=U[a(G)]||U[i.error]||U[i.char];Y(G)};return y.write=function(F){for(var G=F.length,U=0;U<G;U++)R(F[U])},y};return d2e={State:o,Action:i,Type:r,create:A},d2e}var h2e,gat;function IBn(){if(gat)return h2e;gat=1;var t=cat(),e=fBn(),n=e.Type,o={element:"element",text:"text"},i=function(A){return Object.assign({name:"",type:o.element,value:"",parent:null,attributes:{},children:[]},A)},r=function(A){A=Object.assign({stream:!1,parentNodes:!0,doneEvent:"done",tagPrefix:"tag:",emitTopLevelOnly:!1,debug:!1},A);var c=void 0,l=void 0,g=void 0,u=void 0,h=new t,d=function(m){switch(m.type){case n.openTag:if(g===null)g=l,g.name=m.value;else{var _=i({name:m.value,parent:g});g.children.push(_),g=_}break;case n.closeTag:var f=g.parent;if(A.parentNodes||(g.parent=null),g.name!==m.value)break;A.stream&&f===l&&(l.children=[],g.parent=null),(!A.emitTopLevelOnly||f===l)&&(h.emit(A.tagPrefix+g.name,g),h.emit("tag",g.name,g)),g===l&&(c.removeAllListeners("data"),h.emit(A.doneEvent,g),l=null),g=f;break;case n.text:g&&g.children.push(i({type:o.text,value:m.value,parent:A.parentNodes?g:null}));break;case n.attributeName:u=m.value,g.attributes[u]="";break;case n.attributeValue:g.attributes[u]=m.value;break}};return h.reset=function(){c=e.create({debug:A.debug}),c.on("data",d),l=i(),g=null,u="",h.parse=c.write},h.reset(),h},s=function(A,c){c=Object.assign({},c,{stream:!1,tagPrefix:":"});var l=r(c),g=void 0;return l.on("done",function(u){g=u}),l.parse(A),g};return h2e={parseSync:s,create:r,NodeType:o},h2e}var CBn=IBn(),yBn=function(e){var n=CBn.parseSync("<root>".concat(e,"</root>"),{parentNodes:!1}),o=n.children&&n.children.length>0&&n.children.every(function(i){return i.name==="svg"});if(o)return n.children.length===1?n.children[0]:n.children;throw Error("nothing to parse")},xBn=function(e){return _Bn(e,function(n){return BBn(n)?n:EBn(n)})},EBn=function(e){return e.replace(/[-|:]([a-z])/gi,function(n,o){return o.toUpperCase()})},BBn=function(e){return/^(data|aria)(-\w+)/.test(e)},SBn=function(e){if(e){var n=String(e);return/[&<>]/.test(n)?"<![CDATA[".concat(n.replace(/]]>/,"]]]]><![CDATA[>"),"]]>"):n}return""},bBn=function(e){return String(e).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},p2e=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=n.transformNode,i=o===void 0?function(A){return A}:o,r=n.camelcase,s=r===void 0?!1:r,a=function(c){var l;return l=i(c),s&&(l=xBn(l)),l};return a(yBn(e))},QBn=function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=n.transformAttr,i=o===void 0?function(h,d,p){return"".concat(h,'="').concat(p(d),'"')}:o,r=n.transformNode,s=r===void 0?function(h){return h}:r,a=n.selfClose,A=a===void 0?!0:a;if(Array.isArray(e))return e.map(function(h){return t(h,{transformAttr:i,selfClose:A,transformNode:s})}).join("");var c=s(e);if(c.type==="text")return SBn(c.value);var l="";for(var g in c.attributes){var u=i(g,c.attributes[g],bBn,c.name);l+=u?" ".concat(u):""}return c.children&&c.children.length>0||!A?"<".concat(c.name).concat(l,">").concat(t(c.children,{transformAttr:i,transformNode:s,selfClose:A}),"</").concat(c.name,">"):"<".concat(c.name).concat(l,"/>")},Zb=t=>{const e=Math.round(t*1e3)/1e3;return`${Number(e.toFixed(3))}mm`},uat=new Map([["T",1e12],["G",1e9],["M",1e6],["K",1e3],["k",1e3],["",1],["m",.001],["µ",1e-6],["μ",1e-6],["u",1e-6],["n",1e-9],["p",1e-12],["f",1e-15]]),vBn=[...uat.keys()];function dat(t){return uat.get(t)}var hat={Hz:{baseUnit:"Hz",variants:{MHz:1e6,kHz:1e3,Hz:1}},g:{baseUnit:"g",variants:{kg:1e3,g:1}},Ω:{baseUnit:"Ω",variants:{mΩ:.001,mohm:.001,mOhm:.001,milliohm:.001,Ω:1,ohm:1,Ohm:1,kΩ:1e3,KΩ:1e3,kohm:1e3,kOhm:1e3,KOhm:1e3,Kohm:1e3,MΩ:1e6,Mohm:1e6,MOhm:1e6,megohm:1e6,Megohm:1e6,GΩ:1e9,Gohm:1e9,GOhm:1e9,TΩ:1e12,Tohm:1e12,TOhm:1e12}},V:{baseUnit:"V",variants:{mV:.001,V:1,kV:1e3,KV:1e3,MV:1e6,GV:1e9,TV:1e12}},A:{baseUnit:"A",variants:{µA:1e-6,μA:1e-6,mA:.001,ma:.001,A:1,kA:1e3,MA:1e6}},F:{baseUnit:"F",variants:{pF:1e-12,nF:1e-9,µF:1e-6,μF:1e-6,uF:1e-6,mF:.001,F:1,kF:1e3,KF:1e3,MF:1e6}},H:{baseUnit:"H",variants:{pH:1e-12,nH:1e-9,µH:1e-6,μH:1e-6,uH:1e-6,mH:.001,H:1,kH:1e3,KH:1e3,MH:1e6}},ml:{baseUnit:"ml",variants:{ml:1,mL:1,l:1e3,L:1e3}},deg:{baseUnit:"deg",variants:{rad:180/Math.PI}},ms:{baseUnit:"ms",variants:{fs:1e-12,ps:1e-9,ns:1e-6,us:.001,µs:.001,μs:.001,ms:1,s:1e3}},mm:{baseUnit:"mm",variants:{nm:1e-6,µm:.001,μm:.001,um:.001,mm:1,cm:10,dm:100,m:1e3,km:1e6,in:25.4,ft:304.8,IN:25.4,FT:304.8,yd:914.4,mi:1609344,mil:.0254}}},m2e=new Set;for(const[t,e]of Object.entries(hat)){m2e.add(t);for(const n of Object.keys(e.variants))m2e.add(n)}function PBn(t){for(const e of Object.values(hat)){if(t in e.variants)return{baseUnit:e.baseUnit,conversionFactor:e.variants[t]};for(const[n,o]of Object.entries(e.variants)){if(!t.endsWith(n))continue;const i=t.slice(0,-n.length),r=dat(i);if(r!=null)return{baseUnit:e.baseUnit,conversionFactor:r*o}}}return{baseUnit:t,conversionFactor:1}}function G1(t,e){if(t==null)return{parsedUnit:null,unitOfValue:null,value:null};if(typeof t=="string"&&t.match(/^-?[\d.]+$/))return{value:Number.parseFloat(t),parsedUnit:null,unitOfValue:null};if(typeof t=="number")return{value:t,parsedUnit:null,unitOfValue:null};if(typeof t=="object"&&"x"in t&&"y"in t){const c=G1(t.x,e),l=G1(t.x,e),g=G1(t.y,e);return l.value===null||g.value===null?{parsedUnit:null,unitOfValue:null,value:null}:{parsedUnit:c.parsedUnit,unitOfValue:c.unitOfValue,value:{x:l.value,y:g.value}}}const o=t.toString().split("").reverse().join("").match(/[^\d\s]+/)?.[0];if(!o)throw new Error(`Could not determine unit: "${t}"`);const i=o.split("").reverse().join(""),r=t.slice(0,-i.length),s=dat(i);if(e&&s!=null)return{parsedUnit:null,unitOfValue:e,value:Number.parseFloat(r)*s};if(s!=null&&!m2e.has(i))return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(r)*s};const{baseUnit:a,conversionFactor:A}=PBn(i);return{parsedUnit:i,unitOfValue:a,value:A*Number.parseFloat(r)}}vBn.filter(t=>t!=="").sort((t,e)=>e.length-t.length).map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|");var yk=[{value:1e12,symbol:"T"},{value:1e9,symbol:"G"},{value:1e6,symbol:"M"},{value:1e3,symbol:"k"},{value:1,symbol:""},{value:.001,symbol:"m"},{value:1e-6,symbol:"µ"},{value:1e-9,symbol:"n"},{value:1e-12,symbol:"p"}],wBn=yk[yk.length-1];function D_(t){if(t==null)return"";if(t===0)return"0";const e=Math.abs(t);let n=yk.findIndex(s=>{const a=e/s.value;return a>=1&&a<1e3});n===-1&&(n=yk.indexOf(wBn));let o=yk[n],i=t/o.value;for(;n>0&&Math.abs(Number(i.toPrecision(3)))>=1e3;)n-=1,o=yk[n],i=t/o.value;let r=i.toPrecision(3);return r.includes(".")&&!/\.0+$/.test(r)&&(r=r.replace(/0+$/,"")),r=r.replace(/\.0+$/,""),`${r}${o.symbol}`}var Sl;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const r={};for(const s of i)r[s]=s;return r},t.getValidEnumValues=i=>{const r=t.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),s={};for(const a of r)s[a]=i[a];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(r){return i[r]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const r=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&r.push(s);return r},t.find=(i,r)=>{for(const s of i)if(r(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function o(i,r=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(r)}t.joinValues=o,t.jsonStringifyReplacer=(i,r)=>typeof r=="bigint"?r.toString():r})(Sl||(Sl={}));var pat;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(pat||(pat={}));const Er=Sl.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),eQ=t=>{switch(typeof t){case"undefined":return Er.undefined;case"string":return Er.string;case"number":return Number.isNaN(t)?Er.nan:Er.number;case"boolean":return Er.boolean;case"function":return Er.function;case"bigint":return Er.bigint;case"symbol":return Er.symbol;case"object":return Array.isArray(t)?Er.array:t===null?Er.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Er.promise:typeof Map<"u"&&t instanceof Map?Er.map:typeof Set<"u"&&t instanceof Set?Er.set:typeof Date<"u"&&t instanceof Date?Er.date:Er.object;default:return Er.unknown}},lo=Sl.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class i5 extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=o=>{this.issues=[...this.issues,o]},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(r){return r.message},o={_errors:[]},i=r=>{for(const s of r.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)o._errors.push(n(s));else{let a=o,A=0;for(;A<s.path.length;){const c=s.path[A];A===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],A++}}};return i(this),o}static assert(e){if(!(e instanceof i5))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Sl.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},o=[];for(const i of this.issues)if(i.path.length>0){const r=i.path[0];n[r]=n[r]||[],n[r].push(e(i))}else o.push(e(i));return{formErrors:o,fieldErrors:n}}get formErrors(){return this.flatten()}}i5.create=t=>new i5(t);const jK=(t,e)=>{let n;switch(t.code){case lo.invalid_type:t.received===Er.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case lo.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Sl.jsonStringifyReplacer)}`;break;case lo.unrecognized_keys:n=`Unrecognized key(s) in object: ${Sl.joinValues(t.keys,", ")}`;break;case lo.invalid_union:n="Invalid input";break;case lo.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Sl.joinValues(t.options)}`;break;case lo.invalid_enum_value:n=`Invalid enum value. Expected ${Sl.joinValues(t.options)}, received '${t.received}'`;break;case lo.invalid_arguments:n="Invalid function arguments";break;case lo.invalid_return_type:n="Invalid function return type";break;case lo.invalid_date:n="Invalid date";break;case lo.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Sl.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case lo.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case lo.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case lo.custom:n="Invalid input";break;case lo.invalid_intersection_types:n="Intersection results could not be merged";break;case lo.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case lo.not_finite:n="Number must be finite";break;default:n=e.defaultError,Sl.assertNever(t)}return{message:n}};let MBn=jK;function _2e(){return MBn}const f2e=t=>{const{data:e,path:n,errorMaps:o,issueData:i}=t,r=[...n,...i.path||[]],s={...i,path:r};if(i.message!==void 0)return{...i,path:r,message:i.message};let a="";const A=o.filter(c=>!!c).slice().reverse();for(const c of A)a=c(s,{data:e,defaultError:a}).message;return{...i,path:r,message:a}};function or(t,e){const n=_2e(),o=f2e({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===jK?void 0:jK].filter(i=>!!i)});t.common.issues.push(o)}class ay{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const o=[];for(const i of n){if(i.status==="aborted")return Xs;i.status==="dirty"&&e.dirty(),o.push(i.value)}return{status:e.value,value:o}}static async mergeObjectAsync(e,n){const o=[];for(const i of n){const r=await i.key,s=await i.value;o.push({key:r,value:s})}return ay.mergeObjectSync(e,o)}static mergeObjectSync(e,n){const o={};for(const i of n){const{key:r,value:s}=i;if(r.status==="aborted"||s.status==="aborted")return Xs;r.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(o[r.value]=s.value)}return{status:e.value,value:o}}}const Xs=Object.freeze({status:"aborted"}),qK=t=>({status:"dirty",value:t}),j2=t=>({status:"valid",value:t}),mat=t=>t.status==="aborted",_at=t=>t.status==="dirty",xk=t=>t.status==="valid",Dte=t=>typeof Promise<"u"&&t instanceof Promise;var ns;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(ns||(ns={}));class u9{constructor(e,n,o,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=o,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const fat=(t,e)=>{if(xk(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new i5(t.common.issues);return this._error=n,this._error}}};function yA(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:o,description:i}=t;if(e&&(n||o))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,a)=>{const{message:A}=t;return s.code==="invalid_enum_value"?{message:A??a.defaultError}:typeof a.data>"u"?{message:A??o??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:A??n??a.defaultError}},description:i}}class yc{get description(){return this._def.description}_getType(e){return eQ(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:eQ(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ay,ctx:{common:e.parent.common,data:e.data,parsedType:eQ(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Dte(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const o=this.safeParse(e,n);if(o.success)return o.data;throw o.error}safeParse(e,n){const o={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:eQ(e)},i=this._parseSync({data:e,path:o.path,parent:o});return fat(o,i)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:eQ(e)};if(!this["~standard"].async)try{const o=this._parseSync({data:e,path:[],parent:n});return xk(o)?{value:o.value}:{issues:n.common.issues}}catch(o){o?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(o=>xk(o)?{value:o.value}:{issues:n.common.issues})}async parseAsync(e,n){const o=await this.safeParseAsync(e,n);if(o.success)return o.data;throw o.error}async safeParseAsync(e,n){const o={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:eQ(e)},i=this._parse({data:e,path:o.path,parent:o}),r=await(Dte(i)?i:Promise.resolve(i));return fat(o,r)}refine(e,n){const o=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,r)=>{const s=e(i),a=()=>r.addIssue({code:lo.custom,...o(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(A=>A?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,n){return this._refinement((o,i)=>e(o)?!0:(i.addIssue(typeof n=="function"?n(o,i):n),!1))}_refinement(e){return new nQ({schema:this,typeName:ya.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return g8.create(this,this._def)}nullable(){return bM.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return h9.create(this)}promise(){return eV.create(this,this._def)}or(e){return Tte.create([this,e],this._def)}and(e){return kte.create(this,e,this._def)}transform(e){return new nQ({...yA(this._def),schema:this,typeName:ya.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Hte({...yA(this._def),innerType:this,defaultValue:n,typeName:ya.ZodDefault})}brand(){return new bat({typeName:ya.ZodBranded,type:this,...yA(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Ote({...yA(this._def),innerType:this,catchValue:n,typeName:ya.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return S2e.create(this,e)}readonly(){return Gte.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const DBn=/^c[^\s-]{8,}$/i,NBn=/^[0-9a-z]+$/,RBn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,TBn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,kBn=/^[a-z0-9_-]{21}$/i,FBn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,LBn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,HBn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,OBn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let I2e;const GBn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,YBn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,UBn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,KBn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,VBn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,zBn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Iat="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",JBn=new RegExp(`^${Iat}$`);function Cat(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function WBn(t){return new RegExp(`^${Cat(t)}$`)}function jBn(t){let e=`${Iat}T${Cat(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function qBn(t,e){return!!((e==="v4"||!e)&&GBn.test(t)||(e==="v6"||!e)&&UBn.test(t))}function XBn(t,e){if(!FBn.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const o=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(o));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function $Bn(t,e){return!!((e==="v4"||!e)&&YBn.test(t)||(e==="v6"||!e)&&KBn.test(t))}class d9 extends yc{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Er.string){const r=this._getOrReturnCtx(e);return or(r,{code:lo.invalid_type,expected:Er.string,received:r.parsedType}),Xs}const o=new ay;let i;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(i=this._getOrReturnCtx(e,i),or(i,{code:lo.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),o.dirty());else if(r.kind==="max")e.data.length>r.value&&(i=this._getOrReturnCtx(e,i),or(i,{code:lo.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),o.dirty());else if(r.kind==="length"){const s=e.data.length>r.value,a=e.data.length<r.value;(s||a)&&(i=this._getOrReturnCtx(e,i),s?or(i,{code:lo.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):a&&or(i,{code:lo.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),o.dirty())}else if(r.kind==="email")HBn.test(e.data)||(i=this._getOrReturnCtx(e,i),or(i,{validation:"email",code:lo.invalid_string,message:r.message}),o.dirty());else if(r.kind==="emoji")I2e||(I2e=new RegExp(OBn,"u")),I2e.test(e.data)||(i=this._getOrReturnCtx(e,i),or(i,{validation:"emoji",code:lo.invalid_string,message:r.message}),o.dirty());else if(r.kind==="uuid")TBn.test(e.data)||(i=this._getOrReturnCtx(e,i),or(i,{validation:"uuid",code:lo.invalid_string,message:r.message}),o.dirty());else if(r.kind==="nanoid")kBn.test(e.data)||(i=this._getOrReturnCtx(e,i),or(i,{validation:"nanoid",code:lo.invalid_string,message:r.message}),o.dirty());else if(r.kind==="cuid")DBn.test(e.data)||(i=this._getOrReturnCtx(e,i),or(i,{validation:"cuid",code:lo.invalid_string,message:r.message}),o.dirty());else if(r.kind==="cuid2")NBn.test(e.data)||(i=this._getOrReturnCtx(e,i),or(i,{validation:"cuid2",code:lo.invalid_string,message:r.message}),o.dirty());else if(r.kind==="ulid")RBn.test(e.data)||(i=this._getOrReturnCtx(e,i),or(i,{validation:"ulid",code:lo.invalid_string,message:r.message}),o.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),or(i,{validation:"url",code:lo.invalid_string,message:r.message}),o.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),or(i,{validation:"regex",code:lo.invalid_string,message:r.message}),o.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(i=this._getOrReturnCtx(e,i),or(i,{code:lo.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),o.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(i=this._getOrReturnCtx(e,i),or(i,{code:lo.invalid_string,validation:{startsWith:r.value},message:r.message}),o.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(i=this._getOrReturnCtx(e,i),or(i,{code:lo.invalid_string,validation:{endsWith:r.value},message:r.message}),o.dirty()):r.kind==="datetime"?jBn(r).test(e.data)||(i=this._getOrReturnCtx(e,i),or(i,{code:lo.invalid_string,validation:"datetime",message:r.message}),o.dirty()):r.kind==="date"?JBn.test(e.data)||(i=this._getOrReturnCtx(e,i),or(i,{code:lo.invalid_string,validation:"date",message:r.message}),o.dirty()):r.kind==="time"?WBn(r).test(e.data)||(i=this._getOrReturnCtx(e,i),or(i,{code:lo.invalid_string,validation:"time",message:r.message}),o.dirty()):r.kind==="duration"?LBn.test(e.data)||(i=this._getOrReturnCtx(e,i),or(i,{validation:"duration",code:lo.invalid_string,message:r.message}),o.dirty()):r.kind==="ip"?qBn(e.data,r.version)||(i=this._getOrReturnCtx(e,i),or(i,{validation:"ip",code:lo.invalid_string,message:r.message}),o.dirty()):r.kind==="jwt"?XBn(e.data,r.alg)||(i=this._getOrReturnCtx(e,i),or(i,{validation:"jwt",code:lo.invalid_string,message:r.message}),o.dirty()):r.kind==="cidr"?$Bn(e.data,r.version)||(i=this._getOrReturnCtx(e,i),or(i,{validation:"cidr",code:lo.invalid_string,message:r.message}),o.dirty()):r.kind==="base64"?VBn.test(e.data)||(i=this._getOrReturnCtx(e,i),or(i,{validation:"base64",code:lo.invalid_string,message:r.message}),o.dirty()):r.kind==="base64url"?zBn.test(e.data)||(i=this._getOrReturnCtx(e,i),or(i,{validation:"base64url",code:lo.invalid_string,message:r.message}),o.dirty()):Sl.assertNever(r);return{status:o.value,value:e.data}}_regex(e,n,o){return this.refinement(i=>e.test(i),{validation:n,code:lo.invalid_string,...ns.errToObj(o)})}_addCheck(e){return new d9({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ns.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ns.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ns.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ns.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ns.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ns.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ns.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ns.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ns.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ns.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ns.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ns.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ns.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...ns.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...ns.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...ns.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...ns.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...ns.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...ns.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...ns.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...ns.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...ns.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...ns.errToObj(n)})}nonempty(e){return this.min(1,ns.errToObj(e))}trim(){return new d9({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new d9({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new d9({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}d9.create=t=>new d9({checks:[],typeName:ya.ZodString,coerce:t?.coerce??!1,...yA(t)});function ZBn(t,e){const n=(t.toString().split(".")[1]||"").length,o=(e.toString().split(".")[1]||"").length,i=n>o?n:o,r=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return r%s/10**i}class EM extends yc{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Er.number){const r=this._getOrReturnCtx(e);return or(r,{code:lo.invalid_type,expected:Er.number,received:r.parsedType}),Xs}let o;const i=new ay;for(const r of this._def.checks)r.kind==="int"?Sl.isInteger(e.data)||(o=this._getOrReturnCtx(e,o),or(o,{code:lo.invalid_type,expected:"integer",received:"float",message:r.message}),i.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(o=this._getOrReturnCtx(e,o),or(o,{code:lo.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(o=this._getOrReturnCtx(e,o),or(o,{code:lo.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="multipleOf"?ZBn(e.data,r.value)!==0&&(o=this._getOrReturnCtx(e,o),or(o,{code:lo.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(o=this._getOrReturnCtx(e,o),or(o,{code:lo.not_finite,message:r.message}),i.dirty()):Sl.assertNever(r);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,ns.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ns.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ns.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ns.toString(n))}setLimit(e,n,o,i){return new EM({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:o,message:ns.toString(i)}]})}_addCheck(e){return new EM({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ns.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ns.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ns.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ns.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ns.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ns.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:ns.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ns.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ns.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Sl.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const o of this._def.checks){if(o.kind==="finite"||o.kind==="int"||o.kind==="multipleOf")return!0;o.kind==="min"?(n===null||o.value>n)&&(n=o.value):o.kind==="max"&&(e===null||o.value<e)&&(e=o.value)}return Number.isFinite(n)&&Number.isFinite(e)}}EM.create=t=>new EM({checks:[],typeName:ya.ZodNumber,coerce:t?.coerce||!1,...yA(t)});class BM extends yc{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Er.bigint)return this._getInvalidInput(e);let o;const i=new ay;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(o=this._getOrReturnCtx(e,o),or(o,{code:lo.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(o=this._getOrReturnCtx(e,o),or(o,{code:lo.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),i.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(o=this._getOrReturnCtx(e,o),or(o,{code:lo.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):Sl.assertNever(r);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return or(n,{code:lo.invalid_type,expected:Er.bigint,received:n.parsedType}),Xs}gte(e,n){return this.setLimit("min",e,!0,ns.toString(n))}gt(e,n){return this.setLimit("min",e,!1,ns.toString(n))}lte(e,n){return this.setLimit("max",e,!0,ns.toString(n))}lt(e,n){return this.setLimit("max",e,!1,ns.toString(n))}setLimit(e,n,o,i){return new BM({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:o,message:ns.toString(i)}]})}_addCheck(e){return new BM({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ns.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ns.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ns.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ns.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:ns.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}BM.create=t=>new BM({checks:[],typeName:ya.ZodBigInt,coerce:t?.coerce??!1,...yA(t)});class Nte extends yc{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Er.boolean){const o=this._getOrReturnCtx(e);return or(o,{code:lo.invalid_type,expected:Er.boolean,received:o.parsedType}),Xs}return j2(e.data)}}Nte.create=t=>new Nte({typeName:ya.ZodBoolean,coerce:t?.coerce||!1,...yA(t)});class Ek extends yc{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Er.date){const r=this._getOrReturnCtx(e);return or(r,{code:lo.invalid_type,expected:Er.date,received:r.parsedType}),Xs}if(Number.isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return or(r,{code:lo.invalid_date}),Xs}const o=new ay;let i;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(i=this._getOrReturnCtx(e,i),or(i,{code:lo.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),o.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(i=this._getOrReturnCtx(e,i),or(i,{code:lo.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),o.dirty()):Sl.assertNever(r);return{status:o.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ek({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:ns.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:ns.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Ek.create=t=>new Ek({checks:[],coerce:t?.coerce||!1,typeName:ya.ZodDate,...yA(t)});class yat extends yc{_parse(e){if(this._getType(e)!==Er.symbol){const o=this._getOrReturnCtx(e);return or(o,{code:lo.invalid_type,expected:Er.symbol,received:o.parsedType}),Xs}return j2(e.data)}}yat.create=t=>new yat({typeName:ya.ZodSymbol,...yA(t)});class C2e extends yc{_parse(e){if(this._getType(e)!==Er.undefined){const o=this._getOrReturnCtx(e);return or(o,{code:lo.invalid_type,expected:Er.undefined,received:o.parsedType}),Xs}return j2(e.data)}}C2e.create=t=>new C2e({typeName:ya.ZodUndefined,...yA(t)});class Rte extends yc{_parse(e){if(this._getType(e)!==Er.null){const o=this._getOrReturnCtx(e);return or(o,{code:lo.invalid_type,expected:Er.null,received:o.parsedType}),Xs}return j2(e.data)}}Rte.create=t=>new Rte({typeName:ya.ZodNull,...yA(t)});class XK extends yc{constructor(){super(...arguments),this._any=!0}_parse(e){return j2(e.data)}}XK.create=t=>new XK({typeName:ya.ZodAny,...yA(t)});class Bk extends yc{constructor(){super(...arguments),this._unknown=!0}_parse(e){return j2(e.data)}}Bk.create=t=>new Bk({typeName:ya.ZodUnknown,...yA(t)});class tQ extends yc{_parse(e){const n=this._getOrReturnCtx(e);return or(n,{code:lo.invalid_type,expected:Er.never,received:n.parsedType}),Xs}}tQ.create=t=>new tQ({typeName:ya.ZodNever,...yA(t)});class xat extends yc{_parse(e){if(this._getType(e)!==Er.undefined){const o=this._getOrReturnCtx(e);return or(o,{code:lo.invalid_type,expected:Er.void,received:o.parsedType}),Xs}return j2(e.data)}}xat.create=t=>new xat({typeName:ya.ZodVoid,...yA(t)});class h9 extends yc{_parse(e){const{ctx:n,status:o}=this._processInputParams(e),i=this._def;if(n.parsedType!==Er.array)return or(n,{code:lo.invalid_type,expected:Er.array,received:n.parsedType}),Xs;if(i.exactLength!==null){const s=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(s||a)&&(or(n,{code:s?lo.too_big:lo.too_small,minimum:a?i.exactLength.value:void 0,maximum:s?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),o.dirty())}if(i.minLength!==null&&n.data.length<i.minLength.value&&(or(n,{code:lo.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),o.dirty()),i.maxLength!==null&&n.data.length>i.maxLength.value&&(or(n,{code:lo.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),o.dirty()),n.common.async)return Promise.all([...n.data].map((s,a)=>i.type._parseAsync(new u9(n,s,n.path,a)))).then(s=>ay.mergeArray(o,s));const r=[...n.data].map((s,a)=>i.type._parseSync(new u9(n,s,n.path,a)));return ay.mergeArray(o,r)}get element(){return this._def.type}min(e,n){return new h9({...this._def,minLength:{value:e,message:ns.toString(n)}})}max(e,n){return new h9({...this._def,maxLength:{value:e,message:ns.toString(n)}})}length(e,n){return new h9({...this._def,exactLength:{value:e,message:ns.toString(n)}})}nonempty(e){return this.min(1,e)}}h9.create=(t,e)=>new h9({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ya.ZodArray,...yA(e)});function Sk(t){if(t instanceof Hm){const e={};for(const n in t.shape){const o=t.shape[n];e[n]=g8.create(Sk(o))}return new Hm({...t._def,shape:()=>e})}else return t instanceof h9?new h9({...t._def,type:Sk(t.element)}):t instanceof g8?g8.create(Sk(t.unwrap())):t instanceof bM?bM.create(Sk(t.unwrap())):t instanceof l8?l8.create(t.items.map(e=>Sk(e))):t}class Hm extends yc{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Sl.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Er.object){const c=this._getOrReturnCtx(e);return or(c,{code:lo.invalid_type,expected:Er.object,received:c.parsedType}),Xs}const{status:o,ctx:i}=this._processInputParams(e),{shape:r,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof tQ&&this._def.unknownKeys==="strip"))for(const c in i.data)s.includes(c)||a.push(c);const A=[];for(const c of s){const l=r[c],g=i.data[c];A.push({key:{status:"valid",value:c},value:l._parse(new u9(i,g,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof tQ){const c=this._def.unknownKeys;if(c==="passthrough")for(const l of a)A.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(c==="strict")a.length>0&&(or(i,{code:lo.unrecognized_keys,keys:a}),o.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const l of a){const g=i.data[l];A.push({key:{status:"valid",value:l},value:c._parse(new u9(i,g,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const c=[];for(const l of A){const g=await l.key,u=await l.value;c.push({key:g,value:u,alwaysSet:l.alwaysSet})}return c}).then(c=>ay.mergeObjectSync(o,c)):ay.mergeObjectSync(o,A)}get shape(){return this._def.shape()}strict(e){return ns.errToObj,new Hm({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,o)=>{const i=this._def.errorMap?.(n,o).message??o.defaultError;return n.code==="unrecognized_keys"?{message:ns.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new Hm({...this._def,unknownKeys:"strip"})}passthrough(){return new Hm({...this._def,unknownKeys:"passthrough"})}extend(e){return new Hm({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Hm({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ya.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Hm({...this._def,catchall:e})}pick(e){const n={};for(const o of Sl.objectKeys(e))e[o]&&this.shape[o]&&(n[o]=this.shape[o]);return new Hm({...this._def,shape:()=>n})}omit(e){const n={};for(const o of Sl.objectKeys(this.shape))e[o]||(n[o]=this.shape[o]);return new Hm({...this._def,shape:()=>n})}deepPartial(){return Sk(this)}partial(e){const n={};for(const o of Sl.objectKeys(this.shape)){const i=this.shape[o];e&&!e[o]?n[o]=i:n[o]=i.optional()}return new Hm({...this._def,shape:()=>n})}required(e){const n={};for(const o of Sl.objectKeys(this.shape))if(e&&!e[o])n[o]=this.shape[o];else{let r=this.shape[o];for(;r instanceof g8;)r=r._def.innerType;n[o]=r}return new Hm({...this._def,shape:()=>n})}keyof(){return Bat(Sl.objectKeys(this.shape))}}Hm.create=(t,e)=>new Hm({shape:()=>t,unknownKeys:"strip",catchall:tQ.create(),typeName:ya.ZodObject,...yA(e)}),Hm.strictCreate=(t,e)=>new Hm({shape:()=>t,unknownKeys:"strict",catchall:tQ.create(),typeName:ya.ZodObject,...yA(e)}),Hm.lazycreate=(t,e)=>new Hm({shape:t,unknownKeys:"strip",catchall:tQ.create(),typeName:ya.ZodObject,...yA(e)});class Tte extends yc{_parse(e){const{ctx:n}=this._processInputParams(e),o=this._def.options;function i(r){for(const a of r)if(a.result.status==="valid")return a.result;for(const a of r)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const s=r.map(a=>new i5(a.ctx.common.issues));return or(n,{code:lo.invalid_union,unionErrors:s}),Xs}if(n.common.async)return Promise.all(o.map(async r=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await r._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let r;const s=[];for(const A of o){const c={...n,common:{...n.common,issues:[]},parent:null},l=A._parseSync({data:n.data,path:n.path,parent:c});if(l.status==="valid")return l;l.status==="dirty"&&!r&&(r={result:l,ctx:c}),c.common.issues.length&&s.push(c.common.issues)}if(r)return n.common.issues.push(...r.ctx.common.issues),r.result;const a=s.map(A=>new i5(A));return or(n,{code:lo.invalid_union,unionErrors:a}),Xs}}get options(){return this._def.options}}Tte.create=(t,e)=>new Tte({options:t,typeName:ya.ZodUnion,...yA(e)});const c8=t=>t instanceof E2e?c8(t.schema):t instanceof nQ?c8(t.innerType()):t instanceof Lte?[t.value]:t instanceof SM?t.options:t instanceof B2e?Sl.objectValues(t.enum):t instanceof Hte?c8(t._def.innerType):t instanceof C2e?[void 0]:t instanceof Rte?[null]:t instanceof g8?[void 0,...c8(t.unwrap())]:t instanceof bM?[null,...c8(t.unwrap())]:t instanceof bat||t instanceof Gte?c8(t.unwrap()):t instanceof Ote?c8(t._def.innerType):[];class y2e extends yc{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Er.object)return or(n,{code:lo.invalid_type,expected:Er.object,received:n.parsedType}),Xs;const o=this.discriminator,i=n.data[o],r=this.optionsMap.get(i);return r?n.common.async?r._parseAsync({data:n.data,path:n.path,parent:n}):r._parseSync({data:n.data,path:n.path,parent:n}):(or(n,{code:lo.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),Xs)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,o){const i=new Map;for(const r of n){const s=c8(r.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of s){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,r)}}return new y2e({typeName:ya.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...yA(o)})}}function x2e(t,e){const n=eQ(t),o=eQ(e);if(t===e)return{valid:!0,data:t};if(n===Er.object&&o===Er.object){const i=Sl.objectKeys(e),r=Sl.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(const a of r){const A=x2e(t[a],e[a]);if(!A.valid)return{valid:!1};s[a]=A.data}return{valid:!0,data:s}}else if(n===Er.array&&o===Er.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let r=0;r<t.length;r++){const s=t[r],a=e[r],A=x2e(s,a);if(!A.valid)return{valid:!1};i.push(A.data)}return{valid:!0,data:i}}else return n===Er.date&&o===Er.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class kte extends yc{_parse(e){const{status:n,ctx:o}=this._processInputParams(e),i=(r,s)=>{if(mat(r)||mat(s))return Xs;const a=x2e(r.value,s.value);return a.valid?((_at(r)||_at(s))&&n.dirty(),{status:n.value,value:a.data}):(or(o,{code:lo.invalid_intersection_types}),Xs)};return o.common.async?Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([r,s])=>i(r,s)):i(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}}kte.create=(t,e,n)=>new kte({left:t,right:e,typeName:ya.ZodIntersection,...yA(n)});class l8 extends yc{_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.parsedType!==Er.array)return or(o,{code:lo.invalid_type,expected:Er.array,received:o.parsedType}),Xs;if(o.data.length<this._def.items.length)return or(o,{code:lo.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Xs;!this._def.rest&&o.data.length>this._def.items.length&&(or(o,{code:lo.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const r=[...o.data].map((s,a)=>{const A=this._def.items[a]||this._def.rest;return A?A._parse(new u9(o,s,o.path,a)):null}).filter(s=>!!s);return o.common.async?Promise.all(r).then(s=>ay.mergeArray(n,s)):ay.mergeArray(n,r)}get items(){return this._def.items}rest(e){return new l8({...this._def,rest:e})}}l8.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new l8({items:t,typeName:ya.ZodTuple,rest:null,...yA(e)})};class Fte extends yc{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.parsedType!==Er.object)return or(o,{code:lo.invalid_type,expected:Er.object,received:o.parsedType}),Xs;const i=[],r=this._def.keyType,s=this._def.valueType;for(const a in o.data)i.push({key:r._parse(new u9(o,a,o.path,a)),value:s._parse(new u9(o,o.data[a],o.path,a)),alwaysSet:a in o.data});return o.common.async?ay.mergeObjectAsync(n,i):ay.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,o){return n instanceof yc?new Fte({keyType:e,valueType:n,typeName:ya.ZodRecord,...yA(o)}):new Fte({keyType:d9.create(),valueType:e,typeName:ya.ZodRecord,...yA(n)})}}class Eat extends yc{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.parsedType!==Er.map)return or(o,{code:lo.invalid_type,expected:Er.map,received:o.parsedType}),Xs;const i=this._def.keyType,r=this._def.valueType,s=[...o.data.entries()].map(([a,A],c)=>({key:i._parse(new u9(o,a,o.path,[c,"key"])),value:r._parse(new u9(o,A,o.path,[c,"value"]))}));if(o.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const A of s){const c=await A.key,l=await A.value;if(c.status==="aborted"||l.status==="aborted")return Xs;(c.status==="dirty"||l.status==="dirty")&&n.dirty(),a.set(c.value,l.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const A of s){const c=A.key,l=A.value;if(c.status==="aborted"||l.status==="aborted")return Xs;(c.status==="dirty"||l.status==="dirty")&&n.dirty(),a.set(c.value,l.value)}return{status:n.value,value:a}}}}Eat.create=(t,e,n)=>new Eat({valueType:e,keyType:t,typeName:ya.ZodMap,...yA(n)});class $K extends yc{_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.parsedType!==Er.set)return or(o,{code:lo.invalid_type,expected:Er.set,received:o.parsedType}),Xs;const i=this._def;i.minSize!==null&&o.data.size<i.minSize.value&&(or(o,{code:lo.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),i.maxSize!==null&&o.data.size>i.maxSize.value&&(or(o,{code:lo.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const r=this._def.valueType;function s(A){const c=new Set;for(const l of A){if(l.status==="aborted")return Xs;l.status==="dirty"&&n.dirty(),c.add(l.value)}return{status:n.value,value:c}}const a=[...o.data.values()].map((A,c)=>r._parse(new u9(o,A,o.path,c)));return o.common.async?Promise.all(a).then(A=>s(A)):s(a)}min(e,n){return new $K({...this._def,minSize:{value:e,message:ns.toString(n)}})}max(e,n){return new $K({...this._def,maxSize:{value:e,message:ns.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}$K.create=(t,e)=>new $K({valueType:t,minSize:null,maxSize:null,typeName:ya.ZodSet,...yA(e)});class ZK extends yc{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Er.function)return or(n,{code:lo.invalid_type,expected:Er.function,received:n.parsedType}),Xs;function o(a,A){return f2e({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,_2e(),jK].filter(c=>!!c),issueData:{code:lo.invalid_arguments,argumentsError:A}})}function i(a,A){return f2e({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,_2e(),jK].filter(c=>!!c),issueData:{code:lo.invalid_return_type,returnTypeError:A}})}const r={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof eV){const a=this;return j2(async function(...A){const c=new i5([]),l=await a._def.args.parseAsync(A,r).catch(h=>{throw c.addIssue(o(A,h)),c}),g=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(g,r).catch(h=>{throw c.addIssue(i(g,h)),c})})}else{const a=this;return j2(function(...A){const c=a._def.args.safeParse(A,r);if(!c.success)throw new i5([o(A,c.error)]);const l=Reflect.apply(s,this,c.data),g=a._def.returns.safeParse(l,r);if(!g.success)throw new i5([i(l,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZK({...this._def,args:l8.create(e).rest(Bk.create())})}returns(e){return new ZK({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,o){return new ZK({args:e||l8.create([]).rest(Bk.create()),returns:n||Bk.create(),typeName:ya.ZodFunction,...yA(o)})}}class E2e extends yc{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}E2e.create=(t,e)=>new E2e({getter:t,typeName:ya.ZodLazy,...yA(e)});class Lte extends yc{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return or(n,{received:n.data,code:lo.invalid_literal,expected:this._def.value}),Xs}return{status:"valid",value:e.data}}get value(){return this._def.value}}Lte.create=(t,e)=>new Lte({value:t,typeName:ya.ZodLiteral,...yA(e)});function Bat(t,e){return new SM({values:t,typeName:ya.ZodEnum,...yA(e)})}class SM extends yc{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),o=this._def.values;return or(n,{expected:Sl.joinValues(o),received:n.parsedType,code:lo.invalid_type}),Xs}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),o=this._def.values;return or(n,{received:n.data,code:lo.invalid_enum_value,options:o}),Xs}return j2(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return SM.create(e,{...this._def,...n})}exclude(e,n=this._def){return SM.create(this.options.filter(o=>!e.includes(o)),{...this._def,...n})}}SM.create=Bat;class B2e extends yc{_parse(e){const n=Sl.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(e);if(o.parsedType!==Er.string&&o.parsedType!==Er.number){const i=Sl.objectValues(n);return or(o,{expected:Sl.joinValues(i),received:o.parsedType,code:lo.invalid_type}),Xs}if(this._cache||(this._cache=new Set(Sl.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=Sl.objectValues(n);return or(o,{received:o.data,code:lo.invalid_enum_value,options:i}),Xs}return j2(e.data)}get enum(){return this._def.values}}B2e.create=(t,e)=>new B2e({values:t,typeName:ya.ZodNativeEnum,...yA(e)});class eV extends yc{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Er.promise&&n.common.async===!1)return or(n,{code:lo.invalid_type,expected:Er.promise,received:n.parsedType}),Xs;const o=n.parsedType===Er.promise?n.data:Promise.resolve(n.data);return j2(o.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}eV.create=(t,e)=>new eV({type:t,typeName:ya.ZodPromise,...yA(e)});class nQ extends yc{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ya.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:o}=this._processInputParams(e),i=this._def.effect||null,r={addIssue:s=>{or(o,s),s.fatal?n.abort():n.dirty()},get path(){return o.path}};if(r.addIssue=r.addIssue.bind(r),i.type==="preprocess"){const s=i.transform(o.data,r);if(o.common.async)return Promise.resolve(s).then(async a=>{if(n.value==="aborted")return Xs;const A=await this._def.schema._parseAsync({data:a,path:o.path,parent:o});return A.status==="aborted"?Xs:A.status==="dirty"||n.value==="dirty"?qK(A.value):A});{if(n.value==="aborted")return Xs;const a=this._def.schema._parseSync({data:s,path:o.path,parent:o});return a.status==="aborted"?Xs:a.status==="dirty"||n.value==="dirty"?qK(a.value):a}}if(i.type==="refinement"){const s=a=>{const A=i.refinement(a,r);if(o.common.async)return Promise.resolve(A);if(A instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(o.common.async===!1){const a=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return a.status==="aborted"?Xs:(a.status==="dirty"&&n.dirty(),s(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(a=>a.status==="aborted"?Xs:(a.status==="dirty"&&n.dirty(),s(a.value).then(()=>({status:n.value,value:a.value}))))}if(i.type==="transform")if(o.common.async===!1){const s=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!xk(s))return Xs;const a=i.transform(s.value,r);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(s=>xk(s)?Promise.resolve(i.transform(s.value,r)).then(a=>({status:n.value,value:a})):Xs);Sl.assertNever(i)}}nQ.create=(t,e,n)=>new nQ({schema:t,typeName:ya.ZodEffects,effect:e,...yA(n)}),nQ.createWithPreprocess=(t,e,n)=>new nQ({schema:e,effect:{type:"preprocess",transform:t},typeName:ya.ZodEffects,...yA(n)});class g8 extends yc{_parse(e){return this._getType(e)===Er.undefined?j2(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}g8.create=(t,e)=>new g8({innerType:t,typeName:ya.ZodOptional,...yA(e)});class bM extends yc{_parse(e){return this._getType(e)===Er.null?j2(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}bM.create=(t,e)=>new bM({innerType:t,typeName:ya.ZodNullable,...yA(e)});class Hte extends yc{_parse(e){const{ctx:n}=this._processInputParams(e);let o=n.data;return n.parsedType===Er.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Hte.create=(t,e)=>new Hte({innerType:t,typeName:ya.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...yA(e)});class Ote extends yc{_parse(e){const{ctx:n}=this._processInputParams(e),o={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});return Dte(i)?i.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new i5(o.common.issues)},input:o.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new i5(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}}Ote.create=(t,e)=>new Ote({innerType:t,typeName:ya.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...yA(e)});class Sat extends yc{_parse(e){if(this._getType(e)!==Er.nan){const o=this._getOrReturnCtx(e);return or(o,{code:lo.invalid_type,expected:Er.nan,received:o.parsedType}),Xs}return{status:"valid",value:e.data}}}Sat.create=t=>new Sat({typeName:ya.ZodNaN,...yA(t)});class bat extends yc{_parse(e){const{ctx:n}=this._processInputParams(e),o=n.data;return this._def.type._parse({data:o,path:n.path,parent:n})}unwrap(){return this._def.type}}class S2e extends yc{_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.common.async)return(async()=>{const r=await this._def.in._parseAsync({data:o.data,path:o.path,parent:o});return r.status==="aborted"?Xs:r.status==="dirty"?(n.dirty(),qK(r.value)):this._def.out._parseAsync({data:r.value,path:o.path,parent:o})})();{const i=this._def.in._parseSync({data:o.data,path:o.path,parent:o});return i.status==="aborted"?Xs:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:o.path,parent:o})}}static create(e,n){return new S2e({in:e,out:n,typeName:ya.ZodPipeline})}}class Gte extends yc{_parse(e){const n=this._def.innerType._parse(e),o=i=>(xk(i)&&(i.value=Object.freeze(i.value)),i);return Dte(n)?n.then(i=>o(i)):o(n)}unwrap(){return this._def.innerType}}Gte.create=(t,e)=>new Gte({innerType:t,typeName:ya.ZodReadonly,...yA(e)});function Qat(t,e){const n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function b0(t,e={},n){return t?XK.create().superRefine((o,i)=>{const r=t(o);if(r instanceof Promise)return r.then(s=>{if(!s){const a=Qat(e,o),A=a.fatal??n??!0;i.addIssue({code:"custom",...a,fatal:A})}});if(!r){const s=Qat(e,o),a=s.fatal??n??!0;i.addIssue({code:"custom",...s,fatal:a})}}):XK.create()}var ya;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ya||(ya={}));const Z=d9.create,mt=EM.create;BM.create;const qe=Nte.create;Ek.create;const vat=Rte.create,Ad=XK.create,b2e=Bk.create;tQ.create;const dn=h9.create,wt=Hm.create,xo=Tte.create,Ay=y2e.create;kte.create;const oQ=l8.create,xc=Fte.create,iQ=ZK.create,Xe=Lte.create,Kn=SM.create,rQ=eV.create;g8.create,bM.create;const Pat=nQ.createWithPreprocess,r5={string:(t=>d9.create({...t,coerce:!0})),number:(t=>EM.create({...t,coerce:!0})),boolean:(t=>Nte.create({...t,coerce:!0})),bigint:(t=>BM.create({...t,coerce:!0})),date:(t=>Ek.create({...t,coerce:!0}))},e9n=Xs;var u8=Z().or(mt()).transform(t=>G1(t,"Ω").value),QM=Z().or(mt()).transform(t=>G1(t,"F").value).transform(t=>Number.parseFloat(t.toPrecision(12))),Yte=Z().or(mt()).transform(t=>G1(t,"H").value),N_=Z().or(mt()).transform(t=>G1(t,"V").value),ce=Z().or(mt()).transform(t=>G1(t).value),cy=Z().or(mt()).transform(t=>G1(t,"Hz").value),ct=ce,E3=Z().or(mt()).transform(t=>G1(t,"A").value),bk=Z().or(mt()).transform(t=>G1(t).value),t9n=bk,bl=bk,wat=Z().datetime(),tA=Z().or(mt()).transform(t=>typeof t=="number"?t:t.endsWith("deg")?Number.parseFloat(t.split("deg")[0]):t.endsWith("rad")?Number.parseFloat(t.split("rad")[0])*180/Math.PI:Number.parseFloat(t)),Mat=mt().or(Z().endsWith("mAh")).transform(t=>{if(typeof t=="string"){const e=t.replace("mAh",""),n=Number.parseFloat(e);if(Number.isNaN(n))throw new Error("Invalid capacity");return n}return t}).describe("Battery capacity in mAh"),Ti=wt({x:ct,y:ct}),n9n=Ti,p9=wt({x:ct,y:ct,z:ct}),o9n=p9,Ute=wt({width:mt(),height:mt()}),i9n=t=>{const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";return Array.from({length:t},()=>e[Math.floor(Math.random()*e.length)]).join("")},so=t=>Z().optional().default(()=>`${t}_${i9n(10)}`),d8=Kn(["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"]),r9n=Kn(["top_silkscreen","bottom_silkscreen","top_copper","bottom_copper","top_soldermask","bottom_soldermask","top_fabrication_note","bottom_fabrication_note","top_user_note","bottom_user_note","top_courtyard","bottom_courtyard","inner1_copper","inner2_copper","inner3_copper","inner4_copper","inner5_copper","inner6_copper","inner7_copper","inner8_copper","edge_cuts","drill"]),Kte=wt({project_relative_path:Z(),url:Z(),mimetype:Z()}),Vte=Ti.extend({rotation:tA.optional()}),Q2e=wt({size:Ti.optional(),thickness:ct.optional()}),Dat=wt({font:Q2e.optional()}),tV=wt({value:Z(),at:Vte.optional(),layer:Z().optional(),uuid:Z().optional(),hide:qe().optional(),effects:Dat.optional()}),Nat=wt({Reference:tV.optional(),Value:tV.optional(),Datasheet:tV.optional(),Description:tV.optional()}),Rat=wt({through_hole:qe().optional(),smd:qe().optional(),exclude_from_pos_files:qe().optional(),exclude_from_bom:qe().optional()}),Tat=wt({name:Z(),type:Z(),shape:Z().optional(),at:Vte.optional(),size:Ti.optional(),drill:ct.optional(),layers:dn(Z()).optional(),removeUnusedLayers:qe().optional(),uuid:Z().optional()}),kat=wt({path:Z(),offset:p9.optional(),scale:p9.optional(),rotate:p9.optional()}),Fat=wt({footprintName:Z().optional(),version:xo([mt(),Z()]).optional(),generator:Z().optional(),generatorVersion:xo([mt(),Z()]).optional(),layer:Z().optional(),properties:Nat.optional(),attributes:Rat.optional(),pads:dn(Tat).optional(),embeddedFonts:qe().optional(),model:kat.optional()}),Lat=wt({hide:qe().optional()}),Hat=wt({offset:ct.optional(),hide:qe().optional()}),Oat=wt({font:Q2e.optional(),justify:xo([Z(),dn(Z())]).optional(),hide:qe().optional()}),sQ=wt({value:Z(),id:xo([mt(),Z()]).optional(),at:Vte.optional(),effects:Oat.optional()}),Gat=wt({Reference:sQ.optional(),Value:sQ.optional(),Footprint:sQ.optional(),Datasheet:sQ.optional(),Description:sQ.optional(),ki_keywords:sQ.optional(),ki_fp_filters:sQ.optional()}),Yat=wt({symbolName:Z().optional(),extends:Z().optional(),pinNumbers:Lat.optional(),pinNames:Hat.optional(),excludeFromSim:qe().optional(),inBom:qe().optional(),onBoard:qe().optional(),properties:Gat.optional(),embeddedFonts:qe().optional()}),Ql=wt({error_type:Z(),message:Z(),is_fatal:qe().optional()}),vM=Kn(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),yg=wt({type:Xe("source_component"),ftype:Z().optional(),source_component_id:Z(),name:Z(),manufacturer_part_number:Z().optional(),supplier_part_numbers:xc(vM,dn(Z())).optional(),display_value:Z().optional(),display_name:Z().optional(),are_pins_interchangeable:qe().optional(),internally_connected_source_port_ids:dn(dn(Z())).optional(),source_group_id:Z().optional(),subcircuit_id:Z().optional()}),v2e=yg.extend({ftype:Xe("simple_capacitor"),capacitance:QM,max_voltage_rating:N_.optional(),display_capacitance:Z().optional(),max_decoupling_trace_length:ct.optional()}),P2e=yg.extend({ftype:Xe("simple_resistor"),resistance:u8,display_resistance:Z().optional()}),zte=yg.extend({ftype:Xe("simple_diode")}),Uat=yg.extend({ftype:Xe("simple_fiducial")}),w2e=zte.extend({ftype:Xe("simple_led"),color:Z().optional(),wavelength:Z().optional()}),Kat=yg.extend({ftype:Xe("simple_ground")}),M2e=yg.extend({ftype:Xe("simple_chip")}),D2e=yg.extend({ftype:Xe("simple_power_source"),voltage:N_}),Vat=yg.extend({ftype:Xe("simple_current_source"),current:E3,frequency:cy.optional(),peak_to_peak_current:E3.optional(),wave_shape:Kn(["sine","square","triangle","sawtooth","dc"]).optional().default("dc"),phase:mt().optional(),duty_cycle:mt().min(0).max(1).optional()}),zat=yg.extend({ftype:Xe("simple_fuse"),current_rating_amps:mt().describe("Nominal current in amps the fuse is rated for"),voltage_rating_volts:mt().describe("Voltage rating in volts, e.g. ±5V would be 5")}),Jat=yg.extend({ftype:Xe("simple_ammeter")}),Wat=wt({must_be_connected:qe().optional(),provides_power:qe().optional(),requires_power:qe().optional(),provides_ground:qe().optional(),requires_ground:qe().optional(),provides_voltage:xo([Z(),mt()]).optional(),requires_voltage:xo([Z(),mt()]).optional(),do_not_connect:qe().optional(),include_in_board_pinout:qe().optional(),can_use_internal_pullup:qe().optional(),is_using_internal_pullup:qe().optional(),needs_external_pullup:qe().optional(),can_use_internal_pulldown:qe().optional(),is_using_internal_pulldown:qe().optional(),needs_external_pulldown:qe().optional(),can_use_open_drain:qe().optional(),is_using_open_drain:qe().optional(),can_use_push_pull:qe().optional(),is_using_push_pull:qe().optional(),should_have_decoupling_capacitor:qe().optional(),recommended_decoupling_capacitor_capacitance:xo([Z(),mt()]).optional(),is_configured_for_i2c_sda:qe().optional(),is_configured_for_i2c_scl:qe().optional(),is_configured_for_spi_mosi:qe().optional(),is_configured_for_spi_miso:qe().optional(),is_configured_for_spi_sck:qe().optional(),is_configured_for_spi_cs:qe().optional(),is_configured_for_uart_tx:qe().optional(),is_configured_for_uart_rx:qe().optional(),supports_i2c_sda:qe().optional(),supports_i2c_scl:qe().optional(),supports_spi_mosi:qe().optional(),supports_spi_miso:qe().optional(),supports_spi_sck:qe().optional(),supports_spi_cs:qe().optional(),supports_uart_tx:qe().optional(),supports_uart_rx:qe().optional()}),N2e=yg.extend({ftype:Xe("simple_battery"),capacity:Mat}),R2e=yg.extend({ftype:Xe("simple_inductor"),inductance:Yte,display_inductance:Z().optional(),max_current_rating:mt().optional()}),T2e=yg.extend({ftype:Xe("simple_push_button")}),k2e=yg.extend({ftype:Xe("simple_potentiometer"),max_resistance:u8,display_max_resistance:Z().optional()}),jat=yg.extend({ftype:Xe("simple_crystal"),frequency:mt().describe("Frequency in Hz"),load_capacitance:mt().optional().describe("Load capacitance in pF"),pin_variant:Kn(["two_pin","four_pin"]).optional()}),F2e=yg.extend({ftype:Xe("simple_pin_header"),pin_count:mt(),gender:Kn(["male","female"]).optional().default("male")}),qat=["usb_c","m2","jst_sh","jst_gh","jst_zh","jst_ph","jst_xh","jst_vh"],Xat=yg.extend({ftype:Xe("simple_connector"),standard:Kn(qat).optional(),pin_count:mt().int().positive().optional()}),L2e=yg.extend({ftype:Xe("simple_pinout")}),H2e=yg.extend({ftype:Xe("simple_resonator"),load_capacitance:QM,equivalent_series_resistance:u8.optional(),frequency:cy}),O2e=yg.extend({ftype:Xe("simple_transistor"),transistor_type:Kn(["npn","pnp"])}),G2e=yg.extend({ftype:Xe("simple_test_point"),footprint_variant:Kn(["pad","through_hole"]).optional(),pad_shape:Kn(["rect","circle"]).optional(),pad_diameter:xo([mt(),Z()]).optional(),hole_diameter:xo([mt(),Z()]).optional(),width:xo([mt(),Z()]).optional(),height:xo([mt(),Z()]).optional()}),Y2e=yg.extend({ftype:Xe("simple_mosfet"),channel_type:Kn(["n","p"]),mosfet_mode:Kn(["enhancement","depletion"])}),U2e=yg.extend({ftype:Xe("simple_op_amp")}),K2e=yg.extend({ftype:Xe("simple_switch")}),V2e=wt({type:Xe("source_project_metadata"),name:Z().optional(),software_used_string:Z().optional(),project_url:Z().optional(),source_filesystem_md5_hash:Z().optional(),created_at:wat.optional()}),$at=Ql.extend({type:Xe("source_missing_property_error"),source_missing_property_error_id:so("source_missing_property_error"),source_component_id:Z(),property_name:Z(),subcircuit_id:Z().optional(),error_type:Xe("source_missing_property_error").default("source_missing_property_error")}).describe("The source code is missing a property"),Zat=Ql.extend({type:Xe("source_failed_to_create_component_error"),source_failed_to_create_component_error_id:so("source_failed_to_create_component_error"),error_type:Xe("source_failed_to_create_component_error").default("source_failed_to_create_component_error"),component_name:Z().optional(),subcircuit_id:Z().optional(),parent_source_component_id:Z().optional(),pcb_center:wt({x:mt().optional(),y:mt().optional()}).optional(),schematic_center:wt({x:mt().optional(),y:mt().optional()}).optional()}).describe("Error emitted when a component fails to be constructed"),z2e=Ql.extend({type:Xe("source_invalid_component_property_error"),source_invalid_component_property_error_id:so("source_invalid_component_property_error"),source_component_id:Z(),property_name:Z(),property_value:b2e().optional(),expected_format:Z().optional(),subcircuit_id:Z().optional(),error_type:Xe("source_invalid_component_property_error").default("source_invalid_component_property_error")}).describe("The source component property is invalid"),J2e=Ql.extend({type:Xe("source_trace_not_connected_error"),source_trace_not_connected_error_id:so("source_trace_not_connected_error"),error_type:Xe("source_trace_not_connected_error").default("source_trace_not_connected_error"),subcircuit_id:Z().optional(),source_group_id:Z().optional(),source_trace_id:Z().optional(),connected_source_port_ids:dn(Z()).optional(),selectors_not_found:dn(Z()).optional()}).describe("Occurs when a source trace selector does not match any ports"),eAt=wt({type:Xe("source_property_ignored_warning"),source_property_ignored_warning_id:so("source_property_ignored_warning"),source_component_id:Z(),property_name:Z(),subcircuit_id:Z().optional(),error_type:Xe("source_property_ignored_warning").default("source_property_ignored_warning"),message:Z()}).describe("The source property was ignored"),W2e=wt({type:Xe("source_pin_missing_trace_warning"),source_pin_missing_trace_warning_id:so("source_pin_missing_trace_warning"),warning_type:Xe("source_pin_missing_trace_warning").default("source_pin_missing_trace_warning"),message:Z(),source_component_id:Z(),source_port_id:Z(),subcircuit_id:Z().optional()}).describe("Warning emitted when a source component pin is missing a trace connection"),j2e=wt({type:Xe("source_missing_manufacturer_part_number_warning"),source_missing_manufacturer_part_number_warning_id:so("source_missing_manufacturer_part_number_warning"),warning_type:Xe("source_missing_manufacturer_part_number_warning").default("source_missing_manufacturer_part_number_warning"),message:Z(),source_component_id:Z(),standard:Z(),subcircuit_id:Z().optional()}).describe("Warning emitted when a standard connector is missing manufacturer part number"),q2e=wt({type:Xe("source_refdes_convention_warning"),source_refdes_convention_warning_id:so("source_refdes_convention_warning"),warning_type:Xe("source_refdes_convention_warning").default("source_refdes_convention_warning"),message:Z(),source_component_id:Z(),refdes:Z(),source_component_ftype:Z(),expected_prefixes:dn(Z()),actual_prefix:Z().optional(),subcircuit_id:Z().optional()}).describe("Warning emitted when a source component reference designator does not match the component type convention"),tAt=yg.extend({ftype:Xe("simple_voltage_probe")}),nAt=yg.extend({ftype:Xe("interconnect")}),X2e=Ql.extend({type:Xe("source_i2c_misconfigured_error"),source_i2c_misconfigured_error_id:so("source_i2c_misconfigured_error"),error_type:Xe("source_i2c_misconfigured_error").default("source_i2c_misconfigured_error"),source_port_ids:dn(Z())}).describe("Error emitted when incompatible I2C pins (e.g. SDA and SCL) are connected to the same net"),nV=Ql.extend({type:Xe("source_component_misconfigured_error"),source_component_misconfigured_error_id:so("source_component_misconfigured_error"),error_type:Xe("source_component_misconfigured_error").default("source_component_misconfigured_error"),source_component_ids:dn(Z()),source_port_ids:dn(Z()).optional()}).describe("Error emitted when one or more source components have an invalid or conflicting configuration"),oAt=yg.extend({ftype:Xe("simple_voltage_source"),voltage:N_,frequency:cy.optional(),peak_to_peak_voltage:N_.optional(),wave_shape:Kn(["sinewave","square","triangle","sawtooth"]).optional(),phase:tA.optional(),duty_cycle:mt().optional().describe("Duty cycle as a fraction (0 to 1)"),pulse_delay:bl.optional(),rise_time:bl.optional(),fall_time:bl.optional(),pulse_width:bl.optional(),period:bl.optional()}),iAt=xo([P2e,v2e,zte,Uat,w2e,Kat,M2e,D2e,Vat,Jat,N2e,R2e,T2e,k2e,jat,F2e,Xat,L2e,H2e,K2e,O2e,G2e,Y2e,U2e,zat,tAt,nAt,oAt,V2e,$at,z2e,Zat,J2e,eAt,W2e,j2e,q2e,X2e,nV]),rAt=wt({type:Xe("source_port"),pin_number:mt().optional(),port_hints:dn(Z()).optional(),name:Z(),source_port_id:Z(),source_component_id:Z().optional(),source_group_id:Z().optional(),most_frequently_referenced_by_name:Z().optional(),subcircuit_id:Z().optional(),subcircuit_connectivity_map_key:Z().optional()}).merge(Wat),sAt=wt({type:Xe("source_component_internal_connection"),source_component_internal_connection_id:Z(),source_component_id:Z(),source_port_ids:dn(Z()),subcircuit_id:Z().optional()}),aAt=wt({type:Xe("source_trace"),source_trace_id:Z(),connected_source_port_ids:dn(Z()),connected_source_net_ids:dn(Z()),subcircuit_id:Z().optional(),subcircuit_connectivity_map_key:Z().optional(),max_length:mt().optional(),max_via_count:mt().int().nonnegative().optional(),name:Z().optional(),min_trace_thickness:mt().optional(),display_name:Z().optional()}),AAt=wt({type:Xe("source_group"),source_group_id:Z(),subcircuit_id:Z().optional(),parent_subcircuit_id:Z().optional(),parent_source_group_id:Z().optional(),is_subcircuit:qe().optional(),show_as_schematic_box:qe().optional(),name:Z().optional(),was_automatically_named:qe().optional()}),cAt=wt({type:Xe("source_net"),source_net_id:Z(),name:Z(),member_source_group_ids:dn(Z()),is_power:qe().optional(),is_ground:qe().optional(),is_digital_signal:qe().optional(),is_analog_signal:qe().optional(),is_positive_voltage_source:qe().optional(),trace_width:mt().optional(),subcircuit_id:Z().optional(),subcircuit_connectivity_map_key:Z().optional()}),lAt=wt({type:Xe("source_board"),source_board_id:Z(),source_group_id:Z(),title:Z().optional()}).describe("Defines a board in the source domain"),gAt=Ql.extend({type:Xe("source_ambiguous_port_reference"),source_ambiguous_port_reference_id:so("source_ambiguous_port_reference"),error_type:Xe("source_ambiguous_port_reference").default("source_ambiguous_port_reference"),source_port_id:Z().optional(),source_component_id:Z().optional()}).describe("Error emitted when a port hint matches multiple non-overlapping pads, making the port reference ambiguous"),uAt=wt({type:Xe("source_pcb_ground_plane"),source_pcb_ground_plane_id:Z(),source_group_id:Z(),source_net_id:Z(),subcircuit_id:Z().optional()}).describe("Defines a ground plane in the source domain"),Qk=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6","inner7","inner8"],$2e=Kn(Qk),Qr=$2e.or(wt({name:$2e})).transform(t=>typeof t=="string"?t:t.name),Om=Kn(["top","bottom"]),dAt=wt({type:Xe("source_manually_placed_via"),source_manually_placed_via_id:Z(),source_group_id:Z(),source_net_id:Z().min(1).optional(),subcircuit_id:Z().optional(),source_trace_id:Z().optional()}).describe("Defines a via that is manually placed in the source domain"),hAt=wt({type:Xe("source_unnamed_trace_warning"),source_unnamed_trace_warning_id:so("source_unnamed_trace_warning"),warning_type:Xe("source_unnamed_trace_warning").default("source_unnamed_trace_warning"),message:Z(),source_trace_id:Z(),subcircuit_id:Z().optional()}).describe("Warning emitted when a source trace is missing a name"),pAt=wt({type:Xe("source_no_power_pin_defined_warning"),source_no_power_pin_defined_warning_id:so("source_no_power_pin_defined_warning"),warning_type:Xe("source_no_power_pin_defined_warning").default("source_no_power_pin_defined_warning"),message:Z(),source_component_id:Z(),source_port_ids:dn(Z()),subcircuit_id:Z().optional()}).describe("Warning emitted when a chip has no source ports with requires_power=true"),mAt=wt({type:Xe("source_no_ground_pin_defined_warning"),source_no_ground_pin_defined_warning_id:so("source_no_ground_pin_defined_warning"),warning_type:Xe("source_no_ground_pin_defined_warning").default("source_no_ground_pin_defined_warning"),message:Z(),source_component_id:Z(),source_port_ids:dn(Z()),subcircuit_id:Z().optional()}).describe("Warning emitted when a chip has no source ports marked as ground pins"),_At=wt({type:Xe("source_component_pins_underspecified_warning"),source_component_pins_underspecified_warning_id:so("source_component_pins_underspecified_warning"),warning_type:Xe("source_component_pins_underspecified_warning").default("source_component_pins_underspecified_warning"),message:Z(),source_component_id:Z(),source_port_ids:dn(Z()),subcircuit_id:Z().optional()}).describe("Warning emitted when all ports on a source component are underspecified"),fAt=Ql.extend({type:Xe("source_pin_must_be_connected_error"),source_pin_must_be_connected_error_id:so("source_pin_must_be_connected_error"),error_type:Xe("source_pin_must_be_connected_error").default("source_pin_must_be_connected_error"),source_component_id:Z(),source_port_id:Z(),subcircuit_id:Z().optional()}).describe("Error emitted when a pin with mustBeConnected attribute is not connected to any trace"),IAt=Ql.extend({type:Xe("unknown_error_finding_part"),unknown_error_finding_part_id:so("unknown_error_finding_part"),error_type:Xe("unknown_error_finding_part").default("unknown_error_finding_part"),source_component_id:Z().optional(),subcircuit_id:Z().optional()}).describe("Error emitted when an unexpected error occurs while finding a part"),oV=wt({type:Xe("source_part_not_found_warning"),source_part_not_found_warning_id:so("source_part_not_found_warning"),warning_type:Xe("source_part_not_found_warning").default("source_part_not_found_warning"),message:Z(),source_component_id:Z().optional(),subcircuit_id:Z().optional(),supplier_name:vM.optional(),manufacturer_part_number:Z().optional(),supplier_part_number:Z().optional(),part_name:Z().optional()}).describe("Warning emitted when a requested part can not be found"),CAt=wt({type:Xe("source_confusing_net_name_warning"),source_confusing_net_name_warning_id:so("source_confusing_net_name_warning"),warning_type:Xe("source_confusing_net_name_warning").default("source_confusing_net_name_warning"),message:Z(),source_net_ids:dn(Z()).min(2),net_name:Z(),subcircuit_id:Z().optional()}).describe("Warning emitted when electrically disconnected source nets share a name"),yAt=wt({type:Xe("schematic_box"),schematic_sheet_id:Z().optional(),schematic_component_id:Z().optional(),schematic_symbol_id:Z().optional(),width:ct,height:ct,is_dashed:qe().default(!1),x:ct,y:ct,subcircuit_id:Z().optional()}).describe("Draws a box on the schematic"),xAt=wt({type:Xe("schematic_path"),schematic_path_id:so("schematic_path"),schematic_sheet_id:Z().optional(),schematic_component_id:Z().optional(),schematic_symbol_id:Z().optional(),fill_color:Z().optional(),is_filled:qe().optional(),is_dashed:qe().default(!1),stroke_width:ct.nullable().optional(),stroke_color:Z().optional(),dash_length:ct.optional(),dash_gap:ct.optional(),points:dn(Ti),subcircuit_id:Z().optional()}),EAt=xc(wt({left_margin:ce.optional(),right_margin:ce.optional(),top_margin:ce.optional(),bottom_margin:ce.optional()})),BAt=wt({left_size:mt(),right_size:mt(),top_size:mt().optional(),bottom_size:mt().optional()}),SAt=wt({left_side:wt({pins:dn(mt()),direction:Kn(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:wt({pins:dn(mt()),direction:Kn(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:wt({pins:dn(mt()),direction:Kn(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:wt({pins:dn(mt()),direction:Kn(["left-to-right","right-to-left"]).optional()}).optional()}),bAt=xo([BAt,SAt]),QAt=wt({type:Xe("schematic_component"),size:Ute,center:Ti,source_component_id:Z().optional(),schematic_component_id:Z(),schematic_sheet_id:Z().optional(),schematic_symbol_id:Z().optional(),pin_spacing:ce.optional(),pin_styles:EAt.optional(),box_width:ce.optional(),symbol_name:Z().optional(),port_arrangement:bAt.optional(),port_labels:xc(Z()).optional(),symbol_display_value:Z().optional(),subcircuit_id:Z().optional(),schematic_group_id:Z().optional(),is_schematic_group:qe().optional(),source_group_id:Z().optional(),is_box_with_pins:qe().optional().default(!0)}),s9n=wt({kicad_symbol:Yat.optional()}).catchall(b2e()),vAt=wt({type:Xe("schematic_symbol"),schematic_symbol_id:Z(),name:Z().optional(),metadata:s9n.optional()}).describe("Defines a named schematic symbol that can be referenced by components."),PAt=wt({type:Xe("schematic_line"),schematic_line_id:so("schematic_line"),schematic_sheet_id:Z().optional(),schematic_component_id:Z().optional(),schematic_symbol_id:Z().optional(),x1:ct,y1:ct,x2:ct,y2:ct,stroke_width:ct.nullable().optional(),color:Z().default("#000000"),is_dashed:qe().default(!1),dash_length:ct.optional(),dash_gap:ct.optional(),subcircuit_id:Z().optional()}).describe("Draws a styled line on the schematic"),wAt=wt({type:Xe("schematic_rect"),schematic_rect_id:so("schematic_rect"),schematic_sheet_id:Z().optional(),schematic_component_id:Z().optional(),schematic_symbol_id:Z().optional(),center:Ti,width:ct,height:ct,rotation:tA.default(0),stroke_width:ct.nullable().optional(),color:Z().default("#000000"),is_filled:qe().default(!1),fill_color:Z().optional(),is_dashed:qe().default(!1),subcircuit_id:Z().optional()}).describe("Draws a styled rectangle on the schematic"),MAt=wt({type:Xe("schematic_circle"),schematic_circle_id:so("schematic_circle"),schematic_sheet_id:Z().optional(),schematic_component_id:Z().optional(),schematic_symbol_id:Z().optional(),center:Ti,radius:ct,stroke_width:ct.nullable().optional(),color:Z().default("#000000"),is_filled:qe().default(!1),fill_color:Z().optional(),is_dashed:qe().default(!1),subcircuit_id:Z().optional()}).describe("Draws a styled circle on the schematic"),DAt=wt({type:Xe("schematic_arc"),schematic_arc_id:so("schematic_arc"),schematic_sheet_id:Z().optional(),schematic_component_id:Z().optional(),schematic_symbol_id:Z().optional(),center:Ti,radius:ct,start_angle_degrees:tA,end_angle_degrees:tA,direction:Kn(["clockwise","counterclockwise"]).default("counterclockwise"),stroke_width:ct.nullable().optional(),color:Z().default("#000000"),is_dashed:qe().default(!1),subcircuit_id:Z().optional()}).describe("Draws a styled arc on the schematic"),NAt=wt({type:Xe("schematic_trace"),schematic_trace_id:Z(),schematic_sheet_id:Z().optional(),source_trace_id:Z().optional(),junctions:dn(wt({x:mt(),y:mt()})),edges:dn(wt({from:wt({x:mt(),y:mt()}),to:wt({x:mt(),y:mt()}),is_crossing:qe().optional(),from_schematic_port_id:Z().optional(),to_schematic_port_id:Z().optional()})),subcircuit_id:Z().optional(),subcircuit_connectivity_map_key:Z().optional()}),a9n=Kn(["center","left","right","top","bottom"]),Z2e=wt({text:Z(),is_overlined:qe().optional()}),RAt=wt({type:Xe("schematic_text"),schematic_sheet_id:Z().optional(),schematic_component_id:Z().optional(),schematic_symbol_id:Z().optional(),schematic_text_id:Z(),source_trace_id:Z().optional(),text:Z(),text_parts:dn(Z2e).min(1).optional(),display_superscript:Z().optional(),font_size:mt().default(.18),position:wt({x:ct,y:ct}),rotation:mt().default(0),anchor:xo([a9n.describe("legacy"),d8]).default("center"),color:Z().default("#000000"),subcircuit_id:Z().optional()}),TAt=wt({type:Xe("schematic_port"),schematic_port_id:Z(),source_port_id:Z(),schematic_sheet_id:Z().optional(),schematic_component_id:Z().optional(),center:Ti,facing_direction:Kn(["up","down","left","right"]).optional(),distance_from_component_edge:mt().optional(),side_of_component:Kn(["top","bottom","left","right"]).optional(),true_ccw_index:mt().optional(),pin_number:mt().optional(),display_pin_label:Z().optional(),display_pin_label_text_parts:dn(Z2e).min(1).optional(),display_pin_label_font_size:mt().positive().finite().optional(),subcircuit_id:Z().optional(),is_connected:qe().optional(),is_internal_circuit_port:qe().optional(),is_overlapping_internal_circuit_port:qe().optional(),has_input_arrow:qe().optional(),has_output_arrow:qe().optional(),is_drawn_with_inversion_circle:qe().optional()}).describe("Defines a port on a schematic component"),kAt=wt({type:Xe("schematic_net_label"),schematic_net_label_id:so("schematic_net_label"),schematic_sheet_id:Z().optional(),schematic_trace_id:Z().optional(),source_trace_id:Z().optional(),source_net_id:Z(),center:Ti,anchor_position:Ti.optional(),anchor_side:Kn(["top","bottom","left","right"]),text:Z(),display_superscript:Z().optional(),symbol_name:Z().optional(),is_movable:qe().optional(),subcircuit_id:Z().optional()}),FAt=Ql.extend({type:Xe("schematic_error"),schematic_error_id:Z(),error_type:Xe("schematic_port_not_found").default("schematic_port_not_found"),subcircuit_id:Z().optional()}).describe("Defines a schematic error on the schematic"),LAt=Ql.extend({type:Xe("schematic_layout_error"),schematic_layout_error_id:so("schematic_layout_error"),error_type:Xe("schematic_layout_error").default("schematic_layout_error"),source_group_id:Z(),schematic_group_id:Z(),subcircuit_id:Z().optional()}).describe("Error emitted when schematic layout fails for a group"),Jte=wt({type:Xe("schematic_debug_object"),label:Z().optional(),subcircuit_id:Z().optional()}),HAt=Jte.extend({shape:Xe("rect"),center:Ti,size:Ute}),OAt=Jte.extend({shape:Xe("line"),start:Ti,end:Ti}),GAt=Jte.extend({shape:Xe("point"),center:Ti}),YAt=Ay("shape",[HAt,OAt,GAt]),UAt=wt({type:Xe("schematic_voltage_probe"),schematic_voltage_probe_id:Z(),schematic_sheet_id:Z().optional(),source_component_id:Z().optional(),name:Z().optional(),position:Ti,schematic_trace_id:Z(),voltage:N_.optional(),subcircuit_id:Z().optional(),color:Z().optional(),label_alignment:d8.optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),exe=wt({type:Xe("schematic_manual_edit_conflict_warning"),schematic_manual_edit_conflict_warning_id:so("schematic_manual_edit_conflict_warning"),warning_type:Xe("schematic_manual_edit_conflict_warning").default("schematic_manual_edit_conflict_warning"),message:Z(),schematic_component_id:Z(),schematic_group_id:Z().optional(),subcircuit_id:Z().optional(),source_component_id:Z()}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates"),KAt=wt({type:Xe("schematic_component_overlap_warning"),schematic_component_overlap_warning_id:so("schematic_component_overlap_warning"),warning_type:Xe("schematic_component_overlap_warning").default("schematic_component_overlap_warning"),message:Z(),schematic_component_ids:oQ([Z(),Z()]),schematic_sheet_id:Z().optional()}).describe("Warning emitted when the rendered bounds of two schematic components overlap"),VAt=wt({type:Xe("schematic_component_styling_warning"),schematic_component_styling_warning_id:so("schematic_component_styling_warning"),warning_type:Xe("schematic_component_styling_warning").default("schematic_component_styling_warning"),message:Z(),schematic_component_id:Z(),styling_issue_type:Z(),schematic_port_ids:dn(Z()).optional(),source_component_id:Z().optional(),schematic_sheet_id:Z().optional(),subcircuit_id:Z().optional()}).describe("Warning emitted when a schematic component has a visual styling issue"),zAt=wt({type:Xe("schematic_element_outside_sheet_warning"),schematic_element_outside_sheet_warning_id:so("schematic_element_outside_sheet_warning"),warning_type:Xe("schematic_element_outside_sheet_warning").default("schematic_element_outside_sheet_warning"),message:Z(),schematic_sheet_id:Z(),schematic_element_type:Kn(["schematic_component","schematic_net_label","schematic_trace"]),schematic_element_id:Z()}).describe("Warning emitted when a schematic component, net label, or trace extends outside its schematic sheet"),JAt=ct.pipe(mt().positive().finite()),WAt=wt({type:Xe("schematic_graphic"),schematic_graphic_id:so("schematic_graphic"),schematic_sheet_id:Z().optional(),asset:Kte.optional(),svg_content:Z().optional(),width:JAt.optional(),height:JAt.optional()}).describe("References a graphic asset or inline SVG content with optional centered layout bounds on a schematic sheet").superRefine(({asset:t,svg_content:e},n)=>{t===void 0&&e===void 0&&n.addIssue({code:lo.custom,message:"At least one of asset or svg_content is required"})}),jAt=wt({type:Xe("schematic_group"),schematic_group_id:so("schematic_group"),schematic_sheet_id:Z().optional(),source_group_id:Z(),is_subcircuit:qe().optional(),subcircuit_id:Z().optional(),width:ce,height:ce,center:Ti,schematic_component_ids:dn(Z()),show_as_schematic_box:qe().optional(),name:Z().optional(),description:Z().optional()}).describe("Defines a group of components on the schematic"),qAt=wt({type:Xe("schematic_table"),schematic_table_id:so("schematic_table"),schematic_sheet_id:Z().optional(),anchor_position:Ti,column_widths:dn(ct),row_heights:dn(ct),cell_padding:ct.optional(),border_width:ct.optional(),subcircuit_id:Z().optional(),schematic_component_id:Z().optional(),anchor:d8.optional()}).describe("Defines a table on the schematic"),XAt=wt({type:Xe("schematic_table_cell"),schematic_table_cell_id:so("schematic_table_cell"),schematic_sheet_id:Z().optional(),schematic_table_id:Z(),start_row_index:mt(),end_row_index:mt(),start_column_index:mt(),end_column_index:mt(),text:Z().optional(),center:Ti,width:ct,height:ct,horizontal_align:Kn(["left","center","right"]).optional(),vertical_align:Kn(["top","middle","bottom"]).optional(),font_size:ct.optional(),subcircuit_id:Z().optional()}).describe("Defines a cell within a schematic_table"),txe=Kn(["a4","ansi_b"]),$At=wt({type:Xe("schematic_sheet"),schematic_sheet_id:so("schematic_sheet"),name:Z().optional(),sheet_index:mt().optional(),sheet_size:txe.optional(),sheet_width:mt().positive().optional(),sheet_height:mt().positive().optional(),subcircuit_id:Z().optional(),outline_color:Z().optional()}).describe("Defines a schematic sheet or page that components can be placed on"),ZAt=wt({type:Xe("schematic_missing_sheet_warning"),schematic_missing_sheet_warning_id:so("schematic_missing_sheet_warning"),warning_type:Xe("schematic_missing_sheet_warning").default("schematic_missing_sheet_warning"),message:Z()}).describe("Circuit-wide warning emitted when a schematic has no schematic sheet. Display as a banner without attaching it to a component or drawing a target outline or leader line."),ect=wt({x:ct,y:ct,bulge:mt().optional()}),nxe=wt({vertices:dn(ect)}),oxe=wt({outer_ring:nxe,inner_rings:dn(nxe).default([])}),ixe={from_left:"from_left",from_right:"from_right",from_top:"from_top",from_bottom:"from_bottom",from_above:"from_above",from_below:"from_below",from_x_neg:"from_left",from_x_pos:"from_right",from_y_pos:"from_top",from_y_neg:"from_bottom",from_z_pos:"from_above",from_z_neg:"from_below",from_front:"from_top",from_back:"from_bottom"},A9n={from_left:{x:-1,y:0,z:0},from_right:{x:1,y:0,z:0},from_top:{x:0,y:1,z:0},from_bottom:{x:0,y:-1,z:0},from_above:{x:0,y:0,z:1},from_below:{x:0,y:0,z:-1}},tct=Kn(["from_left","from_right","from_top","from_bottom","from_above","from_below","from_x_neg","from_x_pos","from_y_pos","from_y_neg","from_z_pos","from_z_neg","from_front","from_back"]).transform(t=>ixe[t]).describe('The side exposing the receptacle where the cable or mating part is attached, following the 2D PCB diagram convention, not a 3D viewport frame. In project coordinate space, "from_top" is +Y, "from_bottom" -Y, "from_left" -X, "from_right" +X, "from_above" +Z and "from_below" -Z. A receptacle on the +Y edge is "from_top" even though the plug moves in -Y as it seats. Cartesian spellings such as "from_y_pos" are accepted and normalized to the named values, as are the deprecated "from_front" (now "from_top") and "from_back" (now "from_bottom").'),iV=Kn(["leftside_top","leftside_bottom","rightside_top","rightside_bottom","topside_left","topside_right","bottomside_left","bottomside_right"]),c9n=[["leftside_top","bottomside_left","rightside_bottom","topside_right"],["leftside_bottom","bottomside_right","rightside_top","topside_left"]],l9n=(t,e)=>{for(const n of c9n){const o=n.indexOf(t),i=n.indexOf(e);if(o!==-1&&i!==-1)return(i-o+n.length)%n.length*90}return null},nct=wt({x:ct,y:ct,via:qe().optional(),via_to_layer:Qr.optional()}),g9n=dn(nct),m9=wt({x:ct,y:ct,via:qe().optional(),to_layer:Qr.optional(),trace_width:ct.optional()}),oct=wt({min_trace_width:ce.optional(),min_board_edge_clearance:ce.optional(),min_via_hole_edge_to_via_hole_edge_clearance:ce.optional(),min_plated_hole_drill_edge_to_drill_edge_clearance:ce.optional(),min_trace_to_pad_edge_clearance:ce.optional(),min_pad_edge_to_pad_edge_clearance:ce.optional(),min_same_net_trace_edge_to_trace_edge_clearance:ce.optional(),min_different_net_trace_edge_to_trace_edge_clearance:ce.optional(),min_via_edge_to_pad_edge_clearance:ce.optional(),min_via_hole_diameter:ce.optional(),min_via_pad_diameter:ce.optional()}),ict=wt({type:Xe("pcb_component"),pcb_component_id:so("pcb_component"),source_component_id:Z(),center:Ti,layer:Qr,rotation:tA,display_offset_x:Z().optional().describe("How to display the x offset for this part, usually corresponding with how the user specified it"),display_offset_y:Z().optional().describe("How to display the y offset for this part, usually corresponding with how the user specified it"),width:ce,height:ce,do_not_place:qe().optional(),is_allowed_to_be_off_board:qe().optional(),subcircuit_id:Z().optional(),pcb_group_id:Z().optional(),position_mode:Kn(["packed","relative_to_group_anchor","relative_to_another_component","none"]).optional(),anchor_position:Ti.optional(),anchor_alignment:d8.optional(),positioned_relative_to_pcb_group_id:Z().optional(),positioned_relative_to_pcb_board_id:Z().optional(),cable_insertion_center:Ti.optional(),insertion_direction:tct.optional(),pin1_location:iV.optional().describe("Location of pin 1 on the unrotated, top-view component footprint"),supplier_pin1_location_map:xc(vM,iV).optional().describe("Pin 1 location for each supplier's unrotated, top-view footprint"),metadata:wt({kicad_footprint:Fat.optional()}).optional(),obstructs_within_bounds:qe().default(!0).describe("Does this component take up all the space within its bounds on a layer. This is generally true except for when separated pin headers are being represented by a single component (in which case, chips can be placed between the pin headers) or for tall modules where chips fit underneath")}).describe("Defines a component on the PCB"),Wte=wt({type:Xe("pcb_debug_object"),pcb_debug_object_id:so("pcb_debug_object"),label:Z().optional(),subcircuit_id:Z().optional()}),rct=Wte.extend({shape:Xe("rect"),center:Ti,size:Ute}),sct=Wte.extend({shape:Xe("line"),start:Ti,end:Ti}),act=Wte.extend({shape:Xe("point"),center:Ti}),Act=Ay("shape",[rct,sct,act]),cct=wt({type:Xe("pcb_hole"),pcb_hole_id:so("pcb_hole"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),pcb_component_id:Z().optional(),hole_shape:Xe("circle"),hole_diameter:mt(),x:ct,y:ct,is_covered_with_solder_mask:qe().optional(),soldermask_margin:mt().optional()}),u9n=cct.describe("Defines a circular hole on the PCB"),lct=wt({type:Xe("pcb_hole"),pcb_hole_id:so("pcb_hole"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),pcb_component_id:Z().optional(),hole_shape:Xe("rect"),hole_width:mt(),hole_height:mt(),x:ct,y:ct,is_covered_with_solder_mask:qe().optional(),soldermask_margin:mt().optional()}),d9n=lct.describe("Defines a rectangular (square-capable) hole on the PCB. Use equal width/height for square."),gct=wt({type:Xe("pcb_hole"),pcb_hole_id:so("pcb_hole"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),pcb_component_id:Z().optional(),hole_shape:Kn(["circle","square"]),hole_diameter:mt(),x:ct,y:ct,is_covered_with_solder_mask:qe().optional(),soldermask_margin:mt().optional()}),h9n=gct.describe("Defines a circular or square hole on the PCB"),uct=wt({type:Xe("pcb_hole"),pcb_hole_id:so("pcb_hole"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),pcb_component_id:Z().optional(),hole_shape:Xe("oval"),hole_width:mt(),hole_height:mt(),x:ct,y:ct,is_covered_with_solder_mask:qe().optional(),soldermask_margin:mt().optional()}),p9n=uct.describe("Defines an oval hole on the PCB"),dct=wt({type:Xe("pcb_hole"),pcb_hole_id:so("pcb_hole"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),pcb_component_id:Z().optional(),hole_shape:Xe("pill"),hole_width:mt(),hole_height:mt(),x:ct,y:ct,is_covered_with_solder_mask:qe().optional(),soldermask_margin:mt().optional()}),m9n=dct.describe("Defines a pill-shaped hole on the PCB"),hct=wt({type:Xe("pcb_hole"),pcb_hole_id:so("pcb_hole"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),pcb_component_id:Z().optional(),hole_shape:Xe("rotated_pill"),hole_width:mt(),hole_height:mt(),x:ct,y:ct,ccw_rotation:tA,is_covered_with_solder_mask:qe().optional(),soldermask_margin:mt().optional()}),_9n=hct.describe("Defines a rotated pill-shaped hole on the PCB"),pct=gct.or(uct).or(dct).or(hct).or(cct).or(lct),f9n=wt({type:Xe("pcb_plated_hole"),shape:Xe("circle"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),outer_diameter:mt(),hole_diameter:mt(),is_covered_with_solder_mask:qe().optional(),x:ct,y:ct,layers:dn(Qr),port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),pcb_plated_hole_id:so("pcb_plated_hole"),soldermask_margin:mt().optional()}),I9n=wt({type:Xe("pcb_plated_hole"),shape:Kn(["oval","pill"]),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),outer_width:mt(),outer_height:mt(),hole_width:mt(),hole_height:mt(),is_covered_with_solder_mask:qe().optional(),x:ct,y:ct,ccw_rotation:tA,layers:dn(Qr),port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),pcb_plated_hole_id:so("pcb_plated_hole"),soldermask_margin:mt().optional()}),C9n=wt({type:Xe("pcb_plated_hole"),shape:Xe("circular_hole_with_rect_pad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),hole_shape:Xe("circle"),pad_shape:Xe("rect"),hole_diameter:mt(),rect_pad_width:mt(),rect_pad_height:mt(),rect_border_radius:mt().optional(),hole_offset_x:ct.default(0),hole_offset_y:ct.default(0),is_covered_with_solder_mask:qe().optional(),x:ct,y:ct,layers:dn(Qr),port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),pcb_plated_hole_id:so("pcb_plated_hole"),soldermask_margin:mt().optional(),rect_ccw_rotation:tA.optional()}),y9n=wt({type:Xe("pcb_plated_hole"),shape:Xe("pill_hole_with_rect_pad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),hole_shape:Xe("pill"),pad_shape:Xe("rect"),hole_width:mt(),hole_height:mt(),rect_pad_width:mt(),rect_pad_height:mt(),rect_border_radius:mt().optional(),hole_offset_x:ct.default(0),hole_offset_y:ct.default(0),is_covered_with_solder_mask:qe().optional(),x:ct,y:ct,layers:dn(Qr),port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),pcb_plated_hole_id:so("pcb_plated_hole"),soldermask_margin:mt().optional()}),x9n=wt({type:Xe("pcb_plated_hole"),shape:Xe("rotated_pill_hole_with_rect_pad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),hole_shape:Xe("rotated_pill"),pad_shape:Xe("rect"),hole_width:mt(),hole_height:mt(),hole_ccw_rotation:tA,rect_pad_width:mt(),rect_pad_height:mt(),rect_border_radius:mt().optional(),rect_ccw_rotation:tA,hole_offset_x:ct.default(0),hole_offset_y:ct.default(0),is_covered_with_solder_mask:qe().optional(),x:ct,y:ct,layers:dn(Qr),port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),pcb_plated_hole_id:so("pcb_plated_hole"),soldermask_margin:mt().optional()}),E9n=wt({type:Xe("pcb_plated_hole"),shape:Xe("hole_with_polygon_pad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),hole_shape:Kn(["circle","oval","pill","rotated_pill"]),hole_diameter:mt().optional(),hole_width:mt().optional(),hole_height:mt().optional(),pad_outline:dn(wt({x:ct,y:ct})).min(3),hole_offset_x:ct.default(0),hole_offset_y:ct.default(0),is_covered_with_solder_mask:qe().optional(),x:ct,y:ct,layers:dn(Qr),port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),pcb_plated_hole_id:so("pcb_plated_hole"),soldermask_margin:mt().optional(),ccw_rotation:tA.optional()}),mct=xo([f9n,I9n,C9n,y9n,x9n,E9n]),_ct=wt({type:Xe("pcb_port"),pcb_port_id:so("pcb_port"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),source_port_id:Z(),pcb_component_id:Z().optional(),x:ct,y:ct,layers:dn(Qr),is_board_pinout:qe().optional()}).describe("Defines a port on the PCB"),B9n=wt({type:Xe("pcb_smtpad"),shape:Xe("circle"),pcb_smtpad_id:so("pcb_smtpad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),x:ct,y:ct,radius:mt(),layer:Qr,port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),is_covered_with_solder_mask:qe().optional(),soldermask_margin:mt().optional(),solderpaste_margin:mt().optional()}),S9n=wt({type:Xe("pcb_smtpad"),shape:Xe("rect"),pcb_smtpad_id:so("pcb_smtpad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),x:ct,y:ct,width:mt(),height:mt(),rect_border_radius:mt().optional(),corner_radius:mt().optional(),layer:Qr,port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),is_covered_with_solder_mask:qe().optional(),soldermask_margin:mt().optional(),soldermask_margin_left:mt().optional(),soldermask_margin_top:mt().optional(),soldermask_margin_right:mt().optional(),soldermask_margin_bottom:mt().optional(),solderpaste_margin:mt().optional()}),b9n=wt({type:Xe("pcb_smtpad"),shape:Xe("rotated_rect"),pcb_smtpad_id:so("pcb_smtpad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),x:ct,y:ct,width:mt(),height:mt(),rect_border_radius:mt().optional(),corner_radius:mt().optional(),ccw_rotation:tA,layer:Qr,port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),is_covered_with_solder_mask:qe().optional(),soldermask_margin:mt().optional(),soldermask_margin_left:mt().optional(),soldermask_margin_top:mt().optional(),soldermask_margin_right:mt().optional(),soldermask_margin_bottom:mt().optional(),solderpaste_margin:mt().optional()}),fct=wt({type:Xe("pcb_smtpad"),shape:Xe("pill"),pcb_smtpad_id:so("pcb_smtpad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),x:ct,y:ct,width:mt(),height:mt(),radius:mt(),layer:Qr,port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),is_covered_with_solder_mask:qe().optional(),soldermask_margin:mt().optional(),solderpaste_margin:mt().optional()}),Q9n=wt({type:Xe("pcb_smtpad"),shape:Xe("rotated_pill"),pcb_smtpad_id:so("pcb_smtpad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),x:ct,y:ct,width:mt(),height:mt(),radius:mt(),ccw_rotation:tA,layer:Qr,port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),is_covered_with_solder_mask:qe().optional(),soldermask_margin:mt().optional(),solderpaste_margin:mt().optional()}),v9n=wt({type:Xe("pcb_smtpad"),shape:Xe("polygon"),pcb_smtpad_id:so("pcb_smtpad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),points:dn(Ti),layer:Qr,port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),is_covered_with_solder_mask:qe().optional(),soldermask_margin:mt().optional(),solderpaste_margin:mt().optional()}),Ict=Ay("shape",[B9n,S9n,b9n,Q9n,fct,v9n]).describe("Defines an SMT pad on the PCB"),P9n=wt({type:Xe("pcb_solder_paste"),shape:Xe("circle"),pcb_solder_paste_id:so("pcb_solder_paste"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),x:ct,y:ct,radius:mt(),layer:Qr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),w9n=wt({type:Xe("pcb_solder_paste"),shape:Xe("rect"),pcb_solder_paste_id:so("pcb_solder_paste"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),x:ct,y:ct,width:mt(),height:mt(),layer:Qr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),M9n=wt({type:Xe("pcb_solder_paste"),shape:Xe("pill"),pcb_solder_paste_id:so("pcb_solder_paste"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),x:ct,y:ct,width:mt(),height:mt(),radius:mt(),layer:Qr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),D9n=wt({type:Xe("pcb_solder_paste"),shape:Xe("rotated_rect"),pcb_solder_paste_id:so("pcb_solder_paste"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),x:ct,y:ct,width:mt(),height:mt(),ccw_rotation:ct,layer:Qr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),N9n=wt({type:Xe("pcb_solder_paste"),shape:Xe("rotated_pill"),pcb_solder_paste_id:so("pcb_solder_paste"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),x:ct,y:ct,width:mt(),height:mt(),radius:mt(),ccw_rotation:tA,layer:Qr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),R9n=wt({type:Xe("pcb_solder_paste"),shape:Xe("oval"),pcb_solder_paste_id:so("pcb_solder_paste"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),x:ct,y:ct,width:mt(),height:mt(),layer:Qr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),Cct=xo([P9n,w9n,M9n,D9n,N9n,R9n]).describe("Defines solderpaste on the PCB"),yct=wt({type:Xe("pcb_text"),pcb_text_id:so("pcb_text"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),text:Z(),center:Ti,layer:Qr,width:ce,height:ce,lines:mt(),align:Kn(["bottom-left"])}).describe("Defines text on the PCB"),xct=wt({route_type:Xe("wire"),x:ct,y:ct,width:ct,copper_pour_id:Z().optional(),is_inside_copper_pour:qe().optional(),start_pcb_port_id:Z().optional(),end_pcb_port_id:Z().optional(),layer:Qr}),Ect=wt({route_type:Xe("via"),x:ct,y:ct,copper_pour_id:Z().optional(),is_inside_copper_pour:qe().optional(),hole_diameter:ct.optional(),outer_diameter:ct.optional(),from_layer:Qr,to_layer:Qr}),Bct=wt({route_type:Xe("through_pad"),start:Ti,end:Ti,width:ct,start_layer:Qr,end_layer:Qr,pcb_smtpad_id:Z().optional(),pcb_plated_hole_id:Z().optional()}),rxe=xo([xct,Ect,Bct]),Sct=wt({type:Xe("pcb_trace"),source_trace_id:Z().optional(),pcb_component_id:Z().optional(),pcb_trace_id:so("pcb_trace"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),route_thickness_mode:Kn(["constant","interpolated"]).default("constant").optional(),route_order_index:mt().optional(),should_round_corners:qe().optional(),trace_length:mt().optional(),highlight_color:Z().optional(),route:dn(rxe)}).describe("Defines a trace on the PCB"),bct=wt({type:Xe("pcb_trace_warning"),pcb_trace_warning_id:so("pcb_trace_warning"),warning_type:Xe("pcb_trace_warning").default("pcb_trace_warning"),message:Z(),center:Ti.optional(),pcb_trace_id:Z(),source_trace_id:Z(),pcb_component_ids:dn(Z()),pcb_port_ids:dn(Z()),subcircuit_id:Z().optional()}).describe("Defines a trace warning on the PCB"),Qct=wt({type:Xe("pcb_trace_too_long_warning"),pcb_trace_too_long_warning_id:so("pcb_trace_too_long_warning"),warning_type:Xe("pcb_trace_too_long_warning").default("pcb_trace_too_long_warning"),message:Z(),pcb_trace_id:Z(),source_net_id:Z().optional(),source_trace_id:Z().optional(),actual_trace_length:ct,maximum_trace_length:ct,subcircuit_id:Z().optional()}).describe("Warning emitted when a PCB trace is longer than its maximum allowed length"),vct=wt({type:Xe("pcb_trace_too_many_vias_warning"),pcb_trace_too_many_vias_warning_id:so("pcb_trace_too_many_vias_warning"),warning_type:Xe("pcb_trace_too_many_vias_warning").default("pcb_trace_too_many_vias_warning"),message:Z(),pcb_trace_id:Z(),source_net_id:Z().optional(),source_trace_id:Z().optional(),actual_via_count:mt().int().nonnegative(),maximum_via_count:mt().int().nonnegative(),subcircuit_id:Z().optional()}).describe("Warning emitted when a PCB trace has more vias than its maximum allowed count"),Pct=Ql.extend({type:Xe("pcb_trace_error"),pcb_trace_error_id:so("pcb_trace_error"),error_type:Xe("pcb_trace_error").default("pcb_trace_error"),center:Ti.optional(),pcb_trace_id:Z(),source_trace_id:Z(),pcb_component_ids:dn(Z()),pcb_port_ids:dn(Z()),subcircuit_id:Z().optional()}).describe("Defines a trace error on the PCB"),wct=Ql.extend({type:Xe("pcb_trace_missing_error"),pcb_trace_missing_error_id:so("pcb_trace_missing_error"),error_type:Xe("pcb_trace_missing_error").default("pcb_trace_missing_error"),center:Ti.optional(),source_trace_id:Z(),pcb_component_ids:dn(Z()),pcb_port_ids:dn(Z()),subcircuit_id:Z().optional()}).describe("Defines an error when a source trace has no corresponding PCB trace"),Mct=Ql.extend({type:Xe("pcb_port_not_matched_error"),pcb_error_id:so("pcb_error"),error_type:Xe("pcb_port_not_matched_error").default("pcb_port_not_matched_error"),pcb_component_ids:dn(Z()),subcircuit_id:Z().optional()}).describe("Defines a trace error on the PCB where a port is not matched"),Dct=Ql.extend({type:Xe("pcb_port_not_connected_error"),pcb_port_not_connected_error_id:so("pcb_port_not_connected_error"),error_type:Xe("pcb_port_not_connected_error").default("pcb_port_not_connected_error"),pcb_port_ids:dn(Z()),pcb_component_ids:dn(Z()),subcircuit_id:Z().optional()}).describe("Defines an error when a pcb port is not connected to any trace"),Nct=wt({type:Xe("pcb_net"),pcb_net_id:so("pcb_net"),source_net_id:Z().optional(),highlight_color:Z().optional()}).describe("Defines a net on the PCB"),jte=wt({type:Xe("pcb_via"),pcb_via_id:so("pcb_via"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),subcircuit_connectivity_map_key:Z().optional(),x:ct,y:ct,outer_diameter:ct.default("0.6mm"),hole_diameter:ct.default("0.25mm"),from_layer:Qr.optional(),to_layer:Qr.optional(),layers:dn(Qr),pcb_trace_id:Z().optional(),source_trace_id:Z().optional(),source_net_id:Z().min(1).optional(),net_is_assignable:qe().optional(),net_assigned:qe().optional(),is_tented:qe().optional(),tented_on_top:qe().optional(),tented_on_bottom:qe().optional()}).transform(({is_tented:t,...e})=>(t!==void 0&&(e.tented_on_top??=t,e.tented_on_bottom??=t),e)).describe("Defines a via on the PCB"),Rct=wt({type:Xe("pcb_board"),pcb_board_id:so("pcb_board"),pcb_panel_id:Z().optional(),carrier_pcb_board_id:Z().optional(),is_subcircuit:qe().optional(),subcircuit_id:Z().optional(),is_mounted_to_carrier_board:qe().optional(),is_via_in_pad_allowed:qe().optional(),width:ce.optional(),height:ce.optional(),center:Ti,display_offset_x:Z().optional().describe("How to display the x offset for this board, usually corresponding with how the user specified it"),display_offset_y:Z().optional().describe("How to display the y offset for this board, usually corresponding with how the user specified it"),thickness:ce.optional().default(1.4),num_layers:mt().optional().default(4),allow_blind_and_buried_vias:qe().optional().describe("Whether autorouters may generate blind and buried vias. False restricts newly generated vias to the full board stack."),outline:dn(Ti).optional(),shape:Kn(["rect","polygon"]).optional(),material:Kn(["fr4","fr1"]).default("fr4"),solder_mask_color:Z().optional(),silkscreen_color:Z().optional(),anchor_position:Ti.optional(),anchor_alignment:d8.optional(),position_mode:Kn(["relative_to_panel_anchor","none"]).optional()}).merge(oct).describe("Defines the board outline of the PCB"),Tct=wt({type:Xe("pcb_panel"),pcb_panel_id:so("pcb_panel"),width:ce,height:ce,center:Ti,thickness:ce.optional().default(1.4),covered_with_solder_mask:qe().optional().default(!0)}).describe("Defines a PCB panel that can contain multiple boards"),kct=Ql.extend({type:Xe("pcb_placement_error"),pcb_placement_error_id:so("pcb_placement_error"),error_type:Xe("pcb_placement_error").default("pcb_placement_error"),subcircuit_id:Z().optional()}).describe("Defines a placement error on the PCB"),Fct=Ql.extend({type:Xe("pcb_packing_error"),pcb_packing_error_id:so("pcb_packing_error"),error_type:Xe("pcb_packing_error").default("pcb_packing_error"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional()}).describe("Defines a failure to pack PCB components within layout bounds"),Lct=Ql.extend({type:Xe("pcb_panelization_placement_error"),pcb_panelization_placement_error_id:so("pcb_panelization_placement_error"),error_type:Xe("pcb_panelization_placement_error").default("pcb_panelization_placement_error"),pcb_panel_id:Z().optional(),pcb_board_id:Z().optional(),subcircuit_id:Z().optional()}).describe("Defines a panelization placement error on the PCB"),Hct=wt({type:Xe("pcb_trace_hint"),pcb_trace_hint_id:so("pcb_trace_hint"),pcb_port_id:Z(),pcb_component_id:Z(),route:dn(m9),subcircuit_id:Z().optional()}).describe("A hint that can be used during generation of a PCB trace"),Oct=wt({type:Xe("pcb_silkscreen_line"),pcb_silkscreen_line_id:so("pcb_silkscreen_line"),pcb_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),stroke_width:ct.default("0.1mm"),x1:ct,y1:ct,x2:ct,y2:ct,layer:Om}).describe("Defines a silkscreen line on the PCB"),Gct=wt({type:Xe("pcb_silkscreen_path"),pcb_silkscreen_path_id:so("pcb_silkscreen_path"),pcb_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),layer:Om,route:dn(Ti),stroke_width:ce}).describe("Defines a silkscreen path on the PCB"),Yct=wt({type:Xe("pcb_silkscreen_text"),pcb_silkscreen_text_id:so("pcb_silkscreen_text"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),font:Xe("tscircuit2024").default("tscircuit2024"),font_size:ct.default("0.2mm"),pcb_component_id:Z(),text:Z(),is_knockout:qe().default(!1).optional(),knockout_padding:wt({left:ce,top:ce,bottom:ce,right:ce}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:mt().optional(),layer:Qr,is_mirrored:qe().default(!1).optional(),anchor_position:Ti.default({x:0,y:0}),anchor_alignment:d8.default("center")}).describe("Defines silkscreen text on the PCB"),Uct=wt({type:Xe("pcb_copper_text"),pcb_copper_text_id:so("pcb_copper_text"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),font:Xe("tscircuit2024").default("tscircuit2024"),font_size:ct.default("0.2mm"),pcb_component_id:Z(),text:Z(),is_knockout:qe().default(!1).optional(),knockout_padding:wt({left:ce,top:ce,bottom:ce,right:ce}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:mt().optional(),layer:Qr,is_mirrored:qe().default(!1).optional(),anchor_position:Ti.default({x:0,y:0}),anchor_alignment:d8.default("center")}).describe("Defines copper text on the PCB"),Kct=wt({type:Xe("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:so("pcb_silkscreen_rect"),pcb_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),center:Ti,width:ce,height:ce,layer:Qr,stroke_width:ce.default("1mm"),corner_radius:ce.optional(),is_filled:qe().default(!0).optional(),has_stroke:qe().optional(),is_stroke_dashed:qe().optional(),ccw_rotation:mt().optional()}).describe("Defines a silkscreen rect on the PCB"),Vct=wt({type:Xe("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:so("pcb_silkscreen_circle"),pcb_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),center:Ti,radius:ce,layer:Om,stroke_width:ce.default("1mm"),is_filled:qe().optional()}).describe("Defines a silkscreen circle on the PCB"),zct=wt({type:Xe("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:so("pcb_silkscreen_oval"),pcb_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),center:Ti,radius_x:ct,radius_y:ct,layer:Om,ccw_rotation:tA.optional()}).describe("Defines a silkscreen oval on the PCB"),T9n=wt({type:Xe("pcb_silkscreen_graphic"),pcb_silkscreen_graphic_id:so("pcb_silkscreen_graphic"),pcb_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),layer:Om,image_asset:Kte.optional()}),Jct=T9n.extend({shape:Xe("brep"),brep_shape:oxe}).describe("Defines a BRep silkscreen graphic on the PCB"),Wct=Ay("shape",[Jct]).describe("Defines a silkscreen graphic on the PCB"),jct=wt({type:Xe("pcb_silkscreen_pill"),pcb_silkscreen_pill_id:so("pcb_silkscreen_pill"),pcb_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),center:Ti,width:ce,height:ce,layer:Qr,ccw_rotation:mt().optional()}).describe("Defines a silkscreen pill on the PCB"),sxe=wt({type:Xe("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:so("pcb_fabrication_note_text"),subcircuit_id:Z().optional(),pcb_group_id:Z().optional(),font:Xe("tscircuit2024").default("tscircuit2024"),font_size:ct.default("1mm"),pcb_component_id:Z(),text:Z(),ccw_rotation:mt().optional(),layer:Om,anchor_position:Ti.default({x:0,y:0}),anchor_alignment:Kn(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:Z().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),axe=wt({type:Xe("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:so("pcb_fabrication_note_path"),pcb_component_id:Z(),subcircuit_id:Z().optional(),layer:Qr,route:dn(Ti),stroke_width:ce,color:Z().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),Axe=wt({type:Xe("pcb_fabrication_note_rect"),pcb_fabrication_note_rect_id:so("pcb_fabrication_note_rect"),pcb_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),center:Ti,width:ce,height:ce,layer:Om,stroke_width:ce.default("0.1mm"),corner_radius:ce.optional(),is_filled:qe().optional(),has_stroke:qe().optional(),is_stroke_dashed:qe().optional(),color:Z().optional()}).describe("Defines a fabrication note rectangle on the PCB"),cxe=wt({type:Xe("pcb_fabrication_note_dimension"),pcb_fabrication_note_dimension_id:so("pcb_fabrication_note_dimension"),pcb_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),layer:Om,from:Ti,to:Ti,text:Z().optional(),text_ccw_rotation:mt().optional(),offset:ce.optional(),offset_distance:ce.optional(),offset_direction:wt({x:mt(),y:mt()}).optional(),font:Xe("tscircuit2024").default("tscircuit2024"),font_size:ce.default("1mm"),color:Z().optional(),arrow_size:ce.default("1mm")}).describe("Defines a measurement annotation within PCB fabrication notes"),lxe=wt({type:Xe("pcb_note_text"),pcb_note_text_id:so("pcb_note_text"),pcb_component_id:Z().optional(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),name:Z().optional(),font:Xe("tscircuit2024").default("tscircuit2024"),font_size:ct.default("1mm"),text:Z().optional(),anchor_position:Ti.default({x:0,y:0}),anchor_alignment:Kn(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),layer:Om.default("top"),is_mirrored_from_top_view:qe().optional(),color:Z().optional()}).describe("Defines a documentation note in text on the PCB"),gxe=wt({type:Xe("pcb_note_rect"),pcb_note_rect_id:so("pcb_note_rect"),pcb_component_id:Z().optional(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),name:Z().optional(),text:Z().optional(),center:Ti,width:ce,height:ce,layer:Om.default("top"),stroke_width:ce.default("0.1mm"),corner_radius:ce.optional(),is_filled:qe().optional(),has_stroke:qe().optional(),is_stroke_dashed:qe().optional(),color:Z().optional()}).describe("Defines a rectangular documentation note on the PCB"),uxe=wt({type:Xe("pcb_note_path"),pcb_note_path_id:so("pcb_note_path"),pcb_component_id:Z().optional(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),name:Z().optional(),text:Z().optional(),route:dn(Ti),layer:Om.default("top"),stroke_width:ce.default("0.1mm"),color:Z().optional()}).describe("Defines a polyline documentation note on the PCB"),dxe=wt({type:Xe("pcb_note_line"),pcb_note_line_id:so("pcb_note_line"),pcb_component_id:Z().optional(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),name:Z().optional(),text:Z().optional(),x1:ct,y1:ct,x2:ct,y2:ct,layer:Om.default("top"),stroke_width:ct.default("0.1mm"),color:Z().optional(),is_dashed:qe().optional()}).describe("Defines a straight documentation note line on the PCB"),hxe=wt({type:Xe("pcb_note_dimension"),pcb_note_dimension_id:so("pcb_note_dimension"),pcb_component_id:Z().optional(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),name:Z().optional(),from:Ti,to:Ti,text:Z().optional(),text_ccw_rotation:mt().optional(),offset_distance:ce.optional(),offset_direction:wt({x:mt(),y:mt()}).optional(),font:Xe("tscircuit2024").default("tscircuit2024"),font_size:ce.default("1mm"),layer:Om.default("top"),color:Z().optional(),arrow_size:ce.default("1mm")}).describe("Defines a measurement annotation within PCB documentation notes"),qct=Ql.extend({type:Xe("pcb_footprint_overlap_error"),pcb_error_id:so("pcb_error"),error_type:Xe("pcb_footprint_overlap_error").default("pcb_footprint_overlap_error"),pcb_smtpad_ids:dn(Z()).optional(),pcb_plated_hole_ids:dn(Z()).optional(),pcb_hole_ids:dn(Z()).optional(),pcb_keepout_ids:dn(Z()).optional()}).describe("Error emitted when a pcb footprint overlaps with another element"),Xct=Ql.extend({type:Xe("pcb_courtyard_overlap_error"),pcb_error_id:so("pcb_error"),error_type:Xe("pcb_courtyard_overlap_error").default("pcb_courtyard_overlap_error"),pcb_component_ids:oQ([Z(),Z()])}).describe("Error emitted when the courtyard (CrtYd) of one PCB component overlaps with the courtyard of another"),$ct=wt({type:Xe("pcb_keepout"),shape:Xe("outline"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),outline:dn(Ti).min(2),stroke_width:ce,pcb_keepout_id:Z(),layers:dn(Z()),description:Z().optional(),excluded_pcb_component_ids:dn(Z()).optional()}),pxe=wt({type:Xe("pcb_keepout"),shape:Xe("rect"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),center:Ti,width:ct,height:ct,pcb_keepout_id:Z(),layers:dn(Z()),description:Z().optional(),excluded_pcb_component_ids:dn(Z()).optional()}).or(wt({type:Xe("pcb_keepout"),shape:Xe("circle"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),center:Ti,radius:ct,pcb_keepout_id:Z(),layers:dn(Z()),description:Z().optional(),excluded_pcb_component_ids:dn(Z()).optional()})).or($ct),qte=wt({type:Xe("pcb_cutout"),pcb_cutout_id:so("pcb_cutout"),pcb_component_id:Z().optional(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),pcb_board_id:Z().optional(),pcb_panel_id:Z().optional()}),Zct=qte.extend({shape:Xe("rect"),center:Ti,width:ce,height:ce,rotation:tA.optional(),corner_radius:ce.optional()}),elt=qte.extend({shape:Xe("circle"),center:Ti,radius:ce}),tlt=qte.extend({shape:Xe("polygon"),points:dn(Ti)}),nlt=qte.extend({shape:Xe("path"),route:dn(Ti),slot_width:ce,slot_length:ce.optional(),space_between_slots:ce.optional(),slot_corner_radius:ce.optional()}),mxe=Ay("shape",[Zct,elt,tlt,nlt]).describe("Defines a cutout on the PCB, removing board material."),olt=Ql.extend({type:Xe("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:so("pcb_missing_footprint_error"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),error_type:Xe("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),source_component_id:Z()}).describe("Defines a missing footprint error on the PCB"),rV=Ql.extend({type:Xe("external_footprint_load_error"),external_footprint_load_error_id:so("external_footprint_load_error"),pcb_component_id:Z(),source_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),footprinter_string:Z().optional(),error_type:Xe("external_footprint_load_error").default("external_footprint_load_error")}).describe("Defines an error when an external footprint fails to load"),_xe=Ql.extend({type:Xe("circuit_json_footprint_load_error"),circuit_json_footprint_load_error_id:so("circuit_json_footprint_load_error"),pcb_component_id:Z(),source_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),error_type:Xe("circuit_json_footprint_load_error").default("circuit_json_footprint_load_error"),circuit_json:dn(Ad()).optional()}).describe("Defines an error when a circuit JSON footprint fails to load"),ilt=wt({type:Xe("pcb_group"),pcb_group_id:so("pcb_group"),source_group_id:Z(),is_subcircuit:qe().optional(),subcircuit_id:Z().optional(),width:ce.optional(),height:ce.optional(),center:Ti,display_offset_x:Z().optional().describe("How to display the x offset for this group, usually corresponding with how the user specified it"),display_offset_y:Z().optional().describe("How to display the y offset for this group, usually corresponding with how the user specified it"),outline:dn(Ti).optional(),anchor_position:Ti.optional(),anchor_alignment:d8.default("center"),position_mode:Kn(["packed","relative_to_group_anchor","none"]).optional(),positioned_relative_to_pcb_group_id:Z().optional(),positioned_relative_to_pcb_board_id:Z().optional(),pcb_component_ids:dn(Z()),child_layout_mode:Kn(["packed","none"]).optional(),name:Z().optional(),description:Z().optional(),layout_mode:Z().optional(),autorouter_configuration:wt({trace_clearance:ce}).optional(),autorouter_used_string:Z().optional()}).describe("Defines a group of components on the PCB"),rlt=Ql.extend({type:Xe("pcb_autorouting_error"),pcb_error_id:so("pcb_autorouting_error"),error_type:Xe("pcb_autorouting_error").default("pcb_autorouting_error"),subcircuit_id:Z().optional()}).describe("The autorouting has failed to route a portion of the board"),fxe=wt({type:Xe("pcb_manual_edit_conflict_warning"),pcb_manual_edit_conflict_warning_id:so("pcb_manual_edit_conflict_warning"),warning_type:Xe("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),message:Z(),pcb_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),source_component_id:Z()}).describe("Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),slt=Kn(["x-","x+","y+","y-"]),alt=wt({type:Xe("pcb_connector_not_in_accessible_orientation_warning"),pcb_connector_not_in_accessible_orientation_warning_id:so("pcb_connector_not_in_accessible_orientation_warning"),warning_type:Xe("pcb_connector_not_in_accessible_orientation_warning").default("pcb_connector_not_in_accessible_orientation_warning"),message:Z(),pcb_component_id:Z(),source_component_id:Z().optional(),pcb_board_id:Z().optional(),facing_direction:slt,recommended_facing_direction:slt,subcircuit_id:Z().optional()}).describe("Warning emitted when a connector PCB component is facing inward toward the board and should be reoriented to an outward-facing direction"),Alt=wt({type:Xe("pcb_component_missing_courtyard_warning"),pcb_component_missing_courtyard_warning_id:so("pcb_component_missing_courtyard_warning"),warning_type:Xe("pcb_component_missing_courtyard_warning").default("pcb_component_missing_courtyard_warning"),message:Z(),pcb_component_id:Z(),source_component_id:Z().optional(),subcircuit_id:Z().optional()}).describe("Warning emitted when a PCB component has no courtyard geometry"),Ixe=wt({type:Xe("supplier_footprint_mismatch_warning"),supplier_footprint_mismatch_warning_id:so("supplier_footprint_mismatch_warning"),warning_type:Xe("supplier_footprint_mismatch_warning").default("supplier_footprint_mismatch_warning"),message:Z(),source_component_id:Z(),pcb_component_id:Z().optional(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),supplier_name:vM.optional(),supplier_part_number:Z().optional(),supplier_footprint_url:Z().optional(),footprint_copper_intersection_over_union:mt()}).describe("Warning emitted when a supplier part footprint does not match the expected footprint"),clt=wt({type:Xe("pcb_fabricator_extra_charge_warning"),pcb_fabricator_extra_charge_warning_id:so("pcb_fabricator_extra_charge_warning"),warning_type:Xe("pcb_fabricator_extra_charge_warning").default("pcb_fabricator_extra_charge_warning"),message:Z(),fabricator_preset:Z(),pcb_board_id:Z().optional(),pcb_via_ids:dn(Z()).optional(),subcircuit_id:Z().optional()}).describe("Warning that a design feature incurs an extra charge for the selected fabricator preset, such as via hole diameters below 0.3 mm with JLCPCB economy or standard presets."),llt=wt({type:Xe("pcb_breakout_point"),pcb_breakout_point_id:so("pcb_breakout_point"),pcb_group_id:Z(),subcircuit_id:Z().optional(),source_trace_id:Z().optional(),source_port_id:Z().optional(),source_net_id:Z().optional(),layer:Qr.optional(),x:ct,y:ct}).describe("Defines a routing target within a pcb_group for a source_trace or source_net"),glt=wt({type:Xe("pcb_ground_plane"),pcb_ground_plane_id:so("pcb_ground_plane"),source_pcb_ground_plane_id:Z(),source_net_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional()}).describe("Defines a ground plane on the PCB"),ult=wt({type:Xe("pcb_ground_plane_region"),pcb_ground_plane_region_id:so("pcb_ground_plane_region"),pcb_ground_plane_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),layer:Qr,points:dn(Ti)}).describe("Defines a polygon region of a ground plane"),dlt=wt({type:Xe("pcb_thermal_spoke"),pcb_thermal_spoke_id:so("pcb_thermal_spoke"),pcb_ground_plane_id:Z(),shape:Z(),spoke_count:mt(),spoke_thickness:ct,spoke_inner_diameter:ct,spoke_outer_diameter:ct,pcb_plated_hole_id:Z().optional(),subcircuit_id:Z().optional()}).describe("Pattern for connecting a ground plane to a plated hole"),Cxe=wt({type:Xe("pcb_copper_pour"),pcb_copper_pour_id:so("pcb_copper_pour"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),layer:Qr,source_net_id:Z().optional(),covered_with_solder_mask:qe().optional().default(!0)}),hlt=Cxe.extend({shape:Xe("rect"),center:Ti,width:ce,height:ce,rotation:tA.optional()}),plt=Cxe.extend({shape:Xe("brep"),brep_shape:oxe}),mlt=Cxe.extend({shape:Xe("polygon"),points:dn(Ti)}),yxe=Ay("shape",[hlt,plt,mlt]).describe("Defines a copper pour on the PCB."),_lt=Ql.extend({type:Xe("pcb_component_outside_board_error"),pcb_component_outside_board_error_id:so("pcb_component_outside_board_error"),error_type:Xe("pcb_component_outside_board_error").default("pcb_component_outside_board_error"),pcb_component_id:Z(),pcb_board_id:Z(),component_center:Ti,component_bounds:wt({min_x:mt(),max_x:mt(),min_y:mt(),max_y:mt()}),subcircuit_id:Z().optional(),source_component_id:Z().optional()}).describe("Error emitted when a PCB component is placed outside the board boundaries"),flt=Ql.extend({type:Xe("pcb_component_not_on_board_edge_error"),pcb_component_not_on_board_edge_error_id:so("pcb_component_not_on_board_edge_error"),error_type:Xe("pcb_component_not_on_board_edge_error").default("pcb_component_not_on_board_edge_error"),pcb_component_id:Z(),pcb_board_id:Z(),component_center:Ti,pad_to_nearest_board_edge_distance:mt(),source_component_id:Z().optional(),subcircuit_id:Z().optional()}).describe("Error emitted when a component that must be placed on the board edge is centered away from the edge"),Xte=Ql.extend({type:Xe("pcb_component_invalid_layer_error"),pcb_component_invalid_layer_error_id:so("pcb_component_invalid_layer_error"),error_type:Xe("pcb_component_invalid_layer_error").default("pcb_component_invalid_layer_error"),pcb_component_id:Z().optional(),source_component_id:Z(),layer:Qr,subcircuit_id:Z().optional()}).describe("Error emitted when a component is placed on an invalid layer (components can only be on 'top' or 'bottom' layers)"),Ilt=Ql.extend({type:Xe("pcb_via_clearance_error"),pcb_error_id:so("pcb_error"),error_type:Xe("pcb_via_clearance_error").default("pcb_via_clearance_error"),pcb_via_ids:dn(Z()).min(2),minimum_clearance:ct.optional(),actual_clearance:ct.optional(),pcb_center:wt({x:mt().optional(),y:mt().optional()}).optional(),subcircuit_id:Z().optional()}).describe("Error emitted when vias are closer than the allowed clearance"),Clt=Ql.extend({type:Xe("pcb_via_trace_clearance_error"),pcb_via_trace_clearance_error_id:so("pcb_via_trace_clearance_error"),error_type:Xe("pcb_via_trace_clearance_error").default("pcb_via_trace_clearance_error"),pcb_via_id:Z(),pcb_trace_id:Z(),minimum_clearance:ct.optional(),actual_clearance:ct.optional(),center:wt({x:mt().optional(),y:mt().optional()}).optional(),subcircuit_id:Z().optional()}).describe("Error emitted when a via and trace are closer than the allowed clearance"),ylt=Ql.extend({type:Xe("pcb_pad_pad_clearance_error"),pcb_pad_pad_clearance_error_id:so("pcb_pad_pad_clearance_error"),error_type:Xe("pcb_pad_pad_clearance_error").default("pcb_pad_pad_clearance_error"),pcb_pad_ids:dn(Z()).min(2),minimum_clearance:ct.optional(),actual_clearance:ct.optional(),center:wt({x:mt().optional(),y:mt().optional()}).optional(),subcircuit_id:Z().optional()}).describe("Error emitted when pads are closer than the allowed clearance"),xlt=Ql.extend({type:Xe("pcb_pad_trace_clearance_error"),pcb_pad_trace_clearance_error_id:so("pcb_pad_trace_clearance_error"),error_type:Xe("pcb_pad_trace_clearance_error").default("pcb_pad_trace_clearance_error"),pcb_pad_id:Z(),pcb_trace_id:Z(),minimum_clearance:ct.optional(),actual_clearance:ct.optional(),center:wt({x:mt().optional(),y:mt().optional()}).optional(),subcircuit_id:Z().optional()}).describe("Error emitted when a pad and trace are closer than allowed clearance"),xxe=wt({type:Xe("pcb_courtyard_rect"),pcb_courtyard_rect_id:so("pcb_courtyard_rect"),pcb_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),center:Ti,width:ce,height:ce,layer:Om,ccw_rotation:tA.optional(),color:Z().optional()}).describe("Defines a courtyard rectangle on the PCB"),Exe=wt({type:Xe("pcb_courtyard_outline"),pcb_courtyard_outline_id:so("pcb_courtyard_outline"),pcb_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),layer:Om,outline:dn(Ti).min(2)}).describe("Defines a courtyard outline on the PCB"),Bxe=wt({type:Xe("pcb_courtyard_polygon"),pcb_courtyard_polygon_id:so("pcb_courtyard_polygon"),pcb_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),layer:Om,points:dn(Ti).min(3),color:Z().optional()}).describe("Defines a courtyard polygon on the PCB"),Sxe=wt({type:Xe("pcb_courtyard_circle"),pcb_courtyard_circle_id:so("pcb_courtyard_circle"),pcb_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),center:Ti,radius:ce,layer:Om,color:Z().optional()}).describe("Defines a courtyard circle on the PCB"),bxe=wt({type:Xe("pcb_courtyard_pill"),pcb_courtyard_pill_id:so("pcb_courtyard_pill"),pcb_component_id:Z(),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),center:Ti,width:ce,height:ce,radius:ce,layer:Om,color:Z().optional()}).describe("Defines a courtyard pill on the PCB"),k9n=["obj","stl","3mf","gltf","glb","step","wrl"],Elt=["x+","x-","y+","y-","z+","z-"],F9n={obj:"z+",stl:"z+","3mf":"z+",gltf:"y+",glb:"y+",step:"z+",wrl:"y+"},Blt=wt({type:Xe("cad_component"),cad_component_id:Z(),pcb_component_id:Z(),source_component_id:Z(),position:p9,rotation:p9.optional(),size:p9.optional(),layer:Qr.optional(),subcircuit_id:Z().optional(),footprinter_string:Z().optional(),model_obj_url:Z().optional(),model_stl_url:Z().optional(),model_3mf_url:Z().optional(),model_gltf_url:Z().optional(),model_glb_url:Z().optional(),model_step_url:Z().optional(),model_wrl_url:Z().optional(),model_asset:Kte.optional(),model_unit_to_mm_scale_factor:mt().optional(),model_board_normal_direction:Kn(Elt).optional().describe(`The direction in the model's coordinate space that is considered "up" or "coming out of the board surface"`),model_origin_position:p9.optional(),model_origin_alignment:Kn(["unknown","center","center_of_component_on_board_surface","bottom_center_of_component"]).optional(),model_object_fit:Kn(["contain_within_bounds","fill_bounds"]).optional().default("contain_within_bounds"),model_jscad:Ad().optional(),show_as_translucent_model:qe().optional(),show_as_bounding_box:qe().optional(),show_hidden_edges:qe().optional(),anchor_alignment:Kn(["center","center_of_component_on_board_surface"]).optional().default("center")}).describe("Defines a component on the PCB"),Qxe=Kn(["sinewave","square","triangle","sawtooth"]),L9n=xo([Z(),mt()]).transform(t=>typeof t=="string"?t.endsWith("%")?parseFloat(t.slice(0,-1))/100:parseFloat(t):t).pipe(mt().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),Slt=wt({type:Xe("simulation_voltage_source"),simulation_voltage_source_id:so("simulation_voltage_source"),is_dc_source:Xe(!0).optional().default(!0),positive_source_port_id:Z().optional(),negative_source_port_id:Z().optional(),positive_source_net_id:Z().optional(),negative_source_net_id:Z().optional(),voltage:N_,ac_magnitude:N_.optional(),ac_phase:tA.optional()}).describe("Defines a DC voltage source for simulation"),blt=wt({type:Xe("simulation_voltage_source"),simulation_voltage_source_id:so("simulation_voltage_source"),is_dc_source:Xe(!1),terminal1_source_port_id:Z().optional(),terminal2_source_port_id:Z().optional(),terminal1_source_net_id:Z().optional(),terminal2_source_net_id:Z().optional(),voltage:N_.optional(),frequency:cy.optional(),peak_to_peak_voltage:N_.optional(),wave_shape:Qxe.optional(),phase:tA.optional(),duty_cycle:L9n.optional(),pulse_delay:bl.optional(),rise_time:bl.optional(),fall_time:bl.optional(),pulse_width:bl.optional(),period:bl.optional(),ac_magnitude:N_.optional(),ac_phase:tA.optional()}).describe("Defines an AC voltage source for simulation"),Qlt=xo([Slt,blt]).describe("Defines a voltage source for simulation"),H9n=xo([Z(),mt()]).transform(t=>typeof t=="string"?t.endsWith("%")?parseFloat(t.slice(0,-1))/100:parseFloat(t):t).pipe(mt().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),vlt=wt({type:Xe("simulation_current_source"),simulation_current_source_id:so("simulation_current_source"),is_dc_source:Xe(!0).optional().default(!0),positive_source_port_id:Z().optional(),negative_source_port_id:Z().optional(),positive_source_net_id:Z().optional(),negative_source_net_id:Z().optional(),current:E3,ac_magnitude:E3.optional(),ac_phase:tA.optional()}).describe("Defines a DC current source for simulation"),Plt=wt({type:Xe("simulation_current_source"),simulation_current_source_id:so("simulation_current_source"),is_dc_source:Xe(!1),terminal1_source_port_id:Z().optional(),terminal2_source_port_id:Z().optional(),terminal1_source_net_id:Z().optional(),terminal2_source_net_id:Z().optional(),current:E3.optional(),frequency:cy.optional(),peak_to_peak_current:E3.optional(),wave_shape:Qxe.optional(),phase:tA.optional(),duty_cycle:H9n.optional(),ac_magnitude:E3.optional(),ac_phase:tA.optional()}).describe("Defines an AC current source for simulation"),wlt=xo([vlt,Plt]).describe("Defines a current source for simulation"),$te=b0(t=>t==="V"||t==="A"),vxe=b0(t=>t==="Ω"||t==="F"||t==="H"||t==="V"||t==="A"),Mlt=xo([Xe("spice_dc_sweep"),Xe("spice_dc_operating_point"),Xe("spice_transient_analysis"),Xe("spice_ac_analysis")]),Dlt=wt({method:Kn(["trap","gear"]).optional(),reltol:xo([mt(),Z()]).optional(),abstol:xo([mt(),Z()]).optional(),vntol:xo([mt(),Z()]).optional()}).describe("SPICE solver options for a simulation experiment"),Nlt=wt({type:Xe("simulation_experiment"),simulation_experiment_id:so("simulation_experiment"),name:Z(),experiment_type:Mlt,time_per_step:bk.optional(),start_time_ms:bl.optional(),end_time_ms:bl.optional(),spice_options:Dlt.optional(),dc_sweep_voltage_source_id:Z().optional(),dc_sweep_current_source_id:Z().optional(),dc_sweep_start:mt().optional(),dc_sweep_stop:mt().optional(),dc_sweep_step:mt().refine(t=>t!==0).optional(),dc_sweep_unit:$te.optional(),ac_sweep_type:Kn(["linear","decade","octave"]).optional(),ac_samples_per_interval:mt().int().positive().optional(),ac_sample_count:mt().int().positive().optional(),ac_start_frequency_hz:mt().positive().optional(),ac_stop_frequency_hz:mt().positive().optional()}).superRefine((t,e)=>{if(t.experiment_type==="spice_dc_sweep"){const n=["dc_sweep_start","dc_sweep_stop","dc_sweep_step","dc_sweep_unit"];for(const r of n)t[r]===void 0&&e.addIssue({code:lo.custom,path:[r],message:`${r} is required for a DC sweep`});const o=t.dc_sweep_voltage_source_id!==void 0,i=t.dc_sweep_current_source_id!==void 0;o===i&&e.addIssue({code:lo.custom,path:["dc_sweep_voltage_source_id"],message:"Exactly one DC sweep voltage or current source ID is required"})}t.experiment_type==="spice_ac_analysis"&&(t.ac_sweep_type===void 0&&e.addIssue({code:lo.custom,path:["ac_sweep_type"],message:"ac_sweep_type is required for an AC analysis"}),t.ac_start_frequency_hz===void 0&&e.addIssue({code:lo.custom,path:["ac_start_frequency_hz"],message:"ac_start_frequency_hz is required for an AC analysis"}),t.ac_stop_frequency_hz===void 0&&e.addIssue({code:lo.custom,path:["ac_stop_frequency_hz"],message:"ac_stop_frequency_hz is required for an AC analysis"}),t.ac_sweep_type==="linear"&&t.ac_sample_count===void 0&&e.addIssue({code:lo.custom,path:["ac_sample_count"],message:"ac_sample_count is required for a linear AC analysis"}),(t.ac_sweep_type==="decade"||t.ac_sweep_type==="octave")&&t.ac_samples_per_interval===void 0&&e.addIssue({code:lo.custom,path:["ac_samples_per_interval"],message:"ac_samples_per_interval is required for decade and octave AC analyses"}))}).describe("Defines a simulation experiment configuration"),h8=wt({simulation_parameter_sweep_id:Z(),sweep_index:mt().int().nonnegative(),parameter_value:mt(),parameter_unit:vxe}),Rlt=wt({type:Xe("simulation_transient_voltage_graph"),simulation_transient_voltage_graph_id:so("simulation_transient_voltage_graph"),simulation_experiment_id:Z(),simulation_parameter_sweep_coordinate:h8.optional(),timestamps_ms:dn(mt()).optional(),voltage_levels:dn(mt()),source_component_id:Z().optional(),subcircuit_connectivity_map_key:Z().optional(),time_per_step:bk,start_time_ms:bl,end_time_ms:bl,name:Z().optional(),color:Z().optional()}).describe("Stores voltage measurements over time for a simulation"),Tlt=wt({type:Xe("simulation_transient_current_graph"),simulation_transient_current_graph_id:so("simulation_transient_current_graph"),simulation_experiment_id:Z(),simulation_parameter_sweep_coordinate:h8.optional(),timestamps_ms:dn(mt()).optional(),current_levels:dn(mt()),source_component_id:Z().optional(),subcircuit_connectivity_map_key:Z().optional(),time_per_step:bk,start_time_ms:bl,end_time_ms:bl,name:Z().optional(),color:Z().optional()}).describe("Stores current measurements over time for a simulation"),klt=wt({type:Xe("simulation_switch"),simulation_switch_id:so("simulation_switch"),source_component_id:Z().optional(),closes_at:bl.optional(),opens_at:bl.optional(),starts_closed:qe().optional(),switching_frequency:cy.optional()}).describe("Defines a switch for simulation timing control"),Flt=wt({type:Xe("simulation_voltage_probe"),simulation_voltage_probe_id:so("simulation_voltage_probe"),source_component_id:Z().optional(),name:Z().optional(),signal_input_source_port_id:Z().optional(),signal_input_source_net_id:Z().optional(),reference_input_source_port_id:Z().optional(),reference_input_source_net_id:Z().optional(),subcircuit_id:Z().optional(),color:Z().optional()}).describe("Defines a voltage probe for simulation. If a reference input is not provided, it measures against ground. If a reference input is provided, it measures the differential voltage between two points.").superRefine((t,e)=>{if(t.reference_input_source_port_id||t.reference_input_source_net_id){const o=!!t.signal_input_source_port_id||!!t.reference_input_source_port_id,i=!!t.signal_input_source_net_id||!!t.reference_input_source_net_id;o&&i?e.addIssue({code:lo.custom,message:"Cannot mix port and net connections in a differential probe."}):o?(!t.signal_input_source_port_id||!t.reference_input_source_port_id)&&e.addIssue({code:lo.custom,message:"Differential port probe requires both signal_input_source_port_id and reference_input_source_port_id."}):i&&(!t.signal_input_source_net_id||!t.reference_input_source_net_id)&&e.addIssue({code:lo.custom,message:"Differential net probe requires both signal_input_source_net_id and reference_input_source_net_id."})}else!!t.signal_input_source_port_id==!!t.signal_input_source_net_id&&e.addIssue({code:lo.custom,message:"A voltage probe must have exactly one of signal_input_source_port_id or signal_input_source_net_id."})}),Llt=wt({type:Xe("simulation_current_probe"),simulation_current_probe_id:so("simulation_current_probe"),source_component_id:Z().optional(),name:Z().optional(),positive_source_port_id:Z().optional(),negative_source_port_id:Z().optional(),positive_source_net_id:Z().optional(),negative_source_net_id:Z().optional(),subcircuit_id:Z().optional(),color:Z().optional()}).describe("Defines a current probe for simulation. It measures current flowing from the positive endpoint to the negative endpoint.").superRefine((t,e)=>{const n=!!t.positive_source_port_id,o=!!t.negative_source_port_id,i=!!t.positive_source_net_id,r=!!t.negative_source_net_id,s=n||o,a=i||r;if(s&&a){e.addIssue({code:lo.custom,message:"Cannot mix port and net connections in a current probe."});return}if(s){(!n||!o)&&e.addIssue({code:lo.custom,message:"Current probe using source ports requires both positive_source_port_id and negative_source_port_id."});return}if(a){(!i||!r)&&e.addIssue({code:lo.custom,message:"Current probe using source nets requires both positive_source_net_id and negative_source_net_id."});return}e.addIssue({code:lo.custom,message:"A current probe must have either positive/negative source port ids or positive/negative source net ids."})}),Hlt=Ql.extend({type:Xe("simulation_unknown_experiment_error"),simulation_unknown_experiment_error_id:so("simulation_unknown_experiment_error"),error_type:Xe("simulation_unknown_experiment_error").default("simulation_unknown_experiment_error"),simulation_experiment_id:Z().optional(),subcircuit_id:Z().optional()}).describe("An unknown error occurred during the simulation experiment."),O9n=Kn(["resistance","capacitance","inductance","voltage","current"]),sV=wt({type:Xe("simulation_parameter_sweep"),simulation_parameter_sweep_id:so("simulation_parameter_sweep"),simulation_experiment_id:Z(),name:Z().optional(),parameter_values:dn(mt()).min(1),parameter_unit:vxe}),Olt=Ay("parameter_type",[sV.extend({parameter_type:Xe("resistance"),resistor_source_component_id:Z()}),sV.extend({parameter_type:Xe("capacitance"),capacitor_source_component_id:Z()}),sV.extend({parameter_type:Xe("inductance"),inductor_source_component_id:Z()}),sV.extend({parameter_type:Xe("voltage"),source_net_id:Z()}),sV.extend({parameter_type:Xe("current"),current_source_component_id:Z()})]).describe("Repeats a simulation experiment over component parameter values"),Glt=wt({type:Xe("simulation_dc_operating_point_voltage"),simulation_dc_operating_point_voltage_id:so("simulation_dc_operating_point_voltage"),simulation_experiment_id:Z(),simulation_parameter_sweep_coordinate:h8.optional(),simulation_voltage_probe_id:Z(),voltage:mt(),name:Z().optional(),color:Z().optional()}),Ylt=wt({type:Xe("simulation_dc_operating_point_current"),simulation_dc_operating_point_current_id:so("simulation_dc_operating_point_current"),simulation_experiment_id:Z(),simulation_parameter_sweep_coordinate:h8.optional(),simulation_current_probe_id:Z(),current:mt(),name:Z().optional(),color:Z().optional()}),Ult=wt({type:Xe("simulation_dc_sweep_voltage_graph"),simulation_dc_sweep_voltage_graph_id:so("simulation_dc_sweep_voltage_graph"),simulation_experiment_id:Z(),simulation_parameter_sweep_coordinate:h8.optional(),simulation_voltage_probe_id:Z(),sweep_values:dn(mt()),sweep_unit:$te,voltage_levels:dn(mt()),name:Z().optional(),color:Z().optional()}).refine(t=>t.sweep_values.length===t.voltage_levels.length,{message:"sweep_values and voltage_levels must have the same length"}),Klt=wt({type:Xe("simulation_dc_sweep_current_graph"),simulation_dc_sweep_current_graph_id:so("simulation_dc_sweep_current_graph"),simulation_experiment_id:Z(),simulation_parameter_sweep_coordinate:h8.optional(),simulation_current_probe_id:Z(),sweep_values:dn(mt()),sweep_unit:$te,current_levels:dn(mt()),name:Z().optional(),color:Z().optional()}).refine(t=>t.sweep_values.length===t.current_levels.length,{message:"sweep_values and current_levels must have the same length"}),Pxe=wt({re:mt(),im:mt()}),Vlt=wt({type:Xe("simulation_ac_sweep_voltage_graph"),simulation_ac_sweep_voltage_graph_id:so("simulation_ac_sweep_voltage_graph"),simulation_experiment_id:Z(),simulation_parameter_sweep_coordinate:h8.optional(),simulation_voltage_probe_id:Z(),frequencies_hz:dn(mt()),complex_voltages:dn(Pxe),name:Z().optional(),color:Z().optional()}).refine(t=>t.frequencies_hz.length===t.complex_voltages.length,{message:"frequencies_hz and complex_voltages must have the same length"}),zlt=wt({type:Xe("simulation_ac_sweep_current_graph"),simulation_ac_sweep_current_graph_id:so("simulation_ac_sweep_current_graph"),simulation_experiment_id:Z(),simulation_parameter_sweep_coordinate:h8.optional(),simulation_current_probe_id:Z(),frequencies_hz:dn(mt()),complex_currents:dn(Pxe),name:Z().optional(),color:Z().optional()}).refine(t=>t.frequencies_hz.length===t.complex_currents.length,{message:"frequencies_hz and complex_currents must have the same length"}),Jlt=wt({type:Xe("simulation_op_amp"),simulation_op_amp_id:so("simulation_op_amp"),source_component_id:Z().optional(),inverting_input_source_port_id:Z(),non_inverting_input_source_port_id:Z(),output_source_port_id:Z(),positive_supply_source_port_id:Z(),negative_supply_source_port_id:Z()}).describe("Defines a simple ideal operational amplifier for simulation"),Wlt=wt({type:Xe("simulation_spice_subcircuit"),simulation_spice_subcircuit_id:so("simulation_spice_subcircuit"),source_component_id:Z(),spice_pin_to_source_port_map:xc(Z(),Z()),subcircuit_source:Z()}).describe("Defines a custom SPICE subcircuit model for simulation"),jlt=t=>t!==void 0,qlt=wt({type:Xe("simulation_oscilloscope_trace"),simulation_oscilloscope_trace_id:so("simulation_oscilloscope_trace"),simulation_transient_voltage_graph_id:Z().optional(),simulation_transient_current_graph_id:Z().optional(),simulation_voltage_probe_id:Z().optional(),simulation_current_probe_id:Z().optional(),display_name:Z().optional(),color:Z().optional(),display_center_value:mt().optional(),display_center_offset_divs:mt().optional(),volts_per_div:mt().positive().optional(),amps_per_div:mt().positive().optional()}).describe("Defines how a simulation measurement is rendered as an oscilloscope-style trace.").superRefine((t,e)=>{const n=[t.simulation_transient_voltage_graph_id,t.simulation_voltage_probe_id].filter(jlt).length,o=[t.simulation_transient_current_graph_id,t.simulation_current_probe_id].filter(jlt).length;n+o!==1&&e.addIssue({code:lo.custom,message:"An oscilloscope trace must reference exactly one voltage graph, current graph, voltage probe, or current probe."}),n>0&&t.amps_per_div!==void 0&&e.addIssue({code:lo.custom,message:"Voltage oscilloscope traces must use volts_per_div, not amps_per_div."}),o>0&&t.volts_per_div!==void 0&&e.addIssue({code:lo.custom,message:"Current oscilloscope traces must use amps_per_div, not volts_per_div."})}),wxe=xo([aAt,rAt,sAt,iAt,cAt,AAt,M2e,v2e,zte,w2e,P2e,D2e,N2e,R2e,F2e,L2e,H2e,K2e,O2e,G2e,Y2e,U2e,k2e,T2e,uAt,dAt,lAt,V2e,z2e,J2e,W2e,hAt,CAt,j2e,q2e,pAt,mAt,_At,fAt,IAt,oV,X2e,nV,gAt,ict,Act,pct,olt,rV,_xe,fxe,alt,Alt,Ixe,clt,mct,pxe,_ct,Nct,yct,Sct,bct,Qct,vct,jte,Ict,Cct,Rct,Tct,ilt,Hct,Oct,Gct,Yct,jct,Uct,Kct,Vct,zct,Wct,Pct,wct,kct,Fct,Lct,Mct,Dct,Ilt,Clt,ylt,xlt,axe,sxe,Axe,cxe,lxe,gxe,uxe,dxe,hxe,rlt,qct,Xct,llt,mxe,glt,ult,dlt,yxe,_lt,flt,Xte,xxe,Exe,Bxe,Sxe,bxe,yAt,RAt,PAt,wAt,MAt,DAt,QAt,vAt,TAt,NAt,xAt,FAt,LAt,kAt,YAt,UAt,exe,KAt,VAt,ZAt,zAt,WAt,jAt,$At,qAt,XAt,Blt,Qlt,wlt,Nlt,Rlt,Tlt,Glt,Ylt,Ult,Klt,Vlt,zlt,Olt,klt,Flt,Llt,qlt,Hlt,Jlt,Wlt]),B4=wxe;const _9=Object.freeze(Object.defineProperty({__proto__:null,all_layers:Qk,any_circuit_element:wxe,any_soup_element:B4,any_source_component:iAt,asset:Kte,base_circuit_json_error:Ql,battery_capacity:Mat,brep_shape:oxe,cadModelDefaultDirectionMap:F9n,cad_component:Blt,cad_model_axis_directions:Elt,cad_model_formats:k9n,capacitance:QM,circuit_json_footprint_load_error:_xe,current:E3,distance:ct,duration_ms:bk,experiment_type:Mlt,external_footprint_load_error:rV,frequency:cy,getRotationBetweenPcbPin1Locations:l9n,getZodPrefixedIdWithDefault:so,inductance:Yte,insertionDirectionToCanonical:ixe,insertionDirectionToVector:A9n,insertion_direction:tct,kicadAt:Vte,kicadEffects:Dat,kicadFont:Q2e,kicadFootprintAttributes:Rat,kicadFootprintMetadata:Fat,kicadFootprintModel:kat,kicadFootprintPad:Tat,kicadFootprintProperties:Nat,kicadProperty:tV,kicadSymbolEffects:Oat,kicadSymbolMetadata:Yat,kicadSymbolPinNames:Hat,kicadSymbolPinNumbers:Lat,kicadSymbolProperties:Gat,kicadSymbolProperty:sQ,layer_ref:Qr,layer_string:$2e,length:ce,manufacturing_drc_properties:oct,ms:bl,ninePointAnchor:d8,parseAndConvertSiUnit:G1,pcbRenderLayer:r9n,pcb_autorouting_error:rlt,pcb_board:Rct,pcb_breakout_point:llt,pcb_component:ict,pcb_component_invalid_layer_error:Xte,pcb_component_missing_courtyard_warning:Alt,pcb_component_not_on_board_edge_error:flt,pcb_component_outside_board_error:_lt,pcb_connector_not_in_accessible_orientation_warning:alt,pcb_copper_pour:yxe,pcb_copper_pour_brep:plt,pcb_copper_pour_polygon:mlt,pcb_copper_pour_rect:hlt,pcb_copper_text:Uct,pcb_courtyard_circle:Sxe,pcb_courtyard_outline:Exe,pcb_courtyard_overlap_error:Xct,pcb_courtyard_pill:bxe,pcb_courtyard_polygon:Bxe,pcb_courtyard_rect:xxe,pcb_cutout:mxe,pcb_cutout_circle:elt,pcb_cutout_path:nlt,pcb_cutout_polygon:tlt,pcb_cutout_rect:Zct,pcb_debug_line:sct,pcb_debug_object:Act,pcb_debug_object_base:Wte,pcb_debug_point:act,pcb_debug_rect:rct,pcb_fabrication_note_dimension:cxe,pcb_fabrication_note_path:axe,pcb_fabrication_note_rect:Axe,pcb_fabrication_note_text:sxe,pcb_fabricator_extra_charge_warning:clt,pcb_footprint_overlap_error:qct,pcb_ground_plane:glt,pcb_ground_plane_region:ult,pcb_group:ilt,pcb_hole:pct,pcb_hole_circle_or_square_shape:h9n,pcb_hole_circle_shape:u9n,pcb_hole_oval_shape:p9n,pcb_hole_pill_shape:m9n,pcb_hole_rect_shape:d9n,pcb_hole_rotated_pill_shape:_9n,pcb_keepout:pxe,pcb_keepout_outline:$ct,pcb_manual_edit_conflict_warning:fxe,pcb_missing_footprint_error:olt,pcb_net:Nct,pcb_note_dimension:hxe,pcb_note_line:dxe,pcb_note_path:uxe,pcb_note_rect:gxe,pcb_note_text:lxe,pcb_packing_error:Fct,pcb_pad_pad_clearance_error:ylt,pcb_pad_trace_clearance_error:xlt,pcb_panel:Tct,pcb_panelization_placement_error:Lct,pcb_pin1_location:iV,pcb_placement_error:kct,pcb_plated_hole:mct,pcb_port:_ct,pcb_port_not_connected_error:Dct,pcb_port_not_matched_error:Mct,pcb_route_hint:nct,pcb_route_hints:g9n,pcb_silkscreen_circle:Vct,pcb_silkscreen_graphic:Wct,pcb_silkscreen_graphic_brep:Jct,pcb_silkscreen_line:Oct,pcb_silkscreen_oval:zct,pcb_silkscreen_path:Gct,pcb_silkscreen_pill:jct,pcb_silkscreen_rect:Kct,pcb_silkscreen_text:Yct,pcb_smtpad:Ict,pcb_smtpad_pill:fct,pcb_solder_paste:Cct,pcb_text:yct,pcb_thermal_spoke:dlt,pcb_trace:Sct,pcb_trace_error:Pct,pcb_trace_hint:Hct,pcb_trace_missing_error:wct,pcb_trace_route_point:rxe,pcb_trace_route_point_through_pad:Bct,pcb_trace_route_point_via:Ect,pcb_trace_route_point_wire:xct,pcb_trace_too_long_warning:Qct,pcb_trace_too_many_vias_warning:vct,pcb_trace_warning:bct,pcb_via:jte,pcb_via_clearance_error:Ilt,pcb_via_trace_clearance_error:Clt,point:Ti,point3:p9,point_with_bulge:ect,port_arrangement:bAt,position:n9n,position3:o9n,resistance:u8,ring:nxe,rotation:tA,route_hint_point:m9,schematic_arc:DAt,schematic_box:yAt,schematic_circle:MAt,schematic_component:QAt,schematic_component_overlap_warning:KAt,schematic_component_port_arrangement_by_sides:SAt,schematic_component_port_arrangement_by_size:BAt,schematic_component_styling_warning:VAt,schematic_debug_line:OAt,schematic_debug_object:YAt,schematic_debug_object_base:Jte,schematic_debug_point:GAt,schematic_debug_rect:HAt,schematic_element_outside_sheet_warning:zAt,schematic_error:FAt,schematic_graphic:WAt,schematic_group:jAt,schematic_layout_error:LAt,schematic_line:PAt,schematic_manual_edit_conflict_warning:exe,schematic_missing_sheet_warning:ZAt,schematic_net_label:kAt,schematic_path:xAt,schematic_pin_styles:EAt,schematic_port:TAt,schematic_rect:wAt,schematic_sheet:$At,schematic_sheet_size:txe,schematic_symbol:vAt,schematic_table:qAt,schematic_table_cell:XAt,schematic_text:RAt,schematic_text_part:Z2e,schematic_trace:NAt,schematic_voltage_probe:UAt,simulation_ac_current_source:Plt,simulation_ac_sweep_current_graph:zlt,simulation_ac_sweep_voltage_graph:Vlt,simulation_ac_voltage_source:blt,simulation_complex_sample:Pxe,simulation_current_probe:Llt,simulation_current_source:wlt,simulation_dc_current_source:vlt,simulation_dc_operating_point_current:Ylt,simulation_dc_operating_point_voltage:Glt,simulation_dc_sweep_current_graph:Klt,simulation_dc_sweep_unit:$te,simulation_dc_sweep_voltage_graph:Ult,simulation_dc_voltage_source:Slt,simulation_experiment:Nlt,simulation_op_amp:Jlt,simulation_oscilloscope_trace:qlt,simulation_parameter_sweep:Olt,simulation_parameter_sweep_coordinate:h8,simulation_parameter_type:O9n,simulation_parameter_unit:vxe,simulation_spice_subcircuit:Wlt,simulation_switch:klt,simulation_transient_current_graph:Tlt,simulation_transient_voltage_graph:Rlt,simulation_unknown_experiment_error:Hlt,simulation_voltage_probe:Flt,simulation_voltage_source:Qlt,size:Ute,source_ambiguous_port_reference:gAt,source_board:lAt,source_component_base:yg,source_component_internal_connection:sAt,source_component_misconfigured_error:nV,source_component_pins_underspecified_warning:_At,source_confusing_net_name_warning:CAt,source_failed_to_create_component_error:Zat,source_group:AAt,source_i2c_misconfigured_error:X2e,source_interconnect:nAt,source_invalid_component_property_error:z2e,source_manually_placed_via:dAt,source_missing_manufacturer_part_number_warning:j2e,source_missing_property_error:$at,source_net:cAt,source_no_ground_pin_defined_warning:mAt,source_no_power_pin_defined_warning:pAt,source_part_not_found_warning:oV,source_pcb_ground_plane:uAt,source_pin_attributes:Wat,source_pin_missing_trace_warning:W2e,source_pin_must_be_connected_error:fAt,source_port:rAt,source_project_metadata:V2e,source_property_ignored_warning:eAt,source_refdes_convention_warning:q2e,source_simple_ammeter:Jat,source_simple_battery:N2e,source_simple_capacitor:v2e,source_simple_chip:M2e,source_simple_connector:Xat,source_simple_connector_standards:qat,source_simple_crystal:jat,source_simple_current_source:Vat,source_simple_diode:zte,source_simple_fiducial:Uat,source_simple_fuse:zat,source_simple_ground:Kat,source_simple_inductor:R2e,source_simple_led:w2e,source_simple_mosfet:Y2e,source_simple_op_amp:U2e,source_simple_pin_header:F2e,source_simple_pinout:L2e,source_simple_potentiometer:k2e,source_simple_power_source:D2e,source_simple_push_button:T2e,source_simple_resistor:P2e,source_simple_resonator:H2e,source_simple_switch:K2e,source_simple_test_point:G2e,source_simple_transistor:O2e,source_simple_voltage_probe:tAt,source_simple_voltage_source:oAt,source_trace:aAt,source_trace_not_connected_error:J2e,source_unnamed_trace_warning:hAt,spice_simulation_options:Dlt,supplier_footprint_mismatch_warning:Ixe,supplier_name:vM,time:t9n,timestamp:wat,unknown_error_finding_part:IAt,visible_layer:Om,voltage:N_,wave_shape:Qxe},Symbol.toStringTag,{value:"Module"}));function hn(t,e){return Array.isArray(e)?[t.a*e[0]+t.c*e[1]+t.e,t.b*e[0]+t.d*e[1]+t.f]:{x:t.a*e.x+t.c*e.y+t.e,y:t.b*e.x+t.d*e.y+t.f}}const G9n=/^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 Y9n(t){const e=t.match(G9n);if(e===null||e.length<7)throw new Error(`'${t}' is not a matrix`);return{a:parseFloat(e[1]),b:parseFloat(e[2]),c:parseFloat(e[3]),d:parseFloat(e[4]),e:parseFloat(e[5]),f:parseFloat(e[6])}}function U9n(t){const{a:e,b:n,c:o,d:i,e:r,f:s}=t,a=e*i-n*o;return{a:i/a,b:n/-a,c:o/-a,d:e/a,e:(i*r-o*s)/-a,f:(n*r-e*s)/a}}function aV(t){return typeof t>"u"}function R_(t,e=0){return{a:1,c:0,e:t,b:0,d:1,f:e}}function AV(...t){t=Array.isArray(t[0])?t[0]:t;const e=(n,o)=>({a:n.a*o.a+n.c*o.b,c:n.a*o.c+n.c*o.d,e:n.a*o.e+n.c*o.f+n.e,b:n.b*o.a+n.d*o.b,d:n.b*o.c+n.d*o.d,f:n.b*o.e+n.d*o.f+n.f});switch(t.length){case 0:throw new Error("no matrices provided");case 1:return t[0];case 2:return e(t[0],t[1]);default:{const[n,o,...i]=t,r=e(n,o);return AV(r,...i)}}}function s0(...t){return AV(...t)}const{cos:K9n,sin:V9n}=Math;function p8(t,e,n){const o=K9n(t),i=V9n(t),r={a:o,c:-i,e:0,b:i,d:o,f:0};return aV(e)||aV(n)?r:AV([R_(e,n),r,R_(-e,-n)])}function q2(t,e=void 0,n=void 0,o=void 0){aV(e)&&(e=t);const i={a:t,c:0,e:0,b:0,d:e,f:0};return aV(n)||aV(o)?i:AV([R_(n,o),i,R_(-n,-o)])}function z9n(t){return m8(t)}function m8(t){return`matrix(${t.a},${t.b},${t.c},${t.d},${t.e},${t.f})`}function J9n(t,e=1e10){return{a:Math.round(t.a*e)/e,b:Math.round(t.b*e)/e,c:Math.round(t.c*e)/e,d:Math.round(t.d*e)/e,e:Math.round(t.e*e)/e,f:Math.round(t.f*e)/e}}function W9n(t,e){const n=t[0].x!=null?t[0].x:t[0][0],o=t[0].y!=null?t[0].y:t[0][1],i=e[0].x!=null?e[0].x:e[0][0],r=e[0].y!=null?e[0].y:e[0][1],s=t[1].x!=null?t[1].x:t[1][0],a=t[1].y!=null?t[1].y:t[1][1],A=e[1].x!=null?e[1].x:e[1][0],c=e[1].y!=null?e[1].y:e[1][1],l=t[2].x!=null?t[2].x:t[2][0],g=t[2].y!=null?t[2].y:t[2][1],u=e[2].x!=null?e[2].x:e[2][0],h=e[2].y!=null?e[2].y:e[2][1],d={a:n-l,b:o-g,c:s-l,d:a-g,e:l,f:g},p={a:i-u,b:r-h,c:A-u,d:c-h,e:u,f:h},m=U9n(d),_=AV([p,m]);return J9n(_)}function j9n(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n}function Zte(t,e,n,o){var i=Error.call(this,t);return Object.setPrototypeOf&&Object.setPrototypeOf(i,Zte.prototype),i.expected=e,i.found=n,i.location=o,i.name="SyntaxError",i}j9n(Zte,Error);function Mxe(t,e,n){return n=n||" ",t.length>e?t:(e-=t.length,n+=n.repeat(e),t+n.slice(0,e))}Zte.prototype.format=function(t){var e="Error: "+this.message;if(this.location){var n=null,o;for(o=0;o<t.length;o++)if(t[o].source===this.location.source){n=t[o].text.split(/\r\n|\n|\r/g);break}var i=this.location.start,r=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(i):i,s=this.location.source+":"+r.line+":"+r.column;if(n){var a=this.location.end,A=Mxe("",r.line.toString().length," "),c=n[i.line-1],l=i.line===a.line?a.column:c.length+1,g=l-i.column||1;e+=`
|
|
242
242
|
--> `+s+`
|
|
243
243
|
`+A+` |
|
|
@@ -5620,7 +5620,7 @@ test("${c} should solve problem correctly", () => {
|
|
|
5620
5620
|
// Add more specific assertions based on expected output
|
|
5621
5621
|
// expect(solver.netLabelPlacementSolver!.netLabelPlacements).toMatchInlineSnapshot()
|
|
5622
5622
|
})
|
|
5623
|
-
`,g=new Blob([l],{type:"text/plain"}),u=URL.createObjectURL(g),h=document.createElement("a");h.href=u,h.download=`${c}.test.ts`,h.click(),URL.revokeObjectURL(u)}catch(A){alert(`Error generating test.ts for ${t.getSolverName()}: ${A instanceof Error?A.message:String(A)}`)}o(!1)};return z.jsxs("div",{className:`relative ${e}`,ref:i,children:[z.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>o(!n),title:`Download options for ${t.getSolverName()}`,children:t.getSolverName()}),n&&z.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download JSON"}),z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:a,children:"Download test.ts"})]})]})},M0n=t=>t.activeSubSolver?[t,...M0n(t.activeSubSolver)]:[t],lDi=({solver:t})=>{const e=M0n(t);return z.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:e.map((n,o)=>z.jsxs("div",{className:"flex items-center",children:[o>0&&z.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),z.jsx(cDi,{solver:n})]},n.getSolverName()))})},gDi=({solver:t,triggerRender:e,animationSpeed:n=25,renderer:o,onRendererChange:i,onAnimationSpeedChange:r,onDownloadVisualization:s,onSolverStarted:a,onSolverCompleted:A})=>{const[c,l]=te.useReducer(B=>!B,!1),g=te.useRef(void 0),u=te.useRef(null),h="solver-debugger-last-iteration",[d,p]=te.useState(null),m=te.useRef(null),_=te.useMemo(()=>[{label:"Slow",value:250,description:"250ms"},{label:"Normal",value:100,description:"100ms"},{label:"Fast",value:10,description:"10ms"},{label:"Fast (2x)",value:5,description:"5ms"},{label:"Fast (10x)",value:1,description:"1ms"},{label:"Fast 20x",value:.5,description:"2 steps / 1ms"},{label:"Fast 100x",value:.1,description:"10 steps / 1ms"}],[]),f=()=>{const B=Math.max(1,n),b=n<1?Math.round(1/n):1;g.current=setInterval(()=>{if(t.solved||t.failed){g.current&&(clearInterval(g.current),g.current=void 0),l(),e(),A&&t.solved&&A(t);return}for(let Q=0;Q<b&&!(t.solved||t.failed);Q++)t.step();e()},B)},I=()=>{g.current&&(clearInterval(g.current),g.current=void 0)},C=()=>{!t.solved&&!t.failed&&(t.step(),e())},y=()=>{!t.solved&&!t.failed&&(a&&a(t),t.solve(),e(),A&&A(t))},x=()=>{c?(I(),l()):(l(),f())},E=()=>{if(t.solved||t.failed||c)return;u.current===null&&typeof window<"u"&&(u.current=window.localStorage.getItem(h));const B=window.prompt("Step until which iteration?",u.current??`${t.iterations}`);if(B===null)return;u.current=B,typeof window<"u"&&window.localStorage.setItem(h,B);const b=Number(B);if(!Number.isFinite(b)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<b&&!t.solved&&!t.failed;)t.step();e(),t.solved&&A&&A(t)};return te.useEffect(()=>()=>{I()},[]),te.useEffect(()=>{(t.solved||t.failed)&&c&&(I(),l())},[t.solved,t.failed,c]),te.useEffect(()=>{c&&(I(),f())},[n,c]),te.useEffect(()=>{if(typeof document>"u")return;const B=b=>{m.current&&!m.current.contains(b.target)&&p(null)};return document.addEventListener("mousedown",B),()=>{document.removeEventListener("mousedown",B)}},[]),z.jsxs("div",{className:"space-y-2 p-2 border-b",children:[z.jsx("div",{className:"flex items-center",children:z.jsxs("div",{className:"flex items-center gap-2",ref:m,children:[z.jsxs("div",{className:"flex h-9 items-center space-x-1 rounded-md border border-slate-200 bg-white p-1 shadow-sm",children:[z.jsxs("div",{className:"relative",children:[z.jsx("button",{type:"button",onClick:()=>p(d==="renderer"?null:"renderer"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="renderer"?"open":"closed",children:"Renderer"}),d==="renderer"&&z.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[10rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:["vector","canvas"].map(B=>z.jsxs("button",{type:"button",onClick:()=>{i(B),p(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[B==="vector"?"Vector":"Canvas",o===B&&z.jsx("span",{className:"ml-auto text-xs text-slate-500",children:"✓"})]},B))})]}),z.jsxs("div",{className:"relative",children:[z.jsx("button",{type:"button",onClick:()=>p(d==="debug"?null:"debug"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="debug"?"open":"closed",children:"Debug"}),d==="debug"&&z.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[12rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:z.jsx("button",{type:"button",onClick:()=>{s(),p(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:"Download Visualization"})})]}),z.jsxs("div",{className:"relative",children:[z.jsx("button",{type:"button",onClick:()=>p(d==="animation"?null:"animation"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="animation"?"open":"closed",children:"Animation"}),d==="animation"&&z.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[12rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:_.map(B=>z.jsxs("button",{type:"button",onClick:()=>{r(B.value),p(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[B.label,z.jsx("span",{className:"ml-auto text-xs text-slate-500",children:B.description}),n===B.value&&z.jsx("span",{className:"ml-2 text-xs text-slate-500",children:"✓"})]},B.value))})]})]}),z.jsx(lDi,{solver:t})]})}),z.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[z.jsx("button",{onClick:C,disabled:t.solved||t.failed||c,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),z.jsx("button",{onClick:y,disabled:t.solved||t.failed||c,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),z.jsx("button",{onClick:x,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${c?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:c?"Stop":"Animate"}),z.jsx("button",{onClick:E,disabled:t.solved||t.failed||c,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),z.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&z.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),t.solved&&z.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&z.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&z.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},uDi=t=>t!==null&&"pipelineDef"in t&&Array.isArray(t.pipelineDef),dDi=(t,e,n)=>{const o=t.currentPipelineStageIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},hDi=(t,e)=>{const o=t.pipelineDef[e].solverName,i=dDi(t,e),r=t[o],s=t.firstIterationOfStage?.[o]??(e===t.currentPipelineStageIndex?t.iterations:null),a=t.iterations;let A=0;if(i==="Completed"){const u=t.pipelineDef[e+1],h=u?t.firstIterationOfStage?.[u.solverName]:void 0;h!==void 0&&s!==null?A=h-s:s!==null&&(A=a-s)}else i==="In Progress"&&s!==null&&(A=a-s);const c=t.timeSpentOnStage?.[o]??0;let l=0;i==="Completed"?l=1:i==="In Progress"&&r&&(l=r.progress??0);const g=r?.stats??null;return{index:e,name:o,status:i,firstIteration:s,iterations:A,progress:l,timeSpent:c,stats:g&&Object.keys(g).length>0?g:null,solverInstance:r??null}},pDi=({status:t})=>{const e={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return z.jsx("span",{className:`font-medium ${e[t]}`,children:t})},mDi=({progress:t})=>{if(t===0)return null;const e=Math.round(t*100);return z.jsxs("div",{className:"flex items-center gap-2",children:[z.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:z.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${e}%`}})}),z.jsxs("span",{className:"text-xs text-gray-500",children:[e,"%"]})]})},D0n=t=>{if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"||t==null)return String(t);if(typeof t=="object")try{return JSON.stringify(t)}catch{return String(t)}return String(t)},_Di=t=>Object.entries(t).map(([e,n])=>`${e}: ${D0n(n)}`).join(", "),fDi=({stats:t})=>{if(!t||Object.keys(t).length===0)return z.jsx("span",{children:"-"});const e=Object.entries(t),n=_Di(t);return z.jsxs("details",{className:"cursor-pointer",children:[z.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:n}),z.jsx("div",{className:"mt-1 text-xs",children:e.map(([o,i])=>z.jsxs("div",{children:[o,": ",D0n(i)]},o))})]})},$Je=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map($Je);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=$Je(o));return e},IDi=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=$Je(t.getConstructorParams()),o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),i=URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=`${e}_input.json`,r.click(),URL.revokeObjectURL(i)}catch(n){alert(`Error downloading input for ${e}: ${n instanceof Error?n.message:String(n)}`)}},CDi=({expanded:t})=>z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:`w-4 h-4 transition-transform duration-200 ${t?"rotate-90":""}`,children:z.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})}),N0n=t=>{let e=t;for(;e.activeSubSolver;)e=e.activeSubSolver;return e},R0n=({solver:t,onStepUntilPhase:e,onDownloadInput:n,isNested:o=!1,indentLevel:i=0,triggerRender:r})=>{const[s,a]=te.useState(new Set),A=t.pipelineDef.map((m,_)=>hDi(t,_)),c=m=>{a(_=>{const f=new Set(_);return f.has(m)?f.delete(m):f.add(m),f})},l=m=>{e?.(m)},g=m=>{m.solverInstance&&(n?n(m.solverInstance,m.name):IDi(m.solverInstance,m.name))},u=m=>`${(m/1e3).toFixed(2)}s`,h=()=>{if(!t.solved&&!t.failed){const m=t.activeSubSolver;for(;!t.solved&&!t.failed&&(t.step(),!(t.activeSubSolver&&t.activeSubSolver!==m)););r?.()}},d=()=>{if(!t.solved&&!t.failed){const m=N0n(t);for(;!t.solved&&!t.failed&&(t.step(),N0n(t)===m););r?.()}},p=i*24;return z.jsxs("div",{className:o?"":"border-t border-gray-200",children:[!o&&z.jsxs("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200 flex items-center justify-between",children:[z.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Stages"}),z.jsxs("div",{className:"flex gap-2",children:[z.jsx("button",{onClick:d,disabled:t.solved||t.failed,className:"bg-indigo-500 hover:bg-indigo-600 disabled:bg-gray-300 disabled:cursor-not-allowed cursor-pointer text-white px-3 py-1 rounded text-sm",children:"Next Solver"}),z.jsx("button",{onClick:h,disabled:t.solved||t.failed,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 disabled:cursor-not-allowed cursor-pointer text-white px-3 py-1 rounded text-sm",children:"Next Stage"})]})]}),z.jsx("div",{className:"overflow-x-auto",children:z.jsxs("table",{className:"w-full text-sm",children:[!o&&z.jsx("thead",{children:z.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stage"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),z.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",z.jsx("sub",{children:"0"})]}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),z.jsx("tbody",{children:A.map(m=>{const _=uDi(m.solverInstance),f=s.has(m.name);return z.jsxs(Ns.Fragment,{children:[z.jsxs("tr",{className:`border-b border-gray-100 ${m.status==="In Progress"?"bg-yellow-50":""}`,children:[z.jsx("td",{className:"px-4 py-2",children:z.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:p},children:[_?z.jsx("button",{onClick:()=>c(m.name),className:"text-gray-500 hover:text-gray-700",title:f?"Collapse":"Expand",children:z.jsx(CDi,{expanded:f})}):z.jsx("span",{className:"w-4"}),z.jsx("span",{className:"text-gray-400 w-6",children:String(m.index+1).padStart(2,"0")}),z.jsx("button",{onClick:()=>l(m.name),disabled:m.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${m.name} completes`,children:z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:z.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),z.jsx("span",{className:"font-medium text-gray-900",children:m.name})]})}),z.jsx("td",{className:"px-4 py-2",children:z.jsx(pDi,{status:m.status})}),z.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:m.firstIteration!==null?m.firstIteration:""}),z.jsx("td",{className:"px-4 py-2 text-gray-600",children:m.iterations}),z.jsx("td",{className:"px-4 py-2",children:z.jsx(mDi,{progress:m.progress})}),z.jsx("td",{className:"px-4 py-2 text-gray-600",children:u(m.timeSpent)}),z.jsx("td",{className:"px-4 py-2 text-gray-500",children:z.jsx(fDi,{stats:m.stats})}),z.jsx("td",{className:"px-4 py-2",children:m.solverInstance?z.jsxs("button",{onClick:()=>g(m),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${m.name}`,children:[z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:z.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),z.jsx("span",{children:"Input"})]}):null})]}),_&&f&&z.jsx("tr",{children:z.jsx("td",{colSpan:8,className:"p-0",children:z.jsx(R0n,{solver:m.solverInstance,onStepUntilPhase:e,onDownloadInput:n,isNested:!0,indentLevel:i+1,triggerRender:r})})})]},m.name)})})]})})]})};function yDi({graphics:t}){const e=t.points??[],n=t.lines??[],o=t.rects??[],i=t.circles??[],r=t.texts??[];let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;const l=(m,_)=>{typeof m=="number"&&(m<s&&(s=m),m>A&&(A=m)),typeof _=="number"&&(_<a&&(a=_),_>c&&(c=_))};for(const m of e)l(m.x,m.y);for(const m of n){const _=m.points??[];for(const f of _)l(f.x,f.y)}for(const m of o){const _=m.x??0,f=m.y??0,I=m.width??0,C=m.height??0;l(_,f),l(_+I,f+C)}for(const m of i){const _=m.x??0,f=m.y??0,I=m.radius??1;l(_-I,f-I),l(_+I,f+I)}for(const m of r)l(m.x,m.y);(!isFinite(s)||!isFinite(a)||!isFinite(A)||!isFinite(c))&&(s=-20,a=-20,A=20,c=20);const g=10,u=s-g,h=a-g,d=Math.max(1,A-s+2*g),p=Math.max(1,c-a+2*g);return z.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${u} ${h} ${d} ${p}`,role:"img","aria-label":"Graphics fallback",children:[o.map((m,_)=>z.jsx("rect",{x:m.x??0,y:m.y??0,width:m.width??0,height:m.height??0,fill:"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1},`rect-${_}`)),n.map((m,_)=>z.jsx("polyline",{fill:"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1,points:(m.points??[]).map(f=>`${f.x??0},${f.y??0}`).join(" ")},`line-${_}`)),i.map((m,_)=>z.jsx("circle",{cx:m.x??0,cy:m.y??0,r:m.radius??1.5,fill:m.fillColor??"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1},`circle-${_}`)),e.map((m,_)=>z.jsx("circle",{cx:m.x??0,cy:m.y??0,r:m.radius??1.5,fill:m.color??"black"},`point-${_}`)),r.map((m,_)=>z.jsx("text",{x:m.x??0,y:m.y??0,fontSize:m.fontSize??10,fill:m.color??"black",children:m.text??""},`text-${_}`))]})}var xDi=class extends Ns.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}},EDi=({solver:t,createSolver:e,animationSpeed:n=25,onSolverStarted:o,onSolverCompleted:i})=>{const[r,s]=te.useReducer(f=>f+1,0),[a]=te.useState(()=>{if(e)return e();if(!t)throw new Error("GenericSolverDebugger requires solver or createSolver");return t}),[A,c]=te.useState(()=>typeof window>"u"?"vector":window.localStorage.getItem("solver-utils-renderer")==="canvas"?"canvas":"vector"),[l,g]=te.useState(n),u=te.useMemo(()=>{try{return a.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(f){return console.error("Visualization error:",f),{points:[],lines:[],rects:[],circles:[]}}},[a,r]),h=te.useMemo(()=>(u.rects?.length||0)===0&&(u.lines?.length||0)===0&&(u.points?.length||0)===0&&(u.circles?.length||0)===0,[u]);te.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const f=document.createElement("script");f.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(f)}},[]),te.useEffect(()=>{g(n)},[n]);const d=a.pipelineDef!==void 0,p=f=>{const I=a;if(!a.solved&&!a.failed){for(;!a.solved&&!a.failed&&I.currentPipelineStageIndex<=I.pipelineDef.findIndex(C=>C.solverName===f);)a.step();s()}},m=()=>{const f=JSON.stringify(u,null,2),I=new Blob([f],{type:"application/json"}),C=URL.createObjectURL(I),y=document.createElement("a");y.download="visualization.json",y.href=C,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(C)},_=f=>{c(f),typeof window<"u"&&window.localStorage.setItem("solver-utils-renderer",f)};return z.jsxs("div",{children:[z.jsx(gDi,{solver:a,triggerRender:s,animationSpeed:l,renderer:A,onRendererChange:_,onAnimationSpeedChange:g,onDownloadVisualization:m,onSolverStarted:o,onSolverCompleted:i}),h?z.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):z.jsx(xDi,{fallback:z.jsx(yDi,{graphics:u}),children:A==="canvas"?z.jsx(ADi,{graphics:u}):z.jsx(rDi,{graphics:u})}),d&&z.jsx(R0n,{solver:a,onStepUntilPhase:p,triggerRender:s})]})};const BDi=()=>{te.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const e=document.createElement("div");e.className="hidden",document.body.appendChild(e);const n=window.getComputedStyle(e).display==="none";if(document.body.removeChild(e),n)return;const o=document.createElement("script");o.id=t,o.src="https://cdn.tailwindcss.com",document.head.appendChild(o)},[])},SDi=1e3,gE=(t,e)=>{const{fileName:n,mimeType:o="text/plain"}=e,i=t instanceof Blob?t:new Blob([t],{type:o}),r=URL.createObjectURL(i),s=document.createElement("a");s.href=r,s.download=n,s.target="_blank",s.rel="noopener noreferrer",s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>{URL.revokeObjectURL(r)},SDi)},ZJe=t=>{let e=t.trim().replace(/[\\/:*?"<>|]/g,"_").replace(/[\x00-\x1f]/g,"").replace(/^\.+/,"").replace(/\.+$/,"").replace(/\s+/g," ").replace(/_+/g,"_");return/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i.test(e)&&(e=`_${e}`),e=e.slice(0,200),e||"untitled"},bDi=t=>{const e=t.solverConstructorArgs??[t.solverParams];if(t.solverName!=="AutoroutingPipelineSolver7_MultiGraph"||e.length!==1)return e;const[{input:n,options:o}]=e;return[n,o]},P6="https://github.com/tscircuit/tscircuit-autorouter/issues/new",T0n="https://github.com/tscircuit/copper-pour-solver/issues/new",k0n="https://github.com/tscircuit/calculate-packing/issues/new",QDi="https://github.com/tscircuit/matchpack/issues/new",F0n="https://github.com/tscircuit/schematic-trace-solver/issues/new?template=json-bug-report.yml",vDi={PackSolver2:k0n,LayoutPipelineSolver:QDi,AutoroutingPipelineSolver:P6,AssignableAutoroutingPipeline2:P6,AssignableAutoroutingPipeline3:P6,AutoroutingPipeline1_OriginalUnravel:P6,AutoroutingPipelineSolver3_HgPortPointPathing:P6,AutoroutingPipelineSolver4:P6,AutoroutingPipelineSolver5:P6,AutoroutingPipelineSolver7_MultiGraph:P6,AutoroutingPipelineSolver8:P6,CopperPourPipelineSolver:T0n,SchematicTracePipelineSolver:F0n},PDi=t=>t.toLowerCase().includes("pack")?z5i:t.toLowerCase().includes("rout")?Dsn:L5i,L0n=t=>{const e=vDi[t];if(e)return e;const n=t.toLowerCase();return n.includes("autorout")?P6:n.includes("schematic")&&n.includes("trace")?F0n:n.includes("copperpour")?T0n:n.includes("pack")?k0n:null},wDi=t=>`${ZJe(`${t.componentName}-${t.solverName}`)}-solver-input.json`,H0n=t=>{gE(JSON.stringify(t.solverParams,null,2),{fileName:wDi(t),mimeType:"application/json"})},MDi=({solverEvent:t})=>{const e=L0n(t.solverName);return z.jsxs("div",{className:"rf-flex rf-items-center rf-justify-end rf-gap-2 rf-border-b rf-border-gray-200 rf-bg-gray-50 rf-px-4 rf-py-2",children:[z.jsxs(jc,{type:"button",variant:"outline",size:"sm",onClick:()=>H0n(t),children:[z.jsx(A$,{className:"rf-w-4 rf-h-4"}),"Download"]}),e?z.jsx(jc,{asChild:!0,variant:"outline",size:"sm",children:z.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[z.jsx(Yhe,{className:"rf-w-4 rf-h-4"}),"Report"]})}):z.jsxs(jc,{type:"button",variant:"outline",size:"sm",disabled:!0,title:"No report link configured for this solver",children:[z.jsx(Yhe,{className:"rf-w-4 rf-h-4"}),"Report"]})]})},DDi=({solverEvent:t})=>{const e=L0n(t.solverName);return e?z.jsx(jc,{asChild:!0,variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",children:z.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:"Report solver bug","aria-label":"Report solver bug",children:z.jsx(Yhe,{className:"rf-w-4 rf-h-4"})})}):z.jsx(jc,{type:"button",variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",disabled:!0,title:"No report link configured for this solver","aria-label":"Report solver bug",children:z.jsx(Yhe,{className:"rf-w-4 rf-h-4"})})},NDi=({solverEvents:t=[]})=>{const[e,n]=te.useState(null);BDi();const o=te.useMemo(()=>{const a=new Map;for(const A of t){const c=`${A.componentName}-${A.solverName}`;a.set(c,A)}return a},[t]),i=te.useMemo(()=>Array.from(o.keys()),[o]),r=e?o.get(e):null,s=te.useMemo(()=>{if(!r)return{instance:null,error:null,classFound:!1};const a=kNe[r.solverName];if(!a)return{instance:null,error:`Solver class "${r.solverName}" not found in SOLVERS registry. Available: ${Object.keys(kNe).join(", ")}`,classFound:!1};try{return{instance:new a(...bDi(r)),error:null,classFound:!0}}catch(A){const c=A instanceof Error?A.message:String(A);return console.error("Failed to reconstruct solver:",A),{instance:null,error:`Failed to instantiate solver: ${c}`,classFound:!0}}},[r]);return t.length===0?z.jsx("div",{className:"rf-p-4",children:z.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:z.jsxs("div",{className:"rf-p-4",children:[z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),z.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):z.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[z.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[z.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[i.length," ",i.length===1?"Solver":"Solvers"]}),i.map(a=>{const A=o.get(a),c=e===a;return z.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${c?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>n(a),children:(()=>{const l=PDi(A.solverName);return z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[z.jsx(l,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),z.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[z.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:A.componentName}),z.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:A.solverName})]})]})})()},a)})]}),z.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:r?s.instance?z.jsxs("div",{className:"rf-flex rf-h-full rf-flex-col rf-overflow-y-auto",children:[z.jsx(MDi,{solverEvent:r}),z.jsx("div",{className:"rf-min-h-0 rf-flex-1",children:z.jsx(vB,{fallback:z.jsx("div",{className:"rf-p-4",children:z.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),z.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",r.solverName]})]})}),children:z.jsx(EDi,{solver:s.instance})})})]}):z.jsxs("div",{className:"rf-p-4",children:[z.jsxs("div",{className:"rf-mb-4",children:[z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:r.solverName}),z.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",r.componentName]})]}),s.error&&z.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:z.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),z.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[z.jsxs("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50 rf-flex rf-items-center rf-justify-between rf-gap-2",children:[z.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"}),z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-1",children:[z.jsx(DDi,{solverEvent:r}),z.jsx(jc,{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:()=>H0n(r),children:z.jsx(A$,{className:"rf-w-4 rf-h-4"})})]})]}),z.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:z.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(r.solverParams,null,2)})})]})]}):z.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:z.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},RDi=new Map([["custom","Custom"],["fanout","Fanout"],["single_layer_fanout","Single layer fanout"],["tscircuit_simplify","Simplify"]]),TDi=new Set(["tscircuit","default","auto","auto_local"]);function kDi(t){if(t==="FanoutSolver")return"Fanout";if(t==="AutoroutingPipelineSolver11_Simplification")return"Simplify";const e=t.match(/^AutoroutingPipeline(?:Solver)?(\d+)(?:_|$)/);if(e)return`Pipeline${e[1]}`;const n=t.match(/^AssignableAutoroutingPipeline(\d+)$/);return n?`Assignable${n[1]}`:t}function FDi(t){const e=t.autorouterName?.trim(),n=e?.replace(/-/g,"_"),o=n&&RDi.get(n);if(o)return o;if(n&&!TDi.has(n))return e;const i=t.solverName?.trim();if(i)return kDi(i);const r=t.autorouterVersion?.trim();if(r){const s=r.match(/^beta[_-]pipeline(\d+)$/);return s?`Pipeline${s[1]}`:r==="latest"?"default":r}return e?"default":"Unknown"}const eWe="#fbbf24";function LDi(t){const e=t.endSimpleRouteJson?.traces??[],n=new Set(e.flatMap(i=>[i.pcb_trace_id,i.__replaces_pcb_trace_id].filter(r=>r!==void 0)));return[...(t.startSimpleRouteJson?.traces??[]).filter(i=>!n.has(i.pcb_trace_id)),...e]}function O0n(t){const e=new Map((t.startSimpleRouteJson?.traces??[]).map(n=>[n.pcb_trace_id,n]));return(t.endSimpleRouteJson?.traces??[]).filter(n=>{const o=e.get(n.pcb_trace_id);return!o||!!n.__replaces_pcb_trace_id&&n.__replaces_pcb_trace_id!==o.__replaces_pcb_trace_id||JSON.stringify(o.route)!==JSON.stringify(n.route)}).map(n=>n.pcb_trace_id)}function HDi(t,e){return{outer_diameter:t.via_diameter??e.minViaPadDiameter??e.min_via_pad_diameter??e.minViaDiameter??.6,hole_diameter:t.via_hole_diameter??e.minViaHoleDiameter??e.min_via_hole_diameter??.3}}function G0n(t,e){const n=[];for(const a of t.route)a.route_type==="wire"?n.push({...a,layer:a.layer}):a.route_type==="via"?n.push({route_type:"via",x:a.x,y:a.y,from_layer:a.from_layer,to_layer:a.to_layer,...HDi(a,e)}):a.route_type==="through_obstacle"&&n.push({route_type:"through_pad",start:{...a.start},end:{...a.end},width:a.width,start_layer:a.from_layer,end_layer:a.to_layer,pcb_smtpad_id:a.circuitJsonMetadata?.pcb_smtpad_id,pcb_plated_hole_id:a.circuitJsonMetadata?.pcb_plated_hole_id});const o=a=>{let A=-1,c=Number.POSITIVE_INFINITY;return n.forEach((l,g)=>{if(l.route_type!=="wire")return;const u=Math.hypot(l.x-a.x,l.y-a.y);u<c&&(c=u,A=g)}),A},i=t.route.filter(a=>a.route_type==="jumper").map(a=>[o(a.start),o(a.end)].sort((A,c)=>A-c)).filter(([a,A])=>a>=0&&A>a).sort(([a],[A])=>a-A),r=[];let s=0;for(const[a,A]of i)a>=s&&r.push(n.slice(s,a+1)),s=Math.max(s,A);return s<n.length&&r.push(n.slice(s)),r}function ODi(t){const e=[],n=[],o=t.endSimpleRouteJson;if(!o)return{lines:e,circles:n};const i=new Set(O0n(t));for(const r of o.traces??[])if(i.has(r.pcb_trace_id))for(const s of G0n(r,o)){let a;for(const A of s){if(A.route_type==="through_pad"){a={...A.end,layer:A.end_layer,width:A.width};continue}const c=A.route_type==="wire"?A.layer:A.from_layer;a&&a.layer===c&&(a.x!==A.x||a.y!==A.y)&&e.push({points:[{x:a.x,y:a.y},{x:A.x,y:A.y}],strokeWidth:A.route_type==="wire"?A.width:a.width,strokeColor:eWe,layer:c}),A.route_type==="via"&&n.push({center:{x:A.x,y:A.y},radius:A.outer_diameter/2,stroke:eWe,fill:"transparent"}),a={x:A.x,y:A.y,layer:A.route_type==="wire"?A.layer:A.to_layer,width:A.route_type==="wire"?A.width:a?.width??o.minTraceWidth}}}return{coordinateSystem:"cartesian",lines:e,circles:n}}function GDi(t){const e=JSON.stringify(t);let n=2166136261;for(let o=0;o<e.length;o++)n=Math.imul(n^e.charCodeAt(o),16777619);return(n>>>0).toString(36)}const YDi=new Set(["pcb_trace","pcb_via","pcb_copper_pour","pcb_ground_plane","pcb_ground_plane_region","pcb_thermal_spoke","pcb_breakout_point"]);function UDi(t,e,n){const o=n==="input"?e.startSimpleRouteJson??e.errorSimpleRouteJson:e.endSimpleRouteJson,i=t.filter(c=>!YDi.has(c.type)&&!c.type.endsWith("_error")&&!c.type.endsWith("_warning"));if(!o)return i;const r=n==="input"?o.traces??[]:LDi(e),s=new Set(t.filter(c=>c.type==="source_trace").map(c=>c.source_trace_id)),a=["top",...Array.from({length:Math.max(0,o.layerCount-2)},(c,l)=>`inner${l+1}`),...o.layerCount>1?["bottom"]:[]],A=[];for(const c of r){const g=o.connections.find(h=>h.name===c.connection_name||h.source_trace_id===c.connection_name)?.source_trace_id??c.connection_name??"",u=G0n(c,o);for(const[h,d]of u.entries()){const p={type:"pcb_trace",pcb_trace_id:`${e.id}_${n}_${c.pcb_trace_id}_${h}_${GDi(d)}`,subcircuit_id:e.subcircuit_id??void 0,source_trace_id:s.has(g)?g:void 0,route:d};A.push(p);for(const[m,_]of d.entries()){if(_.route_type!=="via")continue;const f=a.indexOf(_.from_layer),I=a.indexOf(_.to_layer),C={type:"pcb_via",pcb_via_id:`${p.pcb_trace_id}_via_${m}`,pcb_trace_id:p.pcb_trace_id,subcircuit_id:e.subcircuit_id??void 0,x:_.x,y:_.y,outer_diameter:_.outer_diameter,hole_diameter:_.hole_diameter,layers:f>=0&&I>=0?a.slice(Math.min(f,I),Math.max(f,I)+1):[_.from_layer,_.to_layer]};A.push(C)}}}return[...i,...A]}const tWe=(t,e)=>t.phaseName||`Phase ${t.phaseOrdinal??e+1}`,Y0n=t=>t.componentDisplayName?.match(/name="([^"]+)"/)?.[1]?.replace(/^\./,"")||t.componentDisplayName||t.subcircuit_id||"Board",U0n=t=>t.startSimpleRouteJson??t.endSimpleRouteJson??t.errorSimpleRouteJson,KDi={is_showing_autorouting:!0,is_showing_rats_nest:!1,is_showing_drc_errors:!1,is_showing_drc_warnings:!1,is_showing_pcb_groups:!1},VDi=({circuitJson:t,phases:e=[],isRunning:n=!1})=>{const[o,i]=te.useState(null),[r,s]=te.useState("output"),[a,A]=te.useState(!0),[c,l]=te.useState(!1),g=te.useRef(null),[u,h]=te.useState(480),d=o?e.findIndex(R=>R.id===o.id&&U0n(R)===U0n(o)):-1,p=d<0?e.length-1:d,m=e[p],_=d<0,f=!!m?.endSimpleRouteJson,I=m?.startSimpleRouteJson??m?.errorSimpleRouteJson,C=!!I,y=r==="output"&&!f?"input":r==="input"&&!C?"output":r,x=y==="input"?I:m?.endSimpleRouteJson,E=te.useMemo(()=>!m||!x?null:UDi(t??[],m,y),[t,m,x,y]),B=te.useMemo(()=>m&&y==="output"&&a?ODi(m):{lines:[],circles:[]},[m,y,a]);if(te.useLayoutEffect(()=>{const R=g.current;if(!R)return;const F=()=>h(Math.max(360,R.clientHeight));F();const G=new ResizeObserver(F);return G.observe(R),()=>G.disconnect()},[!!m]),!m)return z.jsxs("div",{className:"rf-flex rf-min-h-[400px] rf-flex-col rf-items-center rf-justify-center rf-gap-3 rf-p-8 rf-text-center",children:[z.jsx(Dsn,{className:"rf-h-7 rf-w-7 rf-text-blue-500"}),z.jsx("h3",{className:"rf-text-base rf-font-medium",children:n?"Waiting for autorouting":"No autorouting captures"}),z.jsx("p",{className:"rf-max-w-md rf-text-sm rf-text-gray-500",children:n?"Phases appear as the circuit routes. Each capture includes its input and output on the PCB.":"Run a circuit with autorouting enabled to inspect its phases. A circuit JSON file alone does not include routing history."})]});const b=tWe(m,p),Q=m.status==="running"&&n,w=!f,M=I?.connections.length,k=E?.filter(R=>R.type==="pcb_trace").length??0;return z.jsxs("div",{className:"rf-flex rf-h-full rf-min-h-[620px] rf-flex-col rf-bg-white md:rf-flex-row","data-testid":"autorouting-explorer",children:[z.jsxs("aside",{className:"rf-flex rf-shrink-0 rf-flex-col rf-border-b rf-border-gray-200 md:rf-w-52 md:rf-border-b-0 md:rf-border-r","aria-label":"Routing phases",children:[z.jsxs("div",{className:"rf-flex rf-items-center rf-justify-between rf-px-3 rf-py-2 rf-text-xs rf-text-gray-500",children:[z.jsx("span",{children:"Routing phases"}),z.jsx("span",{children:e.length})]}),z.jsx("div",{className:"rf-flex rf-gap-1 rf-overflow-x-auto rf-px-1.5 rf-pb-1.5 md:rf-flex-col md:rf-overflow-x-hidden md:rf-overflow-y-auto",children:e.map((R,F)=>{const G=O0n(R).length,U=R.endSimpleRouteJson?`${G} ${G===1?"trace":"traces"} routed`:R.status==="error"?"Failed":R.status==="running"&&n?"Routing…":"No output";return z.jsxs("button",{type:"button","aria-pressed":F===p,title:`${Y0n(R)} · ${U}`,onClick:()=>i(R),className:Kr("rf-flex rf-min-w-[192px] rf-items-start rf-gap-2 rf-rounded-md rf-border rf-px-2 rf-py-2 rf-text-left md:rf-min-w-0",F===p?"rf-border-blue-200 rf-bg-blue-50":"rf-border-transparent hover:rf-bg-gray-50"),children:[z.jsx("span",{className:Kr("rf-flex rf-h-5 rf-w-5 rf-shrink-0 rf-items-center rf-justify-center rf-rounded-full rf-text-[11px]",F===p?"rf-bg-blue-600 rf-text-white":"rf-bg-gray-100 rf-text-gray-500"),children:F+1}),z.jsxs("span",{className:"rf-min-w-0 rf-flex-1",children:[z.jsxs("span",{className:"rf-flex rf-items-center rf-gap-1",children:[z.jsx("span",{className:"rf-min-w-0 rf-flex-1 rf-truncate rf-text-xs rf-font-medium rf-leading-5 rf-text-gray-800",title:tWe(R,F),children:tWe(R,F)}),R.status==="complete"?z.jsx(a$,{"aria-label":"Captured",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-green-600"}):R.status==="error"?z.jsx(wVe,{"aria-label":"Failed",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-red-500"}):n?z.jsx(z5,{"aria-label":"Routing",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-animate-spin rf-text-blue-500"}):null]}),z.jsxs("span",{className:"rf-block rf-text-[11px] rf-leading-4 rf-text-gray-500",children:[FDi(R)," · ",U]})]})]},R.id)})})]}),z.jsxs("div",{className:"rf-flex rf-min-w-0 rf-flex-1 rf-flex-col",children:[z.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-gap-3 rf-border-b rf-border-gray-200 rf-px-4 rf-py-3",children:[z.jsxs("h3",{className:"rf-mr-auto rf-flex rf-items-center rf-gap-2 rf-text-sm rf-font-medium",children:[b,z.jsxs("span",{className:"rf-text-xs rf-font-normal rf-text-gray-500",children:[p+1," of ",e.length]})]}),n&&z.jsx("button",{type:"button",onClick:()=>i(null),disabled:_,className:"rf-text-xs rf-text-blue-600 disabled:rf-text-gray-500",children:_?"Following latest":"Follow latest"}),z.jsx("div",{className:"rf-flex rf-rounded-md rf-bg-gray-100 rf-p-1","aria-label":"Phase snapshot",children:["input","output"].map(R=>z.jsx("button",{type:"button","aria-pressed":y===R,disabled:R==="input"?!C:!f,onClick:()=>s(R),className:Kr("rf-rounded rf-px-3 rf-py-1 rf-text-xs disabled:rf-opacity-40",y===R?"rf-bg-white rf-text-gray-900 rf-shadow-sm":"rf-text-gray-500"),children:R==="input"?"Input":"Output"},R))})]}),z.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-justify-between rf-gap-2 rf-px-4 rf-py-2 rf-text-xs rf-text-gray-600",children:[z.jsxs("label",{className:"rf-flex rf-items-center rf-gap-2",children:[z.jsx("input",{type:"checkbox",checked:a,disabled:y!=="output",onChange:R=>A(R.target.checked),className:"rf-accent-blue-600"}),z.jsx("span",{"aria-hidden":"true",className:"rf-inline-block rf-h-0.5 rf-w-3",style:{backgroundColor:eWe}}),"Highlight changes (all layers)"]}),z.jsxs("span",{children:[y==="input"?"Before this phase":"After this phase"," ","· ",k," traces"]})]}),w&&z.jsx("div",{className:Kr("rf-border-y rf-px-4 rf-py-2 rf-text-xs",m.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:m.status==="error"?`Routing failed: ${m.error?.message||"No output was captured."}`:Q?"Routing in progress. Showing captured input until output is available.":"No output was captured for this phase. Showing the available input."}),z.jsx("div",{ref:g,className:"rf-relative rf-min-h-[360px] rf-flex-1","data-testid":"autorouting-pcb",children:E?z.jsx(VJe,{circuitJson:E,height:u,allowEditing:!1,clickToInteractEnabled:!1,initialState:KDi,debugGraphics:B}):z.jsx("div",{className:"rf-p-6 rf-text-sm rf-text-gray-500",children:"No PCB snapshot available for this capture."})}),z.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-justify-between rf-gap-2 rf-border-t rf-border-gray-200 rf-px-4 rf-py-3 rf-text-xs rf-text-gray-500",children:[z.jsxs("span",{children:[M===void 0?"Input unavailable":`${M} input connections`,` · ${Y0n(m)}`]}),z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-4",children:[z.jsxs("button",{type:"button",disabled:!x,onClick:()=>gE(JSON.stringify(x,null,2),{fileName:`${m.id}-${y}.srj.json`,mimeType:"application/json"}),className:"rf-flex rf-items-center rf-gap-1 disabled:rf-opacity-40",children:[z.jsx(A$,{className:"rf-h-3 rf-w-3"}),"Download SRJ"]}),z.jsxs("button",{type:"button","aria-expanded":c,onClick:()=>l(!c),className:"rf-flex rf-items-center rf-gap-1",children:[z.jsx(IY,{className:Kr("rf-h-3 rf-w-3",c&&"rf-rotate-90")}),"Inspect SRJ"]})]})]}),c&&z.jsx("pre",{className:"rf-m-0 rf-max-h-64 rf-overflow-auto rf-border-t rf-border-gray-200 rf-bg-gray-50 rf-p-4 rf-text-xs","aria-label":`${b} ${y} SRJ`,children:x?JSON.stringify(x,null,2):"No snapshot captured."})]})]})},K0n=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{te.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{Ik.captureException(o)}catch{}}},[t,e]),te.useEffect(()=>{if(n&&n.length>0)for(const o of n){const i=new Error(o.message||"Circuit JSON Error");o.stack&&(i.stack=o.stack);try{Ik.captureException(i,{error_type:o.type})}catch{}}},[n])},zDi=t=>{te.useEffect(()=>{try{z4n(t)}catch{}},[t.source,t.component,t.isWebEmbedded,t.activeTab])},V0n="0.0.2798",JDi={version:V0n},nWe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},oWe=new Map,_me=t=>{const e=oWe.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,o])=>[n,o.getState()])):{}},WDi=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};const o=oWe.get(n.name);if(o)return{type:"tracked",store:t,...o};const i={connection:e.connect(n),stores:{}};return oWe.set(n.name,i),{type:"tracked",store:t,...i}},z0n=(t,e={})=>(n,o,i)=>{const{enabled:r,anonymousActionType:s,store:a,...A}=e;let c;try{c=(r??(nWe?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(nWe?"production":void 0)!=="production"&&r&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,o,i);const{connection:l,...g}=WDi(a,c,A);let u=!0;i.setState=(p,m,_)=>{const f=n(p,m);if(!u)return f;const I=_===void 0?{type:s||"anonymous"}:typeof _=="string"?{type:_}:_;return a===void 0?(l?.send(I,o()),f):(l?.send({...I,type:`${a}/${I.type}`},{..._me(A.name),[a]:i.getState()}),f)};const h=(...p)=>{const m=u;u=!1,n(...p),u=m},d=t(i.setState,o,i);if(g.type==="untracked"?l?.init(d):(g.stores[g.store]=i,l?.init(Object.fromEntries(Object.entries(g.stores).map(([p,m])=>[p,p===g.store?d:m.getState()])))),i.dispatchFromDevtools&&typeof i.dispatch=="function"){let p=!1;const m=i.dispatch;i.dispatch=(..._)=>{(nWe?"production":void 0)!=="production"&&_[0].type==="__setState"&&!p&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),p=!0),m(..._)}}return l.subscribe(p=>{var m;switch(p.type){case"ACTION":if(typeof p.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return iWe(p.payload,_=>{if(_.type==="__setState"){if(a===void 0){h(_.state);return}Object.keys(_.state).length!==1&&console.error(`
|
|
5623
|
+
`,g=new Blob([l],{type:"text/plain"}),u=URL.createObjectURL(g),h=document.createElement("a");h.href=u,h.download=`${c}.test.ts`,h.click(),URL.revokeObjectURL(u)}catch(A){alert(`Error generating test.ts for ${t.getSolverName()}: ${A instanceof Error?A.message:String(A)}`)}o(!1)};return z.jsxs("div",{className:`relative ${e}`,ref:i,children:[z.jsx("button",{className:"px-2 py-1 rounded text-xs cursor-pointer",onClick:()=>o(!n),title:`Download options for ${t.getSolverName()}`,children:t.getSolverName()}),n&&z.jsxs("div",{className:"absolute top-full left-0 mt-1 bg-white border border-gray-300 rounded shadow-lg z-10 min-w-[150px]",children:[z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download JSON"}),z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),z.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:a,children:"Download test.ts"})]})]})},M0n=t=>t.activeSubSolver?[t,...M0n(t.activeSubSolver)]:[t],lDi=({solver:t})=>{const e=M0n(t);return z.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:e.map((n,o)=>z.jsxs("div",{className:"flex items-center",children:[o>0&&z.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),z.jsx(cDi,{solver:n})]},n.getSolverName()))})},gDi=({solver:t,triggerRender:e,animationSpeed:n=25,renderer:o,onRendererChange:i,onAnimationSpeedChange:r,onDownloadVisualization:s,onSolverStarted:a,onSolverCompleted:A})=>{const[c,l]=te.useReducer(B=>!B,!1),g=te.useRef(void 0),u=te.useRef(null),h="solver-debugger-last-iteration",[d,p]=te.useState(null),m=te.useRef(null),_=te.useMemo(()=>[{label:"Slow",value:250,description:"250ms"},{label:"Normal",value:100,description:"100ms"},{label:"Fast",value:10,description:"10ms"},{label:"Fast (2x)",value:5,description:"5ms"},{label:"Fast (10x)",value:1,description:"1ms"},{label:"Fast 20x",value:.5,description:"2 steps / 1ms"},{label:"Fast 100x",value:.1,description:"10 steps / 1ms"}],[]),f=()=>{const B=Math.max(1,n),b=n<1?Math.round(1/n):1;g.current=setInterval(()=>{if(t.solved||t.failed){g.current&&(clearInterval(g.current),g.current=void 0),l(),e(),A&&t.solved&&A(t);return}for(let Q=0;Q<b&&!(t.solved||t.failed);Q++)t.step();e()},B)},I=()=>{g.current&&(clearInterval(g.current),g.current=void 0)},C=()=>{!t.solved&&!t.failed&&(t.step(),e())},y=()=>{!t.solved&&!t.failed&&(a&&a(t),t.solve(),e(),A&&A(t))},x=()=>{c?(I(),l()):(l(),f())},E=()=>{if(t.solved||t.failed||c)return;u.current===null&&typeof window<"u"&&(u.current=window.localStorage.getItem(h));const B=window.prompt("Step until which iteration?",u.current??`${t.iterations}`);if(B===null)return;u.current=B,typeof window<"u"&&window.localStorage.setItem(h,B);const b=Number(B);if(!Number.isFinite(b)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<b&&!t.solved&&!t.failed;)t.step();e(),t.solved&&A&&A(t)};return te.useEffect(()=>()=>{I()},[]),te.useEffect(()=>{(t.solved||t.failed)&&c&&(I(),l())},[t.solved,t.failed,c]),te.useEffect(()=>{c&&(I(),f())},[n,c]),te.useEffect(()=>{if(typeof document>"u")return;const B=b=>{m.current&&!m.current.contains(b.target)&&p(null)};return document.addEventListener("mousedown",B),()=>{document.removeEventListener("mousedown",B)}},[]),z.jsxs("div",{className:"space-y-2 p-2 border-b",children:[z.jsx("div",{className:"flex items-center",children:z.jsxs("div",{className:"flex items-center gap-2",ref:m,children:[z.jsxs("div",{className:"flex h-9 items-center space-x-1 rounded-md border border-slate-200 bg-white p-1 shadow-sm",children:[z.jsxs("div",{className:"relative",children:[z.jsx("button",{type:"button",onClick:()=>p(d==="renderer"?null:"renderer"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="renderer"?"open":"closed",children:"Renderer"}),d==="renderer"&&z.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[10rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:["vector","canvas"].map(B=>z.jsxs("button",{type:"button",onClick:()=>{i(B),p(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[B==="vector"?"Vector":"Canvas",o===B&&z.jsx("span",{className:"ml-auto text-xs text-slate-500",children:"✓"})]},B))})]}),z.jsxs("div",{className:"relative",children:[z.jsx("button",{type:"button",onClick:()=>p(d==="debug"?null:"debug"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="debug"?"open":"closed",children:"Debug"}),d==="debug"&&z.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[12rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:z.jsx("button",{type:"button",onClick:()=>{s(),p(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:"Download Visualization"})})]}),z.jsxs("div",{className:"relative",children:[z.jsx("button",{type:"button",onClick:()=>p(d==="animation"?null:"animation"),className:"flex select-none items-center rounded-sm px-3 py-1 text-sm font-medium outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100","data-state":d==="animation"?"open":"closed",children:"Animation"}),d==="animation"&&z.jsx("div",{className:"absolute left-0 z-50 mt-1 min-w-[12rem] rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md",children:_.map(B=>z.jsxs("button",{type:"button",onClick:()=>{r(B.value),p(null)},className:"flex w-full items-center rounded-sm px-2 py-1.5 text-sm hover:bg-slate-100",children:[B.label,z.jsx("span",{className:"ml-auto text-xs text-slate-500",children:B.description}),n===B.value&&z.jsx("span",{className:"ml-2 text-xs text-slate-500",children:"✓"})]},B.value))})]})]}),z.jsx(lDi,{solver:t})]})}),z.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[z.jsx("button",{onClick:C,disabled:t.solved||t.failed||c,className:"bg-blue-500 hover:bg-blue-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step"}),z.jsx("button",{onClick:y,disabled:t.solved||t.failed||c,className:"bg-green-500 hover:bg-green-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Solve"}),z.jsx("button",{onClick:x,disabled:t.solved||t.failed,className:`px-3 py-1 rounded text-white text-sm ${c?"bg-red-500 hover:bg-red-600":"bg-yellow-500 hover:bg-yellow-600"} disabled:bg-gray-300`,children:c?"Stop":"Animate"}),z.jsx("button",{onClick:E,disabled:t.solved||t.failed||c,className:"bg-orange-500 hover:bg-orange-600 disabled:bg-gray-300 text-white px-3 py-1 rounded text-sm",children:"Step Until Iteration"}),z.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&z.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),t.solved&&z.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&z.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&z.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},uDi=t=>t!==null&&"pipelineDef"in t&&Array.isArray(t.pipelineDef),dDi=(t,e,n)=>{const o=t.currentPipelineStageIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},hDi=(t,e)=>{const o=t.pipelineDef[e].solverName,i=dDi(t,e),r=t[o],s=t.firstIterationOfStage?.[o]??(e===t.currentPipelineStageIndex?t.iterations:null),a=t.iterations;let A=0;if(i==="Completed"){const u=t.pipelineDef[e+1],h=u?t.firstIterationOfStage?.[u.solverName]:void 0;h!==void 0&&s!==null?A=h-s:s!==null&&(A=a-s)}else i==="In Progress"&&s!==null&&(A=a-s);const c=t.timeSpentOnStage?.[o]??0;let l=0;i==="Completed"?l=1:i==="In Progress"&&r&&(l=r.progress??0);const g=r?.stats??null;return{index:e,name:o,status:i,firstIteration:s,iterations:A,progress:l,timeSpent:c,stats:g&&Object.keys(g).length>0?g:null,solverInstance:r??null}},pDi=({status:t})=>{const e={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return z.jsx("span",{className:`font-medium ${e[t]}`,children:t})},mDi=({progress:t})=>{if(t===0)return null;const e=Math.round(t*100);return z.jsxs("div",{className:"flex items-center gap-2",children:[z.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:z.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${e}%`}})}),z.jsxs("span",{className:"text-xs text-gray-500",children:[e,"%"]})]})},D0n=t=>{if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"||t==null)return String(t);if(typeof t=="object")try{return JSON.stringify(t)}catch{return String(t)}return String(t)},_Di=t=>Object.entries(t).map(([e,n])=>`${e}: ${D0n(n)}`).join(", "),fDi=({stats:t})=>{if(!t||Object.keys(t).length===0)return z.jsx("span",{children:"-"});const e=Object.entries(t),n=_Di(t);return z.jsxs("details",{className:"cursor-pointer",children:[z.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:n}),z.jsx("div",{className:"mt-1 text-xs",children:e.map(([o,i])=>z.jsxs("div",{children:[o,": ",D0n(i)]},o))})]})},$Je=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map($Je);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=$Je(o));return e},IDi=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=$Je(t.getConstructorParams()),o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),i=URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=`${e}_input.json`,r.click(),URL.revokeObjectURL(i)}catch(n){alert(`Error downloading input for ${e}: ${n instanceof Error?n.message:String(n)}`)}},CDi=({expanded:t})=>z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:`w-4 h-4 transition-transform duration-200 ${t?"rotate-90":""}`,children:z.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})}),N0n=t=>{let e=t;for(;e.activeSubSolver;)e=e.activeSubSolver;return e},R0n=({solver:t,onStepUntilPhase:e,onDownloadInput:n,isNested:o=!1,indentLevel:i=0,triggerRender:r})=>{const[s,a]=te.useState(new Set),A=t.pipelineDef.map((m,_)=>hDi(t,_)),c=m=>{a(_=>{const f=new Set(_);return f.has(m)?f.delete(m):f.add(m),f})},l=m=>{e?.(m)},g=m=>{m.solverInstance&&(n?n(m.solverInstance,m.name):IDi(m.solverInstance,m.name))},u=m=>`${(m/1e3).toFixed(2)}s`,h=()=>{if(!t.solved&&!t.failed){const m=t.activeSubSolver;for(;!t.solved&&!t.failed&&(t.step(),!(t.activeSubSolver&&t.activeSubSolver!==m)););r?.()}},d=()=>{if(!t.solved&&!t.failed){const m=N0n(t);for(;!t.solved&&!t.failed&&(t.step(),N0n(t)===m););r?.()}},p=i*24;return z.jsxs("div",{className:o?"":"border-t border-gray-200",children:[!o&&z.jsxs("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200 flex items-center justify-between",children:[z.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Stages"}),z.jsxs("div",{className:"flex gap-2",children:[z.jsx("button",{onClick:d,disabled:t.solved||t.failed,className:"bg-indigo-500 hover:bg-indigo-600 disabled:bg-gray-300 disabled:cursor-not-allowed cursor-pointer text-white px-3 py-1 rounded text-sm",children:"Next Solver"}),z.jsx("button",{onClick:h,disabled:t.solved||t.failed,className:"bg-purple-500 hover:bg-purple-600 disabled:bg-gray-300 disabled:cursor-not-allowed cursor-pointer text-white px-3 py-1 rounded text-sm",children:"Next Stage"})]})]}),z.jsx("div",{className:"overflow-x-auto",children:z.jsxs("table",{className:"w-full text-sm",children:[!o&&z.jsx("thead",{children:z.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stage"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),z.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",z.jsx("sub",{children:"0"})]}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),z.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),z.jsx("tbody",{children:A.map(m=>{const _=uDi(m.solverInstance),f=s.has(m.name);return z.jsxs(Ns.Fragment,{children:[z.jsxs("tr",{className:`border-b border-gray-100 ${m.status==="In Progress"?"bg-yellow-50":""}`,children:[z.jsx("td",{className:"px-4 py-2",children:z.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:p},children:[_?z.jsx("button",{onClick:()=>c(m.name),className:"text-gray-500 hover:text-gray-700",title:f?"Collapse":"Expand",children:z.jsx(CDi,{expanded:f})}):z.jsx("span",{className:"w-4"}),z.jsx("span",{className:"text-gray-400 w-6",children:String(m.index+1).padStart(2,"0")}),z.jsx("button",{onClick:()=>l(m.name),disabled:m.status==="Completed"||t.solved||t.failed,className:"text-blue-500 hover:text-blue-700 disabled:text-gray-300 disabled:cursor-not-allowed",title:`Step until ${m.name} completes`,children:z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:z.jsx("path",{fillRule:"evenodd",d:"M4.5 5.653c0-1.426 1.529-2.33 2.779-1.643l11.54 6.348c1.295.712 1.295 2.573 0 3.285L7.28 19.991c-1.25.687-2.779-.217-2.779-1.643V5.653z",clipRule:"evenodd"})})}),z.jsx("span",{className:"font-medium text-gray-900",children:m.name})]})}),z.jsx("td",{className:"px-4 py-2",children:z.jsx(pDi,{status:m.status})}),z.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:m.firstIteration!==null?m.firstIteration:""}),z.jsx("td",{className:"px-4 py-2 text-gray-600",children:m.iterations}),z.jsx("td",{className:"px-4 py-2",children:z.jsx(mDi,{progress:m.progress})}),z.jsx("td",{className:"px-4 py-2 text-gray-600",children:u(m.timeSpent)}),z.jsx("td",{className:"px-4 py-2 text-gray-500",children:z.jsx(fDi,{stats:m.stats})}),z.jsx("td",{className:"px-4 py-2",children:m.solverInstance?z.jsxs("button",{onClick:()=>g(m),className:"flex items-center gap-1 text-blue-500 hover:text-blue-700",title:`Download input for ${m.name}`,children:[z.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:z.jsx("path",{fillRule:"evenodd",d:"M12 2.25a.75.75 0 01.75.75v11.69l3.22-3.22a.75.75 0 111.06 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-4.5-4.5a.75.75 0 111.06-1.06l3.22 3.22V3a.75.75 0 01.75-.75zm-9 13.5a.75.75 0 01.75.75v2.25a1.5 1.5 0 001.5 1.5h13.5a1.5 1.5 0 001.5-1.5V16.5a.75.75 0 011.5 0v2.25a3 3 0 01-3 3H5.25a3 3 0 01-3-3V16.5a.75.75 0 01.75-.75z",clipRule:"evenodd"})}),z.jsx("span",{children:"Input"})]}):null})]}),_&&f&&z.jsx("tr",{children:z.jsx("td",{colSpan:8,className:"p-0",children:z.jsx(R0n,{solver:m.solverInstance,onStepUntilPhase:e,onDownloadInput:n,isNested:!0,indentLevel:i+1,triggerRender:r})})})]},m.name)})})]})})]})};function yDi({graphics:t}){const e=t.points??[],n=t.lines??[],o=t.rects??[],i=t.circles??[],r=t.texts??[];let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,A=Number.NEGATIVE_INFINITY,c=Number.NEGATIVE_INFINITY;const l=(m,_)=>{typeof m=="number"&&(m<s&&(s=m),m>A&&(A=m)),typeof _=="number"&&(_<a&&(a=_),_>c&&(c=_))};for(const m of e)l(m.x,m.y);for(const m of n){const _=m.points??[];for(const f of _)l(f.x,f.y)}for(const m of o){const _=m.x??0,f=m.y??0,I=m.width??0,C=m.height??0;l(_,f),l(_+I,f+C)}for(const m of i){const _=m.x??0,f=m.y??0,I=m.radius??1;l(_-I,f-I),l(_+I,f+I)}for(const m of r)l(m.x,m.y);(!isFinite(s)||!isFinite(a)||!isFinite(A)||!isFinite(c))&&(s=-20,a=-20,A=20,c=20);const g=10,u=s-g,h=a-g,d=Math.max(1,A-s+2*g),p=Math.max(1,c-a+2*g);return z.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${u} ${h} ${d} ${p}`,role:"img","aria-label":"Graphics fallback",children:[o.map((m,_)=>z.jsx("rect",{x:m.x??0,y:m.y??0,width:m.width??0,height:m.height??0,fill:"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1},`rect-${_}`)),n.map((m,_)=>z.jsx("polyline",{fill:"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1,points:(m.points??[]).map(f=>`${f.x??0},${f.y??0}`).join(" ")},`line-${_}`)),i.map((m,_)=>z.jsx("circle",{cx:m.x??0,cy:m.y??0,r:m.radius??1.5,fill:m.fillColor??"none",stroke:m.strokeColor??"black",strokeWidth:m.strokeWidth??1},`circle-${_}`)),e.map((m,_)=>z.jsx("circle",{cx:m.x??0,cy:m.y??0,r:m.radius??1.5,fill:m.color??"black"},`point-${_}`)),r.map((m,_)=>z.jsx("text",{x:m.x??0,y:m.y??0,fontSize:m.fontSize??10,fill:m.color??"black",children:m.text??""},`text-${_}`))]})}var xDi=class extends Ns.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}},EDi=({solver:t,createSolver:e,animationSpeed:n=25,onSolverStarted:o,onSolverCompleted:i})=>{const[r,s]=te.useReducer(f=>f+1,0),[a]=te.useState(()=>{if(e)return e();if(!t)throw new Error("GenericSolverDebugger requires solver or createSolver");return t}),[A,c]=te.useState(()=>typeof window>"u"?"vector":window.localStorage.getItem("solver-utils-renderer")==="canvas"?"canvas":"vector"),[l,g]=te.useState(n),u=te.useMemo(()=>{try{return a.visualize()||{points:[],lines:[],rects:[],circles:[]}}catch(f){return console.error("Visualization error:",f),{points:[],lines:[],rects:[],circles:[]}}},[a,r]),h=te.useMemo(()=>(u.rects?.length||0)===0&&(u.lines?.length||0)===0&&(u.points?.length||0)===0&&(u.circles?.length||0)===0,[u]);te.useEffect(()=>{if(!(typeof document>"u")&&!document.querySelector('script[src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"]')){const f=document.createElement("script");f.src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",document.head.appendChild(f)}},[]),te.useEffect(()=>{g(n)},[n]);const d=a.pipelineDef!==void 0,p=f=>{const I=a;if(!a.solved&&!a.failed){for(;!a.solved&&!a.failed&&I.currentPipelineStageIndex<=I.pipelineDef.findIndex(C=>C.solverName===f);)a.step();s()}},m=()=>{const f=JSON.stringify(u,null,2),I=new Blob([f],{type:"application/json"}),C=URL.createObjectURL(I),y=document.createElement("a");y.download="visualization.json",y.href=C,document.body.appendChild(y),y.click(),document.body.removeChild(y),URL.revokeObjectURL(C)},_=f=>{c(f),typeof window<"u"&&window.localStorage.setItem("solver-utils-renderer",f)};return z.jsxs("div",{children:[z.jsx(gDi,{solver:a,triggerRender:s,animationSpeed:l,renderer:A,onRendererChange:_,onAnimationSpeedChange:g,onDownloadVisualization:m,onSolverStarted:o,onSolverCompleted:i}),h?z.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):z.jsx(xDi,{fallback:z.jsx(yDi,{graphics:u}),children:A==="canvas"?z.jsx(ADi,{graphics:u}):z.jsx(rDi,{graphics:u})}),d&&z.jsx(R0n,{solver:a,onStepUntilPhase:p,triggerRender:s})]})};const BDi=()=>{te.useEffect(()=>{const t="tailwind-cdn-script";if(document.getElementById(t)||window.tailwind)return;const e=document.createElement("div");e.className="hidden",document.body.appendChild(e);const n=window.getComputedStyle(e).display==="none";if(document.body.removeChild(e),n)return;const o=document.createElement("script");o.id=t,o.src="https://cdn.tailwindcss.com",document.head.appendChild(o)},[])},SDi=1e3,gE=(t,e)=>{const{fileName:n,mimeType:o="text/plain"}=e,i=t instanceof Blob?t:new Blob([t],{type:o}),r=URL.createObjectURL(i),s=document.createElement("a");s.href=r,s.download=n,s.target="_blank",s.rel="noopener noreferrer",s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>{URL.revokeObjectURL(r)},SDi)},ZJe=t=>{let e=t.trim().replace(/[\\/:*?"<>|]/g,"_").replace(/[\x00-\x1f]/g,"").replace(/^\.+/,"").replace(/\.+$/,"").replace(/\s+/g," ").replace(/_+/g,"_");return/^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/i.test(e)&&(e=`_${e}`),e=e.slice(0,200),e||"untitled"},bDi=t=>{const e=t.solverConstructorArgs??[t.solverParams];if(t.solverName!=="AutoroutingPipelineSolver7_MultiGraph"||e.length!==1)return e;const[{input:n,options:o}]=e;return[n,o]},P6="https://github.com/tscircuit/tscircuit-autorouter/issues/new",T0n="https://github.com/tscircuit/copper-pour-solver/issues/new",k0n="https://github.com/tscircuit/calculate-packing/issues/new",QDi="https://github.com/tscircuit/matchpack/issues/new",F0n="https://github.com/tscircuit/schematic-trace-solver/issues/new?template=json-bug-report.yml",vDi={PackSolver2:k0n,LayoutPipelineSolver:QDi,AutoroutingPipelineSolver:P6,AssignableAutoroutingPipeline2:P6,AssignableAutoroutingPipeline3:P6,AutoroutingPipeline1_OriginalUnravel:P6,AutoroutingPipelineSolver3_HgPortPointPathing:P6,AutoroutingPipelineSolver4:P6,AutoroutingPipelineSolver5:P6,AutoroutingPipelineSolver7_MultiGraph:P6,AutoroutingPipelineSolver8:P6,CopperPourPipelineSolver:T0n,SchematicTracePipelineSolver:F0n},PDi=t=>t.toLowerCase().includes("pack")?z5i:t.toLowerCase().includes("rout")?Dsn:L5i,L0n=t=>{const e=vDi[t];if(e)return e;const n=t.toLowerCase();return n.includes("autorout")?P6:n.includes("schematic")&&n.includes("trace")?F0n:n.includes("copperpour")?T0n:n.includes("pack")?k0n:null},wDi=t=>`${ZJe(`${t.componentName}-${t.solverName}`)}-solver-input.json`,H0n=t=>{gE(JSON.stringify(t.solverParams,null,2),{fileName:wDi(t),mimeType:"application/json"})},MDi=({solverEvent:t})=>{const e=L0n(t.solverName);return z.jsxs("div",{className:"rf-flex rf-items-center rf-justify-end rf-gap-2 rf-border-b rf-border-gray-200 rf-bg-gray-50 rf-px-4 rf-py-2",children:[z.jsxs(jc,{type:"button",variant:"outline",size:"sm",onClick:()=>H0n(t),children:[z.jsx(A$,{className:"rf-w-4 rf-h-4"}),"Download"]}),e?z.jsx(jc,{asChild:!0,variant:"outline",size:"sm",children:z.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[z.jsx(Yhe,{className:"rf-w-4 rf-h-4"}),"Report"]})}):z.jsxs(jc,{type:"button",variant:"outline",size:"sm",disabled:!0,title:"No report link configured for this solver",children:[z.jsx(Yhe,{className:"rf-w-4 rf-h-4"}),"Report"]})]})},DDi=({solverEvent:t})=>{const e=L0n(t.solverName);return e?z.jsx(jc,{asChild:!0,variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",children:z.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:"Report solver bug","aria-label":"Report solver bug",children:z.jsx(Yhe,{className:"rf-w-4 rf-h-4"})})}):z.jsx(jc,{type:"button",variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",disabled:!0,title:"No report link configured for this solver","aria-label":"Report solver bug",children:z.jsx(Yhe,{className:"rf-w-4 rf-h-4"})})},NDi=({solverEvents:t=[]})=>{const[e,n]=te.useState(null);BDi();const o=te.useMemo(()=>{const a=new Map;for(const A of t){const c=`${A.componentName}-${A.solverName}`;a.set(c,A)}return a},[t]),i=te.useMemo(()=>Array.from(o.keys()),[o]),r=e?o.get(e):null,s=te.useMemo(()=>{if(!r)return{instance:null,error:null,classFound:!1};const a=kNe[r.solverName];if(!a)return{instance:null,error:`Solver class "${r.solverName}" not found in SOLVERS registry. Available: ${Object.keys(kNe).join(", ")}`,classFound:!1};try{return{instance:new a(...bDi(r)),error:null,classFound:!0}}catch(A){const c=A instanceof Error?A.message:String(A);return console.error("Failed to reconstruct solver:",A),{instance:null,error:`Failed to instantiate solver: ${c}`,classFound:!0}}},[r]);return t.length===0?z.jsx("div",{className:"rf-p-4",children:z.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:z.jsxs("div",{className:"rf-p-4",children:[z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),z.jsx("p",{className:"rf-text-sm rf-text-gray-600",children:"Solvers will appear here when the circuit runs. Solvers are used for tasks like component packing and autorouting."})]})})}):z.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[z.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[z.jsxs("div",{className:"rf-text-xs rf-font-semibold rf-text-gray-500 rf-px-3 rf-py-2 rf-bg-gray-50 rf-border-b rf-border-gray-200",children:[i.length," ",i.length===1?"Solver":"Solvers"]}),i.map(a=>{const A=o.get(a),c=e===a;return z.jsx("div",{className:`rf-px-3 rf-py-2 rf-cursor-pointer rf-border-b rf-border-gray-100 ${c?"rf-bg-blue-50 rf-border-l-2 rf-border-l-blue-500":"hover:rf-bg-gray-50"}`,onClick:()=>n(a),children:(()=>{const l=PDi(A.solverName);return z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[z.jsx(l,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),z.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[z.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:A.componentName}),z.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:A.solverName})]})]})})()},a)})]}),z.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:r?s.instance?z.jsxs("div",{className:"rf-flex rf-h-full rf-flex-col rf-overflow-y-auto",children:[z.jsx(MDi,{solverEvent:r}),z.jsx("div",{className:"rf-min-h-0 rf-flex-1",children:z.jsx(vB,{fallback:z.jsx("div",{className:"rf-p-4",children:z.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),z.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",r.solverName]})]})}),children:z.jsx(EDi,{solver:s.instance})})})]}):z.jsxs("div",{className:"rf-p-4",children:[z.jsxs("div",{className:"rf-mb-4",children:[z.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:r.solverName}),z.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",r.componentName]})]}),s.error&&z.jsx("div",{className:`rf-rounded-md rf-border rf-p-4 rf-mb-4 ${s.classFound?"rf-bg-red-50 rf-border-red-200":"rf-bg-yellow-50 rf-border-yellow-200"}`,children:z.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),z.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[z.jsxs("div",{className:"rf-px-3 rf-py-2 rf-bg-gray-50 rf-flex rf-items-center rf-justify-between rf-gap-2",children:[z.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"}),z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-1",children:[z.jsx(DDi,{solverEvent:r}),z.jsx(jc,{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:()=>H0n(r),children:z.jsx(A$,{className:"rf-w-4 rf-h-4"})})]})]}),z.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:z.jsx("pre",{className:"rf-text-xs rf-font-mono rf-text-gray-600 rf-whitespace-pre-wrap rf-overflow-x-auto",children:JSON.stringify(r.solverParams,null,2)})})]})]}):z.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:z.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},RDi=new Map([["custom","Custom"],["fanout","Fanout"],["single_layer_fanout","Single layer fanout"],["tscircuit_simplify","Simplify"]]),TDi=new Set(["tscircuit","default","auto","auto_local"]);function kDi(t){if(t==="FanoutSolver")return"Fanout";if(t==="AutoroutingPipelineSolver11_Simplification")return"Simplify";const e=t.match(/^AutoroutingPipeline(?:Solver)?(\d+)(?:_|$)/);if(e)return`Pipeline${e[1]}`;const n=t.match(/^AssignableAutoroutingPipeline(\d+)$/);return n?`Assignable${n[1]}`:t}function FDi(t){const e=t.autorouterName?.trim(),n=e?.replace(/-/g,"_"),o=n&&RDi.get(n);if(o)return o;if(n&&!TDi.has(n))return e;const i=t.solverName?.trim();if(i)return kDi(i);const r=t.autorouterVersion?.trim();if(r){const s=r.match(/^beta[_-]pipeline(\d+)$/);return s?`Pipeline${s[1]}`:r==="latest"?"default":r}return e?"default":"Unknown"}const eWe="#fbbf24";function LDi(t){const e=t.endSimpleRouteJson?.traces??[],n=new Set(e.flatMap(i=>[i.pcb_trace_id,i.__replaces_pcb_trace_id].filter(r=>r!==void 0)));return[...(t.startSimpleRouteJson?.traces??[]).filter(i=>!n.has(i.pcb_trace_id)),...e]}function O0n(t){const e=new Map((t.startSimpleRouteJson?.traces??[]).map(n=>[n.pcb_trace_id,n]));return(t.endSimpleRouteJson?.traces??[]).filter(n=>{const o=e.get(n.pcb_trace_id);return!o||!!n.__replaces_pcb_trace_id&&n.__replaces_pcb_trace_id!==o.__replaces_pcb_trace_id||JSON.stringify(o.route)!==JSON.stringify(n.route)}).map(n=>n.pcb_trace_id)}function HDi(t,e){return{outer_diameter:t.via_diameter??e.minViaPadDiameter??e.min_via_pad_diameter??e.minViaDiameter??.6,hole_diameter:t.via_hole_diameter??e.minViaHoleDiameter??e.min_via_hole_diameter??.3}}function G0n(t,e){const n=[];for(const a of t.route)a.route_type==="wire"?n.push({...a,layer:a.layer}):a.route_type==="via"?n.push({route_type:"via",x:a.x,y:a.y,from_layer:a.from_layer,to_layer:a.to_layer,...HDi(a,e)}):a.route_type==="through_obstacle"&&n.push({route_type:"through_pad",start:{...a.start},end:{...a.end},width:a.width,start_layer:a.from_layer,end_layer:a.to_layer,pcb_smtpad_id:a.circuitJsonMetadata?.pcb_smtpad_id,pcb_plated_hole_id:a.circuitJsonMetadata?.pcb_plated_hole_id});const o=a=>{let A=-1,c=Number.POSITIVE_INFINITY;return n.forEach((l,g)=>{if(l.route_type!=="wire")return;const u=Math.hypot(l.x-a.x,l.y-a.y);u<c&&(c=u,A=g)}),A},i=t.route.filter(a=>a.route_type==="jumper").map(a=>[o(a.start),o(a.end)].sort((A,c)=>A-c)).filter(([a,A])=>a>=0&&A>a).sort(([a],[A])=>a-A),r=[];let s=0;for(const[a,A]of i)a>=s&&r.push(n.slice(s,a+1)),s=Math.max(s,A);return s<n.length&&r.push(n.slice(s)),r}function ODi(t){const e=[],n=[],o=t.endSimpleRouteJson;if(!o)return{lines:e,circles:n};const i=new Set(O0n(t));for(const r of o.traces??[])if(i.has(r.pcb_trace_id))for(const s of G0n(r,o)){let a;for(const A of s){if(A.route_type==="through_pad"){a={...A.end,layer:A.end_layer,width:A.width};continue}const c=A.route_type==="wire"?A.layer:A.from_layer;a&&a.layer===c&&(a.x!==A.x||a.y!==A.y)&&e.push({points:[{x:a.x,y:a.y},{x:A.x,y:A.y}],strokeWidth:A.route_type==="wire"?A.width:a.width,strokeColor:eWe,layer:c}),A.route_type==="via"&&n.push({center:{x:A.x,y:A.y},radius:A.outer_diameter/2,stroke:eWe,fill:"transparent"}),a={x:A.x,y:A.y,layer:A.route_type==="wire"?A.layer:A.to_layer,width:A.route_type==="wire"?A.width:a?.width??o.minTraceWidth}}}return{coordinateSystem:"cartesian",lines:e,circles:n}}function GDi(t){const e=JSON.stringify(t);let n=2166136261;for(let o=0;o<e.length;o++)n=Math.imul(n^e.charCodeAt(o),16777619);return(n>>>0).toString(36)}const YDi=new Set(["pcb_trace","pcb_via","pcb_copper_pour","pcb_ground_plane","pcb_ground_plane_region","pcb_thermal_spoke","pcb_breakout_point"]);function UDi(t,e,n){const o=n==="input"?e.startSimpleRouteJson??e.errorSimpleRouteJson:e.endSimpleRouteJson,i=t.filter(c=>!YDi.has(c.type)&&!c.type.endsWith("_error")&&!c.type.endsWith("_warning"));if(!o)return i;const r=n==="input"?o.traces??[]:LDi(e),s=new Set(t.filter(c=>c.type==="source_trace").map(c=>c.source_trace_id)),a=["top",...Array.from({length:Math.max(0,o.layerCount-2)},(c,l)=>`inner${l+1}`),...o.layerCount>1?["bottom"]:[]],A=[];for(const c of r){const g=o.connections.find(h=>h.name===c.connection_name||h.source_trace_id===c.connection_name)?.source_trace_id??c.connection_name??"",u=G0n(c,o);for(const[h,d]of u.entries()){const p={type:"pcb_trace",pcb_trace_id:`${e.id}_${n}_${c.pcb_trace_id}_${h}_${GDi(d)}`,subcircuit_id:e.subcircuit_id??void 0,source_trace_id:s.has(g)?g:void 0,route:d};A.push(p);for(const[m,_]of d.entries()){if(_.route_type!=="via")continue;const f=a.indexOf(_.from_layer),I=a.indexOf(_.to_layer),C={type:"pcb_via",pcb_via_id:`${p.pcb_trace_id}_via_${m}`,pcb_trace_id:p.pcb_trace_id,subcircuit_id:e.subcircuit_id??void 0,x:_.x,y:_.y,outer_diameter:_.outer_diameter,hole_diameter:_.hole_diameter,layers:f>=0&&I>=0?a.slice(Math.min(f,I),Math.max(f,I)+1):[_.from_layer,_.to_layer]};A.push(C)}}}return[...i,...A]}const tWe=(t,e)=>t.phaseName||`Phase ${t.phaseOrdinal??e+1}`,Y0n=t=>t.componentDisplayName?.match(/name="([^"]+)"/)?.[1]?.replace(/^\./,"")||t.componentDisplayName||t.subcircuit_id||"Board",U0n=t=>t.startSimpleRouteJson??t.endSimpleRouteJson??t.errorSimpleRouteJson,KDi={is_showing_autorouting:!0,is_showing_rats_nest:!1,is_showing_drc_errors:!1,is_showing_drc_warnings:!1,is_showing_pcb_groups:!1},VDi=({circuitJson:t,phases:e=[],isRunning:n=!1})=>{const[o,i]=te.useState(null),[r,s]=te.useState("output"),[a,A]=te.useState(!0),[c,l]=te.useState(!1),g=te.useRef(null),[u,h]=te.useState(480),d=o?e.findIndex(R=>R.id===o.id&&U0n(R)===U0n(o)):-1,p=d<0?e.length-1:d,m=e[p],_=d<0,f=!!m?.endSimpleRouteJson,I=m?.startSimpleRouteJson??m?.errorSimpleRouteJson,C=!!I,y=r==="output"&&!f?"input":r==="input"&&!C?"output":r,x=y==="input"?I:m?.endSimpleRouteJson,E=te.useMemo(()=>!m||!x?null:UDi(t??[],m,y),[t,m,x,y]),B=te.useMemo(()=>m&&y==="output"&&a?ODi(m):{lines:[],circles:[]},[m,y,a]);if(te.useLayoutEffect(()=>{const R=g.current;if(!R)return;const F=()=>h(Math.max(360,R.clientHeight));F();const G=new ResizeObserver(F);return G.observe(R),()=>G.disconnect()},[!!m]),!m)return z.jsxs("div",{className:"rf-flex rf-min-h-[400px] rf-flex-col rf-items-center rf-justify-center rf-gap-3 rf-p-8 rf-text-center",children:[z.jsx(Dsn,{className:"rf-h-7 rf-w-7 rf-text-blue-500"}),z.jsx("h3",{className:"rf-text-base rf-font-medium",children:n?"Waiting for autorouting":"No autorouting captures"}),z.jsx("p",{className:"rf-max-w-md rf-text-sm rf-text-gray-500",children:n?"Phases appear as the circuit routes. Each capture includes its input and output on the PCB.":"Run a circuit with autorouting enabled to inspect its phases. A circuit JSON file alone does not include routing history."})]});const b=tWe(m,p),Q=m.status==="running"&&n,w=!f,M=I?.connections.length,k=E?.filter(R=>R.type==="pcb_trace").length??0;return z.jsxs("div",{className:"rf-flex rf-h-full rf-min-h-[620px] rf-flex-col rf-bg-white md:rf-flex-row","data-testid":"autorouting-explorer",children:[z.jsxs("aside",{className:"rf-flex rf-shrink-0 rf-flex-col rf-border-b rf-border-gray-200 md:rf-w-52 md:rf-border-b-0 md:rf-border-r","aria-label":"Routing phases",children:[z.jsxs("div",{className:"rf-flex rf-items-center rf-justify-between rf-px-3 rf-py-2 rf-text-xs rf-text-gray-500",children:[z.jsx("span",{children:"Routing phases"}),z.jsx("span",{children:e.length})]}),z.jsx("div",{className:"rf-flex rf-gap-1 rf-overflow-x-auto rf-px-1.5 rf-pb-1.5 md:rf-flex-col md:rf-overflow-x-hidden md:rf-overflow-y-auto",children:e.map((R,F)=>{const G=O0n(R).length,U=R.endSimpleRouteJson?`${G} ${G===1?"trace":"traces"} routed`:R.status==="error"?"Failed":R.status==="running"&&n?"Routing…":"No output";return z.jsxs("button",{type:"button","aria-pressed":F===p,title:`${Y0n(R)} · ${U}`,onClick:()=>i(R),className:Kr("rf-flex rf-min-w-[192px] rf-items-start rf-gap-2 rf-rounded-md rf-border rf-px-2 rf-py-2 rf-text-left md:rf-min-w-0",F===p?"rf-border-blue-200 rf-bg-blue-50":"rf-border-transparent hover:rf-bg-gray-50"),children:[z.jsx("span",{className:Kr("rf-flex rf-h-5 rf-w-5 rf-shrink-0 rf-items-center rf-justify-center rf-rounded-full rf-text-[11px]",F===p?"rf-bg-blue-600 rf-text-white":"rf-bg-gray-100 rf-text-gray-500"),children:F+1}),z.jsxs("span",{className:"rf-min-w-0 rf-flex-1",children:[z.jsxs("span",{className:"rf-flex rf-items-center rf-gap-1",children:[z.jsx("span",{className:"rf-min-w-0 rf-flex-1 rf-truncate rf-text-xs rf-font-medium rf-leading-5 rf-text-gray-800",title:tWe(R,F),children:tWe(R,F)}),R.status==="complete"?z.jsx(a$,{"aria-label":"Captured",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-green-600"}):R.status==="error"?z.jsx(wVe,{"aria-label":"Failed",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-red-500"}):n?z.jsx(z5,{"aria-label":"Routing",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-animate-spin rf-text-blue-500"}):null]}),z.jsxs("span",{className:"rf-block rf-text-[11px] rf-leading-4 rf-text-gray-500",children:[FDi(R)," · ",U]})]})]},R.id)})})]}),z.jsxs("div",{className:"rf-flex rf-min-w-0 rf-flex-1 rf-flex-col",children:[z.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-gap-3 rf-border-b rf-border-gray-200 rf-px-4 rf-py-3",children:[z.jsxs("h3",{className:"rf-mr-auto rf-flex rf-items-center rf-gap-2 rf-text-sm rf-font-medium",children:[b,z.jsxs("span",{className:"rf-text-xs rf-font-normal rf-text-gray-500",children:[p+1," of ",e.length]})]}),n&&z.jsx("button",{type:"button",onClick:()=>i(null),disabled:_,className:"rf-text-xs rf-text-blue-600 disabled:rf-text-gray-500",children:_?"Following latest":"Follow latest"}),z.jsx("div",{className:"rf-flex rf-rounded-md rf-bg-gray-100 rf-p-1","aria-label":"Phase snapshot",children:["input","output"].map(R=>z.jsx("button",{type:"button","aria-pressed":y===R,disabled:R==="input"?!C:!f,onClick:()=>s(R),className:Kr("rf-rounded rf-px-3 rf-py-1 rf-text-xs disabled:rf-opacity-40",y===R?"rf-bg-white rf-text-gray-900 rf-shadow-sm":"rf-text-gray-500"),children:R==="input"?"Input":"Output"},R))})]}),z.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-justify-between rf-gap-2 rf-px-4 rf-py-2 rf-text-xs rf-text-gray-600",children:[z.jsxs("label",{className:"rf-flex rf-items-center rf-gap-2",children:[z.jsx("input",{type:"checkbox",checked:a,disabled:y!=="output",onChange:R=>A(R.target.checked),className:"rf-accent-blue-600"}),z.jsx("span",{"aria-hidden":"true",className:"rf-inline-block rf-h-0.5 rf-w-3",style:{backgroundColor:eWe}}),"Highlight changes (all layers)"]}),z.jsxs("span",{children:[y==="input"?"Before this phase":"After this phase"," ","· ",k," traces"]})]}),w&&z.jsx("div",{className:Kr("rf-border-y rf-px-4 rf-py-2 rf-text-xs",m.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:m.status==="error"?`Routing failed: ${m.error?.message||"No output was captured."}`:Q?"Routing in progress. Showing captured input until output is available.":"No output was captured for this phase. Showing the available input."}),z.jsx("div",{ref:g,className:"rf-relative rf-min-h-[360px] rf-flex-1","data-testid":"autorouting-pcb",children:E?z.jsx(VJe,{circuitJson:E,height:u,allowEditing:!1,clickToInteractEnabled:!1,initialState:KDi,debugGraphics:B}):z.jsx("div",{className:"rf-p-6 rf-text-sm rf-text-gray-500",children:"No PCB snapshot available for this capture."})}),z.jsxs("div",{className:"rf-flex rf-flex-wrap rf-items-center rf-justify-between rf-gap-2 rf-border-t rf-border-gray-200 rf-px-4 rf-py-3 rf-text-xs rf-text-gray-500",children:[z.jsxs("span",{children:[M===void 0?"Input unavailable":`${M} input connections`,` · ${Y0n(m)}`]}),z.jsxs("div",{className:"rf-flex rf-items-center rf-gap-4",children:[z.jsxs("button",{type:"button",disabled:!x,onClick:()=>gE(JSON.stringify(x,null,2),{fileName:`${m.id}-${y}.srj.json`,mimeType:"application/json"}),className:"rf-flex rf-items-center rf-gap-1 disabled:rf-opacity-40",children:[z.jsx(A$,{className:"rf-h-3 rf-w-3"}),"Download SRJ"]}),z.jsxs("button",{type:"button","aria-expanded":c,onClick:()=>l(!c),className:"rf-flex rf-items-center rf-gap-1",children:[z.jsx(IY,{className:Kr("rf-h-3 rf-w-3",c&&"rf-rotate-90")}),"Inspect SRJ"]})]})]}),c&&z.jsx("pre",{className:"rf-m-0 rf-max-h-64 rf-overflow-auto rf-border-t rf-border-gray-200 rf-bg-gray-50 rf-p-4 rf-text-xs","aria-label":`${b} ${y} SRJ`,children:x?JSON.stringify(x,null,2):"No snapshot captured."})]})]})},K0n=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{te.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{Ik.captureException(o)}catch{}}},[t,e]),te.useEffect(()=>{if(n&&n.length>0)for(const o of n){const i=new Error(o.message||"Circuit JSON Error");o.stack&&(i.stack=o.stack);try{Ik.captureException(i,{error_type:o.type})}catch{}}},[n])},zDi=t=>{te.useEffect(()=>{try{z4n(t)}catch{}},[t.source,t.component,t.isWebEmbedded,t.activeTab])},V0n="0.0.2799",JDi={version:V0n},nWe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},oWe=new Map,_me=t=>{const e=oWe.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,o])=>[n,o.getState()])):{}},WDi=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};const o=oWe.get(n.name);if(o)return{type:"tracked",store:t,...o};const i={connection:e.connect(n),stores:{}};return oWe.set(n.name,i),{type:"tracked",store:t,...i}},z0n=(t,e={})=>(n,o,i)=>{const{enabled:r,anonymousActionType:s,store:a,...A}=e;let c;try{c=(r??(nWe?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(nWe?"production":void 0)!=="production"&&r&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,o,i);const{connection:l,...g}=WDi(a,c,A);let u=!0;i.setState=(p,m,_)=>{const f=n(p,m);if(!u)return f;const I=_===void 0?{type:s||"anonymous"}:typeof _=="string"?{type:_}:_;return a===void 0?(l?.send(I,o()),f):(l?.send({...I,type:`${a}/${I.type}`},{..._me(A.name),[a]:i.getState()}),f)};const h=(...p)=>{const m=u;u=!1,n(...p),u=m},d=t(i.setState,o,i);if(g.type==="untracked"?l?.init(d):(g.stores[g.store]=i,l?.init(Object.fromEntries(Object.entries(g.stores).map(([p,m])=>[p,p===g.store?d:m.getState()])))),i.dispatchFromDevtools&&typeof i.dispatch=="function"){let p=!1;const m=i.dispatch;i.dispatch=(..._)=>{(nWe?"production":void 0)!=="production"&&_[0].type==="__setState"&&!p&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),p=!0),m(..._)}}return l.subscribe(p=>{var m;switch(p.type){case"ACTION":if(typeof p.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return iWe(p.payload,_=>{if(_.type==="__setState"){if(a===void 0){h(_.state);return}Object.keys(_.state).length!==1&&console.error(`
|
|
5624
5624
|
[zustand devtools middleware] Unsupported __setState action format.
|
|
5625
5625
|
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
5626
5626
|
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
|