@tscircuit/runframe 0.0.2825 → 0.0.2827
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&&(j=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(b,1,!1,null,null,L,j,ae,fe,ze,At,null),b[q0]=v.current,XE(b),new F1(v)},RK.hydrateRoot=function(b,v,L){if(!_(b))throw Error("Target container is not a DOM element.");gp(b),v===void 0&&console.error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var j=!1,ae="",fe=_4,ze=z0,At=bm,Mt=null,Vt=null;return L!=null&&(L.unstable_strictMode===!0&&(j=!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(b,1,!0,v,L??null,j,ae,fe,ze,At,Mt,Vt),v.context=ln(null),L=v.current,j=Gd(L),j=ct(j),ae=tp(j),ae.callback=null,y0(L,ae,j),L=j,v.current.lanes=L,Le(v,L),Cu(v),b[q0]=v.current,XE(b),new P_(v)},RK.version="19.1.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})(),RK}var Eot;function eEn(){if(Eot)return xte.exports;Eot=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(),xte.exports=$3n()):xte.exports=Z3n(),xte.exports}var tEn=eEn(),te=Q3();const ks=uy(te),g5=tx({__proto__:null,default:ks},[te]);var nEn=Object.defineProperty,_k=(t,e)=>nEn(t,"name",{value:e,configurable:!0}),Bot=!!(typeof window<"u"&&window.document&&window.document.createElement);function _r(t,e,{checkForDefaultPrevented:n=!0}={}){return _k(function(i){if(t?.(i),n===!1||!i||!i.defaultPrevented)return e?.(i)},"handleEvent")}_k(_r,"composeEventHandlers");function oEn(t){if(!Bot)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}_k(oEn,"getOwnerWindow");function oye(t){if(!Bot)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}_k(oye,"getOwnerDocument");function bot(t,e=!1){const{activeElement:n}=oye(t);if(!n?.nodeName)return null;if(Sot(n)&&n.contentDocument)return bot(n.contentDocument.body,e);if(e){const o=n.getAttribute("aria-activedescendant");if(o){const i=oye(n).getElementById(o);if(i)return i}}return n}_k(bot,"getActiveElement");function Sot(t){return t.tagName==="IFRAME"}_k(Sot,"isFrame");var iEn=Object.defineProperty,u5=(t,e)=>iEn(t,"name",{value:e,configurable:!0});function rEn(t,e){const n=te.createContext(e);n.displayName=t+"Context";const o=u5(r=>{const{children:s,...a}=r,A=te.useMemo(()=>a,Object.values(a));return V.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 u5(i,"useContext"),[o,i]}u5(rEn,"createContext");function v3(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=u5(g=>{const{scope:u,children:h,...d}=g,p=u?.[t]?.[A]||a,m=te.useMemo(()=>d,Object.values(d));return V.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 u5(l,"useContext"),[c,l]}u5(o,"createContext");const i=u5(()=>{const r=n.map(s=>te.createContext(s));return u5(function(a){const A=a?.[t]||r;return te.useMemo(()=>({[`__scope${t}`]:{...a,[t]:A}}),[a,A])},"useScope")},"createScope");return i.scopeName=t,[o,Qot(i,...e)]}u5(v3,"createContextScope");function Qot(...t){const e=t[0];if(t.length===1)return e;const n=u5(()=>{const o=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return u5(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}u5(Qot,"composeContextScopes");var sEn=Object.defineProperty,iye=(t,e)=>sEn(t,"name",{value:e,configurable:!0});function rye(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}iye(rye,"setRef");function vot(...t){return e=>{let n=!1;const o=t.map(i=>{const r=rye(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():rye(t[i],null)}}}}iye(vot,"composeRefs");function lc(...t){return te.useCallback(vot(...t),t)}iye(lc,"useComposedRefs");var aEn=Object.defineProperty,M4=(t,e)=>aEn(t,"name",{value:e,configurable:!0});function f9(t){const e=te.forwardRef((n,o)=>{let{children:i,...r}=n,s=null,a=!1;const A=[];sye(i)&&typeof Ste=="function"&&(i=Ste(i._payload)),te.Children.forEach(i,u=>{if(Not(u)){a=!0;const h=u;let d="child"in h.props?h.props.child:h.props.children;sye(d)&&typeof Ste=="function"&&(d=Ste(d._payload)),s=cEn(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?Dot(s):void 0,l=lc(o,c);if(!s){if(i||i===0)throw new Error(a?uEn(t):gEn(t));return i}const g=Mot(r,s.props??{});return s.type!==te.Fragment&&(g.ref=o?l:c),te.cloneElement(s,g)});return e.displayName=`${t}.Slot`,e}M4(f9,"createSlot");var AEn=f9("Slot"),Pot=Symbol.for("radix.slottable");function wot(t){const e=M4(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=Pot,e}M4(wot,"createSlottable");var cEn=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 Mot(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(Mot,"mergeProps");function Dot(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(Dot,"getElementRef");function Not(t){return te.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Pot}M4(Not,"isSlottable");var lEn=Symbol.for("react.lazy");function sye(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===lEn&&"_payload"in t&&Rot(t._payload)}M4(sye,"isLazyComponent");function Rot(t){return typeof t=="object"&&t!==null&&"then"in t}M4(Rot,"isPromiseLike");var gEn=M4(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),uEn=M4(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Ste=g5[" use ".trim().toString()],dEn=Object.defineProperty,Uf=(t,e)=>dEn(t,"name",{value:e,configurable:!0});function Qte(t){const e=t+"CollectionProvider",[n,o]=v3(e),[i,r]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=Uf(p=>{const{scope:m,children:_}=p,f=te.useRef(null),I=te.useRef(new Map).current;return V.jsx(i,{scope:m,itemMap:I,collectionRef:f,children:_})},"CollectionProvider");s.displayName=e;const a=t+"CollectionSlot",A=f9(a),c=te.forwardRef((p,m)=>{const{scope:_,children:f}=p,I=r(a,_),C=lc(m,I.collectionRef);return V.jsx(A,{ref:C,children:f})});c.displayName=a;const l=t+"CollectionItemSlot",g="data-radix-collection-item",u=f9(l),h=te.forwardRef((p,m)=>{const{scope:_,children:f,...I}=p,C=te.useRef(null),y=lc(m,C),x=r(l,_);return te.useEffect(()=>(x.itemMap.set(C,{ref:C,...I}),()=>{x.itemMap.delete(C)})),V.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 Uf(d,"useCollection"),[{Provider:s,Slot:c,ItemSlot:h},d,o]}Uf(Qte,"createCollection");var Tot=new WeakMap,aye=(vE=class extends Map{constructor(n){super(n);Unt(this,u_);rte(this,u_,[...super.keys()]),Tot.set(this,!0)}set(n,o){return Tot.get(this)&&(this.has(n)?P0(this,u_)[P0(this,u_).indexOf(n)]=n:P0(this,u_).push(n)),super.set(n,o),this}insert(n,o,i){const r=this.has(o),s=P0(this,u_).length,a=Aye(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=[...P0(this,u_)];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 vE(this);return r.insert(n,o,i),r}before(n){const o=P0(this,u_).indexOf(n)-1;if(!(o<0))return this.entryAt(o)}setBefore(n,o,i){const r=P0(this,u_).indexOf(n);return r===-1?this:this.insert(r,o,i)}after(n){let o=P0(this,u_).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=P0(this,u_).indexOf(n);return r===-1?this:this.insert(r+1,o,i)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return rte(this,u_,[]),super.clear()}delete(n){const o=super.delete(n);return o&&P0(this,u_).splice(P0(this,u_).indexOf(n),1),o}deleteAt(n){const o=this.keyAt(n);return o!==void 0?this.delete(o):!1}at(n){const o=vte(P0(this,u_),n);if(o!==void 0)return this.get(o)}entryAt(n){const o=vte(P0(this,u_),n);if(o!==void 0)return[o,this.get(o)]}indexOf(n){return P0(this,u_).indexOf(n)}keyAt(n){return vte(P0(this,u_),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 vE(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 vE(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 vE(o)}toReversed(){const n=new vE;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 vE(o)}slice(n,o){const i=new vE;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}},u_=new WeakMap,Uf(vE,"OrderedDict"),vE);function vte(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=kot(t,e);return n===-1?void 0:t[n]}Uf(vte,"at");function kot(t,e){const n=t.length,o=Aye(e),i=o>=0?o:n+o;return i<0||i>=n?-1:i}Uf(kot,"toSafeIndex");function Aye(t){return t!==t||t===0?0:Math.trunc(t)}Uf(Aye,"toSafeInteger");function hEn(t){const e=t+"CollectionProvider",[n,o]=v3(e),[i,r]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new aye,setItemMap:Uf(()=>{},"setItemMap")}),s=Uf(({state:I,...C})=>I?V.jsx(A,{...C,state:I}):V.jsx(a,{...C}),"CollectionProvider");s.displayName=e;const a=Uf(I=>{const C=m();return V.jsx(A,{...I,state:C})},"CollectionInit");a.displayName=e+"Init";const A=Uf(I=>{const{scope:C,children:y,state:x}=I,E=te.useRef(null),[B,S]=te.useState(null),Q=lc(E,S),[P,M]=x;return te.useEffect(()=>{if(!B)return;const k=Hot(()=>{});return k.observe(B,{childList:!0,subtree:!0}),()=>{k.disconnect()}},[B]),V.jsx(i,{scope:C,itemMap:P,setItemMap:M,collectionRef:Q,collectionRefObject:E,collectionElement:B,children:y})},"CollectionProviderImpl");A.displayName=e+"Impl";const c=t+"CollectionSlot",l=f9(c),g=te.forwardRef((I,C)=>{const{scope:y,children:x}=I,E=r(c,y),B=lc(C,E.collectionRef);return V.jsx(l,{ref:B,children:x})});g.displayName=c;const u=t+"CollectionItemSlot",h="data-radix-collection-item",d=f9(u),p=te.forwardRef((I,C)=>{const{scope:y,children:x,...E}=I,B=te.useRef(null),[S,Q]=te.useState(null),P=lc(C,B,Q),M=r(u,y),{setItemMap:k}=M,R=te.useRef(E);Fot(R.current,E)||(R.current=E);const F=R.current;return te.useEffect(()=>{const O=F;return k(U=>S?U.has(S)?U.set(S,{...O,element:S}).toSorted(cye):(U.set(S,{...O,element:S}),U.toSorted(cye)):U),()=>{k(U=>!S||!U.has(S)?U:(U.delete(S),new aye(U)))}},[S,F,k]),V.jsx(d,{[h]:"",ref:P,children:x})});p.displayName=u;function m(){return te.useState(new aye)}Uf(m,"useInitCollection");function _(I){const{itemMap:C}=r(t+"CollectionConsumer",I);return C}return Uf(_,"useCollection"),[{Provider:s,Slot:g,ItemSlot:p},{createCollectionScope:o,useCollection:_,useInitCollection:m}]}Uf(hEn,"createCollection");function Fot(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}Uf(Fot,"shallowEqual");function Lot(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}Uf(Lot,"isElementPreceding");function cye(t,e){return!t[1].element||!e[1].element?0:Lot(t[1].element,e[1].element)?-1:1}Uf(cye,"sortByDocumentPosition");function Hot(t){return new MutationObserver(n=>{for(const o of n)if(o.type==="childList"){t();return}})}Uf(Hot,"getChildListObserver");var _p=globalThis?.document?te.useLayoutEffect:()=>{},pEn=Object.defineProperty,mEn=(t,e)=>pEn(t,"name",{value:e,configurable:!0}),_En=g5[" useId ".trim().toString()]||(()=>{}),fEn=0;function P3(t){const[e,n]=te.useState(_En());return _p(()=>{t||n(o=>o??String(fEn++))},[t]),t||(e?`radix-${e}`:"")}mEn(P3,"useId");var I9=nye();const Oot=uy(I9);var IEn=Object.defineProperty,CEn=(t,e)=>IEn(t,"name",{value:e,configurable:!0}),yEn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],gc=yEn.reduce((t,e)=>{const n=f9(`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),V.jsx(A,{...a,ref:r})});return o.displayName=`Primitive.${e}`,{...t,[e]:o}},{});function lye(t,e){t&&I9.flushSync(()=>t.dispatchEvent(e))}CEn(lye,"dispatchDiscreteCustomEvent");var xEn=Object.defineProperty,EEn=(t,e)=>xEn(t,"name",{value:e,configurable:!0});function w3(t){const e=te.useRef(t);return te.useEffect(()=>{e.current=t}),te.useMemo(()=>((...n)=>e.current?.(...n)),[])}EEn(w3,"useCallbackRef");var BEn=Object.defineProperty,bEn=(t,e)=>BEn(t,"name",{value:e,configurable:!0}),Got=g5[" useEffectEvent ".trim().toString()],Yot=g5[" useInsertionEffect ".trim().toString()];function Uot(t){if(typeof Got=="function")return Got(t);const e=te.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Yot=="function"?Yot(()=>{e.current=t}):_p(()=>{e.current=t}),te.useMemo(()=>((...n)=>e.current?.(...n)),[])}bEn(Uot,"useEffectEvent");var SEn=Object.defineProperty,TK=(t,e)=>SEn(t,"name",{value:e,configurable:!0}),QEn=g5[" useInsertionEffect ".trim().toString()]||_p;function C9({prop:t,defaultProp:e,onChange:n=TK(()=>{},"onChange"),caller:o}){const[i,r,s]=Kot({defaultProp:e,onChange:n}),a=t!==void 0,A=a?t:i,c=te.useCallback(l=>{if(a){const g=Vot(l)?l(t):l;g!==t&&s.current?.(g)}else r(l)},[a,t,r,s]);return[A,c]}TK(C9,"useControllableState");function Kot({defaultProp:t,onChange:e}){const[n,o]=te.useState(t),i=te.useRef(n),r=te.useRef(e);return QEn(()=>{r.current=e},[e]),te.useEffect(()=>{i.current!==n&&(r.current?.(n),i.current=n)},[n,i]),[n,o,r]}TK(Kot,"useUncontrolledState");function Vot(t){return typeof t=="function"}TK(Vot,"isFunction");var zot=Symbol("RADIX:SYNC_STATE");function vEn(t,e,n,o){const{prop:i,defaultProp:r,onChange:s,caller:a}=e,A=i!==void 0,c=Uot(s),l=[{...n,state:r}];o&&l.push(o);const[g,u]=te.useReducer((m,_)=>{if(_.type===zot)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:zot,state:i})},[i,g.state,A]),[p,u]}TK(vEn,"useControllableStateReducer");var PEn=Object.defineProperty,wEn=(t,e)=>PEn(t,"name",{value:e,configurable:!0}),MEn=te.createContext(void 0);function kK(t){const e=te.useContext(MEn);return t||e||"ltr"}wEn(kK,"useDirection");var DEn=Object.defineProperty,gye=(t,e)=>DEn(t,"name",{value:e,configurable:!0}),uye=!1;function Jot(){const[t,e]=te.useState(uye);return te.useEffect(()=>{uye||(uye=!0,e(!0))},[]),t}gye(Jot,"useIsHydrated");var Wot=g5[" useSyncExternalStore ".trim().toString()];function jot(){return()=>{}}gye(jot,"subscribe");function Xot(){return Wot(jot,()=>!0,()=>!1)}gye(Xot,"useIsHydratedModern");var NEn=typeof Wot=="function"?Xot:Jot,REn=Object.defineProperty,vM=(t,e)=>REn(t,"name",{value:e,configurable:!0}),dye="rovingFocusGroup.onEntryFocus",TEn={bubbles:!1,cancelable:!0},Pte="RovingFocusGroup",[hye,qot,kEn]=Qte(Pte),[FEn,wte]=v3(Pte,[kEn]),[LEn,HEn]=FEn(Pte),OEn=te.forwardRef(vM(function(e,n){return V.jsx(hye.Provider,{scope:e.__scopeRovingFocusGroup,children:V.jsx(hye.Slot,{scope:e.__scopeRovingFocusGroup,children:V.jsx(GEn,{...e,ref:n})})})},"RovingFocusGroup")),GEn=te.forwardRef(vM(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=lc(n,h),p=kK(s),[m,_]=C9({prop:a,defaultProp:A??null,onChange:c,caller:Pte}),[f,I]=te.useState(!1),C=w3(l),y=qot(o),x=te.useRef(!1),[E,B]=te.useState(0);return te.useEffect(()=>{const S=h.current;if(S)return S.addEventListener(dye,C),()=>S.removeEventListener(dye,C)},[C]),V.jsx(LEn,{scope:o,orientation:i,dir:p,loop:r,currentTabStopId:m,onItemFocus:te.useCallback(S=>_(S),[_]),onItemShiftTab:te.useCallback(()=>I(!0),[]),onFocusableItemAdd:te.useCallback(()=>B(S=>S+1),[]),onFocusableItemRemove:te.useCallback(()=>B(S=>S-1),[]),children:V.jsx(gc.div,{tabIndex:f||E===0?-1:0,"data-orientation":i,...u,ref:d,style:{outline:"none",...e.style},onMouseDown:_r(e.onMouseDown,()=>{x.current=!0}),onFocus:_r(e.onFocus,S=>{const Q=!x.current;if(S.target===S.currentTarget&&Q&&!f){const P=new CustomEvent(dye,TEn);if(S.currentTarget.dispatchEvent(P),!P.defaultPrevented){const M=y().filter(U=>U.focusable),k=M.find(U=>U.active),R=M.find(U=>U.id===m),O=[k,R,...M].filter(Boolean).map(U=>U.ref.current);pye(O,g)}}x.current=!1}),onBlur:_r(e.onBlur,()=>I(!1))})})},"RovingFocusGroupImpl")),YEn="RovingFocusGroupItem",UEn=te.forwardRef(vM(function(e,n){const{__scopeRovingFocusGroup:o,focusable:i=!0,active:r=!1,tabStopId:s,children:a,...A}=e,c=P3(),l=s||c,g=HEn(YEn,o),u=g.currentTabStopId===l,h=qot(o),{onFocusableItemAdd:d,onFocusableItemRemove:p,currentTabStopId:m}=g,_=NEn();return _p(()=>{if(!(!_||!i))return d(),()=>p()},[_,i,d,p]),te.useEffect(()=>{if(!(_||!i))return d(),()=>p()},[_,i,d,p]),V.jsx(hye.ItemSlot,{scope:o,id:l,focusable:i,active:r,children:V.jsx(gc.span,{tabIndex:u?0:-1,"data-orientation":g.orientation,...A,ref:n,onMouseDown:_r(e.onMouseDown,f=>{i?g.onItemFocus(l):f.preventDefault()}),onFocus:_r(e.onFocus,()=>g.onItemFocus(l)),onKeyDown:_r(e.onKeyDown,f=>{if(f.key==="Tab"&&f.shiftKey){g.onItemShiftTab();return}if(f.target!==f.currentTarget)return;const I=Zot(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?eit(y,x+1):y.slice(x+1)}setTimeout(()=>pye(y))}}),children:typeof a=="function"?a({isCurrentTabStop:u,hasTabStop:m!=null}):a})})},"RovingFocusGroupItem")),KEn={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $ot(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}vM($ot,"getDirectionAwareKey");function Zot(t,e,n){const o=$ot(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return KEn[o]}vM(Zot,"getFocusIntent");function pye(t,e=!1){const n=document.activeElement;for(const o of t)if(o===n||(o.focus({preventScroll:e}),document.activeElement!==n))return}vM(pye,"focusFirst");function eit(t,e){return t.map((n,o)=>t[(e+o)%t.length])}vM(eit,"wrapArray");var tit=OEn,nit=UEn,VEn=Object.defineProperty,p8=(t,e)=>VEn(t,"name",{value:e,configurable:!0});function oit(t,e){return te.useReducer((n,o)=>e[n][o]??n,t)}p8(oit,"useStateMachine");var D4=p8(t=>{const{present:e,children:n}=t,o=iit(e),i=typeof n=="function"?n({present:o.isPresent}):te.Children.only(n),r=rit(o.ref,sit(i));return typeof n=="function"||o.isPresent?te.cloneElement(i,{ref:r}):null},"Presence");function iit(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]=oit(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??fk(o.current),s.current=void 0):r.current="none"},[A]),_p(()=>{const l=o.current,g=i.current;if(g!==t){const h=r.current,d=fk(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]),_p(()=>{if(e){let l;const g=e.ownerDocument.defaultView??window,u=p8(d=>{const m=fk(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=p8(d=>{d.target===e&&(r.current=fk(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=fk(g)}else o.current=null;n(l)},[])}}p8(iit,"usePresence");function mye(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}p8(mye,"setRef");function rit(...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=mye(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():mye(o[s],null)}}},[])}p8(rit,"useStableComposedRefs");function fk(t){return t?.animationName||"none"}p8(fk,"getAnimationName");function sit(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)}p8(sit,"getElementRef");var zEn=Object.defineProperty,Ik=(t,e)=>zEn(t,"name",{value:e,configurable:!0}),_ye="Tabs",[JEn,LAr]=v3(_ye,[wte]),ait=wte(),[WEn,fye]=JEn(_ye),jEn=te.forwardRef(Ik(function(e,n){const{__scopeTabs:o,value:i,onValueChange:r,defaultValue:s,orientation:a="horizontal",dir:A,activationMode:c="automatic",...l}=e,g=kK(A),[u,h]=C9({prop:i,onChange:r,defaultProp:s??"",caller:_ye});return V.jsx(WEn,{scope:o,baseId:P3(),value:u,onValueChange:h,orientation:a,dir:g,activationMode:c,children:V.jsx(gc.div,{dir:g,"data-orientation":a,...l,ref:n})})},"Tabs")),XEn="TabsList",qEn=te.forwardRef(Ik(function(e,n){const{__scopeTabs:o,loop:i=!0,...r}=e,s=fye(XEn,o),a=ait(o);return V.jsx(tit,{asChild:!0,...a,orientation:s.orientation,dir:s.dir,loop:i,children:V.jsx(gc.div,{role:"tablist","aria-orientation":s.orientation,...r,ref:n})})},"TabsList")),$En="TabsTrigger",ZEn=te.forwardRef(Ik(function(e,n){const{__scopeTabs:o,value:i,disabled:r=!1,...s}=e,a=fye($En,o),A=ait(o),c=Iye(a.baseId,i),l=Cye(a.baseId,i),g=i===a.value;return V.jsx(nit,{asChild:!0,...A,focusable:!r,active:g,children:V.jsx(gc.button,{type:"button",role:"tab","aria-selected":g,"aria-controls":l,"data-state":g?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:c,...s,ref:n,onMouseDown:_r(e.onMouseDown,u=>{!r&&u.button===0&&u.ctrlKey===!1?a.onValueChange(i):u.preventDefault()}),onKeyDown:_r(e.onKeyDown,u=>{r||u.target!==u.currentTarget||[" ","Enter"].includes(u.key)&&a.onValueChange(i)}),onFocus:_r(e.onFocus,()=>{const u=a.activationMode!=="manual";!g&&!r&&u&&a.onValueChange(i)})})})},"TabsTrigger")),e5n="TabsContent",t5n=te.forwardRef(Ik(function(e,n){const{__scopeTabs:o,value:i,forceMount:r,children:s,...a}=e,A=fye(e5n,o),c=Iye(A.baseId,i),l=Cye(A.baseId,i),g=i===A.value,u=te.useRef(g);return te.useEffect(()=>{const h=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(h)},[]),V.jsx(D4,{present:r||g,children:({present:h})=>V.jsx(gc.div,{"data-state":g?"active":"inactive","data-orientation":A.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:l,tabIndex:0,...a,ref:n,style:{...e.style,animationDuration:u.current?"0s":void 0},children:h&&s})})},"TabsContent"));function Iye(t,e){return`${t}-trigger-${e}`}Ik(Iye,"makeTriggerId");function Cye(t,e){return`${t}-content-${e}`}Ik(Cye,"makeContentId");var n5n=jEn,Ait=qEn,cit=ZEn,lit=t5n;function git(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=git(t[e]))&&(o&&(o+=" "),o+=n)}else for(n in t)t[n]&&(o&&(o+=" "),o+=n);return o}function N4(){for(var t,e,n=0,o="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=git(t))&&(o&&(o+=" "),o+=e);return o}const yye="-",o5n=t=>{const e=r5n(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=t;return{getClassGroupId:s=>{const a=s.split(yye);return a[0]===""&&a.length!==1&&a.shift(),uit(a,e)||i5n(s)},getConflictingClassGroupIds:(s,a)=>{const A=n[s]||[];return a&&o[s]?[...A,...o[s]]:A}}},uit=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],o=e.nextPart.get(n),i=o?uit(t.slice(1),o):void 0;if(i)return i;if(e.validators.length===0)return;const r=t.join(yye);return e.validators.find(({validator:s})=>s(r))?.classGroupId},dit=/^\[(.+)\]$/,i5n=t=>{if(dit.test(t)){const e=dit.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},r5n=t=>{const{theme:e,prefix:n}=t,o={nextPart:new Map,validators:[]};return a5n(Object.entries(t.classGroups),n).forEach(([r,s])=>{xye(s,o,r,e)}),o},xye=(t,e,n,o)=>{t.forEach(i=>{if(typeof i=="string"){const r=i===""?e:hit(e,i);r.classGroupId=n;return}if(typeof i=="function"){if(s5n(i)){xye(i(o),e,n,o);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([r,s])=>{xye(s,hit(e,r),n,o)})})},hit=(t,e)=>{let n=t;return e.split(yye).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},s5n=t=>t.isThemeGetter,a5n=(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,A5n=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)}}},pit="!",c5n=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(pit),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},l5n=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},g5n=t=>({cache:A5n(t.cacheSize),parseClassName:c5n(t),...o5n(t)}),u5n=/\s+/,d5n=(t,e)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:i}=e,r=[],s=t.trim().split(u5n);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=l5n(l).join(":"),_=g?m+pit: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 h5n(){let t=0,e,n,o="";for(;t<arguments.length;)(e=arguments[t++])&&(n=mit(e))&&(o&&(o+=" "),o+=n);return o}const mit=t=>{if(typeof t=="string")return t;let e,n="";for(let o=0;o<t.length;o++)t[o]&&(e=mit(t[o]))&&(n&&(n+=" "),n+=e);return n};function p5n(t,...e){let n,o,i,r=s;function s(A){const c=e.reduce((l,g)=>g(l),t());return n=g5n(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=d5n(A,n);return i(A,l),l}return function(){return r(h5n.apply(null,arguments))}}const rd=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},_it=/^\[(?:([a-z-]+):)?(.+)\]$/i,m5n=/^\d+\/\d+$/,_5n=new Set(["px","full","screen"]),f5n=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,I5n=/\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$/,C5n=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,y5n=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,x5n=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,m8=t=>Ck(t)||_5n.has(t)||m5n.test(t),nQ=t=>yk(t,"length",w5n),Ck=t=>!!t&&!Number.isNaN(Number(t)),Eye=t=>yk(t,"number",Ck),FK=t=>!!t&&Number.isInteger(Number(t)),E5n=t=>t.endsWith("%")&&Ck(t.slice(0,-1)),RA=t=>_it.test(t),oQ=t=>f5n.test(t),B5n=new Set(["length","size","percentage"]),b5n=t=>yk(t,B5n,fit),S5n=t=>yk(t,"position",fit),Q5n=new Set(["image","url"]),v5n=t=>yk(t,Q5n,D5n),P5n=t=>yk(t,"",M5n),LK=()=>!0,yk=(t,e,n)=>{const o=_it.exec(t);return o?o[1]?typeof e=="string"?o[1]===e:e.has(o[1]):n(o[2]):!1},w5n=t=>I5n.test(t)&&!C5n.test(t),fit=()=>!1,M5n=t=>y5n.test(t),D5n=t=>x5n.test(t),N5n=p5n(()=>{const t=rd("colors"),e=rd("spacing"),n=rd("blur"),o=rd("brightness"),i=rd("borderColor"),r=rd("borderRadius"),s=rd("borderSpacing"),a=rd("borderWidth"),A=rd("contrast"),c=rd("grayscale"),l=rd("hueRotate"),g=rd("invert"),u=rd("gap"),h=rd("gradientColorStops"),d=rd("gradientColorStopPositions"),p=rd("inset"),m=rd("margin"),_=rd("opacity"),f=rd("padding"),I=rd("saturate"),C=rd("scale"),y=rd("sepia"),x=rd("skew"),E=rd("space"),B=rd("translate"),S=()=>["auto","contain","none"],Q=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto",RA,e],M=()=>[RA,e],k=()=>["",m8,nQ],R=()=>["auto",Ck,RA],F=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],O=()=>["solid","dashed","dotted","double","none"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>["start","end","center","between","around","evenly","stretch"],J=()=>["","0",RA],ee=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>[Ck,RA];return{cacheSize:500,separator:":",theme:{colors:[LK],spacing:[m8,nQ],blur:["none","",oQ,RA],brightness:W(),borderColor:[t],borderRadius:["none","","full",oQ,RA],borderSpacing:M(),borderWidth:k(),contrast:W(),grayscale:J(),hueRotate:W(),invert:J(),gap:M(),gradientColorStops:[t],gradientColorStopPositions:[E5n,nQ],inset:P(),margin:P(),opacity:W(),padding:M(),saturate:W(),scale:W(),sepia:J(),skew:W(),space:M(),translate:M()},classGroups:{aspect:[{aspect:["auto","square","video",RA]}],container:["container"],columns:[{columns:[oQ]}],"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(),RA]}],overflow:[{overflow:Q()}],"overflow-x":[{"overflow-x":Q()}],"overflow-y":[{"overflow-y":Q()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[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",FK,RA]}],basis:[{basis:P()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",RA]}],grow:[{grow:J()}],shrink:[{shrink:J()}],order:[{order:["first","last","none",FK,RA]}],"grid-cols":[{"grid-cols":[LK]}],"col-start-end":[{col:["auto",{span:["full",FK,RA]},RA]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[LK]}],"row-start-end":[{row:["auto",{span:[FK,RA]},RA]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",RA]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",RA]}],gap:[{gap:[u]}],"gap-x":[{"gap-x":[u]}],"gap-y":[{"gap-y":[u]}],"justify-content":[{justify:["normal",...Y()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Y(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Y(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[f]}],px:[{px:[f]}],py:[{py:[f]}],ps:[{ps:[f]}],pe:[{pe:[f]}],pt:[{pt:[f]}],pr:[{pr:[f]}],pb:[{pb:[f]}],pl:[{pl:[f]}],m:[{m:[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",RA,e]}],"min-w":[{"min-w":[RA,e,"min","max","fit"]}],"max-w":[{"max-w":[RA,e,"none","full","min","max","fit","prose",{screen:[oQ]},oQ]}],h:[{h:[RA,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[RA,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[RA,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[RA,e,"auto","min","max","fit"]}],"font-size":[{text:["base",oQ,nQ]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Eye]}],"font-family":[{font:[LK]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",RA]}],"line-clamp":[{"line-clamp":["none",Ck,Eye]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",m8,RA]}],"list-image":[{"list-image":["none",RA]}],"list-style-type":[{list:["none","disc","decimal",RA]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",m8,nQ]}],"underline-offset":[{"underline-offset":["auto",m8,RA]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",RA]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",RA]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...F(),S5n]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",b5n]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},v5n]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[d]}],"gradient-via-pos":[{via:[d]}],"gradient-to-pos":[{to:[d]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[r]}],"rounded-s":[{"rounded-s":[r]}],"rounded-e":[{"rounded-e":[r]}],"rounded-t":[{"rounded-t":[r]}],"rounded-r":[{"rounded-r":[r]}],"rounded-b":[{"rounded-b":[r]}],"rounded-l":[{"rounded-l":[r]}],"rounded-ss":[{"rounded-ss":[r]}],"rounded-se":[{"rounded-se":[r]}],"rounded-ee":[{"rounded-ee":[r]}],"rounded-es":[{"rounded-es":[r]}],"rounded-tl":[{"rounded-tl":[r]}],"rounded-tr":[{"rounded-tr":[r]}],"rounded-br":[{"rounded-br":[r]}],"rounded-bl":[{"rounded-bl":[r]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...O(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:O()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...O()]}],"outline-offset":[{"outline-offset":[m8,RA]}],"outline-w":[{outline:[m8,nQ]}],"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":[m8,nQ]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",oQ,P5n]}],"shadow-color":[{shadow:[LK]}],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",oQ,RA]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[l]}],invert:[{invert:[g]}],saturate:[{saturate:[I]}],sepia:[{sepia:[y]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[A]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[l]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[I]}],"backdrop-sepia":[{"backdrop-sepia":[y]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",RA]}],duration:[{duration:W()}],ease:[{ease:["linear","in","out","in-out",RA]}],delay:[{delay:W()}],animate:[{animate:["none","spin","ping","pulse","bounce",RA]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[FK,RA]}],"translate-x":[{"translate-x":[B]}],"translate-y":[{"translate-y":[B]}],"skew-x":[{"skew-x":[x]}],"skew-y":[{"skew-y":[x]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",RA]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",RA]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",RA]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[m8,nQ,Eye]}],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"]}}}),Ln="u">typeof window?window:void 0,gC="u">typeof globalThis?globalThis:Ln,F_=gC?.navigator,No=gC?.document,sd=gC?.location,HK=gC?.fetch,Bye=gC?.XMLHttpRequest&&"withCredentials"in new gC.XMLHttpRequest?gC.XMLHttpRequest:void 0,Iit=gC?.AbortController,R5n=gC?.CompressionStream,dy=F_?.userAgent;function Cit(){return!(!Ln||Ln.navigator.onLine===!1)}const OK=typeof globalThis<"u"?globalThis:Ln;OK&&typeof self>"u"&&(OK.self=OK),OK&&typeof File>"u"&&(OK.File=function(){});const Ur=Ln??{},T5n="0.9.0",_8={DEBUG:!1,LIB_VERSION:T5n,LIB_NAME:"browser-common"};var y9=(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})({}),bye=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({});const k5n=["$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"],F5n=["token"];function fs(t,e){return t.indexOf(e)!==-1}const Mte=function(t){return t.trim()},Sye=function(t){return t.replace(/^\$/,"")};function yit(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 xit=Object.prototype,Qye=xit.hasOwnProperty,Dte=xit.toString,as=Array.isArray||function(t){return Dte.call(t)==="[object Array]"},L_=t=>typeof t=="function",xA=t=>t===Object(t)&&!as(t),nx=t=>{if(xA(t)){for(const e in t)if(Qye.call(t,e))return!1;return!0}return!1},Bo=t=>t===void 0,nA=t=>Dte.call(t)=="[object String]",GK=t=>nA(t)&&t.trim().length===0,ad=t=>t===null,Us=t=>Bo(t)||ad(t),jd=t=>Dte.call(t)=="[object Number]"&&t==t,f8=t=>jd(t)&&t>0,hy=t=>Dte.call(t)==="[object Boolean]",L5n=t=>fs(k5n,t),H5n=t=>fs(F5n,t);function Eit(t){return t===null||typeof t!="object"}function Nte(t,e){return{}.toString.call(t)===`[object ${e}]`}function xk(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Bit(t,Error)}}function vye(t){return"u">typeof Event&&Bit(t,Event)}function Bit(t,e){try{return t instanceof e}catch{return!1}}const O5n=[!0,"true",1,"1","yes"],Pye=t=>fs(O5n,t),G5n=[!1,"false",0,"0","no"];function bit(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 jg(t){return function(){var e=this,n=arguments;return new Promise(function(o,i){var r=t.apply(e,n);function s(A){bit(r,o,i,s,a,"next",A)}function a(A){bit(r,o,i,s,a,"throw",A)}s(void 0)})}}const Y5n=["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"],Sit=function(t,e=[]){if(!t)return!1;const n=t.toLowerCase();return Y5n.concat(e).some(o=>{const i=o.toLowerCase();return n.indexOf(i)!==-1})};function x9(t,e,n,o,i){return e>n&&(o.warn("min cannot be greater than max."),e=n),jd(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),x9(i??n,e,n,o))}var U5n=class{constructor(e){this.C={},this.I=e.I,this.R=x9(e.bucketSize,0,100,e.$),this.A=x9(e.refillRate,0,this.R,e.$),this.O=x9(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",YK="Android",Rte="Tablet",Qit="Android Tablet",vit="iPad",Pit="Apple Watch",Tte="Safari",kte="BlackBerry",wit="Samsung Internet",Fte="Chrome",Mit="Chrome iOS",Dit="Internet Explorer",Nit="Internet Explorer Mobile",Rit="Opera",Tit="Microsoft Edge",Lte="Firefox",kit="Firefox iOS",Hte="Nintendo",Ote="PlayStation",Gte="Xbox",Fit="Android Mobile",Lit="Mobile Safari",wye="Windows",Hit="Windows Phone",Oit="Nokia",Mye="Ouya",K5n="Generic "+Ek.toLowerCase(),Git="Generic "+Rte.toLowerCase(),Dye="Konqueror",Yit="Oculus Browser",Uit="Vivaldi",Kit="Yandex",Vit="Whale",zit="DuckDuckGo",Jit="Pale Moon",Wit="Waterfox",Nye="Brave",jit="Claude",Xit="Codex",qit="ChatGPT",$it="Google Search App",Rye=new RegExp("Version/(\\d+(\\.\\d+)?)"),Tye=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),V5n=new RegExp(Gte,"i"),z5n=new RegExp("PlayStation \\w+","i"),J5n=new RegExp("Nintendo \\w+","i"),kye=new RegExp("BlackBerry|PlayBook|BB10","i"),W5n={"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"},Zit=function(t,e,n,o){return e=e||"",(function(r){return r?.brave?Nye:null})(n)||(o?.detectGoogleSearchApp&&fs(t,"GSA/")?$it:fs(t," OPR/")&&fs(t,"Mini")?"Opera Mini":fs(t," OPR/")?Rit:kye.test(t)?kte:fs(t,"IEMobile")||fs(t,"WPDesktop")?Nit:fs(t,"OculusBrowser")?Yit:fs(t,"SamsungBrowser")?wit:fs(t,"Edge")||fs(t,"Edg/")?Tit:fs(t,"Vivaldi/")?Uit:fs(t,"YaBrowser/")?Kit:fs(t,"Whale/")?Vit:fs(t,"DuckDuckGo/")||fs(t,"Ddg/")?zit:fs(t,"Claude/")?jit:fs(t,"Codex/")?Xit:fs(t,"ChatGPT/")?qit:fs(t,"FBIOS")?"Facebook Mobile":fs(t,"UCWEB")||fs(t,"UCBrowser")?"UC Browser":fs(t,"CriOS")?Mit:fs(t,"CrMo")||fs(t,Fte)?Fte:fs(t,YK)&&fs(t,Tte)?Fit:fs(t,"FxiOS")?kit:fs(t.toLowerCase(),Dye.toLowerCase())?Dye:fs(t,"Brave/")?Nye:((r,s)=>s&&fs(s,"Apple")||(function(a){return fs(a,Tte)&&!fs(a,Fte)&&!fs(a,YK)})(r))(t,e)?fs(t,Ek)?Lit:Tte:fs(t,"PaleMoon/")?Jit:fs(t,"Waterfox/")?Wit:fs(t,Lte)?Lte:fs(t,"MSIE")||fs(t,"Trident/")?Dit:fs(t,"Gecko")?Lte:"")},j5n={[Nit]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Tit]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Fte]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Mit]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Tte]:[Rye],[Lit]:[Rye],[Rit]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Lte]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[kit]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Dye]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[kte]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Rye],[Fit]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[wit]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Yit]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Uit]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Kit]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Vit]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Nye]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[jit]:[Tye],[Xit]:[Tye],[qit]:[Tye],[zit]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Jit]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Wit]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[$it]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Dit]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},X5n=function(t,e,n,o){const i=Zit(t,e,n,o),r=j5n[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},ert=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[Gte,t&&t[1]||""]],[new RegExp(Hte,"i"),[Hte,""]],[new RegExp(Ote,"i"),[Ote,""]],[kye,[kte,""]],[new RegExp(wye,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Hit,""];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=W5n[n[1]]||"";return/arm/i.test(e)&&(o="RT"),[wye,o]}return[wye,""]}],[/((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]?[YK,[t[2],t[3],t[4]||"0"].join(".")]:[YK,""]],[/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",""]]],trt=function(t){for(let e=0;ert.length>e;e++){const[n,o]=ert[e],i=n.exec(t),r=i&&(L_(o)?o(i,t):o);if(r)return r}return["",""]},nrt=function(t){return J5n.test(t)?Hte:z5n.test(t)?Ote:V5n.test(t)?Gte:new RegExp(Mye,"i").test(t)?Mye:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?Hit:/iPad/.test(t)?vit:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Pit:kye.test(t)?kte:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Oit,"i").test(t)?Oit:/(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)?YK:Qit:new RegExp("(pda|Mobile)","i").test(t)?K5n:new RegExp(Rte,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?Git:""},q5n=function(t,e){var n;const o=nrt(t);return o===vit||o===Qit||o==="Kobo"||o==="Kindle Fire"||o===Git?Rte:o===Hte||o===Gte||o===Ote||o===Mye?"Console":o===Pit?"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:Rte:"Desktop";var i,r,s},Fye=/\bFBAV\/(\d+(?:\.\d+)*)/i,ort=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Fye],[/\bFBAN\/EMA\b/i,"Facebook Lite",Fye],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Fye],[/\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"]],Lye="[Truncated]",UK="[Unserializable]";function Bk(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 irt(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=UK}Object.defineProperty(t,o,{value:i,enumerable:!0,writable:!0,configurable:!0})}return t}const Yte=3e5;var rrt=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,Yte);if(!n)return this.ts=o,void(this.es=o+i);this.es=Math.max(this.es,Math.min(o+i,this.ts+Yte))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const n=Math.min(Yte,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 $5n=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function srt(t,e){return typeof(n=t)=="string"&&$5n.test(n)?t:e();var n}function art(t,e){const n=new Error(e);try{Object.defineProperty(n,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function iQ(t){return t&&t.split("#")[0]}function Art(t){try{return t()}catch{return}}function crt(t,e){const n=setTimeout(t,e);return n!=null&&n.unref&&n?.unref(),n}function lrt(t,e,n){return grt.apply(this,arguments)}function grt(){return(grt=jg(function*(t,e,n){let o;try{return yield Promise.race([t,new Promise((i,r)=>{o=crt(()=>{try{n?.(),i()}catch(s){r(s)}},e)})])}finally{clearTimeout(o)}})).apply(this,arguments)}let Ute,urt,Hye;function Z5n(t){const e=globalThis._posthogChunkIds;if(!e)return;const n=Object.keys(e);return Hye&&n.length===urt||(urt=n.length,Hye=n.reduce((o,i)=>{Ute||(Ute={});const r=Ute[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,Ute[i]=[c,l];break}}}return o},{})),Hye}function KK(t){return KK=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},KK(t)}function e4n(t,e,n){return(e=(function(o){var i=(function(r){if(KK(r)!="object"||!r)return r;var s=r[Symbol.toPrimitive];if(s!==void 0){var a=s.call(r,"string");if(KK(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)})(o);return KK(i)=="symbol"?i:i+""})(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function drt(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?drt(Object(n),!0).forEach(function(o){e4n(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):drt(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}var t4n=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 jg(function*(){for(const o of e)o.stacktrace&&o.stacktrace.frames&&as(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 jg(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:Z5n(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}getAggregateErrors(e){try{if(xk(e)){let o=Object.getPrototypeOf(e);for(let i=0;o&&100>i;i++){var n;const r=(n=Object.getOwnPropertyDescriptor(o,"constructor"))===null||n===void 0?void 0:n.value;if(typeof r=="function"&&r.name==="AggregateError"){const s=e.errors;return as(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 n4n=/^([a-z][a-z0-9.+-]+):/i,o4n=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function i4n(t){if(!t||t==="<anonymous>")return!1;const e=n4n.exec(t);return!e||o4n.includes(e[1].toLowerCase())}function Oye(t,e,n,o,i){const r={platform:t,filename:e,function:n==="<anonymous>"?"?":n,in_app:i4n(e)};return Bo(o)||(r.lineno=o),Bo(i)||(r.colno=i),r}const hrt=(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]},r4n=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,s4n=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,a4n=/\((\S*)(?::(\d+))(?::(\d+))\)/,A4n=(t,e)=>{const n=r4n.exec(t);if(n){const[,i,r,s]=n;return Oye(e,i,"?",+r,+s)}const o=s4n.exec(t);if(o){if(o[2]&&o[2].indexOf("eval")===0){const s=a4n.exec(o[2]);s&&(o[2]=s[1],o[3]=s[2],o[4]=s[3])}const[i,r]=hrt(o[1]||"?",o[2]);return Oye(e,r,i,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},c4n=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,l4n=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,g4n=(t,e)=>{const n=c4n.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){const r=l4n.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]=hrt(i,o),Oye(e,o,i,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},prt=/\(error: (.*)\)/;function Gye(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function u4n(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(!Gye(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 d4n(t,e){const n=e.start+e.length,o=_rt(t,e);o&&t.splice(n+o===t.length?n:e.start,o)}function mrt(t,e){let n=e.start;for(;n>0&&Gye(t[n-1],t[n-1+e.length]);)n--;return e.start-n}function _rt(t,e){const n=e.start+e.length;let o=n;for(;t.length>o&&Gye(t[o],t[o-e.length]);)o++;return o-n}function h4n(t,e){const n=e[0];let o=t.length-(n?mrt(t,n):0);for(const i of e)o-=_rt(t,i);return o}function p4n(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 m4n=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){const o=nA(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 Nte(e,"DOMException")}isDOMError(e){return Nte(e,"DOMError")}},_4n=class{match(e){return xk(e)}coerce(e,n){var o;const i=this.getStack(e),r=i===void 0?(o=n.syntheticException)===null||o===void 0?void 0:o.stack:void 0,s=!!r;return{type:this.getType(e),value:this.getMessage(e,n),stack:i??r,cause:e.cause?n.next(e.cause):void 0,synthetic:s}}getType(e){return e.name||e.constructor.name}getMessage(e,n){const o=e.message;return String(o.error&&typeof o.error.message=="string"?o.error.message:o)}getStack(e){try{const n=e.stacktrace;if(typeof n=="string"&&n.length>0)return n;const o=e.stack;return typeof o=="string"&&o.length>0?o:void 0}catch{return}}},f4n=class{match(e){return!!Nte(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 nA(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(nA(i.filename)&&i.filename.length!==0&&r!==0)return`Error
|
|
240
|
-
at ${i.filename}:${r}:${s}`}};const I4n=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var C4n=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(I4n);return i&&(n=i[1],o=i[2]),[n,o]}};const y4n=["fatal","error","warning","log","info","debug"];function frt(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 x4n=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(vye(e))return e.constructor.name;const n="name"in e?e.name:void 0;return nA(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: ${frt(e)}`}isSeverityLevel(e){return nA(e)&&!GK(e)&&y4n.indexOf(e)>=0}getStack(e){try{return nA(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:nA(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const n in e)if({}.hasOwnProperty.call(e,n)){const o=e[n];if(xk(o))return o}}getObjectClassName(e){try{const n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}},E4n=class{match(e){return vye(e)}coerce(e,n){var o;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${frt(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},B4n=class{match(e){return Eit(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}}},b4n=class{match(e){return Nte(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!vye(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 Eit(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 Kte="$message",Vte="$timestamp",S4n=new Set([Kte,Vte]),Yye={enabled:!0,max_bytes:32768};function zte(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:Yye.enabled,max_bytes:v4n(t.max_bytes,Yye.max_bytes)}:sn({},Yye)}var Q4n=class{constructor(e){this.ns=[],this.ss=0,this.Rr=zte(e)}setConfig(e){this.Rr=zte(e),this.rs()}add(e){const n=(function(i){let r;try{r=yit(i)}catch{return}try{const s=JSON.parse(r);if(!xA(s))return;const a=s,A=a[Kte],c=a[Vte];return!nA(A)||A.trim().length===0||!nA(c)&&!jd(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 v4n(t,e){if(!jd(t)||t===1/0||t===-1/0)return e;const n=Math.floor(t);return 0>n?e:n}const Irt=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function Crt(t){return typeof t=="string"||t}function yrt(t){return typeof t=="string"?t:void 0}const P4n=["$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"],xrt="NativeGzipValidationError",Uye=t=>t.length>=2&&t[0]===31&&t[1]===139,Ert=(t,e)=>t===bye.GZipJS||e===bye.GZipJS||e==="gzip",Brt=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError";let VK;const Jte=t=>{throw art(xrt,`Native gzip produced invalid output: ${t}`)},w4n=(brt=jg(function*(t,e){18>t.size&&Jte("too-short");const n=new Uint8Array(yield t.slice(0,10).arrayBuffer());Uye(n)&&n[2]===8||Jte("invalid-header");const o=new DataView(yield t.slice(t.size-8).arrayBuffer());o.getUint32(0,!0)!==(r=>{const s=(()=>{if(VK)return VK;VK=[];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;VK[A]=c>>>0}return VK})();let a=4294967295;for(let A=0;r.length>A;A++)a=s[255&(a^r[A])]^a>>>8;return(4294967295^a)>>>0})(e)&&Jte("invalid-crc");const i=e.length>>>0;o.getUint32(4,!0)!==i&&Jte("invalid-size")}),function(t,e){return brt.apply(this,arguments)});var brt;function Kye(){return Kye=jg(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=jg(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 w4n(c,i),c}catch(i){if(n?.rethrow)throw i;return e&&console.error("Failed to gzip compress data",i),null}var o}),Kye.apply(this,arguments)}function Srt(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 M4n={}.propertyIsEnumerable;function Wte(t,e){try{return Qrt(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function Vye(t,e,n,o){if(0>=n.remainingNodes)return{stringValue:Lye};if(n.remainingNodes--,hy(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:Bk(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:Lye};if(t instanceof Date){const i=t.getTime(),r=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:typeof r=="string"?Bk(r):String(r)}}n.ancestors.add(t);try{try{const i=t.toJSON;if(typeof i=="function")return Vye(i.call(t),e,n,o+1)}catch{}return as(t)?{arrayValue:{values:D4n(t,e,n,o+1)}}:{kvlistValue:{values:Qrt(t,e,n,o+1)}}}finally{n.ancestors.delete(t)}}return{stringValue:Bk(String(t))}}function D4n(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(Us(a))continue;i.push(Vye(a,e,n,o))}catch{i.push({stringValue:UK})}return t.length>s&&i.push({stringValue:Lye}),i}function Qrt(t,e,n,o){const i=[];for(const r in t)if(M4n.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(ad(s)||Bo(s))continue;i.push({key:Bk(r),value:Vye(s,e,n,o)})}catch{i.push({key:Bk(r),value:{stringValue:UK}})}}return i}function vrt(t,e,n){return sn(sn(sn(sn({},irt({},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 N4n=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function Prt(t,e){const n=irt({},t),o={};for(const i of N4n)({}).hasOwnProperty.call(n,i)&&(o[i]=n[i],delete n[i]);return[...Wte(n,e),...Wte(o,e)]}const wrt={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"},Mrt={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}},R4n=Mrt.info;function T4n(t){try{return Bk(String(t))}catch{return UK}}function k4n(t,e,n,o){const i=t.level||"info",{text:r,number:s}=Mrt[i]||R4n,a=(function(u=Date.now()){return String(u)+"000000"})(jd(o)?o:void 0),A={};e.distinctId&&(A.posthogDistinctId=e.distinctId),e.sessionId&&(A.sessionId=e.sessionId),e.windowId&&(A["window.id"]=e.windowId),Us(e.sessionStartTimestamp)||(A.sessionStartTimestamp=String(e.sessionStartTimestamp)),Us(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=UK}Object.defineProperty(c,h,{value:d,enumerable:!0,writable:!0,configurable:!0})}}const g={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:s,severityText:r,body:{stringValue:T4n(t.body)},attributes:Wte(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 Drt(t,e,n){return vrt(t,e,n)}function Nrt(t,e,n,o){return{resourceLogs:[{resource:{attributes:Prt(e)},scopeLogs:[{scope:{name:n,version:o},logRecords:t}]}]}}var Rrt=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=crt(()=>{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 Trt(){return .75+.5*Math.random()}function krt(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 F4n=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 Rrt(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new rrt,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(y9.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:k4n(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=as(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 jg(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return jg(function*(){var n;e.ps.clear();let o=(n=e._instance.getPersistedProperty(y9.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=Nrt(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(y9.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,u.kind==="fatal"))throw u.error}})()}Bs(e){var n=this;return jg(function*(){var o;const i=Math.max(0,e-n.bs),r=(o=n._instance.getPersistedProperty(y9.LogsQueue))!==null&&o!==void 0?o:[];n._instance.setPersistedProperty(y9.LogsQueue,r.slice(i)),yield n.vs()})()}qs(){return Drt(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var n;if(this._instance.optedOut)return;const o=(n=this._instance.getPersistedProperty(y9.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(y9.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(krt(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(y9.LogsQueue);return!!e&&e.length>0}shutdown(e){var n=this;return jg(function*(){n.ps.clear();const o=n.flush().catch(()=>{});e!==void 0?yield lrt(o,e):yield o})()}flushWithTimeout(e){var n=this;return jg(function*(){const o=n.flush();yield lrt(o,e,()=>{o.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=Trt(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const zye=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Frt(t){return String(t)+"000000"}function Lrt(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 L4n=class{constructor(e,n,o){this._instance=e,this.Rr=n,this.$=o,this.zs=new Map,this.ps=new Rrt(()=>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 rrt,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=jg(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=Lrt(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(zye.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,zye)]+=1;break}}}Os(e){const n=this.Rr.beforeSend;if(!n)return e;const o=as(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(krt(this.Rr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return jg(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=Trt()):(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 vrt(s,a,A)})(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Prt(o)},scopeMetrics:[{scope:{name:i,version:r},metrics:n}]}]};var n,o,i,r}vo(e){const n=Frt(Date.now()),o=new Map;for(const a of e.values()){var i;const A=Lrt(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=Wte((i=a.attributes)!==null&&i!==void 0?i:{},this.$),g=Frt(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:zye})}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 Hrt=(t,{debugEnabled:e}={})=>{const n={N(o,...i){Ln&&(_8.DEBUG||Ln.POSTHOG_DEBUG||e)&&!Bo(Ln.console)&&Ln.console&&("__rrweb_original__"in Ln.console[o]?Ln.console[o].__rrweb_original__:Ln.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)=>Hrt(`${t} ${o}`,i)};return n},gi=Hrt("[PostHog.js]"),Ad=gi.createLogger,H4n=Ad("[ExternalScriptsLoader]"),jte=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]}},PM=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return H4n.warn(`${e} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const o=jte(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(jte(e))return PM(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)},Jye={},Ort=(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)};Ur.__PosthogExtensions__=Ur.__PosthogExtensions__||{},Ur.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e==="remote-config"){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void PM(t,i,n)}const o=t.config.strict_script_versioning;if(o){const i=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=Jye[i];if(o==="fallback"&&r){if(jte(r))return void PM(t,r,n);delete Jye[i]}return void PM(t,i,o==="fallback"?(s,a)=>{if(s)if(typeof s=="string")n(s);else{var A;const c=Ort(t,e);Jye[i]=c;const l=jte(i);l==null||(A=l.parentNode)===null||A===void 0||A.removeChild(l),PM(t,c,n)}else n(void 0,a)}:n)}PM(t,Ort(t,e),n)},Ur.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{const o=t.requestRouter.endpointFor("api",e);PM(t,o,n)},_8.DEBUG=!1,_8.LIB_VERSION="1.434.15",_8.LIB_NAME="web";var Ym=_8;const O4n="$people_distinct_id",R4="distinct_id",Wye="$device_id",jye="$device_model",Xte="__alias",G4n="__cmpns",Grt="$fbc",bk="$fbc_persistence",Yrt="$fbp",zK="$fbp_persistence",Xye="__timers",Urt="$autocapture_disabled_server_side",qye="$heatmaps_enabled_server_side",$ye="$exception_capture_enabled_server_side",Krt="$error_tracking_suppression_rules",Zye="$error_tracking_capture_extension_exceptions",e2e="$web_vitals_enabled_server_side",t2e="$dead_clicks_enabled_server_side",n2e="$product_tours_enabled_server_side",Vrt="$logs_capture_enabled_server_side",zrt="$web_vitals_allowed_metrics",JK="$session_recording_remote_config",Y4n="$session_recording_enabled_server_side",U4n="$replay_sample_rate",K4n="$replay_override_sampling",V4n="$replay_override_linked_flag",z4n="$replay_override_url_trigger",J4n="$replay_override_event_trigger",Sk="$sesid",Jrt="$session_is_sampled",W4n="$session_past_minimum_duration",j4n="$session_recording_url_trigger_activated_session",X4n="$session_recording_event_trigger_activated_session",q4n="$debug_first_full_snapshot_timestamp",$4n="$sess_rec_flush_size",T4="$enabled_feature_flags",I8="$active_feature_flags",o2e="$early_access_features",wM="$feature_flag_details",rQ="$feature_flag_payloads",MM="$feature_flag_request_id",WK="$minimal_flag_called_events",E9="$override_feature_flags",DM="$override_feature_flag_payloads",sQ="$stored_person_properties",aQ="$stored_group_properties",Wrt="$groups",i2e="$surveys",qte="$surveys_loaded_at",jrt="$surveys_activated",Xrt="$surveys_activated_session",qrt="$surveys_activated_timestamps",r2e="ph_product_tours",Z4n="$product_tours_activated",eBn="$product_tours_activated_session",tBn="$conversations_widget_session_id",nBn="$conversations_ticket_id",oBn="$conversations_widget_state",iBn="$conversations_user_traits",AQ="$flag_call_reported",jK="$flag_call_reported_session_id",XK="$feature_flag_errors",cQ="$feature_flag_evaluated_at",py="$user_state",s2e="$client_session_props",rBn="$capture_rate_limit",$rt="$initial_campaign_params",Zrt="$initial_referrer_info",Qk="$initial_person_info",a2e="$epp",A2e="$posthog_cookieless",est="$cookieless_mode",tst="$sdk_debug_extensions_init_method",nst="$sdk_debug_extensions_init_time_ms",ost="$sdk_debug_recording_script_not_loaded",ist="$sdk_debug_replay_stale_config",sBn="$sdk_debug_replay_event_trigger_status",aBn="$sdk_debug_replay_linked_flag_trigger_status",ABn="$sdk_debug_replay_matched_recording_trigger_groups",cBn="$sdk_debug_replay_pending_trigger_conditions",lBn="$sdk_debug_replay_remote_trigger_matching_config",gBn="$sdk_debug_replay_trigger_groups_count",uBn="$sdk_debug_replay_url_trigger_status",dBn="$session_recording_start_reason",c2e="PostHog loadExternalDependency extension not found.",C8="anonymous",$te="identified",rst="identified_only",qK="visibilitychange",Zte="beforeunload",l2e="$pageview",sst="$pageleave",ast="$identify",Ast="$groupidentify";function vk(t,e){as(t)&&t.forEach(e)}function Ql(t,e){if(!Us(t))if(as(t))t.forEach(e);else if((n=>n instanceof FormData)(t))t.forEach((n,o)=>e(n,o));else for(const n in t)Qye.call(t,n)&&e(t[n],n)}const Bg=function(t,...e){for(const n of e)for(const o in n)n[o]!==void 0&&(t[o]=n[o]);return t};function ene(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 hBn=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)}}},g2e=function(t){const e={};return Ql(t,function(n,o){(nA(n)&&n.length>0||jd(n))&&(e[o]=n)}),e};function cst(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 pBn=["herokuapp.com","vercel.app","netlify.app"];function mBn(t){const e=t?.hostname;if(!nA(e))return!1;const n=e.split(".").slice(-2).join(".");for(const o of pBn)if(n===o)return!1;return!0}function ml(t,e,n,o){const{capture:i=!1,passive:r=!0}=o??{};t?.addEventListener(e,n,{capture:i,passive:r})}function u2e(t){return t.name==="ph_toolbar_internal"}const $K=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 jd(t)&&isFinite(t)&&Math.floor(t)===t});var _Bn=class Knt{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 Knt(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 Knt(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}},fBn=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 jd(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 _Bn.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 IBn}};let lst=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};Ln&&!Bo(Ln.crypto)&&crypto.getRandomValues&&(lst=t=>crypto.getRandomValues(t));var IBn=class{nextUint32(){return this.Rt.length>this.$t||(lst(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let gst;const k4=()=>CBn().toString(),CBn=()=>(gst||(gst=new fBn)).generate();let ZK="";const yBn=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Pk=null;const cd={Et(){if(!ad(Pk))return Pk;if(Pk=!1,No)try{const t=`__ph_cookie_support_${k4()}`;cd.At(t,"xyz"),Pk=$K(t)==='"xyz"',cd.Lt(t)}catch{Pk=!1}return Pk},Pt(t){gi.error("cookieStore error: "+t)},Ot:$K,Dt(t){let e;try{e=JSON.parse(cd.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(ZK)return ZK;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_"+k4();for(;!ZK&&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",ZK=_)}return ZK})(c);if(!g){const u=(h=>{const d=h.match(yBn);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||!ad($K(t))))try{cd.At(t,"",-1,e)}catch{return}}};let d2e=null;const uc={Et(){if(!ad(d2e))return d2e;let t=!0;if(Bo(Ln))t=!1;else try{const e="__mplssupport__";uc.At(e,"xyz"),uc.Ot(e)!=='"xyz"'&&(t=!1),uc.Lt(e)}catch{t=!1}return t||gi.error("localStorage unsupported; falling back to cookie store"),d2e=t,t},Pt(t){gi.error("localStorage error: "+t)},Ot(t){try{return Ln?.localStorage.getItem(t)}catch(e){uc.Pt(e)}return null},Dt(t){try{return JSON.parse(uc.Ot(t))||{}}catch{}return null},At(t,e){try{return Ln?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){uc.Pt(n)}return!1},Lt(t){try{Ln?.localStorage.removeItem(t)}catch(e){uc.Pt(e)}}},h2e=[sQ,I8,T4,wM,rQ,MM,cQ,XK,AQ],NM=[Wye,R4,Sk,Jrt,a2e,Qk,bk,py],tne=t=>t+"_cpm",xBn=["__proto__","constructor","prototype"],p2e=t=>{if(!xA(t))return{};const e={};return Object.keys(t).forEach(n=>{xBn.indexOf(n)===-1&&(e[n]=t[n])}),e},m2e=(t,e=[])=>{const n={};return[...NM,...e].forEach(o=>{const i=t[o];Bo(i)||ad(i)||i===""||(n[o]=i)}),n},ust=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)},dst=(t,e)=>({p:e,f:ust(JSON.stringify(t))}),hst=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const n=cd.Dt(tne(t)),o=n?.f===ust(e)&&as(n.p);return{properties:o?n.p:[],isValid:o}}catch{return{properties:[],isValid:!1}}},_2e=(t,e)=>e+"|"+(cd.Ot(tne(t))||""),wk={},f2e={Et:()=>!0,Pt(t){gi.error("memoryStorage error: "+t)},Ot:t=>t in wk?wk[t]:null,Dt:t=>t in wk?wk[t]:null,At:(t,e)=>(wk[t]=e,!0),Lt(t){delete wk[t]}};let RM=null;const Z0={Et(){if(!ad(RM))return RM;if(RM=!0,Bo(Ln))RM=!1;else try{const t="__support__";Z0.At(t,"xyz"),Z0.Ot(t)!=='"xyz"'&&(RM=!1),Z0.Lt(t)}catch{RM=!1}return RM},Pt(t){gi.error("sessionStorage error: ",t)},Ot(t){try{return Ln?.sessionStorage.getItem(t)}catch(e){Z0.Pt(e)}return null},Dt(t){try{return JSON.parse(Z0.Ot(t))||null}catch{}return null},At(t,e){try{return Ln?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){Z0.Pt(n)}return!1},Lt(t){try{Ln?.sessionStorage.removeItem(t)}catch(e){Z0.Pt(e)}}};var EBn=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 Pye(e)?1:fs(G5n,e)?0:-1}get qo(){const e=this.Rr.opt_out_capturing_persistence_type,n=e==="localStorage"?uc:cd,o=n.Et()?n:f2e;if(!this.Bo||this.Bo!==o){this.Bo=o;const i=e==="localStorage"?cd:uc;i.Ot(this.jo)&&(this.Bo.Ot(this.jo)||this.optInOut(Pye(i.Ot(this.jo))),i.Lt(this.jo,this.Rr.cross_subdomain_cookie))}return this.Bo}Lo(){return!!this.Rr.respect_dnt&&[F_?.doNotTrack,F_?.msDoNotTrack,Ur.doNotTrack,F_?.globalPrivacyControl].some(e=>Pye(e))}};function pst(t,e){var n;const o=t==null||(n=t.config)===null||n===void 0?void 0:n.get_current_url;if(!L_(o))return e;try{const i=o(e);return nA(i)&&i?i:e}catch(i){return gi.error("Error in get_current_url, falling back to window.location.href",i),e}}function mst(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 B9(t){return!!t&&t.nodeType===1}function j1(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function _st(t){return!!t&&t.nodeType===3}function I2e(t){return!!t&&t.nodeType===11&&B9(t.host)}function C2e(t){return t?Mte(t).split(/\s+/):[]}function fst(t,e){const n=(function(o){var i;const r=Ln==null||(i=Ln.location)===null||i===void 0?void 0:i.href;return Bo(r)?void 0:pst(o,r)})(e);return!!(n&&t&&t.some(o=>n.match(o)))}function Mk(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 C2e(e)}function Ist(t){return Us(t)?null:Mte(t).split(/(\s+)/).filter(e=>oV(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function eV(t){let e="";return Dk(t)&&!nV(t)&&t.childNodes&&t.childNodes.length&&Ql(t.childNodes,function(n){var o;_st(n)&&n.textContent&&(e+=(o=Ist(n.textContent))!==null&&o!==void 0?o:"")}),Mte(e)}function tV(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 y2e=["a","button","form","input","select","textarea","label"];function x2e(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 E2e(t,e){if(Bo(e))return!0;for(const n of t)if(e.some(o=>x2e(n,o)))return!0;return!1}function Cst(t){const e=t.parentNode;return!(!e||!B9(e))&&e}const B2e=[".ph-no-autocapture","[data-ph-no-autocapture]"],yst=["next","previous","prev",">","<"],BBn=[...yst,"+","-","−","–"],xst=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Est=[".ph-no-rageclick",".ph-no-capture"],bBn=["","text","search","email","password","url","tel","number"];function Bst(t,e){if(!Ln||b2e(t))return!1;let n,o,i;var r,s;if(hy(e)?(n=!!e&&Est,o=void 0,i=!1):(n=(r=e?.css_selector_ignorelist)!==null&&r!==void 0?r:Est,o=e?.content_ignorelist,i=(s=e?.ignore_text_selection)!==null&&s!==void 0&&s),n===!1||i&&(function(A){return!(!A||!B9(A))&&(!!j1(A,"textarea")||(j1(A,"input")?fs(bBn,(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}=bst(t,!1);return!(function(A,c){if(A===!1||Bo(A))return!1;let l;if(A===!0)l=yst;else{if(!as(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=>xst(g,h)||xst(u,h)))})(o,a.map(A=>{var c;return{safeText:eV(A).toLowerCase(),ariaLabel:((c=A.getAttribute("aria-label"))===null||c===void 0?void 0:c.toLowerCase().trim())||""}}))&&!E2e(a,n)}const b2e=t=>!t||j1(t,"html")||!B9(t),bst=(t,e)=>{if(!Ln||b2e(t))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const o=[t];let i=t;for(;i.parentNode&&!j1(i,"body");){if(I2e(i.parentNode)){o.push(i.parentNode.host),i=i.parentNode.host;continue}const r=Cst(i);if(!r)break;if(e||y2e.indexOf(r.tagName.toLowerCase())>-1)n=!0;else try{const s=Ln.getComputedStyle(r);s&&s.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}o.push(r),i=r}return{parentIsUsefulElement:n,targetElementList:o}};function Dk(t){const e=new Set;let n=0;for(let r=t;r.parentNode&&!j1(r,"body");r=r.parentNode){if(n++>=1e3||e.has(r))return!1;e.add(r);const s=Mk(r);if(fs(s,"ph-sensitive")||fs(s,"ph-no-capture"))return!1}if(fs(Mk(t),"ph-include"))return!0;const o=t.type||"";if(nA(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}const i=t.name||t.id||"";return!nA(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 nV(t){return!!(j1(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||j1(t,"select")||j1(t,"textarea")||t.getAttribute("contenteditable")==="true")}const Sst=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}))$"),Qst=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,SBn=[16,15,14,13],QBn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),vst=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Pst=/[0-9A-Za-z_]/;function vBn(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 oV(t,e=!0){return!(Us(t)||nA(t)&&(t=Mte(t),(e?Sst.test((t||"").replace(/[- ]/g,"")):(function(n){let o;for(Qst.lastIndex=0;o=Qst.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 SBn){const A=s+a;if(r.length>=A){const c=r.slice(s,A);if(Sst.test(c)&&vBn(c))return!0}}}return!1})(t))||(e?QBn.test(t):(function(n){let o;for(vst.lastIndex=0;o=vst.exec(n);){const i=o[1],r=o[3];if(!(i&&r&&Pst.test(i)&&Pst.test(r)))return!0}return!1})(t))))}function wst(t){let e=eV(t);return e=`${e} ${Mst(t)}`.trim(),oV(e)?e:""}function Mst(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Ql(t.childNodes,function(n){var o;if(n&&((o=n.tagName)===null||o===void 0?void 0:o.toLowerCase())==="span")try{const i=eV(n);e=`${e} ${i}`.trim(),n.childNodes&&n.childNodes.length&&(e=`${e} ${Mst(n)}`.trim())}catch(i){gi.error("[AutoCapture]",i)}}),e}function Dst(t){return t.replace(/"|\\"/g,'\\"')}function PBn(t){const e=t.attr__class;if(e)return as(e)?e:C2e(e)}const nne=Ad("[Dead Clicks]"),wBn=()=>!0,MBn=t=>{var e;const n=!!(!((e=t.instance.persistence)===null||e===void 0)&&e.get_property(t2e)),o=t.instance.config.capture_dead_clicks;return hy(o)?o:!!xA(o)||n};var Nst=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({[t2e]:n.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Uo()}):this.stop()}zo(e){var n,o,i;!((n=Ur.__PosthogExtensions__)===null||n===void 0)&&n.initDeadClicksAutocapture?e():(o=Ur.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this.instance,"dead-clicks-autocapture",r=>{r?nne.error("failed to load script",r):e()})}Uo(){var e;if(No){if(!this.Ho&&(!((e=Ur.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const n=xA(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=Ur.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Ho.start(No),nne.info("starting...")}}else nne.error("`document` not found. Cannot start.")}stop(){this.Ho&&(this.Ho.stop(),this.Ho=void 0,nne.info("stopping..."))}};const iV=Ad("[SegmentIntegration]");function Rst(t,e,n=!0){const o=t.config.segment;if(!o)return e();const{analytics:i,filterProperties:r}=(a=>L_(a.register))(s=o)?{analytics:s}:s;var s;(function(a,A,c,l){const g=h=>{const d=()=>h.anonymousId()||k4();a.config.get_device_id=d,l&&h.id()&&(a.register({distinct_id:h.id(),$device_id:d()}),a.persistence.set_property(py,$te)),c(l?void 0:h.anonymousId()||void 0)},u=A.user();"then"in u&&L_(u.then)?u.then(g):g(u)})(t,i,a=>{i.register(((A,c,{filterProperties:l}={})=>{typeof Promise<"u"&&Promise.resolve||iV.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()||(iV.info("No userId set, resetting PostHog"),A.reset()),d||(c=void 0),u.event.userId&&u.event.userId!==A.get_distinct_id()&&(iV.info("UserId set, identifying with PostHog"),A.identify(u.event.userId));let p=A.calculateEventProperties(h,u.event.properties);if(!Us(l)){const m=u.event.properties||{},_={};for(const I of Object.keys(p))Qye.call(m,I)||(_[I]=p[I]);const f=((I,C)=>{const y=as(I)?I:[I];let x=sn({},C);for(const E of y)try{if(x=E(x),Us(x))return null}catch(B){return iV.error("Error in Segment filterProperties:",B),null}return x})(l,_);if(Us(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,l2e)},identify(u){return g(u,ast)},screen(u){return g(u,"$screen")}}})(t,a,{filterProperties:r})).then(()=>{e()},A=>{iV.error("Failed to register the Segment integration",A),e()})},n)}const Tst="posthog-js";function kst(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 DBn=class{constructor(e,n,o,i,r,s){this.name=Tst,this.setupOnce=function(a){a(kst(e,{organization:n,projectId:o,prefix:i,severityAllowList:r,sendExceptionsToPostHog:s==null||s}))}}},Fst=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=Ln?.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?x9(a/s,0,1,gi):1,h=s>1?x9(A/s,0,1,gi):1,d=c>1?x9(l/c,0,1,gi):1,p=c>1?x9(g/c,0,1,gi):1;i=Bg(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 rV=["flags","surveys"],NBn={[O4n]:{exposure:"hidden"},[Xte]:{exposure:"hidden"},[G4n]:{exposure:"hidden"},[Xye]:{exposure:"hidden"},[bk]:{exposure:"hidden"},[zK]:{exposure:"hidden"},[Urt]:{exposure:"event"},[qye]:{exposure:"hidden"},[Vrt]:{exposure:"hidden"},[$ye]:{exposure:"event"},[Krt]:{exposure:"hidden"},[Zye]:{exposure:"event"},[e2e]:{exposure:"event"},[t2e]:{exposure:"event"},[n2e]:{exposure:"hidden"},[zrt]:{exposure:"event"},[JK]:{exposure:"hidden"},[Y4n]:{exposure:"hidden"},[Sk]:{exposure:"hidden"},[Jrt]:{exposure:"event"},[U4n]:{exposure:"event",shouldSkipFromEventProperties:t=>ad(t)},[W4n]:{exposure:"event"},[j4n]:{exposure:"event"},[X4n]:{exposure:"event"},[q4n]:{exposure:"event"},[$4n]:{exposure:"hidden"},[T4]:{exposure:"hidden",storageGroup:"flags"},[I8]:{exposure:"hidden",storageGroup:"flags"},[o2e]:{exposure:"hidden"},[wM]:{exposure:"hidden",storageGroup:"flags"},[rQ]:{exposure:"hidden",storageGroup:"flags"},[MM]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[WK]:{exposure:"hidden",storageGroup:"flags"},[E9]:{exposure:"hidden"},[DM]:{exposure:"hidden"},[sQ]:{exposure:"hidden"},[aQ]:{exposure:"hidden"},[i2e]:{exposure:"hidden",storageGroup:"surveys"},[qte]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[jrt]:{exposure:"event"},[Xrt]:{exposure:"hidden"},[qrt]:{exposure:"hidden"},[r2e]:{exposure:"hidden"},[Z4n]:{exposure:"hidden"},[eBn]:{exposure:"hidden"},[tBn]:{exposure:"event"},[nBn]:{exposure:"event"},[oBn]:{exposure:"event"},[iBn]:{exposure:"event"},[AQ]:{exposure:"hidden"},[jK]:{exposure:"hidden"},[Wrt]:{exposure:"event"},[XK]:{exposure:"hidden"},[cQ]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[py]:{exposure:"hidden"},[s2e]:{exposure:"hidden"},[rBn]:{exposure:"hidden"},[$rt]:{exposure:"hidden"},[Zrt]:{exposure:"hidden"},[Qk]:{exposure:"hidden"},[a2e]:{exposure:"hidden"},[K4n]:{exposure:"event"},[V4n]:{exposure:"event"},[z4n]:{exposure:"event"},[J4n]:{exposure:"event"},[tst]:{exposure:"event"},[nst]:{exposure:"event"},[ost]:{exposure:"event"},[ist]:{exposure:"event"},[sBn]:{exposure:"event"},[aBn]:{exposure:"event"},[ABn]:{exposure:"event"},[cBn]:{exposure:"event"},[lBn]:{exposure:"event"},[gBn]:{exposure:"event"},[uBn]:{exposure:"event"},[dBn]:{exposure:"event"}},RBn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Kf=t=>{const e=NBn[t];if(e)return e;for(const[n,o]of RBn)if(t.indexOf(n)===0)return o},Nk=(t,e)=>{try{let n;return JSON.stringify(t,(o,i)=>{var r;return xk(i)?((r=n)!==null&&r!==void 0||(n=new WeakMap),n.has(i)||n.set(i,cst(i)),n.get(i)):typeof i=="bigint"?i.toString():i},e)}catch{return yit(t)}},y8=t=>{const e=No?.createElement("a");return Bo(e)?null:(e.href=t,e)},Rk=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(!as(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," ")}},sV=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("=");as(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},one=function(t,e){const n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},Lst=(t,e)=>t>=e&&Cit(),Hst=(t,e,n,o)=>{if(t===0){if(Cit()){const i=e+1;return i===n&&o(),i}return e}return 0},Tk=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],TBn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Tk],aV="<masked>",kBn=["li_fat_id"];function Ost(t,e,n){if(!No)return{};const o=e?[...Tk,...n||[]]:[],i=Gst(sV(No.URL,o,aV),t),r=(function(){const s={};return Ql(kBn,function(a){const A=$K(a);s[a]=A||null}),s})();return Bg(r,i)}function Gst(t,e){const n=TBn.concat(e||[]),o={};return Ql(n,function(i){const r=Rk(t,i);o[i]=r||null}),o}function Yst(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(!ad(e)){o.$search_engine=e;const i=No?Rk(No.referrer,n):"";i.length&&(o.ph_keyword=i)}return o}function Ust(){return navigator.language||navigator.userLanguage}function FBn(){const t=Ust();return typeof t=="string"?t.split("-")[0]:void 0}const ine="$direct";function Kst(){return No?.referrer||ine}function Vst(t,e,n=!1){const o=t?[...Tk,...e||[]]:[],i=n?iQ(sd?.href):sd?.href,r=i?.substring(0,1e3);return{r:Kst().substring(0,1e3),u:r?sV(r,o,aV):void 0}}function zst(t,e=!1){var n;const{r:o,u:i}=t,r=e?iQ(i):i,s={$referrer:o,$referring_domain:o==null?void 0:o==ine?ine:(n=y8(o))===null||n===void 0?void 0:n.host};if(r){s.$current_url=r;const a=y8(r);s.$host=a?.host,s.$pathname=a?.pathname;const A=Gst(r);Bg(s,A)}if(o){const a=Yst(o);Bg(s,a)}return s}function Jst(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function LBn(){try{return new Date().getTimezoneOffset()}catch{return}}const HBn={flags:cQ,surveys:qte},OBn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],rne=t=>`${t}_cookie_identity_change_pending`,sne=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},Um="main",x8=[T4,I8,wM,rQ,MM,cQ,WK,sQ],S2e=t=>x8.indexOf(t)!==-1,Wst=[bk,zK],jst=t=>Wst.indexOf(t)!==-1,lQ=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch{return t===e}},kk=t=>{if(!t)return{};const e=JSON.parse(t);return xA(e)?e:{}},Xst=(t,e)=>{Ql(t,(n,o)=>{const i=Kf(o);i&&i.exposure!=="event"||{}.hasOwnProperty.call(e,o)||delete t[o]})};var Q2e=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(),Ln){const i=()=>this.flush();ml(Ln,"beforeunload",i,{capture:!1}),ml(Ln,"pagehide",i,{capture:!1}),this.fa=r=>{if(this.Ko&&(!r.storageArea||r.storageArea===Ln?.localStorage)&&r.key)if(r.key!==this.ha){if(this.Yo){const s=rV.find(a=>r.key===this.pa(a));s&&this.ga(r.key,s)}}else this.ga(r.key,Um)},ml(Ln,"storage",this.fa)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([n,o])=>{const i=this.ia.get(n);if(!S2e(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&&Ln&&(Ln.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=uc.Ot(e),ad(r)){const A=this.ya(n);return A.storageValue=null,n!==Um&&(A.persisted=!1),!1}i=kk(r)}catch{return!1}const s=n===Um?i:uc.Dt(this.ha);if(s&&this.ba(s))return!1;const a=this._a(i,n,o);return n===Um&&this.Yo&&!lQ(this.wa().main,i)||this.ka(i,n,!0,r),a}ba(e){const n=this.props[R4],o=e[R4];return!Bo(n)&&!Bo(o)&&n!==o}ka(e,n,o,i){const r=this.ya(n);r.storageValue=i,n!==Um&&(r.persisted=o);try{r.fingerprint=this.Sa(e,n)}catch{r.fingerprint=void 0}}_a(e,n,o){let i=!1;return x8.forEach(r=>{var s;const a=(s=Kf(r))===null||s===void 0?void 0:s.storageGroup;if(n===Um&&this.Yo&&a||n!==Um&&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&&lQ(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=uc.Ot(this.ha),n=this.ya(Um);let o,i=!1,r=!1;if(e!==n.storageValue)if(ad(e))n.storageValue=null;else{if(o=kk(e),this.ra=!this.sa&&this.ba(o),this.ra)return!1;r=this._a(o,Um,!1),!this.Yo||lQ(this.wa().main,o)?this.ka(o,Um,!0,e):n.storageValue=e,i=!0}return this.Yo&&rV.forEach(s=>{const a=uc.Ot(this.pa(s)),A=this.ya(s),c=o||{},l=i&&x8.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(ad(a))return A.storageValue=null,A.persisted=!1,void(l&&(r=this._a(c,s,!1)||r));const g=kk(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)||Um).fingerprint=void 0,this.Ia(e))}Ma(){x8.forEach(e=>this.ia.set(e,!0))}va(){if(this.Ko)try{const e=uc.Ot(this.ha),n=kk(e);this.ya(Um).storageValue=e,x8.forEach(o=>{var i;const r=this.Yo?(i=Kf(o))===null||i===void 0?void 0:i.storageGroup:void 0,s=r?uc.Ot(this.pa(r)):null;if(r){const A=this.ya(r);A.storageValue=s,A.persisted=!ad(s)}const a=r&&!ad(s)?kk(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(as(n)?n:[]),a=new Set(as(this.props[e])?this.props[e]:[]);return o.forEach(A=>a.has(A)?s.add(A):s.delete(A)),Array.from(s)}const i=xA(n)?sn({},n):{},r=xA(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(!S2e(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=kk(uc.Ot(c))[e]}catch{}const a=new Set(i||[]);if(e==="$active_feature_flags"){if(!Bo(n)&&!as(n)||!Bo(r)&&!as(r)||!as(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(!xA(o))return void(lQ(r,o)?this.ia.delete(e):this.ma(e,!0));{if(!Bo(n)&&!xA(n)||Bo(n)&&nx(o)&&Bo(r))return void this.ma(e,!0);const A=xA(n)?n:{},c=xA(r)?r:{};new Set([...Object.keys(A),...Object.keys(o)]).forEach(l=>{l in A==l in o&&lQ(A[l],o[l])||a.add(l)}),a.forEach(l=>{l in c==l in o&&lQ(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 jd(n)&&n>0?n:0}Ra(e){if(this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const n=m2e(e,this.Rr.cookie_persisted_properties||[]),o=dst(n,this.Rr.cookie_persisted_properties||[]),i=JSON.stringify(n)+"|"+JSON.stringify(o),r=cd.Ot(this.ha)||void 0;r&&_2e(this.ha,r)===i&&(this.Aa=i,this.Fa=r)}catch{}else try{const n=cd.Ot(this.ha)||void 0;this.Aa=n?_2e(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=cd.Ot(this.ha)||void 0}catch{}if(!o||o===this.Fa)return!1;const i=_2e(this.ha,o);let r;try{r=p2e(JSON.parse(o))}catch{return!1}if((cd.Ot(this.ha)||void 0)!==o)return!1;this.Aa=i,this.Fa=o;const s=hst(this.ha,o),a=[...NM,...s.properties],A={};if(Object.keys(r).forEach(m=>{const _=r[m];(Bo(_)||ad(_)||_===""||m==="$user_state"&&_!=="anonymous"&&_!=="identified")&&(A[m]=!0,delete r[m])}),nx(r))return!1;const c="distinct_id"in r||r.$user_state==="anonymous"||r.$user_state==="identified",l=this.props,g=l[R4],u=l[py],h=Bg({},l);[...NM,...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||NM.indexOf(m)===-1||_!==!1&&_!==0)&&delete h[m]}}),this.props=Bg(h,r),x8.forEach(m=>{const _=m in this.props;m in l===_&&lQ(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(py,C8);const d=this.props[R4],p=this.props[py];return!c||d===g&&p===u||(this.sa=!0,this.ta=!0,Z0.At(rne(this.ha),!0),this.$a(sQ),this.$a(I8),this.$a(T4),this.$a(wM),this.$a(rQ),this.$a(MM),this.$a(cQ),this.$a(XK),this.$a(AQ),p!=="anonymous"||u!=="identified"&&r.$user_state!=="anonymous"&&(Bo(g)||d===g)||(Xst(this.props,r),this.$a(aQ)),p==="identified"?this.props.$user_id=d:delete this.props.$user_id,this.$a(Xte)),!0}consumeCookieIdentityChange(){const e=rne(this.ha),n=this.ta||!!Z0.Ot(e);return this.ta=!1,n&&Z0.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[Um],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){OBn.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=[...NM,...a];return sn(sn({},uc),{},{Dt(l){try{let u,h={};try{u=cd.Ot(l)||void 0,h=u?p2e(JSON.parse(u)):{}}catch{}const d=JSON.parse(uc.Ot(l)||"{}");let p;if(A){const m=hst(l,u),_=[...NM,...m.properties],f={};Object.keys(h).forEach(C=>{const y=h[C];ad(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[R4],y=(g=d.$user_state)!==null&&g!==void 0?g:C8;c.forEach(x=>{if(_.indexOf(x)!==-1&&!(x in h)&&(I||x!=="distinct_id"&&x!=="$user_state")){const E=d[x];(m.isValid||NM.indexOf(x)===-1||E!==!1&&E!==0)&&delete d[x]}}),!I||"$user_state"in h||"$user_state"in d||(d[py]=C8),!I||("distinct_id"in f?f[R4]:d[R4])===C&&("$user_state"in f?f[py]:d[py])===y||(h2e.forEach(x=>delete d[x]),f.$user_state==="identified"&&"distinct_id"in f?d.$user_id=f[R4]:delete d.$user_id,f.$user_state!=="identified"&&(delete d[Wrt],delete d[aQ]),delete d.__alias)}p=Bg(d,f)}else p=Bg(h,d);return uc.At(l,p),p}catch{}return null},At(l,g,u,h,d,p){const m=uc.At(l,g,void 0,void 0,p);try{const _=m2e(g,a);if(Object.keys(_).length){if(A){const f=tne(l),I=dst(_,a);if(cd.At(f,I,u,h,d,p),cd.Ot(f)!==JSON.stringify(I)){cd.Lt(f,h);const C=m2e(g);return cd.At(l,C,u,h,d,p),m}}cd.At(l,_,u,h,d,p)}}catch(_){uc.Pt(_)}return m},Lt(l,g){try{Ln?.localStorage.removeItem(l),cd.Lt(l,g),cd.Lt(tne(l),g)}catch(u){uc.Pt(u)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let o,i=!1,r=!1;const s=e.persistence.toLowerCase();return s==="localstorage"&&uc.Et()?(o=uc,r=!0):s==="localstorage+cookie"&&n.Et()?(o=n,r=!0,i=!0):s==="sessionstorage"&&Z0.Et()?o=Z0:s==="memory"?o=f2e:s==="cookie"&&cd.Et()?(o=cd,i=!0):n.Et()?(o=n,r=!0,i=!0):cd.Et()?(o=cd,i=!0):o=f2e,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 Ql(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?uc.Dt(this.ha):null;let i={};if(n)try{i=p2e(cd.Dt(this.ha)),Ql(i,(A,c)=>{(Bo(A)||ad(A)||A==="")&&delete i[c]})}catch{}const r=this.qo.Dt(this.ha);if(r&&(this.props=Bg({},r)),this.Yo&&this.Ba(),n&&r){var s,a;const A=o?.[R4],c=(s=o?.$user_state)!==null&&s!==void 0?s:C8,l=r[R4],g=(a=r.$user_state)!==null&&a!==void 0?a:C8;if(l!==A||g!==c){this.ta=!0,Z0.At(rne(this.ha),!0);const u=Bg({},this.props);h2e.forEach(d=>delete u[d]),g!=="anonymous"||c!=="identified"&&i.$user_state!=="anonymous"&&(Bo(A)||l===A)||(Xst(u,i),delete u[aQ]),this.props=u;const h=new Set;h2e.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={};Ql(this.props,(m,_)=>{var f;((f=Kf(_))===null||f===void 0?void 0:f.storageGroup)===d&&(p[_]=m)}),nx(p)?(uc.Lt(this.pa(d)),this.Jo[d]={}):uc.At(this.pa(d),p)&&(this.Jo[d]={persisted:!0,fingerprint:this.Sa(p,d)})})}}Z0.Ot(rne(this.ha))&&(this.ta=!0)}Ba(){for(const e of rV){const n=uc.Dt(this.pa(e));if(n&&!nx(n)){const o=this.ya(e);o.persisted=!0,this.Ha(e)||(o.fingerprint=this.Sa(n,e)),this.za(e,n)||Bg(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=HBn[e];if(!o)return!1;const i=n[o],r=this.props[o];return jd(i)&&jd(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?uc.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"||Wst.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,Um);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,Um);o==="written"&&this.Ra(e),o!=="failed"&&(this.sa=!1,this.oa.clear(),x8.forEach(r=>{var s;!((s=Kf(r))===null||s===void 0)&&s.storageGroup||this.ia.delete(r)}));for(const r of rV){var i;const s=n[r];if(nx(s)&&!(!((i=this.Jo[r])===null||i===void 0)&&i.persisted)){x8.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(uc,this.pa(r),s,r);a!=="failed"&&x8.forEach(A=>{const c=Kf(A);c?.storageGroup!==r||a!=="written"&&c.volatile||this.ia.delete(A)})}}wa(){const e={},n={flags:{},surveys:{}};return Ql(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===Um)return JSON.stringify(e)+"|"+this.Va+"|"+this.Ga+"|"+this.Za;const o={};return Ql(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!==Um&&!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!==Um&&(r.persisted=!0),Bo(s)||(r.fingerprint=s),this.Ko&&(r.storageValue=uc.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 rV)uc.Lt(this.pa(n));e?delete this.Jo[Um]:this.Jo={},this.Aa=void 0,this.Fa=void 0}clear(){this.remove(),this.props={}}register_once(e,n,o){if(xA(e)){this.syncCookieProperties(),Bo(n)&&(n="None"),this.Va=Bo(o)?this.Qa:o;let i=!1;if(Ql(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(xA(e)){this.syncCookieProperties(),this.Va=Bo(n)?this.Qa:n;let o=!1;if(Ql(e,(i,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==i||xA(i)||as(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=Ost(this.Rr.custom_campaign_params,this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties),o=!nx(g2e(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?Yst(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:Kst(),$referring_domain:No?.referrer&&((e=y8(No.referrer))===null||e===void 0?void 0:e.host)||ine},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=Vst(this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties,this.Rr.disable_capture_url_hashes);this.register_once({[Qk]:this.Xo?{r:sne(e.r),u:e.u?sne(e.u):void 0}:e},void 0)}get_initial_props(){const e={};Ql([Zrt,$rt],o=>{const i=this.props[o];i&&Ql(i,function(r,s){e["$initial_"+Sye(s)]=r})});const n=this.props[Qk];if(n){const o=(function(i,r=!1){const s=zst(i,r),a={};return Ql(s,function(A,c){a[`$initial_${Sye(c)}`]=A}),a})(n,this.Rr.disable_capture_url_hashes);Bg(e,o)}return e}safe_merge(e){return Ql(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[Um],this.qa()))}finally{this.na=!1,h&&this.ja()}}Ja(){const e=this.props[Qk];if(!this.Xo||!xA(e)||typeof e.r!="string")return;const n=sne(e.r),o=typeof e.u=="string"?sne(e.u):e.u;n===e.r&&o===e.u||this.Ca(Qk,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(Xye,o),this.save()}remove_event_timer(e){const n=this.props.__timers||{},o=n[e];return Bo(o)||(delete n[e],this.Ca(Xye,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),jst(e)&&!lQ(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&&(S2e(e)&&this.ma(e,!0),jst(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 M3={GZipJS:"gzip-js",Base64:"base64"},AV={Activation:"events",Cancellation:"cancelEvents"},v2e={Popover:"popover",API:"api",Widget:"widget"},E8={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},P2e={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},w2e={Popover:"popover",Inline:"inline"};function ane(t){let e=!0;return{dispose(){if(e){e=!1;const n=t();n&&L_(n.then)&&n.then(void 0,()=>{})}}}}const GBn={SHOWN:"product tour shown"},qst={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},$st=Ad("[RateLimiter]");var YBn=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=>{$st.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void $st.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=(jd(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!as(n)||!n.includes(e)}Ya(){var e;if(this.Xa("$current_url")&&this.Xa("$pathname")&&sd?.pathname)return`${(e=sd.origin)!==null&&e!==void 0?e:""}${sd.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 gQ=Ad("[RemoteConfig]");var Zst=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Ur._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=Ur.__PosthogExtensions__)===null||n===void 0)&&n.loadExternalDependency?(o=Ur.__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 gQ.info("Using preloaded remote config",this.remoteConfig),void this.il(this.remoteConfig);if(this._instance.nl())return void gQ.warn("Remote config is disabled. Falling back to local config.");this.tl(e=>{if(!e)return gQ.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){gQ.error("Error loading remote config",e),this.il()}}il(e,n){!e&&n&&(n.statusCode===0?n.error||gQ.warn("Failed to fetch remote config from PostHog."):gQ.error("Failed to fetch remote config from PostHog."));try{this._instance.il(e?{ok:!0,config:e}:{ok:!1})}catch(i){gQ.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){gQ.error("Error loading feature flags",i)}}},d5=Uint8Array,ox=Uint16Array,Fk=Uint32Array,M2e=new d5([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]),D2e=new d5([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]),eat=new d5([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tat=function(t,e){for(var n=new ox(31),o=0;31>o;++o)n[o]=e+=1<<t[o-1];var i=new Fk(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]},nat=tat(M2e,2),N2e=nat[1];nat[0][28]=258,N2e[258]=28;for(var oat=tat(D2e,0)[1],iat=new ox(32768),ld=0;32768>ld;++ld){var Lk=(43690&ld)>>>1|(21845&ld)<<1;iat[ld]=((65280&(Lk=(61680&(Lk=(52428&Lk)>>>2|(13107&Lk)<<2))>>>4|(3855&Lk)<<4))>>>8|(255&Lk)<<8)>>>1}var cV=function(t,e,n){for(var o=t.length,i=0,r=new ox(e);o>i;++i)++r[t[i]-1];var s,a=new ox(e);for(i=0;e>i;++i)a[i]=a[i-1]+r[i-1]<<1;for(s=new ox(o),i=0;o>i;++i)s[i]=iat[a[t[i]-1]++]>>>15-t[i];return s},TM=new d5(288);for(ld=0;144>ld;++ld)TM[ld]=8;for(ld=144;256>ld;++ld)TM[ld]=9;for(ld=256;280>ld;++ld)TM[ld]=7;for(ld=280;288>ld;++ld)TM[ld]=8;var Ane=new d5(32);for(ld=0;32>ld;++ld)Ane[ld]=5;var UBn=cV(TM,9),KBn=cV(Ane,5),rat=function(t){return(t/8|0)+(7&t&&1)},sat=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var o=new(t instanceof ox?ox:t instanceof Fk?Fk:d5)(n-e);return o.set(t.subarray(e,n)),o},B8=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8},lV=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8,t[o+2]|=n>>>16},R2e=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 d5(0),0];if(i==1){var s=new d5(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 ox(u+1),d=T2e(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 d5(h),d]},T2e=function(t,e,n){return t.s==-1?Math.max(T2e(t.l,e,n+1),T2e(t.r,e,n+1)):e[t.s]=n},aat=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new ox(++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]},gV=function(t,e){for(var n=0,o=0;e.length>o;++o)n+=t[o]*e[o];return n},k2e=function(t,e,n){var o=n.length,i=rat(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)},Aat=function(t,e,n,o,i,r,s,a,A,c,l){B8(e,l++,n),++i[256];for(var g=R2e(i,15),u=g[0],h=g[1],d=R2e(r,15),p=d[0],m=d[1],_=aat(u),f=_[0],I=_[1],C=aat(p),y=C[0],x=C[1],E=new ox(19),B=0;f.length>B;++B)E[31&f[B]]++;for(B=0;y.length>B;++B)E[31&y[B]]++;for(var S=R2e(E,7),Q=S[0],P=S[1],M=19;M>4&&!Q[eat[M-1]];--M);var k,R,F,O,U=c+5<<3,Y=gV(i,TM)+gV(r,Ane)+s,J=gV(i,u)+gV(r,p)+s+14+3*M+gV(E,Q)+(2*E[16]+3*E[17]+7*E[18]);if(Y>=U&&J>=U)return k2e(e,l,t.subarray(A,A+c));if(B8(e,l,1+(Y>J)),l+=2,Y>J){k=cV(u,h),R=u,F=cV(p,m),O=p;var ee=cV(Q,P);for(B8(e,l,I-257),B8(e,l+5,x-1),B8(e,l+10,M-4),l+=14,B=0;M>B;++B)B8(e,l+3*B,Q[eat[B]]);l+=3*M;for(var W=[f,y],X=0;2>X;++X){var ie=W[X];for(B=0;ie.length>B;++B)B8(e,l,ee[se=31&ie[B]]),l+=Q[se],se>15&&(B8(e,l,ie[B]>>>5&127),l+=ie[B]>>>12)}}else k=UBn,R=TM,F=KBn,O=Ane;for(B=0;a>B;++B)if(o[B]>255){var se;lV(e,l,k[257+(se=o[B]>>>18&31)]),l+=R[se+257],se>7&&(B8(e,l,o[B]>>>23&31),l+=M2e[se]);var oe=31&o[B];lV(e,l,F[oe]),l+=O[oe],oe>3&&(lV(e,l,o[B]>>>5&8191),l+=D2e[oe])}else lV(e,l,k[o[B]]),l+=R[o[B]];return lV(e,l,k[256]),l+R[256]},VBn=new Fk([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),zBn=(function(){for(var t=new Fk(256),e=0;256>e;++e){for(var n=e,o=9;--o;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),F2e=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function JBn(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=zBn[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 d5(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=k2e(I,C,g.subarray(y,x)):(I[y]=m,C=k2e(I,C,g.subarray(y,_)))}else{for(var E=VBn[u-1],B=E>>>13,S=8191&E,Q=(1<<h)-1,P=new ox(32768),M=new ox(Q+1),k=Math.ceil(h/3),R=2*k,F=function(Ce){return(g[Ce]^g[Ce+1]<<k^g[Ce+2]<<R)&Q},O=new Fk(25e3),U=new ox(288),Y=new ox(32),J=0,ee=0,W=(y=0,0),X=0,ie=0;_>y;++y){var se=F(y),oe=32767&y,ge=M[se];if(P[oe]=ge,M[se]=oe,y>=X){var ue=_-y;if((J>7e3||W>24576)&&ue>423){C=Aat(g,I,0,O,U,Y,ee,W,ie,y-ie,C),W=J=ee=0,ie=y;for(var Ie=0;286>Ie;++Ie)U[Ie]=0;for(Ie=0;30>Ie;++Ie)Y[Ie]=0}var le=2,_e=0,he=S,ye=oe-ge&32767;if(ue>2&&se==F(y-ye))for(var Qe=Math.min(B,ue)-1,Pe=Math.min(32767,y),me=Math.min(258,ue);Pe>=ye&&--he&&oe!=ge;){if(g[y+le]==g[y+le-ye]){for(var ve=0;me>ve&&g[y+ve]==g[y+ve-ye];++ve);if(ve>le){if(le=ve,_e=ye,ve>Qe)break;var we=Math.min(ye,ve-2),Me=0;for(Ie=0;we>Ie;++Ie){var He=y-ye+Ie+32768&32767,ke=He-P[He]+32768&32767;ke>Me&&(Me=ke,ge=He)}}}ye+=(oe=ge)-(ge=P[oe])+32768&32767}if(_e){O[W++]=268435456|N2e[le]<<18|oat[_e];var be=31&N2e[le],Te=31&oat[_e];ee+=M2e[be]+D2e[Te],++U[257+be],++Y[Te],X=y+le,++J}else O[W++]=g[y],++U[g[y]]}}C=Aat(g,I,m,O,U,Y,ee,W,ie,y-ie,C)}return sat(f,0,d+rat(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&&F2e(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),F2e(c,l-8,n.d()),F2e(c,l-4,o),c}const WBn=!!Bye||!!HK,cat=new WeakMap,lat="text/plain";let L2e=0,cne=!1;const gat=(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}`:""}`},uV=(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 Ql(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},H2e=t=>{if(t.sl)return t.sl;const{data:e,compression:n}=t;if(!e)return;if(n===M3.GZipJS){const i=JBn((function(r){var s=r.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(r);for(var a=new d5(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 d5(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 sat(a,0,A)})(Nk(e)),{mtime:0});return{contentType:lat,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===M3.Base64){const i=(function(s){return s&&btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g,(a,A)=>String.fromCharCode(parseInt(A,16))))})(Nk(e)),r=(s=>"data="+encodeURIComponent(typeof s=="string"?s:Nk(s)))(i);return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}const o=Nk(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}},uat=t=>{const e=()=>t.transport==="sendBeacon"?{url:uV(t.url,{compression:M3.Base64}),encodedBody:H2e(sn(sn({},t),{},{compression:M3.Base64,sl:void 0}))}:{url:gat(t.url,"compression"),encodedBody:H2e(sn(sn({},t),{},{compression:void 0,sl:void 0}))};let n;try{n=H2e(t)}catch(i){if(Ert(t.compression,Rk(t.url,"compression")))return gi.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return n&&Ert(t.compression,Rk(t.url,"compression"))&&!((o=n.body)instanceof ArrayBuffer?Uye(new Uint8Array(o)):ArrayBuffer.isView(o)&&Uye(new Uint8Array(o.buffer,o.byteOffset,o.byteLength)))?(cne=!0,e()):{url:t.url,encodedBody:n};var o},dat=t=>{try{return uat(t)}catch(n){var e;return gi.error(n),void((e=t.callback)===null||e===void 0||e.call(t,{statusCode:0,error:n}))}},jBn=(function(){var t=jg(function*(e){const n=yield(function(i){return Kye.apply(this,arguments)})(Nk(e.data),Ym.DEBUG,{rethrow:!0});if(!n)return e;const o=yield n.arrayBuffer();return sn(sn({},e),{},{sl:{contentType:lat,body:o,estimatedSize:o.byteLength}})});return function(e){return t.apply(this,arguments)}})(),XBn=/Failed to fetch|NetworkError|Load failed/i,hat=t=>t?.name==="TypeError"&&XBn.test(t?.message||""),pat=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,Yte):void 0})(t());return Bo(e)?void 0:Math.min(e,3e4)}catch{return}},mat=t=>{const e=dat(t);if(!e)return;const n=new Bye;cat.set(n,!0);const{url:o,encodedBody:i}=e;n.open(t.method||"GET",o,!0);const{contentType:r,body:s}=i??{};Ql(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,pat(()=>n.getResponseHeader("Retry-After")))}},n.send(s)},_at=t=>{const e=dat(t);if(!e)return;const{url:n,encodedBody:o}=e,{contentType:i,body:r,estimatedSize:s}=o??{},a=new Headers;Ql(t.headers,function(d,p){a.append(p,d)}),i&&a.append("Content-Type",i);let A=null,c=!1;if(Iit){const d=new Iit;A={signal:d.signal,timeout:setTimeout(()=>{c=!0;try{d.abort(art("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"||hat(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=()=>{L2e-=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>L2e+p,d.keepalive&&(u=p,L2e+=u),HK(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,pat(()=>m.headers.get("Retry-After")))})).catch(m=>{h(),g(m)}).finally(h)}catch(d){h(),g(d)}},O2e=t=>{try{var e;const{url:n,encodedBody:o}=uat(t),{contentType:i,body:r,estimatedSize:s}=o??{};if(!r)return;const a=r instanceof Blob?r:new Blob([r],{type:i});if(F_.sendBeacon(n,a))return;const A=as(t.data)?t.data:(e=t.data)===null||e===void 0?void 0:e.batch;if(as(A)&&A.length>1&&(s??0)>16384){const c=Math.ceil(A.length/2),l=g=>as(t.data)?g:sn(sn({},t.data),{},{batch:g});return O2e(sn(sn({},t),{},{data:l(A.slice(0,c))})),void O2e(sn(sn({},t),{},{data:l(A.slice(c))}))}gi.warn(`Beacon of ~${s??0} bytes was rejected by the browser, falling back to ${HK?"fetch":"XHR"}`),HK?_at(sn(sn({},t),{},{rl:!0})):mat(t)}catch(n){gi.warn("Beacon send failed",n)}},fat=(t,e,n,o)=>{const i=o==="query"?e==="POST"?"sent_at":"_":void 0;return uV(n===M3.GZipJS?gat(t,"compression"):t,sn(sn({},i?{[i]:Date.now().toString()}:{}),n===M3.GZipJS?{}:{compression:n}))},qBn=(()=>{const t=[];return HK&&t.push({transport:"fetch",method:_at}),Bye&&t.push({transport:"XHR",method:mat}),F_?.sendBeacon&&t.push({transport:"sendBeacon",method:O2e}),t})();let Iat=!WBn&&dy?.indexOf("MSIE")===-1&&dy?.indexOf("Mozilla")===-1;function Cat(t,e,n){var o,i,r;n&&(e=sn(sn({},e),{},{callback:s=>n(s)})),t.__loaded?Iat?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=M3.Base64),g.method==="POST"&&g.data&&(g.timestampMode==="capture-body"?g.data=(m=>{var _,f;const I=(as(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())=>as(m)?m.map(f=>sn(sn({},f),{},{sent_at:_})):sn(sn({},m),{},{sent_at:_}))(g.data))),g.url=fat(g.url,g.method,g.compression,g.timestampMode);const h=qBn.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 _;hat(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===M3.GZipJS&&R5n&&typeof Promise<"u"&&!cne?jBn(g).then(m=>{p(m)}).catch(m=>{if(Brt(m))return cne=!0,void p(sn(sn({},g),{},{compression:void 0,url:fat(s.url,s.method,void 0,s.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;const f="name"in _?String(_.name):"";return Brt(_)||f===xrt})(m)&&(cne=!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 $Bn=class{constructor(e,n){this.ol=!0,this.al=[],this.ll=x9(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 Ql(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 ZBn=["retriesPerformedSoFar"];var e9n=class{constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.al=[],this.al=[],this.ml=!0,this.resume()}resume(){if(!Bo(Ln)&&"onLine"in Ln.navigator){if(this.ml=Ln.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.bl()},this._l=()=>{this.ml=!1},ml(Ln,"online",this.yl),ml(Ln,"offline",this._l)}}get length(){return this.al.length}retriableRequest(e,n){let{retriesPerformedSoFar:o}=e,i=Srt(e,ZBn);f8(o)&&(i.url=uV(i.url,{retry_count:o})),Cat(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(Ln)||(this.yl&&(Ln.removeEventListener("online",this.yl),this.yl=void 0),this._l&&(Ln.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=[]}},t9n=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(){ml(Ln,"scroll",this.Sl,{capture:!0}),ml(Ln,"scrollend",this.Sl,{capture:!0}),ml(Ln,"resize",this.Sl)}scrollElement(){if(this.Cl){const o=as(this.Cl)?this.Cl:[this.Cl];for(const i of o){var e;const r=Ln==null||(e=Ln.document)===null||e===void 0?void 0:e.querySelector(i);if(r)return r}return}var n;return Ln==null||(n=Ln.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 Ln?e==="y"?Ln.scrollY||Ln.pageYOffset||((n=Ln.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.scrollTop)||0:Ln.scrollX||Ln.pageXOffset||((o=Ln.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 n9n=t=>Vst(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes);var yat=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({[s2e]:a})},this._instance=e,this.El=n,this.Ml=o,this.Il=i||n9n,this.El.onSessionId(this.Be)}Tl(){return this.Ml.props[s2e]}getSetOnceProps(){var e;const n=(e=this.Tl())===null||e===void 0?void 0:e.props;return n?"r"in n?zst(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 Ql(g2e(this.getSetOnceProps()),(n,o)=>{o==="$current_url"&&(o="url"),e[`$session_entry_${Sye(o)}`]=n}),e}},lne=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 Hk=Ad("[SessionId]"),xat=864e5;var Eat=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 lne,this.Nl=(s,a)=>!(!f8(s)||!f8(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||k4,this.Bl=o||k4;const r=this.Rr.persistence_name||this.Rr.token;if(this._sessionTimeoutMs=1e3*x9(this.Rr.session_idle_timeout_seconds||1800,60,36e3,Hk.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=Z0.Dt(this.zl),a=Z0.Dt(this.Ul);s&&!a?this.He=s:Z0.Lt(this.zl),Z0.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&&Z0.Et()}Gl(e){e!==this.He&&(this.He=e,this.Wl()&&Z0.At(this.zl,e))}Zl(){return this.He?this.He:this.Wl()?Z0.Dt(this.zl):null}Ql(e){const n=this.Al;return!ad(n)&&!ad(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({[Sk]:[n,e,o]}))}Kl(){var e;const n=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return f8(n)&&n>0}Xl(){this.Kl()?this.Ml.refreshKey(Sk):(this.Ml.flush(),this.Ml.load())}Yl(){var e;if(ad(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({[Sk]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Ml.flush())}eu(){const[e]=this.tu(),n=f8(e)?e:0,o=f8(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[Sk];return as(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 Hk.error("Bootstrap sessionID cannot be in the future"):s}catch(s){return void Hk.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&&Ln&&(Ln.removeEventListener(Zte,this.Dl,{capture:!1}),this.Dl=void 0),this.Ol=[]}Vl(){this.Dl=()=>{this.Yl(),this.Wl()&&Z0.Lt(this.Ul)},ml(Ln,Zte,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(ad(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>xat),p=h?d:f8(c)&&Math.abs(i-c)>xat;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||Hk.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(),Hk.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,_&&(Hk.info("adopted cross-tab session id",{sessionId:A,windowId:u}),m=!0);const y=f8(g)&&e&&!p?g:i,x=f8(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 Bat=function(t,e){if(!t)return!1;const n=t.userAgent;if(n&&Sit(n,e))return!0;try{const o=t?.userAgentData;if(o?.brands&&o.brands.some(i=>Sit(i?.brand,e)))return!0}catch{}return!!t.webdriver};function bat(){return(bat=jg(function*(){const t=F_?.userAgentData;if(t?.getHighEntropyValues)try{const e=yield t.getHighEntropyValues(["model"]),n=e?.model;return nA(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 o9n(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 Sat(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 gne=(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}},une=t=>t.toLowerCase(),Qat={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=>gne(n,o))),not_regex:(t,e)=>e.every(n=>t.every(o=>!gne(n,o))),icontains:(t,e)=>e.map(une).some(n=>t.map(une).some(o=>n.includes(o))),not_icontains:(t,e)=>e.map(une).every(n=>t.map(une).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 vat(t,e){return!t||Object.entries(t).every(([n,o])=>{const i=e?.[n];if(i==null)return!1;const r=Qat[o.operator];return!!r&&r(o.values.map(String),[String(i)])})}function G2e(t,e,n){return Nk({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}const Y2e="custom",Pat="i.posthog.com",i9n=/^\/static\//,r9n=["/s/","/e/","/i/"];var s9n=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(`.${Pat}`,".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":Y2e),this.su[this.apiHost]}ru(e){if(!i9n.test(e))return;const n=this.instance.config.asset_host;return typeof n=="string"&&n.trim().replace(/\/$/,"")||void 0}ou(e){const n=y8(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=y8(o))===null||s===void 0?void 0:s.href)||o;i=r(new URL(a)).toString()}if(r&&e==="api"&&r9n.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===Y2e)return this.au(e,n,this.apiHost+n);const o=Pat+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 vl=Ad("[Surveys]"),wat=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){vl.error("Failed to persist survey seen state",e)}},a9n=[v2e.Popover,v2e.Widget,v2e.API],A9n={ignoreConditions:!1,ignoreDelay:!1,displayType:w2e.Popover},c9n=Ad("[PostHog ExternalIntegrations]"),l9n={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var g9n=class{constructor(e){this._instance=e}zo(e,n){var o,i;(o=Ur.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,e,r=>{if(r)return c9n.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=Ur.__PosthogExtensions__)===null||n===void 0||(n=n.integrations)===null||n===void 0)&&n[r])&&this.zo(l9n[r],()=>{var a;(a=Ur.__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=Ur.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0)&&o[r])&&((i=Ur.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0||(i=i[r])===null||i===void 0||i.stop())}}},u9n=class{constructor(e,n){this.$=e,this.wo=n,this.uu=new Map,this.Io=!1}add(e){var n=this;return jg(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&&L_(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)}}},d9n=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 Mat="extensionsRemoteConfig";var h9n=class{constructor(e){this.instance=e,this.Io=!1,this.$=gi,this.cu=e.du,this.kv=new d9n(e),this.onEvent=n=>ane(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 ane(()=>{});const o=r=>{try{n(r)}catch(s){this.$.error("Browser extension remote config listener failed",s)}},i=this.instance.vu.on(Mat,o);return this.cu&&o(this.cu),ane(i)},this.fu=new u9n(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(Wye);return typeof e=="string"?e:void 0}get library(){return{name:Ym.LIB_NAME,version:Ym.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 ane(this.instance.pu(e))}handleRemoteConfig(e){this.Io||(this.cu=e,this.instance.vu.emit(Mat,e))}sendRequest(e){var n=this;return jg(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?uV(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"?bye.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 dV={};let U2e=0;const hV=()=>{},Dat='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',pV="Surveys module not available",Nat="sanitize_properties is deprecated. Use before_send instead",Rat="Invalid value for property_denylist config: ",p9n=/^[A-Za-z0-9_-]{1,400}$/,Tat=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,kat=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,m9n=["token","distinct_id",est],mV="posthog",_9n=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},K2e=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:mBn(No?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:hV,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:sd&&nA(sd?.search)&&sd.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:(Ln==null||(e=Ln.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:rst,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:hV},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:BBn,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:_9n(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))},f9n=[["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"]],Fat=t=>{const e={};for(const[i,r]of f9n)Bo(t[i])||(e[r]=t[i]);const n=Bg({},e,t),o=t.__preview_external_dependency_versioned_paths;return Bo(o)||(Bo(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),nA(o)&&Bo(t.asset_host)&&(n.asset_host=o)),as(t.property_blacklist)&&(Bo(t.property_denylist)?n.property_denylist=t.property_blacklist:as(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:gi.error(Rat+t.property_denylist)),n};var I9n=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}},_V=class EM{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(k4());this.register({distinct_id:o,$device_id:o}),e.set_property(py,C8)}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 I9n,this.Iu=!1,this.version=Ym.LIB_VERSION,this.Mu=new Set,this.Eu="",this.vu=new lne,this.uu=[],this.Pu=[],this.ku=!1,this.wu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=K2e(),this.SentryIntegration=DBn,this.sentryIntegration=o=>(function(i,r){const s=kst(i,r);return{name:Tst,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 t9n(this),this.pageViewManager=new Fst(this),this.rateLimiter=new YBn(this),this.requestRouter=new s9n(this),this.consent=new EBn(this),this.externalIntegrations=new g9n(this);const n=(e=EM.__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=nA(o)?{[o]:i}:o;this.setPersonProperties(s),r?.({})},set_once:(o,i,r)=>{const s=nA(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!==mV){var i;const r=(i=dV[o])!==null&&i!==void 0?i:new EM;return r._init(e,n,o),dV[o]=r,dV[mV][o]=r,r}return this._init(e,n,o)}_init(e,n={},o){var i,r,s;const a=nA(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=K2e(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=K2e(n.defaults),l=Fat(n),g=Bg({},c,l,{name:o,token:a});xA(c.rageclick)&&xA(l.rageclick)&&(g.rageclick=Bg({},c.rageclick,l.rageclick)),xA(c.session_recording)&&xA(l.session_recording)&&(g.session_recording=Bg({},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:M3.GZipJS;const u=this.xu();if(this.persistence=new Q2e(this.config,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Q2e(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&&Z0.Et()){const _=Z0.Dt(this.Eu);as(_)&&_.forEach(f=>{nA(f)&&this.Mu.add(f)})}else Z0.Lt(this.Eu);const h=sn({},this.persistence.props),d=sn({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new $Bn((_,f)=>this.ju(_,f),this.config.request_queue_config),this.Bu=new e9n(this),this.__request_queue=[];const p=this.bu();p||(this.sessionManager=new Eat(this),this.sessionPropsManager=new yat(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)),Ym.DEBUG=Ym.DEBUG||this.config.debug,Ym.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(py);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(k4()),y=n.bootstrap.isIdentifiedID?C:_;this.persistence.set_property(py,n.bootstrap.isIdentifiedID?$te:C8),this.register({distinct_id:_,$device_id:y})}}if(p)this.register_once({distinct_id:A2e,$device_id:null},"");else if(!this.get_distinct_id()){const _=this.config.get_device_id(k4());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(py,C8)}return ml(Ln,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),ml(Ln,"pageshow",()=>{var _;this.$u=!1,this.Tu||(_=this.Bu)===null||_===void 0||_.resume()}),n.segment?Rst(this,()=>this.Wu()):this.Wu(),L_(this.config._onCapture)&&this.config._onCapture!==hV&&(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 bat.apply(this,arguments)})().then(_=>{_&&this.register({[jye]:_})}).catch(hV),this}Vu(e){const n=e;return nA(n.name)&&L_(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=EM.__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)),L_(this.featureFlags.onReloading)&&L_(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({},EM.__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,MBn)),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({[tst]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[nst]: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=fs(i.supportedCompression,M3.GZipJS)?M3.GZipJS:fs(i.supportedCompression,M3.Base64)?M3.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:rst}),(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&&sd?.hostname){const e=sd.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 Zst(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()&&vk(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(sst),(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(sst,null,{transport:"sendBeacon"})}_send_request(e){Cat(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){U2e++;try{let n;const o=[],i=[],r=[];vk(e,a=>{if(a)if(n=a[0],as(n))r.push(a);else if(L_(a))try{a.call(this)}catch(A){gi.error("Error executing queued PostHog call",a,A)}else as(a)&&n==="alias"?o.push(a):as(a)&&n.indexOf("capture")!==-1&&L_(this[n])?r.push(a):i.push(a)});const s=function(a,A){vk(a,function(c){try{if(as(c[0])){let l=A;Ql(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{U2e--}}push(e){if(U2e>0&&as(e)&&nA(e[0])){const n=EM.prototype[e[0]];return void(L_(n)&&n.apply(this,e.slice(1)))}this._execute_array([e])}get nh(){return{property:Grt,persistenceKey:bk,cookieName:"_fbc",pattern:Tat,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[bk]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(bk)}}}get sh(){return{property:Yrt,persistenceKey:zK,cookieName:"_fbp",pattern:kat,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[zK]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(zK)}}}rh(e){var n;const o=(n=this.persistence)===null||n===void 0?void 0:n.get_property(e.persistenceKey);return nA(o)&&e.pattern.test(o)?{value:o,delivered:!1}:xA(o)&&nA(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=$K(e.cookieName);return nA(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 nA(n)&&Tat.test(n)?this.oh(r,n,s):void r.unregister();const a=nA(e)&&p9n.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 nA(e)&&kat.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)||!nA(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&&!nA(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=srt(o?.uuid,k4);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=xA(n?.$set)?n.$set:void 0,p=as(n?.$unset)?n.$unset:[],m=o?.$unset||[],_=R=>{var F;const O=!!o?.$set&&R in o.$set;return{hasProvided:O||!!d&&R in d,provided:O?o==null||(F=o.$set)===null||F===void 0?void 0:F[R]:d?.[R],unset:p.indexOf(R)!==-1||m.indexOf(R)!==-1}},f=_(Grt),I=_(Yrt),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:O}of C)O&&u.properties.$process_person_profile===!0&&O.pending&&!F&&!h&&(u.$set=sn({[R.property]:O.value},u.$set));const y=o?.$unset;y&&(u.$unset=y);const x=h?void 0:this.ph(o?.$set_once,e!==Ast,e===ast);if(x&&(u.$set_once=x),o?._noTruncate||(E=this.config.properties_string_max_length,u=(function(R,F){const O=new Set;return(function U(Y,J){if(Y!==Object(Y))return F?F(Y):Y;if(O.has(Y))return;let ee;if(O.add(Y),as(Y))ee=[],vk(Y,W=>{ee.push(U(W))});else{const W={};Ql(xk(Y)?cst(Y):Y,(X,ie)=>{O.has(X)||(W[ie]=U(X))}),ee=W}return ee})(R)})(u,R=>nA(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 O={},U=Y=>{R[Y]!==void 0&&(O[Y]=R[Y])};return P4n.forEach(U),F.forEach(U),O})(u.properties,m9n)),e===E8.DISMISSED||e===E8.SENT){const R=n?.[P2e.SURVEY_ID],F=n?.[P2e.SURVEY_ITERATION];wat({id:R,current_iteration:F}),u.$set=sn(sn({},u.$set),{},{[o9n({id:R,current_iteration:F},e===E8.SENT?"responded":"dismissed")]:!0})}else e===E8.SHOWN&&(u.$set=sn(sn({},u.$set),{},{[P2e.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var E;if(e===GBn.SHOWN){const R=n?.[qst.TOUR_TYPE];R&&(u.$set=sn(sn({},u.$set),{},{[`${qst.TOUR_LAST_SEEN_DATE}/${R}`]:new Date().toISOString()}))}const B=sn(sn({},u.properties.$set),u.$set);if(nx(B)||this.setPersonPropertiesForFlags(B),!Us(this.config.before_send)){const R=this.Os(u);if(!R)return;u=R,u.uuid=srt(u.uuid,k4)}const S=C.filter(({channel:R,update:F})=>{var O,U,Y;const J=(O=(U=u.$set)===null||U===void 0?void 0:U[R.property])!==null&&O!==void 0?O:xA((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),P=o?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(Q),M=sn(sn(sn({method:"POST",url:Q,data:u,compression:"best-available",preferSyncCompression:o?.send_instantly,timestampMode:P?"body":"capture-body",batchKey:o?._batchKey},P&&(!((r=u.properties)===null||r===void 0)&&r.$session_id)?{batchGroup:u.properties.$session_id+(u.properties.$window_id?`-${u.properties.$window_id}`:"")}:{}),o?.transport?{transport:o.transport}:{}),S.length?{fireCallbackOnDrop:!0,callback:R=>{if(R.statusCode>=200&&300>R.statusCode)for(const{channel:F,update:O}of S)this.dh(F,O.value)}}:{});if(!this.config.request_batching||o&&!o?._batchKey||o?.send_instantly||S.length){var k;let R;!M.transport&&!M.callback&&nx((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 h9n(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[est]=!0),e==="$snapshot"){const f=sn(sn({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=f.distinct_id,(!nA(a.distinct_id)&&!jd(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,S;if(!dy)return{};const Q=f?[...Tk,...I||[]]:[],[P,M]=trt(dy),[k,R]=(function(se){for(let oe=0;ort.length>oe;oe++){const[ge,ue,Ie]=ort[oe],le=se.match(ge);if(le){const _e=Ie&&se.match(Ie)||le;return[ue,_e?.[1]||""]}}return["",""]})(dy),F=(function(){const se="u">typeof navigator?navigator:void 0;return se?.brave?{brave:!0}:{}})(),O={};Bo(C)||(O.detectGoogleSearchApp=C);const U={},Y=(x=navigator)===null||x===void 0||(x=x.userAgentData)===null||x===void 0?void 0:x.platform,J=(E=navigator)===null||E===void 0?void 0:E.maxTouchPoints,ee=Ln==null||(B=Ln.screen)===null||B===void 0?void 0:B.width,W=Ln==null||(S=Ln.screen)===null||S===void 0?void 0:S.height,X=Ln?.devicePixelRatio;Bo(Y)||(U.userAgentDataPlatform=Y),Bo(J)||(U.maxTouchPoints=J),Bo(ee)||(U.screenWidth=ee),Bo(W)||(U.screenHeight=W),Bo(X)||(U.devicePixelRatio=X);const ie=Bg(g2e({$os:P,$os_version:M,$browser:Zit(dy,navigator.vendor,F,O),$webview_app:k,$webview_app_version:R,$device:nrt(dy),$device_type:q5n(dy,U),$timezone:Jst(),$timezone_offset:LBn()}),{$current_url:sV(y?iQ(sd?.href):sd?.href,Q,aV),$host:sd?.host,$pathname:sd?.pathname,$raw_user_agent:dy.length>1e3?dy.substring(0,997)+"...":dy,$browser_version:X5n(dy,navigator.vendor,F,O),$browser_language:Ust(),$browser_language_prefix:FBn(),$screen_height:Ln?.screen.height,$screen_width:Ln?.screen.width,$viewport_height:Ln?.innerHeight,$viewport_width:Ln?.innerWidth,$lib:_8.LIB_NAME,$lib_version:_8.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return _8.SDK_DIST_CHANNEL&&(ie.$sdk_dist_channel=_8.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&&Bg(a,this.sessionPropsManager.getSessionProps());try{var c;this.sessionRecording&&Bg(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===Y2e&&(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=Bg(a,l),e==="$pageview"&&No&&(a.title=No.title),!Bo(s)){const f=o.getTime()-s;a.$duration=parseFloat((f/1e3).toFixed(3))}dy&&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;xA(h)&&!nx(h)&&(a.$groups=sn(sn({},xA(d)?d:{}),h)),Ql(["$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{Bg(p,f())}catch(I){gi.error("Failed to produce browser extension event properties",I)}a=Bg({},A,g,u,sn(sn({},p),a)),a.$is_identified=this._isIdentified(),as(this.config.property_denylist)?Ql(this.config.property_denylist,function(f){delete a[f]}):gi.error(Rat+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const m=this.config.sanitize_properties;m&&(gi.error(Nat),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=Bg({},r,s||{},e||{});const A=this.config.sanitize_properties;return A&&(gi.error(Nat),a=A(a,"$set_once")),n&&(this.Iu=!0),nx(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||!Z0.Et())return void Z0.Lt(this.Eu);const n=[];this.Mu.forEach(o=>n.push(o)),n.length>0?Z0.At(this.Eu,n):Z0.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:pV}),()=>{})}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:pV})}getActiveMatchingSurveys(e,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:pV})}renderSurvey(e,n){var o;(o=this.surveys)===null||o===void 0||o.renderSurvey(e,n)}displaySurvey(e,n=A9n){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:pV}}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:pV})}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(jd(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(Xte),this.register({distinct_id:e}));const g=(this.persistence.get_property("$user_state")||"anonymous")===C8,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(py,$te),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=G2e(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(py,$te);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=G2e(e,n,o))}else(n||o)&&this.setPersonProperties(n,o);u||r||s?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(AQ)):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=G2e(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=(as(e)?e:[e]).filter(i=>nA(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(Ast,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=hy(e)?e:e?.resetDeviceID,o=hy(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(Wye),u=this.get_property(jye),h=this.get_property(JK);(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,S,Q,P,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"),(S=this.sessionManager)===null||S===void 0||S.resetSessionId(),this.Ou=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:A2e,$device_id:null},"");else{const O=this.config.get_device_id(k4());this.register_once({distinct_id:O,$device_id:e?O:g},""),e||Bo(u)||this.register({[jye]: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})),(P=this.featureFlags)===null||P===void 0||P.initialize(),!Us(l)&&!(!((M=this.sessionManager)===null||M===void 0)&&M.setBootstrapSessionId(l,!0)))){const O=sn({},o);delete O.sessionID,this.config.bootstrap=O}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 jg(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(Xte,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(xA(e)){var o,i,r,s,a,A,c,l,g,u,h,d,p,m;Bg(this.config,Fat(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 Q2e(sn(sn({},this.config),{},{persistence:"sessionStorage"}),f,!1);const I=this.Du(this.config.debug);var _;hy(I)&&(this.config.debug=I),hy(this.config.debug)&&(this.config.debug?(Ym.DEBUG=!0,uc.Et()&&uc.At("ph_debug",!0),gi.info("set_config",{config:e,oldConfig:n,newConfig:sn({},this.config)})):(Ym.DEBUG=!1,uc.Et()&&uc.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&&Rst(this,hV,!1)}}_overrideSDKInfo(e,n){Ym.LIB_NAME=e,Ym.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:EM.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:mV;return n!==mV&&(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()&&nx(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(a2e,!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 Eat(this),this.pageViewManager=new Fst(this),this.persistence&&(this.sessionPropsManager=new yat(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=EM.__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(Dat)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void gi.warn(Dat);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:A2e,$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 F_?Bat(F_,this.config.custom_blocked_useragents):void 0}th(){No&&(No.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(l2e,{title:No.title},{send_instantly:!0}),this.Au&&(No.removeEventListener(qK,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),ml(No,qK,this.Au)))}debug(e){e===!1?(Ln?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Ln?.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&&!Us(n[o]),A=i in n&&!Us(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(Us(this.config.before_send))return e;const o=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(H5n),i=as(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),Us(r)){const a=`Event '${e.event}' was rejected in beforeSend function`;return L5n(e.event)?gi.warn(`${a}. This can cause unexpected behavior.`):gi.info(a),null}r.properties&&!nx(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&&Us(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=hy(e)&&!e,o=uc.Et()&&uc.Ot("ph_debug")==="true";return!n&&(!!o||e)}};_V.__defaultExtensionClasses={},_V.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]]=hBn(t.prototype[e[n]])})(_V,["identify"]);var Lat=class{constructor(e){this.disabled=e===!1;const n=xA(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 V2e="$copy_autocapture",z2e=Ad("[AutoCapture]");function J2e(t,e){return e.length>t?e.slice(0,t)+"...":e}function C9n(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do e=e.previousSibling;while(e&&!B9(e));return e}function y9n(t,{e,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:i,elementsChainAsString:r,disableCaptureUrlHashes:s}){var a,A;if(!B9(t))return{props:{}};const c=[t],l=new Set([t]);let g=t;for(;g.parentNode&&!j1(g,"body")&&1e3>c.length;){if(I2e(g.parentNode)){const x=g.parentNode.host;if(l.has(x))break;l.add(x),c.push(x),g=x;continue}if(!B9(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=>j1(x,"button")||j1(x,"a")):-1;u>0&&(o=o||c.slice(0,u+1).some(x=>!Dk(x)||nV(x)));const h=[],d={};let p,m=!1,_=!1;if(Ql(c,x=>{const E=Dk(x);if(j1(x,"a")&&!n&&!i?.includes("href")){const B=x.getAttribute("href");m=!!(E&&B&&oV(B))&&(s?iQ(B):B)}fs(Mk(x),"ph-no-capture")&&(_=!0),h.push((function(B,S,Q,P,M=!1){const k=B.tagName.toLowerCase(),R={tag_name:k};y2e.indexOf(k)>-1&&!Q&&(R.$el_text=k.toLowerCase()==="a"||k.toLowerCase()==="button"?J2e(1024,wst(B)):J2e(1024,eV(B)));const F=Mk(B);S||P?.includes("class")||0>=F.length||(R.classes=F.filter(function(J){return J!==""})),Ql(B.attributes,function(J){var ee;if((!nV(B)||["name","id","class","aria-label"].indexOf(J.name)!==-1)&&!P?.includes(J.name)&&!S&&oV(J.value)&&(!nA(ee=J.name)||ee.substring(0,10)!=="_ngcontent"&&ee.substring(0,7)!=="_nghost")){let W=J.value;J.name==="class"&&(W=C2e(W).join(" ")),R["attr__"+J.name]=J2e(1024,J.name==="href"&&M?iQ(W):W)}});let O=1,U=1,Y=B;for(;Y=C9n(Y);)O++,Y.tagName===B.tagName&&U++;return R.nth_child=O,R.nth_of_type=U,R})(x,n,o,i,s)),Ql((function(B){if(!Dk(B))return{};const S={};return Ql(B.attributes,function(Q){if(Q.name&&Q.name.indexOf("data-ph-capture-attribute")===0){const P=Q.name.replace("data-ph-capture-attribute-",""),M=Q.value;P&&M&&oV(M)&&(S[P]=M)}}),S})(x),(B,S)=>{({}).hasOwnProperty.call(d,S)||(d[S]=B)})}),_)return{props:{},explicitNoCapture:_};if(u>0&&(t=c[u],h.splice(0,u)),o||(h[0].$el_text=j1(t,"a")||j1(t,"button")?wst(t):eV(t)),m){var f,I;h[0].attr__href=m;const x=(f=y8(m))===null||f===void 0?void 0:f.host,E=Ln==null||(I=Ln.location)===null||I===void 0?void 0:I.host;x&&E&&x!==E&&(p=m)}return{props:Bg((y=e.type,{$event_type:y,$ce_version:1}),r?{}:{$elements:h},{$elements_chain:(C=h,as(C)?(function(x){return x.map(E=>{var B,S;let Q="";if(E.tag_name&&(Q+=E.tag_name),E.attr_class){E.attr_class.sort();for(const k of E.attr_class)Q+=`.${k.replace(/"/g,"")}`}const P=sn(sn(sn(sn({},E.text?{text:E.text}:{}),{},{"nth-child":(B=E.nth_child)!==null&&B!==void 0?B:0,"nth-of-type":(S=E.nth_of_type)!==null&&S!==void 0?S:0},E.href?{href:E.href}:{}),E.attr_id?{attr_id:E.attr_id}:{}),E.attributes),M={};return ene(P).sort(([k],[R])=>(function(F,O){return O>F?-1:F>O?1:0})(k,R)).forEach(([k,R])=>M[Dst(k.toString())]=Dst(R.toString())),Q+=":",Q+=ene(M).map(([k,R])=>`${k}="${R}"`).join(""),Q}).join(";")})((function(x){return x.map(E=>{var B,S;const Q={text:(B=E.$el_text)===null||B===void 0?void 0:B.slice(0,400),tag_name:E.tag_name,href:(S=E.attr__href)===null||S===void 0?void 0:S.slice(0,2048),attr_class:PBn(E),attr_id:E.attr__id,nth_child:E.nth_child,nth_of_type:E.nth_of_type,attributes:{}};return ene(E).filter(([P])=>P.indexOf("attr__")===0).forEach(([P,M])=>Q.attributes[P]=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 x9n=class{fo(){this.po=void 0,clearTimeout(this.mo),this.mo=void 0}yo(e){var n;if(!Dk(e))return!0;const o=(n=this.bo().css_selector_ignorelist)!==null&&n!==void 0?n:B2e,i=new Set;let r=e;for(;r;){if(i.size>=1e3||i.has(r))return!0;i.add(r);const s=r,a=Mk(s);if(fs(a,"ph-no-capture")||fs(a,"ph-sensitive")||nV(s)||o.some(c=>x2e(s,c)))return!0;const A=r.parentNode;r=I2e(A)?A.host:A&&B9(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=tV(e);var n;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&B9(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=tV(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&&(j1(i,"html")||j1(i,"body"))){var r;if(o.excluded)return null;const s=(r=this.bo().css_selector_ignorelist)!==null&&r!==void 0?r:B2e;return[i,No?.documentElement,No?.body].some(a=>{if(!a)return!1;const A=Mk(a);return fs(A,"ph-no-capture")||fs(A,"ph-sensitive")||!Dk(a)||nV(a)||s.some(c=>x2e(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 Lat(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 z2e.info("Disabling Automatic Event Collection because this browser is not supported");if(!Ln||!No)return;const e=this.Fo=n=>{n=n||Ln?.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(ad(o))return;this.Oo(n,"$autocapture",o)}catch(o){z2e.error("Failed to capture event",o)}};if(ml(Ln,"blur",e),ml(No,"submit",e,{capture:!0}),ml(No,"change",e,{capture:!0}),ml(No,"click",e,{capture:!0}),Ql(["pointerdown","pointermove","pointerup","pointercancel"],n=>{ml(No,n,e,{capture:!0})}),this.bo().capture_copied_text){const n=this.Do=o=>{o=o||Ln?.event;try{this.Oo(o,V2e)}catch(i){z2e.error("Failed to capture clipboard event",i)}};ml(No,"copy",n,{capture:!0}),ml(No,"cut",n,{capture:!0}),ml(No,"paste",n,{capture:!0})}}Ro(){this.fo(),this.Fo&&(Ln?.removeEventListener("blur",this.Fo),Ql(["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;hy(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||fs(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(Urt),i=this.Co,r=this.bo();if(!r.remoteRequestsDisabled&&!this.$o)return!1;const s=r.remoteRequestsDisabled&&!this.$o;if(ad(i)&&!hy(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||tV(e);_st(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()))&&Bst(i,r.rageclick)&&this.Oo(e,"$rageclick",o);const a=n===V2e,A=a?sn(sn({},r),{},{dom_event_allowlist:void 0}):r;if(i&&(function(u,h,d,p,m,_){var f;if(!Ln||b2e(u)||d?.url_allowlist&&!fst(d.url_allowlist,_)||d?.url_ignorelist&&fst(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}=bst(u,p);if(!(function(x,E){const B=E?.element_allowlist;if(Bo(B))return!0;for(const S of x)if(B.some(Q=>S.tagName.toLowerCase()===Q))return!0;return!1})(C,d)||!E2e(C,d?.css_selector_allowlist)||E2e(C,(f=d?.css_selector_ignorelist)!==null&&f!==void 0?f:B2e))return!1;try{const x=Ln.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&&(y2e.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}=y9n(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===V2e){const m=e.type||"clipboard";if(m!=="paste"){var l,g;const _=Ln==null||(l=Ln.getSelection())===null||l===void 0?void 0:l.toString(),f=Ist(_);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 L_(No?.querySelectorAll)}},E9n=class{constructor(e){this._instance=e}refresh(e){const n=this._instance.config,o=xA(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 fV=Ad("[ExceptionAutocapture]"),Hat=()=>{},Oat=t=>{var e;if(L_(t))return(e=t.__posthog_layer__)!==null&&e!==void 0?e:t.__rrweb_layer__};function IV(t,e,n){try{if(!(e in t))return Hat;const o={next:t[e]},i=n(function(...r){return o.next.apply(this,r)});return L_(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=Oat(r);for(;s;){if(s.next===i)return void(s.next=o.next);r=s.next,s=Oat(r)}}}catch{return Hat}}const B9n=Ad("[TracingHeaders]"),kM=Ad("[Web Vitals]"),Gat=9e5,Yat=["CLS","FCP","INP","LCP"],b9n=["INP","LCP"],S9n=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],W2e="disabled",Uat="lazy_loading",b8=Ad("[SessionRecording]"),Q9n=Ad("[Heatmaps]");function j2e(t){return xA(t)&&"clientX"in t&&"clientY"in t&&jd(t.clientX)&&jd(t.clientY)}const dne=Ad("[Product Tours]"),X2e=t=>{var e;return!t.config.disable_product_tours&&!!(!((e=t.persistence)===null||e===void 0)&&e.get_property(n2e))},v9n=["$set_once","$set"],b9=Ad("[SiteApps]"),Kat="Error while initializing PostHog app with config id ",Vat=(t,e)=>t?.then?t.then(e):e(t),Ok="SDK is not enabled or survey functionality is not yet loaded",zat="Disabled. Not loading surveys.";var P9n=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 vl.warn("Remote config unavailable. Not loading surveys.");const i=o.config.surveys;if(Us(i))return vl.warn("Flags not loaded yet. Not loading surveys.");this.Ah=hy(i)?i:i.length>0,vl.info(`flags response received, isSurveysEnabled: ${this.Ah}`),this.loadIfEnabled()}}setup(e){if(!this.Io)return this.Fh=e,Vat(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 vl.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void vl.info(zat);if(e.cookielessMode&&this.So.isOptedOut())return void vl.info("Not loading surveys in cookieless mode without consent.");const n=this.So.getExtensions();if(!n)return void vl.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(c2e),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(),vl.info("Surveys loaded successfully"),this.Lh({isLoaded:!0}))}Dh(e,n){vl.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 vl.info(zat),e([]);const r=i.kv.get(i2e);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=>vl.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 vl.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=>vl.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(Ok)}))}jh(e,n){if(this.Io)return{surveys:[],context:{isLoaded:!1,error:Ok}};const o=n.statusCode;if(o!==200||!n.json){const a=`Surveys API could not be loaded, status: ${o}`;return o!==0?vl.error(a):n.error||vl.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)&&(Sat(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({[i2e]:i,[qte]: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(qte);return jd(o)&&Date.now()-o>3e5}Hh(){return jd(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};wat(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){vl.error("Error in survey callback",o)}}getActiveMatchingSurveys(e,n=!1){if(!Us(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);vl.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(Us(this._surveyManager))return{eligible:!1,reason:Ok};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(Us(this._surveyManager))return{eligible:!1,reason:Ok};const n=typeof e=="string"?this.zh(e):e;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Us(this._surveyManager))return vl.warn("init was not called"),{visible:!1,disabledReason:Ok};const n=this.Wh(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return Us(this._surveyManager)?(vl.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ok})):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(Us(this._surveyManager))return void vl.warn("init was not called");const r=typeof e=="string"?this.zh(e):e;if(!r?.id)return void vl.warn("Survey not found");if(!a9n.includes(r.type))return void vl.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){vl.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()&&(vl.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),vl.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Rh.add(a)}this._surveyManager.renderSurvey(r,s,o)}else vl.warn("Survey element not found")}displaySurvey(e,n){var o;if(!this.So.isCapturing())return;if(Us(this._surveyManager))return void vl.warn("init was not called");const i=this.zh(e);if(!i)return void vl.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!==w2e.Popover&&n.initialResponses&&vl.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 vl.warn("Survey is not eligible to be displayed: ",s.reason)}n.displayType!==w2e.Inline?this._surveyManager.handlePopoverSurvey(r,n):this.renderSurvey(r,n.selector,n.properties)}cancelPendingSurvey(e){Us(this._surveyManager)?vl.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 Gk(t,e,n){if(Us(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 w9n=class{constructor(e){this._instance=e,this.Vh=new Set,this.Gh=new Set,this.Zh=new lne,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 lne}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"||!Gk(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=>Gk(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&&Gk((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=>Gk(c.text,n.text,n.text_matching||"exact")||Gk(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(;!Us(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=>Gk(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||vat(n.properties.reduce((o,i)=>{const r=as(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)}},M9n=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&&vat(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===AV.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 w9n(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,AV.Activation),A=this._c(e,AV.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,AV.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,AV.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&&(nx(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 jd(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=>jd(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}},D9n=class extends M9n{constructor(e){super(e)}zc(){return jrt}Uc(){return Xrt}gc(){return qrt}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 jd(i)&&i>0}Qc(){return E8.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 vl}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 Sat(i)&&!!(!((r=i.conditions)===null||r===void 0||(r=r.events)===null||r===void 0)&&r.repeatedActivation)||i.schedule==="always"})(o)?e===E8.SHOWN?"consume":"ignore":e===E8.SHOWN?"persist":e===E8.DISMISSED||e===E8.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},N9n=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)}},R9n=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=Ur?.__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 D9n(this._instance)}};const T9n=Ln?.location?one(Ln.location.hash,"__posthog")||one(location.hash,"state"):null,Jat="_postHogToolbarParams",Wat=Ad("[Toolbar]"),jat=Ad("[FeatureFlags]");var k9n=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:as(o.flag_keys)?o.flag_keys:void 0}})(e,n),!e.evaluation_environments||e.evaluation_contexts||this.Jc||(jat.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)||as(e.flag_keys)||jat.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Kc}};const Xat=Ad("[FeatureFlags]"),FM=Ad("[FeatureFlags]",{debugEnabled:!0}),q2e=`" failed. Feature flags didn't load in time.`,F9n=[502,504],qat=["click","keydown","wheel","touchstart","pointerdown"],$at="connection_error",Zat=t=>{const e={};for(let n=0;t.length>n;n++)e[t[n]]=!0;return e},eAt=t=>{const e={};for(const[n,o]of ene(t||{}))o&&(e[n]=o);return e},tAt=t=>xk(t)&&(t.name==="RangeError"&&t.message.indexOf("Maximum call stack size exceeded")===0||t.name==="InternalError"&&t.message==="too much recursion"),F4=Ad("[Error tracking]"),$2e="webkit-masked-url:",L9n=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],H9n=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",$2e],O9n=["__firefox__","__gCrWeb"],nAt="Refusing to render web experiment since the viewer is a likely bot",G9n={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>gne(e,t),not_regex:(t,e)=>!gne(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},h5=Ad("[Conversations]"),LM="Conversations not available yet.";function oAt(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=F_?.userAgent;m&&([d,p]=trt(m))}catch{}return(function(m,_){const f=(function(I){if(I)return{}.hasOwnProperty.call(wrt,I)?wrt[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 Y9n=["debug","log","warn","error","info"],U9n=t=>{for(;t?.__rrweb_original__;)t=t.__rrweb_original__;return t},iAt="console",rAt="__posthogHandledLogsRequestError",Z2e=(t,e)=>{const n=t instanceof Error?t:new Error(e);return n[rAt]=!0,n},sAt=t=>!!t&&typeof t=="object"&&t[rAt]===!0,hne=Ad("[NetworkMetrics]"),exe=()=>{var t;return!(Ln==null||(t=Ln.performance)===null||t===void 0)&&t.now?Ln.performance.now():Date.now()},K9n={"http:":80,"https:":443},V9n=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),aAt=(t,e)=>{var n;const o=String(e);return{method:String(t).toUpperCase(),url:((n=y8(o))===null||n===void 0?void 0:n.href)||o}},txe=(t,e,n,o,i,r,s=!1)=>{try{var a,A;const c=i();if(!c)return;const l=n||void 0,g=exe()-o,u=y8(e.url);if(u&&u.protocol!=="http:"&&u.protocol!=="https:")return;const h={url:u?.href||e.url,method:e.method},d=L_(c.name)?c.name(h):nA(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=V9n.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)||K9n[_.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){hne.error("Failed to record network metric",c)}},AAt=()=>{},z9n=(t,e)=>L_(Ln?.fetch)?IV(Ln,"fetch",n=>function(...o){const i=exe(),r=n.apply(this,o);if(!e())return r;try{var s,a,A;const[c,l]=o,g=aAt((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=>(txe(t,g,u?.status,i,e,void 0,!0),u),u=>{throw txe(t,g,void 0,i,e,u),u})}catch(c){return hne.error("Failed to observe fetch",c),r}}):AAt,J9n=(t,e)=>{var n;const o=Ln==null||(n=Ln.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!o)return AAt;const i=new WeakMap,r=IV(o,"open",a=>function(...A){try{cat.has(this)||i.set(this,aAt(A[0],A[1]))}catch(c){hne.error("Failed to observe XHR open",c)}return a.apply(this,A)}),s=IV(o,"send",a=>function(...A){let c;try{const l=i.get(this);if(l&&e()){const g=exe();c=()=>{this.removeEventListener("loadend",c),txe(t,l,this.status,g,e)},ml(this,"loadend",c)}}catch(l){hne.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()}},pne={featureFlags:class{constructor(t){this.name="featureFlags",this.Xc=!1,this.featureFlagEventHandlers=[],this.$=Xat,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 k9n(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]"),Vat(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 Ln&&ml(Ln,"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&&(ml(No,qK,this.ln),vk(qat,n=>{ml(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),vk(qat,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=[],Ln?.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&&!as(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={[I8]:d,[T4]:d,[rQ]:p};t.$feature_flag_details&&(m[wM]=d);for(const _ of[MM,cQ,WK])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[I8,rQ,MM,E9]){const i=this.Fd(o);Bo(i)||(t[o]=i)}this.Yc=t;const e=sn({},t),n=this.Fd(T4);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(cQ);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:Crt(g),variant:yrt(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(wM),e=this.Fd(E9),n=this.Fd(DM);if(!n&&!e)return t||{};const o=Bg({},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:Crt(o),variant:yrt(o),payload:Irt(e[n])}})}getFlagVariants(){const t=this.Fd(T4),e=this.Fd(E9);if(!e)return t||{};const n=Bg({},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(rQ),e=this.Fd(DM);if(!e)return t||{};const n=Bg({},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(AQ)}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(aQ),timezone:Jst()};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?$at:"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({[XK]: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({[XK]:[$at]}),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=>F9n.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 Lst(this.hd,3)}Wd(t){this.hd=Hst(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+q2e);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+q2e);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 S=(g=this.wo)===null||g===void 0?void 0:g.session.sessionId,Q=this.Fd(jK);S&&S!==Q&&(l={},c=S)}if(e.send_event||!("send_event"in e))if(t in l&&l[t].includes(s))c&&this.At({[AQ]:l,[jK]:c});else{var u,h,d,p,m,_,f,I,C,y,x,E;as(l[t])?l[t].push(s):l[t]=[s],this.At(sn({[AQ]:l},c?{[jK]:c}:{}));const S=this.getFeatureFlagDetails(t),Q=[...(u=this.Fd("$feature_flag_errors"))!==null&&u!==void 0?u:[]];Bo(i)&&Q.push("flag_missing");const P={$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(S==null||(_=S.metadata)===null||_===void 0?void 0:_.has_experiment)||(P.$feature_flag_has_experiment=S.metadata.has_experiment),Bo(S==null||(f=S.metadata)===null||f===void 0?void 0:f.version)||(P.$feature_flag_version=S.metadata.version);const M=(I=S==null||(C=S.reason)===null||C===void 0?void 0:C.description)!==null&&I!==void 0?I:S==null||(y=S.reason)===null||y===void 0?void 0:y.code;var B;M&&(P.$feature_flag_reason=M),!(S==null||(x=S.metadata)===null||x===void 0)&&x.id&&(P.$feature_flag_id=S.metadata.id),Bo(S?.original_variant)&&Bo(S?.original_enabled)||(P.$feature_flag_original_response=Bo(S.original_variant)?S.original_enabled:S.original_variant),!(S==null||(E=S.metadata)===null||E===void 0)&&E.original_payload&&(P.$feature_flag_original_payload=S==null||(B=S.metadata)===null||B===void 0?void 0:B.original_payload),Q.length&&(P.$feature_flag_error=Q.join(",")),this.Vd(P)}else c&&this.At({[AQ]:l,[jK]:c});return o?{key:t,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:Irt(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 jg(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+q2e),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=Xat)=>{const l=((I,C)=>{const y=I.flags;if(y){const x=Object.fromEntries(Object.keys(y).map(B=>{var S;return[B,(S=y[B].variant)!==null&&S!==void 0?S:y[B].enabled]})),E=Object.fromEntries(Object.keys(y).filter(B=>y[B].enabled).filter(B=>{var S;return!Bo((S=y[B].metadata)===null||S===void 0?void 0:S.payload)}).map(B=>{var S;return[B,(S=y[B].metadata)===null||S===void 0?void 0:S.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(as(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{[I8]:u,[T4]:I,[WK]:!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({[I8]:Object.keys(eAt(m)),[T4]:m||{},[rQ]:_||{},[wM]:f||{},[WK]:i.minimalFlagCalledEvents===!0},d?{[MM]:d}:{}),p?{[cQ]:p}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.$);if(o)if(n?.persist===!1){const i=!Bo(this.wo.kv.get(T4));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([E9,DM]),this.Md(),void FM.info("All overrides cleared");if(as(t))return this.At({[E9]:Zat(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[E9]=as(i)?Zat(i):i),r&&(o[DM]=r),Object.keys(o).length&&this.At(o),i===!1&&r===!1?this.Lt([E9,DM]):i===!1?this.Lt(E9):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({[E9]: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({[I8]:Object.keys(eAt(a)),[T4]:a,[sQ]: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(o2e);!o||e?this.Jd(t,n):t(o)}Jd(t,e){var n=this;return jg(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({[o2e]: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({[sQ]: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({[sQ]:n}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(sQ),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({[aQ]:o}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.Fd("$stored_group_properties")||{};this.At({[aQ]:sn(sn({},e),{},{[t]:{}})})}else this.Lt(aQ)}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}}},W9n={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=W2e,this.tv=void 0,this.ev=!1,this.Xe=(()=>{var e,n;if(!No?.visibilityState||No.visibilityState==="visible")return!0;const o=Ln==null||(e=Ln.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 b8.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&&ml(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 Ln&&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),b8.info("starting")):(this.Yd=W2e,this.stopRecording())}sv(t){var e,n;if(this.nv)if(this.Yd!=="awaiting_config"&&this.Yd!=="missing_config"&&(this.Yd=Uat),(Ur==null||(e=Ur.__PosthogExtensions__)===null||e===void 0||(e=e.rrweb)===null||e===void 0?void 0:e.record)&&((n=Ur.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording))this.rv(t);else{var o,i;const r=this._instance.sessionManager;(o=Ur.__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}),b8.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(Us(t))return null;const n=jd(t)?t:parseFloat(t);return typeof(o=n)!="number"||!Number.isFinite(o)||0>o||o>1?(b8.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;Us(c)&&this.av();const l=s?.minimumDurationMilliseconds;o.register({[JK]: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({[ist]:!0}),b8.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):b8.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(JK);return(n==null||(e=n.scriptConfig)===null||e===void 0?void 0:e.script)||"lazy-recorder"}hv(){const t=this._instance.get_property(JK);if(!t)return!1;let e;try{e=typeof t=="object"?t:JSON.parse(t)}catch(n){return b8.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!Us(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=Ur.__PosthogExtensions__)===null||e===void 0)&&e.initSessionRecording))return b8.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ost]:!0});var i;if(this.Xd||(this.Xd=(i=Ur.__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",b8.info("persisted remote config is stale, requesting fresh config before starting"),void new Zst(this._instance).load());this.Yd=Uat,(n=(o=this.Xd).setDocumentWasEverVisible)===null||n===void 0||n.call(o,this.Xe),this.Xd.start(t)}else this.Yd=W2e}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)}}},j9n={autocapture:class extends x9n{constructor(t){super(new E9n(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.dv=!1,this._instance=t,this.vv=this.fv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.pv();return!!(t.path||t.search||this.gv(t))}startIfEnabled(){this.isEnabled&&(gi.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.vv=this.fv(),this.startIfEnabled()}stop(){this.mv&&this.mv(),this.mv=void 0,this.yv&&this.yv(),this.yv=void 0,gi.info("History API monitoring stopped")}monitorHistoryChanges(){Ln&&Ln.history&&(this.bv("pushState"),this.bv("replaceState"),this._v(),this.gv()&&this.wv())}bv(t){var e;if(!Ln||!((e=Ln.history[t])===null||e===void 0)&&e.__posthog_wrapped__)return;const n=this;IV(Ln.history,t,o=>function(i,r,s){var a;n.Sv(s)&&n.xv(),o.call(this,i,r,s),n.Cv(t,!n.dv&&(Ln==null||(a=Ln.event)===null||a===void 0?void 0:a.type)!=="popstate")})}fv(){const t=Ln?.location;if(t?.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}pv(){const t=this._instance.config.capture_pageview;return t==="history_change"?{path:!0}:xA(t)?t:{}}gv(t=this.pv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}$v(t){const e=this.pv(),n=this.vv;return!(!n||!(e.path&&t.pathname!==n.pathname||e.search&&t.search!==n.search||this.gv(e)&&t.hash!==n.hash))}Cv(t,e=!1){try{e||this.xv();const n=this.fv();if(!n)return;if(this.$v(n)){const o=()=>this._instance.capture(l2e,{navigation_type:t});e?(this.Tv=o,Promise.resolve().then(()=>this.xv())):o()}this.vv=n}catch(n){gi.error(`Error capturing ${t} pageview`,n)}}Sv(t){var e,n;return!(Us(t)||!Ln)&&((e=y8(String(t)))===null||e===void 0?void 0:e.href)!==((n=Ln.location)===null||n===void 0?void 0:n.href)}xv(){const t=this.Tv;if(t){this.Tv=void 0,this.dv=!0;try{t()}catch(e){gi.error("Error capturing deferred pageview",e)}finally{this.dv=!1}this.vv=this.fv()}}_v(){if(this.mv)return;const t=()=>{this.Cv("popstate")};ml(Ln,"popstate",t),this.mv=()=>{Ln&&Ln.removeEventListener("popstate",t)}}wv(){if(this.yv)return;const t=()=>{this.Cv("hashchange")};ml(Ln,"hashchange",t),this.yv=()=>{Ln&&Ln.removeEventListener("hashchange",t)}}},heatmaps:class{get Rr(){return this.instance.config}constructor(t){var e;this.Iv=!1,this.xo=!1,this.Mv=null,this.instance=t,this.Iv=!!(!((e=this.instance.persistence)===null||e===void 0)&&e.props[qye]),this.rageclicks=new Lat(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return xA(this.Rr.capture_heatmaps)&&this.Rr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Rr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Us(this.Rr.capture_heatmaps)?Us(this.Rr.enable_heatmaps)?this.Iv:this.Rr.enable_heatmaps:this.Rr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.xo)return;Q9n.info("starting..."),this.Ev(),this.ln()}else{var t;clearInterval((t=this.Mv)!==null&&t!==void 0?t:void 0),this.Pv(),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({[qye]:n}),this.Iv=n,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Rv(t){j2e(t.originalEvent)&&this.Tr(t.originalEvent,"deadclick")}ln(){this.Mv&&clearInterval(this.Mv),this.Mv=No?.visibilityState==="visible"?setInterval(this.bl.bind(this),this.flushIntervalMilliseconds):null}Ev(){Ln&&No&&(this.Av=this.bl.bind(this),ml(Ln,Zte,this.Av),this.Fv=t=>this.Tr(t||Ln?.event),ml(No,"click",this.Fv,{capture:!0}),this.Ov=t=>this.Dv(t||Ln?.event),ml(No,"mousemove",this.Ov,{capture:!0}),this.Lv=new Nst(this.instance,wBn,this.Rv.bind(this)),this.Lv.startIfEnabledOrStop(),this.Nv=this.ln.bind(this),ml(No,qK,this.Nv),this.xo=!0)}Pv(){var t;Ln&&No&&(this.Av&&Ln.removeEventListener(Zte,this.Av),this.Fv&&No.removeEventListener("click",this.Fv,{capture:!0}),this.Ov&&No.removeEventListener("mousemove",this.Ov,{capture:!0}),this.Nv&&No.removeEventListener(qK,this.Nv),clearTimeout(this.qv),(t=this.Lv)===null||t===void 0||t.stop(),this.xo=!1)}jv(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&&B9(c)&&!j1(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:Ln)===null||l===void 0?void 0:l.getComputedStyle(c).position}catch{return!1}if(fs(a,h))return!0;c=Cst(c)}return!1})(tV(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(mst(t.target)||!j2e(t))return;const o=this.jv(t,e);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&Bst(tV(t),this.instance.config.rageclick)&&this.Zs(sn(sn({},o),{},{type:"rageclick"})),this.Zs(o)}Dv(t){!mst(t.target)&&j2e(t)&&(clearTimeout(this.qv),this.qv=setTimeout(()=>{this.Zs(this.jv(t,"mousemove"))},500))}Zs(t){if(!Ln)return;const e=this.Rr.disable_capture_url_hashes?iQ(Ln.location.href):Ln.location.href,n=this.Rr.custom_personal_data_properties,o=this.Rr.mask_personal_data_properties?[...Tk,...n||[]]:[],i=sV(e,o,aV);this.Rt=this.Rt||{},this.Rt[i]||(this.Rt[i]=[]),this.Rt[i].push(t)}bl(){this.Rt&&!nx(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Nst,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.Iv=!1,this.xo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Bv=()=>{clearTimeout(this.Hv),this.Hv=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.zv=n=>{var o;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Us(n?.name)||Us(n?.value))return void kM.error("Invalid metric received",n);const i=typeof n.navigationURL=="string"?n.navigationURL:void 0,r=this.Uv(i);if(Bo(r))return;const s=jd(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${r}`;if(this.Wv&&n.value>=this.Wv)return void kM.error("Ignoring metric with value >= "+this.Wv,n);this.Rt.navigationKey!==s&&(this.Bv(),this.Hv=setTimeout(this.Bv,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,xA(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){const c={};for(const l of S9n){const g=l==="url"&&typeof n.attribution[l]=="string"?this.Uv(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.Bv()},this.Vv=()=>{if(this.xo)return;let n,o,i,r,s=!1;const a=Ur.__PosthogExtensions__,A=a?.postHogWebVitalsCallbacksByFlavor,c=A?.[this.Gv]||(this.Gv==="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 kM.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.zv.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&o(this.zv.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.zv.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&r(this.zv.bind(this),g),this.xo=!0},this.Iv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[e2e]),this.startIfEnabled()}get Zv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const n=xA(this.Zv)?(t=this.Zv)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return Us(n)?((e=this._instance.persistence)===null||e===void 0?void 0:e.props.$web_vitals_allowed_metrics)||Yat:n}get flushToCaptureTimeoutMs(){return(xA(this.Zv)?this.Zv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=xA(this.Zv)?this.Zv.web_vitals_attribution:void 0;return hy(t)?t?Yat:[]:as(t)?t:b9n}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=xA(this.Zv)?this.Zv.__preview_web_vitals_soft_navs:void 0;return t!=null&&t}get Wv(){const t=xA(this.Zv)&&jd(this.Zv.__web_vitals_max_value)?this.Zv.__web_vitals_max_value:Gat;return t>0&&6e4>=t?Gat:t}get isEnabled(){const t=sd?.protocol;if(t!=="http:"&&t!=="https:")return kM.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=xA(this.Zv)?this.Zv.web_vitals:hy(this.Zv)?this.Zv:void 0;return hy(e)?e:this.Iv}startIfEnabled(){this.isEnabled&&!this.xo&&(kM.info("enabled, starting..."),this.zo(this.Vv))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const n=xA(e.capturePerformance)&&!!e.capturePerformance.web_vitals,o=xA(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[e2e]:n}),this._instance.persistence.register({[zrt]:o})),this.Iv=n,this.startIfEnabled()}get Gv(){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=Ur.__PosthogExtensions__,o=this.Gv,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?kM.error("failed to load script",r):t()})}Uv(t){const e=t||Ln?.location.href;if(!e)return void kM.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?iQ(e):e,o=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...Tk,...o||[]]:[];return sV(n,i,aV)}}},X9n={exceptionObserver:class{constructor(t){var e;this.Vv=()=>{var n;if(!Ln||!this.isEnabled||!(!((n=Ur.__PosthogExtensions__)===null||n===void 0)&&n.errorWrappingFunctions))return;const o=Ur.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Ur.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=Ur.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Qv&&this.Rr.capture_unhandled_errors&&(this.Qv=o(this.captureException.bind(this))),!this.Jv&&this.Rr.capture_unhandled_rejections&&(this.Jv=i(this.captureException.bind(this))),!this.Kv&&this.Rr.capture_console_errors&&(this.Kv=r(this.captureException.bind(this)))}catch(s){fV.error("failed to start",s),this.Xv()}},this._instance=t,this.Yv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[$ye]),this.wt=new U5n(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,$:fV})),this.Rr=this.tf(),this.startIfEnabledOrStop()}tf(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return xA(t)?e=sn(sn({},e),t):(Bo(t)?this.Yv: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?(fV.info("enabled"),this.Xv(),this.zo(this.Vv)):this.Xv()}zo(t){var e,n,o;!((e=Ur.__PosthogExtensions__)===null||e===void 0)&&e.errorWrappingFunctions?t():(n=Ur.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"exception-autocapture",i=>{if(i)return fV.error("failed to load script",i);t()})}Xv(){var t,e,n;(t=this.Qv)===null||t===void 0||t.call(this),this.Qv=void 0,(e=this.Jv)===null||e===void 0||e.call(this),this.Jv=void 0,(n=this.Kv)===null||n===void 0||n.call(this),this.Kv=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.Yv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[$ye]:this.Yv}),this.Rr=this.tf(),this.startIfEnabledOrStop())}onConfigChange(){this.Rr=this.tf()}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 fV.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.ef=[],this.if=new t4n([new m4n,new b4n,new f4n,new _4n,new E4n,new x4n,new C4n,new B4n],(function(o,...i){return(r,s=0)=>{const a=[],A=r.split(`
|
|
240
|
+
at ${i.filename}:${r}:${s}`}};const I4n=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var C4n=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(I4n);return i&&(n=i[1],o=i[2]),[n,o]}};const y4n=["fatal","error","warning","log","info","debug"];function frt(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 x4n=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(vye(e))return e.constructor.name;const n="name"in e?e.name:void 0;return nA(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: ${frt(e)}`}isSeverityLevel(e){return nA(e)&&!GK(e)&&y4n.indexOf(e)>=0}getStack(e){try{return nA(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:nA(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const n in e)if({}.hasOwnProperty.call(e,n)){const o=e[n];if(xk(o))return o}}getObjectClassName(e){try{const n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}},E4n=class{match(e){return vye(e)}coerce(e,n){var o;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${frt(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},B4n=class{match(e){return Eit(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}}},b4n=class{match(e){return Nte(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!vye(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 Eit(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 Kte="$message",Vte="$timestamp",S4n=new Set([Kte,Vte]),Yye={enabled:!0,max_bytes:32768};function zte(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:Yye.enabled,max_bytes:v4n(t.max_bytes,Yye.max_bytes)}:sn({},Yye)}var Q4n=class{constructor(e){this.ns=[],this.ss=0,this.Rr=zte(e)}setConfig(e){this.Rr=zte(e),this.rs()}add(e){const n=(function(i){let r;try{r=yit(i)}catch{return}try{const s=JSON.parse(r);if(!xA(s))return;const a=s,A=a[Kte],c=a[Vte];return!nA(A)||A.trim().length===0||!nA(c)&&!jd(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 v4n(t,e){if(!jd(t)||t===1/0||t===-1/0)return e;const n=Math.floor(t);return 0>n?e:n}const Irt=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function Crt(t){return typeof t=="string"||t}function yrt(t){return typeof t=="string"?t:void 0}const P4n=["$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"],xrt="NativeGzipValidationError",Uye=t=>t.length>=2&&t[0]===31&&t[1]===139,Ert=(t,e)=>t===bye.GZipJS||e===bye.GZipJS||e==="gzip",Brt=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError";let VK;const Jte=t=>{throw art(xrt,`Native gzip produced invalid output: ${t}`)},w4n=(brt=jg(function*(t,e){18>t.size&&Jte("too-short");const n=new Uint8Array(yield t.slice(0,10).arrayBuffer());Uye(n)&&n[2]===8||Jte("invalid-header");const o=new DataView(yield t.slice(t.size-8).arrayBuffer());o.getUint32(0,!0)!==(r=>{const s=(()=>{if(VK)return VK;VK=[];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;VK[A]=c>>>0}return VK})();let a=4294967295;for(let A=0;r.length>A;A++)a=s[255&(a^r[A])]^a>>>8;return(4294967295^a)>>>0})(e)&&Jte("invalid-crc");const i=e.length>>>0;o.getUint32(4,!0)!==i&&Jte("invalid-size")}),function(t,e){return brt.apply(this,arguments)});var brt;function Kye(){return Kye=jg(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=jg(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 w4n(c,i),c}catch(i){if(n?.rethrow)throw i;return e&&console.error("Failed to gzip compress data",i),null}var o}),Kye.apply(this,arguments)}function Srt(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 M4n={}.propertyIsEnumerable;function Wte(t,e){try{return Qrt(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function Vye(t,e,n,o){if(0>=n.remainingNodes)return{stringValue:Lye};if(n.remainingNodes--,hy(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:Bk(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:Lye};if(t instanceof Date){const i=t.getTime(),r=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:typeof r=="string"?Bk(r):String(r)}}n.ancestors.add(t);try{try{const i=t.toJSON;if(typeof i=="function")return Vye(i.call(t),e,n,o+1)}catch{}return as(t)?{arrayValue:{values:D4n(t,e,n,o+1)}}:{kvlistValue:{values:Qrt(t,e,n,o+1)}}}finally{n.ancestors.delete(t)}}return{stringValue:Bk(String(t))}}function D4n(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(Us(a))continue;i.push(Vye(a,e,n,o))}catch{i.push({stringValue:UK})}return t.length>s&&i.push({stringValue:Lye}),i}function Qrt(t,e,n,o){const i=[];for(const r in t)if(M4n.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(ad(s)||Bo(s))continue;i.push({key:Bk(r),value:Vye(s,e,n,o)})}catch{i.push({key:Bk(r),value:{stringValue:UK}})}}return i}function vrt(t,e,n){return sn(sn(sn(sn({},irt({},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 N4n=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function Prt(t,e){const n=irt({},t),o={};for(const i of N4n)({}).hasOwnProperty.call(n,i)&&(o[i]=n[i],delete n[i]);return[...Wte(n,e),...Wte(o,e)]}const wrt={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"},Mrt={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}},R4n=Mrt.info;function T4n(t){try{return Bk(String(t))}catch{return UK}}function k4n(t,e,n,o){const i=t.level||"info",{text:r,number:s}=Mrt[i]||R4n,a=(function(u=Date.now()){return String(u)+"000000"})(jd(o)?o:void 0),A={};e.distinctId&&(A.posthogDistinctId=e.distinctId),e.sessionId&&(A.sessionId=e.sessionId),e.windowId&&(A["window.id"]=e.windowId),Us(e.sessionStartTimestamp)||(A.sessionStartTimestamp=String(e.sessionStartTimestamp)),Us(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=UK}Object.defineProperty(c,h,{value:d,enumerable:!0,writable:!0,configurable:!0})}}const g={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:s,severityText:r,body:{stringValue:T4n(t.body)},attributes:Wte(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 Drt(t,e,n){return vrt(t,e,n)}function Nrt(t,e,n,o){return{resourceLogs:[{resource:{attributes:Prt(e)},scopeLogs:[{scope:{name:n,version:o},logRecords:t}]}]}}var Rrt=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=crt(()=>{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 Trt(){return .75+.5*Math.random()}function krt(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 F4n=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 Rrt(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new rrt,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(y9.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:k4n(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=as(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 jg(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return jg(function*(){var n;e.ps.clear();let o=(n=e._instance.getPersistedProperty(y9.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=Nrt(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(y9.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,u.kind==="fatal"))throw u.error}})()}Bs(e){var n=this;return jg(function*(){var o;const i=Math.max(0,e-n.bs),r=(o=n._instance.getPersistedProperty(y9.LogsQueue))!==null&&o!==void 0?o:[];n._instance.setPersistedProperty(y9.LogsQueue,r.slice(i)),yield n.vs()})()}qs(){return Drt(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var n;if(this._instance.optedOut)return;const o=(n=this._instance.getPersistedProperty(y9.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(y9.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(krt(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(y9.LogsQueue);return!!e&&e.length>0}shutdown(e){var n=this;return jg(function*(){n.ps.clear();const o=n.flush().catch(()=>{});e!==void 0?yield lrt(o,e):yield o})()}flushWithTimeout(e){var n=this;return jg(function*(){const o=n.flush();yield lrt(o,e,()=>{o.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=Trt(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const zye=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Frt(t){return String(t)+"000000"}function Lrt(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 L4n=class{constructor(e,n,o){this._instance=e,this.Rr=n,this.$=o,this.zs=new Map,this.ps=new Rrt(()=>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 rrt,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=jg(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=Lrt(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(zye.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,zye)]+=1;break}}}Os(e){const n=this.Rr.beforeSend;if(!n)return e;const o=as(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(krt(this.Rr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return jg(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=Trt()):(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 vrt(s,a,A)})(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Prt(o)},scopeMetrics:[{scope:{name:i,version:r},metrics:n}]}]};var n,o,i,r}vo(e){const n=Frt(Date.now()),o=new Map;for(const a of e.values()){var i;const A=Lrt(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=Wte((i=a.attributes)!==null&&i!==void 0?i:{},this.$),g=Frt(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:zye})}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 Hrt=(t,{debugEnabled:e}={})=>{const n={N(o,...i){Ln&&(_8.DEBUG||Ln.POSTHOG_DEBUG||e)&&!Bo(Ln.console)&&Ln.console&&("__rrweb_original__"in Ln.console[o]?Ln.console[o].__rrweb_original__:Ln.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)=>Hrt(`${t} ${o}`,i)};return n},gi=Hrt("[PostHog.js]"),Ad=gi.createLogger,H4n=Ad("[ExternalScriptsLoader]"),jte=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]}},PM=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return H4n.warn(`${e} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const o=jte(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(jte(e))return PM(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)},Jye={},Ort=(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)};Ur.__PosthogExtensions__=Ur.__PosthogExtensions__||{},Ur.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e==="remote-config"){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void PM(t,i,n)}const o=t.config.strict_script_versioning;if(o){const i=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=Jye[i];if(o==="fallback"&&r){if(jte(r))return void PM(t,r,n);delete Jye[i]}return void PM(t,i,o==="fallback"?(s,a)=>{if(s)if(typeof s=="string")n(s);else{var A;const c=Ort(t,e);Jye[i]=c;const l=jte(i);l==null||(A=l.parentNode)===null||A===void 0||A.removeChild(l),PM(t,c,n)}else n(void 0,a)}:n)}PM(t,Ort(t,e),n)},Ur.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{const o=t.requestRouter.endpointFor("api",e);PM(t,o,n)},_8.DEBUG=!1,_8.LIB_VERSION="1.434.16",_8.LIB_NAME="web";var Ym=_8;const O4n="$people_distinct_id",R4="distinct_id",Wye="$device_id",jye="$device_model",Xte="__alias",G4n="__cmpns",Grt="$fbc",bk="$fbc_persistence",Yrt="$fbp",zK="$fbp_persistence",Xye="__timers",Urt="$autocapture_disabled_server_side",qye="$heatmaps_enabled_server_side",$ye="$exception_capture_enabled_server_side",Krt="$error_tracking_suppression_rules",Zye="$error_tracking_capture_extension_exceptions",e2e="$web_vitals_enabled_server_side",t2e="$dead_clicks_enabled_server_side",n2e="$product_tours_enabled_server_side",Vrt="$logs_capture_enabled_server_side",zrt="$web_vitals_allowed_metrics",JK="$session_recording_remote_config",Y4n="$session_recording_enabled_server_side",U4n="$replay_sample_rate",K4n="$replay_override_sampling",V4n="$replay_override_linked_flag",z4n="$replay_override_url_trigger",J4n="$replay_override_event_trigger",Sk="$sesid",Jrt="$session_is_sampled",W4n="$session_past_minimum_duration",j4n="$session_recording_url_trigger_activated_session",X4n="$session_recording_event_trigger_activated_session",q4n="$debug_first_full_snapshot_timestamp",$4n="$sess_rec_flush_size",T4="$enabled_feature_flags",I8="$active_feature_flags",o2e="$early_access_features",wM="$feature_flag_details",rQ="$feature_flag_payloads",MM="$feature_flag_request_id",WK="$minimal_flag_called_events",E9="$override_feature_flags",DM="$override_feature_flag_payloads",sQ="$stored_person_properties",aQ="$stored_group_properties",Wrt="$groups",i2e="$surveys",qte="$surveys_loaded_at",jrt="$surveys_activated",Xrt="$surveys_activated_session",qrt="$surveys_activated_timestamps",r2e="ph_product_tours",Z4n="$product_tours_activated",eBn="$product_tours_activated_session",tBn="$conversations_widget_session_id",nBn="$conversations_ticket_id",oBn="$conversations_widget_state",iBn="$conversations_user_traits",AQ="$flag_call_reported",jK="$flag_call_reported_session_id",XK="$feature_flag_errors",cQ="$feature_flag_evaluated_at",py="$user_state",s2e="$client_session_props",rBn="$capture_rate_limit",$rt="$initial_campaign_params",Zrt="$initial_referrer_info",Qk="$initial_person_info",a2e="$epp",A2e="$posthog_cookieless",est="$cookieless_mode",tst="$sdk_debug_extensions_init_method",nst="$sdk_debug_extensions_init_time_ms",ost="$sdk_debug_recording_script_not_loaded",ist="$sdk_debug_replay_stale_config",sBn="$sdk_debug_replay_event_trigger_status",aBn="$sdk_debug_replay_linked_flag_trigger_status",ABn="$sdk_debug_replay_matched_recording_trigger_groups",cBn="$sdk_debug_replay_pending_trigger_conditions",lBn="$sdk_debug_replay_remote_trigger_matching_config",gBn="$sdk_debug_replay_trigger_groups_count",uBn="$sdk_debug_replay_url_trigger_status",dBn="$session_recording_start_reason",c2e="PostHog loadExternalDependency extension not found.",C8="anonymous",$te="identified",rst="identified_only",qK="visibilitychange",Zte="beforeunload",l2e="$pageview",sst="$pageleave",ast="$identify",Ast="$groupidentify";function vk(t,e){as(t)&&t.forEach(e)}function Ql(t,e){if(!Us(t))if(as(t))t.forEach(e);else if((n=>n instanceof FormData)(t))t.forEach((n,o)=>e(n,o));else for(const n in t)Qye.call(t,n)&&e(t[n],n)}const Bg=function(t,...e){for(const n of e)for(const o in n)n[o]!==void 0&&(t[o]=n[o]);return t};function ene(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 hBn=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)}}},g2e=function(t){const e={};return Ql(t,function(n,o){(nA(n)&&n.length>0||jd(n))&&(e[o]=n)}),e};function cst(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 pBn=["herokuapp.com","vercel.app","netlify.app"];function mBn(t){const e=t?.hostname;if(!nA(e))return!1;const n=e.split(".").slice(-2).join(".");for(const o of pBn)if(n===o)return!1;return!0}function ml(t,e,n,o){const{capture:i=!1,passive:r=!0}=o??{};t?.addEventListener(e,n,{capture:i,passive:r})}function u2e(t){return t.name==="ph_toolbar_internal"}const $K=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 jd(t)&&isFinite(t)&&Math.floor(t)===t});var _Bn=class Knt{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 Knt(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 Knt(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}},fBn=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 jd(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 _Bn.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 IBn}};let lst=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};Ln&&!Bo(Ln.crypto)&&crypto.getRandomValues&&(lst=t=>crypto.getRandomValues(t));var IBn=class{nextUint32(){return this.Rt.length>this.$t||(lst(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let gst;const k4=()=>CBn().toString(),CBn=()=>(gst||(gst=new fBn)).generate();let ZK="";const yBn=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Pk=null;const cd={Et(){if(!ad(Pk))return Pk;if(Pk=!1,No)try{const t=`__ph_cookie_support_${k4()}`;cd.At(t,"xyz"),Pk=$K(t)==='"xyz"',cd.Lt(t)}catch{Pk=!1}return Pk},Pt(t){gi.error("cookieStore error: "+t)},Ot:$K,Dt(t){let e;try{e=JSON.parse(cd.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(ZK)return ZK;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_"+k4();for(;!ZK&&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",ZK=_)}return ZK})(c);if(!g){const u=(h=>{const d=h.match(yBn);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||!ad($K(t))))try{cd.At(t,"",-1,e)}catch{return}}};let d2e=null;const uc={Et(){if(!ad(d2e))return d2e;let t=!0;if(Bo(Ln))t=!1;else try{const e="__mplssupport__";uc.At(e,"xyz"),uc.Ot(e)!=='"xyz"'&&(t=!1),uc.Lt(e)}catch{t=!1}return t||gi.error("localStorage unsupported; falling back to cookie store"),d2e=t,t},Pt(t){gi.error("localStorage error: "+t)},Ot(t){try{return Ln?.localStorage.getItem(t)}catch(e){uc.Pt(e)}return null},Dt(t){try{return JSON.parse(uc.Ot(t))||{}}catch{}return null},At(t,e){try{return Ln?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){uc.Pt(n)}return!1},Lt(t){try{Ln?.localStorage.removeItem(t)}catch(e){uc.Pt(e)}}},h2e=[sQ,I8,T4,wM,rQ,MM,cQ,XK,AQ],NM=[Wye,R4,Sk,Jrt,a2e,Qk,bk,py],tne=t=>t+"_cpm",xBn=["__proto__","constructor","prototype"],p2e=t=>{if(!xA(t))return{};const e={};return Object.keys(t).forEach(n=>{xBn.indexOf(n)===-1&&(e[n]=t[n])}),e},m2e=(t,e=[])=>{const n={};return[...NM,...e].forEach(o=>{const i=t[o];Bo(i)||ad(i)||i===""||(n[o]=i)}),n},ust=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)},dst=(t,e)=>({p:e,f:ust(JSON.stringify(t))}),hst=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const n=cd.Dt(tne(t)),o=n?.f===ust(e)&&as(n.p);return{properties:o?n.p:[],isValid:o}}catch{return{properties:[],isValid:!1}}},_2e=(t,e)=>e+"|"+(cd.Ot(tne(t))||""),wk={},f2e={Et:()=>!0,Pt(t){gi.error("memoryStorage error: "+t)},Ot:t=>t in wk?wk[t]:null,Dt:t=>t in wk?wk[t]:null,At:(t,e)=>(wk[t]=e,!0),Lt(t){delete wk[t]}};let RM=null;const Z0={Et(){if(!ad(RM))return RM;if(RM=!0,Bo(Ln))RM=!1;else try{const t="__support__";Z0.At(t,"xyz"),Z0.Ot(t)!=='"xyz"'&&(RM=!1),Z0.Lt(t)}catch{RM=!1}return RM},Pt(t){gi.error("sessionStorage error: ",t)},Ot(t){try{return Ln?.sessionStorage.getItem(t)}catch(e){Z0.Pt(e)}return null},Dt(t){try{return JSON.parse(Z0.Ot(t))||null}catch{}return null},At(t,e){try{return Ln?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){Z0.Pt(n)}return!1},Lt(t){try{Ln?.sessionStorage.removeItem(t)}catch(e){Z0.Pt(e)}}};var EBn=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 Pye(e)?1:fs(G5n,e)?0:-1}get qo(){const e=this.Rr.opt_out_capturing_persistence_type,n=e==="localStorage"?uc:cd,o=n.Et()?n:f2e;if(!this.Bo||this.Bo!==o){this.Bo=o;const i=e==="localStorage"?cd:uc;i.Ot(this.jo)&&(this.Bo.Ot(this.jo)||this.optInOut(Pye(i.Ot(this.jo))),i.Lt(this.jo,this.Rr.cross_subdomain_cookie))}return this.Bo}Lo(){return!!this.Rr.respect_dnt&&[F_?.doNotTrack,F_?.msDoNotTrack,Ur.doNotTrack,F_?.globalPrivacyControl].some(e=>Pye(e))}};function pst(t,e){var n;const o=t==null||(n=t.config)===null||n===void 0?void 0:n.get_current_url;if(!L_(o))return e;try{const i=o(e);return nA(i)&&i?i:e}catch(i){return gi.error("Error in get_current_url, falling back to window.location.href",i),e}}function mst(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 B9(t){return!!t&&t.nodeType===1}function j1(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function _st(t){return!!t&&t.nodeType===3}function I2e(t){return!!t&&t.nodeType===11&&B9(t.host)}function C2e(t){return t?Mte(t).split(/\s+/):[]}function fst(t,e){const n=(function(o){var i;const r=Ln==null||(i=Ln.location)===null||i===void 0?void 0:i.href;return Bo(r)?void 0:pst(o,r)})(e);return!!(n&&t&&t.some(o=>n.match(o)))}function Mk(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 C2e(e)}function Ist(t){return Us(t)?null:Mte(t).split(/(\s+)/).filter(e=>oV(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function eV(t){let e="";return Dk(t)&&!nV(t)&&t.childNodes&&t.childNodes.length&&Ql(t.childNodes,function(n){var o;_st(n)&&n.textContent&&(e+=(o=Ist(n.textContent))!==null&&o!==void 0?o:"")}),Mte(e)}function tV(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 y2e=["a","button","form","input","select","textarea","label"];function x2e(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 E2e(t,e){if(Bo(e))return!0;for(const n of t)if(e.some(o=>x2e(n,o)))return!0;return!1}function Cst(t){const e=t.parentNode;return!(!e||!B9(e))&&e}const B2e=[".ph-no-autocapture","[data-ph-no-autocapture]"],yst=["next","previous","prev",">","<"],BBn=[...yst,"+","-","−","–"],xst=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Est=[".ph-no-rageclick",".ph-no-capture"],bBn=["","text","search","email","password","url","tel","number"];function Bst(t,e){if(!Ln||b2e(t))return!1;let n,o,i;var r,s;if(hy(e)?(n=!!e&&Est,o=void 0,i=!1):(n=(r=e?.css_selector_ignorelist)!==null&&r!==void 0?r:Est,o=e?.content_ignorelist,i=(s=e?.ignore_text_selection)!==null&&s!==void 0&&s),n===!1||i&&(function(A){return!(!A||!B9(A))&&(!!j1(A,"textarea")||(j1(A,"input")?fs(bBn,(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}=bst(t,!1);return!(function(A,c){if(A===!1||Bo(A))return!1;let l;if(A===!0)l=yst;else{if(!as(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=>xst(g,h)||xst(u,h)))})(o,a.map(A=>{var c;return{safeText:eV(A).toLowerCase(),ariaLabel:((c=A.getAttribute("aria-label"))===null||c===void 0?void 0:c.toLowerCase().trim())||""}}))&&!E2e(a,n)}const b2e=t=>!t||j1(t,"html")||!B9(t),bst=(t,e)=>{if(!Ln||b2e(t))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const o=[t];let i=t;for(;i.parentNode&&!j1(i,"body");){if(I2e(i.parentNode)){o.push(i.parentNode.host),i=i.parentNode.host;continue}const r=Cst(i);if(!r)break;if(e||y2e.indexOf(r.tagName.toLowerCase())>-1)n=!0;else try{const s=Ln.getComputedStyle(r);s&&s.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}o.push(r),i=r}return{parentIsUsefulElement:n,targetElementList:o}};function Dk(t){const e=new Set;let n=0;for(let r=t;r.parentNode&&!j1(r,"body");r=r.parentNode){if(n++>=1e3||e.has(r))return!1;e.add(r);const s=Mk(r);if(fs(s,"ph-sensitive")||fs(s,"ph-no-capture"))return!1}if(fs(Mk(t),"ph-include"))return!0;const o=t.type||"";if(nA(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}const i=t.name||t.id||"";return!nA(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 nV(t){return!!(j1(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||j1(t,"select")||j1(t,"textarea")||t.getAttribute("contenteditable")==="true")}const Sst=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}))$"),Qst=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,SBn=[16,15,14,13],QBn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),vst=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Pst=/[0-9A-Za-z_]/;function vBn(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 oV(t,e=!0){return!(Us(t)||nA(t)&&(t=Mte(t),(e?Sst.test((t||"").replace(/[- ]/g,"")):(function(n){let o;for(Qst.lastIndex=0;o=Qst.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 SBn){const A=s+a;if(r.length>=A){const c=r.slice(s,A);if(Sst.test(c)&&vBn(c))return!0}}}return!1})(t))||(e?QBn.test(t):(function(n){let o;for(vst.lastIndex=0;o=vst.exec(n);){const i=o[1],r=o[3];if(!(i&&r&&Pst.test(i)&&Pst.test(r)))return!0}return!1})(t))))}function wst(t){let e=eV(t);return e=`${e} ${Mst(t)}`.trim(),oV(e)?e:""}function Mst(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Ql(t.childNodes,function(n){var o;if(n&&((o=n.tagName)===null||o===void 0?void 0:o.toLowerCase())==="span")try{const i=eV(n);e=`${e} ${i}`.trim(),n.childNodes&&n.childNodes.length&&(e=`${e} ${Mst(n)}`.trim())}catch(i){gi.error("[AutoCapture]",i)}}),e}function Dst(t){return t.replace(/"|\\"/g,'\\"')}function PBn(t){const e=t.attr__class;if(e)return as(e)?e:C2e(e)}const nne=Ad("[Dead Clicks]"),wBn=()=>!0,MBn=t=>{var e;const n=!!(!((e=t.instance.persistence)===null||e===void 0)&&e.get_property(t2e)),o=t.instance.config.capture_dead_clicks;return hy(o)?o:!!xA(o)||n};var Nst=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({[t2e]:n.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Uo()}):this.stop()}zo(e){var n,o,i;!((n=Ur.__PosthogExtensions__)===null||n===void 0)&&n.initDeadClicksAutocapture?e():(o=Ur.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this.instance,"dead-clicks-autocapture",r=>{r?nne.error("failed to load script",r):e()})}Uo(){var e;if(No){if(!this.Ho&&(!((e=Ur.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const n=xA(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=Ur.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Ho.start(No),nne.info("starting...")}}else nne.error("`document` not found. Cannot start.")}stop(){this.Ho&&(this.Ho.stop(),this.Ho=void 0,nne.info("stopping..."))}};const iV=Ad("[SegmentIntegration]");function Rst(t,e,n=!0){const o=t.config.segment;if(!o)return e();const{analytics:i,filterProperties:r}=(a=>L_(a.register))(s=o)?{analytics:s}:s;var s;(function(a,A,c,l){const g=h=>{const d=()=>h.anonymousId()||k4();a.config.get_device_id=d,l&&h.id()&&(a.register({distinct_id:h.id(),$device_id:d()}),a.persistence.set_property(py,$te)),c(l?void 0:h.anonymousId()||void 0)},u=A.user();"then"in u&&L_(u.then)?u.then(g):g(u)})(t,i,a=>{i.register(((A,c,{filterProperties:l}={})=>{typeof Promise<"u"&&Promise.resolve||iV.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()||(iV.info("No userId set, resetting PostHog"),A.reset()),d||(c=void 0),u.event.userId&&u.event.userId!==A.get_distinct_id()&&(iV.info("UserId set, identifying with PostHog"),A.identify(u.event.userId));let p=A.calculateEventProperties(h,u.event.properties);if(!Us(l)){const m=u.event.properties||{},_={};for(const I of Object.keys(p))Qye.call(m,I)||(_[I]=p[I]);const f=((I,C)=>{const y=as(I)?I:[I];let x=sn({},C);for(const E of y)try{if(x=E(x),Us(x))return null}catch(B){return iV.error("Error in Segment filterProperties:",B),null}return x})(l,_);if(Us(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,l2e)},identify(u){return g(u,ast)},screen(u){return g(u,"$screen")}}})(t,a,{filterProperties:r})).then(()=>{e()},A=>{iV.error("Failed to register the Segment integration",A),e()})},n)}const Tst="posthog-js";function kst(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 DBn=class{constructor(e,n,o,i,r,s){this.name=Tst,this.setupOnce=function(a){a(kst(e,{organization:n,projectId:o,prefix:i,severityAllowList:r,sendExceptionsToPostHog:s==null||s}))}}},Fst=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=Ln?.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?x9(a/s,0,1,gi):1,h=s>1?x9(A/s,0,1,gi):1,d=c>1?x9(l/c,0,1,gi):1,p=c>1?x9(g/c,0,1,gi):1;i=Bg(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 rV=["flags","surveys"],NBn={[O4n]:{exposure:"hidden"},[Xte]:{exposure:"hidden"},[G4n]:{exposure:"hidden"},[Xye]:{exposure:"hidden"},[bk]:{exposure:"hidden"},[zK]:{exposure:"hidden"},[Urt]:{exposure:"event"},[qye]:{exposure:"hidden"},[Vrt]:{exposure:"hidden"},[$ye]:{exposure:"event"},[Krt]:{exposure:"hidden"},[Zye]:{exposure:"event"},[e2e]:{exposure:"event"},[t2e]:{exposure:"event"},[n2e]:{exposure:"hidden"},[zrt]:{exposure:"event"},[JK]:{exposure:"hidden"},[Y4n]:{exposure:"hidden"},[Sk]:{exposure:"hidden"},[Jrt]:{exposure:"event"},[U4n]:{exposure:"event",shouldSkipFromEventProperties:t=>ad(t)},[W4n]:{exposure:"event"},[j4n]:{exposure:"event"},[X4n]:{exposure:"event"},[q4n]:{exposure:"event"},[$4n]:{exposure:"hidden"},[T4]:{exposure:"hidden",storageGroup:"flags"},[I8]:{exposure:"hidden",storageGroup:"flags"},[o2e]:{exposure:"hidden"},[wM]:{exposure:"hidden",storageGroup:"flags"},[rQ]:{exposure:"hidden",storageGroup:"flags"},[MM]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[WK]:{exposure:"hidden",storageGroup:"flags"},[E9]:{exposure:"hidden"},[DM]:{exposure:"hidden"},[sQ]:{exposure:"hidden"},[aQ]:{exposure:"hidden"},[i2e]:{exposure:"hidden",storageGroup:"surveys"},[qte]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[jrt]:{exposure:"event"},[Xrt]:{exposure:"hidden"},[qrt]:{exposure:"hidden"},[r2e]:{exposure:"hidden"},[Z4n]:{exposure:"hidden"},[eBn]:{exposure:"hidden"},[tBn]:{exposure:"event"},[nBn]:{exposure:"event"},[oBn]:{exposure:"event"},[iBn]:{exposure:"event"},[AQ]:{exposure:"hidden"},[jK]:{exposure:"hidden"},[Wrt]:{exposure:"event"},[XK]:{exposure:"hidden"},[cQ]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[py]:{exposure:"hidden"},[s2e]:{exposure:"hidden"},[rBn]:{exposure:"hidden"},[$rt]:{exposure:"hidden"},[Zrt]:{exposure:"hidden"},[Qk]:{exposure:"hidden"},[a2e]:{exposure:"hidden"},[K4n]:{exposure:"event"},[V4n]:{exposure:"event"},[z4n]:{exposure:"event"},[J4n]:{exposure:"event"},[tst]:{exposure:"event"},[nst]:{exposure:"event"},[ost]:{exposure:"event"},[ist]:{exposure:"event"},[sBn]:{exposure:"event"},[aBn]:{exposure:"event"},[ABn]:{exposure:"event"},[cBn]:{exposure:"event"},[lBn]:{exposure:"event"},[gBn]:{exposure:"event"},[uBn]:{exposure:"event"},[dBn]:{exposure:"event"}},RBn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Kf=t=>{const e=NBn[t];if(e)return e;for(const[n,o]of RBn)if(t.indexOf(n)===0)return o},Nk=(t,e)=>{try{let n;return JSON.stringify(t,(o,i)=>{var r;return xk(i)?((r=n)!==null&&r!==void 0||(n=new WeakMap),n.has(i)||n.set(i,cst(i)),n.get(i)):typeof i=="bigint"?i.toString():i},e)}catch{return yit(t)}},y8=t=>{const e=No?.createElement("a");return Bo(e)?null:(e.href=t,e)},Rk=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(!as(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," ")}},sV=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("=");as(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},one=function(t,e){const n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},Lst=(t,e)=>t>=e&&Cit(),Hst=(t,e,n,o)=>{if(t===0){if(Cit()){const i=e+1;return i===n&&o(),i}return e}return 0},Tk=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],TBn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Tk],aV="<masked>",kBn=["li_fat_id"];function Ost(t,e,n){if(!No)return{};const o=e?[...Tk,...n||[]]:[],i=Gst(sV(No.URL,o,aV),t),r=(function(){const s={};return Ql(kBn,function(a){const A=$K(a);s[a]=A||null}),s})();return Bg(r,i)}function Gst(t,e){const n=TBn.concat(e||[]),o={};return Ql(n,function(i){const r=Rk(t,i);o[i]=r||null}),o}function Yst(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(!ad(e)){o.$search_engine=e;const i=No?Rk(No.referrer,n):"";i.length&&(o.ph_keyword=i)}return o}function Ust(){return navigator.language||navigator.userLanguage}function FBn(){const t=Ust();return typeof t=="string"?t.split("-")[0]:void 0}const ine="$direct";function Kst(){return No?.referrer||ine}function Vst(t,e,n=!1){const o=t?[...Tk,...e||[]]:[],i=n?iQ(sd?.href):sd?.href,r=i?.substring(0,1e3);return{r:Kst().substring(0,1e3),u:r?sV(r,o,aV):void 0}}function zst(t,e=!1){var n;const{r:o,u:i}=t,r=e?iQ(i):i,s={$referrer:o,$referring_domain:o==null?void 0:o==ine?ine:(n=y8(o))===null||n===void 0?void 0:n.host};if(r){s.$current_url=r;const a=y8(r);s.$host=a?.host,s.$pathname=a?.pathname;const A=Gst(r);Bg(s,A)}if(o){const a=Yst(o);Bg(s,a)}return s}function Jst(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function LBn(){try{return new Date().getTimezoneOffset()}catch{return}}const HBn={flags:cQ,surveys:qte},OBn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],rne=t=>`${t}_cookie_identity_change_pending`,sne=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},Um="main",x8=[T4,I8,wM,rQ,MM,cQ,WK,sQ],S2e=t=>x8.indexOf(t)!==-1,Wst=[bk,zK],jst=t=>Wst.indexOf(t)!==-1,lQ=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch{return t===e}},kk=t=>{if(!t)return{};const e=JSON.parse(t);return xA(e)?e:{}},Xst=(t,e)=>{Ql(t,(n,o)=>{const i=Kf(o);i&&i.exposure!=="event"||{}.hasOwnProperty.call(e,o)||delete t[o]})};var Q2e=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(),Ln){const i=()=>this.flush();ml(Ln,"beforeunload",i,{capture:!1}),ml(Ln,"pagehide",i,{capture:!1}),this.fa=r=>{if(this.Ko&&(!r.storageArea||r.storageArea===Ln?.localStorage)&&r.key)if(r.key!==this.ha){if(this.Yo){const s=rV.find(a=>r.key===this.pa(a));s&&this.ga(r.key,s)}}else this.ga(r.key,Um)},ml(Ln,"storage",this.fa)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([n,o])=>{const i=this.ia.get(n);if(!S2e(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&&Ln&&(Ln.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=uc.Ot(e),ad(r)){const A=this.ya(n);return A.storageValue=null,n!==Um&&(A.persisted=!1),!1}i=kk(r)}catch{return!1}const s=n===Um?i:uc.Dt(this.ha);if(s&&this.ba(s))return!1;const a=this._a(i,n,o);return n===Um&&this.Yo&&!lQ(this.wa().main,i)||this.ka(i,n,!0,r),a}ba(e){const n=this.props[R4],o=e[R4];return!Bo(n)&&!Bo(o)&&n!==o}ka(e,n,o,i){const r=this.ya(n);r.storageValue=i,n!==Um&&(r.persisted=o);try{r.fingerprint=this.Sa(e,n)}catch{r.fingerprint=void 0}}_a(e,n,o){let i=!1;return x8.forEach(r=>{var s;const a=(s=Kf(r))===null||s===void 0?void 0:s.storageGroup;if(n===Um&&this.Yo&&a||n!==Um&&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&&lQ(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=uc.Ot(this.ha),n=this.ya(Um);let o,i=!1,r=!1;if(e!==n.storageValue)if(ad(e))n.storageValue=null;else{if(o=kk(e),this.ra=!this.sa&&this.ba(o),this.ra)return!1;r=this._a(o,Um,!1),!this.Yo||lQ(this.wa().main,o)?this.ka(o,Um,!0,e):n.storageValue=e,i=!0}return this.Yo&&rV.forEach(s=>{const a=uc.Ot(this.pa(s)),A=this.ya(s),c=o||{},l=i&&x8.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(ad(a))return A.storageValue=null,A.persisted=!1,void(l&&(r=this._a(c,s,!1)||r));const g=kk(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)||Um).fingerprint=void 0,this.Ia(e))}Ma(){x8.forEach(e=>this.ia.set(e,!0))}va(){if(this.Ko)try{const e=uc.Ot(this.ha),n=kk(e);this.ya(Um).storageValue=e,x8.forEach(o=>{var i;const r=this.Yo?(i=Kf(o))===null||i===void 0?void 0:i.storageGroup:void 0,s=r?uc.Ot(this.pa(r)):null;if(r){const A=this.ya(r);A.storageValue=s,A.persisted=!ad(s)}const a=r&&!ad(s)?kk(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(as(n)?n:[]),a=new Set(as(this.props[e])?this.props[e]:[]);return o.forEach(A=>a.has(A)?s.add(A):s.delete(A)),Array.from(s)}const i=xA(n)?sn({},n):{},r=xA(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(!S2e(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=kk(uc.Ot(c))[e]}catch{}const a=new Set(i||[]);if(e==="$active_feature_flags"){if(!Bo(n)&&!as(n)||!Bo(r)&&!as(r)||!as(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(!xA(o))return void(lQ(r,o)?this.ia.delete(e):this.ma(e,!0));{if(!Bo(n)&&!xA(n)||Bo(n)&&nx(o)&&Bo(r))return void this.ma(e,!0);const A=xA(n)?n:{},c=xA(r)?r:{};new Set([...Object.keys(A),...Object.keys(o)]).forEach(l=>{l in A==l in o&&lQ(A[l],o[l])||a.add(l)}),a.forEach(l=>{l in c==l in o&&lQ(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 jd(n)&&n>0?n:0}Ra(e){if(this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const n=m2e(e,this.Rr.cookie_persisted_properties||[]),o=dst(n,this.Rr.cookie_persisted_properties||[]),i=JSON.stringify(n)+"|"+JSON.stringify(o),r=cd.Ot(this.ha)||void 0;r&&_2e(this.ha,r)===i&&(this.Aa=i,this.Fa=r)}catch{}else try{const n=cd.Ot(this.ha)||void 0;this.Aa=n?_2e(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=cd.Ot(this.ha)||void 0}catch{}if(!o||o===this.Fa)return!1;const i=_2e(this.ha,o);let r;try{r=p2e(JSON.parse(o))}catch{return!1}if((cd.Ot(this.ha)||void 0)!==o)return!1;this.Aa=i,this.Fa=o;const s=hst(this.ha,o),a=[...NM,...s.properties],A={};if(Object.keys(r).forEach(m=>{const _=r[m];(Bo(_)||ad(_)||_===""||m==="$user_state"&&_!=="anonymous"&&_!=="identified")&&(A[m]=!0,delete r[m])}),nx(r))return!1;const c="distinct_id"in r||r.$user_state==="anonymous"||r.$user_state==="identified",l=this.props,g=l[R4],u=l[py],h=Bg({},l);[...NM,...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||NM.indexOf(m)===-1||_!==!1&&_!==0)&&delete h[m]}}),this.props=Bg(h,r),x8.forEach(m=>{const _=m in this.props;m in l===_&&lQ(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(py,C8);const d=this.props[R4],p=this.props[py];return!c||d===g&&p===u||(this.sa=!0,this.ta=!0,Z0.At(rne(this.ha),!0),this.$a(sQ),this.$a(I8),this.$a(T4),this.$a(wM),this.$a(rQ),this.$a(MM),this.$a(cQ),this.$a(XK),this.$a(AQ),p!=="anonymous"||u!=="identified"&&r.$user_state!=="anonymous"&&(Bo(g)||d===g)||(Xst(this.props,r),this.$a(aQ)),p==="identified"?this.props.$user_id=d:delete this.props.$user_id,this.$a(Xte)),!0}consumeCookieIdentityChange(){const e=rne(this.ha),n=this.ta||!!Z0.Ot(e);return this.ta=!1,n&&Z0.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[Um],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){OBn.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=[...NM,...a];return sn(sn({},uc),{},{Dt(l){try{let u,h={};try{u=cd.Ot(l)||void 0,h=u?p2e(JSON.parse(u)):{}}catch{}const d=JSON.parse(uc.Ot(l)||"{}");let p;if(A){const m=hst(l,u),_=[...NM,...m.properties],f={};Object.keys(h).forEach(C=>{const y=h[C];ad(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[R4],y=(g=d.$user_state)!==null&&g!==void 0?g:C8;c.forEach(x=>{if(_.indexOf(x)!==-1&&!(x in h)&&(I||x!=="distinct_id"&&x!=="$user_state")){const E=d[x];(m.isValid||NM.indexOf(x)===-1||E!==!1&&E!==0)&&delete d[x]}}),!I||"$user_state"in h||"$user_state"in d||(d[py]=C8),!I||("distinct_id"in f?f[R4]:d[R4])===C&&("$user_state"in f?f[py]:d[py])===y||(h2e.forEach(x=>delete d[x]),f.$user_state==="identified"&&"distinct_id"in f?d.$user_id=f[R4]:delete d.$user_id,f.$user_state!=="identified"&&(delete d[Wrt],delete d[aQ]),delete d.__alias)}p=Bg(d,f)}else p=Bg(h,d);return uc.At(l,p),p}catch{}return null},At(l,g,u,h,d,p){const m=uc.At(l,g,void 0,void 0,p);try{const _=m2e(g,a);if(Object.keys(_).length){if(A){const f=tne(l),I=dst(_,a);if(cd.At(f,I,u,h,d,p),cd.Ot(f)!==JSON.stringify(I)){cd.Lt(f,h);const C=m2e(g);return cd.At(l,C,u,h,d,p),m}}cd.At(l,_,u,h,d,p)}}catch(_){uc.Pt(_)}return m},Lt(l,g){try{Ln?.localStorage.removeItem(l),cd.Lt(l,g),cd.Lt(tne(l),g)}catch(u){uc.Pt(u)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let o,i=!1,r=!1;const s=e.persistence.toLowerCase();return s==="localstorage"&&uc.Et()?(o=uc,r=!0):s==="localstorage+cookie"&&n.Et()?(o=n,r=!0,i=!0):s==="sessionstorage"&&Z0.Et()?o=Z0:s==="memory"?o=f2e:s==="cookie"&&cd.Et()?(o=cd,i=!0):n.Et()?(o=n,r=!0,i=!0):cd.Et()?(o=cd,i=!0):o=f2e,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 Ql(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?uc.Dt(this.ha):null;let i={};if(n)try{i=p2e(cd.Dt(this.ha)),Ql(i,(A,c)=>{(Bo(A)||ad(A)||A==="")&&delete i[c]})}catch{}const r=this.qo.Dt(this.ha);if(r&&(this.props=Bg({},r)),this.Yo&&this.Ba(),n&&r){var s,a;const A=o?.[R4],c=(s=o?.$user_state)!==null&&s!==void 0?s:C8,l=r[R4],g=(a=r.$user_state)!==null&&a!==void 0?a:C8;if(l!==A||g!==c){this.ta=!0,Z0.At(rne(this.ha),!0);const u=Bg({},this.props);h2e.forEach(d=>delete u[d]),g!=="anonymous"||c!=="identified"&&i.$user_state!=="anonymous"&&(Bo(A)||l===A)||(Xst(u,i),delete u[aQ]),this.props=u;const h=new Set;h2e.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={};Ql(this.props,(m,_)=>{var f;((f=Kf(_))===null||f===void 0?void 0:f.storageGroup)===d&&(p[_]=m)}),nx(p)?(uc.Lt(this.pa(d)),this.Jo[d]={}):uc.At(this.pa(d),p)&&(this.Jo[d]={persisted:!0,fingerprint:this.Sa(p,d)})})}}Z0.Ot(rne(this.ha))&&(this.ta=!0)}Ba(){for(const e of rV){const n=uc.Dt(this.pa(e));if(n&&!nx(n)){const o=this.ya(e);o.persisted=!0,this.Ha(e)||(o.fingerprint=this.Sa(n,e)),this.za(e,n)||Bg(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=HBn[e];if(!o)return!1;const i=n[o],r=this.props[o];return jd(i)&&jd(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?uc.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"||Wst.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,Um);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,Um);o==="written"&&this.Ra(e),o!=="failed"&&(this.sa=!1,this.oa.clear(),x8.forEach(r=>{var s;!((s=Kf(r))===null||s===void 0)&&s.storageGroup||this.ia.delete(r)}));for(const r of rV){var i;const s=n[r];if(nx(s)&&!(!((i=this.Jo[r])===null||i===void 0)&&i.persisted)){x8.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(uc,this.pa(r),s,r);a!=="failed"&&x8.forEach(A=>{const c=Kf(A);c?.storageGroup!==r||a!=="written"&&c.volatile||this.ia.delete(A)})}}wa(){const e={},n={flags:{},surveys:{}};return Ql(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===Um)return JSON.stringify(e)+"|"+this.Va+"|"+this.Ga+"|"+this.Za;const o={};return Ql(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!==Um&&!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!==Um&&(r.persisted=!0),Bo(s)||(r.fingerprint=s),this.Ko&&(r.storageValue=uc.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 rV)uc.Lt(this.pa(n));e?delete this.Jo[Um]:this.Jo={},this.Aa=void 0,this.Fa=void 0}clear(){this.remove(),this.props={}}register_once(e,n,o){if(xA(e)){this.syncCookieProperties(),Bo(n)&&(n="None"),this.Va=Bo(o)?this.Qa:o;let i=!1;if(Ql(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(xA(e)){this.syncCookieProperties(),this.Va=Bo(n)?this.Qa:n;let o=!1;if(Ql(e,(i,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==i||xA(i)||as(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=Ost(this.Rr.custom_campaign_params,this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties),o=!nx(g2e(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?Yst(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:Kst(),$referring_domain:No?.referrer&&((e=y8(No.referrer))===null||e===void 0?void 0:e.host)||ine},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=Vst(this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties,this.Rr.disable_capture_url_hashes);this.register_once({[Qk]:this.Xo?{r:sne(e.r),u:e.u?sne(e.u):void 0}:e},void 0)}get_initial_props(){const e={};Ql([Zrt,$rt],o=>{const i=this.props[o];i&&Ql(i,function(r,s){e["$initial_"+Sye(s)]=r})});const n=this.props[Qk];if(n){const o=(function(i,r=!1){const s=zst(i,r),a={};return Ql(s,function(A,c){a[`$initial_${Sye(c)}`]=A}),a})(n,this.Rr.disable_capture_url_hashes);Bg(e,o)}return e}safe_merge(e){return Ql(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[Um],this.qa()))}finally{this.na=!1,h&&this.ja()}}Ja(){const e=this.props[Qk];if(!this.Xo||!xA(e)||typeof e.r!="string")return;const n=sne(e.r),o=typeof e.u=="string"?sne(e.u):e.u;n===e.r&&o===e.u||this.Ca(Qk,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(Xye,o),this.save()}remove_event_timer(e){const n=this.props.__timers||{},o=n[e];return Bo(o)||(delete n[e],this.Ca(Xye,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),jst(e)&&!lQ(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&&(S2e(e)&&this.ma(e,!0),jst(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 M3={GZipJS:"gzip-js",Base64:"base64"},AV={Activation:"events",Cancellation:"cancelEvents"},v2e={Popover:"popover",API:"api",Widget:"widget"},E8={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},P2e={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},w2e={Popover:"popover",Inline:"inline"};function ane(t){let e=!0;return{dispose(){if(e){e=!1;const n=t();n&&L_(n.then)&&n.then(void 0,()=>{})}}}}const GBn={SHOWN:"product tour shown"},qst={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},$st=Ad("[RateLimiter]");var YBn=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=>{$st.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void $st.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=(jd(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!as(n)||!n.includes(e)}Ya(){var e;if(this.Xa("$current_url")&&this.Xa("$pathname")&&sd?.pathname)return`${(e=sd.origin)!==null&&e!==void 0?e:""}${sd.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 gQ=Ad("[RemoteConfig]");var Zst=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Ur._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=Ur.__PosthogExtensions__)===null||n===void 0)&&n.loadExternalDependency?(o=Ur.__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 gQ.info("Using preloaded remote config",this.remoteConfig),void this.il(this.remoteConfig);if(this._instance.nl())return void gQ.warn("Remote config is disabled. Falling back to local config.");this.tl(e=>{if(!e)return gQ.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){gQ.error("Error loading remote config",e),this.il()}}il(e,n){!e&&n&&(n.statusCode===0?n.error||gQ.warn("Failed to fetch remote config from PostHog."):gQ.error("Failed to fetch remote config from PostHog."));try{this._instance.il(e?{ok:!0,config:e}:{ok:!1})}catch(i){gQ.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){gQ.error("Error loading feature flags",i)}}},d5=Uint8Array,ox=Uint16Array,Fk=Uint32Array,M2e=new d5([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]),D2e=new d5([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]),eat=new d5([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tat=function(t,e){for(var n=new ox(31),o=0;31>o;++o)n[o]=e+=1<<t[o-1];var i=new Fk(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]},nat=tat(M2e,2),N2e=nat[1];nat[0][28]=258,N2e[258]=28;for(var oat=tat(D2e,0)[1],iat=new ox(32768),ld=0;32768>ld;++ld){var Lk=(43690&ld)>>>1|(21845&ld)<<1;iat[ld]=((65280&(Lk=(61680&(Lk=(52428&Lk)>>>2|(13107&Lk)<<2))>>>4|(3855&Lk)<<4))>>>8|(255&Lk)<<8)>>>1}var cV=function(t,e,n){for(var o=t.length,i=0,r=new ox(e);o>i;++i)++r[t[i]-1];var s,a=new ox(e);for(i=0;e>i;++i)a[i]=a[i-1]+r[i-1]<<1;for(s=new ox(o),i=0;o>i;++i)s[i]=iat[a[t[i]-1]++]>>>15-t[i];return s},TM=new d5(288);for(ld=0;144>ld;++ld)TM[ld]=8;for(ld=144;256>ld;++ld)TM[ld]=9;for(ld=256;280>ld;++ld)TM[ld]=7;for(ld=280;288>ld;++ld)TM[ld]=8;var Ane=new d5(32);for(ld=0;32>ld;++ld)Ane[ld]=5;var UBn=cV(TM,9),KBn=cV(Ane,5),rat=function(t){return(t/8|0)+(7&t&&1)},sat=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var o=new(t instanceof ox?ox:t instanceof Fk?Fk:d5)(n-e);return o.set(t.subarray(e,n)),o},B8=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8},lV=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8,t[o+2]|=n>>>16},R2e=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 d5(0),0];if(i==1){var s=new d5(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 ox(u+1),d=T2e(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 d5(h),d]},T2e=function(t,e,n){return t.s==-1?Math.max(T2e(t.l,e,n+1),T2e(t.r,e,n+1)):e[t.s]=n},aat=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new ox(++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]},gV=function(t,e){for(var n=0,o=0;e.length>o;++o)n+=t[o]*e[o];return n},k2e=function(t,e,n){var o=n.length,i=rat(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)},Aat=function(t,e,n,o,i,r,s,a,A,c,l){B8(e,l++,n),++i[256];for(var g=R2e(i,15),u=g[0],h=g[1],d=R2e(r,15),p=d[0],m=d[1],_=aat(u),f=_[0],I=_[1],C=aat(p),y=C[0],x=C[1],E=new ox(19),B=0;f.length>B;++B)E[31&f[B]]++;for(B=0;y.length>B;++B)E[31&y[B]]++;for(var S=R2e(E,7),Q=S[0],P=S[1],M=19;M>4&&!Q[eat[M-1]];--M);var k,R,F,O,U=c+5<<3,Y=gV(i,TM)+gV(r,Ane)+s,J=gV(i,u)+gV(r,p)+s+14+3*M+gV(E,Q)+(2*E[16]+3*E[17]+7*E[18]);if(Y>=U&&J>=U)return k2e(e,l,t.subarray(A,A+c));if(B8(e,l,1+(Y>J)),l+=2,Y>J){k=cV(u,h),R=u,F=cV(p,m),O=p;var ee=cV(Q,P);for(B8(e,l,I-257),B8(e,l+5,x-1),B8(e,l+10,M-4),l+=14,B=0;M>B;++B)B8(e,l+3*B,Q[eat[B]]);l+=3*M;for(var W=[f,y],X=0;2>X;++X){var ie=W[X];for(B=0;ie.length>B;++B)B8(e,l,ee[se=31&ie[B]]),l+=Q[se],se>15&&(B8(e,l,ie[B]>>>5&127),l+=ie[B]>>>12)}}else k=UBn,R=TM,F=KBn,O=Ane;for(B=0;a>B;++B)if(o[B]>255){var se;lV(e,l,k[257+(se=o[B]>>>18&31)]),l+=R[se+257],se>7&&(B8(e,l,o[B]>>>23&31),l+=M2e[se]);var oe=31&o[B];lV(e,l,F[oe]),l+=O[oe],oe>3&&(lV(e,l,o[B]>>>5&8191),l+=D2e[oe])}else lV(e,l,k[o[B]]),l+=R[o[B]];return lV(e,l,k[256]),l+R[256]},VBn=new Fk([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),zBn=(function(){for(var t=new Fk(256),e=0;256>e;++e){for(var n=e,o=9;--o;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),F2e=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function JBn(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=zBn[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 d5(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=k2e(I,C,g.subarray(y,x)):(I[y]=m,C=k2e(I,C,g.subarray(y,_)))}else{for(var E=VBn[u-1],B=E>>>13,S=8191&E,Q=(1<<h)-1,P=new ox(32768),M=new ox(Q+1),k=Math.ceil(h/3),R=2*k,F=function(Ce){return(g[Ce]^g[Ce+1]<<k^g[Ce+2]<<R)&Q},O=new Fk(25e3),U=new ox(288),Y=new ox(32),J=0,ee=0,W=(y=0,0),X=0,ie=0;_>y;++y){var se=F(y),oe=32767&y,ge=M[se];if(P[oe]=ge,M[se]=oe,y>=X){var ue=_-y;if((J>7e3||W>24576)&&ue>423){C=Aat(g,I,0,O,U,Y,ee,W,ie,y-ie,C),W=J=ee=0,ie=y;for(var Ie=0;286>Ie;++Ie)U[Ie]=0;for(Ie=0;30>Ie;++Ie)Y[Ie]=0}var le=2,_e=0,he=S,ye=oe-ge&32767;if(ue>2&&se==F(y-ye))for(var Qe=Math.min(B,ue)-1,Pe=Math.min(32767,y),me=Math.min(258,ue);Pe>=ye&&--he&&oe!=ge;){if(g[y+le]==g[y+le-ye]){for(var ve=0;me>ve&&g[y+ve]==g[y+ve-ye];++ve);if(ve>le){if(le=ve,_e=ye,ve>Qe)break;var we=Math.min(ye,ve-2),Me=0;for(Ie=0;we>Ie;++Ie){var He=y-ye+Ie+32768&32767,ke=He-P[He]+32768&32767;ke>Me&&(Me=ke,ge=He)}}}ye+=(oe=ge)-(ge=P[oe])+32768&32767}if(_e){O[W++]=268435456|N2e[le]<<18|oat[_e];var be=31&N2e[le],Te=31&oat[_e];ee+=M2e[be]+D2e[Te],++U[257+be],++Y[Te],X=y+le,++J}else O[W++]=g[y],++U[g[y]]}}C=Aat(g,I,m,O,U,Y,ee,W,ie,y-ie,C)}return sat(f,0,d+rat(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&&F2e(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),F2e(c,l-8,n.d()),F2e(c,l-4,o),c}const WBn=!!Bye||!!HK,cat=new WeakMap,lat="text/plain";let L2e=0,cne=!1;const gat=(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}`:""}`},uV=(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 Ql(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},H2e=t=>{if(t.sl)return t.sl;const{data:e,compression:n}=t;if(!e)return;if(n===M3.GZipJS){const i=JBn((function(r){var s=r.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(r);for(var a=new d5(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 d5(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 sat(a,0,A)})(Nk(e)),{mtime:0});return{contentType:lat,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===M3.Base64){const i=(function(s){return s&&btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g,(a,A)=>String.fromCharCode(parseInt(A,16))))})(Nk(e)),r=(s=>"data="+encodeURIComponent(typeof s=="string"?s:Nk(s)))(i);return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}const o=Nk(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}},uat=t=>{const e=()=>t.transport==="sendBeacon"?{url:uV(t.url,{compression:M3.Base64}),encodedBody:H2e(sn(sn({},t),{},{compression:M3.Base64,sl:void 0}))}:{url:gat(t.url,"compression"),encodedBody:H2e(sn(sn({},t),{},{compression:void 0,sl:void 0}))};let n;try{n=H2e(t)}catch(i){if(Ert(t.compression,Rk(t.url,"compression")))return gi.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return n&&Ert(t.compression,Rk(t.url,"compression"))&&!((o=n.body)instanceof ArrayBuffer?Uye(new Uint8Array(o)):ArrayBuffer.isView(o)&&Uye(new Uint8Array(o.buffer,o.byteOffset,o.byteLength)))?(cne=!0,e()):{url:t.url,encodedBody:n};var o},dat=t=>{try{return uat(t)}catch(n){var e;return gi.error(n),void((e=t.callback)===null||e===void 0||e.call(t,{statusCode:0,error:n}))}},jBn=(function(){var t=jg(function*(e){const n=yield(function(i){return Kye.apply(this,arguments)})(Nk(e.data),Ym.DEBUG,{rethrow:!0});if(!n)return e;const o=yield n.arrayBuffer();return sn(sn({},e),{},{sl:{contentType:lat,body:o,estimatedSize:o.byteLength}})});return function(e){return t.apply(this,arguments)}})(),XBn=/Failed to fetch|NetworkError|Load failed/i,hat=t=>t?.name==="TypeError"&&XBn.test(t?.message||""),pat=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,Yte):void 0})(t());return Bo(e)?void 0:Math.min(e,3e4)}catch{return}},mat=t=>{const e=dat(t);if(!e)return;const n=new Bye;cat.set(n,!0);const{url:o,encodedBody:i}=e;n.open(t.method||"GET",o,!0);const{contentType:r,body:s}=i??{};Ql(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,pat(()=>n.getResponseHeader("Retry-After")))}},n.send(s)},_at=t=>{const e=dat(t);if(!e)return;const{url:n,encodedBody:o}=e,{contentType:i,body:r,estimatedSize:s}=o??{},a=new Headers;Ql(t.headers,function(d,p){a.append(p,d)}),i&&a.append("Content-Type",i);let A=null,c=!1;if(Iit){const d=new Iit;A={signal:d.signal,timeout:setTimeout(()=>{c=!0;try{d.abort(art("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"||hat(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=()=>{L2e-=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>L2e+p,d.keepalive&&(u=p,L2e+=u),HK(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,pat(()=>m.headers.get("Retry-After")))})).catch(m=>{h(),g(m)}).finally(h)}catch(d){h(),g(d)}},O2e=t=>{try{var e;const{url:n,encodedBody:o}=uat(t),{contentType:i,body:r,estimatedSize:s}=o??{};if(!r)return;const a=r instanceof Blob?r:new Blob([r],{type:i});if(F_.sendBeacon(n,a))return;const A=as(t.data)?t.data:(e=t.data)===null||e===void 0?void 0:e.batch;if(as(A)&&A.length>1&&(s??0)>16384){const c=Math.ceil(A.length/2),l=g=>as(t.data)?g:sn(sn({},t.data),{},{batch:g});return O2e(sn(sn({},t),{},{data:l(A.slice(0,c))})),void O2e(sn(sn({},t),{},{data:l(A.slice(c))}))}gi.warn(`Beacon of ~${s??0} bytes was rejected by the browser, falling back to ${HK?"fetch":"XHR"}`),HK?_at(sn(sn({},t),{},{rl:!0})):mat(t)}catch(n){gi.warn("Beacon send failed",n)}},fat=(t,e,n,o)=>{const i=o==="query"?e==="POST"?"sent_at":"_":void 0;return uV(n===M3.GZipJS?gat(t,"compression"):t,sn(sn({},i?{[i]:Date.now().toString()}:{}),n===M3.GZipJS?{}:{compression:n}))},qBn=(()=>{const t=[];return HK&&t.push({transport:"fetch",method:_at}),Bye&&t.push({transport:"XHR",method:mat}),F_?.sendBeacon&&t.push({transport:"sendBeacon",method:O2e}),t})();let Iat=!WBn&&dy?.indexOf("MSIE")===-1&&dy?.indexOf("Mozilla")===-1;function Cat(t,e,n){var o,i,r;n&&(e=sn(sn({},e),{},{callback:s=>n(s)})),t.__loaded?Iat?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=M3.Base64),g.method==="POST"&&g.data&&(g.timestampMode==="capture-body"?g.data=(m=>{var _,f;const I=(as(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())=>as(m)?m.map(f=>sn(sn({},f),{},{sent_at:_})):sn(sn({},m),{},{sent_at:_}))(g.data))),g.url=fat(g.url,g.method,g.compression,g.timestampMode);const h=qBn.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 _;hat(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===M3.GZipJS&&R5n&&typeof Promise<"u"&&!cne?jBn(g).then(m=>{p(m)}).catch(m=>{if(Brt(m))return cne=!0,void p(sn(sn({},g),{},{compression:void 0,url:fat(s.url,s.method,void 0,s.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;const f="name"in _?String(_.name):"";return Brt(_)||f===xrt})(m)&&(cne=!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 $Bn=class{constructor(e,n){this.ol=!0,this.al=[],this.ll=x9(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 Ql(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 ZBn=["retriesPerformedSoFar"];var e9n=class{constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.al=[],this.al=[],this.ml=!0,this.resume()}resume(){if(!Bo(Ln)&&"onLine"in Ln.navigator){if(this.ml=Ln.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.bl()},this._l=()=>{this.ml=!1},ml(Ln,"online",this.yl),ml(Ln,"offline",this._l)}}get length(){return this.al.length}retriableRequest(e,n){let{retriesPerformedSoFar:o}=e,i=Srt(e,ZBn);f8(o)&&(i.url=uV(i.url,{retry_count:o})),Cat(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(Ln)||(this.yl&&(Ln.removeEventListener("online",this.yl),this.yl=void 0),this._l&&(Ln.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=[]}},t9n=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(){ml(Ln,"scroll",this.Sl,{capture:!0}),ml(Ln,"scrollend",this.Sl,{capture:!0}),ml(Ln,"resize",this.Sl)}scrollElement(){if(this.Cl){const o=as(this.Cl)?this.Cl:[this.Cl];for(const i of o){var e;const r=Ln==null||(e=Ln.document)===null||e===void 0?void 0:e.querySelector(i);if(r)return r}return}var n;return Ln==null||(n=Ln.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 Ln?e==="y"?Ln.scrollY||Ln.pageYOffset||((n=Ln.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.scrollTop)||0:Ln.scrollX||Ln.pageXOffset||((o=Ln.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 n9n=t=>Vst(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes);var yat=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({[s2e]:a})},this._instance=e,this.El=n,this.Ml=o,this.Il=i||n9n,this.El.onSessionId(this.Be)}Tl(){return this.Ml.props[s2e]}getSetOnceProps(){var e;const n=(e=this.Tl())===null||e===void 0?void 0:e.props;return n?"r"in n?zst(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 Ql(g2e(this.getSetOnceProps()),(n,o)=>{o==="$current_url"&&(o="url"),e[`$session_entry_${Sye(o)}`]=n}),e}},lne=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 Hk=Ad("[SessionId]"),xat=864e5;var Eat=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 lne,this.Nl=(s,a)=>!(!f8(s)||!f8(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||k4,this.Bl=o||k4;const r=this.Rr.persistence_name||this.Rr.token;if(this._sessionTimeoutMs=1e3*x9(this.Rr.session_idle_timeout_seconds||1800,60,36e3,Hk.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=Z0.Dt(this.zl),a=Z0.Dt(this.Ul);s&&!a?this.He=s:Z0.Lt(this.zl),Z0.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&&Z0.Et()}Gl(e){e!==this.He&&(this.He=e,this.Wl()&&Z0.At(this.zl,e))}Zl(){return this.He?this.He:this.Wl()?Z0.Dt(this.zl):null}Ql(e){const n=this.Al;return!ad(n)&&!ad(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({[Sk]:[n,e,o]}))}Kl(){var e;const n=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return f8(n)&&n>0}Xl(){this.Kl()?this.Ml.refreshKey(Sk):(this.Ml.flush(),this.Ml.load())}Yl(){var e;if(ad(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({[Sk]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Ml.flush())}eu(){const[e]=this.tu(),n=f8(e)?e:0,o=f8(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[Sk];return as(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 Hk.error("Bootstrap sessionID cannot be in the future"):s}catch(s){return void Hk.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&&Ln&&(Ln.removeEventListener(Zte,this.Dl,{capture:!1}),this.Dl=void 0),this.Ol=[]}Vl(){this.Dl=()=>{this.Yl(),this.Wl()&&Z0.Lt(this.Ul)},ml(Ln,Zte,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(ad(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>xat),p=h?d:f8(c)&&Math.abs(i-c)>xat;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||Hk.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(),Hk.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,_&&(Hk.info("adopted cross-tab session id",{sessionId:A,windowId:u}),m=!0);const y=f8(g)&&e&&!p?g:i,x=f8(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 Bat=function(t,e){if(!t)return!1;const n=t.userAgent;if(n&&Sit(n,e))return!0;try{const o=t?.userAgentData;if(o?.brands&&o.brands.some(i=>Sit(i?.brand,e)))return!0}catch{}return!!t.webdriver};function bat(){return(bat=jg(function*(){const t=F_?.userAgentData;if(t?.getHighEntropyValues)try{const e=yield t.getHighEntropyValues(["model"]),n=e?.model;return nA(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 o9n(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 Sat(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 gne=(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}},une=t=>t.toLowerCase(),Qat={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=>gne(n,o))),not_regex:(t,e)=>e.every(n=>t.every(o=>!gne(n,o))),icontains:(t,e)=>e.map(une).some(n=>t.map(une).some(o=>n.includes(o))),not_icontains:(t,e)=>e.map(une).every(n=>t.map(une).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 vat(t,e){return!t||Object.entries(t).every(([n,o])=>{const i=e?.[n];if(i==null)return!1;const r=Qat[o.operator];return!!r&&r(o.values.map(String),[String(i)])})}function G2e(t,e,n){return Nk({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}const Y2e="custom",Pat="i.posthog.com",i9n=/^\/static\//,r9n=["/s/","/e/","/i/"];var s9n=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(`.${Pat}`,".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":Y2e),this.su[this.apiHost]}ru(e){if(!i9n.test(e))return;const n=this.instance.config.asset_host;return typeof n=="string"&&n.trim().replace(/\/$/,"")||void 0}ou(e){const n=y8(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=y8(o))===null||s===void 0?void 0:s.href)||o;i=r(new URL(a)).toString()}if(r&&e==="api"&&r9n.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===Y2e)return this.au(e,n,this.apiHost+n);const o=Pat+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 vl=Ad("[Surveys]"),wat=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){vl.error("Failed to persist survey seen state",e)}},a9n=[v2e.Popover,v2e.Widget,v2e.API],A9n={ignoreConditions:!1,ignoreDelay:!1,displayType:w2e.Popover},c9n=Ad("[PostHog ExternalIntegrations]"),l9n={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var g9n=class{constructor(e){this._instance=e}zo(e,n){var o,i;(o=Ur.__PosthogExtensions__)===null||o===void 0||(i=o.loadExternalDependency)===null||i===void 0||i.call(o,this._instance,e,r=>{if(r)return c9n.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=Ur.__PosthogExtensions__)===null||n===void 0||(n=n.integrations)===null||n===void 0)&&n[r])&&this.zo(l9n[r],()=>{var a;(a=Ur.__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=Ur.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0)&&o[r])&&((i=Ur.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0||(i=i[r])===null||i===void 0||i.stop())}}},u9n=class{constructor(e,n){this.$=e,this.wo=n,this.uu=new Map,this.Io=!1}add(e){var n=this;return jg(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&&L_(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)}}},d9n=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 Mat="extensionsRemoteConfig";var h9n=class{constructor(e){this.instance=e,this.Io=!1,this.$=gi,this.cu=e.du,this.kv=new d9n(e),this.onEvent=n=>ane(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 ane(()=>{});const o=r=>{try{n(r)}catch(s){this.$.error("Browser extension remote config listener failed",s)}},i=this.instance.vu.on(Mat,o);return this.cu&&o(this.cu),ane(i)},this.fu=new u9n(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(Wye);return typeof e=="string"?e:void 0}get library(){return{name:Ym.LIB_NAME,version:Ym.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 ane(this.instance.pu(e))}handleRemoteConfig(e){this.Io||(this.cu=e,this.instance.vu.emit(Mat,e))}sendRequest(e){var n=this;return jg(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?uV(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"?bye.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 dV={};let U2e=0;const hV=()=>{},Dat='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',pV="Surveys module not available",Nat="sanitize_properties is deprecated. Use before_send instead",Rat="Invalid value for property_denylist config: ",p9n=/^[A-Za-z0-9_-]{1,400}$/,Tat=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,kat=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,m9n=["token","distinct_id",est],mV="posthog",_9n=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},K2e=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:mBn(No?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:hV,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:sd&&nA(sd?.search)&&sd.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:(Ln==null||(e=Ln.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:rst,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:hV},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:BBn,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:_9n(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))},f9n=[["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"]],Fat=t=>{const e={};for(const[i,r]of f9n)Bo(t[i])||(e[r]=t[i]);const n=Bg({},e,t),o=t.__preview_external_dependency_versioned_paths;return Bo(o)||(Bo(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),nA(o)&&Bo(t.asset_host)&&(n.asset_host=o)),as(t.property_blacklist)&&(Bo(t.property_denylist)?n.property_denylist=t.property_blacklist:as(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:gi.error(Rat+t.property_denylist)),n};var I9n=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}},_V=class EM{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(k4());this.register({distinct_id:o,$device_id:o}),e.set_property(py,C8)}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 I9n,this.Iu=!1,this.version=Ym.LIB_VERSION,this.Mu=new Set,this.Eu="",this.vu=new lne,this.uu=[],this.Pu=[],this.ku=!1,this.wu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=K2e(),this.SentryIntegration=DBn,this.sentryIntegration=o=>(function(i,r){const s=kst(i,r);return{name:Tst,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 t9n(this),this.pageViewManager=new Fst(this),this.rateLimiter=new YBn(this),this.requestRouter=new s9n(this),this.consent=new EBn(this),this.externalIntegrations=new g9n(this);const n=(e=EM.__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=nA(o)?{[o]:i}:o;this.setPersonProperties(s),r?.({})},set_once:(o,i,r)=>{const s=nA(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!==mV){var i;const r=(i=dV[o])!==null&&i!==void 0?i:new EM;return r._init(e,n,o),dV[o]=r,dV[mV][o]=r,r}return this._init(e,n,o)}_init(e,n={},o){var i,r,s;const a=nA(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=K2e(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=K2e(n.defaults),l=Fat(n),g=Bg({},c,l,{name:o,token:a});xA(c.rageclick)&&xA(l.rageclick)&&(g.rageclick=Bg({},c.rageclick,l.rageclick)),xA(c.session_recording)&&xA(l.session_recording)&&(g.session_recording=Bg({},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:M3.GZipJS;const u=this.xu();if(this.persistence=new Q2e(this.config,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Q2e(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&&Z0.Et()){const _=Z0.Dt(this.Eu);as(_)&&_.forEach(f=>{nA(f)&&this.Mu.add(f)})}else Z0.Lt(this.Eu);const h=sn({},this.persistence.props),d=sn({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new $Bn((_,f)=>this.ju(_,f),this.config.request_queue_config),this.Bu=new e9n(this),this.__request_queue=[];const p=this.bu();p||(this.sessionManager=new Eat(this),this.sessionPropsManager=new yat(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)),Ym.DEBUG=Ym.DEBUG||this.config.debug,Ym.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(py);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(k4()),y=n.bootstrap.isIdentifiedID?C:_;this.persistence.set_property(py,n.bootstrap.isIdentifiedID?$te:C8),this.register({distinct_id:_,$device_id:y})}}if(p)this.register_once({distinct_id:A2e,$device_id:null},"");else if(!this.get_distinct_id()){const _=this.config.get_device_id(k4());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(py,C8)}return ml(Ln,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),ml(Ln,"pageshow",()=>{var _;this.$u=!1,this.Tu||(_=this.Bu)===null||_===void 0||_.resume()}),n.segment?Rst(this,()=>this.Wu()):this.Wu(),L_(this.config._onCapture)&&this.config._onCapture!==hV&&(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 bat.apply(this,arguments)})().then(_=>{_&&this.register({[jye]:_})}).catch(hV),this}Vu(e){const n=e;return nA(n.name)&&L_(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=EM.__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)),L_(this.featureFlags.onReloading)&&L_(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({},EM.__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,MBn)),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({[tst]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[nst]: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=fs(i.supportedCompression,M3.GZipJS)?M3.GZipJS:fs(i.supportedCompression,M3.Base64)?M3.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:rst}),(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&&sd?.hostname){const e=sd.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 Zst(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()&&vk(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(sst),(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(sst,null,{transport:"sendBeacon"})}_send_request(e){Cat(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){U2e++;try{let n;const o=[],i=[],r=[];vk(e,a=>{if(a)if(n=a[0],as(n))r.push(a);else if(L_(a))try{a.call(this)}catch(A){gi.error("Error executing queued PostHog call",a,A)}else as(a)&&n==="alias"?o.push(a):as(a)&&n.indexOf("capture")!==-1&&L_(this[n])?r.push(a):i.push(a)});const s=function(a,A){vk(a,function(c){try{if(as(c[0])){let l=A;Ql(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{U2e--}}push(e){if(U2e>0&&as(e)&&nA(e[0])){const n=EM.prototype[e[0]];return void(L_(n)&&n.apply(this,e.slice(1)))}this._execute_array([e])}get nh(){return{property:Grt,persistenceKey:bk,cookieName:"_fbc",pattern:Tat,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[bk]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(bk)}}}get sh(){return{property:Yrt,persistenceKey:zK,cookieName:"_fbp",pattern:kat,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[zK]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(zK)}}}rh(e){var n;const o=(n=this.persistence)===null||n===void 0?void 0:n.get_property(e.persistenceKey);return nA(o)&&e.pattern.test(o)?{value:o,delivered:!1}:xA(o)&&nA(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=$K(e.cookieName);return nA(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 nA(n)&&Tat.test(n)?this.oh(r,n,s):void r.unregister();const a=nA(e)&&p9n.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 nA(e)&&kat.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)||!nA(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&&!nA(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=srt(o?.uuid,k4);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=xA(n?.$set)?n.$set:void 0,p=as(n?.$unset)?n.$unset:[],m=o?.$unset||[],_=R=>{var F;const O=!!o?.$set&&R in o.$set;return{hasProvided:O||!!d&&R in d,provided:O?o==null||(F=o.$set)===null||F===void 0?void 0:F[R]:d?.[R],unset:p.indexOf(R)!==-1||m.indexOf(R)!==-1}},f=_(Grt),I=_(Yrt),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:O}of C)O&&u.properties.$process_person_profile===!0&&O.pending&&!F&&!h&&(u.$set=sn({[R.property]:O.value},u.$set));const y=o?.$unset;y&&(u.$unset=y);const x=h?void 0:this.ph(o?.$set_once,e!==Ast,e===ast);if(x&&(u.$set_once=x),o?._noTruncate||(E=this.config.properties_string_max_length,u=(function(R,F){const O=new Set;return(function U(Y,J){if(Y!==Object(Y))return F?F(Y):Y;if(O.has(Y))return;let ee;if(O.add(Y),as(Y))ee=[],vk(Y,W=>{ee.push(U(W))});else{const W={};Ql(xk(Y)?cst(Y):Y,(X,ie)=>{O.has(X)||(W[ie]=U(X))}),ee=W}return ee})(R)})(u,R=>nA(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 O={},U=Y=>{R[Y]!==void 0&&(O[Y]=R[Y])};return P4n.forEach(U),F.forEach(U),O})(u.properties,m9n)),e===E8.DISMISSED||e===E8.SENT){const R=n?.[P2e.SURVEY_ID],F=n?.[P2e.SURVEY_ITERATION];wat({id:R,current_iteration:F}),u.$set=sn(sn({},u.$set),{},{[o9n({id:R,current_iteration:F},e===E8.SENT?"responded":"dismissed")]:!0})}else e===E8.SHOWN&&(u.$set=sn(sn({},u.$set),{},{[P2e.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var E;if(e===GBn.SHOWN){const R=n?.[qst.TOUR_TYPE];R&&(u.$set=sn(sn({},u.$set),{},{[`${qst.TOUR_LAST_SEEN_DATE}/${R}`]:new Date().toISOString()}))}const B=sn(sn({},u.properties.$set),u.$set);if(nx(B)||this.setPersonPropertiesForFlags(B),!Us(this.config.before_send)){const R=this.Os(u);if(!R)return;u=R,u.uuid=srt(u.uuid,k4)}const S=C.filter(({channel:R,update:F})=>{var O,U,Y;const J=(O=(U=u.$set)===null||U===void 0?void 0:U[R.property])!==null&&O!==void 0?O:xA((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),P=o?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(Q),M=sn(sn(sn({method:"POST",url:Q,data:u,compression:"best-available",preferSyncCompression:o?.send_instantly,timestampMode:P?"body":"capture-body",batchKey:o?._batchKey},P&&(!((r=u.properties)===null||r===void 0)&&r.$session_id)?{batchGroup:u.properties.$session_id+(u.properties.$window_id?`-${u.properties.$window_id}`:"")}:{}),o?.transport?{transport:o.transport}:{}),S.length?{fireCallbackOnDrop:!0,callback:R=>{if(R.statusCode>=200&&300>R.statusCode)for(const{channel:F,update:O}of S)this.dh(F,O.value)}}:{});if(!this.config.request_batching||o&&!o?._batchKey||o?.send_instantly||S.length){var k;let R;!M.transport&&!M.callback&&nx((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 h9n(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[est]=!0),e==="$snapshot"){const f=sn(sn({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=f.distinct_id,(!nA(a.distinct_id)&&!jd(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,S;if(!dy)return{};const Q=f?[...Tk,...I||[]]:[],[P,M]=trt(dy),[k,R]=(function(se){for(let oe=0;ort.length>oe;oe++){const[ge,ue,Ie]=ort[oe],le=se.match(ge);if(le){const _e=Ie&&se.match(Ie)||le;return[ue,_e?.[1]||""]}}return["",""]})(dy),F=(function(){const se="u">typeof navigator?navigator:void 0;return se?.brave?{brave:!0}:{}})(),O={};Bo(C)||(O.detectGoogleSearchApp=C);const U={},Y=(x=navigator)===null||x===void 0||(x=x.userAgentData)===null||x===void 0?void 0:x.platform,J=(E=navigator)===null||E===void 0?void 0:E.maxTouchPoints,ee=Ln==null||(B=Ln.screen)===null||B===void 0?void 0:B.width,W=Ln==null||(S=Ln.screen)===null||S===void 0?void 0:S.height,X=Ln?.devicePixelRatio;Bo(Y)||(U.userAgentDataPlatform=Y),Bo(J)||(U.maxTouchPoints=J),Bo(ee)||(U.screenWidth=ee),Bo(W)||(U.screenHeight=W),Bo(X)||(U.devicePixelRatio=X);const ie=Bg(g2e({$os:P,$os_version:M,$browser:Zit(dy,navigator.vendor,F,O),$webview_app:k,$webview_app_version:R,$device:nrt(dy),$device_type:q5n(dy,U),$timezone:Jst(),$timezone_offset:LBn()}),{$current_url:sV(y?iQ(sd?.href):sd?.href,Q,aV),$host:sd?.host,$pathname:sd?.pathname,$raw_user_agent:dy.length>1e3?dy.substring(0,997)+"...":dy,$browser_version:X5n(dy,navigator.vendor,F,O),$browser_language:Ust(),$browser_language_prefix:FBn(),$screen_height:Ln?.screen.height,$screen_width:Ln?.screen.width,$viewport_height:Ln?.innerHeight,$viewport_width:Ln?.innerWidth,$lib:_8.LIB_NAME,$lib_version:_8.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return _8.SDK_DIST_CHANNEL&&(ie.$sdk_dist_channel=_8.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&&Bg(a,this.sessionPropsManager.getSessionProps());try{var c;this.sessionRecording&&Bg(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===Y2e&&(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=Bg(a,l),e==="$pageview"&&No&&(a.title=No.title),!Bo(s)){const f=o.getTime()-s;a.$duration=parseFloat((f/1e3).toFixed(3))}dy&&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;xA(h)&&!nx(h)&&(a.$groups=sn(sn({},xA(d)?d:{}),h)),Ql(["$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{Bg(p,f())}catch(I){gi.error("Failed to produce browser extension event properties",I)}a=Bg({},A,g,u,sn(sn({},p),a)),a.$is_identified=this._isIdentified(),as(this.config.property_denylist)?Ql(this.config.property_denylist,function(f){delete a[f]}):gi.error(Rat+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const m=this.config.sanitize_properties;m&&(gi.error(Nat),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=Bg({},r,s||{},e||{});const A=this.config.sanitize_properties;return A&&(gi.error(Nat),a=A(a,"$set_once")),n&&(this.Iu=!0),nx(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||!Z0.Et())return void Z0.Lt(this.Eu);const n=[];this.Mu.forEach(o=>n.push(o)),n.length>0?Z0.At(this.Eu,n):Z0.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:pV}),()=>{})}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:pV})}getActiveMatchingSurveys(e,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:pV})}renderSurvey(e,n){var o;(o=this.surveys)===null||o===void 0||o.renderSurvey(e,n)}displaySurvey(e,n=A9n){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:pV}}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:pV})}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(jd(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(Xte),this.register({distinct_id:e}));const g=(this.persistence.get_property("$user_state")||"anonymous")===C8,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(py,$te),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=G2e(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(py,$te);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=G2e(e,n,o))}else(n||o)&&this.setPersonProperties(n,o);u||r||s?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(AQ)):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=G2e(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=(as(e)?e:[e]).filter(i=>nA(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(Ast,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=hy(e)?e:e?.resetDeviceID,o=hy(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(Wye),u=this.get_property(jye),h=this.get_property(JK);(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,S,Q,P,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"),(S=this.sessionManager)===null||S===void 0||S.resetSessionId(),this.Ou=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:A2e,$device_id:null},"");else{const O=this.config.get_device_id(k4());this.register_once({distinct_id:O,$device_id:e?O:g},""),e||Bo(u)||this.register({[jye]: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})),(P=this.featureFlags)===null||P===void 0||P.initialize(),!Us(l)&&!(!((M=this.sessionManager)===null||M===void 0)&&M.setBootstrapSessionId(l,!0)))){const O=sn({},o);delete O.sessionID,this.config.bootstrap=O}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 jg(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(Xte,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(xA(e)){var o,i,r,s,a,A,c,l,g,u,h,d,p,m;Bg(this.config,Fat(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 Q2e(sn(sn({},this.config),{},{persistence:"sessionStorage"}),f,!1);const I=this.Du(this.config.debug);var _;hy(I)&&(this.config.debug=I),hy(this.config.debug)&&(this.config.debug?(Ym.DEBUG=!0,uc.Et()&&uc.At("ph_debug",!0),gi.info("set_config",{config:e,oldConfig:n,newConfig:sn({},this.config)})):(Ym.DEBUG=!1,uc.Et()&&uc.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&&Rst(this,hV,!1)}}_overrideSDKInfo(e,n){Ym.LIB_NAME=e,Ym.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:EM.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:mV;return n!==mV&&(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()&&nx(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(a2e,!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 Eat(this),this.pageViewManager=new Fst(this),this.persistence&&(this.sessionPropsManager=new yat(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=EM.__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(Dat)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void gi.warn(Dat);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:A2e,$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 F_?Bat(F_,this.config.custom_blocked_useragents):void 0}th(){No&&(No.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(l2e,{title:No.title},{send_instantly:!0}),this.Au&&(No.removeEventListener(qK,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),ml(No,qK,this.Au)))}debug(e){e===!1?(Ln?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Ln?.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&&!Us(n[o]),A=i in n&&!Us(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(Us(this.config.before_send))return e;const o=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(H5n),i=as(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),Us(r)){const a=`Event '${e.event}' was rejected in beforeSend function`;return L5n(e.event)?gi.warn(`${a}. This can cause unexpected behavior.`):gi.info(a),null}r.properties&&!nx(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&&Us(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=hy(e)&&!e,o=uc.Et()&&uc.Ot("ph_debug")==="true";return!n&&(!!o||e)}};_V.__defaultExtensionClasses={},_V.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]]=hBn(t.prototype[e[n]])})(_V,["identify"]);var Lat=class{constructor(e){this.disabled=e===!1;const n=xA(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 V2e="$copy_autocapture",z2e=Ad("[AutoCapture]");function J2e(t,e){return e.length>t?e.slice(0,t)+"...":e}function C9n(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do e=e.previousSibling;while(e&&!B9(e));return e}function y9n(t,{e,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:i,elementsChainAsString:r,disableCaptureUrlHashes:s}){var a,A;if(!B9(t))return{props:{}};const c=[t],l=new Set([t]);let g=t;for(;g.parentNode&&!j1(g,"body")&&1e3>c.length;){if(I2e(g.parentNode)){const x=g.parentNode.host;if(l.has(x))break;l.add(x),c.push(x),g=x;continue}if(!B9(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=>j1(x,"button")||j1(x,"a")):-1;u>0&&(o=o||c.slice(0,u+1).some(x=>!Dk(x)||nV(x)));const h=[],d={};let p,m=!1,_=!1;if(Ql(c,x=>{const E=Dk(x);if(j1(x,"a")&&!n&&!i?.includes("href")){const B=x.getAttribute("href");m=!!(E&&B&&oV(B))&&(s?iQ(B):B)}fs(Mk(x),"ph-no-capture")&&(_=!0),h.push((function(B,S,Q,P,M=!1){const k=B.tagName.toLowerCase(),R={tag_name:k};y2e.indexOf(k)>-1&&!Q&&(R.$el_text=k.toLowerCase()==="a"||k.toLowerCase()==="button"?J2e(1024,wst(B)):J2e(1024,eV(B)));const F=Mk(B);S||P?.includes("class")||0>=F.length||(R.classes=F.filter(function(J){return J!==""})),Ql(B.attributes,function(J){var ee;if((!nV(B)||["name","id","class","aria-label"].indexOf(J.name)!==-1)&&!P?.includes(J.name)&&!S&&oV(J.value)&&(!nA(ee=J.name)||ee.substring(0,10)!=="_ngcontent"&&ee.substring(0,7)!=="_nghost")){let W=J.value;J.name==="class"&&(W=C2e(W).join(" ")),R["attr__"+J.name]=J2e(1024,J.name==="href"&&M?iQ(W):W)}});let O=1,U=1,Y=B;for(;Y=C9n(Y);)O++,Y.tagName===B.tagName&&U++;return R.nth_child=O,R.nth_of_type=U,R})(x,n,o,i,s)),Ql((function(B){if(!Dk(B))return{};const S={};return Ql(B.attributes,function(Q){if(Q.name&&Q.name.indexOf("data-ph-capture-attribute")===0){const P=Q.name.replace("data-ph-capture-attribute-",""),M=Q.value;P&&M&&oV(M)&&(S[P]=M)}}),S})(x),(B,S)=>{({}).hasOwnProperty.call(d,S)||(d[S]=B)})}),_)return{props:{},explicitNoCapture:_};if(u>0&&(t=c[u],h.splice(0,u)),o||(h[0].$el_text=j1(t,"a")||j1(t,"button")?wst(t):eV(t)),m){var f,I;h[0].attr__href=m;const x=(f=y8(m))===null||f===void 0?void 0:f.host,E=Ln==null||(I=Ln.location)===null||I===void 0?void 0:I.host;x&&E&&x!==E&&(p=m)}return{props:Bg((y=e.type,{$event_type:y,$ce_version:1}),r?{}:{$elements:h},{$elements_chain:(C=h,as(C)?(function(x){return x.map(E=>{var B,S;let Q="";if(E.tag_name&&(Q+=E.tag_name),E.attr_class){E.attr_class.sort();for(const k of E.attr_class)Q+=`.${k.replace(/"/g,"")}`}const P=sn(sn(sn(sn({},E.text?{text:E.text}:{}),{},{"nth-child":(B=E.nth_child)!==null&&B!==void 0?B:0,"nth-of-type":(S=E.nth_of_type)!==null&&S!==void 0?S:0},E.href?{href:E.href}:{}),E.attr_id?{attr_id:E.attr_id}:{}),E.attributes),M={};return ene(P).sort(([k],[R])=>(function(F,O){return O>F?-1:F>O?1:0})(k,R)).forEach(([k,R])=>M[Dst(k.toString())]=Dst(R.toString())),Q+=":",Q+=ene(M).map(([k,R])=>`${k}="${R}"`).join(""),Q}).join(";")})((function(x){return x.map(E=>{var B,S;const Q={text:(B=E.$el_text)===null||B===void 0?void 0:B.slice(0,400),tag_name:E.tag_name,href:(S=E.attr__href)===null||S===void 0?void 0:S.slice(0,2048),attr_class:PBn(E),attr_id:E.attr__id,nth_child:E.nth_child,nth_of_type:E.nth_of_type,attributes:{}};return ene(E).filter(([P])=>P.indexOf("attr__")===0).forEach(([P,M])=>Q.attributes[P]=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 x9n=class{fo(){this.po=void 0,clearTimeout(this.mo),this.mo=void 0}yo(e){var n;if(!Dk(e))return!0;const o=(n=this.bo().css_selector_ignorelist)!==null&&n!==void 0?n:B2e,i=new Set;let r=e;for(;r;){if(i.size>=1e3||i.has(r))return!0;i.add(r);const s=r,a=Mk(s);if(fs(a,"ph-no-capture")||fs(a,"ph-sensitive")||nV(s)||o.some(c=>x2e(s,c)))return!0;const A=r.parentNode;r=I2e(A)?A.host:A&&B9(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=tV(e);var n;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&B9(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=tV(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&&(j1(i,"html")||j1(i,"body"))){var r;if(o.excluded)return null;const s=(r=this.bo().css_selector_ignorelist)!==null&&r!==void 0?r:B2e;return[i,No?.documentElement,No?.body].some(a=>{if(!a)return!1;const A=Mk(a);return fs(A,"ph-no-capture")||fs(A,"ph-sensitive")||!Dk(a)||nV(a)||s.some(c=>x2e(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 Lat(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 z2e.info("Disabling Automatic Event Collection because this browser is not supported");if(!Ln||!No)return;const e=this.Fo=n=>{n=n||Ln?.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(ad(o))return;this.Oo(n,"$autocapture",o)}catch(o){z2e.error("Failed to capture event",o)}};if(ml(Ln,"blur",e),ml(No,"submit",e,{capture:!0}),ml(No,"change",e,{capture:!0}),ml(No,"click",e,{capture:!0}),Ql(["pointerdown","pointermove","pointerup","pointercancel"],n=>{ml(No,n,e,{capture:!0})}),this.bo().capture_copied_text){const n=this.Do=o=>{o=o||Ln?.event;try{this.Oo(o,V2e)}catch(i){z2e.error("Failed to capture clipboard event",i)}};ml(No,"copy",n,{capture:!0}),ml(No,"cut",n,{capture:!0}),ml(No,"paste",n,{capture:!0})}}Ro(){this.fo(),this.Fo&&(Ln?.removeEventListener("blur",this.Fo),Ql(["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;hy(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||fs(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(Urt),i=this.Co,r=this.bo();if(!r.remoteRequestsDisabled&&!this.$o)return!1;const s=r.remoteRequestsDisabled&&!this.$o;if(ad(i)&&!hy(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||tV(e);_st(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()))&&Bst(i,r.rageclick)&&this.Oo(e,"$rageclick",o);const a=n===V2e,A=a?sn(sn({},r),{},{dom_event_allowlist:void 0}):r;if(i&&(function(u,h,d,p,m,_){var f;if(!Ln||b2e(u)||d?.url_allowlist&&!fst(d.url_allowlist,_)||d?.url_ignorelist&&fst(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}=bst(u,p);if(!(function(x,E){const B=E?.element_allowlist;if(Bo(B))return!0;for(const S of x)if(B.some(Q=>S.tagName.toLowerCase()===Q))return!0;return!1})(C,d)||!E2e(C,d?.css_selector_allowlist)||E2e(C,(f=d?.css_selector_ignorelist)!==null&&f!==void 0?f:B2e))return!1;try{const x=Ln.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&&(y2e.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}=y9n(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===V2e){const m=e.type||"clipboard";if(m!=="paste"){var l,g;const _=Ln==null||(l=Ln.getSelection())===null||l===void 0?void 0:l.toString(),f=Ist(_);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 L_(No?.querySelectorAll)}},E9n=class{constructor(e){this._instance=e}refresh(e){const n=this._instance.config,o=xA(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 fV=Ad("[ExceptionAutocapture]"),Hat=()=>{},Oat=t=>{var e;if(L_(t))return(e=t.__posthog_layer__)!==null&&e!==void 0?e:t.__rrweb_layer__};function IV(t,e,n){try{if(!(e in t))return Hat;const o={next:t[e]},i=n(function(...r){return o.next.apply(this,r)});return L_(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=Oat(r);for(;s;){if(s.next===i)return void(s.next=o.next);r=s.next,s=Oat(r)}}}catch{return Hat}}const B9n=Ad("[TracingHeaders]"),kM=Ad("[Web Vitals]"),Gat=9e5,Yat=["CLS","FCP","INP","LCP"],b9n=["INP","LCP"],S9n=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],W2e="disabled",Uat="lazy_loading",b8=Ad("[SessionRecording]"),Q9n=Ad("[Heatmaps]");function j2e(t){return xA(t)&&"clientX"in t&&"clientY"in t&&jd(t.clientX)&&jd(t.clientY)}const dne=Ad("[Product Tours]"),X2e=t=>{var e;return!t.config.disable_product_tours&&!!(!((e=t.persistence)===null||e===void 0)&&e.get_property(n2e))},v9n=["$set_once","$set"],b9=Ad("[SiteApps]"),Kat="Error while initializing PostHog app with config id ",Vat=(t,e)=>t?.then?t.then(e):e(t),Ok="SDK is not enabled or survey functionality is not yet loaded",zat="Disabled. Not loading surveys.";var P9n=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 vl.warn("Remote config unavailable. Not loading surveys.");const i=o.config.surveys;if(Us(i))return vl.warn("Flags not loaded yet. Not loading surveys.");this.Ah=hy(i)?i:i.length>0,vl.info(`flags response received, isSurveysEnabled: ${this.Ah}`),this.loadIfEnabled()}}setup(e){if(!this.Io)return this.Fh=e,Vat(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 vl.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void vl.info(zat);if(e.cookielessMode&&this.So.isOptedOut())return void vl.info("Not loading surveys in cookieless mode without consent.");const n=this.So.getExtensions();if(!n)return void vl.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(c2e),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(),vl.info("Surveys loaded successfully"),this.Lh({isLoaded:!0}))}Dh(e,n){vl.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 vl.info(zat),e([]);const r=i.kv.get(i2e);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=>vl.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 vl.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=>vl.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(Ok)}))}jh(e,n){if(this.Io)return{surveys:[],context:{isLoaded:!1,error:Ok}};const o=n.statusCode;if(o!==200||!n.json){const a=`Surveys API could not be loaded, status: ${o}`;return o!==0?vl.error(a):n.error||vl.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)&&(Sat(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({[i2e]:i,[qte]: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(qte);return jd(o)&&Date.now()-o>3e5}Hh(){return jd(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};wat(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){vl.error("Error in survey callback",o)}}getActiveMatchingSurveys(e,n=!1){if(!Us(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);vl.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(Us(this._surveyManager))return{eligible:!1,reason:Ok};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(Us(this._surveyManager))return{eligible:!1,reason:Ok};const n=typeof e=="string"?this.zh(e):e;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Us(this._surveyManager))return vl.warn("init was not called"),{visible:!1,disabledReason:Ok};const n=this.Wh(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return Us(this._surveyManager)?(vl.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ok})):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(Us(this._surveyManager))return void vl.warn("init was not called");const r=typeof e=="string"?this.zh(e):e;if(!r?.id)return void vl.warn("Survey not found");if(!a9n.includes(r.type))return void vl.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){vl.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()&&(vl.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),vl.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Rh.add(a)}this._surveyManager.renderSurvey(r,s,o)}else vl.warn("Survey element not found")}displaySurvey(e,n){var o;if(!this.So.isCapturing())return;if(Us(this._surveyManager))return void vl.warn("init was not called");const i=this.zh(e);if(!i)return void vl.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!==w2e.Popover&&n.initialResponses&&vl.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 vl.warn("Survey is not eligible to be displayed: ",s.reason)}n.displayType!==w2e.Inline?this._surveyManager.handlePopoverSurvey(r,n):this.renderSurvey(r,n.selector,n.properties)}cancelPendingSurvey(e){Us(this._surveyManager)?vl.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 Gk(t,e,n){if(Us(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 w9n=class{constructor(e){this._instance=e,this.Vh=new Set,this.Gh=new Set,this.Zh=new lne,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 lne}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"||!Gk(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=>Gk(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&&Gk((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=>Gk(c.text,n.text,n.text_matching||"exact")||Gk(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(;!Us(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=>Gk(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||vat(n.properties.reduce((o,i)=>{const r=as(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)}},M9n=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&&vat(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===AV.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 w9n(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,AV.Activation),A=this._c(e,AV.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,AV.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,AV.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&&(nx(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 jd(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=>jd(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}},D9n=class extends M9n{constructor(e){super(e)}zc(){return jrt}Uc(){return Xrt}gc(){return qrt}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 jd(i)&&i>0}Qc(){return E8.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 vl}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 Sat(i)&&!!(!((r=i.conditions)===null||r===void 0||(r=r.events)===null||r===void 0)&&r.repeatedActivation)||i.schedule==="always"})(o)?e===E8.SHOWN?"consume":"ignore":e===E8.SHOWN?"persist":e===E8.DISMISSED||e===E8.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},N9n=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)}},R9n=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=Ur?.__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 D9n(this._instance)}};const T9n=Ln?.location?one(Ln.location.hash,"__posthog")||one(location.hash,"state"):null,Jat="_postHogToolbarParams",Wat=Ad("[Toolbar]"),jat=Ad("[FeatureFlags]");var k9n=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:as(o.flag_keys)?o.flag_keys:void 0}})(e,n),!e.evaluation_environments||e.evaluation_contexts||this.Jc||(jat.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)||as(e.flag_keys)||jat.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Kc}};const Xat=Ad("[FeatureFlags]"),FM=Ad("[FeatureFlags]",{debugEnabled:!0}),q2e=`" failed. Feature flags didn't load in time.`,F9n=[502,504],qat=["click","keydown","wheel","touchstart","pointerdown"],$at="connection_error",Zat=t=>{const e={};for(let n=0;t.length>n;n++)e[t[n]]=!0;return e},eAt=t=>{const e={};for(const[n,o]of ene(t||{}))o&&(e[n]=o);return e},tAt=t=>xk(t)&&(t.name==="RangeError"&&t.message.indexOf("Maximum call stack size exceeded")===0||t.name==="InternalError"&&t.message==="too much recursion"),F4=Ad("[Error tracking]"),$2e="webkit-masked-url:",L9n=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],H9n=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",$2e],O9n=["__firefox__","__gCrWeb"],nAt="Refusing to render web experiment since the viewer is a likely bot",G9n={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>gne(e,t),not_regex:(t,e)=>!gne(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},h5=Ad("[Conversations]"),LM="Conversations not available yet.";function oAt(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=F_?.userAgent;m&&([d,p]=trt(m))}catch{}return(function(m,_){const f=(function(I){if(I)return{}.hasOwnProperty.call(wrt,I)?wrt[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 Y9n=["debug","log","warn","error","info"],U9n=t=>{for(;t?.__rrweb_original__;)t=t.__rrweb_original__;return t},iAt="console",rAt="__posthogHandledLogsRequestError",Z2e=(t,e)=>{const n=t instanceof Error?t:new Error(e);return n[rAt]=!0,n},sAt=t=>!!t&&typeof t=="object"&&t[rAt]===!0,hne=Ad("[NetworkMetrics]"),exe=()=>{var t;return!(Ln==null||(t=Ln.performance)===null||t===void 0)&&t.now?Ln.performance.now():Date.now()},K9n={"http:":80,"https:":443},V9n=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),aAt=(t,e)=>{var n;const o=String(e);return{method:String(t).toUpperCase(),url:((n=y8(o))===null||n===void 0?void 0:n.href)||o}},txe=(t,e,n,o,i,r,s=!1)=>{try{var a,A;const c=i();if(!c)return;const l=n||void 0,g=exe()-o,u=y8(e.url);if(u&&u.protocol!=="http:"&&u.protocol!=="https:")return;const h={url:u?.href||e.url,method:e.method},d=L_(c.name)?c.name(h):nA(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=V9n.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)||K9n[_.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){hne.error("Failed to record network metric",c)}},AAt=()=>{},z9n=(t,e)=>L_(Ln?.fetch)?IV(Ln,"fetch",n=>function(...o){const i=exe(),r=n.apply(this,o);if(!e())return r;try{var s,a,A;const[c,l]=o,g=aAt((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=>(txe(t,g,u?.status,i,e,void 0,!0),u),u=>{throw txe(t,g,void 0,i,e,u),u})}catch(c){return hne.error("Failed to observe fetch",c),r}}):AAt,J9n=(t,e)=>{var n;const o=Ln==null||(n=Ln.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!o)return AAt;const i=new WeakMap,r=IV(o,"open",a=>function(...A){try{cat.has(this)||i.set(this,aAt(A[0],A[1]))}catch(c){hne.error("Failed to observe XHR open",c)}return a.apply(this,A)}),s=IV(o,"send",a=>function(...A){let c;try{const l=i.get(this);if(l&&e()){const g=exe();c=()=>{this.removeEventListener("loadend",c),txe(t,l,this.status,g,e)},ml(this,"loadend",c)}}catch(l){hne.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()}},pne={featureFlags:class{constructor(t){this.name="featureFlags",this.Xc=!1,this.featureFlagEventHandlers=[],this.$=Xat,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 k9n(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]"),Vat(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 Ln&&ml(Ln,"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&&(ml(No,qK,this.ln),vk(qat,n=>{ml(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),vk(qat,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=[],Ln?.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&&!as(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={[I8]:d,[T4]:d,[rQ]:p};t.$feature_flag_details&&(m[wM]=d);for(const _ of[MM,cQ,WK])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[I8,rQ,MM,E9]){const i=this.Fd(o);Bo(i)||(t[o]=i)}this.Yc=t;const e=sn({},t),n=this.Fd(T4);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(cQ);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:Crt(g),variant:yrt(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(wM),e=this.Fd(E9),n=this.Fd(DM);if(!n&&!e)return t||{};const o=Bg({},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:Crt(o),variant:yrt(o),payload:Irt(e[n])}})}getFlagVariants(){const t=this.Fd(T4),e=this.Fd(E9);if(!e)return t||{};const n=Bg({},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(rQ),e=this.Fd(DM);if(!e)return t||{};const n=Bg({},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(AQ)}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(aQ),timezone:Jst()};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?$at:"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({[XK]: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({[XK]:[$at]}),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=>F9n.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 Lst(this.hd,3)}Wd(t){this.hd=Hst(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+q2e);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+q2e);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 S=(g=this.wo)===null||g===void 0?void 0:g.session.sessionId,Q=this.Fd(jK);S&&S!==Q&&(l={},c=S)}if(e.send_event||!("send_event"in e))if(t in l&&l[t].includes(s))c&&this.At({[AQ]:l,[jK]:c});else{var u,h,d,p,m,_,f,I,C,y,x,E;as(l[t])?l[t].push(s):l[t]=[s],this.At(sn({[AQ]:l},c?{[jK]:c}:{}));const S=this.getFeatureFlagDetails(t),Q=[...(u=this.Fd("$feature_flag_errors"))!==null&&u!==void 0?u:[]];Bo(i)&&Q.push("flag_missing");const P={$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(S==null||(_=S.metadata)===null||_===void 0?void 0:_.has_experiment)||(P.$feature_flag_has_experiment=S.metadata.has_experiment),Bo(S==null||(f=S.metadata)===null||f===void 0?void 0:f.version)||(P.$feature_flag_version=S.metadata.version);const M=(I=S==null||(C=S.reason)===null||C===void 0?void 0:C.description)!==null&&I!==void 0?I:S==null||(y=S.reason)===null||y===void 0?void 0:y.code;var B;M&&(P.$feature_flag_reason=M),!(S==null||(x=S.metadata)===null||x===void 0)&&x.id&&(P.$feature_flag_id=S.metadata.id),Bo(S?.original_variant)&&Bo(S?.original_enabled)||(P.$feature_flag_original_response=Bo(S.original_variant)?S.original_enabled:S.original_variant),!(S==null||(E=S.metadata)===null||E===void 0)&&E.original_payload&&(P.$feature_flag_original_payload=S==null||(B=S.metadata)===null||B===void 0?void 0:B.original_payload),Q.length&&(P.$feature_flag_error=Q.join(",")),this.Vd(P)}else c&&this.At({[AQ]:l,[jK]:c});return o?{key:t,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:Irt(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 jg(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+q2e),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=Xat)=>{const l=((I,C)=>{const y=I.flags;if(y){const x=Object.fromEntries(Object.keys(y).map(B=>{var S;return[B,(S=y[B].variant)!==null&&S!==void 0?S:y[B].enabled]})),E=Object.fromEntries(Object.keys(y).filter(B=>y[B].enabled).filter(B=>{var S;return!Bo((S=y[B].metadata)===null||S===void 0?void 0:S.payload)}).map(B=>{var S;return[B,(S=y[B].metadata)===null||S===void 0?void 0:S.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(as(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{[I8]:u,[T4]:I,[WK]:!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({[I8]:Object.keys(eAt(m)),[T4]:m||{},[rQ]:_||{},[wM]:f||{},[WK]:i.minimalFlagCalledEvents===!0},d?{[MM]:d}:{}),p?{[cQ]:p}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.$);if(o)if(n?.persist===!1){const i=!Bo(this.wo.kv.get(T4));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([E9,DM]),this.Md(),void FM.info("All overrides cleared");if(as(t))return this.At({[E9]:Zat(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[E9]=as(i)?Zat(i):i),r&&(o[DM]=r),Object.keys(o).length&&this.At(o),i===!1&&r===!1?this.Lt([E9,DM]):i===!1?this.Lt(E9):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({[E9]: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({[I8]:Object.keys(eAt(a)),[T4]:a,[sQ]: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(o2e);!o||e?this.Jd(t,n):t(o)}Jd(t,e){var n=this;return jg(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({[o2e]: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({[sQ]: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({[sQ]:n}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(sQ),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({[aQ]:o}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.Fd("$stored_group_properties")||{};this.At({[aQ]:sn(sn({},e),{},{[t]:{}})})}else this.Lt(aQ)}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}}},W9n={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=W2e,this.tv=void 0,this.ev=!1,this.Xe=(()=>{var e,n;if(!No?.visibilityState||No.visibilityState==="visible")return!0;const o=Ln==null||(e=Ln.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 b8.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&&ml(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 Ln&&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),b8.info("starting")):(this.Yd=W2e,this.stopRecording())}sv(t){var e,n;if(this.nv)if(this.Yd!=="awaiting_config"&&this.Yd!=="missing_config"&&(this.Yd=Uat),(Ur==null||(e=Ur.__PosthogExtensions__)===null||e===void 0||(e=e.rrweb)===null||e===void 0?void 0:e.record)&&((n=Ur.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording))this.rv(t);else{var o,i;const r=this._instance.sessionManager;(o=Ur.__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}),b8.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(Us(t))return null;const n=jd(t)?t:parseFloat(t);return typeof(o=n)!="number"||!Number.isFinite(o)||0>o||o>1?(b8.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;Us(c)&&this.av();const l=s?.minimumDurationMilliseconds;o.register({[JK]: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({[ist]:!0}),b8.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):b8.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(JK);return(n==null||(e=n.scriptConfig)===null||e===void 0?void 0:e.script)||"lazy-recorder"}hv(){const t=this._instance.get_property(JK);if(!t)return!1;let e;try{e=typeof t=="object"?t:JSON.parse(t)}catch(n){return b8.warn("persisted remote config for session recording is invalid and will be ignored",n),!1}return!Us(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=Ur.__PosthogExtensions__)===null||e===void 0)&&e.initSessionRecording))return b8.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ost]:!0});var i;if(this.Xd||(this.Xd=(i=Ur.__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",b8.info("persisted remote config is stale, requesting fresh config before starting"),void new Zst(this._instance).load());this.Yd=Uat,(n=(o=this.Xd).setDocumentWasEverVisible)===null||n===void 0||n.call(o,this.Xe),this.Xd.start(t)}else this.Yd=W2e}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)}}},j9n={autocapture:class extends x9n{constructor(t){super(new E9n(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.dv=!1,this._instance=t,this.vv=this.fv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.pv();return!!(t.path||t.search||this.gv(t))}startIfEnabled(){this.isEnabled&&(gi.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.vv=this.fv(),this.startIfEnabled()}stop(){this.mv&&this.mv(),this.mv=void 0,this.yv&&this.yv(),this.yv=void 0,gi.info("History API monitoring stopped")}monitorHistoryChanges(){Ln&&Ln.history&&(this.bv("pushState"),this.bv("replaceState"),this._v(),this.gv()&&this.wv())}bv(t){var e;if(!Ln||!((e=Ln.history[t])===null||e===void 0)&&e.__posthog_wrapped__)return;const n=this;IV(Ln.history,t,o=>function(i,r,s){var a;n.Sv(s)&&n.xv(),o.call(this,i,r,s),n.Cv(t,!n.dv&&(Ln==null||(a=Ln.event)===null||a===void 0?void 0:a.type)!=="popstate")})}fv(){const t=Ln?.location;if(t?.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}pv(){const t=this._instance.config.capture_pageview;return t==="history_change"?{path:!0}:xA(t)?t:{}}gv(t=this.pv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}$v(t){const e=this.pv(),n=this.vv;return!(!n||!(e.path&&t.pathname!==n.pathname||e.search&&t.search!==n.search||this.gv(e)&&t.hash!==n.hash))}Cv(t,e=!1){try{e||this.xv();const n=this.fv();if(!n)return;if(this.$v(n)){const o=()=>this._instance.capture(l2e,{navigation_type:t});e?(this.Tv=o,Promise.resolve().then(()=>this.xv())):o()}this.vv=n}catch(n){gi.error(`Error capturing ${t} pageview`,n)}}Sv(t){var e,n;return!(Us(t)||!Ln)&&((e=y8(String(t)))===null||e===void 0?void 0:e.href)!==((n=Ln.location)===null||n===void 0?void 0:n.href)}xv(){const t=this.Tv;if(t){this.Tv=void 0,this.dv=!0;try{t()}catch(e){gi.error("Error capturing deferred pageview",e)}finally{this.dv=!1}this.vv=this.fv()}}_v(){if(this.mv)return;const t=()=>{this.Cv("popstate")};ml(Ln,"popstate",t),this.mv=()=>{Ln&&Ln.removeEventListener("popstate",t)}}wv(){if(this.yv)return;const t=()=>{this.Cv("hashchange")};ml(Ln,"hashchange",t),this.yv=()=>{Ln&&Ln.removeEventListener("hashchange",t)}}},heatmaps:class{get Rr(){return this.instance.config}constructor(t){var e;this.Iv=!1,this.xo=!1,this.Mv=null,this.instance=t,this.Iv=!!(!((e=this.instance.persistence)===null||e===void 0)&&e.props[qye]),this.rageclicks=new Lat(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return xA(this.Rr.capture_heatmaps)&&this.Rr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Rr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Us(this.Rr.capture_heatmaps)?Us(this.Rr.enable_heatmaps)?this.Iv:this.Rr.enable_heatmaps:this.Rr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.xo)return;Q9n.info("starting..."),this.Ev(),this.ln()}else{var t;clearInterval((t=this.Mv)!==null&&t!==void 0?t:void 0),this.Pv(),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({[qye]:n}),this.Iv=n,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Rv(t){j2e(t.originalEvent)&&this.Tr(t.originalEvent,"deadclick")}ln(){this.Mv&&clearInterval(this.Mv),this.Mv=No?.visibilityState==="visible"?setInterval(this.bl.bind(this),this.flushIntervalMilliseconds):null}Ev(){Ln&&No&&(this.Av=this.bl.bind(this),ml(Ln,Zte,this.Av),this.Fv=t=>this.Tr(t||Ln?.event),ml(No,"click",this.Fv,{capture:!0}),this.Ov=t=>this.Dv(t||Ln?.event),ml(No,"mousemove",this.Ov,{capture:!0}),this.Lv=new Nst(this.instance,wBn,this.Rv.bind(this)),this.Lv.startIfEnabledOrStop(),this.Nv=this.ln.bind(this),ml(No,qK,this.Nv),this.xo=!0)}Pv(){var t;Ln&&No&&(this.Av&&Ln.removeEventListener(Zte,this.Av),this.Fv&&No.removeEventListener("click",this.Fv,{capture:!0}),this.Ov&&No.removeEventListener("mousemove",this.Ov,{capture:!0}),this.Nv&&No.removeEventListener(qK,this.Nv),clearTimeout(this.qv),(t=this.Lv)===null||t===void 0||t.stop(),this.xo=!1)}jv(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&&B9(c)&&!j1(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:Ln)===null||l===void 0?void 0:l.getComputedStyle(c).position}catch{return!1}if(fs(a,h))return!0;c=Cst(c)}return!1})(tV(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(mst(t.target)||!j2e(t))return;const o=this.jv(t,e);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&Bst(tV(t),this.instance.config.rageclick)&&this.Zs(sn(sn({},o),{},{type:"rageclick"})),this.Zs(o)}Dv(t){!mst(t.target)&&j2e(t)&&(clearTimeout(this.qv),this.qv=setTimeout(()=>{this.Zs(this.jv(t,"mousemove"))},500))}Zs(t){if(!Ln)return;const e=this.Rr.disable_capture_url_hashes?iQ(Ln.location.href):Ln.location.href,n=this.Rr.custom_personal_data_properties,o=this.Rr.mask_personal_data_properties?[...Tk,...n||[]]:[],i=sV(e,o,aV);this.Rt=this.Rt||{},this.Rt[i]||(this.Rt[i]=[]),this.Rt[i].push(t)}bl(){this.Rt&&!nx(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Nst,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.Iv=!1,this.xo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Bv=()=>{clearTimeout(this.Hv),this.Hv=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.zv=n=>{var o;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Us(n?.name)||Us(n?.value))return void kM.error("Invalid metric received",n);const i=typeof n.navigationURL=="string"?n.navigationURL:void 0,r=this.Uv(i);if(Bo(r))return;const s=jd(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${r}`;if(this.Wv&&n.value>=this.Wv)return void kM.error("Ignoring metric with value >= "+this.Wv,n);this.Rt.navigationKey!==s&&(this.Bv(),this.Hv=setTimeout(this.Bv,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,xA(n.attribution)&&this.attributionMetrics.indexOf(n.name)>-1){const c={};for(const l of S9n){const g=l==="url"&&typeof n.attribution[l]=="string"?this.Uv(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.Bv()},this.Vv=()=>{if(this.xo)return;let n,o,i,r,s=!1;const a=Ur.__PosthogExtensions__,A=a?.postHogWebVitalsCallbacksByFlavor,c=A?.[this.Gv]||(this.Gv==="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 kM.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.zv.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&o(this.zv.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.zv.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&r(this.zv.bind(this),g),this.xo=!0},this.Iv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[e2e]),this.startIfEnabled()}get Zv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const n=xA(this.Zv)?(t=this.Zv)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return Us(n)?((e=this._instance.persistence)===null||e===void 0?void 0:e.props.$web_vitals_allowed_metrics)||Yat:n}get flushToCaptureTimeoutMs(){return(xA(this.Zv)?this.Zv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=xA(this.Zv)?this.Zv.web_vitals_attribution:void 0;return hy(t)?t?Yat:[]:as(t)?t:b9n}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=xA(this.Zv)?this.Zv.__preview_web_vitals_soft_navs:void 0;return t!=null&&t}get Wv(){const t=xA(this.Zv)&&jd(this.Zv.__web_vitals_max_value)?this.Zv.__web_vitals_max_value:Gat;return t>0&&6e4>=t?Gat:t}get isEnabled(){const t=sd?.protocol;if(t!=="http:"&&t!=="https:")return kM.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=xA(this.Zv)?this.Zv.web_vitals:hy(this.Zv)?this.Zv:void 0;return hy(e)?e:this.Iv}startIfEnabled(){this.isEnabled&&!this.xo&&(kM.info("enabled, starting..."),this.zo(this.Vv))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const n=xA(e.capturePerformance)&&!!e.capturePerformance.web_vitals,o=xA(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[e2e]:n}),this._instance.persistence.register({[zrt]:o})),this.Iv=n,this.startIfEnabled()}get Gv(){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=Ur.__PosthogExtensions__,o=this.Gv,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?kM.error("failed to load script",r):t()})}Uv(t){const e=t||Ln?.location.href;if(!e)return void kM.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?iQ(e):e,o=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...Tk,...o||[]]:[];return sV(n,i,aV)}}},X9n={exceptionObserver:class{constructor(t){var e;this.Vv=()=>{var n;if(!Ln||!this.isEnabled||!(!((n=Ur.__PosthogExtensions__)===null||n===void 0)&&n.errorWrappingFunctions))return;const o=Ur.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Ur.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=Ur.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Qv&&this.Rr.capture_unhandled_errors&&(this.Qv=o(this.captureException.bind(this))),!this.Jv&&this.Rr.capture_unhandled_rejections&&(this.Jv=i(this.captureException.bind(this))),!this.Kv&&this.Rr.capture_console_errors&&(this.Kv=r(this.captureException.bind(this)))}catch(s){fV.error("failed to start",s),this.Xv()}},this._instance=t,this.Yv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[$ye]),this.wt=new U5n(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,$:fV})),this.Rr=this.tf(),this.startIfEnabledOrStop()}tf(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return xA(t)?e=sn(sn({},e),t):(Bo(t)?this.Yv: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?(fV.info("enabled"),this.Xv(),this.zo(this.Vv)):this.Xv()}zo(t){var e,n,o;!((e=Ur.__PosthogExtensions__)===null||e===void 0)&&e.errorWrappingFunctions?t():(n=Ur.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"exception-autocapture",i=>{if(i)return fV.error("failed to load script",i);t()})}Xv(){var t,e,n;(t=this.Qv)===null||t===void 0||t.call(this),this.Qv=void 0,(e=this.Jv)===null||e===void 0||e.call(this),this.Jv=void 0,(n=this.Kv)===null||n===void 0||n.call(this),this.Kv=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.Yv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[$ye]:this.Yv}),this.Rr=this.tf(),this.startIfEnabledOrStop())}onConfigChange(){this.Rr=this.tf()}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 fV.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.ef=[],this.if=new t4n([new m4n,new b4n,new f4n,new _4n,new E4n,new x4n,new C4n,new B4n],(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=prt.test(d)?d.replace(prt,"$1"):d;if(!p.match(/\S*Error: /)){for(const m of i){const _=m(p,o);if(_){a.push(_);const f=u4n(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(h4n(a,l)>=50)break}}const g=[...l].sort((h,d)=>d.start-h.start),u=g[g.length-1];if(u){const h=mrt(a,u);a.splice(u.start-h,h);for(const d of g)d.start-=h}for(const h of g)d4n(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++)p4n(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",A4n,g4n)),this._instance=t,this.ef=(e=(n=this._instance.persistence)===null||n===void 0?void 0:n.get_property("$error_tracking_suppression_rules"))!==null&&e!==void 0?e:[],this.nf=zte(this.sf()),this.rf=new Q4n(this.nf)}onConfigChange(){this.nf=zte(this.sf()),this.rf.setConfig(this.nf)}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.ef=r,this._instance.persistence&&this._instance.persistence.register({[Krt]:this.ef,[Zye]:s})}get af(){var t;const e=!!this._instance.get_property(Zye),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.if.buildFromUnknown(t,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(t,e){if(this.nf.enabled)try{if(!nA(t)||t.trim().length===0)return void F4.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)=>S4n.has(a)?(r.push(a),s):(s[a]=i[a],s),{}),droppedKeys:r}})(this.lf(e));o.length>0&&F4.warn("Ignoring reserved exception step fields",{droppedKeys:o}),this.rf.add(sn({[Kte]:t,[Vte]:new Date().toISOString()},n))}catch(n){F4.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.uf(e)){if(this.hf(e))return this.cf("Exception dropped: matched a suppression rule"),void F4.info("Skipping exception capture because a suppression rule matched");if(!this.af&&this.df(e))return this.cf("Exception dropped: thrown by a browser extension"),void F4.info("Skipping exception capture because it was thrown by an extension");if(!this.af&&this.vf(e))return this.cf("Exception dropped: thrown by an injected browser script"),void F4.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ff(e))return this.cf("Exception dropped: thrown by the PostHog SDK"),void F4.info("Skipping exception capture because it was thrown by the PostHog SDK")}const n=this.nf.enabled&&Us(t.$exception_steps)?this.pf(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.rf.clear(),i}catch(i){return tAt(i)||F4.error("Failed to capture exception event. Dropping this exception.",i),void this.rf.clear()}}catch(e){return void(tAt(e)||F4.error("Failed to process exception event. Ignoring this exception.",e))}}pf(t){try{const e=this.rf.getAttachable();return e.length===0?t:sn(sn({},t),{},{$exception_steps:e})}catch(e){return F4.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}cf(t){this.nf.enabled&&this.rf.add({[Kte]:t,[Vte]:new Date().toISOString()})}lf(t){return xA(t)?sn({},t):{}}sf(){var t,e;return(t=(e=this._instance.config.error_tracking)===null||e===void 0?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}hf(t){if(t.length===0)return!1;try{const e=t.reduce((n,{type:o,value:i})=>(nA(o)&&o.length>0&&n.$exception_types.push(o),nA(i)&&i.length>0&&n.$exception_values.push(i),n),{$exception_types:[],$exception_values:[]});return this.ef.some(n=>{const o=n.values.map(i=>{const r=Qat[i.operator],s=e[i.key];if(!r||!s)return!1;const a=as(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 F4.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}df(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&&H9n.some(i=>o.startsWith(i)));return n.length!==0&&(!n.every(({filename:o})=>!!o&&o.startsWith($2e))||t.some(({type:o,value:i})=>o==="NoResponse"||nA(i)&&L9n.some(({value:r,exact:s})=>s?i===r:i.includes(r)))&&!e.some(({in_app:o,filename:i})=>o&&!i?.startsWith($2e)))}vf(t){return t.some(({value:e})=>nA(e)&&O9n.some(n=>e.includes(n)))}ff(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}uf(t){return!Us(t)&&as(t)}}},q9n=sn({productTours:class{get Ml(){return this._instance.persistence}constructor(t){this.gf=null,this.mf=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({[n2e]:!!e.productTours}),!X2e(this._instance))return!this.gf&&Us((n=this.Ml)===null||n===void 0?void 0:n.props.ph_product_tours)||dne.info("product tours disabled; stopping and clearing cached tours"),(o=this.gf)===null||o===void 0||o.stop(),this.gf=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.gf&&X2e(this._instance)&&this.zo(()=>this.yf())}zo(t){var e,n,o;!((e=Ur.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours?t():(n=Ur.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"product-tours",i=>{i?dne.error("Could not load product tours script",i):t()})}yf(){var t;!this.gf&&(!((t=Ur.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours)&&(this.gf=Ur.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(as(this.mf)&&!e)return void t(this.mf,{isLoaded:!0});const n=this.Ml;if(n){const o=n.props[r2e];if(as(o)&&!e)return this.mf=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(!X2e(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||dne.warn(s):dne.error(s),void t([],{isLoaded:!1,error:s})}const r=as(o.json.product_tours)?o.json.product_tours:[];this.mf=r,n&&n.register({[r2e]:r}),t(r,{isLoaded:!0})}})}getActiveProductTours(t){Us(this.gf)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.gf.getActiveProductTours(t)}showProductTour(t){var e;(e=this.gf)===null||e===void 0||e.showTourById(t)}previewTour(t){this.gf?this.gf.previewTour(t):this.zo(()=>{var e;this.yf(),(e=this.gf)===null||e===void 0||e.previewTour(t)})}dismissProductTour(){var t;(t=this.gf)===null||t===void 0||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.gf)===null||t===void 0||t.nextStep()}previousStep(){var t;(t=this.gf)===null||t===void 0||t.previousStep()}clearCache(){var t;this.mf=null,(t=this.Ml)===null||t===void 0||t.unregister("ph_product_tours")}resetTour(t){var e;(e=this.gf)===null||e===void 0||e.resetTour(t)}resetAllTours(){var t;(t=this.gf)===null||t===void 0||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.gf)===null||e===void 0||e.cancelPendingTour(t)}}},pne),$9n={siteApps:class{constructor(t){this._instance=t,this.bf=0,this._f=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}wf(t,e){if(!e)return;const n=this.globalsForEvent(e);this._f.push(n),this._f.length>1e3&&(this._f=this._f.slice(10))}get siteAppLoaders(){var t;return(t=Ur._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.wf.bind(this));this.kf=()=>{t(),this._f=[],this.kf=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({},Srt(t,v9n)),{},{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}}Sf(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)||(b9.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)||(b9.error("prepare_external_dependency_script returned null"),null):t}xf(){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.bf++,this.Cf)return this.$f();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.Sf(m);return _&&u.add(_),_},p=m=>m.map(_=>typeof _=="string"?_:d(_)).filter(_=>!ad(_));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.Cf=()=>{l.forEach(m=>m()),this.Cf=void 0},this.$f()}$f(){let t=!1;return()=>{var e;t||(t=!0,this.bf--,this.bf===0&&((e=this.Cf)===null||e===void 0||e.call(this)))}}Tf(t,e=!0){const n=this.xf();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._f.length&&(b9.info(`Processing ${this._f.length} events for site app with id ${t.id}`),this._f.forEach(s=>this.Tf(()=>{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.kf)===null||r===void 0||r.call(this))};let o=!1;const i=r=>{e.errored=!r,e.loaded=!0,b9.info(`Site app with id ${t.id} ${r?"loaded":"errored"}`),o&&n()};try{const{processEvent:r}=this.Tf(s=>t.init({posthog:this._instance,callback(a){s(),i(a)}}),!1);r&&(e.processEvent=r),o=!0}catch(r){b9.error(Kat+t.id,r),i(!1)}if(o&&e.loaded)try{n()}catch(r){b9.error(`Error while processing buffered events PostHog app with config id ${t.id}`,r),e.errored=!0}}If(){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)}Mf(t){if(Object.keys(this.apps).length===0)return;const e=this.globalsForEvent(t);for(const n of Object.values(this.apps))try{this.Tf(()=>{var o;return(o=n.processEvent)===null||o===void 0?void 0:o.call(n,e)})}catch(o){b9.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.If(),void this._instance.on("eventCaptured",a=>this.Mf(a))):void b9.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.kf)===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;Ur[`__$$ph_site_app_${a}`]=this._instance,(r=Ur.__PosthogExtensions__)===null||r===void 0||(s=r.loadSiteApp)===null||s===void 0||s.call(r,this._instance,A,c=>{if(c)return b9.error(Kat+a,c)})}else b9.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Z9n={tracingHeaders:class{constructor(t){this._instance=t,this.Ef=void 0,this.Pf=void 0,this.Rf=void 0,this.Vv=()=>{const e=this.Af();var n,o;e?(Bo(this.Ef)&&(this.Ef=(n=Ur.__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.Pf)&&(this.Pf=(o=Ur.__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.Xv()}}initialize(){this.startIfEnabledOrStop()}zo(t){var e,n,o;!((e=Ur.__PosthogExtensions__)===null||e===void 0)&&e.tracingHeadersPatchFns?t():(n=Ur.__PosthogExtensions__)===null||n===void 0||(o=n.loadExternalDependency)===null||o===void 0||o.call(n,this._instance,"tracing-headers",i=>{if(i)return B9n.error("failed to load script",i);t()})}Ff(){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}Af(){const t=this.Ff();return as(t)?(as(this.Rf)?this.Rf.splice(0,this.Rf.length,...t):this.Rf=[...t],t.length>0?this.Rf:void 0):(as(this.Rf)&&this.Rf.splice(0),this.Rf=t||void 0,this.Rf)}Xv(){var t,e;(t=this.Ef)===null||t===void 0||t.call(this),(e=this.Pf)===null||e===void 0||e.call(this),this.Ef=void 0,this.Pf=void 0}startIfEnabledOrStop(){this.Af()?this.zo(this.Vv):this.Xv()}}},e7n=sn({surveys:class extends P9n{constructor(t){var e;super(new R9n(t),(e=t,{get projectToken(){return e.config.token},kv:new N9n(e)})),this._instance=t}qh(t,e){const n=e.query?uV(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})})}}},pne),t7n={toolbar:class{constructor(t){this.instance=t}Of(t){Ur.ph_toolbar_state=t}Df(){var t;return(t=Ur.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(u2e(this.instance.config)||!Ln||!No)return!1;t=(o=t)!==null&&o!==void 0?o:Ln.location,n=(i=n)!==null&&i!==void 0?i:Ln.history;try{if(!e){try{Ln.localStorage.setItem("test","test"),Ln.localStorage.removeItem("test")}catch{return!1}e=Ln?.localStorage}const r=T9n||one(t.hash,"__posthog")||one(t.hash,"state");let s;const a=r?Art(()=>JSON.parse(atob(decodeURIComponent(r))))||Art(()=>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(Jat)||"{}"),s.source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}Lf(t){const e=Ur.ph_load_toolbar||Ur.ph_load_editor;!Us(e)&&L_(e)?e(t,this.instance):Wat.warn("No toolbar load function found")}loadToolbar(t){const e=!!No?.getElementById("__POSTHOG_TOOLBAR__");if(!Ln||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(Ln.localStorage.setItem(Jat,JSON.stringify(sn(sn({},o),{},{source:void 0}))),this.Df()===2)this.Lf(o);else if(this.Df()===0){var i,r;this.Of(1),(i=Ur.__PosthogExtensions__)===null||i===void 0||(r=i.loadExternalDependency)===null||r===void 0||r.call(i,this.instance,"toolbar",s=>{if(s)return Wat.error("[Toolbar] Failed to load",s),void this.Of(0);this.Of(2),this.Lf(o)}),ml(Ln,"turbolinks:load",()=>{this.Of(0),this.loadToolbar(o)})}return!0}Nf(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,n=void 0){return this.maybeLoadToolbar(t,e,n)}}},n7n=sn({experiments:class ex{get Rr(){return this._instance.config}constructor(e){this._instance=e,this.getWebExperimentsAndEvaluateDisplayLogic=(n=!1)=>{this.getWebExperiments(o=>{ex.qf("retrieved web experiments from the server"),this.jf=new Map,o.forEach(i=>{if(i.feature_flag_key){var r;this.jf&&(ex.qf("setting flag key ",i.feature_flag_key," to web experiment ",i),(r=this.jf)===null||r===void 0||r.set(i.feature_flag_key,i));const s=this._instance.getFeatureFlag(i.feature_flag_key);nA(s)&&i.variants[s]&&this.Bf(i.name,s,i.variants[s].transforms)}else if(i.variants)for(const s in i.variants){const a=i.variants[s];ex.Hf(a,this._instance)&&this.Bf(i.name,s,a.transforms)}})},n)},this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}initialize(){}onFeatureFlags(e){if(this._is_bot())ex.qf(nAt);else if(!this.Rr.disable_web_experiments){if(Us(this.jf))return this.jf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ex.qf("applying feature flags",e),e.forEach(n=>{var o;if(this.jf&&(!((o=this.jf)===null||o===void 0)&&o.has(n))){var i;const r=this._instance.getFeatureFlag(n),s=(i=this.jf)===null||i===void 0?void 0:i.get(n);r&&s?.variants[r]&&this.Bf(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){const e=ex.getWindowLocation();if(e?.search){const n=Rk(e?.search,"__experiment_id"),o=Rk(e?.search,"__experiment_variant");n&&o&&(ex.qf(`previewing web experiments ${n} && ${o}`),this.getWebExperiments(i=>{this.zf(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||[])})}zf(e,n,o){const i=o.filter(r=>r.id===e);i&&i.length>0&&(ex.qf(`Previewing web experiment [${i[0].name}] with variant [${n}]`),this.Bf(i[0].name,n,i[0].variants[n].transforms))}static Hf(e,n){return!Us(e.conditions)&&ex.Uf(e,n)&&ex.Wf(e)}static Uf(e,n){var o;if(Us(e.conditions)||Us((o=e.conditions)===null||o===void 0?void 0:o.url))return!0;const i=ex.getWindowLocation();if(i){var r,s,a;const A=pst(n,i.href);return!(!((r=e.conditions)===null||r===void 0)&&r.url)||G9n[(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 Ln?.location}static Wf(e){var n;if(Us(e.conditions)||Us((n=e.conditions)===null||n===void 0?void 0:n.utm))return!0;const o=Ost();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 qf(e,...n){gi.info(`[WebExperiments] ${e}`,n)}Bf(e,n,o){this._is_bot()?ex.qf(nAt):n!=="control"?o.forEach(i=>{if(i.selector){var r;ex.qf(`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)})}}):ex.qf("Control variants leave the page unmodified.")}_is_bot(){return F_&&this._instance?Bat(F_,this.Rr.custom_blocked_useragents):void 0}}},pne),o7n={conversations:class{constructor(t){this._instance=t,this.Vf=void 0,this._conversationsManager=null,this.Gf=!1,this.ne=null,this.Zf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations||(this.Qf=t.ok,!t.ok))return;const e=t.config.conversations;Us(e)||(hy(e)?this.Vf=e:(this.Vf=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;(t=this._conversationsManager)===null||t===void 0||t.reset(),this._conversationsManager=null,this.Vf=void 0,this.ne=null,this.Qf=void 0,this.Zf=!1}loadIfEnabled(){if(this._conversationsManager||this.Gf||this._instance.config.disable_conversations||u2e(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=Ur?.__PosthogExtensions__;if(t&&!Bo(this.Vf)&&this.Vf)if(this.ne&&this.ne.token){this.Gf=!0;try{const e=t.initConversations;if(e)return this.Jf(e),void(this.Gf=!1);const n=t.loadExternalDependency;if(!n)return void this.Kf(c2e);n(this._instance,"conversations",o=>{o||!t.initConversations?this.Kf("Could not load conversations script",o):this.Jf(t.initConversations),this.Gf=!1})}catch(e){this.Kf("Error initializing conversations",e),this.Gf=!1}}else h5.error("Conversations enabled but missing token in remote config.")}Jf(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.Zf=!1,h5.info("Conversations loaded successfully")}catch(e){this.Kf("Error completing conversations initialization",e)}else h5.error("Cannot complete initialization: remote config is null")}Kf(t,e){h5.error(t,e),this._conversationsManager=null,this.Gf=!1,this.Zf=!0}show(){this._conversationsManager?this._conversationsManager.show():h5.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Vf===!0&&!ad(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":u2e(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Qf===!1?"remote_config_failed":Bo(this.Vf)?this.Qf?"disabled_in_project":"remote_config_pending":this.Vf?Us(this.ne)||!this.ne.token?"missing_token":Ur?.__PosthogExtensions__?this.Gf?"initializing":this.Zf?"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 jg(function*(){return o._conversationsManager?o._conversationsManager.sendMessage(t,e,n):(h5.warn(LM),null)})()}getMessages(t,e){var n=this;return jg(function*(){return n._conversationsManager?n._conversationsManager.getMessages(t,e):(h5.warn(LM),null)})()}markAsRead(t){var e=this;return jg(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(h5.warn(LM),null)})()}getTickets(t){var e=this;return jg(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(h5.warn(LM),null)})()}requestRestoreLink(t){var e=this;return jg(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(h5.warn(LM),null)})()}restoreFromToken(t){var e=this;return jg(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(h5.warn(LM),null)})()}restoreFromUrlToken(){var t=this;return jg(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(h5.warn(LM),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()}}},i7n={logs:class{constructor(t){var e;this._instance=t,this.name="logs",this.Xf=!1,this.Yf=!1,this.tp=!1,this.$=Ad("[logs]"),this.ep=sn(sn({},this.$),{},{error:(...n)=>{n.some(sAt)||this.$.error(...n)}}),this.al=[],this.np=[],this.hd=0,this.Io=!1,this.sp=[],this.rp=[],this.op=!1,this.ap=!1,this.lp=()=>{var n,o;this.Io||(this.hd=0,(n=this.up)===null||n===void 0||n.onReconnect(),(o=this.hp)===null||o===void 0||o.onReconnect())},this._instance&&(!((e=this._instance.config.logs)===null||e===void 0)&&e.captureConsoleLogs)&&(this.Xf=!0),Ln&&ml(Ln,"online",this.lp)}cp(t,e,n,o){var i;const r=oAt((i=this._instance)===null||i===void 0||(i=i.config)===null||i===void 0?void 0:i.logs,n);return[new F4n(this.dp(t,e),r,this.ep,()=>this.vp(),s=>s(),void 0,o),r]}fp(){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.up&&this.pp===e||((n=this.up)===null||n===void 0||n.reset(),this.pp=e,[this.up,this.gp]=this.cp(()=>this.al,o=>{this.al=o})),this.up}mp(){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.hp&&this.yp===e||((n=this.hp)===null||n===void 0||n.reset(),this.yp=e,[this.hp,this.bp]=this.cp(()=>this.np,o=>{this.np=o},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},iAt)),this.hp}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.Xf=!0),(this.Xf||this._p()&&this.wp())&&this.kp();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.Sp(),(t=this.Po)===null||t===void 0||t.dispose(),this.Po=void 0,this.wo=void 0,this.tp=!1,Ln?.removeEventListener("online",this.lp),(e=this.xp)===null||e===void 0||e.call(this),this.xp=void 0,(n=this.up)===null||n===void 0||n.reset(),(o=this.hp)===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;Us(o)?this.Cp():((n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$logs_capture_enabled_server_side:!!o}),o?(this.Xf=!0,this.Yf||this.kp(),this.loadIfEnabled()):this.Cp())}reset(){var t,e,n,o;this.Sp(),(t=this.up)===null||t===void 0||t.clearQueue(),this.al=[],(e=this.up)===null||e===void 0||e.reset(),(n=this.hp)===null||n===void 0||n.clearQueue(),this.np=[],(o=this.hp)===null||o===void 0||o.reset(),this.hd=0}captureLog(t){this.Io||this.fp().captureLog(t)}captureConsoleLog(t){this.Io||this.mp().captureLog(t)}captureBufferedConsoleLog(t,e,n){this.Io||this.mp().captureLog(t,{context:e,occurredAtMs:n})}wp(){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[Vrt])}_p(){var t,e,n;return!(!((t=this._instance)===null||t===void 0||(e=t.nl)===null||e===void 0)&&e.call(t))||!!(!((n=Ur._POSTHOG_REMOTE_CONFIG)===null||n===void 0||(n=n[this._instance.config.token])===null||n===void 0)&&n.config)}$h(){var t;this.Sp(),(t=this.hp)===null||t===void 0||t.clearQueue(),this.np=[]}Cp(){this.Xf||this.Sp()}kp(){var t;if(this.op||!Ur?.console)return;const e=oAt((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.logs).maxBufferSize;let n=!0;this.rp.push(()=>{n=!1});for(const o of Y9n){let i;try{i=U9n(Ur.console[o])}catch{continue}i&&this.rp.push(IV(Ur.console,o,r=>{const s=(...a)=>{try{n&&this.$p(o,a,e)}catch{}return r.apply(Ur.console,a)};return s.__rrweb_original__=i,s}))}this.op=!0,this.Tp=setTimeout(()=>{this.Sp()},3e4)}$p(t,e,n){var o;if(this.op&&!this.ap&&e.length!==0)if(!((o=this._instance)===null||o===void 0)&&o.is_capturing()){if(n>this.sp.length){this.ap=!0;try{this.sp.push({level:t,args:e,occurredAtMs:Date.now(),context:this.vp()})}finally{this.ap=!1}}}else this.Sp()}Sp(){if(this.sp=[],this.op){this.op=!1,this.Tp&&(clearTimeout(this.Tp),this.Tp=void 0);for(const t of this.rp)t();this.rp=[]}}Ip(){const t=this.sp;return this.Sp(),t}get logger(){return this.Mp||(this.Mp={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.Mp}flushLogs(t){t?this.Ep(t):(this.up&&this.up.flush().catch(e=>this.Pp(e)),this.hp&&this.hp.flush().catch(e=>this.Pp(e)))}Pp(t){sAt(t)||this.$.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Io||!this.Xf||this.Yf||this.tp)return;const t=Ur?.__PosthogExtensions__;if(!t)return this.$.error("PostHog Extensions not found."),void this.Sp();const e=t.loadExternalDependency;if(!e)return this.$.error(c2e),void this.Sp();this.tp=!0;try{e(this._instance,"logs",n=>{if(this.tp=!1,this.Io||!this.Xf)return;const o=t.logs;if(n||!o?.initializeLogs)this.$.error("Could not load logs script",n),this.Sp();else{var i;const a=this.Ip();var r,s;this.xp=o.initializeLogs((i=this.wo)!==null&&i!==void 0?i:this._instance),this.Yf=!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.tp=!1,n}}dp(t,e){const n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:o=>o===y9.LogsQueue?t():void 0,setPersistedProperty(o,i){var r;o===y9.LogsQueue&&e((r=i)!==null&&r!==void 0?r:[])},js:o=>this.js(o),getLibraryId:()=>Ym.LIB_NAME,getLibraryVersion:()=>Ym.LIB_VERSION}}js(t){return new Promise(e=>{if(Lst(this.hd,3))return void e({kind:"fatal",error:Z2e(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:Z2e(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Rp(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:r=>{const s=r.statusCode;if(this.Ap(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:Z2e(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}`)})}}})})}Ap(t){(t!==0||this._instance.__loaded)&&(this.hd=Hst(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.")))}Ep(t){this.al.length>0&&this.Fp(t,this.al,this.gp,Ym.LIB_NAME,e=>{this.al=e}),this.np.length>0&&this.Fp(t,this.np,this.bp,iAt,e=>{this.np=e})}Fp(t,e,n,o,i){if(e.length===0)return;const r=e.map(a=>a.record);i([]);const s=Nrt(r,Drt(n,Ym.LIB_NAME,Ym.LIB_VERSION),o,Ym.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Rp(),data:s,compression:"best-available",batchKey:"logs",transport:t})}Rp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}vp(){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,Us(i)||(e.sessionStartTimestamp=i),Us(r)||(e.lastActivityTimestamp=r)}if(!(Ur==null||(t=Ur.location)===null||t===void 0)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?iQ(Ur.location.href):Ur.location.href),this._instance.featureFlags){const n=this._instance.featureFlags.getFlags();n&&n.length>0&&(e.activeFeatureFlags=n)}return e}}},r7n={metrics:class{constructor(t){this._instance=t,this.$=Ad("[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.Op?this.Op=(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=z9n(n,i),s=J9n(n,i);return()=>{o=!1,r(),s()}})(this._instance):!e&&this.Op&&(this.Op(),this.Op=void 0)}fp(){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.up&&this.pp===e||((n=this.up)===null||n===void 0||n.reset(),this.pp=e,this.up=new L4n(this.dp(),(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.up}count(t,e=1,n){this.fp().count(t,e,n)}gauge(t,e,n){this.fp().gauge(t,e,n)}histogram(t,e,n){this.fp().histogram(t,e,n)}flush(t){if(!this.up)return Promise.resolve();if(t){const e=this.up.drainWindow();return e&&this.Ys(e,t),Promise.resolve()}return this.up.flush().catch(e=>this.$.error("PostHog metrics flush failed:",e))}reset(){var t;(t=this.up)===null||t===void 0||t.reset()}dispose(){var t,e;this.Io=!0,(t=this.Op)===null||t===void 0||t.call(this),this.Op=void 0,(e=this.up)===null||e===void 0||e.reset()}dp(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ys:n=>e.Ys(n),getLibraryId:()=>Ym.LIB_NAME,getLibraryVersion:()=>Ym.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.Dp(),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}`)})}}}))})}Dp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};_V.__defaultExtensionClasses=sn({},sn(sn(sn(sn(sn(sn(sn(sn(sn(sn(sn(sn(sn({},pne),W9n),j9n),X9n),q9n),$9n),e7n),Z9n),t7n),n7n),o7n),i7n),r7n));var Yk=(function(){Ym.SDK_DIST_CHANNEL="npm";const t=dV[mV]=new _V;return(function(){function e(){e.done||(e.done=!0,Iat=!1,Ql(dV,function(n){n._dom_loaded()}))}No?.addEventListener?No.readyState==="complete"?e():ml(No,"DOMContentLoaded",e,{capture:!1}):Ln&&gi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),t})();class HM 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 cAt 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 nxe extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const n=e?.cause?e.cause instanceof Error?e.cause:new cAt(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 lAt=(()=>{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})(),s7n=typeof globalThis.AbortController=="function",gAt=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",a7n=typeof globalThis.ReadableStream=="function",A7n=typeof globalThis.FormData=="function",uAt=["get","post","put","patch","head","delete"],c7n={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},oxe=2147483647,l7n=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,dAt=Symbol("stop");class hAt{options;constructor(e){this.options=e}}const g7n=t=>new hAt(t),u7n={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},d7n={next:!0},h7n={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},p7n=t=>{if(!t)return 0;if(t instanceof FormData){let e=0;for(const[n,o]of t)e+=l7n,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},pAt=(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))}}))},m7n=(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(pAt(t.body,n,e),{status:t.status,statusText:t.statusText,headers:t.headers})},_7n=(t,e,n)=>{if(!t.body)return t;const o=p7n(n??t.body);return new Request(t,{duplex:"half",body:pAt(t.body,o,e)})},OM=t=>t!==null&&typeof t=="object",mne=(...t)=>{for(const e of t)if((!OM(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return ixe({},...t)},mAt=(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 _ne(t,e,n){return Object.hasOwn(e,n)&&e[n]===void 0?[]:ixe(t[n]??[],e[n]??[])}const _At=(t={},e={})=>({beforeRequest:_ne(t,e,"beforeRequest"),beforeRetry:_ne(t,e,"beforeRetry"),afterResponse:_ne(t,e,"afterResponse"),beforeError:_ne(t,e,"beforeError")}),f7n=(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(OM(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},ixe=(...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(OM(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&&(!OM(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:f7n(i,A);continue}OM(A)&&a in e&&(A=ixe(e[a],A)),e={...e,[a]:A}}OM(s.hooks)&&(o=_At(o,s.hooks),e.hooks=o),OM(s.headers)&&(n=mAt(n,s.headers),e.headers=n)}return i!==void 0&&(e.searchParams=i),r.length>0&&(r.length===1?e.signal=r[0]:gAt?e.signal=AbortSignal.any(r):e.signal=r.at(-1)),e},I7n=t=>uAt.includes(t)?t.toUpperCase():t,fAt={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},C7n=(t={})=>{if(typeof t=="number")return{...fAt,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{...fAt,...e}};class rxe extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}}async function y7n(t,e,n,o){return new Promise((i,r)=>{const s=setTimeout(()=>{n&&n.abort(),r(new rxe(t))},o.timeout);o.fetch(t,e).then(i).catch(r).then(()=>{clearTimeout(s)})})}async function x7n(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 E7n=(t,e)=>{const n={};for(const o in e)Object.hasOwn(e,o)&&!(o in h7n)&&!(o in u7n)&&(!(o in t)||o in d7n)&&(n[o]=e[o]);return n},B7n=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 b7n(t){return t instanceof HM||t?.name===HM.name}function S7n(t){return t instanceof rxe||t?.name===rxe.name}let IAt=class Vnt{static create(e,n){const o=new Vnt(e,n),i=async()=>{if(typeof o.#e.timeout=="number"&&o.#e.timeout>oxe)throw new RangeError(`The \`timeout\` option cannot be greater than ${oxe}`);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 hAt)throw o.#r(A),o.#r(s),new nxe(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 HM(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(!a7n)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");const a=s.clone();return o.#r(s),m7n(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(c7n))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:mAt(this.#t.headers,n.headers),hooks:_At({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},n.hooks),method:I7n(n.method??this.#t.method??"GET"),prefixUrl:String(n.prefixUrl||""),retry:C7n(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}s7n&&gAt&&(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),lAt&&(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&&(A7n&&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),B7n(this.#e.searchParams)){const r="?"+(typeof this.#e.searchParams=="string"?this.#e.searchParams.replace(/^\?/,""):new URLSearchParams(Vnt.#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(!lAt)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 cAt(e);if(n instanceof nxe)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(S7n(e)&&!this.#e.retry.retryOnTimeout)throw e;if(b7n(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),oxe);if(this.#n<1)throw n;if(await x7n(o,this.#i?{signal:this.#i}:{}),n instanceof nxe&&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===dAt)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=E7n(this.request,this.#e);return this.#s=this.request,this.request=this.#s.clone(),this.#e.timeout===!1?this.#e.fetch(this.#s,e):y7n(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:_7n(e,this.#e.onUploadProgress,n??this.#e.body??void 0)}};const sxe=t=>{const e=(n,o)=>IAt.create(n,mne(t,o));for(const n of uAt)e[n]=(o,i)=>IAt.create(o,mne(t,i,{method:n}));return e.create=n=>sxe(mne(n)),e.extend=n=>(typeof n=="function"&&(n=n(t??{})),sxe(mne(t,n))),e.stop=dAt,e.retry=g7n,e},Q7n=sxe();class v7n extends HM{constructor(e,n,o,i){super(e,n,o),this.name="RegistryHTTPError",this.message=i}}function CV(t){return typeof window<"u"?window[t]:null}function GM(){const t=CV("TSCIRCUIT_REGISTRY_API_BASE_URL")||void 0||"https://registry-api.tscircuit.com",e=CV("TSCIRCUIT_REGISTRY_TOKEN");return Q7n.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 v7n(i,n,o,l.join(" | "))}]}})}function fne(){return!!CV("TSCIRCUIT_REGISTRY_TOKEN")}const Ine={get:(t,e)=>GM().get(t,e),post:(t,e)=>GM().post(t,e),put:(t,e)=>GM().put(t,e),delete:(t,e)=>GM().delete(t,e),patch:(t,e)=>GM().patch(t,e)},P7n="phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo",w7n="https://postpig.tscircuit.com",CAt="runframe:anonymous-id",axe=()=>typeof window<"u",yAt=t=>t.includes("localhost")||t.includes("127.0.0.1"),M7n=t=>{try{return new URL(t).hostname}catch{return null}},D7n=()=>{if(!axe())return null;let t=null;return document.referrer&&(t=M7n(document.referrer)),t??window.location.hostname},N7n=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,R7n=()=>{if(!axe())return null;try{const t=window.localStorage.getItem(CAt);if(t)return t;const e=N7n();return window.localStorage.setItem(CAt,e),e}catch{return null}},T7n=()=>CV("TSCIRCUIT_USE_RUNFRAME_FOR_CLI")===!0,xAt=()=>!axe()||yAt(window.location.hostname)&&!T7n()?!1:(Yk.__loaded||Yk.init(P7n,{api_host:w7n,person_profiles:"always"}),!0),k7n=()=>{if(!xAt())return null;const t=D7n(),e=t!=null&&!yAt(t);let n=null;e||(n=R7n());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}},F7n=(t,{source:e,...n})=>{const o=k7n();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),Yk.identify(s,A)}Yk.capture(t,{...n,source:e,embed_domain:i,runframe_anonymous_id:r,identity_type:a})},L7n=t=>{F7n("runframe_activity",t)};xAt();function H7n(t){const e=String.fromCodePoint(...t);return btoa(e)}var tm=Uint8Array,D3=Uint16Array,Axe=Int32Array,Cne=new tm([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]),yne=new tm([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]),cxe=new tm([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),EAt=function(t,e){for(var n=new D3(31),o=0;o<31;++o)n[o]=e+=1<<t[o-1];for(var i=new Axe(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}},BAt=EAt(Cne,2),bAt=BAt.b,lxe=BAt.r;bAt[28]=258,lxe[258]=28;for(var SAt=EAt(yne,0),O7n=SAt.b,QAt=SAt.r,gxe=new D3(32768),gd=0;gd<32768;++gd){var uQ=(gd&43690)>>1|(gd&21845)<<1;uQ=(uQ&52428)>>2|(uQ&13107)<<2,uQ=(uQ&61680)>>4|(uQ&3855)<<4,gxe[gd]=((uQ&65280)>>8|(uQ&255)<<8)>>1}for(var S9=(function(t,e,n){for(var o=t.length,i=0,r=new D3(e);i<o;++i)t[i]&&++r[t[i]-1];var s=new D3(e);for(i=1;i<e;++i)s[i]=s[i-1]+r[i-1]<<1;var a;if(n){a=new D3(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[gxe[g]>>A]=c}else for(a=new D3(o),i=0;i<o;++i)t[i]&&(a[i]=gxe[s[t[i]-1]++]>>15-t[i]);return a}),dQ=new tm(288),gd=0;gd<144;++gd)dQ[gd]=8;for(var gd=144;gd<256;++gd)dQ[gd]=9;for(var gd=256;gd<280;++gd)dQ[gd]=7;for(var gd=280;gd<288;++gd)dQ[gd]=8;for(var yV=new tm(32),gd=0;gd<32;++gd)yV[gd]=5;var G7n=S9(dQ,9,0),Y7n=S9(dQ,9,1),U7n=S9(yV,5,0),K7n=S9(yV,5,1),uxe=function(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},L4=function(t,e,n){var o=e/8|0;return(t[o]|t[o+1]<<8)>>(e&7)&n},dxe=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(e&7)},hxe=function(t){return(t+7)/8|0},Uk=function(t,e,n){return(e==null||e<0)&&(e=0),(n==null||n>t.length)&&(n=t.length),new tm(t.subarray(e,n))},V7n=["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"],ix=function(t,e,n){var o=new Error(e||V7n[t]);if(o.code=t,Error.captureStackTrace&&Error.captureStackTrace(o,ix),!n)throw o;return o},vAt=function(t,e,n,o){var i=t.length,r=0;if(!i||e.f&&!e.l)return n||new tm(0);var s=!n,a=s||e.i!=2,A=e.i;s&&(n=new tm(i*3));var c=function(he){var ye=n.length;if(he>ye){var Qe=new tm(Math.max(ye*2,he));Qe.set(n),n=Qe}},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=L4(t,g,1);var f=L4(t,g+1,3);if(g+=3,f)if(f==1)h=Y7n,d=K7n,p=9,m=5;else if(f==2){var x=L4(t,g,31)+257,E=L4(t,g+10,15)+4,B=x+L4(t,g+5,31)+1;g+=14;for(var S=new tm(B),Q=new tm(19),P=0;P<E;++P)Q[cxe[P]]=L4(t,g+P*3,7);g+=E*3;for(var M=uxe(Q),k=(1<<M)-1,R=S9(Q,M,1),P=0;P<B;){var F=R[L4(t,g,k)];g+=F&15;var I=F>>4;if(I<16)S[P++]=I;else{var O=0,U=0;for(I==16?(U=3+L4(t,g,3),g+=2,O=S[P-1]):I==17?(U=3+L4(t,g,7),g+=3):I==18&&(U=11+L4(t,g,127),g+=7);U--;)S[P++]=O}}var Y=S.subarray(0,x),J=S.subarray(x);p=uxe(Y),m=uxe(J),h=S9(Y,p,1),d=S9(J,m,1)}else ix(1);else{var I=hxe(g)+4,C=t[I-4]|t[I-3]<<8,y=I+C;if(y>i){A&&ix(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&&ix(0);break}}a&&c(u+131072);for(var ee=(1<<p)-1,W=(1<<m)-1,X=g;;X=g){var O=h[dxe(t,g)&ee],ie=O>>4;if(g+=O&15,g>_){A&&ix(0);break}if(O||ix(2),ie<256)n[u++]=ie;else if(ie==256){X=g,h=null;break}else{var se=ie-254;if(ie>264){var P=ie-257,oe=Cne[P];se=L4(t,g,(1<<oe)-1)+bAt[P],g+=oe}var ge=d[dxe(t,g)&W],ue=ge>>4;ge||ix(3),g+=ge&15;var J=O7n[ue];if(ue>3){var oe=yne[ue];J+=dxe(t,g)&(1<<oe)-1,g+=oe}if(g>_){A&&ix(0);break}a&&c(u+131072);var Ie=u+se;if(u<J){var le=r-J,_e=Math.min(J,Ie);for(le+u<0&&ix(3);u<_e;++u)n[u]=o[le+u]}for(;u<Ie;++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?Uk(n,0,u):n.subarray(0,u)},S8=function(t,e,n){n<<=e&7;var o=e/8|0;t[o]|=n,t[o+1]|=n>>8},xV=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},pxe=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:DAt,l:0};if(i==1){var s=new tm(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 D3(u+1),d=mxe(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 tm(h),l:d}},mxe=function(t,e,n){return t.s==-1?Math.max(mxe(t.l,e,n+1),mxe(t.r,e,n+1)):e[t.s]=n},PAt=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new D3(++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}},EV=function(t,e){for(var n=0,o=0;o<e.length;++o)n+=t[o]*e[o];return n},wAt=function(t,e,n){var o=n.length,i=hxe(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},MAt=function(t,e,n,o,i,r,s,a,A,c,l){S8(e,l++,n),++i[256];for(var g=pxe(i,15),u=g.t,h=g.l,d=pxe(r,15),p=d.t,m=d.l,_=PAt(u),f=_.c,I=_.n,C=PAt(p),y=C.c,x=C.n,E=new D3(19),B=0;B<f.length;++B)++E[f[B]&31];for(var B=0;B<y.length;++B)++E[y[B]&31];for(var S=pxe(E,7),Q=S.t,P=S.l,M=19;M>4&&!Q[cxe[M-1]];--M);var k=c+5<<3,R=EV(i,dQ)+EV(r,yV)+s,F=EV(i,u)+EV(r,p)+s+14+3*M+EV(E,Q)+2*E[16]+3*E[17]+7*E[18];if(A>=0&&k<=R&&k<=F)return wAt(e,l,t.subarray(A,A+c));var O,U,Y,J;if(S8(e,l,1+(F<R)),l+=2,F<R){O=S9(u,h,0),U=u,Y=S9(p,m,0),J=p;var ee=S9(Q,P,0);S8(e,l,I-257),S8(e,l+5,x-1),S8(e,l+10,M-4),l+=14;for(var B=0;B<M;++B)S8(e,l+3*B,Q[cxe[B]]);l+=3*M;for(var W=[f,y],X=0;X<2;++X)for(var ie=W[X],B=0;B<ie.length;++B){var se=ie[B]&31;S8(e,l,ee[se]),l+=Q[se],se>15&&(S8(e,l,ie[B]>>5&127),l+=ie[B]>>12)}}else O=G7n,U=dQ,Y=U7n,J=yV;for(var B=0;B<a;++B){var oe=o[B];if(oe>255){var se=oe>>18&31;xV(e,l,O[se+257]),l+=U[se+257],se>7&&(S8(e,l,oe>>23&31),l+=Cne[se]);var ge=oe&31;xV(e,l,Y[ge]),l+=J[ge],ge>3&&(xV(e,l,oe>>5&8191),l+=yne[ge])}else xV(e,l,O[oe]),l+=U[oe]}return xV(e,l,O[256]),l+U[256]},z7n=new Axe([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),DAt=new tm(0),J7n=function(t,e,n,o,i,r){var s=r.z||t.length,a=new tm(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=z7n[e-1],u=g>>13,h=g&8191,d=(1<<n)-1,p=r.p||new D3(32768),m=r.h||new D3(d+1),_=Math.ceil(n/3),f=2*_,I=function(Pe){return(t[Pe]^t[Pe+1]<<_^t[Pe+2]<<f)&d},C=new Axe(25e3),y=new D3(288),x=new D3(32),E=0,B=0,S=r.i||0,Q=0,P=r.w||0,M=0;S+2<s;++S){var k=I(S),R=S&32767,F=m[k];if(p[R]=F,m[k]=R,P<=S){var O=s-S;if((E>7e3||Q>24576)&&(O>423||!c)){l=MAt(t,A,0,C,y,x,B,Q,M,S-M,l),Q=E=B=0,M=S;for(var U=0;U<286;++U)y[U]=0;for(var U=0;U<30;++U)x[U]=0}var Y=2,J=0,ee=h,W=R-F&32767;if(O>2&&k==I(S-W))for(var X=Math.min(u,O)-1,ie=Math.min(32767,S),se=Math.min(258,O);W<=ie&&--ee&&R!=F;){if(t[S+Y]==t[S+Y-W]){for(var oe=0;oe<se&&t[S+oe]==t[S+oe-W];++oe);if(oe>Y){if(Y=oe,J=W,oe>X)break;for(var ge=Math.min(W,oe-2),ue=0,U=0;U<ge;++U){var Ie=S-W+U&32767,le=p[Ie],_e=Ie-le&32767;_e>ue&&(ue=_e,F=Ie)}}}R=F,F=p[R],W+=R-F&32767}if(J){C[Q++]=268435456|lxe[Y]<<18|QAt[J];var he=lxe[Y]&31,ye=QAt[J]&31;B+=Cne[he]+yne[ye],++y[257+he],++x[ye],P=S+Y,++E}else C[Q++]=t[S],++y[t[S]]}}for(S=Math.max(S,P);S<s;++S)C[Q++]=t[S],++y[t[S]];l=MAt(t,A,c,C,y,x,B,Q,M,S-M,l),c||(r.r=l&7|A[l/8|0]<<3,l-=7,r.h=m,r.p=p,r.i=S,r.w=P)}else{for(var S=r.w||0;S<s+c;S+=65535){var Qe=S+65535;Qe>=s&&(A[l/8|0]=c,Qe=s),l=wAt(A,l+1,t.subarray(S,Qe))}r.i=s}return Uk(a,0,o+hxe(l)+i)},W7n=(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})(),j7n=function(){var t=-1;return{p:function(e){for(var n=t,o=0;o<e.length;++o)n=W7n[n&255^e[o]]^n>>>8;t=n},d:function(){return~t}}},NAt=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}}},RAt=function(t,e,n,o,i){if(!i&&(i={l:1},e.dictionary)){var r=e.dictionary.subarray(-32768),s=new tm(r.length+t.length);s.set(r),s.set(t,r.length),t=s,i.w=r.length}return J7n(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)},BV=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},X7n=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&&BV(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)}},q7n=function(t){return 10+(t.filename?t.filename.length+1:0)},$7n=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=NAt();i.p(e.dictionary),BV(t,2,i.d())}},TAt=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&ix(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&ix(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2},_xe=(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 tm(32768),this.p=new tm(0),o&&this.o.set(o)}return t.prototype.e=function(e){if(this.ondata||ix(5),this.d&&ix(4),!this.p.length)this.p=e;else if(e.length){var n=new tm(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=vAt(this.p,this.s,this.o);this.ondata(Uk(o,n,this.s.b),this.d),this.o=Uk(o,this.s.b-32768),this.s.b=this.o.length,this.p=Uk(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 fxe(t,e){e||(e={});var n=j7n(),o=t.length;n.p(t);var i=RAt(t,e,q7n(e),8),r=i.length;return X7n(i,e),BV(i,r-8,n.d()),BV(i,r-4,o),i}function kAt(t,e){e||(e={});var n=NAt();n.p(t);var o=RAt(t,e,e.dictionary?6:2,4);return $7n(o,e),BV(o,o.length-4,n.d()),o}var xne=(function(){function t(e,n){_xe.call(this,e,n),this.v=e&&e.dictionary?2:1}return t.prototype.push=function(e,n){if(_xe.prototype.e.call(this,e),this.v){if(this.p.length<6&&!n)return;this.p=this.p.subarray(TAt(this.p,this.v-1)),this.v=0}n&&(this.p.length<4&&ix(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),_xe.prototype.c.call(this,n)},t})();function Z7n(t,e){return vAt(t.subarray(TAt(t,e),-4),{i:2},e,e)}var FAt=typeof TextEncoder<"u"&&new TextEncoder,e6n=typeof TextDecoder<"u"&&new TextDecoder,t6n=0;try{e6n.decode(DAt,{stream:!0}),t6n=1}catch{}function Ixe(t,e){var n;if(FAt)return FAt.encode(t);for(var o=t.length,i=new tm(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 tm(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 Uk(i,0,r)}function n6n(t,e){const n=JSON.stringify(t),o=fxe(Ixe(n));return`https://tscircuit.com/editor?#data:application/gzip;base64,${H7n(o)}`}function zr(...t){return N5n(N4(t))}const LAt=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),Cxe=n5n,Ene=te.forwardRef(({className:t,...e},n)=>V.jsx(Ait,{ref:n,className:zr("rf-inline-flex rf-h-9 rf-items-center rf-justify-center rf-rounded-lg rf-bg-zinc-100 rf-p-1 rf-text-zinc-500 dark:rf-bg-zinc-800 dark:rf-text-zinc-400",t),...e}));Ene.displayName=Ait.displayName;const Q9=te.forwardRef(({className:t,...e},n)=>V.jsx(cit,{ref:n,className:zr("rf-inline-flex rf-items-center rf-justify-center rf-whitespace-nowrap rf-rounded-md rf-px-3 rf-py-1 rf-text-sm rf-font-medium rf-ring-offset-white rf-transition-all focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 disabled:rf-pointer-events-none disabled:rf-opacity-50 data-[state=active]:rf-bg-white data-[state=active]:rf-text-zinc-950 data-[state=active]:rf-shadow dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300 dark:data-[state=active]:rf-bg-zinc-950 dark:data-[state=active]:rf-text-zinc-50",t),...e}));Q9.displayName=cit.displayName;const X1=te.forwardRef(({className:t,...e},n)=>V.jsx(lit,{ref:n,className:zr("rf-h-full rf-mt-2 rf-ring-offset-white focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300",t),...e}));X1.displayName=lit.displayName;const HAt="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 yxe,OAt;function o6n(){if(OAt)return yxe;OAt=1,yxe=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 yxe}var xxe,GAt;function i6n(){if(GAt)return xxe;GAt=1;var t=o6n(),e=Object.prototype.toString;return xxe=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"},xxe}var Exe={exports:{}},YAt;function r6n(){return YAt||(YAt=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})()})(Exe)),Exe.exports}var Bxe,UAt;function s6n(){if(UAt)return Bxe;UAt=1;var t=i6n(),e=r6n();return Bxe=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},Bxe}var a6n=s6n();const A6n=uy(a6n);var bxe={exports:{}},KAt;function VAt(){return KAt||(KAt=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})(bxe)),bxe.exports}var Sxe,zAt;function c6n(){if(zAt)return Sxe;zAt=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=VAt(),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="",S="",Q="",P="",M="",k=function(O,U){if(!(B[0]==="?"||B[0]==="!")){var Y={type:O,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="",P=!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="",P=!0}),u)),t(C,o.tagName,(h={},t(h,i.space,function(){P?x=o.tagEnd:(x=o.attributeNameStart,k(r.openTag,B))}),t(h,i.gt,function(){k(P?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){S=F,x=o.attributeName}),t(p,i.gt,function(){E="",x=o.data}),t(p,i.space,n),t(p,i.slash,function(){P=!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,S),x=o.attributeValueBegin}),t(m,i.gt,function(){Q="",k(r.attributeName,S),k(r.attributeValue,Q),E="",x=o.data}),t(m,i.slash,function(){P=!0,Q="",k(r.attributeName,S),k(r.attributeValue,Q),x=o.tagEnd}),t(m,i.char,function(F){S+=F}),m)),t(C,o.attributeNameEnd,(_={},t(_,i.space,n),t(_,i.equal,function(){k(r.attributeName,S),x=o.attributeValueBegin}),t(_,i.gt,function(){Q="",k(r.attributeName,S),k(r.attributeValue,Q),E="",x=o.data}),t(_,i.char,function(F){Q="",k(r.attributeName,S),k(r.attributeValue,Q),S=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),P=!0,x=o.tagEnd)}),t(I,i.char,function(F){Q+=F}),I)),C);var R=function(O){l.debug&&console.log(x,O);var U=y.stateMachine[x],Y=U[a(O)]||U[i.error]||U[i.char];Y(O)};return y.write=function(F){for(var O=F.length,U=0;U<O;U++)R(F[U])},y};return Sxe={State:o,Action:i,Type:r,create:A},Sxe}var Qxe,JAt;function l6n(){if(JAt)return Qxe;JAt=1;var t=VAt(),e=c6n(),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 Qxe={parseSync:s,create:r,NodeType:o},Qxe}var g6n=l6n(),u6n=function(e){var n=g6n.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")},d6n=function(e){return A6n(e,function(n){return p6n(n)?n:h6n(n)})},h6n=function(e){return e.replace(/[-|:]([a-z])/gi,function(n,o){return o.toUpperCase()})},p6n=function(e){return/^(data|aria)(-\w+)/.test(e)},m6n=function(e){if(e){var n=String(e);return/[&<>]/.test(n)?"<![CDATA[".concat(n.replace(/]]>/,"]]]]><![CDATA[>"),"]]>"):n}return""},_6n=function(e){return String(e).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},bV=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=d6n(l)),l};return a(u6n(e))},WAt=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 m6n(c.value);var l="";for(var g in c.attributes){var u=i(g,c.attributes[g],_6n,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,"/>")},hQ=t=>{const e=Math.round(t*1e3)/1e3;return`${Number(e.toFixed(3))}mm`},jAt=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]]),f6n=[...jAt.keys()];function XAt(t){return jAt.get(t)}var qAt={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}}},vxe=new Set;for(const[t,e]of Object.entries(qAt)){vxe.add(t);for(const n of Object.keys(e.variants))vxe.add(n)}function I6n(t){for(const e of Object.values(qAt)){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=XAt(i);if(r!=null)return{baseUnit:e.baseUnit,conversionFactor:r*o}}}return{baseUnit:t,conversionFactor:1}}function q1(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=q1(t.x,e),l=q1(t.x,e),g=q1(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=XAt(i);if(e&&s!=null)return{parsedUnit:null,unitOfValue:e,value:Number.parseFloat(r)*s};if(s!=null&&!vxe.has(i))return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(r)*s};const{baseUnit:a,conversionFactor:A}=I6n(i);return{parsedUnit:i,unitOfValue:a,value:A*Number.parseFloat(r)}}f6n.filter(t=>t!=="").sort((t,e)=>e.length-t.length).map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|");var Kk=[{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"}],C6n=Kk[Kk.length-1];function H_(t){if(t==null)return"";if(t===0)return"0";const e=Math.abs(t);let n=Kk.findIndex(s=>{const a=e/s.value;return a>=1&&a<1e3});n===-1&&(n=Kk.indexOf(C6n));let o=Kk[n],i=t/o.value;for(;n>0&&Math.abs(Number(i.toPrecision(3)))>=1e3;)n-=1,o=Kk[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 Pl;(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})(Pl||(Pl={}));var $At;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})($At||($At={}));const Sr=Pl.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),pQ=t=>{switch(typeof t){case"undefined":return Sr.undefined;case"string":return Sr.string;case"number":return Number.isNaN(t)?Sr.nan:Sr.number;case"boolean":return Sr.boolean;case"function":return Sr.function;case"bigint":return Sr.bigint;case"symbol":return Sr.symbol;case"object":return Array.isArray(t)?Sr.array:t===null?Sr.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Sr.promise:typeof Map<"u"&&t instanceof Map?Sr.map:typeof Set<"u"&&t instanceof Set?Sr.set:typeof Date<"u"&&t instanceof Date?Sr.date:Sr.object;default:return Sr.unknown}},lo=Pl.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 p5 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 p5))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pl.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()}}p5.create=t=>new p5(t);const SV=(t,e)=>{let n;switch(t.code){case lo.invalid_type:t.received===Sr.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case lo.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Pl.jsonStringifyReplacer)}`;break;case lo.unrecognized_keys:n=`Unrecognized key(s) in object: ${Pl.joinValues(t.keys,", ")}`;break;case lo.invalid_union:n="Invalid input";break;case lo.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Pl.joinValues(t.options)}`;break;case lo.invalid_enum_value:n=`Invalid enum value. Expected ${Pl.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}"`:Pl.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,Pl.assertNever(t)}return{message:n}};let y6n=SV;function Pxe(){return y6n}const wxe=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 rr(t,e){const n=Pxe(),o=wxe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===SV?void 0:SV].filter(i=>!!i)});t.common.issues.push(o)}class my{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 Zs;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 my.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 Zs;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 Zs=Object.freeze({status:"aborted"}),QV=t=>({status:"dirty",value:t}),rx=t=>({status:"valid",value:t}),ZAt=t=>t.status==="aborted",ect=t=>t.status==="dirty",Vk=t=>t.status==="valid",Bne=t=>typeof Promise<"u"&&t instanceof Promise;var is;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(is||(is={}));class v9{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 tct=(t,e)=>{if(Vk(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 p5(t.common.issues);return this._error=n,this._error}}};function EA(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 Bc{get description(){return this._def.description}_getType(e){return pQ(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:pQ(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new my,ctx:{common:e.parent.common,data:e.data,parsedType:pQ(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Bne(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:pQ(e)},i=this._parseSync({data:e,path:o.path,parent:o});return tct(o,i)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:pQ(e)};if(!this["~standard"].async)try{const o=this._parseSync({data:e,path:[],parent:n});return Vk(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=>Vk(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:pQ(e)},i=this._parse({data:e,path:o.path,parent:o}),r=await(Bne(i)?i:Promise.resolve(i));return tct(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 _Q({schema:this,typeName:Ea.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 P8.create(this,this._def)}nullable(){return VM.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return w9.create(this)}promise(){return MV.create(this,this._def)}or(e){return Qne.create([this,e],this._def)}and(e){return vne.create(this,e,this._def)}transform(e){return new _Q({...EA(this._def),schema:this,typeName:Ea.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Mne({...EA(this._def),innerType:this,defaultValue:n,typeName:Ea.ZodDefault})}brand(){return new cct({typeName:Ea.ZodBranded,type:this,...EA(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Dne({...EA(this._def),innerType:this,catchValue:n,typeName:Ea.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Fxe.create(this,e)}readonly(){return Nne.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const x6n=/^c[^\s-]{8,}$/i,E6n=/^[0-9a-z]+$/,B6n=/^[0-9A-HJKMNP-TV-Z]{26}$/i,b6n=/^[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,S6n=/^[a-z0-9_-]{21}$/i,Q6n=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,v6n=/^[-+]?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)?)??$/,P6n=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,w6n="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Mxe;const M6n=/^(?:(?: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])$/,D6n=/^(?:(?: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])$/,N6n=/^(([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]))$/,R6n=/^(([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])$/,T6n=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,k6n=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nct="((\\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])))",F6n=new RegExp(`^${nct}$`);function oct(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 L6n(t){return new RegExp(`^${oct(t)}$`)}function H6n(t){let e=`${nct}T${oct(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 O6n(t,e){return!!((e==="v4"||!e)&&M6n.test(t)||(e==="v6"||!e)&&N6n.test(t))}function G6n(t,e){if(!Q6n.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 Y6n(t,e){return!!((e==="v4"||!e)&&D6n.test(t)||(e==="v6"||!e)&&R6n.test(t))}class P9 extends Bc{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Sr.string){const r=this._getOrReturnCtx(e);return rr(r,{code:lo.invalid_type,expected:Sr.string,received:r.parsedType}),Zs}const o=new my;let i;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(i=this._getOrReturnCtx(e,i),rr(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),rr(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?rr(i,{code:lo.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):a&&rr(i,{code:lo.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),o.dirty())}else if(r.kind==="email")P6n.test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{validation:"email",code:lo.invalid_string,message:r.message}),o.dirty());else if(r.kind==="emoji")Mxe||(Mxe=new RegExp(w6n,"u")),Mxe.test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{validation:"emoji",code:lo.invalid_string,message:r.message}),o.dirty());else if(r.kind==="uuid")b6n.test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{validation:"uuid",code:lo.invalid_string,message:r.message}),o.dirty());else if(r.kind==="nanoid")S6n.test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{validation:"nanoid",code:lo.invalid_string,message:r.message}),o.dirty());else if(r.kind==="cuid")x6n.test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{validation:"cuid",code:lo.invalid_string,message:r.message}),o.dirty());else if(r.kind==="cuid2")E6n.test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{validation:"cuid2",code:lo.invalid_string,message:r.message}),o.dirty());else if(r.kind==="ulid")B6n.test(e.data)||(i=this._getOrReturnCtx(e,i),rr(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),rr(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),rr(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),rr(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),rr(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),rr(i,{code:lo.invalid_string,validation:{endsWith:r.value},message:r.message}),o.dirty()):r.kind==="datetime"?H6n(r).test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{code:lo.invalid_string,validation:"datetime",message:r.message}),o.dirty()):r.kind==="date"?F6n.test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{code:lo.invalid_string,validation:"date",message:r.message}),o.dirty()):r.kind==="time"?L6n(r).test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{code:lo.invalid_string,validation:"time",message:r.message}),o.dirty()):r.kind==="duration"?v6n.test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{validation:"duration",code:lo.invalid_string,message:r.message}),o.dirty()):r.kind==="ip"?O6n(e.data,r.version)||(i=this._getOrReturnCtx(e,i),rr(i,{validation:"ip",code:lo.invalid_string,message:r.message}),o.dirty()):r.kind==="jwt"?G6n(e.data,r.alg)||(i=this._getOrReturnCtx(e,i),rr(i,{validation:"jwt",code:lo.invalid_string,message:r.message}),o.dirty()):r.kind==="cidr"?Y6n(e.data,r.version)||(i=this._getOrReturnCtx(e,i),rr(i,{validation:"cidr",code:lo.invalid_string,message:r.message}),o.dirty()):r.kind==="base64"?T6n.test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{validation:"base64",code:lo.invalid_string,message:r.message}),o.dirty()):r.kind==="base64url"?k6n.test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{validation:"base64url",code:lo.invalid_string,message:r.message}),o.dirty()):Pl.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,...is.errToObj(o)})}_addCheck(e){return new P9({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...is.errToObj(e)})}url(e){return this._addCheck({kind:"url",...is.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...is.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...is.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...is.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...is.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...is.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...is.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...is.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...is.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...is.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...is.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...is.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,...is.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,...is.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...is.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...is.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...is.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...is.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...is.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...is.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...is.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...is.errToObj(n)})}nonempty(e){return this.min(1,is.errToObj(e))}trim(){return new P9({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new P9({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new P9({...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}}P9.create=t=>new P9({checks:[],typeName:Ea.ZodString,coerce:t?.coerce??!1,...EA(t)});function U6n(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 YM extends Bc{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)!==Sr.number){const r=this._getOrReturnCtx(e);return rr(r,{code:lo.invalid_type,expected:Sr.number,received:r.parsedType}),Zs}let o;const i=new my;for(const r of this._def.checks)r.kind==="int"?Pl.isInteger(e.data)||(o=this._getOrReturnCtx(e,o),rr(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),rr(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),rr(o,{code:lo.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),i.dirty()):r.kind==="multipleOf"?U6n(e.data,r.value)!==0&&(o=this._getOrReturnCtx(e,o),rr(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),rr(o,{code:lo.not_finite,message:r.message}),i.dirty()):Pl.assertNever(r);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,is.toString(n))}gt(e,n){return this.setLimit("min",e,!1,is.toString(n))}lte(e,n){return this.setLimit("max",e,!0,is.toString(n))}lt(e,n){return this.setLimit("max",e,!1,is.toString(n))}setLimit(e,n,o,i){return new YM({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:o,message:is.toString(i)}]})}_addCheck(e){return new YM({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:is.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:is.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:is.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:is.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:is.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:is.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:is.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:is.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:is.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"&&Pl.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)}}YM.create=t=>new YM({checks:[],typeName:Ea.ZodNumber,coerce:t?.coerce||!1,...EA(t)});class UM extends Bc{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)!==Sr.bigint)return this._getInvalidInput(e);let o;const i=new my;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),rr(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),rr(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),rr(o,{code:lo.not_multiple_of,multipleOf:r.value,message:r.message}),i.dirty()):Pl.assertNever(r);return{status:i.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return rr(n,{code:lo.invalid_type,expected:Sr.bigint,received:n.parsedType}),Zs}gte(e,n){return this.setLimit("min",e,!0,is.toString(n))}gt(e,n){return this.setLimit("min",e,!1,is.toString(n))}lte(e,n){return this.setLimit("max",e,!0,is.toString(n))}lt(e,n){return this.setLimit("max",e,!1,is.toString(n))}setLimit(e,n,o,i){return new UM({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:o,message:is.toString(i)}]})}_addCheck(e){return new UM({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:is.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:is.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:is.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:is.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:is.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}}UM.create=t=>new UM({checks:[],typeName:Ea.ZodBigInt,coerce:t?.coerce??!1,...EA(t)});class bne extends Bc{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Sr.boolean){const o=this._getOrReturnCtx(e);return rr(o,{code:lo.invalid_type,expected:Sr.boolean,received:o.parsedType}),Zs}return rx(e.data)}}bne.create=t=>new bne({typeName:Ea.ZodBoolean,coerce:t?.coerce||!1,...EA(t)});class zk extends Bc{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Sr.date){const r=this._getOrReturnCtx(e);return rr(r,{code:lo.invalid_type,expected:Sr.date,received:r.parsedType}),Zs}if(Number.isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return rr(r,{code:lo.invalid_date}),Zs}const o=new my;let i;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(i=this._getOrReturnCtx(e,i),rr(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),rr(i,{code:lo.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),o.dirty()):Pl.assertNever(r);return{status:o.value,value:new Date(e.data.getTime())}}_addCheck(e){return new zk({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:is.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:is.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}}zk.create=t=>new zk({checks:[],coerce:t?.coerce||!1,typeName:Ea.ZodDate,...EA(t)});class ict extends Bc{_parse(e){if(this._getType(e)!==Sr.symbol){const o=this._getOrReturnCtx(e);return rr(o,{code:lo.invalid_type,expected:Sr.symbol,received:o.parsedType}),Zs}return rx(e.data)}}ict.create=t=>new ict({typeName:Ea.ZodSymbol,...EA(t)});class Dxe extends Bc{_parse(e){if(this._getType(e)!==Sr.undefined){const o=this._getOrReturnCtx(e);return rr(o,{code:lo.invalid_type,expected:Sr.undefined,received:o.parsedType}),Zs}return rx(e.data)}}Dxe.create=t=>new Dxe({typeName:Ea.ZodUndefined,...EA(t)});class Sne extends Bc{_parse(e){if(this._getType(e)!==Sr.null){const o=this._getOrReturnCtx(e);return rr(o,{code:lo.invalid_type,expected:Sr.null,received:o.parsedType}),Zs}return rx(e.data)}}Sne.create=t=>new Sne({typeName:Ea.ZodNull,...EA(t)});class vV extends Bc{constructor(){super(...arguments),this._any=!0}_parse(e){return rx(e.data)}}vV.create=t=>new vV({typeName:Ea.ZodAny,...EA(t)});class Jk extends Bc{constructor(){super(...arguments),this._unknown=!0}_parse(e){return rx(e.data)}}Jk.create=t=>new Jk({typeName:Ea.ZodUnknown,...EA(t)});class mQ extends Bc{_parse(e){const n=this._getOrReturnCtx(e);return rr(n,{code:lo.invalid_type,expected:Sr.never,received:n.parsedType}),Zs}}mQ.create=t=>new mQ({typeName:Ea.ZodNever,...EA(t)});class rct extends Bc{_parse(e){if(this._getType(e)!==Sr.undefined){const o=this._getOrReturnCtx(e);return rr(o,{code:lo.invalid_type,expected:Sr.void,received:o.parsedType}),Zs}return rx(e.data)}}rct.create=t=>new rct({typeName:Ea.ZodVoid,...EA(t)});class w9 extends Bc{_parse(e){const{ctx:n,status:o}=this._processInputParams(e),i=this._def;if(n.parsedType!==Sr.array)return rr(n,{code:lo.invalid_type,expected:Sr.array,received:n.parsedType}),Zs;if(i.exactLength!==null){const s=n.data.length>i.exactLength.value,a=n.data.length<i.exactLength.value;(s||a)&&(rr(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&&(rr(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&&(rr(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 v9(n,s,n.path,a)))).then(s=>my.mergeArray(o,s));const r=[...n.data].map((s,a)=>i.type._parseSync(new v9(n,s,n.path,a)));return my.mergeArray(o,r)}get element(){return this._def.type}min(e,n){return new w9({...this._def,minLength:{value:e,message:is.toString(n)}})}max(e,n){return new w9({...this._def,maxLength:{value:e,message:is.toString(n)}})}length(e,n){return new w9({...this._def,exactLength:{value:e,message:is.toString(n)}})}nonempty(e){return this.min(1,e)}}w9.create=(t,e)=>new w9({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ea.ZodArray,...EA(e)});function Wk(t){if(t instanceof Km){const e={};for(const n in t.shape){const o=t.shape[n];e[n]=P8.create(Wk(o))}return new Km({...t._def,shape:()=>e})}else return t instanceof w9?new w9({...t._def,type:Wk(t.element)}):t instanceof P8?P8.create(Wk(t.unwrap())):t instanceof VM?VM.create(Wk(t.unwrap())):t instanceof v8?v8.create(t.items.map(e=>Wk(e))):t}class Km extends Bc{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=Pl.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Sr.object){const c=this._getOrReturnCtx(e);return rr(c,{code:lo.invalid_type,expected:Sr.object,received:c.parsedType}),Zs}const{status:o,ctx:i}=this._processInputParams(e),{shape:r,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof mQ&&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 v9(i,g,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof mQ){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&&(rr(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 v9(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=>my.mergeObjectSync(o,c)):my.mergeObjectSync(o,A)}get shape(){return this._def.shape()}strict(e){return is.errToObj,new Km({...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:is.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new Km({...this._def,unknownKeys:"strip"})}passthrough(){return new Km({...this._def,unknownKeys:"passthrough"})}extend(e){return new Km({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Km({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ea.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Km({...this._def,catchall:e})}pick(e){const n={};for(const o of Pl.objectKeys(e))e[o]&&this.shape[o]&&(n[o]=this.shape[o]);return new Km({...this._def,shape:()=>n})}omit(e){const n={};for(const o of Pl.objectKeys(this.shape))e[o]||(n[o]=this.shape[o]);return new Km({...this._def,shape:()=>n})}deepPartial(){return Wk(this)}partial(e){const n={};for(const o of Pl.objectKeys(this.shape)){const i=this.shape[o];e&&!e[o]?n[o]=i:n[o]=i.optional()}return new Km({...this._def,shape:()=>n})}required(e){const n={};for(const o of Pl.objectKeys(this.shape))if(e&&!e[o])n[o]=this.shape[o];else{let r=this.shape[o];for(;r instanceof P8;)r=r._def.innerType;n[o]=r}return new Km({...this._def,shape:()=>n})}keyof(){return act(Pl.objectKeys(this.shape))}}Km.create=(t,e)=>new Km({shape:()=>t,unknownKeys:"strip",catchall:mQ.create(),typeName:Ea.ZodObject,...EA(e)}),Km.strictCreate=(t,e)=>new Km({shape:()=>t,unknownKeys:"strict",catchall:mQ.create(),typeName:Ea.ZodObject,...EA(e)}),Km.lazycreate=(t,e)=>new Km({shape:t,unknownKeys:"strip",catchall:mQ.create(),typeName:Ea.ZodObject,...EA(e)});class Qne extends Bc{_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 p5(a.ctx.common.issues));return rr(n,{code:lo.invalid_union,unionErrors:s}),Zs}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 p5(A));return rr(n,{code:lo.invalid_union,unionErrors:a}),Zs}}get options(){return this._def.options}}Qne.create=(t,e)=>new Qne({options:t,typeName:Ea.ZodUnion,...EA(e)});const Q8=t=>t instanceof Txe?Q8(t.schema):t instanceof _Q?Q8(t.innerType()):t instanceof wne?[t.value]:t instanceof KM?t.options:t instanceof kxe?Pl.objectValues(t.enum):t instanceof Mne?Q8(t._def.innerType):t instanceof Dxe?[void 0]:t instanceof Sne?[null]:t instanceof P8?[void 0,...Q8(t.unwrap())]:t instanceof VM?[null,...Q8(t.unwrap())]:t instanceof cct||t instanceof Nne?Q8(t.unwrap()):t instanceof Dne?Q8(t._def.innerType):[];class Nxe extends Bc{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Sr.object)return rr(n,{code:lo.invalid_type,expected:Sr.object,received:n.parsedType}),Zs;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}):(rr(n,{code:lo.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),Zs)}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=Q8(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 Nxe({typeName:Ea.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...EA(o)})}}function Rxe(t,e){const n=pQ(t),o=pQ(e);if(t===e)return{valid:!0,data:t};if(n===Sr.object&&o===Sr.object){const i=Pl.objectKeys(e),r=Pl.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(const a of r){const A=Rxe(t[a],e[a]);if(!A.valid)return{valid:!1};s[a]=A.data}return{valid:!0,data:s}}else if(n===Sr.array&&o===Sr.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=Rxe(s,a);if(!A.valid)return{valid:!1};i.push(A.data)}return{valid:!0,data:i}}else return n===Sr.date&&o===Sr.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class vne extends Bc{_parse(e){const{status:n,ctx:o}=this._processInputParams(e),i=(r,s)=>{if(ZAt(r)||ZAt(s))return Zs;const a=Rxe(r.value,s.value);return a.valid?((ect(r)||ect(s))&&n.dirty(),{status:n.value,value:a.data}):(rr(o,{code:lo.invalid_intersection_types}),Zs)};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}))}}vne.create=(t,e,n)=>new vne({left:t,right:e,typeName:Ea.ZodIntersection,...EA(n)});class v8 extends Bc{_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.parsedType!==Sr.array)return rr(o,{code:lo.invalid_type,expected:Sr.array,received:o.parsedType}),Zs;if(o.data.length<this._def.items.length)return rr(o,{code:lo.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Zs;!this._def.rest&&o.data.length>this._def.items.length&&(rr(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 v9(o,s,o.path,a)):null}).filter(s=>!!s);return o.common.async?Promise.all(r).then(s=>my.mergeArray(n,s)):my.mergeArray(n,r)}get items(){return this._def.items}rest(e){return new v8({...this._def,rest:e})}}v8.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new v8({items:t,typeName:Ea.ZodTuple,rest:null,...EA(e)})};class Pne extends Bc{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!==Sr.object)return rr(o,{code:lo.invalid_type,expected:Sr.object,received:o.parsedType}),Zs;const i=[],r=this._def.keyType,s=this._def.valueType;for(const a in o.data)i.push({key:r._parse(new v9(o,a,o.path,a)),value:s._parse(new v9(o,o.data[a],o.path,a)),alwaysSet:a in o.data});return o.common.async?my.mergeObjectAsync(n,i):my.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,o){return n instanceof Bc?new Pne({keyType:e,valueType:n,typeName:Ea.ZodRecord,...EA(o)}):new Pne({keyType:P9.create(),valueType:e,typeName:Ea.ZodRecord,...EA(n)})}}class sct extends Bc{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!==Sr.map)return rr(o,{code:lo.invalid_type,expected:Sr.map,received:o.parsedType}),Zs;const i=this._def.keyType,r=this._def.valueType,s=[...o.data.entries()].map(([a,A],c)=>({key:i._parse(new v9(o,a,o.path,[c,"key"])),value:r._parse(new v9(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 Zs;(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 Zs;(c.status==="dirty"||l.status==="dirty")&&n.dirty(),a.set(c.value,l.value)}return{status:n.value,value:a}}}}sct.create=(t,e,n)=>new sct({valueType:e,keyType:t,typeName:Ea.ZodMap,...EA(n)});class PV extends Bc{_parse(e){const{status:n,ctx:o}=this._processInputParams(e);if(o.parsedType!==Sr.set)return rr(o,{code:lo.invalid_type,expected:Sr.set,received:o.parsedType}),Zs;const i=this._def;i.minSize!==null&&o.data.size<i.minSize.value&&(rr(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&&(rr(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 Zs;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 v9(o,A,o.path,c)));return o.common.async?Promise.all(a).then(A=>s(A)):s(a)}min(e,n){return new PV({...this._def,minSize:{value:e,message:is.toString(n)}})}max(e,n){return new PV({...this._def,maxSize:{value:e,message:is.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}PV.create=(t,e)=>new PV({valueType:t,minSize:null,maxSize:null,typeName:Ea.ZodSet,...EA(e)});class wV extends Bc{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Sr.function)return rr(n,{code:lo.invalid_type,expected:Sr.function,received:n.parsedType}),Zs;function o(a,A){return wxe({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Pxe(),SV].filter(c=>!!c),issueData:{code:lo.invalid_arguments,argumentsError:A}})}function i(a,A){return wxe({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Pxe(),SV].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 MV){const a=this;return rx(async function(...A){const c=new p5([]),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 rx(function(...A){const c=a._def.args.safeParse(A,r);if(!c.success)throw new p5([o(A,c.error)]);const l=Reflect.apply(s,this,c.data),g=a._def.returns.safeParse(l,r);if(!g.success)throw new p5([i(l,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new wV({...this._def,args:v8.create(e).rest(Jk.create())})}returns(e){return new wV({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,o){return new wV({args:e||v8.create([]).rest(Jk.create()),returns:n||Jk.create(),typeName:Ea.ZodFunction,...EA(o)})}}class Txe extends Bc{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})}}Txe.create=(t,e)=>new Txe({getter:t,typeName:Ea.ZodLazy,...EA(e)});class wne extends Bc{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return rr(n,{received:n.data,code:lo.invalid_literal,expected:this._def.value}),Zs}return{status:"valid",value:e.data}}get value(){return this._def.value}}wne.create=(t,e)=>new wne({value:t,typeName:Ea.ZodLiteral,...EA(e)});function act(t,e){return new KM({values:t,typeName:Ea.ZodEnum,...EA(e)})}class KM extends Bc{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),o=this._def.values;return rr(n,{expected:Pl.joinValues(o),received:n.parsedType,code:lo.invalid_type}),Zs}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 rr(n,{received:n.data,code:lo.invalid_enum_value,options:o}),Zs}return rx(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 KM.create(e,{...this._def,...n})}exclude(e,n=this._def){return KM.create(this.options.filter(o=>!e.includes(o)),{...this._def,...n})}}KM.create=act;class kxe extends Bc{_parse(e){const n=Pl.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(e);if(o.parsedType!==Sr.string&&o.parsedType!==Sr.number){const i=Pl.objectValues(n);return rr(o,{expected:Pl.joinValues(i),received:o.parsedType,code:lo.invalid_type}),Zs}if(this._cache||(this._cache=new Set(Pl.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=Pl.objectValues(n);return rr(o,{received:o.data,code:lo.invalid_enum_value,options:i}),Zs}return rx(e.data)}get enum(){return this._def.values}}kxe.create=(t,e)=>new kxe({values:t,typeName:Ea.ZodNativeEnum,...EA(e)});class MV extends Bc{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Sr.promise&&n.common.async===!1)return rr(n,{code:lo.invalid_type,expected:Sr.promise,received:n.parsedType}),Zs;const o=n.parsedType===Sr.promise?n.data:Promise.resolve(n.data);return rx(o.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}MV.create=(t,e)=>new MV({type:t,typeName:Ea.ZodPromise,...EA(e)});class _Q extends Bc{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ea.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=>{rr(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 Zs;const A=await this._def.schema._parseAsync({data:a,path:o.path,parent:o});return A.status==="aborted"?Zs:A.status==="dirty"||n.value==="dirty"?QV(A.value):A});{if(n.value==="aborted")return Zs;const a=this._def.schema._parseSync({data:s,path:o.path,parent:o});return a.status==="aborted"?Zs:a.status==="dirty"||n.value==="dirty"?QV(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"?Zs:(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"?Zs:(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(!Vk(s))return Zs;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=>Vk(s)?Promise.resolve(i.transform(s.value,r)).then(a=>({status:n.value,value:a})):Zs);Pl.assertNever(i)}}_Q.create=(t,e,n)=>new _Q({schema:t,typeName:Ea.ZodEffects,effect:e,...EA(n)}),_Q.createWithPreprocess=(t,e,n)=>new _Q({schema:e,effect:{type:"preprocess",transform:t},typeName:Ea.ZodEffects,...EA(n)});class P8 extends Bc{_parse(e){return this._getType(e)===Sr.undefined?rx(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}P8.create=(t,e)=>new P8({innerType:t,typeName:Ea.ZodOptional,...EA(e)});class VM extends Bc{_parse(e){return this._getType(e)===Sr.null?rx(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}VM.create=(t,e)=>new VM({innerType:t,typeName:Ea.ZodNullable,...EA(e)});class Mne extends Bc{_parse(e){const{ctx:n}=this._processInputParams(e);let o=n.data;return n.parsedType===Sr.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Mne.create=(t,e)=>new Mne({innerType:t,typeName:Ea.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...EA(e)});class Dne extends Bc{_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 Bne(i)?i.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new p5(o.common.issues)},input:o.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new p5(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}}Dne.create=(t,e)=>new Dne({innerType:t,typeName:Ea.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...EA(e)});class Act extends Bc{_parse(e){if(this._getType(e)!==Sr.nan){const o=this._getOrReturnCtx(e);return rr(o,{code:lo.invalid_type,expected:Sr.nan,received:o.parsedType}),Zs}return{status:"valid",value:e.data}}}Act.create=t=>new Act({typeName:Ea.ZodNaN,...EA(t)});class cct extends Bc{_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 Fxe extends Bc{_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"?Zs:r.status==="dirty"?(n.dirty(),QV(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"?Zs: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 Fxe({in:e,out:n,typeName:Ea.ZodPipeline})}}class Nne extends Bc{_parse(e){const n=this._def.innerType._parse(e),o=i=>(Vk(i)&&(i.value=Object.freeze(i.value)),i);return Bne(n)?n.then(i=>o(i)):o(n)}unwrap(){return this._def.innerType}}Nne.create=(t,e)=>new Nne({innerType:t,typeName:Ea.ZodReadonly,...EA(e)});function lct(t,e){const n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function w0(t,e={},n){return t?vV.create().superRefine((o,i)=>{const r=t(o);if(r instanceof Promise)return r.then(s=>{if(!s){const a=lct(e,o),A=a.fatal??n??!0;i.addIssue({code:"custom",...a,fatal:A})}});if(!r){const s=lct(e,o),a=s.fatal??n??!0;i.addIssue({code:"custom",...s,fatal:a})}}):vV.create()}var Ea;(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"})(Ea||(Ea={}));const Z=P9.create,_t=YM.create;UM.create;const je=bne.create;zk.create;const gct=Sne.create,ud=vV.create,Lxe=Jk.create;mQ.create;const dn=w9.create,wt=Km.create,xo=Qne.create,_y=Nxe.create;vne.create;const fQ=v8.create,bc=Pne.create,IQ=wV.create,Xe=wne.create,Kn=KM.create,CQ=MV.create;P8.create,VM.create;const uct=_Q.createWithPreprocess,m5={string:(t=>P9.create({...t,coerce:!0})),number:(t=>YM.create({...t,coerce:!0})),boolean:(t=>bne.create({...t,coerce:!0})),bigint:(t=>UM.create({...t,coerce:!0})),date:(t=>zk.create({...t,coerce:!0}))},K6n=Zs;var w8=Z().or(_t()).transform(t=>q1(t,"Ω").value),zM=Z().or(_t()).transform(t=>q1(t,"F").value).transform(t=>Number.parseFloat(t.toPrecision(12))),Rne=Z().or(_t()).transform(t=>q1(t,"H").value),O_=Z().or(_t()).transform(t=>q1(t,"V").value),ce=Z().or(_t()).transform(t=>q1(t).value),fy=Z().or(_t()).transform(t=>q1(t,"Hz").value),lt=ce,N3=Z().or(_t()).transform(t=>q1(t,"A").value),jk=Z().or(_t()).transform(t=>q1(t).value),V6n=jk,wl=jk,dct=Z().datetime(),oA=Z().or(_t()).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)),hct=_t().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:lt,y:lt}),z6n=Ti,M9=wt({x:lt,y:lt,z:lt}),J6n=M9,Tne=wt({width:_t(),height:_t()}),W6n=t=>{const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";return Array.from({length:t},()=>e[Math.floor(Math.random()*e.length)]).join("")},so=t=>Z().optional().default(()=>`${t}_${W6n(10)}`),M8=Kn(["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"]),j6n=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"]),kne=wt({project_relative_path:Z(),url:Z(),mimetype:Z()}),Fne=Ti.extend({rotation:oA.optional()}),Hxe=wt({size:Ti.optional(),thickness:lt.optional()}),pct=wt({font:Hxe.optional()}),DV=wt({value:Z(),at:Fne.optional(),layer:Z().optional(),uuid:Z().optional(),hide:je().optional(),effects:pct.optional()}),mct=wt({Reference:DV.optional(),Value:DV.optional(),Datasheet:DV.optional(),Description:DV.optional()}),_ct=wt({through_hole:je().optional(),smd:je().optional(),exclude_from_pos_files:je().optional(),exclude_from_bom:je().optional()}),fct=wt({name:Z(),type:Z(),shape:Z().optional(),at:Fne.optional(),size:Ti.optional(),drill:lt.optional(),layers:dn(Z()).optional(),removeUnusedLayers:je().optional(),uuid:Z().optional()}),Ict=wt({path:Z(),offset:M9.optional(),scale:M9.optional(),rotate:M9.optional()}),Cct=wt({footprintName:Z().optional(),version:xo([_t(),Z()]).optional(),generator:Z().optional(),generatorVersion:xo([_t(),Z()]).optional(),layer:Z().optional(),properties:mct.optional(),attributes:_ct.optional(),pads:dn(fct).optional(),embeddedFonts:je().optional(),model:Ict.optional()}),yct=wt({hide:je().optional()}),xct=wt({offset:lt.optional(),hide:je().optional()}),Ect=wt({font:Hxe.optional(),justify:xo([Z(),dn(Z())]).optional(),hide:je().optional()}),yQ=wt({value:Z(),id:xo([_t(),Z()]).optional(),at:Fne.optional(),effects:Ect.optional()}),Bct=wt({Reference:yQ.optional(),Value:yQ.optional(),Footprint:yQ.optional(),Datasheet:yQ.optional(),Description:yQ.optional(),ki_keywords:yQ.optional(),ki_fp_filters:yQ.optional()}),bct=wt({symbolName:Z().optional(),extends:Z().optional(),pinNumbers:yct.optional(),pinNames:xct.optional(),excludeFromSim:je().optional(),inBom:je().optional(),onBoard:je().optional(),properties:Bct.optional(),embeddedFonts:je().optional()}),Ml=wt({error_type:Z(),message:Z(),is_fatal:je().optional()}),JM=Kn(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),bg=wt({type:Xe("source_component"),ftype:Z().optional(),source_component_id:Z(),name:Z(),manufacturer_part_number:Z().optional(),supplier_part_numbers:bc(JM,dn(Z())).optional(),display_value:Z().optional(),display_name:Z().optional(),are_pins_interchangeable:je().optional(),internally_connected_source_port_ids:dn(dn(Z())).optional(),source_group_id:Z().optional(),subcircuit_id:Z().optional()}),Oxe=bg.extend({ftype:Xe("simple_capacitor"),capacitance:zM,max_voltage_rating:O_.optional(),display_capacitance:Z().optional(),max_decoupling_trace_length:lt.optional()}),Gxe=bg.extend({ftype:Xe("simple_resistor"),resistance:w8,display_resistance:Z().optional()}),Lne=bg.extend({ftype:Xe("simple_diode")}),Sct=bg.extend({ftype:Xe("simple_fiducial")}),Yxe=Lne.extend({ftype:Xe("simple_led"),color:Z().optional(),wavelength:Z().optional()}),Qct=bg.extend({ftype:Xe("simple_ground")}),Uxe=bg.extend({ftype:Xe("simple_chip")}),Kxe=bg.extend({ftype:Xe("simple_power_source"),voltage:O_}),vct=bg.extend({ftype:Xe("simple_current_source"),current:N3,frequency:fy.optional(),peak_to_peak_current:N3.optional(),wave_shape:Kn(["sine","square","triangle","sawtooth","dc"]).optional().default("dc"),phase:_t().optional(),duty_cycle:_t().min(0).max(1).optional()}),Pct=bg.extend({ftype:Xe("simple_fuse"),current_rating_amps:_t().describe("Nominal current in amps the fuse is rated for"),voltage_rating_volts:_t().describe("Voltage rating in volts, e.g. ±5V would be 5")}),wct=bg.extend({ftype:Xe("simple_ammeter")}),Mct=wt({must_be_connected:je().optional(),provides_power:je().optional(),requires_power:je().optional(),provides_ground:je().optional(),requires_ground:je().optional(),provides_voltage:xo([Z(),_t()]).optional(),requires_voltage:xo([Z(),_t()]).optional(),do_not_connect:je().optional(),include_in_board_pinout:je().optional(),can_use_internal_pullup:je().optional(),is_using_internal_pullup:je().optional(),needs_external_pullup:je().optional(),can_use_internal_pulldown:je().optional(),is_using_internal_pulldown:je().optional(),needs_external_pulldown:je().optional(),can_use_open_drain:je().optional(),is_using_open_drain:je().optional(),can_use_push_pull:je().optional(),is_using_push_pull:je().optional(),should_have_decoupling_capacitor:je().optional(),recommended_decoupling_capacitor_capacitance:xo([Z(),_t()]).optional(),is_configured_for_i2c_sda:je().optional(),is_configured_for_i2c_scl:je().optional(),is_configured_for_spi_mosi:je().optional(),is_configured_for_spi_miso:je().optional(),is_configured_for_spi_sck:je().optional(),is_configured_for_spi_cs:je().optional(),is_configured_for_uart_tx:je().optional(),is_configured_for_uart_rx:je().optional(),supports_i2c_sda:je().optional(),supports_i2c_scl:je().optional(),supports_spi_mosi:je().optional(),supports_spi_miso:je().optional(),supports_spi_sck:je().optional(),supports_spi_cs:je().optional(),supports_uart_tx:je().optional(),supports_uart_rx:je().optional()}),Vxe=bg.extend({ftype:Xe("simple_battery"),capacity:hct}),zxe=bg.extend({ftype:Xe("simple_inductor"),inductance:Rne,display_inductance:Z().optional(),max_current_rating:_t().optional()}),Jxe=bg.extend({ftype:Xe("simple_push_button")}),Wxe=bg.extend({ftype:Xe("simple_potentiometer"),max_resistance:w8,display_max_resistance:Z().optional()}),Dct=bg.extend({ftype:Xe("simple_crystal"),frequency:_t().describe("Frequency in Hz"),load_capacitance:_t().optional().describe("Load capacitance in pF"),pin_variant:Kn(["two_pin","four_pin"]).optional()}),jxe=bg.extend({ftype:Xe("simple_pin_header"),pin_count:_t(),gender:Kn(["male","female"]).optional().default("male")}),Nct=["usb_c","m2","jst_sh","jst_gh","jst_zh","jst_ph","jst_xh","jst_vh"],Rct=bg.extend({ftype:Xe("simple_connector"),standard:Kn(Nct).optional(),pin_count:_t().int().positive().optional()}),Xxe=bg.extend({ftype:Xe("simple_pinout")}),qxe=bg.extend({ftype:Xe("simple_resonator"),load_capacitance:zM,equivalent_series_resistance:w8.optional(),frequency:fy}),$xe=bg.extend({ftype:Xe("simple_transistor"),transistor_type:Kn(["npn","pnp"])}),Zxe=bg.extend({ftype:Xe("simple_test_point"),footprint_variant:Kn(["pad","through_hole"]).optional(),pad_shape:Kn(["rect","circle"]).optional(),pad_diameter:xo([_t(),Z()]).optional(),hole_diameter:xo([_t(),Z()]).optional(),width:xo([_t(),Z()]).optional(),height:xo([_t(),Z()]).optional()}),e3e=bg.extend({ftype:Xe("simple_mosfet"),channel_type:Kn(["n","p"]),mosfet_mode:Kn(["enhancement","depletion"])}),t3e=bg.extend({ftype:Xe("simple_op_amp")}),n3e=bg.extend({ftype:Xe("simple_switch")}),o3e=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:dct.optional()}),Tct=Ml.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"),kct=Ml.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:_t().optional(),y:_t().optional()}).optional(),schematic_center:wt({x:_t().optional(),y:_t().optional()}).optional()}).describe("Error emitted when a component fails to be constructed"),i3e=Ml.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:Lxe().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"),r3e=Ml.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"),Fct=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"),s3e=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"),a3e=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"),A3e=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"),Lct=bg.extend({ftype:Xe("simple_voltage_probe")}),Hct=bg.extend({ftype:Xe("interconnect")}),c3e=Ml.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=Ml.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"),Oct=bg.extend({ftype:Xe("simple_voltage_source"),voltage:O_,frequency:fy.optional(),peak_to_peak_voltage:O_.optional(),wave_shape:Kn(["sinewave","square","triangle","sawtooth"]).optional(),phase:oA.optional(),duty_cycle:_t().optional().describe("Duty cycle as a fraction (0 to 1)"),pulse_delay:wl.optional(),rise_time:wl.optional(),fall_time:wl.optional(),pulse_width:wl.optional(),period:wl.optional()}),Gct=xo([Gxe,Oxe,Lne,Sct,Yxe,Qct,Uxe,Kxe,vct,wct,Vxe,zxe,Jxe,Wxe,Dct,jxe,Rct,Xxe,qxe,n3e,$xe,Zxe,e3e,t3e,Pct,Lct,Hct,Oct,o3e,Tct,i3e,kct,r3e,Fct,s3e,a3e,A3e,c3e,NV]),Yct=wt({type:Xe("source_port"),pin_number:_t().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(Mct),Uct=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()}),Kct=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:_t().optional(),max_via_count:_t().int().nonnegative().optional(),name:Z().optional(),min_trace_thickness:_t().optional(),display_name:Z().optional()}),Vct=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:je().optional(),show_as_schematic_box:je().optional(),name:Z().optional(),was_automatically_named:je().optional()}),zct=wt({type:Xe("source_net"),source_net_id:Z(),name:Z(),member_source_group_ids:dn(Z()),is_power:je().optional(),is_ground:je().optional(),is_digital_signal:je().optional(),is_analog_signal:je().optional(),is_positive_voltage_source:je().optional(),trace_width:_t().optional(),subcircuit_id:Z().optional(),subcircuit_connectivity_map_key:Z().optional()}),Jct=wt({type:Xe("source_board"),source_board_id:Z(),source_group_id:Z(),title:Z().optional()}).describe("Defines a board in the source domain"),Wct=Ml.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"),jct=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"),Xk=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6","inner7","inner8"],l3e=Kn(Xk),wr=l3e.or(wt({name:l3e})).transform(t=>typeof t=="string"?t:t.name),Vm=Kn(["top","bottom"]),Xct=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"),qct=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"),$ct=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"),Zct=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"),elt=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"),tlt=Ml.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"),nlt=Ml.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"),RV=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:JM.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"),olt=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"),ilt=wt({type:Xe("schematic_box"),schematic_sheet_id:Z().optional(),schematic_component_id:Z().optional(),schematic_symbol_id:Z().optional(),width:lt,height:lt,is_dashed:je().default(!1),x:lt,y:lt,subcircuit_id:Z().optional()}).describe("Draws a box on the schematic"),rlt=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:je().optional(),is_dashed:je().default(!1),stroke_width:lt.nullable().optional(),stroke_color:Z().optional(),dash_length:lt.optional(),dash_gap:lt.optional(),points:dn(Ti),subcircuit_id:Z().optional()}),slt=bc(wt({left_margin:ce.optional(),right_margin:ce.optional(),top_margin:ce.optional(),bottom_margin:ce.optional()})),alt=wt({left_size:_t(),right_size:_t(),top_size:_t().optional(),bottom_size:_t().optional()}),Alt=wt({left_side:wt({pins:dn(_t()),direction:Kn(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:wt({pins:dn(_t()),direction:Kn(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:wt({pins:dn(_t()),direction:Kn(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:wt({pins:dn(_t()),direction:Kn(["left-to-right","right-to-left"]).optional()}).optional()}),clt=xo([alt,Alt]),llt=wt({type:Xe("schematic_component"),size:Tne,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:slt.optional(),box_width:ce.optional(),symbol_name:Z().optional(),port_arrangement:clt.optional(),port_labels:bc(Z()).optional(),symbol_display_value:Z().optional(),subcircuit_id:Z().optional(),schematic_group_id:Z().optional(),is_schematic_group:je().optional(),source_group_id:Z().optional(),is_box_with_pins:je().optional().default(!0)}),X6n=wt({kicad_symbol:bct.optional()}).catchall(Lxe()),glt=wt({type:Xe("schematic_symbol"),schematic_symbol_id:Z(),name:Z().optional(),metadata:X6n.optional()}).describe("Defines a named schematic symbol that can be referenced by components."),ult=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:lt,y1:lt,x2:lt,y2:lt,stroke_width:lt.nullable().optional(),color:Z().default("#000000"),is_dashed:je().default(!1),dash_length:lt.optional(),dash_gap:lt.optional(),subcircuit_id:Z().optional()}).describe("Draws a styled line on the schematic"),dlt=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:lt,height:lt,rotation:oA.default(0),stroke_width:lt.nullable().optional(),color:Z().default("#000000"),is_filled:je().default(!1),fill_color:Z().optional(),is_dashed:je().default(!1),subcircuit_id:Z().optional()}).describe("Draws a styled rectangle on the schematic"),hlt=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:lt,stroke_width:lt.nullable().optional(),color:Z().default("#000000"),is_filled:je().default(!1),fill_color:Z().optional(),is_dashed:je().default(!1),subcircuit_id:Z().optional()}).describe("Draws a styled circle on the schematic"),plt=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:lt,start_angle_degrees:oA,end_angle_degrees:oA,direction:Kn(["clockwise","counterclockwise"]).default("counterclockwise"),stroke_width:lt.nullable().optional(),color:Z().default("#000000"),is_dashed:je().default(!1),subcircuit_id:Z().optional()}).describe("Draws a styled arc on the schematic"),mlt=wt({type:Xe("schematic_trace"),schematic_trace_id:Z(),schematic_sheet_id:Z().optional(),source_trace_id:Z().optional(),junctions:dn(wt({x:_t(),y:_t()})),edges:dn(wt({from:wt({x:_t(),y:_t()}),to:wt({x:_t(),y:_t()}),is_crossing:je().optional(),from_schematic_port_id:Z().optional(),to_schematic_port_id:Z().optional()})),subcircuit_id:Z().optional(),subcircuit_connectivity_map_key:Z().optional()}),q6n=Kn(["center","left","right","top","bottom"]),g3e=wt({text:Z(),is_overlined:je().optional()}),_lt=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(g3e).min(1).optional(),display_superscript:Z().optional(),font_size:_t().default(.18),position:wt({x:lt,y:lt}),rotation:_t().default(0),anchor:xo([q6n.describe("legacy"),M8]).default("center"),color:Z().default("#000000"),subcircuit_id:Z().optional()}),flt=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:_t().optional(),side_of_component:Kn(["top","bottom","left","right"]).optional(),true_ccw_index:_t().optional(),pin_number:_t().optional(),display_pin_label:Z().optional(),display_pin_label_text_parts:dn(g3e).min(1).optional(),display_pin_label_font_size:_t().positive().finite().optional(),subcircuit_id:Z().optional(),is_connected:je().optional(),is_internal_circuit_port:je().optional(),is_overlapping_internal_circuit_port:je().optional(),has_input_arrow:je().optional(),has_output_arrow:je().optional(),is_drawn_with_inversion_circle:je().optional()}).describe("Defines a port on a schematic component"),Ilt=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:je().optional(),subcircuit_id:Z().optional()}),Clt=Ml.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"),ylt=Ml.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"),Hne=wt({type:Xe("schematic_debug_object"),label:Z().optional(),subcircuit_id:Z().optional()}),xlt=Hne.extend({shape:Xe("rect"),center:Ti,size:Tne}),Elt=Hne.extend({shape:Xe("line"),start:Ti,end:Ti}),Blt=Hne.extend({shape:Xe("point"),center:Ti}),blt=_y("shape",[xlt,Elt,Blt]),Slt=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:O_.optional(),subcircuit_id:Z().optional(),color:Z().optional(),label_alignment:M8.optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),u3e=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"),Qlt=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:fQ([Z(),Z()]),schematic_sheet_id:Z().optional()}).describe("Warning emitted when the rendered bounds of two schematic components overlap"),vlt=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"),Plt=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"),wlt=lt.pipe(_t().positive().finite()),Mlt=wt({type:Xe("schematic_graphic"),schematic_graphic_id:so("schematic_graphic"),schematic_sheet_id:Z().optional(),asset:kne.optional(),svg_content:Z().optional(),width:wlt.optional(),height:wlt.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"})}),Dlt=wt({type:Xe("schematic_group"),schematic_group_id:so("schematic_group"),schematic_sheet_id:Z().optional(),source_group_id:Z(),is_subcircuit:je().optional(),subcircuit_id:Z().optional(),width:ce,height:ce,center:Ti,schematic_component_ids:dn(Z()),show_as_schematic_box:je().optional(),name:Z().optional(),description:Z().optional()}).describe("Defines a group of components on the schematic"),Nlt=wt({type:Xe("schematic_table"),schematic_table_id:so("schematic_table"),schematic_sheet_id:Z().optional(),anchor_position:Ti,column_widths:dn(lt),row_heights:dn(lt),cell_padding:lt.optional(),border_width:lt.optional(),subcircuit_id:Z().optional(),schematic_component_id:Z().optional(),anchor:M8.optional()}).describe("Defines a table on the schematic"),Rlt=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:_t(),end_row_index:_t(),start_column_index:_t(),end_column_index:_t(),text:Z().optional(),center:Ti,width:lt,height:lt,horizontal_align:Kn(["left","center","right"]).optional(),vertical_align:Kn(["top","middle","bottom"]).optional(),font_size:lt.optional(),subcircuit_id:Z().optional()}).describe("Defines a cell within a schematic_table"),d3e=Kn(["a4","ansi_b"]),Tlt=wt({type:Xe("schematic_sheet"),schematic_sheet_id:so("schematic_sheet"),name:Z().optional(),sheet_index:_t().optional(),sheet_size:d3e.optional(),sheet_width:_t().positive().optional(),sheet_height:_t().positive().optional(),subcircuit_id:Z().optional(),outline_color:Z().optional()}).describe("Defines a schematic sheet or page that components can be placed on"),klt=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."),Flt=wt({x:lt,y:lt,bulge:_t().optional()}),h3e=wt({vertices:dn(Flt)}),p3e=wt({outer_ring:h3e,inner_rings:dn(h3e).default([])}),m3e={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"},$6n={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}},Llt=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=>m3e[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").'),TV=Kn(["leftside_top","leftside_bottom","rightside_top","rightside_bottom","topside_left","topside_right","bottomside_left","bottomside_right"]),Z6n=[["leftside_top","bottomside_left","rightside_bottom","topside_right"],["leftside_bottom","bottomside_right","rightside_top","topside_left"]],e8n=(t,e)=>{for(const n of Z6n){const o=n.indexOf(t),i=n.indexOf(e);if(o!==-1&&i!==-1)return(i-o+n.length)%n.length*90}return null},Hlt=wt({x:lt,y:lt,via:je().optional(),via_to_layer:wr.optional()}),t8n=dn(Hlt),D9=wt({x:lt,y:lt,via:je().optional(),to_layer:wr.optional(),trace_width:lt.optional()}),Olt=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()}),Glt=wt({type:Xe("pcb_component"),pcb_component_id:so("pcb_component"),source_component_id:Z(),center:Ti,layer:wr,rotation:oA,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:je().optional(),is_allowed_to_be_off_board:je().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:M8.optional(),positioned_relative_to_pcb_group_id:Z().optional(),positioned_relative_to_pcb_board_id:Z().optional(),cable_insertion_center:Ti.optional(),insertion_direction:Llt.optional(),pin1_location:TV.optional().describe("Location of pin 1 on the unrotated, top-view component footprint"),supplier_pin1_location_map:bc(JM,TV).optional().describe("Pin 1 location for each supplier's unrotated, top-view footprint"),metadata:wt({kicad_footprint:Cct.optional()}).optional(),obstructs_within_bounds:je().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"),One=wt({type:Xe("pcb_debug_object"),pcb_debug_object_id:so("pcb_debug_object"),label:Z().optional(),subcircuit_id:Z().optional()}),Ylt=One.extend({shape:Xe("rect"),center:Ti,size:Tne}),Ult=One.extend({shape:Xe("line"),start:Ti,end:Ti}),Klt=One.extend({shape:Xe("point"),center:Ti}),Vlt=_y("shape",[Ylt,Ult,Klt]),zlt=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:_t(),x:lt,y:lt,is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional()}),n8n=zlt.describe("Defines a circular hole on the PCB"),Jlt=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:_t(),hole_height:_t(),x:lt,y:lt,is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional()}),o8n=Jlt.describe("Defines a rectangular (square-capable) hole on the PCB. Use equal width/height for square."),Wlt=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:_t(),x:lt,y:lt,is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional()}),i8n=Wlt.describe("Defines a circular or square hole on the PCB"),jlt=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:_t(),hole_height:_t(),x:lt,y:lt,is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional()}),r8n=jlt.describe("Defines an oval hole on the PCB"),Xlt=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:_t(),hole_height:_t(),x:lt,y:lt,is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional()}),s8n=Xlt.describe("Defines a pill-shaped hole on the PCB"),qlt=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:_t(),hole_height:_t(),x:lt,y:lt,ccw_rotation:oA,is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional()}),a8n=qlt.describe("Defines a rotated pill-shaped hole on the PCB"),$lt=Wlt.or(jlt).or(Xlt).or(qlt).or(zlt).or(Jlt),A8n=wt({type:Xe("pcb_plated_hole"),shape:Xe("circle"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),outer_diameter:_t(),hole_diameter:_t(),is_covered_with_solder_mask:je().optional(),x:lt,y:lt,layers:dn(wr),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:_t().optional()}),c8n=wt({type:Xe("pcb_plated_hole"),shape:Kn(["oval","pill"]),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),outer_width:_t(),outer_height:_t(),hole_width:_t(),hole_height:_t(),is_covered_with_solder_mask:je().optional(),x:lt,y:lt,ccw_rotation:oA,layers:dn(wr),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:_t().optional()}),l8n=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:_t(),rect_pad_width:_t(),rect_pad_height:_t(),rect_border_radius:_t().optional(),hole_offset_x:lt.default(0),hole_offset_y:lt.default(0),is_covered_with_solder_mask:je().optional(),x:lt,y:lt,layers:dn(wr),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:_t().optional(),rect_ccw_rotation:oA.optional()}),g8n=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:_t(),hole_height:_t(),rect_pad_width:_t(),rect_pad_height:_t(),rect_border_radius:_t().optional(),hole_offset_x:lt.default(0),hole_offset_y:lt.default(0),is_covered_with_solder_mask:je().optional(),x:lt,y:lt,layers:dn(wr),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:_t().optional()}),u8n=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:_t(),hole_height:_t(),hole_ccw_rotation:oA,rect_pad_width:_t(),rect_pad_height:_t(),rect_border_radius:_t().optional(),rect_ccw_rotation:oA,hole_offset_x:lt.default(0),hole_offset_y:lt.default(0),is_covered_with_solder_mask:je().optional(),x:lt,y:lt,layers:dn(wr),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:_t().optional()}),d8n=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:_t().optional(),hole_width:_t().optional(),hole_height:_t().optional(),pad_outline:dn(wt({x:lt,y:lt})).min(3),hole_offset_x:lt.default(0),hole_offset_y:lt.default(0),is_covered_with_solder_mask:je().optional(),x:lt,y:lt,layers:dn(wr),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:_t().optional(),ccw_rotation:oA.optional()}),Zlt=xo([A8n,c8n,l8n,g8n,u8n,d8n]),e0t=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:lt,y:lt,layers:dn(wr),is_board_pinout:je().optional()}).describe("Defines a port on the PCB"),h8n=wt({type:Xe("pcb_smtpad"),shape:Xe("circle"),pcb_smtpad_id:so("pcb_smtpad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),x:lt,y:lt,radius:_t(),layer:wr,port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional(),solderpaste_margin:_t().optional()}),p8n=wt({type:Xe("pcb_smtpad"),shape:Xe("rect"),pcb_smtpad_id:so("pcb_smtpad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),x:lt,y:lt,width:_t(),height:_t(),rect_border_radius:_t().optional(),corner_radius:_t().optional(),layer:wr,port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional(),soldermask_margin_left:_t().optional(),soldermask_margin_top:_t().optional(),soldermask_margin_right:_t().optional(),soldermask_margin_bottom:_t().optional(),solderpaste_margin:_t().optional()}),m8n=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:lt,y:lt,width:_t(),height:_t(),rect_border_radius:_t().optional(),corner_radius:_t().optional(),ccw_rotation:oA,layer:wr,port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional(),soldermask_margin_left:_t().optional(),soldermask_margin_top:_t().optional(),soldermask_margin_right:_t().optional(),soldermask_margin_bottom:_t().optional(),solderpaste_margin:_t().optional()}),t0t=wt({type:Xe("pcb_smtpad"),shape:Xe("pill"),pcb_smtpad_id:so("pcb_smtpad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),x:lt,y:lt,width:_t(),height:_t(),radius:_t(),layer:wr,port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional(),solderpaste_margin:_t().optional()}),_8n=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:lt,y:lt,width:_t(),height:_t(),radius:_t(),ccw_rotation:oA,layer:wr,port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional(),solderpaste_margin:_t().optional()}),f8n=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:wr,port_hints:dn(Z()).optional(),pcb_component_id:Z().optional(),pcb_port_id:Z().optional(),is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional(),solderpaste_margin:_t().optional()}),n0t=_y("shape",[h8n,p8n,m8n,_8n,t0t,f8n]).describe("Defines an SMT pad on the PCB"),I8n=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:lt,y:lt,radius:_t(),layer:wr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),C8n=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:lt,y:lt,width:_t(),height:_t(),layer:wr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),y8n=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:lt,y:lt,width:_t(),height:_t(),radius:_t(),layer:wr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),x8n=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:lt,y:lt,width:_t(),height:_t(),ccw_rotation:lt,layer:wr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),E8n=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:lt,y:lt,width:_t(),height:_t(),radius:_t(),ccw_rotation:oA,layer:wr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),B8n=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:lt,y:lt,width:_t(),height:_t(),layer:wr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),o0t=xo([I8n,C8n,y8n,x8n,E8n,B8n]).describe("Defines solderpaste on the PCB"),i0t=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:wr,width:ce,height:ce,lines:_t(),align:Kn(["bottom-left"])}).describe("Defines text on the PCB"),r0t=wt({route_type:Xe("wire"),x:lt,y:lt,width:lt,copper_pour_id:Z().optional(),is_inside_copper_pour:je().optional(),start_pcb_port_id:Z().optional(),end_pcb_port_id:Z().optional(),layer:wr}),s0t=wt({route_type:Xe("via"),x:lt,y:lt,copper_pour_id:Z().optional(),is_inside_copper_pour:je().optional(),hole_diameter:lt.optional(),outer_diameter:lt.optional(),from_layer:wr,to_layer:wr}),a0t=wt({route_type:Xe("through_pad"),start:Ti,end:Ti,width:lt,start_layer:wr,end_layer:wr,pcb_smtpad_id:Z().optional(),pcb_plated_hole_id:Z().optional()}),_3e=xo([r0t,s0t,a0t]),A0t=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:_t().optional(),should_round_corners:je().optional(),trace_length:_t().optional(),highlight_color:Z().optional(),route:dn(_3e)}).describe("Defines a trace on the PCB"),c0t=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"),l0t=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:lt,maximum_trace_length:lt,subcircuit_id:Z().optional()}).describe("Warning emitted when a PCB trace is longer than its maximum allowed length"),g0t=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:_t().int().nonnegative(),maximum_via_count:_t().int().nonnegative(),subcircuit_id:Z().optional()}).describe("Warning emitted when a PCB trace has more vias than its maximum allowed count"),u0t=Ml.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"),d0t=Ml.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"),h0t=Ml.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"),p0t=Ml.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"),m0t=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"),Gne=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:lt,y:lt,outer_diameter:lt.default("0.6mm"),hole_diameter:lt.default("0.25mm"),from_layer:wr.optional(),to_layer:wr.optional(),layers:dn(wr),pcb_trace_id:Z().optional(),source_trace_id:Z().optional(),source_net_id:Z().min(1).optional(),net_is_assignable:je().optional(),net_assigned:je().optional(),is_tented:je().optional(),tented_on_top:je().optional(),tented_on_bottom:je().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"),_0t=wt({type:Xe("pcb_board"),pcb_board_id:so("pcb_board"),pcb_panel_id:Z().optional(),carrier_pcb_board_id:Z().optional(),is_subcircuit:je().optional(),subcircuit_id:Z().optional(),is_mounted_to_carrier_board:je().optional(),is_via_in_pad_allowed:je().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:_t().optional().default(4),allow_blind_and_buried_vias:je().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:M8.optional(),position_mode:Kn(["relative_to_panel_anchor","none"]).optional()}).merge(Olt).describe("Defines the board outline of the PCB"),f0t=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:je().optional().default(!0)}).describe("Defines a PCB panel that can contain multiple boards"),I0t=Ml.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"),C0t=Ml.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"),y0t=Ml.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"),x0t=wt({type:Xe("pcb_trace_hint"),pcb_trace_hint_id:so("pcb_trace_hint"),pcb_port_id:Z(),pcb_component_id:Z(),route:dn(D9),subcircuit_id:Z().optional()}).describe("A hint that can be used during generation of a PCB trace"),E0t=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:lt.default("0.1mm"),x1:lt,y1:lt,x2:lt,y2:lt,layer:Vm}).describe("Defines a silkscreen line on the PCB"),B0t=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:Vm,route:dn(Ti),stroke_width:ce}).describe("Defines a silkscreen path on the PCB"),b0t=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:lt.default("0.2mm"),pcb_component_id:Z(),text:Z(),is_knockout:je().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:_t().optional(),layer:wr,is_mirrored:je().default(!1).optional(),anchor_position:Ti.default({x:0,y:0}),anchor_alignment:M8.default("center")}).describe("Defines silkscreen text on the PCB"),S0t=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:lt.default("0.2mm"),pcb_component_id:Z(),text:Z(),is_knockout:je().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:_t().optional(),layer:wr,is_mirrored:je().default(!1).optional(),anchor_position:Ti.default({x:0,y:0}),anchor_alignment:M8.default("center")}).describe("Defines copper text on the PCB"),Q0t=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:wr,stroke_width:ce.default("1mm"),corner_radius:ce.optional(),is_filled:je().default(!0).optional(),has_stroke:je().optional(),is_stroke_dashed:je().optional(),ccw_rotation:_t().optional()}).describe("Defines a silkscreen rect on the PCB"),v0t=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:Vm,stroke_width:ce.default("1mm"),is_filled:je().optional()}).describe("Defines a silkscreen circle on the PCB"),P0t=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:lt,radius_y:lt,layer:Vm,ccw_rotation:oA.optional()}).describe("Defines a silkscreen oval on the PCB"),b8n=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:Vm,image_asset:kne.optional()}),w0t=b8n.extend({shape:Xe("brep"),brep_shape:p3e}).describe("Defines a BRep silkscreen graphic on the PCB"),M0t=_y("shape",[w0t]).describe("Defines a silkscreen graphic on the PCB"),D0t=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:wr,ccw_rotation:_t().optional()}).describe("Defines a silkscreen pill on the PCB"),f3e=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:lt.default("1mm"),pcb_component_id:Z(),text:Z(),ccw_rotation:_t().optional(),layer:Vm,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"),I3e=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:wr,route:dn(Ti),stroke_width:ce,color:Z().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),C3e=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:Vm,stroke_width:ce.default("0.1mm"),corner_radius:ce.optional(),is_filled:je().optional(),has_stroke:je().optional(),is_stroke_dashed:je().optional(),color:Z().optional()}).describe("Defines a fabrication note rectangle on the PCB"),y3e=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:Vm,from:Ti,to:Ti,text:Z().optional(),text_ccw_rotation:_t().optional(),offset:ce.optional(),offset_distance:ce.optional(),offset_direction:wt({x:_t(),y:_t()}).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"),x3e=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:lt.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:Vm.default("top"),is_mirrored_from_top_view:je().optional(),color:Z().optional()}).describe("Defines a documentation note in text on the PCB"),E3e=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:Vm.default("top"),stroke_width:ce.default("0.1mm"),corner_radius:ce.optional(),is_filled:je().optional(),has_stroke:je().optional(),is_stroke_dashed:je().optional(),color:Z().optional()}).describe("Defines a rectangular documentation note on the PCB"),B3e=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:Vm.default("top"),stroke_width:ce.default("0.1mm"),color:Z().optional()}).describe("Defines a polyline documentation note on the PCB"),b3e=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:lt,y1:lt,x2:lt,y2:lt,layer:Vm.default("top"),stroke_width:lt.default("0.1mm"),color:Z().optional(),is_dashed:je().optional()}).describe("Defines a straight documentation note line on the PCB"),S3e=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:_t().optional(),offset_distance:ce.optional(),offset_direction:wt({x:_t(),y:_t()}).optional(),font:Xe("tscircuit2024").default("tscircuit2024"),font_size:ce.default("1mm"),layer:Vm.default("top"),color:Z().optional(),arrow_size:ce.default("1mm")}).describe("Defines a measurement annotation within PCB documentation notes"),N0t=Ml.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"),R0t=Ml.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:fQ([Z(),Z()])}).describe("Error emitted when the courtyard (CrtYd) of one PCB component overlaps with the courtyard of another"),T0t=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()}),Q3e=wt({type:Xe("pcb_keepout"),shape:Xe("rect"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),center:Ti,width:lt,height:lt,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:lt,pcb_keepout_id:Z(),layers:dn(Z()),description:Z().optional(),excluded_pcb_component_ids:dn(Z()).optional()})).or(T0t),Yne=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()}),k0t=Yne.extend({shape:Xe("rect"),center:Ti,width:ce,height:ce,rotation:oA.optional(),corner_radius:ce.optional()}),F0t=Yne.extend({shape:Xe("circle"),center:Ti,radius:ce}),L0t=Yne.extend({shape:Xe("polygon"),points:dn(Ti)}),H0t=Yne.extend({shape:Xe("path"),route:dn(Ti),slot_width:ce,slot_length:ce.optional(),space_between_slots:ce.optional(),slot_corner_radius:ce.optional()}),v3e=_y("shape",[k0t,F0t,L0t,H0t]).describe("Defines a cutout on the PCB, removing board material."),O0t=Ml.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"),kV=Ml.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"),P3e=Ml.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(ud()).optional()}).describe("Defines an error when a circuit JSON footprint fails to load"),G0t=wt({type:Xe("pcb_group"),pcb_group_id:so("pcb_group"),source_group_id:Z(),is_subcircuit:je().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:M8.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"),Y0t=Ml.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"),w3e=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"),U0t=Kn(["x-","x+","y+","y-"]),K0t=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:U0t,recommended_facing_direction:U0t,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"),V0t=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"),M3e=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:JM.optional(),supplier_part_number:Z().optional(),supplier_footprint_url:Z().optional(),footprint_copper_intersection_over_union:_t()}).describe("Warning emitted when a supplier part footprint does not match the expected footprint"),z0t=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."),J0t=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:wr.optional(),x:lt,y:lt}).describe("Defines a routing target within a pcb_group for a source_trace or source_net"),W0t=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"),j0t=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:wr,points:dn(Ti)}).describe("Defines a polygon region of a ground plane"),X0t=wt({type:Xe("pcb_thermal_spoke"),pcb_thermal_spoke_id:so("pcb_thermal_spoke"),pcb_ground_plane_id:Z(),shape:Z(),spoke_count:_t(),spoke_thickness:lt,spoke_inner_diameter:lt,spoke_outer_diameter:lt,pcb_plated_hole_id:Z().optional(),subcircuit_id:Z().optional()}).describe("Pattern for connecting a ground plane to a plated hole"),D3e=wt({type:Xe("pcb_copper_pour"),pcb_copper_pour_id:so("pcb_copper_pour"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),layer:wr,source_net_id:Z().optional(),covered_with_solder_mask:je().optional().default(!0)}),q0t=D3e.extend({shape:Xe("rect"),center:Ti,width:ce,height:ce,rotation:oA.optional()}),$0t=D3e.extend({shape:Xe("brep"),brep_shape:p3e}),Z0t=D3e.extend({shape:Xe("polygon"),points:dn(Ti)}),N3e=_y("shape",[q0t,$0t,Z0t]).describe("Defines a copper pour on the PCB."),egt=Ml.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:_t(),max_x:_t(),min_y:_t(),max_y:_t()}),subcircuit_id:Z().optional(),source_component_id:Z().optional()}).describe("Error emitted when a PCB component is placed outside the board boundaries"),tgt=Ml.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:_t(),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"),Une=Ml.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:wr,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)"),ngt=Ml.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:lt.optional(),actual_clearance:lt.optional(),pcb_center:wt({x:_t().optional(),y:_t().optional()}).optional(),subcircuit_id:Z().optional()}).describe("Error emitted when vias are closer than the allowed clearance"),ogt=Ml.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:lt.optional(),actual_clearance:lt.optional(),center:wt({x:_t().optional(),y:_t().optional()}).optional(),subcircuit_id:Z().optional()}).describe("Error emitted when a via and trace are closer than the allowed clearance"),igt=Ml.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:lt.optional(),actual_clearance:lt.optional(),center:wt({x:_t().optional(),y:_t().optional()}).optional(),subcircuit_id:Z().optional()}).describe("Error emitted when pads are closer than the allowed clearance"),rgt=Ml.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:lt.optional(),actual_clearance:lt.optional(),center:wt({x:_t().optional(),y:_t().optional()}).optional(),subcircuit_id:Z().optional()}).describe("Error emitted when a pad and trace are closer than allowed clearance"),R3e=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:Vm,ccw_rotation:oA.optional(),color:Z().optional()}).describe("Defines a courtyard rectangle on the PCB"),T3e=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:Vm,outline:dn(Ti).min(2)}).describe("Defines a courtyard outline on the PCB"),k3e=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:Vm,points:dn(Ti).min(3),color:Z().optional()}).describe("Defines a courtyard polygon on the PCB"),F3e=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:Vm,color:Z().optional()}).describe("Defines a courtyard circle on the PCB"),L3e=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:Vm,color:Z().optional()}).describe("Defines a courtyard pill on the PCB"),S8n=["obj","stl","3mf","gltf","glb","step","wrl"],sgt=["x+","x-","y+","y-","z+","z-"],Q8n={obj:"z+",stl:"z+","3mf":"z+",gltf:"y+",glb:"y+",step:"z+",wrl:"y+"},agt=wt({type:Xe("cad_component"),cad_component_id:Z(),pcb_component_id:Z(),source_component_id:Z(),position:M9,rotation:M9.optional(),size:M9.optional(),layer:wr.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:kne.optional(),model_unit_to_mm_scale_factor:_t().optional(),model_board_normal_direction:Kn(sgt).optional().describe(`The direction in the model's coordinate space that is considered "up" or "coming out of the board surface"`),model_origin_position:M9.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:ud().optional(),show_as_translucent_model:je().optional(),show_as_bounding_box:je().optional(),show_hidden_edges:je().optional(),anchor_alignment:Kn(["center","center_of_component_on_board_surface"]).optional().default("center")}).describe("Defines a component on the PCB"),H3e=Kn(["sinewave","square","triangle","sawtooth"]),v8n=xo([Z(),_t()]).transform(t=>typeof t=="string"?t.endsWith("%")?parseFloat(t.slice(0,-1))/100:parseFloat(t):t).pipe(_t().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),Agt=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:O_,ac_magnitude:O_.optional(),ac_phase:oA.optional()}).describe("Defines a DC voltage source for simulation"),cgt=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:O_.optional(),frequency:fy.optional(),peak_to_peak_voltage:O_.optional(),wave_shape:H3e.optional(),phase:oA.optional(),duty_cycle:v8n.optional(),pulse_delay:wl.optional(),rise_time:wl.optional(),fall_time:wl.optional(),pulse_width:wl.optional(),period:wl.optional(),ac_magnitude:O_.optional(),ac_phase:oA.optional()}).describe("Defines an AC voltage source for simulation"),lgt=xo([Agt,cgt]).describe("Defines a voltage source for simulation"),P8n=xo([Z(),_t()]).transform(t=>typeof t=="string"?t.endsWith("%")?parseFloat(t.slice(0,-1))/100:parseFloat(t):t).pipe(_t().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),ggt=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:N3,ac_magnitude:N3.optional(),ac_phase:oA.optional()}).describe("Defines a DC current source for simulation"),ugt=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:N3.optional(),frequency:fy.optional(),peak_to_peak_current:N3.optional(),wave_shape:H3e.optional(),phase:oA.optional(),duty_cycle:P8n.optional(),ac_magnitude:N3.optional(),ac_phase:oA.optional()}).describe("Defines an AC current source for simulation"),dgt=xo([ggt,ugt]).describe("Defines a current source for simulation"),Kne=w0(t=>t==="V"||t==="A"),O3e=w0(t=>t==="Ω"||t==="F"||t==="H"||t==="V"||t==="A"),hgt=xo([Xe("spice_dc_sweep"),Xe("spice_dc_operating_point"),Xe("spice_transient_analysis"),Xe("spice_ac_analysis")]),pgt=wt({method:Kn(["trap","gear"]).optional(),reltol:xo([_t(),Z()]).optional(),abstol:xo([_t(),Z()]).optional(),vntol:xo([_t(),Z()]).optional()}).describe("SPICE solver options for a simulation experiment"),mgt=wt({type:Xe("simulation_experiment"),simulation_experiment_id:so("simulation_experiment"),name:Z(),experiment_type:hgt,time_per_step:jk.optional(),start_time_ms:wl.optional(),end_time_ms:wl.optional(),spice_options:pgt.optional(),dc_sweep_voltage_source_id:Z().optional(),dc_sweep_current_source_id:Z().optional(),dc_sweep_start:_t().optional(),dc_sweep_stop:_t().optional(),dc_sweep_step:_t().refine(t=>t!==0).optional(),dc_sweep_unit:Kne.optional(),ac_sweep_type:Kn(["linear","decade","octave"]).optional(),ac_samples_per_interval:_t().int().positive().optional(),ac_sample_count:_t().int().positive().optional(),ac_start_frequency_hz:_t().positive().optional(),ac_stop_frequency_hz:_t().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"),D8=wt({simulation_parameter_sweep_id:Z(),sweep_index:_t().int().nonnegative(),parameter_value:_t(),parameter_unit:O3e}),_gt=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:D8.optional(),timestamps_ms:dn(_t()).optional(),voltage_levels:dn(_t()),source_component_id:Z().optional(),subcircuit_connectivity_map_key:Z().optional(),time_per_step:jk,start_time_ms:wl,end_time_ms:wl,name:Z().optional(),color:Z().optional()}).describe("Stores voltage measurements over time for a simulation"),fgt=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:D8.optional(),timestamps_ms:dn(_t()).optional(),current_levels:dn(_t()),source_component_id:Z().optional(),subcircuit_connectivity_map_key:Z().optional(),time_per_step:jk,start_time_ms:wl,end_time_ms:wl,name:Z().optional(),color:Z().optional()}).describe("Stores current measurements over time for a simulation"),Igt=wt({type:Xe("simulation_switch"),simulation_switch_id:so("simulation_switch"),source_component_id:Z().optional(),closes_at:wl.optional(),opens_at:wl.optional(),starts_closed:je().optional(),switching_frequency:fy.optional()}).describe("Defines a switch for simulation timing control"),Cgt=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."})}),ygt=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."})}),xgt=Ml.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."),w8n=Kn(["resistance","capacitance","inductance","voltage","current"]),FV=wt({type:Xe("simulation_parameter_sweep"),simulation_parameter_sweep_id:so("simulation_parameter_sweep"),simulation_experiment_id:Z(),name:Z().optional(),parameter_values:dn(_t()).min(1),parameter_unit:O3e}),Egt=_y("parameter_type",[FV.extend({parameter_type:Xe("resistance"),resistor_source_component_id:Z()}),FV.extend({parameter_type:Xe("capacitance"),capacitor_source_component_id:Z()}),FV.extend({parameter_type:Xe("inductance"),inductor_source_component_id:Z()}),FV.extend({parameter_type:Xe("voltage"),source_net_id:Z()}),FV.extend({parameter_type:Xe("current"),current_source_component_id:Z()})]).describe("Repeats a simulation experiment over component parameter values"),Bgt=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:D8.optional(),simulation_voltage_probe_id:Z(),voltage:_t(),name:Z().optional(),color:Z().optional()}),bgt=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:D8.optional(),simulation_current_probe_id:Z(),current:_t(),name:Z().optional(),color:Z().optional()}),Sgt=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:D8.optional(),simulation_voltage_probe_id:Z(),sweep_values:dn(_t()),sweep_unit:Kne,voltage_levels:dn(_t()),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"}),Qgt=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:D8.optional(),simulation_current_probe_id:Z(),sweep_values:dn(_t()),sweep_unit:Kne,current_levels:dn(_t()),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"}),G3e=wt({re:_t(),im:_t()}),vgt=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:D8.optional(),simulation_voltage_probe_id:Z(),frequencies_hz:dn(_t()),complex_voltages:dn(G3e),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"}),Pgt=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:D8.optional(),simulation_current_probe_id:Z(),frequencies_hz:dn(_t()),complex_currents:dn(G3e),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"}),wgt=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"),Mgt=wt({type:Xe("simulation_spice_subcircuit"),simulation_spice_subcircuit_id:so("simulation_spice_subcircuit"),source_component_id:Z(),spice_pin_to_source_port_map:bc(Z(),Z()),subcircuit_source:Z()}).describe("Defines a custom SPICE subcircuit model for simulation"),Dgt=t=>t!==void 0,Ngt=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:_t().optional(),display_center_offset_divs:_t().optional(),volts_per_div:_t().positive().optional(),amps_per_div:_t().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(Dgt).length,o=[t.simulation_transient_current_graph_id,t.simulation_current_probe_id].filter(Dgt).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."})}),Y3e=xo([Kct,Yct,Uct,Gct,zct,Vct,Uxe,Oxe,Lne,Yxe,Gxe,Kxe,Vxe,zxe,jxe,Xxe,qxe,n3e,$xe,Zxe,e3e,t3e,Wxe,Jxe,jct,Xct,Jct,o3e,i3e,r3e,s3e,qct,olt,a3e,A3e,$ct,Zct,elt,tlt,nlt,RV,c3e,NV,Wct,Glt,Vlt,$lt,O0t,kV,P3e,w3e,K0t,V0t,M3e,z0t,Zlt,Q3e,e0t,m0t,i0t,A0t,c0t,l0t,g0t,Gne,n0t,o0t,_0t,f0t,G0t,x0t,E0t,B0t,b0t,D0t,S0t,Q0t,v0t,P0t,M0t,u0t,d0t,I0t,C0t,y0t,h0t,p0t,ngt,ogt,igt,rgt,I3e,f3e,C3e,y3e,x3e,E3e,B3e,b3e,S3e,Y0t,N0t,R0t,J0t,v3e,W0t,j0t,X0t,N3e,egt,tgt,Une,R3e,T3e,k3e,F3e,L3e,ilt,_lt,ult,dlt,hlt,plt,llt,glt,flt,mlt,rlt,Clt,ylt,Ilt,blt,Slt,u3e,Qlt,vlt,klt,Plt,Mlt,Dlt,Tlt,Nlt,Rlt,agt,lgt,dgt,mgt,_gt,fgt,Bgt,bgt,Sgt,Qgt,vgt,Pgt,Egt,Igt,Cgt,ygt,Ngt,xgt,wgt,Mgt]),H4=Y3e;const N9=Object.freeze(Object.defineProperty({__proto__:null,all_layers:Xk,any_circuit_element:Y3e,any_soup_element:H4,any_source_component:Gct,asset:kne,base_circuit_json_error:Ml,battery_capacity:hct,brep_shape:p3e,cadModelDefaultDirectionMap:Q8n,cad_component:agt,cad_model_axis_directions:sgt,cad_model_formats:S8n,capacitance:zM,circuit_json_footprint_load_error:P3e,current:N3,distance:lt,duration_ms:jk,experiment_type:hgt,external_footprint_load_error:kV,frequency:fy,getRotationBetweenPcbPin1Locations:e8n,getZodPrefixedIdWithDefault:so,inductance:Rne,insertionDirectionToCanonical:m3e,insertionDirectionToVector:$6n,insertion_direction:Llt,kicadAt:Fne,kicadEffects:pct,kicadFont:Hxe,kicadFootprintAttributes:_ct,kicadFootprintMetadata:Cct,kicadFootprintModel:Ict,kicadFootprintPad:fct,kicadFootprintProperties:mct,kicadProperty:DV,kicadSymbolEffects:Ect,kicadSymbolMetadata:bct,kicadSymbolPinNames:xct,kicadSymbolPinNumbers:yct,kicadSymbolProperties:Bct,kicadSymbolProperty:yQ,layer_ref:wr,layer_string:l3e,length:ce,manufacturing_drc_properties:Olt,ms:wl,ninePointAnchor:M8,parseAndConvertSiUnit:q1,pcbRenderLayer:j6n,pcb_autorouting_error:Y0t,pcb_board:_0t,pcb_breakout_point:J0t,pcb_component:Glt,pcb_component_invalid_layer_error:Une,pcb_component_missing_courtyard_warning:V0t,pcb_component_not_on_board_edge_error:tgt,pcb_component_outside_board_error:egt,pcb_connector_not_in_accessible_orientation_warning:K0t,pcb_copper_pour:N3e,pcb_copper_pour_brep:$0t,pcb_copper_pour_polygon:Z0t,pcb_copper_pour_rect:q0t,pcb_copper_text:S0t,pcb_courtyard_circle:F3e,pcb_courtyard_outline:T3e,pcb_courtyard_overlap_error:R0t,pcb_courtyard_pill:L3e,pcb_courtyard_polygon:k3e,pcb_courtyard_rect:R3e,pcb_cutout:v3e,pcb_cutout_circle:F0t,pcb_cutout_path:H0t,pcb_cutout_polygon:L0t,pcb_cutout_rect:k0t,pcb_debug_line:Ult,pcb_debug_object:Vlt,pcb_debug_object_base:One,pcb_debug_point:Klt,pcb_debug_rect:Ylt,pcb_fabrication_note_dimension:y3e,pcb_fabrication_note_path:I3e,pcb_fabrication_note_rect:C3e,pcb_fabrication_note_text:f3e,pcb_fabricator_extra_charge_warning:z0t,pcb_footprint_overlap_error:N0t,pcb_ground_plane:W0t,pcb_ground_plane_region:j0t,pcb_group:G0t,pcb_hole:$lt,pcb_hole_circle_or_square_shape:i8n,pcb_hole_circle_shape:n8n,pcb_hole_oval_shape:r8n,pcb_hole_pill_shape:s8n,pcb_hole_rect_shape:o8n,pcb_hole_rotated_pill_shape:a8n,pcb_keepout:Q3e,pcb_keepout_outline:T0t,pcb_manual_edit_conflict_warning:w3e,pcb_missing_footprint_error:O0t,pcb_net:m0t,pcb_note_dimension:S3e,pcb_note_line:b3e,pcb_note_path:B3e,pcb_note_rect:E3e,pcb_note_text:x3e,pcb_packing_error:C0t,pcb_pad_pad_clearance_error:igt,pcb_pad_trace_clearance_error:rgt,pcb_panel:f0t,pcb_panelization_placement_error:y0t,pcb_pin1_location:TV,pcb_placement_error:I0t,pcb_plated_hole:Zlt,pcb_port:e0t,pcb_port_not_connected_error:p0t,pcb_port_not_matched_error:h0t,pcb_route_hint:Hlt,pcb_route_hints:t8n,pcb_silkscreen_circle:v0t,pcb_silkscreen_graphic:M0t,pcb_silkscreen_graphic_brep:w0t,pcb_silkscreen_line:E0t,pcb_silkscreen_oval:P0t,pcb_silkscreen_path:B0t,pcb_silkscreen_pill:D0t,pcb_silkscreen_rect:Q0t,pcb_silkscreen_text:b0t,pcb_smtpad:n0t,pcb_smtpad_pill:t0t,pcb_solder_paste:o0t,pcb_text:i0t,pcb_thermal_spoke:X0t,pcb_trace:A0t,pcb_trace_error:u0t,pcb_trace_hint:x0t,pcb_trace_missing_error:d0t,pcb_trace_route_point:_3e,pcb_trace_route_point_through_pad:a0t,pcb_trace_route_point_via:s0t,pcb_trace_route_point_wire:r0t,pcb_trace_too_long_warning:l0t,pcb_trace_too_many_vias_warning:g0t,pcb_trace_warning:c0t,pcb_via:Gne,pcb_via_clearance_error:ngt,pcb_via_trace_clearance_error:ogt,point:Ti,point3:M9,point_with_bulge:Flt,port_arrangement:clt,position:z6n,position3:J6n,resistance:w8,ring:h3e,rotation:oA,route_hint_point:D9,schematic_arc:plt,schematic_box:ilt,schematic_circle:hlt,schematic_component:llt,schematic_component_overlap_warning:Qlt,schematic_component_port_arrangement_by_sides:Alt,schematic_component_port_arrangement_by_size:alt,schematic_component_styling_warning:vlt,schematic_debug_line:Elt,schematic_debug_object:blt,schematic_debug_object_base:Hne,schematic_debug_point:Blt,schematic_debug_rect:xlt,schematic_element_outside_sheet_warning:Plt,schematic_error:Clt,schematic_graphic:Mlt,schematic_group:Dlt,schematic_layout_error:ylt,schematic_line:ult,schematic_manual_edit_conflict_warning:u3e,schematic_missing_sheet_warning:klt,schematic_net_label:Ilt,schematic_path:rlt,schematic_pin_styles:slt,schematic_port:flt,schematic_rect:dlt,schematic_sheet:Tlt,schematic_sheet_size:d3e,schematic_symbol:glt,schematic_table:Nlt,schematic_table_cell:Rlt,schematic_text:_lt,schematic_text_part:g3e,schematic_trace:mlt,schematic_voltage_probe:Slt,simulation_ac_current_source:ugt,simulation_ac_sweep_current_graph:Pgt,simulation_ac_sweep_voltage_graph:vgt,simulation_ac_voltage_source:cgt,simulation_complex_sample:G3e,simulation_current_probe:ygt,simulation_current_source:dgt,simulation_dc_current_source:ggt,simulation_dc_operating_point_current:bgt,simulation_dc_operating_point_voltage:Bgt,simulation_dc_sweep_current_graph:Qgt,simulation_dc_sweep_unit:Kne,simulation_dc_sweep_voltage_graph:Sgt,simulation_dc_voltage_source:Agt,simulation_experiment:mgt,simulation_op_amp:wgt,simulation_oscilloscope_trace:Ngt,simulation_parameter_sweep:Egt,simulation_parameter_sweep_coordinate:D8,simulation_parameter_type:w8n,simulation_parameter_unit:O3e,simulation_spice_subcircuit:Mgt,simulation_switch:Igt,simulation_transient_current_graph:fgt,simulation_transient_voltage_graph:_gt,simulation_unknown_experiment_error:xgt,simulation_voltage_probe:Cgt,simulation_voltage_source:lgt,size:Tne,source_ambiguous_port_reference:Wct,source_board:Jct,source_component_base:bg,source_component_internal_connection:Uct,source_component_misconfigured_error:NV,source_component_pins_underspecified_warning:elt,source_confusing_net_name_warning:olt,source_failed_to_create_component_error:kct,source_group:Vct,source_i2c_misconfigured_error:c3e,source_interconnect:Hct,source_invalid_component_property_error:i3e,source_manually_placed_via:Xct,source_missing_manufacturer_part_number_warning:a3e,source_missing_property_error:Tct,source_net:zct,source_no_ground_pin_defined_warning:Zct,source_no_power_pin_defined_warning:$ct,source_part_not_found_warning:RV,source_pcb_ground_plane:jct,source_pin_attributes:Mct,source_pin_missing_trace_warning:s3e,source_pin_must_be_connected_error:tlt,source_port:Yct,source_project_metadata:o3e,source_property_ignored_warning:Fct,source_refdes_convention_warning:A3e,source_simple_ammeter:wct,source_simple_battery:Vxe,source_simple_capacitor:Oxe,source_simple_chip:Uxe,source_simple_connector:Rct,source_simple_connector_standards:Nct,source_simple_crystal:Dct,source_simple_current_source:vct,source_simple_diode:Lne,source_simple_fiducial:Sct,source_simple_fuse:Pct,source_simple_ground:Qct,source_simple_inductor:zxe,source_simple_led:Yxe,source_simple_mosfet:e3e,source_simple_op_amp:t3e,source_simple_pin_header:jxe,source_simple_pinout:Xxe,source_simple_potentiometer:Wxe,source_simple_power_source:Kxe,source_simple_push_button:Jxe,source_simple_resistor:Gxe,source_simple_resonator:qxe,source_simple_switch:n3e,source_simple_test_point:Zxe,source_simple_transistor:$xe,source_simple_voltage_probe:Lct,source_simple_voltage_source:Oct,source_trace:Kct,source_trace_not_connected_error:r3e,source_unnamed_trace_warning:qct,spice_simulation_options:pgt,supplier_footprint_mismatch_warning:M3e,supplier_name:JM,time:V6n,timestamp:dct,unknown_error_finding_part:nlt,visible_layer:Vm,voltage:O_,wave_shape:H3e},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 M8n=/^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 D8n(t){const e=t.match(M8n);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 N8n(t){const{a:e,b:n,c:o,d:i,e:r,f:s}=t,a=e*i-n*o;return{a:i/a,b:n/-a,c:o/-a,d:e/a,e:(i*r-o*s)/-a,f:(n*r-e*s)/a}}function LV(t){return typeof t>"u"}function G_(t,e=0){return{a:1,c:0,e:t,b:0,d:1,f:e}}function HV(...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 HV(r,...i)}}}function l0(...t){return HV(...t)}const{cos:R8n,sin:T8n}=Math;function N8(t,e,n){const o=R8n(t),i=T8n(t),r={a:o,c:-i,e:0,b:i,d:o,f:0};return LV(e)||LV(n)?r:HV([G_(e,n),r,G_(-e,-n)])}function sx(t,e=void 0,n=void 0,o=void 0){LV(e)&&(e=t);const i={a:t,c:0,e:0,b:0,d:e,f:0};return LV(n)||LV(o)?i:HV([G_(n,o),i,G_(-n,-o)])}function k8n(t){return R8(t)}function R8(t){return`matrix(${t.a},${t.b},${t.c},${t.d},${t.e},${t.f})`}function F8n(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 L8n(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=N8n(d),_=HV([p,m]);return F8n(_)}function H8n(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n}function Vne(t,e,n,o){var i=Error.call(this,t);return Object.setPrototypeOf&&Object.setPrototypeOf(i,Vne.prototype),i.expected=e,i.found=n,i.location=o,i.name="SyntaxError",i}H8n(Vne,Error);function U3e(t,e,n){return n=n||" ",t.length>e?t:(e-=t.length,n+=n.repeat(e),t+n.slice(0,e))}Vne.prototype.format=function(t){var e="Error: "+this.message;if(this.location){var n=null,o;for(o=0;o<t.length;o++)if(t[o].source===this.location.source){n=t[o].text.split(/\r\n|\n|\r/g);break}var i=this.location.start,r=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(i):i,s=this.location.source+":"+r.line+":"+r.column;if(n){var a=this.location.end,A=U3e("",r.line.toString().length," "),c=n[i.line-1],l=i.line===a.line?a.column:c.length+1,g=l-i.column||1;e+=`
|
|
242
242
|
--> `+s+`
|
|
243
243
|
`+A+` |
|
|
@@ -5664,7 +5664,7 @@ test("${c} should solve problem correctly", () => {
|
|
|
5664
5664
|
// Add more specific assertions based on expected output
|
|
5665
5665
|
// expect(solver.netLabelPlacementSolver!.netLabelPlacements).toMatchInlineSnapshot()
|
|
5666
5666
|
})
|
|
5667
|
-
`,g=new Blob([l],{type:"text/plain"}),u=URL.createObjectURL(g),h=document.createElement("a");h.href=u,h.download=`${c}.test.ts`,h.click(),URL.revokeObjectURL(u)}catch(A){alert(`Error generating test.ts for ${t.getSolverName()}: ${A instanceof Error?A.message:String(A)}`)}o(!1)};return V.jsxs("div",{className:`relative ${e}`,ref:i,children:[V.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&&V.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:[V.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download JSON"}),V.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),V.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:a,children:"Download test.ts"})]})]})},Edn=t=>t.activeSubSolver?[t,...Edn(t.activeSubSolver)]:[t],VFi=({solver:t})=>{const e=Edn(t);return V.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:e.map((n,o)=>V.jsxs("div",{className:"flex items-center",children:[o>0&&V.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),V.jsx(KFi,{solver:n})]},n.getSolverName()))})},zFi=({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),S=n<1?Math.round(1/n):1;g.current=setInterval(()=>{if(t.solved||t.failed){g.current&&(clearInterval(g.current),g.current=void 0),l(),e(),A&&t.solved&&A(t);return}for(let Q=0;Q<S&&!(t.solved||t.failed);Q++)t.step();e()},B)},I=()=>{g.current&&(clearInterval(g.current),g.current=void 0)},C=()=>{!t.solved&&!t.failed&&(t.step(),e())},y=()=>{!t.solved&&!t.failed&&(a&&a(t),t.solve(),e(),A&&A(t))},x=()=>{c?(I(),l()):(l(),f())},E=()=>{if(t.solved||t.failed||c)return;u.current===null&&typeof window<"u"&&(u.current=window.localStorage.getItem(h));const B=window.prompt("Step until which iteration?",u.current??`${t.iterations}`);if(B===null)return;u.current=B,typeof window<"u"&&window.localStorage.setItem(h,B);const S=Number(B);if(!Number.isFinite(S)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<S&&!t.solved&&!t.failed;)t.step();e(),t.solved&&A&&A(t)};return 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=S=>{m.current&&!m.current.contains(S.target)&&p(null)};return document.addEventListener("mousedown",B),()=>{document.removeEventListener("mousedown",B)}},[]),V.jsxs("div",{className:"space-y-2 p-2 border-b",children:[V.jsx("div",{className:"flex items-center",children:V.jsxs("div",{className:"flex items-center gap-2",ref:m,children:[V.jsxs("div",{className:"flex h-9 items-center space-x-1 rounded-md border border-slate-200 bg-white p-1 shadow-sm",children:[V.jsxs("div",{className:"relative",children:[V.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"&&V.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=>V.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&&V.jsx("span",{className:"ml-auto text-xs text-slate-500",children:"✓"})]},B))})]}),V.jsxs("div",{className:"relative",children:[V.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"&&V.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:V.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"})})]}),V.jsxs("div",{className:"relative",children:[V.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"&&V.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=>V.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,V.jsx("span",{className:"ml-auto text-xs text-slate-500",children:B.description}),n===B.value&&V.jsx("span",{className:"ml-2 text-xs text-slate-500",children:"✓"})]},B.value))})]})]}),V.jsx(VFi,{solver:t})]})}),V.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[V.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"}),V.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"}),V.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"}),V.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"}),V.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&V.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),t.solved&&V.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&V.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&V.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},JFi=t=>t!==null&&"pipelineDef"in t&&Array.isArray(t.pipelineDef),WFi=(t,e,n)=>{const o=t.currentPipelineStageIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},jFi=(t,e)=>{const o=t.pipelineDef[e].solverName,i=WFi(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}},XFi=({status:t})=>{const e={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return V.jsx("span",{className:`font-medium ${e[t]}`,children:t})},qFi=({progress:t})=>{if(t===0)return null;const e=Math.round(t*100);return V.jsxs("div",{className:"flex items-center gap-2",children:[V.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:V.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${e}%`}})}),V.jsxs("span",{className:"text-xs text-gray-500",children:[e,"%"]})]})},Bdn=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)},$Fi=t=>Object.entries(t).map(([e,n])=>`${e}: ${Bdn(n)}`).join(", "),ZFi=({stats:t})=>{if(!t||Object.keys(t).length===0)return V.jsx("span",{children:"-"});const e=Object.entries(t),n=$Fi(t);return V.jsxs("details",{className:"cursor-pointer",children:[V.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:n}),V.jsx("div",{className:"mt-1 text-xs",children:e.map(([o,i])=>V.jsxs("div",{children:[o,": ",Bdn(i)]},o))})]})},Nje=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Nje);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=Nje(o));return e},eLi=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=Nje(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)}`)}},tLi=({expanded:t})=>V.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:V.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"})}),bdn=t=>{let e=t;for(;e.activeSubSolver;)e=e.activeSubSolver;return e},Sdn=({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,_)=>jFi(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):eLi(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=bdn(t);for(;!t.solved&&!t.failed&&(t.step(),bdn(t)===m););r?.()}},p=i*24;return V.jsxs("div",{className:o?"":"border-t border-gray-200",children:[!o&&V.jsxs("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200 flex items-center justify-between",children:[V.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Stages"}),V.jsxs("div",{className:"flex gap-2",children:[V.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"}),V.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"})]})]}),V.jsx("div",{className:"overflow-x-auto",children:V.jsxs("table",{className:"w-full text-sm",children:[!o&&V.jsx("thead",{children:V.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[V.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stage"}),V.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),V.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",V.jsx("sub",{children:"0"})]}),V.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),V.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),V.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),V.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),V.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),V.jsx("tbody",{children:A.map(m=>{const _=JFi(m.solverInstance),f=s.has(m.name);return V.jsxs(ks.Fragment,{children:[V.jsxs("tr",{className:`border-b border-gray-100 ${m.status==="In Progress"?"bg-yellow-50":""}`,children:[V.jsx("td",{className:"px-4 py-2",children:V.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:p},children:[_?V.jsx("button",{onClick:()=>c(m.name),className:"text-gray-500 hover:text-gray-700",title:f?"Collapse":"Expand",children:V.jsx(tLi,{expanded:f})}):V.jsx("span",{className:"w-4"}),V.jsx("span",{className:"text-gray-400 w-6",children:String(m.index+1).padStart(2,"0")}),V.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:V.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:V.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"})})}),V.jsx("span",{className:"font-medium text-gray-900",children:m.name})]})}),V.jsx("td",{className:"px-4 py-2",children:V.jsx(XFi,{status:m.status})}),V.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:m.firstIteration!==null?m.firstIteration:""}),V.jsx("td",{className:"px-4 py-2 text-gray-600",children:m.iterations}),V.jsx("td",{className:"px-4 py-2",children:V.jsx(qFi,{progress:m.progress})}),V.jsx("td",{className:"px-4 py-2 text-gray-600",children:u(m.timeSpent)}),V.jsx("td",{className:"px-4 py-2 text-gray-500",children:V.jsx(ZFi,{stats:m.stats})}),V.jsx("td",{className:"px-4 py-2",children:m.solverInstance?V.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:[V.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:V.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"})}),V.jsx("span",{children:"Input"})]}):null})]}),_&&f&&V.jsx("tr",{children:V.jsx("td",{colSpan:8,className:"p-0",children:V.jsx(Sdn,{solver:m.solverInstance,onStepUntilPhase:e,onDownloadInput:n,isNested:!0,indentLevel:i+1,triggerRender:r})})})]},m.name)})})]})})]})};function nLi({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 V.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${u} ${h} ${d} ${p}`,role:"img","aria-label":"Graphics fallback",children:[o.map((m,_)=>V.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,_)=>V.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,_)=>V.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,_)=>V.jsx("circle",{cx:m.x??0,cy:m.y??0,r:m.radius??1.5,fill:m.color??"black"},`point-${_}`)),r.map((m,_)=>V.jsx("text",{x:m.x??0,y:m.y??0,fontSize:m.fontSize??10,fill:m.color??"black",children:m.text??""},`text-${_}`))]})}var oLi=class extends ks.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}},iLi=({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 V.jsxs("div",{children:[V.jsx(zFi,{solver:a,triggerRender:s,animationSpeed:l,renderer:A,onRendererChange:_,onAnimationSpeedChange:g,onDownloadVisualization:m,onSolverStarted:o,onSolverCompleted:i}),h?V.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):V.jsx(oLi,{fallback:V.jsx(nLi,{graphics:u}),children:A==="canvas"?V.jsx(UFi,{graphics:u}):V.jsx(OFi,{graphics:u})}),d&&V.jsx(Sdn,{solver:a,onStepUntilPhase:p,triggerRender:s})]})};const rLi=()=>{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)},[])},sLi=1e3,xE=(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)},sLi)},Rje=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"},aLi=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]},z6="https://github.com/tscircuit/tscircuit-autorouter/issues/new",Qdn="https://github.com/tscircuit/copper-pour-solver/issues/new",vdn="https://github.com/tscircuit/calculate-packing/issues/new",ALi="https://github.com/tscircuit/matchpack/issues/new",Pdn="https://github.com/tscircuit/schematic-trace-solver/issues/new?template=json-bug-report.yml",cLi={PackSolver2:vdn,LayoutPipelineSolver:ALi,AutoroutingPipelineSolver:z6,AssignableAutoroutingPipeline2:z6,AssignableAutoroutingPipeline3:z6,AutoroutingPipeline1_OriginalUnravel:z6,AutoroutingPipelineSolver3_HgPortPointPathing:z6,AutoroutingPipelineSolver4:z6,AutoroutingPipelineSolver5:z6,AutoroutingPipelineSolver7_MultiGraph:z6,AutoroutingPipelineSolver8:z6,CopperPourPipelineSolver:Qdn,SchematicTracePipelineSolver:Pdn},lLi=t=>t.toLowerCase().includes("pack")?c7i:t.toLowerCase().includes("rout")?bAn:t7i,wdn=t=>{const e=cLi[t];if(e)return e;const n=t.toLowerCase();return n.includes("autorout")?z6:n.includes("schematic")&&n.includes("trace")?Pdn:n.includes("copperpour")?Qdn:n.includes("pack")?vdn:null},gLi=t=>`${Rje(`${t.componentName}-${t.solverName}`)}-solver-input.json`,Mdn=t=>{xE(JSON.stringify(t.solverParams,null,2),{fileName:gLi(t),mimeType:"application/json"})},uLi=({solverEvent:t})=>{const e=wdn(t.solverName);return V.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:[V.jsxs($c,{type:"button",variant:"outline",size:"sm",onClick:()=>Mdn(t),children:[V.jsx(K$,{className:"rf-w-4 rf-h-4"}),"Download"]}),e?V.jsx($c,{asChild:!0,variant:"outline",size:"sm",children:V.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[V.jsx(Hpe,{className:"rf-w-4 rf-h-4"}),"Report"]})}):V.jsxs($c,{type:"button",variant:"outline",size:"sm",disabled:!0,title:"No report link configured for this solver",children:[V.jsx(Hpe,{className:"rf-w-4 rf-h-4"}),"Report"]})]})},dLi=({solverEvent:t})=>{const e=wdn(t.solverName);return e?V.jsx($c,{asChild:!0,variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",children:V.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:"Report solver bug","aria-label":"Report solver bug",children:V.jsx(Hpe,{className:"rf-w-4 rf-h-4"})})}):V.jsx($c,{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:V.jsx(Hpe,{className:"rf-w-4 rf-h-4"})})},hLi=({solverEvents:t=[]})=>{const[e,n]=te.useState(null);rLi();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=bRe[r.solverName];if(!a)return{instance:null,error:`Solver class "${r.solverName}" not found in SOLVERS registry. Available: ${Object.keys(bRe).join(", ")}`,classFound:!1};try{return{instance:new a(...aLi(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?V.jsx("div",{className:"rf-p-4",children:V.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:V.jsxs("div",{className:"rf-p-4",children:[V.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),V.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."})]})})}):V.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[V.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[V.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 V.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=lLi(A.solverName);return V.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[V.jsx(l,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),V.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[V.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:A.componentName}),V.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:A.solverName})]})]})})()},a)})]}),V.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:r?s.instance?V.jsxs("div",{className:"rf-flex rf-h-full rf-flex-col rf-overflow-y-auto",children:[V.jsx(uLi,{solverEvent:r}),V.jsx("div",{className:"rf-min-h-0 rf-flex-1",children:V.jsx(UB,{fallback:V.jsx("div",{className:"rf-p-4",children:V.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[V.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),V.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",r.solverName]})]})}),children:V.jsx(iLi,{solver:s.instance})})})]}):V.jsxs("div",{className:"rf-p-4",children:[V.jsxs("div",{className:"rf-mb-4",children:[V.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:r.solverName}),V.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",r.componentName]})]}),s.error&&V.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:V.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),V.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[V.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:[V.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"}),V.jsxs("div",{className:"rf-flex rf-items-center rf-gap-1",children:[V.jsx(dLi,{solverEvent:r}),V.jsx($c,{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:()=>Mdn(r),children:V.jsx(K$,{className:"rf-w-4 rf-h-4"})})]})]}),V.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:V.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)})})]})]}):V.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:V.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},pLi=new Map([["custom","Custom"],["fanout","Fanout"],["single_layer_fanout","Single layer fanout"],["tscircuit_simplify","Simplify"]]),mLi=new Set(["tscircuit","default","auto","auto_local"]);function _Li(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 fLi(t){const e=t.autorouterName?.trim(),n=e?.replace(/-/g,"_"),o=n&&pLi.get(n);if(o)return o;if(n&&!mLi.has(n))return e;const i=t.solverName?.trim();if(i)return _Li(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 Tje="#fbbf24";function ILi(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 Ddn(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 CLi(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 Ndn(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,...CLi(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 yLi(t){const e=[],n=[],o=t.endSimpleRouteJson;if(!o)return{lines:e,circles:n};const i=new Set(Ddn(t));for(const r of o.traces??[])if(i.has(r.pcb_trace_id))for(const s of Ndn(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:Tje,layer:c}),A.route_type==="via"&&n.push({center:{x:A.x,y:A.y},radius:A.outer_diameter/2,stroke:Tje,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 xLi(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 ELi=new Set(["pcb_trace","pcb_via","pcb_copper_pour","pcb_ground_plane","pcb_ground_plane_region","pcb_thermal_spoke","pcb_breakout_point"]);function BLi(t,e,n){const o=n==="input"?e.startSimpleRouteJson??e.errorSimpleRouteJson:e.endSimpleRouteJson,i=t.filter(c=>!ELi.has(c.type)&&!c.type.endsWith("_error")&&!c.type.endsWith("_warning"));if(!o)return i;const r=n==="input"?o.traces??[]:ILi(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=Ndn(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}_${xLi(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 kje=(t,e)=>t.phaseName||`Phase ${t.phaseOrdinal??e+1}`,Rdn=t=>t.componentDisplayName?.match(/name="([^"]+)"/)?.[1]?.replace(/^\./,"")||t.componentDisplayName||t.subcircuit_id||"Board",Tdn=t=>t.startSimpleRouteJson??t.endSimpleRouteJson??t.errorSimpleRouteJson,bLi={is_showing_autorouting:!0,is_showing_rats_nest:!1,is_showing_drc_errors:!1,is_showing_drc_warnings:!1,is_showing_pcb_groups:!1},SLi=({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&&Tdn(R)===Tdn(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:BLi(t??[],m,y),[t,m,x,y]),B=te.useMemo(()=>m&&y==="output"&&a?yLi(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 O=new ResizeObserver(F);return O.observe(R),()=>O.disconnect()},[!!m]),!m)return V.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:[V.jsx(bAn,{className:"rf-h-7 rf-w-7 rf-text-blue-500"}),V.jsx("h3",{className:"rf-text-base rf-font-medium",children:n?"Waiting for autorouting":"No autorouting captures"}),V.jsx("p",{className:"rf-max-w-md rf-text-sm rf-text-gray-500",children:n?"Phases appear as the circuit routes. Each capture includes its input and output on the PCB.":"Run a circuit with autorouting enabled to inspect its phases. A circuit JSON file alone does not include routing history."})]});const S=kje(m,p),Q=m.status==="running"&&n,P=!f,M=I?.connections.length,k=E?.filter(R=>R.type==="pcb_trace").length??0;return V.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:[V.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:[V.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:[V.jsx("span",{children:"Routing phases"}),V.jsx("span",{children:e.length})]}),V.jsx("div",{className:"rf-flex rf-gap-1 rf-overflow-x-auto rf-px-1.5 rf-pb-1.5 md:rf-flex-col md:rf-overflow-x-hidden md:rf-overflow-y-auto",children:e.map((R,F)=>{const O=Ddn(R).length,U=R.endSimpleRouteJson?`${O} ${O===1?"trace":"traces"} routed`:R.status==="error"?"Failed":R.status==="running"&&n?"Routing…":"No output";return V.jsxs("button",{type:"button","aria-pressed":F===p,title:`${Rdn(R)} · ${U}`,onClick:()=>i(R),className:zr("rf-flex rf-min-w-[192px] rf-items-start rf-gap-2 rf-rounded-md rf-border rf-px-2 rf-py-2 rf-text-left md:rf-min-w-0",F===p?"rf-border-blue-200 rf-bg-blue-50":"rf-border-transparent hover:rf-bg-gray-50"),children:[V.jsx("span",{className:zr("rf-flex rf-h-5 rf-w-5 rf-shrink-0 rf-items-center rf-justify-center rf-rounded-full rf-text-[11px]",F===p?"rf-bg-blue-600 rf-text-white":"rf-bg-gray-100 rf-text-gray-500"),children:F+1}),V.jsxs("span",{className:"rf-min-w-0 rf-flex-1",children:[V.jsxs("span",{className:"rf-flex rf-items-center rf-gap-1",children:[V.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:kje(R,F),children:kje(R,F)}),R.status==="complete"?V.jsx(U$,{"aria-label":"Captured",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-green-600"}):R.status==="error"?V.jsx(Xze,{"aria-label":"Failed",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-red-500"}):n?V.jsx(s4,{"aria-label":"Routing",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-animate-spin rf-text-blue-500"}):null]}),V.jsxs("span",{className:"rf-block rf-text-[11px] rf-leading-4 rf-text-gray-500",children:[fLi(R)," · ",U]})]})]},R.id)})})]}),V.jsxs("div",{className:"rf-flex rf-min-w-0 rf-flex-1 rf-flex-col",children:[V.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:[V.jsxs("h3",{className:"rf-mr-auto rf-flex rf-items-center rf-gap-2 rf-text-sm rf-font-medium",children:[S,V.jsxs("span",{className:"rf-text-xs rf-font-normal rf-text-gray-500",children:[p+1," of ",e.length]})]}),n&&V.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"}),V.jsx("div",{className:"rf-flex rf-rounded-md rf-bg-gray-100 rf-p-1","aria-label":"Phase snapshot",children:["input","output"].map(R=>V.jsx("button",{type:"button","aria-pressed":y===R,disabled:R==="input"?!C:!f,onClick:()=>s(R),className:zr("rf-rounded rf-px-3 rf-py-1 rf-text-xs disabled:rf-opacity-40",y===R?"rf-bg-white rf-text-gray-900 rf-shadow-sm":"rf-text-gray-500"),children:R==="input"?"Input":"Output"},R))})]}),V.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:[V.jsxs("label",{className:"rf-flex rf-items-center rf-gap-2",children:[V.jsx("input",{type:"checkbox",checked:a,disabled:y!=="output",onChange:R=>A(R.target.checked),className:"rf-accent-blue-600"}),V.jsx("span",{"aria-hidden":"true",className:"rf-inline-block rf-h-0.5 rf-w-3",style:{backgroundColor:Tje}}),"Highlight changes (all layers)"]}),V.jsxs("span",{children:[y==="input"?"Before this phase":"After this phase"," ","· ",k," traces"]})]}),P&&V.jsx("div",{className:zr("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."}),V.jsx("div",{ref:g,className:"rf-relative rf-min-h-[360px] rf-flex-1","data-testid":"autorouting-pcb",children:E?V.jsx(Sje,{circuitJson:E,height:u,allowEditing:!1,clickToInteractEnabled:!1,initialState:bLi,debugGraphics:B}):V.jsx("div",{className:"rf-p-6 rf-text-sm rf-text-gray-500",children:"No PCB snapshot available for this capture."})}),V.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:[V.jsxs("span",{children:[M===void 0?"Input unavailable":`${M} input connections`,` · ${Rdn(m)}`]}),V.jsxs("div",{className:"rf-flex rf-items-center rf-gap-4",children:[V.jsxs("button",{type:"button",disabled:!x,onClick:()=>xE(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:[V.jsx(K$,{className:"rf-h-3 rf-w-3"}),"Download SRJ"]}),V.jsxs("button",{type:"button","aria-expanded":c,onClick:()=>l(!c),className:"rf-flex rf-items-center rf-gap-1",children:[V.jsx(UY,{className:zr("rf-h-3 rf-w-3",c&&"rf-rotate-90")}),"Inspect SRJ"]})]})]}),c&&V.jsx("pre",{className:"rf-m-0 rf-max-h-64 rf-overflow-auto rf-border-t rf-border-gray-200 rf-bg-gray-50 rf-p-4 rf-text-xs","aria-label":`${S} ${y} SRJ`,children:x?JSON.stringify(x,null,2):"No snapshot captured."})]})]})},kdn=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{te.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{Yk.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{Yk.captureException(i,{error_type:o.type})}catch{}}},[n])},QLi=t=>{te.useEffect(()=>{try{L7n(t)}catch{}},[t.source,t.component,t.isWebEmbedded,t.activeTab])},Fdn="0.0.2824",vLi={version:Fdn},Fje={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Lje=new Map,w_e=t=>{const e=Lje.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,o])=>[n,o.getState()])):{}},PLi=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};const o=Lje.get(n.name);if(o)return{type:"tracked",store:t,...o};const i={connection:e.connect(n),stores:{}};return Lje.set(n.name,i),{type:"tracked",store:t,...i}},Ldn=(t,e={})=>(n,o,i)=>{const{enabled:r,anonymousActionType:s,store:a,...A}=e;let c;try{c=(r??(Fje?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(Fje?"production":void 0)!=="production"&&r&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,o,i);const{connection:l,...g}=PLi(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}`},{...w_e(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=(..._)=>{(Fje?"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 Hje(p.payload,_=>{if(_.type==="__setState"){if(a===void 0){h(_.state);return}Object.keys(_.state).length!==1&&console.error(`
|
|
5667
|
+
`,g=new Blob([l],{type:"text/plain"}),u=URL.createObjectURL(g),h=document.createElement("a");h.href=u,h.download=`${c}.test.ts`,h.click(),URL.revokeObjectURL(u)}catch(A){alert(`Error generating test.ts for ${t.getSolverName()}: ${A instanceof Error?A.message:String(A)}`)}o(!1)};return V.jsxs("div",{className:`relative ${e}`,ref:i,children:[V.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&&V.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:[V.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:r,children:"Download JSON"}),V.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:s,children:"Download page.tsx"}),V.jsx("button",{className:"w-full text-left px-3 py-2 hover:bg-gray-100 text-xs",onClick:a,children:"Download test.ts"})]})]})},Edn=t=>t.activeSubSolver?[t,...Edn(t.activeSubSolver)]:[t],VFi=({solver:t})=>{const e=Edn(t);return V.jsx("div",{className:"flex gap-1 items-center text-sm pt-1",children:e.map((n,o)=>V.jsxs("div",{className:"flex items-center",children:[o>0&&V.jsx("span",{className:"text-gray-400 mx-1",children:"→"}),V.jsx(KFi,{solver:n})]},n.getSolverName()))})},zFi=({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),S=n<1?Math.round(1/n):1;g.current=setInterval(()=>{if(t.solved||t.failed){g.current&&(clearInterval(g.current),g.current=void 0),l(),e(),A&&t.solved&&A(t);return}for(let Q=0;Q<S&&!(t.solved||t.failed);Q++)t.step();e()},B)},I=()=>{g.current&&(clearInterval(g.current),g.current=void 0)},C=()=>{!t.solved&&!t.failed&&(t.step(),e())},y=()=>{!t.solved&&!t.failed&&(a&&a(t),t.solve(),e(),A&&A(t))},x=()=>{c?(I(),l()):(l(),f())},E=()=>{if(t.solved||t.failed||c)return;u.current===null&&typeof window<"u"&&(u.current=window.localStorage.getItem(h));const B=window.prompt("Step until which iteration?",u.current??`${t.iterations}`);if(B===null)return;u.current=B,typeof window<"u"&&window.localStorage.setItem(h,B);const S=Number(B);if(!Number.isFinite(S)){window.alert("Please enter a valid number for the iteration");return}for(;t.iterations<S&&!t.solved&&!t.failed;)t.step();e(),t.solved&&A&&A(t)};return 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=S=>{m.current&&!m.current.contains(S.target)&&p(null)};return document.addEventListener("mousedown",B),()=>{document.removeEventListener("mousedown",B)}},[]),V.jsxs("div",{className:"space-y-2 p-2 border-b",children:[V.jsx("div",{className:"flex items-center",children:V.jsxs("div",{className:"flex items-center gap-2",ref:m,children:[V.jsxs("div",{className:"flex h-9 items-center space-x-1 rounded-md border border-slate-200 bg-white p-1 shadow-sm",children:[V.jsxs("div",{className:"relative",children:[V.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"&&V.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=>V.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&&V.jsx("span",{className:"ml-auto text-xs text-slate-500",children:"✓"})]},B))})]}),V.jsxs("div",{className:"relative",children:[V.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"&&V.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:V.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"})})]}),V.jsxs("div",{className:"relative",children:[V.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"&&V.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=>V.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,V.jsx("span",{className:"ml-auto text-xs text-slate-500",children:B.description}),n===B.value&&V.jsx("span",{className:"ml-2 text-xs text-slate-500",children:"✓"})]},B.value))})]})]}),V.jsx(VFi,{solver:t})]})}),V.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[V.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"}),V.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"}),V.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"}),V.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"}),V.jsxs("div",{className:"text-sm text-gray-600",children:["Iterations: ",t.iterations]}),t.timeToSolve!==void 0&&V.jsxs("div",{className:"text-sm text-gray-600",children:["Time: ",(t.timeToSolve/1e3).toFixed(3),"s"]}),t.solved&&V.jsx("div",{className:"px-2 py-1 bg-green-100 text-green-800 rounded text-sm",children:"Solved"}),t.failed&&V.jsx("div",{className:"px-2 py-1 bg-red-100 text-red-800 rounded text-sm",children:"Failed"})]}),t.error&&V.jsxs("div",{className:"text-red-600 text-sm",children:["Error: ",t.error]})]})},JFi=t=>t!==null&&"pipelineDef"in t&&Array.isArray(t.pipelineDef),WFi=(t,e,n)=>{const o=t.currentPipelineStageIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},jFi=(t,e)=>{const o=t.pipelineDef[e].solverName,i=WFi(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}},XFi=({status:t})=>{const e={"Not Started":"text-blue-600","In Progress":"text-yellow-600",Completed:"text-green-600",Failed:"text-red-600"};return V.jsx("span",{className:`font-medium ${e[t]}`,children:t})},qFi=({progress:t})=>{if(t===0)return null;const e=Math.round(t*100);return V.jsxs("div",{className:"flex items-center gap-2",children:[V.jsx("div",{className:"w-20 h-2 bg-gray-200 rounded overflow-hidden",children:V.jsx("div",{className:"h-full bg-blue-500 transition-all duration-200",style:{width:`${e}%`}})}),V.jsxs("span",{className:"text-xs text-gray-500",children:[e,"%"]})]})},Bdn=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)},$Fi=t=>Object.entries(t).map(([e,n])=>`${e}: ${Bdn(n)}`).join(", "),ZFi=({stats:t})=>{if(!t||Object.keys(t).length===0)return V.jsx("span",{children:"-"});const e=Object.entries(t),n=$Fi(t);return V.jsxs("details",{className:"cursor-pointer",children:[V.jsx("summary",{className:"whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px]",children:n}),V.jsx("div",{className:"mt-1 text-xs",children:e.map(([o,i])=>V.jsxs("div",{children:[o,": ",Bdn(i)]},o))})]})},Nje=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Nje);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=Nje(o));return e},eLi=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=Nje(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)}`)}},tLi=({expanded:t})=>V.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:V.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"})}),bdn=t=>{let e=t;for(;e.activeSubSolver;)e=e.activeSubSolver;return e},Sdn=({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,_)=>jFi(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):eLi(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=bdn(t);for(;!t.solved&&!t.failed&&(t.step(),bdn(t)===m););r?.()}},p=i*24;return V.jsxs("div",{className:o?"":"border-t border-gray-200",children:[!o&&V.jsxs("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200 flex items-center justify-between",children:[V.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Pipeline Stages"}),V.jsxs("div",{className:"flex gap-2",children:[V.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"}),V.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"})]})]}),V.jsx("div",{className:"overflow-x-auto",children:V.jsxs("table",{className:"w-full text-sm",children:[!o&&V.jsx("thead",{children:V.jsxs("tr",{className:"bg-gray-50 border-b border-gray-200",children:[V.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stage"}),V.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Status"}),V.jsxs("th",{className:"px-4 py-2 text-center font-semibold text-gray-700",children:["i",V.jsx("sub",{children:"0"})]}),V.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Iterations"}),V.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Progress"}),V.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Time"}),V.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Stats"}),V.jsx("th",{className:"px-4 py-2 text-left font-semibold text-gray-700",children:"Input"})]})}),V.jsx("tbody",{children:A.map(m=>{const _=JFi(m.solverInstance),f=s.has(m.name);return V.jsxs(ks.Fragment,{children:[V.jsxs("tr",{className:`border-b border-gray-100 ${m.status==="In Progress"?"bg-yellow-50":""}`,children:[V.jsx("td",{className:"px-4 py-2",children:V.jsxs("div",{className:"flex items-center gap-2",style:{paddingLeft:p},children:[_?V.jsx("button",{onClick:()=>c(m.name),className:"text-gray-500 hover:text-gray-700",title:f?"Collapse":"Expand",children:V.jsx(tLi,{expanded:f})}):V.jsx("span",{className:"w-4"}),V.jsx("span",{className:"text-gray-400 w-6",children:String(m.index+1).padStart(2,"0")}),V.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:V.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:V.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"})})}),V.jsx("span",{className:"font-medium text-gray-900",children:m.name})]})}),V.jsx("td",{className:"px-4 py-2",children:V.jsx(XFi,{status:m.status})}),V.jsx("td",{className:"px-4 py-2 text-center text-gray-600",children:m.firstIteration!==null?m.firstIteration:""}),V.jsx("td",{className:"px-4 py-2 text-gray-600",children:m.iterations}),V.jsx("td",{className:"px-4 py-2",children:V.jsx(qFi,{progress:m.progress})}),V.jsx("td",{className:"px-4 py-2 text-gray-600",children:u(m.timeSpent)}),V.jsx("td",{className:"px-4 py-2 text-gray-500",children:V.jsx(ZFi,{stats:m.stats})}),V.jsx("td",{className:"px-4 py-2",children:m.solverInstance?V.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:[V.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:V.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"})}),V.jsx("span",{children:"Input"})]}):null})]}),_&&f&&V.jsx("tr",{children:V.jsx("td",{colSpan:8,className:"p-0",children:V.jsx(Sdn,{solver:m.solverInstance,onStepUntilPhase:e,onDownloadInput:n,isNested:!0,indentLevel:i+1,triggerRender:r})})})]},m.name)})})]})})]})};function nLi({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 V.jsxs("svg",{className:"w-full h-[400px] bg-white",viewBox:`${u} ${h} ${d} ${p}`,role:"img","aria-label":"Graphics fallback",children:[o.map((m,_)=>V.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,_)=>V.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,_)=>V.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,_)=>V.jsx("circle",{cx:m.x??0,cy:m.y??0,r:m.radius??1.5,fill:m.color??"black"},`point-${_}`)),r.map((m,_)=>V.jsx("text",{x:m.x??0,y:m.y??0,fontSize:m.fontSize??10,fill:m.color??"black",children:m.text??""},`text-${_}`))]})}var oLi=class extends ks.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("InteractiveGraphics render error:",t)}render(){return this.state.hasError?this.props.fallback:this.props.children}},iLi=({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 V.jsxs("div",{children:[V.jsx(zFi,{solver:a,triggerRender:s,animationSpeed:l,renderer:A,onRendererChange:_,onAnimationSpeedChange:g,onDownloadVisualization:m,onSolverStarted:o,onSolverCompleted:i}),h?V.jsx("div",{className:"p-4 text-gray-500",children:"No Graphics Yet"}):V.jsx(oLi,{fallback:V.jsx(nLi,{graphics:u}),children:A==="canvas"?V.jsx(UFi,{graphics:u}):V.jsx(OFi,{graphics:u})}),d&&V.jsx(Sdn,{solver:a,onStepUntilPhase:p,triggerRender:s})]})};const rLi=()=>{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)},[])},sLi=1e3,xE=(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)},sLi)},Rje=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"},aLi=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]},z6="https://github.com/tscircuit/tscircuit-autorouter/issues/new",Qdn="https://github.com/tscircuit/copper-pour-solver/issues/new",vdn="https://github.com/tscircuit/calculate-packing/issues/new",ALi="https://github.com/tscircuit/matchpack/issues/new",Pdn="https://github.com/tscircuit/schematic-trace-solver/issues/new?template=json-bug-report.yml",cLi={PackSolver2:vdn,LayoutPipelineSolver:ALi,AutoroutingPipelineSolver:z6,AssignableAutoroutingPipeline2:z6,AssignableAutoroutingPipeline3:z6,AutoroutingPipeline1_OriginalUnravel:z6,AutoroutingPipelineSolver3_HgPortPointPathing:z6,AutoroutingPipelineSolver4:z6,AutoroutingPipelineSolver5:z6,AutoroutingPipelineSolver7_MultiGraph:z6,AutoroutingPipelineSolver8:z6,CopperPourPipelineSolver:Qdn,SchematicTracePipelineSolver:Pdn},lLi=t=>t.toLowerCase().includes("pack")?c7i:t.toLowerCase().includes("rout")?bAn:t7i,wdn=t=>{const e=cLi[t];if(e)return e;const n=t.toLowerCase();return n.includes("autorout")?z6:n.includes("schematic")&&n.includes("trace")?Pdn:n.includes("copperpour")?Qdn:n.includes("pack")?vdn:null},gLi=t=>`${Rje(`${t.componentName}-${t.solverName}`)}-solver-input.json`,Mdn=t=>{xE(JSON.stringify(t.solverParams,null,2),{fileName:gLi(t),mimeType:"application/json"})},uLi=({solverEvent:t})=>{const e=wdn(t.solverName);return V.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:[V.jsxs($c,{type:"button",variant:"outline",size:"sm",onClick:()=>Mdn(t),children:[V.jsx(K$,{className:"rf-w-4 rf-h-4"}),"Download"]}),e?V.jsx($c,{asChild:!0,variant:"outline",size:"sm",children:V.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[V.jsx(Hpe,{className:"rf-w-4 rf-h-4"}),"Report"]})}):V.jsxs($c,{type:"button",variant:"outline",size:"sm",disabled:!0,title:"No report link configured for this solver",children:[V.jsx(Hpe,{className:"rf-w-4 rf-h-4"}),"Report"]})]})},dLi=({solverEvent:t})=>{const e=wdn(t.solverName);return e?V.jsx($c,{asChild:!0,variant:"ghost",size:"icon",className:"rf-h-8 rf-w-8",children:V.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:"Report solver bug","aria-label":"Report solver bug",children:V.jsx(Hpe,{className:"rf-w-4 rf-h-4"})})}):V.jsx($c,{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:V.jsx(Hpe,{className:"rf-w-4 rf-h-4"})})},hLi=({solverEvents:t=[]})=>{const[e,n]=te.useState(null);rLi();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=bRe[r.solverName];if(!a)return{instance:null,error:`Solver class "${r.solverName}" not found in SOLVERS registry. Available: ${Object.keys(bRe).join(", ")}`,classFound:!1};try{return{instance:new a(...aLi(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?V.jsx("div",{className:"rf-p-4",children:V.jsx("div",{className:"rf-bg-gray-50 rf-rounded-md rf-border rf-border-gray-200",children:V.jsxs("div",{className:"rf-p-4",children:[V.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800 rf-mb-3",children:"No Solvers Detected"}),V.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."})]})})}):V.jsxs("div",{className:"rf-flex rf-h-full rf-overflow-hidden",children:[V.jsxs("div",{className:"rf-w-64 rf-border-r rf-border-gray-200 rf-overflow-y-auto rf-flex-shrink-0",children:[V.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 V.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=lLi(A.solverName);return V.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[V.jsx(l,{className:"rf-w-4 rf-h-4 rf-text-blue-500 rf-flex-shrink-0"}),V.jsxs("div",{className:"rf-flex-1 rf-min-w-0",children:[V.jsx("div",{className:"rf-text-sm rf-font-medium rf-text-gray-800 rf-truncate",children:A.componentName}),V.jsx("div",{className:"rf-text-xs rf-text-gray-500 rf-truncate",children:A.solverName})]})]})})()},a)})]}),V.jsx("div",{className:"rf-flex-1 rf-overflow-hidden",children:r?s.instance?V.jsxs("div",{className:"rf-flex rf-h-full rf-flex-col rf-overflow-y-auto",children:[V.jsx(uLi,{solverEvent:r}),V.jsx("div",{className:"rf-min-h-0 rf-flex-1",children:V.jsx(UB,{fallback:V.jsx("div",{className:"rf-p-4",children:V.jsxs("div",{className:"rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-p-4",children:[V.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-2",children:"Error Loading Solver Debugger"}),V.jsxs("p",{className:"rf-text-sm rf-text-red-600",children:["Failed to render the solver debugger for"," ",r.solverName]})]})}),children:V.jsx(iLi,{solver:s.instance})})})]}):V.jsxs("div",{className:"rf-p-4",children:[V.jsxs("div",{className:"rf-mb-4",children:[V.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-gray-800",children:r.solverName}),V.jsxs("p",{className:"rf-text-sm rf-text-gray-500",children:["Component: ",r.componentName]})]}),s.error&&V.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:V.jsx("p",{className:`rf-text-sm ${s.classFound?"rf-text-red-700":"rf-text-yellow-700"}`,children:s.error})}),V.jsxs("div",{className:"rf-border rf-border-gray-200 rf-rounded-md rf-overflow-hidden",children:[V.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:[V.jsx("span",{className:"rf-text-sm rf-font-medium rf-text-gray-700",children:"Solver Parameters"}),V.jsxs("div",{className:"rf-flex rf-items-center rf-gap-1",children:[V.jsx(dLi,{solverEvent:r}),V.jsx($c,{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:()=>Mdn(r),children:V.jsx(K$,{className:"rf-w-4 rf-h-4"})})]})]}),V.jsx("div",{className:"rf-p-3 rf-bg-white rf-border-t rf-border-gray-200",children:V.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)})})]})]}):V.jsx("div",{className:"rf-flex rf-items-center rf-justify-center rf-h-full",children:V.jsx("p",{className:"rf-text-sm rf-text-gray-500",children:"Select a solver from the list to view details"})})})]})},pLi=new Map([["custom","Custom"],["fanout","Fanout"],["single_layer_fanout","Single layer fanout"],["tscircuit_simplify","Simplify"]]),mLi=new Set(["tscircuit","default","auto","auto_local"]);function _Li(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 fLi(t){const e=t.autorouterName?.trim(),n=e?.replace(/-/g,"_"),o=n&&pLi.get(n);if(o)return o;if(n&&!mLi.has(n))return e;const i=t.solverName?.trim();if(i)return _Li(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 Tje="#fbbf24";function ILi(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 Ddn(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 CLi(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 Ndn(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,...CLi(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 yLi(t){const e=[],n=[],o=t.endSimpleRouteJson;if(!o)return{lines:e,circles:n};const i=new Set(Ddn(t));for(const r of o.traces??[])if(i.has(r.pcb_trace_id))for(const s of Ndn(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:Tje,layer:c}),A.route_type==="via"&&n.push({center:{x:A.x,y:A.y},radius:A.outer_diameter/2,stroke:Tje,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 xLi(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 ELi=new Set(["pcb_trace","pcb_via","pcb_copper_pour","pcb_ground_plane","pcb_ground_plane_region","pcb_thermal_spoke","pcb_breakout_point"]);function BLi(t,e,n){const o=n==="input"?e.startSimpleRouteJson??e.errorSimpleRouteJson:e.endSimpleRouteJson,i=t.filter(c=>!ELi.has(c.type)&&!c.type.endsWith("_error")&&!c.type.endsWith("_warning"));if(!o)return i;const r=n==="input"?o.traces??[]:ILi(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=Ndn(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}_${xLi(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 kje=(t,e)=>t.phaseName||`Phase ${t.phaseOrdinal??e+1}`,Rdn=t=>t.componentDisplayName?.match(/name="([^"]+)"/)?.[1]?.replace(/^\./,"")||t.componentDisplayName||t.subcircuit_id||"Board",Tdn=t=>t.startSimpleRouteJson??t.endSimpleRouteJson??t.errorSimpleRouteJson,bLi={is_showing_autorouting:!0,is_showing_rats_nest:!1,is_showing_drc_errors:!1,is_showing_drc_warnings:!1,is_showing_pcb_groups:!1},SLi=({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&&Tdn(R)===Tdn(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:BLi(t??[],m,y),[t,m,x,y]),B=te.useMemo(()=>m&&y==="output"&&a?yLi(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 O=new ResizeObserver(F);return O.observe(R),()=>O.disconnect()},[!!m]),!m)return V.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:[V.jsx(bAn,{className:"rf-h-7 rf-w-7 rf-text-blue-500"}),V.jsx("h3",{className:"rf-text-base rf-font-medium",children:n?"Waiting for autorouting":"No autorouting captures"}),V.jsx("p",{className:"rf-max-w-md rf-text-sm rf-text-gray-500",children:n?"Phases appear as the circuit routes. Each capture includes its input and output on the PCB.":"Run a circuit with autorouting enabled to inspect its phases. A circuit JSON file alone does not include routing history."})]});const S=kje(m,p),Q=m.status==="running"&&n,P=!f,M=I?.connections.length,k=E?.filter(R=>R.type==="pcb_trace").length??0;return V.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:[V.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:[V.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:[V.jsx("span",{children:"Routing phases"}),V.jsx("span",{children:e.length})]}),V.jsx("div",{className:"rf-flex rf-gap-1 rf-overflow-x-auto rf-px-1.5 rf-pb-1.5 md:rf-flex-col md:rf-overflow-x-hidden md:rf-overflow-y-auto",children:e.map((R,F)=>{const O=Ddn(R).length,U=R.endSimpleRouteJson?`${O} ${O===1?"trace":"traces"} routed`:R.status==="error"?"Failed":R.status==="running"&&n?"Routing…":"No output";return V.jsxs("button",{type:"button","aria-pressed":F===p,title:`${Rdn(R)} · ${U}`,onClick:()=>i(R),className:zr("rf-flex rf-min-w-[192px] rf-items-start rf-gap-2 rf-rounded-md rf-border rf-px-2 rf-py-2 rf-text-left md:rf-min-w-0",F===p?"rf-border-blue-200 rf-bg-blue-50":"rf-border-transparent hover:rf-bg-gray-50"),children:[V.jsx("span",{className:zr("rf-flex rf-h-5 rf-w-5 rf-shrink-0 rf-items-center rf-justify-center rf-rounded-full rf-text-[11px]",F===p?"rf-bg-blue-600 rf-text-white":"rf-bg-gray-100 rf-text-gray-500"),children:F+1}),V.jsxs("span",{className:"rf-min-w-0 rf-flex-1",children:[V.jsxs("span",{className:"rf-flex rf-items-center rf-gap-1",children:[V.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:kje(R,F),children:kje(R,F)}),R.status==="complete"?V.jsx(U$,{"aria-label":"Captured",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-green-600"}):R.status==="error"?V.jsx(Xze,{"aria-label":"Failed",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-red-500"}):n?V.jsx(s4,{"aria-label":"Routing",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-animate-spin rf-text-blue-500"}):null]}),V.jsxs("span",{className:"rf-block rf-text-[11px] rf-leading-4 rf-text-gray-500",children:[fLi(R)," · ",U]})]})]},R.id)})})]}),V.jsxs("div",{className:"rf-flex rf-min-w-0 rf-flex-1 rf-flex-col",children:[V.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:[V.jsxs("h3",{className:"rf-mr-auto rf-flex rf-items-center rf-gap-2 rf-text-sm rf-font-medium",children:[S,V.jsxs("span",{className:"rf-text-xs rf-font-normal rf-text-gray-500",children:[p+1," of ",e.length]})]}),n&&V.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"}),V.jsx("div",{className:"rf-flex rf-rounded-md rf-bg-gray-100 rf-p-1","aria-label":"Phase snapshot",children:["input","output"].map(R=>V.jsx("button",{type:"button","aria-pressed":y===R,disabled:R==="input"?!C:!f,onClick:()=>s(R),className:zr("rf-rounded rf-px-3 rf-py-1 rf-text-xs disabled:rf-opacity-40",y===R?"rf-bg-white rf-text-gray-900 rf-shadow-sm":"rf-text-gray-500"),children:R==="input"?"Input":"Output"},R))})]}),V.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:[V.jsxs("label",{className:"rf-flex rf-items-center rf-gap-2",children:[V.jsx("input",{type:"checkbox",checked:a,disabled:y!=="output",onChange:R=>A(R.target.checked),className:"rf-accent-blue-600"}),V.jsx("span",{"aria-hidden":"true",className:"rf-inline-block rf-h-0.5 rf-w-3",style:{backgroundColor:Tje}}),"Highlight changes (all layers)"]}),V.jsxs("span",{children:[y==="input"?"Before this phase":"After this phase"," ","· ",k," traces"]})]}),P&&V.jsx("div",{className:zr("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."}),V.jsx("div",{ref:g,className:"rf-relative rf-min-h-[360px] rf-flex-1","data-testid":"autorouting-pcb",children:E?V.jsx(Sje,{circuitJson:E,height:u,allowEditing:!1,clickToInteractEnabled:!1,initialState:bLi,debugGraphics:B}):V.jsx("div",{className:"rf-p-6 rf-text-sm rf-text-gray-500",children:"No PCB snapshot available for this capture."})}),V.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:[V.jsxs("span",{children:[M===void 0?"Input unavailable":`${M} input connections`,` · ${Rdn(m)}`]}),V.jsxs("div",{className:"rf-flex rf-items-center rf-gap-4",children:[V.jsxs("button",{type:"button",disabled:!x,onClick:()=>xE(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:[V.jsx(K$,{className:"rf-h-3 rf-w-3"}),"Download SRJ"]}),V.jsxs("button",{type:"button","aria-expanded":c,onClick:()=>l(!c),className:"rf-flex rf-items-center rf-gap-1",children:[V.jsx(UY,{className:zr("rf-h-3 rf-w-3",c&&"rf-rotate-90")}),"Inspect SRJ"]})]})]}),c&&V.jsx("pre",{className:"rf-m-0 rf-max-h-64 rf-overflow-auto rf-border-t rf-border-gray-200 rf-bg-gray-50 rf-p-4 rf-text-xs","aria-label":`${S} ${y} SRJ`,children:x?JSON.stringify(x,null,2):"No snapshot captured."})]})]})},kdn=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{te.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{Yk.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{Yk.captureException(i,{error_type:o.type})}catch{}}},[n])},QLi=t=>{te.useEffect(()=>{try{L7n(t)}catch{}},[t.source,t.component,t.isWebEmbedded,t.activeTab])},Fdn="0.0.2826",vLi={version:Fdn},Fje={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Lje=new Map,w_e=t=>{const e=Lje.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,o])=>[n,o.getState()])):{}},PLi=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};const o=Lje.get(n.name);if(o)return{type:"tracked",store:t,...o};const i={connection:e.connect(n),stores:{}};return Lje.set(n.name,i),{type:"tracked",store:t,...i}},Ldn=(t,e={})=>(n,o,i)=>{const{enabled:r,anonymousActionType:s,store:a,...A}=e;let c;try{c=(r??(Fje?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(Fje?"production":void 0)!=="production"&&r&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,o,i);const{connection:l,...g}=PLi(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}`},{...w_e(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=(..._)=>{(Fje?"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 Hje(p.payload,_=>{if(_.type==="__setState"){if(a===void 0){h(_.state);return}Object.keys(_.state).length!==1&&console.error(`
|
|
5668
5668
|
[zustand devtools middleware] Unsupported __setState action format.
|
|
5669
5669
|
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
5670
5670
|
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
|