@tscircuit/runframe 0.0.2862 → 0.0.2864
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[X0]=v.current,ZE(b),new F1(v)},FK.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=f4,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=Yd(L),j=ct(j),ae=tp(j),ae.callback=null,y0(L,ae,j),L=j,v.current.lanes=L,He(v,L),Cu(v),b[X0]=v.current,ZE(b),new w_(v)},FK.version="19.1.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})(),FK}var Sot;function gEn(){if(Sot)return Ete.exports;Sot=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(),Ete.exports=cEn()):Ete.exports=lEn(),Ete.exports}var uEn=gEn(),te=v3();const ks=uy(te),h5=tx({__proto__:null,default:ks},[te]);var dEn=Object.defineProperty,fk=(t,e)=>dEn(t,"name",{value:e,configurable:!0}),Qot=!!(typeof window<"u"&&window.document&&window.document.createElement);function _r(t,e,{checkForDefaultPrevented:n=!0}={}){return fk(function(i){if(t?.(i),n===!1||!i||!i.defaultPrevented)return e?.(i)},"handleEvent")}fk(_r,"composeEventHandlers");function hEn(t){if(!Qot)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}fk(hEn,"getOwnerWindow");function rye(t){if(!Qot)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}fk(rye,"getOwnerDocument");function vot(t,e=!1){const{activeElement:n}=rye(t);if(!n?.nodeName)return null;if(wot(n)&&n.contentDocument)return vot(n.contentDocument.body,e);if(e){const o=n.getAttribute("aria-activedescendant");if(o){const i=rye(n).getElementById(o);if(i)return i}}return n}fk(vot,"getActiveElement");function wot(t){return t.tagName==="IFRAME"}fk(wot,"isFrame");var pEn=Object.defineProperty,p5=(t,e)=>pEn(t,"name",{value:e,configurable:!0});function mEn(t,e){const n=te.createContext(e);n.displayName=t+"Context";const o=p5(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 p5(i,"useContext"),[o,i]}p5(mEn,"createContext");function w3(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=p5(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 p5(l,"useContext"),[c,l]}p5(o,"createContext");const i=p5(()=>{const r=n.map(s=>te.createContext(s));return p5(function(a){const A=a?.[t]||r;return te.useMemo(()=>({[`__scope${t}`]:{...a,[t]:A}}),[a,A])},"useScope")},"createScope");return i.scopeName=t,[o,Pot(i,...e)]}p5(w3,"createContextScope");function Pot(...t){const e=t[0];if(t.length===1)return e;const n=p5(()=>{const o=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return p5(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}p5(Pot,"composeContextScopes");var _En=Object.defineProperty,sye=(t,e)=>_En(t,"name",{value:e,configurable:!0});function aye(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}sye(aye,"setRef");function Mot(...t){return e=>{let n=!1;const o=t.map(i=>{const r=aye(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():aye(t[i],null)}}}}sye(Mot,"composeRefs");function lc(...t){return te.useCallback(Mot(...t),t)}sye(lc,"useComposedRefs");var fEn=Object.defineProperty,D4=(t,e)=>fEn(t,"name",{value:e,configurable:!0});function I9(t){const e=te.forwardRef((n,o)=>{let{children:i,...r}=n,s=null,a=!1;const A=[];Aye(i)&&typeof Qte=="function"&&(i=Qte(i._payload)),te.Children.forEach(i,u=>{if(kot(u)){a=!0;const h=u;let d="child"in h.props?h.props.child:h.props.children;Aye(d)&&typeof Qte=="function"&&(d=Qte(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?Tot(s):void 0,l=lc(o,c);if(!s){if(i||i===0)throw new Error(a?EEn(t):xEn(t));return i}const g=Rot(r,s.props??{});return s.type!==te.Fragment&&(g.ref=o?l:c),te.cloneElement(s,g)});return e.displayName=`${t}.Slot`,e}D4(I9,"createSlot");var IEn=I9("Slot"),Dot=Symbol.for("radix.slottable");function Not(t){const e=D4(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=Dot,e}D4(Not,"createSlottable");var CEn=D4((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 Rot(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}}D4(Rot,"mergeProps");function Tot(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)}D4(Tot,"getElementRef");function kot(t){return te.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Dot}D4(kot,"isSlottable");var yEn=Symbol.for("react.lazy");function Aye(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===yEn&&"_payload"in t&&Fot(t._payload)}D4(Aye,"isLazyComponent");function Fot(t){return typeof t=="object"&&t!==null&&"then"in t}D4(Fot,"isPromiseLike");var xEn=D4(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),EEn=D4(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Qte=h5[" use ".trim().toString()],BEn=Object.defineProperty,Uf=(t,e)=>BEn(t,"name",{value:e,configurable:!0});function vte(t){const e=t+"CollectionProvider",[n,o]=w3(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=I9(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=I9(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(vte,"createCollection");var Lot=new WeakMap,cye=(ME=class extends Map{constructor(n){super(n);znt(this,u_);ste(this,u_,[...super.keys()]),Lot.set(this,!0)}set(n,o){return Lot.get(this)&&(this.has(n)?w0(this,u_)[w0(this,u_).indexOf(n)]=n:w0(this,u_).push(n)),super.set(n,o),this}insert(n,o,i){const r=this.has(o),s=w0(this,u_).length,a=lye(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=[...w0(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 ME(this);return r.insert(n,o,i),r}before(n){const o=w0(this,u_).indexOf(n)-1;if(!(o<0))return this.entryAt(o)}setBefore(n,o,i){const r=w0(this,u_).indexOf(n);return r===-1?this:this.insert(r,o,i)}after(n){let o=w0(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=w0(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 ste(this,u_,[]),super.clear()}delete(n){const o=super.delete(n);return o&&w0(this,u_).splice(w0(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=wte(w0(this,u_),n);if(o!==void 0)return this.get(o)}entryAt(n){const o=wte(w0(this,u_),n);if(o!==void 0)return[o,this.get(o)]}indexOf(n){return w0(this,u_).indexOf(n)}keyAt(n){return wte(w0(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 ME(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 ME(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 ME(o)}toReversed(){const n=new ME;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 ME(o)}slice(n,o){const i=new ME;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(ME,"OrderedDict"),ME);function wte(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=Hot(t,e);return n===-1?void 0:t[n]}Uf(wte,"at");function Hot(t,e){const n=t.length,o=lye(e),i=o>=0?o:n+o;return i<0||i>=n?-1:i}Uf(Hot,"toSafeIndex");function lye(t){return t!==t||t===0?0:Math.trunc(t)}Uf(lye,"toSafeInteger");function bEn(t){const e=t+"CollectionProvider",[n,o]=w3(e),[i,r]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new cye,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),[w,M]=x;return te.useEffect(()=>{if(!B)return;const k=Yot(()=>{});return k.observe(B,{childList:!0,subtree:!0}),()=>{k.disconnect()}},[B]),V.jsx(i,{scope:C,itemMap:w,setItemMap:M,collectionRef:Q,collectionRefObject:E,collectionElement:B,children:y})},"CollectionProviderImpl");A.displayName=e+"Impl";const c=t+"CollectionSlot",l=I9(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=I9(u),p=te.forwardRef((I,C)=>{const{scope:y,children:x,...E}=I,B=te.useRef(null),[S,Q]=te.useState(null),w=lc(C,B,Q),M=r(u,y),{setItemMap:k}=M,R=te.useRef(E);Oot(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(gye):(U.set(S,{...O,element:S}),U.toSorted(gye)):U),()=>{k(U=>!S||!U.has(S)?U:(U.delete(S),new cye(U)))}},[S,F,k]),V.jsx(d,{[h]:"",ref:w,children:x})});p.displayName=u;function m(){return te.useState(new cye)}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(bEn,"createCollection");function Oot(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(Oot,"shallowEqual");function Got(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}Uf(Got,"isElementPreceding");function gye(t,e){return!t[1].element||!e[1].element?0:Got(t[1].element,e[1].element)?-1:1}Uf(gye,"sortByDocumentPosition");function Yot(t){return new MutationObserver(n=>{for(const o of n)if(o.type==="childList"){t();return}})}Uf(Yot,"getChildListObserver");var _p=globalThis?.document?te.useLayoutEffect:()=>{},SEn=Object.defineProperty,QEn=(t,e)=>SEn(t,"name",{value:e,configurable:!0}),vEn=h5[" useId ".trim().toString()]||(()=>{}),wEn=0;function P3(t){const[e,n]=te.useState(vEn());return _p(()=>{t||n(o=>o??String(wEn++))},[t]),t||(e?`radix-${e}`:"")}QEn(P3,"useId");var C9=iye();const Uot=uy(C9);var PEn=Object.defineProperty,MEn=(t,e)=>PEn(t,"name",{value:e,configurable:!0}),DEn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],gc=DEn.reduce((t,e)=>{const n=I9(`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 uye(t,e){t&&C9.flushSync(()=>t.dispatchEvent(e))}MEn(uye,"dispatchDiscreteCustomEvent");var NEn=Object.defineProperty,REn=(t,e)=>NEn(t,"name",{value:e,configurable:!0});function M3(t){const e=te.useRef(t);return te.useEffect(()=>{e.current=t}),te.useMemo(()=>((...n)=>e.current?.(...n)),[])}REn(M3,"useCallbackRef");var TEn=Object.defineProperty,kEn=(t,e)=>TEn(t,"name",{value:e,configurable:!0}),Kot=h5[" useEffectEvent ".trim().toString()],Vot=h5[" useInsertionEffect ".trim().toString()];function zot(t){if(typeof Kot=="function")return Kot(t);const e=te.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Vot=="function"?Vot(()=>{e.current=t}):_p(()=>{e.current=t}),te.useMemo(()=>((...n)=>e.current?.(...n)),[])}kEn(zot,"useEffectEvent");var FEn=Object.defineProperty,LK=(t,e)=>FEn(t,"name",{value:e,configurable:!0}),LEn=h5[" useInsertionEffect ".trim().toString()]||_p;function y9({prop:t,defaultProp:e,onChange:n=LK(()=>{},"onChange"),caller:o}){const[i,r,s]=Jot({defaultProp:e,onChange:n}),a=t!==void 0,A=a?t:i,c=te.useCallback(l=>{if(a){const g=Wot(l)?l(t):l;g!==t&&s.current?.(g)}else r(l)},[a,t,r,s]);return[A,c]}LK(y9,"useControllableState");function Jot({defaultProp:t,onChange:e}){const[n,o]=te.useState(t),i=te.useRef(n),r=te.useRef(e);return LEn(()=>{r.current=e},[e]),te.useEffect(()=>{i.current!==n&&(r.current?.(n),i.current=n)},[n,i]),[n,o,r]}LK(Jot,"useUncontrolledState");function Wot(t){return typeof t=="function"}LK(Wot,"isFunction");var jot=Symbol("RADIX:SYNC_STATE");function HEn(t,e,n,o){const{prop:i,defaultProp:r,onChange:s,caller:a}=e,A=i!==void 0,c=zot(s),l=[{...n,state:r}];o&&l.push(o);const[g,u]=te.useReducer((m,_)=>{if(_.type===jot)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:jot,state:i})},[i,g.state,A]),[p,u]}LK(HEn,"useControllableStateReducer");var OEn=Object.defineProperty,GEn=(t,e)=>OEn(t,"name",{value:e,configurable:!0}),YEn=te.createContext(void 0);function HK(t){const e=te.useContext(YEn);return t||e||"ltr"}GEn(HK,"useDirection");var UEn=Object.defineProperty,dye=(t,e)=>UEn(t,"name",{value:e,configurable:!0}),hye=!1;function qot(){const[t,e]=te.useState(hye);return te.useEffect(()=>{hye||(hye=!0,e(!0))},[]),t}dye(qot,"useIsHydrated");var Xot=h5[" useSyncExternalStore ".trim().toString()];function $ot(){return()=>{}}dye($ot,"subscribe");function Zot(){return Xot($ot,()=>!0,()=>!1)}dye(Zot,"useIsHydratedModern");var KEn=typeof Xot=="function"?Zot:qot,VEn=Object.defineProperty,wM=(t,e)=>VEn(t,"name",{value:e,configurable:!0}),pye="rovingFocusGroup.onEntryFocus",zEn={bubbles:!1,cancelable:!0},Pte="RovingFocusGroup",[mye,eit,JEn]=vte(Pte),[WEn,Mte]=w3(Pte,[JEn]),[jEn,qEn]=WEn(Pte),XEn=te.forwardRef(wM(function(e,n){return V.jsx(mye.Provider,{scope:e.__scopeRovingFocusGroup,children:V.jsx(mye.Slot,{scope:e.__scopeRovingFocusGroup,children:V.jsx($En,{...e,ref:n})})})},"RovingFocusGroup")),$En=te.forwardRef(wM(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=HK(s),[m,_]=y9({prop:a,defaultProp:A??null,onChange:c,caller:Pte}),[f,I]=te.useState(!1),C=M3(l),y=eit(o),x=te.useRef(!1),[E,B]=te.useState(0);return te.useEffect(()=>{const S=h.current;if(S)return S.addEventListener(pye,C),()=>S.removeEventListener(pye,C)},[C]),V.jsx(jEn,{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 w=new CustomEvent(pye,zEn);if(S.currentTarget.dispatchEvent(w),!w.defaultPrevented){const M=y().filter(U=>U.focusable),k=M.find(U=>U.active),R=M.find(U=>U.id===m),O=[k,R,...M].filter(Boolean).map(U=>U.ref.current);_ye(O,g)}}x.current=!1}),onBlur:_r(e.onBlur,()=>I(!1))})})},"RovingFocusGroupImpl")),ZEn="RovingFocusGroupItem",e5n=te.forwardRef(wM(function(e,n){const{__scopeRovingFocusGroup:o,focusable:i=!0,active:r=!1,tabStopId:s,children:a,...A}=e,c=P3(),l=s||c,g=qEn(ZEn,o),u=g.currentTabStopId===l,h=eit(o),{onFocusableItemAdd:d,onFocusableItemRemove:p,currentTabStopId:m}=g,_=KEn();return _p(()=>{if(!(!_||!i))return d(),()=>p()},[_,i,d,p]),te.useEffect(()=>{if(!(_||!i))return d(),()=>p()},[_,i,d,p]),V.jsx(mye.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=nit(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?oit(y,x+1):y.slice(x+1)}setTimeout(()=>_ye(y))}}),children:typeof a=="function"?a({isCurrentTabStop:u,hasTabStop:m!=null}):a})})},"RovingFocusGroupItem")),t5n={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function tit(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}wM(tit,"getDirectionAwareKey");function nit(t,e,n){const o=tit(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return t5n[o]}wM(nit,"getFocusIntent");function _ye(t,e=!1){const n=document.activeElement;for(const o of t)if(o===n||(o.focus({preventScroll:e}),document.activeElement!==n))return}wM(_ye,"focusFirst");function oit(t,e){return t.map((n,o)=>t[(e+o)%t.length])}wM(oit,"wrapArray");var iit=XEn,rit=e5n,n5n=Object.defineProperty,m8=(t,e)=>n5n(t,"name",{value:e,configurable:!0});function sit(t,e){return te.useReducer((n,o)=>e[n][o]??n,t)}m8(sit,"useStateMachine");var N4=m8(t=>{const{present:e,children:n}=t,o=ait(e),i=typeof n=="function"?n({present:o.isPresent}):te.Children.only(n),r=Ait(o.ref,cit(i));return typeof n=="function"||o.isPresent?te.cloneElement(i,{ref:r}):null},"Presence");function ait(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]=sit(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??Ik(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=Ik(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=m8(d=>{const m=Ik(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=m8(d=>{d.target===e&&(r.current=Ik(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=Ik(g)}else o.current=null;n(l)},[])}}m8(ait,"usePresence");function fye(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}m8(fye,"setRef");function Ait(...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=fye(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():fye(o[s],null)}}},[])}m8(Ait,"useStableComposedRefs");function Ik(t){return t?.animationName||"none"}m8(Ik,"getAnimationName");function cit(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)}m8(cit,"getElementRef");var o5n=Object.defineProperty,Ck=(t,e)=>o5n(t,"name",{value:e,configurable:!0}),Iye="Tabs",[i5n,WAr]=w3(Iye,[Mte]),lit=Mte(),[r5n,Cye]=i5n(Iye),s5n=te.forwardRef(Ck(function(e,n){const{__scopeTabs:o,value:i,onValueChange:r,defaultValue:s,orientation:a="horizontal",dir:A,activationMode:c="automatic",...l}=e,g=HK(A),[u,h]=y9({prop:i,onChange:r,defaultProp:s??"",caller:Iye});return V.jsx(r5n,{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")),a5n="TabsList",A5n=te.forwardRef(Ck(function(e,n){const{__scopeTabs:o,loop:i=!0,...r}=e,s=Cye(a5n,o),a=lit(o);return V.jsx(iit,{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")),c5n="TabsTrigger",l5n=te.forwardRef(Ck(function(e,n){const{__scopeTabs:o,value:i,disabled:r=!1,...s}=e,a=Cye(c5n,o),A=lit(o),c=yye(a.baseId,i),l=xye(a.baseId,i),g=i===a.value;return V.jsx(rit,{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")),g5n="TabsContent",u5n=te.forwardRef(Ck(function(e,n){const{__scopeTabs:o,value:i,forceMount:r,children:s,...a}=e,A=Cye(g5n,o),c=yye(A.baseId,i),l=xye(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(N4,{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 yye(t,e){return`${t}-trigger-${e}`}Ck(yye,"makeTriggerId");function xye(t,e){return`${t}-content-${e}`}Ck(xye,"makeContentId");var d5n=s5n,git=A5n,uit=l5n,dit=u5n;function hit(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=hit(t[e]))&&(o&&(o+=" "),o+=n)}else for(n in t)t[n]&&(o&&(o+=" "),o+=n);return o}function R4(){for(var t,e,n=0,o="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=hit(t))&&(o&&(o+=" "),o+=e);return o}const Eye="-",h5n=t=>{const e=m5n(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=t;return{getClassGroupId:s=>{const a=s.split(Eye);return a[0]===""&&a.length!==1&&a.shift(),pit(a,e)||p5n(s)},getConflictingClassGroupIds:(s,a)=>{const A=n[s]||[];return a&&o[s]?[...A,...o[s]]:A}}},pit=(t,e)=>{if(t.length===0)return e.classGroupId;const n=t[0],o=e.nextPart.get(n),i=o?pit(t.slice(1),o):void 0;if(i)return i;if(e.validators.length===0)return;const r=t.join(Eye);return e.validators.find(({validator:s})=>s(r))?.classGroupId},mit=/^\[(.+)\]$/,p5n=t=>{if(mit.test(t)){const e=mit.exec(t)[1],n=e?.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},m5n=t=>{const{theme:e,prefix:n}=t,o={nextPart:new Map,validators:[]};return f5n(Object.entries(t.classGroups),n).forEach(([r,s])=>{Bye(s,o,r,e)}),o},Bye=(t,e,n,o)=>{t.forEach(i=>{if(typeof i=="string"){const r=i===""?e:_it(e,i);r.classGroupId=n;return}if(typeof i=="function"){if(_5n(i)){Bye(i(o),e,n,o);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([r,s])=>{Bye(s,_it(e,r),n,o)})})},_it=(t,e)=>{let n=t;return e.split(Eye).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},_5n=t=>t.isThemeGetter,f5n=(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,I5n=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)}}},fit="!",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(fit),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},y5n=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},x5n=t=>({cache:I5n(t.cacheSize),parseClassName:C5n(t),...h5n(t)}),E5n=/\s+/,B5n=(t,e)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:i}=e,r=[],s=t.trim().split(E5n);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=y5n(l).join(":"),_=g?m+fit: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 b5n(){let t=0,e,n,o="";for(;t<arguments.length;)(e=arguments[t++])&&(n=Iit(e))&&(o&&(o+=" "),o+=n);return o}const Iit=t=>{if(typeof t=="string")return t;let e,n="";for(let o=0;o<t.length;o++)t[o]&&(e=Iit(t[o]))&&(n&&(n+=" "),n+=e);return n};function S5n(t,...e){let n,o,i,r=s;function s(A){const c=e.reduce((l,g)=>g(l),t());return n=x5n(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=B5n(A,n);return i(A,l),l}return function(){return r(b5n.apply(null,arguments))}}const rd=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},Cit=/^\[(?:([a-z-]+):)?(.+)\]$/i,Q5n=/^\d+\/\d+$/,v5n=new Set(["px","full","screen"]),w5n=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,P5n=/\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$/,M5n=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,D5n=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,N5n=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_8=t=>yk(t)||v5n.has(t)||Q5n.test(t),oQ=t=>xk(t,"length",G5n),yk=t=>!!t&&!Number.isNaN(Number(t)),bye=t=>xk(t,"number",yk),OK=t=>!!t&&Number.isInteger(Number(t)),R5n=t=>t.endsWith("%")&&yk(t.slice(0,-1)),RA=t=>Cit.test(t),iQ=t=>w5n.test(t),T5n=new Set(["length","size","percentage"]),k5n=t=>xk(t,T5n,yit),F5n=t=>xk(t,"position",yit),L5n=new Set(["image","url"]),H5n=t=>xk(t,L5n,U5n),O5n=t=>xk(t,"",Y5n),GK=()=>!0,xk=(t,e,n)=>{const o=Cit.exec(t);return o?o[1]?typeof e=="string"?o[1]===e:e.has(o[1]):n(o[2]):!1},G5n=t=>P5n.test(t)&&!M5n.test(t),yit=()=>!1,Y5n=t=>D5n.test(t),U5n=t=>N5n.test(t),K5n=S5n(()=>{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"],w=()=>["auto",RA,e],M=()=>[RA,e],k=()=>["",_8,oQ],R=()=>["auto",yk,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=()=>[yk,RA];return{cacheSize:500,separator:":",theme:{colors:[GK],spacing:[_8,oQ],blur:["none","",iQ,RA],brightness:W(),borderColor:[t],borderRadius:["none","","full",iQ,RA],borderSpacing:M(),borderWidth:k(),contrast:W(),grayscale:J(),hueRotate:W(),invert:J(),gap:M(),gradientColorStops:[t],gradientColorStopPositions:[R5n,oQ],inset:w(),margin:w(),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:[iQ]}],"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",OK,RA]}],basis:[{basis:w()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",RA]}],grow:[{grow:J()}],shrink:[{shrink:J()}],order:[{order:["first","last","none",OK,RA]}],"grid-cols":[{"grid-cols":[GK]}],"col-start-end":[{col:["auto",{span:["full",OK,RA]},RA]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[GK]}],"row-start-end":[{row:["auto",{span:[OK,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:[iQ]},iQ]}],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",iQ,oQ]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",bye]}],"font-family":[{font:[GK]}],"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",yk,bye]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_8,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",_8,oQ]}],"underline-offset":[{"underline-offset":["auto",_8,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(),F5n]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",k5n]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},H5n]}],"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":[_8,RA]}],"outline-w":[{outline:[_8,oQ]}],"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":[_8,oQ]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",iQ,O5n]}],"shadow-color":[{shadow:[GK]}],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",iQ,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:[OK,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:[_8,oQ,bye]}],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"]}}}),Fn="u">typeof window?window:void 0,gC="u">typeof globalThis?globalThis:Fn,F_=gC?.navigator,No=gC?.document,sd=gC?.location,YK=gC?.fetch,Sye=gC?.XMLHttpRequest&&"withCredentials"in new gC.XMLHttpRequest?gC.XMLHttpRequest:void 0,xit=gC?.AbortController,V5n=gC?.CompressionStream,dy=F_?.userAgent;function Eit(){return!(!Fn||Fn.navigator.onLine===!1)}const UK=typeof globalThis<"u"?globalThis:Fn;UK&&typeof self>"u"&&(UK.self=UK),UK&&typeof File>"u"&&(UK.File=function(){});const Ur=Fn??{},z5n="0.9.0",f8={DEBUG:!1,LIB_VERSION:z5n,LIB_NAME:"browser-common"};var x9=(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})({}),Qye=(function(t){return t.GZipJS="gzip-js",t.Base64="base64",t})({});const J5n=["$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"],W5n=["token"];function as(t,e){return t.indexOf(e)!==-1}const Dte=function(t){return t.trim()},vye=function(t){return t.replace(/^\$/,"")};function Bit(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 bit=Object.prototype,wye=bit.hasOwnProperty,Nte=bit.toString,As=Array.isArray||function(t){return Nte.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(wye.call(t,e))return!1;return!0}return!1},Eo=t=>t===void 0,nA=t=>Nte.call(t)=="[object String]",KK=t=>nA(t)&&t.trim().length===0,ad=t=>t===null,Fs=t=>Eo(t)||ad(t),qd=t=>Nte.call(t)=="[object Number]"&&t==t,I8=t=>qd(t)&&t>0,hy=t=>Nte.call(t)==="[object Boolean]",j5n=t=>as(J5n,t),q5n=t=>as(W5n,t);function Sit(t){return t===null||typeof t!="object"}function Rte(t,e){return{}.toString.call(t)===`[object ${e}]`}function Ek(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 Qit(t,Error)}}function Pye(t){return"u">typeof Event&&Qit(t,Event)}function Qit(t,e){try{return t instanceof e}catch{return!1}}const X5n=[!0,"true",1,"1","yes"],Mye=t=>as(X5n,t),$5n=[!1,"false",0,"0","no"];function vit(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 Wg(t){return function(){var e=this,n=arguments;return new Promise(function(o,i){var r=t.apply(e,n);function s(A){vit(r,o,i,s,a,"next",A)}function a(A){vit(r,o,i,s,a,"throw",A)}s(void 0)})}}const Z5n=["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"],wit=function(t,e=[]){if(!t)return!1;const n=t.toLowerCase();return Z5n.concat(e).some(o=>{const i=o.toLowerCase();return n.indexOf(i)!==-1})};function E9(t,e,n,o,i){return e>n&&(o.warn("min cannot be greater than max."),e=n),qd(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),E9(i??n,e,n,o))}var e4n=class{constructor(e){this.C={},this.I=e.I,this.R=E9(e.bucketSize,0,100,e.A),this.$=E9(e.refillRate,0,this.R,e.A),this.O=E9(e.refillInterval,0,864e5,e.A)}F(e,n){const o=Math.floor((n-e.lastAccess)/this.O);o>0&&(e.tokens=Math.min(e.tokens+o*this.$,this.R),e.lastAccess=e.lastAccess+o*this.O)}consumeRateLimit(e){var n;const o=Date.now(),i=String(e);let r=this.C[i];return r?this.F(r,o):(r={tokens:this.R,lastAccess:o},this.C[i]=r),r.tokens===0||(r.tokens--,r.tokens===0&&((n=this.I)===null||n===void 0||n.call(this,e)),r.tokens===0)}stop(){this.C={}}};const Bk="Mobile",VK="Android",Tte="Tablet",Pit="Android Tablet",Mit="iPad",Dit="Apple Watch",kte="Safari",Fte="BlackBerry",Nit="Samsung Internet",Lte="Chrome",Rit="Chrome iOS",Tit="Internet Explorer",kit="Internet Explorer Mobile",Fit="Opera",Lit="Microsoft Edge",Hte="Firefox",Hit="Firefox iOS",Ote="Nintendo",Gte="PlayStation",Yte="Xbox",Oit="Android Mobile",Git="Mobile Safari",Dye="Windows",Yit="Windows Phone",Uit="Nokia",Nye="Ouya",t4n="Generic "+Bk.toLowerCase(),Kit="Generic "+Tte.toLowerCase(),Rye="Konqueror",Vit="Oculus Browser",zit="Vivaldi",Jit="Yandex",Wit="Whale",jit="DuckDuckGo",qit="Pale Moon",Xit="Waterfox",Tye="Brave",$it="Claude",Zit="Codex",ert="ChatGPT",trt="Google Search App",kye=new RegExp("Version/(\\d+(\\.\\d+)?)"),Fye=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),n4n=new RegExp(Yte,"i"),o4n=new RegExp("PlayStation \\w+","i"),i4n=new RegExp("Nintendo \\w+","i"),Lye=new RegExp("BlackBerry|PlayBook|BB10","i"),r4n={"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"},nrt=function(t,e,n,o){return e=e||"",(function(r){return r?.brave?Tye:null})(n)||(o?.detectGoogleSearchApp&&as(t,"GSA/")?trt:as(t," OPR/")&&as(t,"Mini")?"Opera Mini":as(t," OPR/")?Fit:Lye.test(t)?Fte:as(t,"IEMobile")||as(t,"WPDesktop")?kit:as(t,"OculusBrowser")?Vit:as(t,"SamsungBrowser")?Nit:as(t,"Edge")||as(t,"Edg/")?Lit:as(t,"Vivaldi/")?zit:as(t,"YaBrowser/")?Jit:as(t,"Whale/")?Wit:as(t,"DuckDuckGo/")||as(t,"Ddg/")?jit:as(t,"Claude/")?$it:as(t,"Codex/")?Zit:as(t,"ChatGPT/")?ert:as(t,"FBIOS")?"Facebook Mobile":as(t,"UCWEB")||as(t,"UCBrowser")?"UC Browser":as(t,"CriOS")?Rit:as(t,"CrMo")||as(t,Lte)?Lte:as(t,VK)&&as(t,kte)?Oit:as(t,"FxiOS")?Hit:as(t.toLowerCase(),Rye.toLowerCase())?Rye:as(t,"Brave/")?Tye:((r,s)=>s&&as(s,"Apple")||(function(a){return as(a,kte)&&!as(a,Lte)&&!as(a,VK)})(r))(t,e)?as(t,Bk)?Git:kte:as(t,"PaleMoon/")?qit:as(t,"Waterfox/")?Xit:as(t,Hte)?Hte:as(t,"MSIE")||as(t,"Trident/")?Tit:as(t,"Gecko")?Hte:"")},s4n={[kit]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Lit]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Lte]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Rit]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[kte]:[kye],[Git]:[kye],[Fit]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Hte]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[Hit]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Rye]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Fte]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),kye],[Oit]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Nit]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Vit]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[zit]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Jit]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Wit]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Tye]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[$it]:[Fye],[Zit]:[Fye],[ert]:[Fye],[jit]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[qit]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Xit]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[trt]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Tit]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},a4n=function(t,e,n,o){const i=nrt(t,e,n,o),r=s4n[i];if(Eo(r))return null;for(let s=0;r.length>s;s++){const a=t.match(r[s]);if(a)return parseFloat(a[a.length-2])}return null},ort=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[Yte,t&&t[1]||""]],[new RegExp(Ote,"i"),[Ote,""]],[new RegExp(Gte,"i"),[Gte,""]],[Lye,[Fte,""]],[new RegExp(Dye,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Yit,""];if(new RegExp(Bk).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){let o=r4n[n[1]]||"";return/arm/i.test(e)&&(o="RT"),[Dye,o]}return[Dye,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let e="";return t&&t.length>=3&&(e=Eo(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[VK,[t[2],t[3],t[4]||"0"].join(".")]:[VK,""]],[/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",""]]],irt=function(t){for(let e=0;ort.length>e;e++){const[n,o]=ort[e],i=n.exec(t),r=i&&(L_(o)?o(i,t):o);if(r)return r}return["",""]},rrt=function(t){return i4n.test(t)?Ote:o4n.test(t)?Gte:n4n.test(t)?Yte:new RegExp(Nye,"i").test(t)?Nye:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?Yit:/iPad/.test(t)?Mit:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Dit:Lye.test(t)?Fte:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Uit,"i").test(t)?Uit:/(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(Bk).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)?VK:Pit:new RegExp("(pda|Mobile)","i").test(t)?t4n:new RegExp(Tte,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?Kit:""},A4n=function(t,e){var n;const o=rrt(t);return o===Mit||o===Pit||o==="Kobo"||o==="Kindle Fire"||o===Kit?Tte:o===Ote||o===Yte||o===Gte||o===Nye?"Console":o===Dit?"Wearable":o?Bk: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)?Bk:Tte:"Desktop";var i,r,s},Hye=/\bFBAV\/(\d+(?:\.\d+)*)/i,srt=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Hye],[/\bFBAN\/EMA\b/i,"Facebook Lite",Hye],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Hye],[/\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"]],Oye="[Truncated]",zK="[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 art(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=zK}Object.defineProperty(t,o,{value:i,enumerable:!0,writable:!0,configurable:!0})}return t}const Ute=3e5;var Art=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,Ute);if(!n)return this.ts=o,void(this.es=o+i);this.es=Math.max(this.es,Math.min(o+i,this.ts+Ute))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const n=Math.min(Ute,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 c4n=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function crt(t,e){return typeof(n=t)=="string"&&c4n.test(n)?t:e();var n}function lrt(t,e){const n=new Error(e);try{Object.defineProperty(n,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch{}return n}function rQ(t){return t&&t.split("#")[0]}function grt(t){try{return t()}catch{return}}function urt(t,e){const n=setTimeout(t,e);return n!=null&&n.unref&&n?.unref(),n}function drt(t,e,n){return hrt.apply(this,arguments)}function hrt(){return(hrt=Wg(function*(t,e,n){let o;try{return yield Promise.race([t,new Promise((i,r)=>{o=urt(()=>{try{n?.(),i()}catch(s){r(s)}},e)})])}finally{clearTimeout(o)}})).apply(this,arguments)}let Kte,prt,Gye;function l4n(t){const e=globalThis._posthogChunkIds;if(!e)return;const n=Object.keys(e);return Gye&&n.length===prt||(prt=n.length,Gye=n.reduce((o,i)=>{Kte||(Kte={});const r=Kte[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,Kte[i]=[c,l];break}}}return o},{})),Gye}function JK(t){return JK=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},JK(t)}function g4n(t,e,n){return(e=(function(o){var i=(function(r){if(JK(r)!="object"||!r)return r;var s=r[Symbol.toPrimitive];if(s!==void 0){var a=s.call(r,"string");if(JK(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)})(o);return JK(i)=="symbol"?i:i+""})(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function mrt(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?mrt(Object(n),!0).forEach(function(o){g4n(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):mrt(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}var u4n=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 Wg(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 Wg(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:l4n(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}getAggregateErrors(e){try{if(Ek(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 d4n=/^([a-z][a-z0-9.+-]+):/i,h4n=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function p4n(t){if(!t||t==="<anonymous>")return!1;const e=d4n.exec(t);return!e||h4n.includes(e[1].toLowerCase())}function Yye(t,e,n,o,i){const r={platform:t,filename:e,function:n==="<anonymous>"?"?":n,in_app:p4n(e)};return Eo(o)||(r.lineno=o),Eo(i)||(r.colno=i),r}const _rt=(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]},m4n=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,_4n=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,f4n=/\((\S*)(?::(\d+))(?::(\d+))\)/,I4n=(t,e)=>{const n=m4n.exec(t);if(n){const[,i,r,s]=n;return Yye(e,i,"?",+r,+s)}const o=_4n.exec(t);if(o){if(o[2]&&o[2].indexOf("eval")===0){const s=f4n.exec(o[2]);s&&(o[2]=s[1],o[3]=s[2],o[4]=s[3])}const[i,r]=_rt(o[1]||"?",o[2]);return Yye(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,y4n=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,x4n=(t,e)=>{const n=C4n.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){const r=y4n.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]=_rt(i,o),Yye(e,o,i,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},frt=/\(error: (.*)\)/;function Uye(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function E4n(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(!Uye(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 B4n(t,e){const n=e.start+e.length,o=Crt(t,e);o&&t.splice(n+o===t.length?n:e.start,o)}function Irt(t,e){let n=e.start;for(;n>0&&Uye(t[n-1],t[n-1+e.length]);)n--;return e.start-n}function Crt(t,e){const n=e.start+e.length;let o=n;for(;t.length>o&&Uye(t[o],t[o-e.length]);)o++;return o-n}function b4n(t,e){const n=e[0];let o=t.length-(n?Irt(t,n):0);for(const i of e)o-=Crt(t,i);return o}function S4n(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 Q4n=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 Rte(e,"DOMException")}isDOMError(e){return Rte(e,"DOMError")}},v4n=class{match(e){return Ek(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}}},w4n=class{match(e){return!!Rte(e,"ErrorEvent")&&(e.error!=null||this.ar(e))}coerce(e,n){var o;if(e.error!=null)return n.apply(e.error);const i=n.apply(e.message);return sn(sn({},i),{},{stack:(o=this.lr(e))!==null&&o!==void 0?o:i.stack,synthetic:!0})}ar(e){return nA(e.message)&&e.message.length>0}lr(e){var n,o;const i=e,r=(n=i.lineno)!==null&&n!==void 0?n:0,s=(o=i.colno)!==null&&o!==void 0?o:0;if(nA(i.filename)&&i.filename.length!==0&&r!==0)return`Error
|
|
240
|
-
at ${i.filename}:${r}:${s}`}};const P4n=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var M4n=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(P4n);return i&&(n=i[1],o=i[2]),[n,o]}};const D4n=["fatal","error","warning","log","info","debug"];function yrt(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 N4n=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(Pye(e))return e.constructor.name;const n="name"in e?e.name:void 0;return nA(n)&&!KK(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: ${yrt(e)}`}isSeverityLevel(e){return nA(e)&&!KK(e)&&D4n.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(Ek(o))return o}}getObjectClassName(e){try{const n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}},R4n=class{match(e){return Pye(e)}coerce(e,n){var o;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${yrt(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},T4n=class{match(e){return Sit(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}}},k4n=class{match(e){return Rte(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Pye(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 Sit(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 Vte="$message",zte="$timestamp",F4n=new Set([Vte,zte]),Kye={enabled:!0,max_bytes:32768};function Jte(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:Kye.enabled,max_bytes:H4n(t.max_bytes,Kye.max_bytes)}:sn({},Kye)}var L4n=class{constructor(e){this.ns=[],this.ss=0,this.Ir=Jte(e)}setConfig(e){this.Ir=Jte(e),this.rs()}add(e){const n=(function(i){let r;try{r=Bit(i)}catch{return}try{const s=JSON.parse(r);if(!xA(s))return;const a=s,A=a[Vte],c=a[zte];return!nA(A)||A.trim().length===0||!nA(c)&&!qd(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.Ir.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.Ir.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function H4n(t,e){if(!qd(t)||t===1/0||t===-1/0)return e;const n=Math.floor(t);return 0>n?e:n}const xrt=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function Ert(t){return typeof t=="string"||t}function Brt(t){return typeof t=="string"?t:void 0}const O4n=["$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"],brt="NativeGzipValidationError",Vye=t=>t.length>=2&&t[0]===31&&t[1]===139,Srt=(t,e)=>t===Qye.GZipJS||e===Qye.GZipJS||e==="gzip",Qrt=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError";let WK;const Wte=t=>{throw lrt(brt,`Native gzip produced invalid output: ${t}`)},G4n=(vrt=Wg(function*(t,e){18>t.size&&Wte("too-short");const n=new Uint8Array(yield t.slice(0,10).arrayBuffer());Vye(n)&&n[2]===8||Wte("invalid-header");const o=new DataView(yield t.slice(t.size-8).arrayBuffer());o.getUint32(0,!0)!==(r=>{const s=(()=>{if(WK)return WK;WK=[];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;WK[A]=c>>>0}return WK})();let a=4294967295;for(let A=0;r.length>A;A++)a=s[255&(a^r[A])]^a>>>8;return(4294967295^a)>>>0})(e)&&Wte("invalid-crc");const i=e.length>>>0;o.getUint32(4,!0)!==i&&Wte("invalid-size")}),function(t,e){return vrt.apply(this,arguments)});var vrt;function zye(){return zye=Wg(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=Wg(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 G4n(c,i),c}catch(i){if(n?.rethrow)throw i;return e&&console.error("Failed to gzip compress data",i),null}var o}),zye.apply(this,arguments)}function wrt(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 Y4n={}.propertyIsEnumerable;function jte(t,e){try{return Prt(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function Jye(t,e,n,o){if(0>=n.remainingNodes)return{stringValue:Oye};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:Oye};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 Jye(i.call(t),e,n,o+1)}catch{}return As(t)?{arrayValue:{values:U4n(t,e,n,o+1)}}:{kvlistValue:{values:Prt(t,e,n,o+1)}}}finally{n.ancestors.delete(t)}}return{stringValue:bk(String(t))}}function U4n(t,e,n,o){const i=[],r=Math.min(t.length,1e3);let s=0;for(;r>s&&n.remainingNodes>0;s++)try{const a=s in t?t[s]:void 0;if(Fs(a))continue;i.push(Jye(a,e,n,o))}catch{i.push({stringValue:zK})}return t.length>s&&i.push({stringValue:Oye}),i}function Prt(t,e,n,o){const i=[];for(const r in t)if(Y4n.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)||Eo(s))continue;i.push({key:bk(r),value:Jye(s,e,n,o)})}catch{i.push({key:bk(r),value:{stringValue:zK}})}}return i}function Mrt(t,e,n){return sn(sn(sn(sn({},art({},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 K4n=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function Drt(t,e){const n=art({},t),o={};for(const i of K4n)({}).hasOwnProperty.call(n,i)&&(o[i]=n[i],delete n[i]);return[...jte(n,e),...jte(o,e)]}const Nrt={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"},Rrt={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}},V4n=Rrt.info;function z4n(t){try{return bk(String(t))}catch{return zK}}function J4n(t,e,n,o){const i=t.level||"info",{text:r,number:s}=Rrt[i]||V4n,a=(function(u=Date.now()){return String(u)+"000000"})(qd(o)?o:void 0),A={};e.distinctId&&(A.posthogDistinctId=e.distinctId),e.sessionId&&(A.sessionId=e.sessionId),e.windowId&&(A["window.id"]=e.windowId),Fs(e.sessionStartTimestamp)||(A.sessionStartTimestamp=String(e.sessionStartTimestamp)),Fs(e.lastActivityTimestamp)||(A.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(A["url.full"]=e.currentUrl),e.screenName&&(A["screen.name"]=e.screenName),e.appState&&(A["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(A.feature_flags=e.activeFeatureFlags);const c=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=zK}Object.defineProperty(c,h,{value:d,enumerable:!0,writable:!0,configurable:!0})}}const g={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:s,severityText:r,body:{stringValue:z4n(t.body)},attributes:jte(c,n)};return t.trace_id&&(g.traceId=t.trace_id),t.span_id&&(g.spanId=t.span_id),Eo(t.trace_flags)||(g.flags=t.trace_flags),g}function Trt(t,e,n){return Mrt(t,e,n)}function krt(t,e,n,o){return{resourceLogs:[{resource:{attributes:Drt(e)},scopeLogs:[{scope:{name:n,version:o},logRecords:t}]}]}}var Frt=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=urt(()=>{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 Lrt(){return .75+.5*Math.random()}function Hrt(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 W4n=class{constructor(e,n,o,i,r,s=()=>Promise.resolve(),a){var A;this._instance=e,this.Ir=n,this.A=o,this.cs=i,this.ds=r,this.vs=s,this.fs=a,this.ps=new Frt(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new Art,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(x9.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.Ir.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,n){var o;if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;const i=this.Os(e);if(i===null)return;if(!i.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;const r={record:J4n(i,(o=n?.context)!==null&&o!==void 0?o:this.cs(),this.A,n?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){const n=this.Ir.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.A.info("Log was rejected in beforeSend function"),null;i=s}catch(s){return this.A.error("Error in beforeSend function for log:",s),null}return i}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),n=e-this.xs;return this.Ps>n&&n>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return Wg(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return Wg(function*(){var n;e.ps.clear();let o=(n=e._instance.getPersistedProperty(x9.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=krt(l.map(h=>h.record),e.qs(),(s=e.fs)!==null&&s!==void 0?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),u=yield e._instance.js(g);if(e._s!==A)return;if(u.kind==="too-large"&&l.length>1)e.Es=Math.max(1,Math.floor(l.length/2)),e.A.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(u),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),u.kind==="retry-later"||(u.kind==="too-large"?e.A.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):u.kind==="ok"&&e.Ir.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Ir.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(l.length),o=(a=e._instance.getPersistedProperty(x9.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,u.kind==="fatal"))throw u.error}})()}Bs(e){var n=this;return Wg(function*(){var o;const i=Math.max(0,e-n.bs),r=(o=n._instance.getPersistedProperty(x9.LogsQueue))!==null&&o!==void 0?o:[];n._instance.setPersistedProperty(x9.LogsQueue,r.slice(i)),yield n.vs()})()}qs(){return Trt(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var n;if(this._instance.optedOut)return;const o=(n=this._instance.getPersistedProperty(x9.LogsQueue))!==null&&n!==void 0?n:[];this.Is>o.length||(o.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),o.push(e),this._instance.setPersistedProperty(x9.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(Hrt(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(x9.LogsQueue);return!!e&&e.length>0}shutdown(e){var n=this;return Wg(function*(){n.ps.clear();const o=n.flush().catch(()=>{});e!==void 0?yield drt(o,e):yield o})()}flushWithTimeout(e){var n=this;return Wg(function*(){const o=n.flush();yield drt(o,e,()=>{o.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=Lrt(),this.A.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const Wye=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Ort(t){return String(t)+"000000"}function Grt(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 j4n=class{constructor(e,n,o){this._instance=e,this.Ir=n,this.A=o,this.zs=new Map,this.ps=new Frt(()=>this.flush().catch(i=>{this.A.error("Metrics flush failed:",i)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new Art,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=Wg(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.A.warn("Dropping metric with empty name");if(typeof n.value!="number"||!Number.isFinite(n.value))return void this.A.warn(`Dropping metric '${n.name}': value must be a finite number`);if(n.type==="count"&&0>n.value)return void this.A.warn(`Dropping count '${n.name}': counters are monotonic, value must be >= 0`);let o,i;try{o=n.attributes?sn({},n.attributes):void 0,i=Grt(n.type,n.name,n.unit,o)}catch(a){return void this.A.warn(`Dropping metric '${n.name}': attributes could not be serialized`,a)}let r=this.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.A.warn(`Metric name '${n.name}' is already used as a ${s}; recording it as a ${n.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(r,n.value),this.Fs()}Ks(){return this.Ir.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.A.warn(`Metric series cap reached (${this.Ir.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(Wye.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,Wye)]+=1;break}}}Os(e){const n=this.Ir.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.A.info("Metric was rejected in beforeSend function"),null;i=s}catch(s){return this.A.error("Error in beforeSend function for metric:",s),null}return i}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(Hrt(this.Ir.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return Wg(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=Lrt()):(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.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.A.error("Failed to send metrics batch:",i.error)}})()}Js(e){return n=this.co(e),o=(function(s,a,A){return Mrt(s,a,A)})(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Drt(o)},scopeMetrics:[{scope:{name:i,version:r},metrics:n}]}]};var n,o,i,r}co(e){const n=Ort(Date.now()),o=new Map;for(const a of e.values()){var i;const A=Grt(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=jte((i=a.attributes)!==null&&i!==void 0?i:{},this.A),g=Ort(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:Wye})}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 Yrt=(t,{debugEnabled:e}={})=>{const n={N(o,...i){Fn&&(f8.DEBUG||Fn.POSTHOG_DEBUG||e)&&!Eo(Fn.console)&&Fn.console&&("__rrweb_original__"in Fn.console[o]?Fn.console[o].__rrweb_original__:Fn.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)=>Yrt(`${t} ${o}`,i)};return n},gi=Yrt("[PostHog.js]"),Ad=gi.createLogger,q4n=Ad("[ExternalScriptsLoader]"),qte=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 q4n.warn(`${e} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const o=qte(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(qte(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={},Urt=(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(qte(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=Urt(t,e);jye[i]=c;const l=qte(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,Urt(t,e),n)},Ur.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{const o=t.requestRouter.endpointFor("api",e);PM(t,o,n)},f8.DEBUG=!1,f8.LIB_VERSION="1.435.3",f8.LIB_NAME="web";var Ym=f8;const X4n="$people_distinct_id",T4="distinct_id",qye="$device_id",Xye="$device_model",Xte="__alias",$4n="__cmpns",Krt="$fbc",Sk="$fbc_persistence",Vrt="$fbp",jK="$fbp_persistence",$ye="__timers",zrt="$autocapture_disabled_server_side",Zye="$heatmaps_enabled_server_side",e2e="$exception_capture_enabled_server_side",Jrt="$error_tracking_suppression_rules",t2e="$error_tracking_capture_extension_exceptions",n2e="$web_vitals_enabled_server_side",o2e="$dead_clicks_enabled_server_side",i2e="$product_tours_enabled_server_side",Wrt="$logs_capture_enabled_server_side",jrt="$web_vitals_allowed_metrics",qK="$session_recording_remote_config",Z4n="$session_recording_enabled_server_side",eBn="$replay_sample_rate",tBn="$replay_override_sampling",nBn="$replay_override_linked_flag",oBn="$replay_override_url_trigger",iBn="$replay_override_event_trigger",Qk="$sesid",qrt="$session_is_sampled",rBn="$session_past_minimum_duration",sBn="$session_recording_url_trigger_activated_session",aBn="$session_recording_event_trigger_activated_session",ABn="$debug_first_full_snapshot_timestamp",cBn="$sess_rec_flush_size",k4="$enabled_feature_flags",C8="$active_feature_flags",r2e="$early_access_features",MM="$feature_flag_details",sQ="$feature_flag_payloads",DM="$feature_flag_request_id",XK="$minimal_flag_called_events",B9="$override_feature_flags",NM="$override_feature_flag_payloads",aQ="$stored_person_properties",AQ="$stored_group_properties",Xrt="$groups",$K="$surveys",$te="$surveys_loaded_at",$rt="$surveys_activated",Zrt="$surveys_activated_session",est="$surveys_activated_timestamps",s2e="ph_product_tours",lBn="$product_tours_activated",gBn="$product_tours_activated_session",uBn="$conversations_widget_session_id",dBn="$conversations_ticket_id",hBn="$conversations_widget_state",pBn="$conversations_user_traits",cQ="$flag_call_reported",ZK="$flag_call_reported_session_id",eV="$feature_flag_errors",lQ="$feature_flag_evaluated_at",py="$user_state",a2e="$client_session_props",mBn="$capture_rate_limit",tst="$initial_campaign_params",nst="$initial_referrer_info",vk="$initial_person_info",A2e="$epp",c2e="$posthog_cookieless",ost="$cookieless_mode",ist="$sdk_debug_extensions_init_method",rst="$sdk_debug_extensions_init_time_ms",l2e="$sdk_debug_recording_script_not_loaded",g2e="$sdk_debug_replay_stale_config",sst="$sdk_debug_replay_event_trigger_status",ast="$sdk_debug_replay_linked_flag_trigger_status",Ast="$sdk_debug_replay_matched_recording_trigger_groups",cst="$sdk_debug_replay_pending_trigger_conditions",lst="$sdk_debug_replay_remote_trigger_matching_config",gst="$sdk_debug_replay_trigger_groups_count",ust="$sdk_debug_replay_url_trigger_status",_Bn="$session_recording_start_reason",u2e="PostHog loadExternalDependency extension not found.",y8="anonymous",Zte="identified",dst="identified_only",tV="visibilitychange",ene="beforeunload",d2e="$pageview",hst="$pageleave",pst="$identify",mst="$groupidentify";function wk(t,e){As(t)&&t.forEach(e)}function vl(t,e){if(!Fs(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)wye.call(t,n)&&e(t[n],n)}const jg=function(t,...e){for(const n of e)for(const o in n)n[o]!==void 0&&(t[o]=n[o]);return t};function tne(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 fBn=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)}}},h2e=function(t){const e={};return vl(t,function(n,o){(nA(n)&&n.length>0||qd(n))&&(e[o]=n)}),e};function _st(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 IBn=["herokuapp.com","vercel.app","netlify.app"];function CBn(t){const e=t?.hostname;if(!nA(e))return!1;const n=e.split(".").slice(-2).join(".");for(const o of IBn)if(n===o)return!1;return!0}function jc(t,e,n,o){const{capture:i=!1,passive:r=!0}=o??{};t?.addEventListener(e,n,{capture:i,passive:r})}function p2e(t){return t.name==="ph_toolbar_internal"}const nV=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 qd(t)&&isFinite(t)&&Math.floor(t)===t});var yBn=class Jnt{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 Jnt(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 Jnt(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}},xBn=class{generate(){const e=this.generateOrAbort();if(!Eo(e))return e;{this.Ct=0;const n=this.generateOrAbort();if(Eo(n))throw new Error("Could not generate UUID after timestamp reset");return n}}generateOrAbort(){const e=(()=>{const n=Date.now();return qd(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 yBn.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 EBn}};let fst=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};Fn&&!Eo(Fn.crypto)&&crypto.getRandomValues&&(fst=t=>crypto.getRandomValues(t));var EBn=class{nextUint32(){return this.Rt.length>this.At||(fst(this.Rt),this.At=0),this.Rt[this.At++]}constructor(){this.Rt=new Uint32Array(8),this.At=1/0}};let Ist;const F4=()=>BBn().toString(),BBn=()=>(Ist||(Ist=new xBn)).generate();let oV="";const bBn=/[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_${F4()}`;cd.$t(t,"xyz"),Pk=nV(t)==='"xyz"',cd.Lt(t)}catch{Pk=!1}return Pk},Pt(t){gi.error("cookieStore error: "+t)},Ot:nV,Dt(t){let e;try{e=JSON.parse(cd.Ot(t))||{}}catch{}return e},$t(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(oV)return oV;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_"+F4();for(;!oV&&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",oV=_)}return oV})(c);if(!g){const u=(h=>{const d=h.match(bBn);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(nV(t))))try{cd.$t(t,"",-1,e)}catch{return}}};let m2e=null;const uc={Et(){if(!ad(m2e))return m2e;let t=!0;if(Eo(Fn))t=!1;else try{const e="__mplssupport__";uc.$t(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"),m2e=t,t},Pt(t){gi.error("localStorage error: "+t)},Ot(t){try{return Fn?.localStorage.getItem(t)}catch(e){uc.Pt(e)}return null},Dt(t){try{return JSON.parse(uc.Ot(t))||{}}catch{}return null},$t(t,e){try{return Fn?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){uc.Pt(n)}return!1},Lt(t){try{Fn?.localStorage.removeItem(t)}catch(e){uc.Pt(e)}}},_2e=[aQ,C8,k4,MM,sQ,DM,lQ,eV,cQ],RM=[qye,T4,Qk,qrt,A2e,vk,Sk,py],nne=t=>t+"_cpm",SBn=["__proto__","constructor","prototype"],f2e=t=>{if(!xA(t))return{};const e={};return Object.keys(t).forEach(n=>{SBn.indexOf(n)===-1&&(e[n]=t[n])}),e},I2e=(t,e=[])=>{const n={};return[...RM,...e].forEach(o=>{const i=t[o];Eo(i)||ad(i)||i===""||(n[o]=i)}),n},Cst=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)},yst=(t,e)=>({p:e,f:Cst(JSON.stringify(t))}),xst=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const n=cd.Dt(nne(t)),o=n?.f===Cst(e)&&As(n.p);return{properties:o?n.p:[],isValid:o}}catch{return{properties:[],isValid:!1}}},C2e=(t,e)=>e+"|"+(cd.Ot(nne(t))||""),Mk={},y2e={Et:()=>!0,Pt(t){gi.error("memoryStorage error: "+t)},Ot:t=>t in Mk?Mk[t]:null,Dt:t=>t in Mk?Mk[t]:null,$t:(t,e)=>(Mk[t]=e,!0),Lt(t){delete Mk[t]}};let TM=null;const Z0={Et(){if(!ad(TM))return TM;if(TM=!0,Eo(Fn))TM=!1;else try{const t="__support__";Z0.$t(t,"xyz"),Z0.Ot(t)!=='"xyz"'&&(TM=!1),Z0.Lt(t)}catch{TM=!1}return TM},Pt(t){gi.error("sessionStorage error: ",t)},Ot(t){try{return Fn?.sessionStorage.getItem(t)}catch(e){Z0.Pt(e)}return null},Dt(t){try{return JSON.parse(Z0.Ot(t))||null}catch{}return null},$t(t,e){try{return Fn?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){Z0.Pt(n)}return!1},Lt(t){try{Fn?.sessionStorage.removeItem(t)}catch(e){Z0.Pt(e)}}};var QBn=class{constructor(e){this._instance=e}get Ir(){return this._instance.config}get consent(){return this.Do()?0:this.Lo}isOptedOut(){return this.Ir.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Ir.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Ir.opt_out_capturing_by_default}optInOut(e){this.No.$t(this.qo,e?1:0,this.Ir.cookie_expiration,this.Ir.cross_subdomain_cookie,this.Ir.secure_cookie)}reset(){this.No.Lt(this.qo,this.Ir.cross_subdomain_cookie)}get qo(){const{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:o}=this._instance.config;return o||(n?n+e:"__ph_opt_in_out_"+e)}get Lo(){const e=this.No.Ot(this.qo);return Mye(e)?1:as($5n,e)?0:-1}get No(){const e=this.Ir.opt_out_capturing_persistence_type,n=e==="localStorage"?uc:cd,o=n.Et()?n:y2e;if(!this.jo||this.jo!==o){this.jo=o;const i=e==="localStorage"?cd:uc;i.Ot(this.qo)&&(this.jo.Ot(this.qo)||this.optInOut(Mye(i.Ot(this.qo))),i.Lt(this.qo,this.Ir.cross_subdomain_cookie))}return this.jo}Do(){return!!this.Ir.respect_dnt&&[F_?.doNotTrack,F_?.msDoNotTrack,Ur.doNotTrack,F_?.globalPrivacyControl].some(e=>Mye(e))}};function Est(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 Bst(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 bst(t){return!!t&&t.nodeType===3}function x2e(t){return!!t&&t.nodeType===11&&b9(t.host)}function E2e(t){return t?Dte(t).split(/\s+/):[]}function Sst(t,e){const n=(function(o){var i;const r=Fn==null||(i=Fn.location)===null||i===void 0?void 0:i.href;return Eo(r)?void 0:Est(o,r)})(e);return!!(n&&t&&t.some(o=>n.match(o)))}function Dk(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 E2e(e)}function Qst(t){return Fs(t)?null:Dte(t).split(/(\s+)/).filter(e=>aV(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function iV(t){let e="";return Nk(t)&&!sV(t)&&t.childNodes&&t.childNodes.length&&vl(t.childNodes,function(n){var o;bst(n)&&n.textContent&&(e+=(o=Qst(n.textContent))!==null&&o!==void 0?o:"")}),Dte(e)}function rV(t){var e;return Eo(t.target)?t.srcElement||null:!((e=t.target)===null||e===void 0)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}const B2e=["a","button","form","input","select","textarea","label"];function b2e(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 S2e(t,e){if(Eo(e))return!0;for(const n of t)if(e.some(o=>b2e(n,o)))return!0;return!1}function vst(t){const e=t.parentNode;return!(!e||!b9(e))&&e}const Q2e=[".ph-no-autocapture","[data-ph-no-autocapture]"],wst=["next","previous","prev",">","<"],vBn=[...wst,"+","-","−","–"],Pst=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Mst=[".ph-no-rageclick",".ph-no-capture"],wBn=["","text","search","email","password","url","tel","number"];function Dst(t,e){if(!Fn||v2e(t))return!1;let n,o,i;var r,s;if(hy(e)?(n=!!e&&Mst,o=void 0,i=!1):(n=(r=e?.css_selector_ignorelist)!==null&&r!==void 0?r:Mst,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")?as(wBn,(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}=Nst(t,!1);return!(function(A,c){if(A===!1||Eo(A))return!1;let l;if(A===!0)l=wst;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=>Pst(g,h)||Pst(u,h)))})(o,a.map(A=>{var c;return{safeText:iV(A).toLowerCase(),ariaLabel:((c=A.getAttribute("aria-label"))===null||c===void 0?void 0:c.toLowerCase().trim())||""}}))&&!S2e(a,n)}const v2e=t=>!t||j1(t,"html")||!b9(t),Nst=(t,e)=>{if(!Fn||v2e(t))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const o=[t];let i=t;for(;i.parentNode&&!j1(i,"body");){if(x2e(i.parentNode)){o.push(i.parentNode.host),i=i.parentNode.host;continue}const r=vst(i);if(!r)break;if(e||B2e.indexOf(r.tagName.toLowerCase())>-1)n=!0;else try{const s=Fn.getComputedStyle(r);s&&s.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}o.push(r),i=r}return{parentIsUsefulElement:n,targetElementList:o}};function Nk(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=Dk(r);if(as(s,"ph-sensitive")||as(s,"ph-no-capture"))return!1}if(as(Dk(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 sV(t){return!!(j1(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||j1(t,"select")||j1(t,"textarea")||t.getAttribute("contenteditable")==="true")}const Rst=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}))$"),Tst=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,PBn=[16,15,14,13],MBn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),kst=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Fst=/[0-9A-Za-z_]/;function DBn(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 aV(t,e=!0){return!(Fs(t)||nA(t)&&(t=Dte(t),(e?Rst.test((t||"").replace(/[- ]/g,"")):(function(n){let o;for(Tst.lastIndex=0;o=Tst.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 PBn){const A=s+a;if(r.length>=A){const c=r.slice(s,A);if(Rst.test(c)&&DBn(c))return!0}}}return!1})(t))||(e?MBn.test(t):(function(n){let o;for(kst.lastIndex=0;o=kst.exec(n);){const i=o[1],r=o[3];if(!(i&&r&&Fst.test(i)&&Fst.test(r)))return!0}return!1})(t))))}function Lst(t){let e=iV(t);return e=`${e} ${Hst(t)}`.trim(),aV(e)?e:""}function Hst(t){let e="";return t&&t.childNodes&&t.childNodes.length&&vl(t.childNodes,function(n){var o;if(n&&((o=n.tagName)===null||o===void 0?void 0:o.toLowerCase())==="span")try{const i=iV(n);e=`${e} ${i}`.trim(),n.childNodes&&n.childNodes.length&&(e=`${e} ${Hst(n)}`.trim())}catch(i){gi.error("[AutoCapture]",i)}}),e}function Ost(t){return t.replace(/"|\\"/g,'\\"')}function NBn(t){const e=t.attr__class;if(e)return As(e)?e:E2e(e)}const one=Ad("[Dead Clicks]"),RBn=()=>!0,TBn=t=>{var e;const n=!!(!((e=t.instance.persistence)===null||e===void 0)&&e.get_property(o2e)),o=t.instance.config.capture_dead_clicks;return hy(o)?o:!!xA(o)||n};var Gst=class{get lazyLoadedDeadClicksAutocapture(){return this.Bo}constructor(e,n,o){this.instance=e,this.isEnabled=n,this.onCapture=o,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const n=e.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[o2e]:n.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Ho(()=>{this.zo()}):this.stop()}Ho(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?one.error("failed to load script",r):e()})}zo(){var e;if(No){if(!this.Bo&&(!((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.Bo=Ur.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Bo.start(No),one.info("starting...")}}else one.error("`document` not found. Cannot start.")}stop(){this.Bo&&(this.Bo.stop(),this.Bo=void 0,one.info("stopping..."))}};const AV=Ad("[SegmentIntegration]");function Yst(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()||F4();a.config.get_device_id=d,l&&h.id()&&(a.register({distinct_id:h.id(),$device_id:d()}),a.persistence.set_property(py,Zte)),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||AV.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()||(AV.info("No userId set, resetting PostHog"),A.reset()),d||(c=void 0),u.event.userId&&u.event.userId!==A.get_distinct_id()&&(AV.info("UserId set, identifying with PostHog"),A.identify(u.event.userId));let p=A.calculateEventProperties(h,u.event.properties);if(!Fs(l)){const m=u.event.properties||{},_={};for(const I of Object.keys(p))wye.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),Fs(x))return null}catch(B){return AV.error("Error in Segment filterProperties:",B),null}return x})(l,_);if(Fs(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,d2e)},identify(u){return g(u,pst)},screen(u){return g(u,"$screen")}}})(t,a,{filterProperties:r})).then(()=>{e()},A=>{AV.error("Failed to register the Segment integration",A),e()})},n)}const Ust="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 kBn=class{constructor(e,n,o,i,r,s){this.name=Ust,this.setupOnce=function(a){a(Kst(e,{organization:n,projectId:o,prefix:i,severityAllowList:r,sendExceptionsToPostHog:s==null||s}))}}},Vst=class{constructor(e){this.Uo=(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.Wo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Vo()}Vo(){var e;this.Go=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Uo)}destroy(){var e;(e=this.Go)===null||e===void 0||e.call(this),this.Go=void 0}doPageView(e,n){var o;const i=this.Zo(e,n);return this.Wo={pathname:(o=Fn?.location.pathname)!==null&&o!==void 0?o:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var n;return this.Zo(e,(n=this.Wo)===null||n===void 0?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Wo)===null||e===void 0?void 0:e.pageViewId}}Zo(e,n){const o=this.Wo;if(!o)return{$pageview_id:n};let i={$pageview_id:n,$prev_pageview_id:o.pageViewId};const r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:s,lastScrollY:a,maxScrollY:A,maxContentHeight:c,lastContentY:l,maxContentY:g}=r;if(!(Eo(s)||Eo(a)||Eo(A)||Eo(c)||Eo(l)||Eo(g))){s=Math.ceil(s),a=Math.ceil(a),A=Math.ceil(A),c=Math.ceil(c),l=Math.ceil(l),g=Math.ceil(g);const u=s>1?E9(a/s,0,1,gi):1,h=s>1?E9(A/s,0,1,gi):1,d=c>1?E9(l/c,0,1,gi):1,p=c>1?E9(g/c,0,1,gi):1;i=jg(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 cV=["flags","surveys"],FBn={[X4n]:{exposure:"hidden"},[Xte]:{exposure:"hidden"},[$4n]:{exposure:"hidden"},[$ye]:{exposure:"hidden"},[Sk]:{exposure:"hidden"},[jK]:{exposure:"hidden"},[zrt]:{exposure:"event"},[Zye]:{exposure:"hidden"},[Wrt]:{exposure:"hidden"},[e2e]:{exposure:"event"},[Jrt]:{exposure:"hidden"},[t2e]:{exposure:"event"},[n2e]:{exposure:"event"},[o2e]:{exposure:"event"},[i2e]:{exposure:"hidden"},[jrt]:{exposure:"event"},[qK]:{exposure:"hidden"},[Z4n]:{exposure:"hidden"},[Qk]:{exposure:"hidden"},[qrt]:{exposure:"event"},[eBn]:{exposure:"event",shouldSkipFromEventProperties:t=>ad(t)},[rBn]:{exposure:"event"},[sBn]:{exposure:"event"},[aBn]:{exposure:"event"},[ABn]:{exposure:"event"},[cBn]:{exposure:"hidden"},[k4]:{exposure:"hidden",storageGroup:"flags"},[C8]:{exposure:"hidden",storageGroup:"flags"},[r2e]:{exposure:"hidden"},[MM]:{exposure:"hidden",storageGroup:"flags"},[sQ]:{exposure:"hidden",storageGroup:"flags"},[DM]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[XK]:{exposure:"hidden",storageGroup:"flags"},[B9]:{exposure:"hidden"},[NM]:{exposure:"hidden"},[aQ]:{exposure:"hidden"},[AQ]:{exposure:"hidden"},[$K]:{exposure:"hidden",storageGroup:"surveys"},[$te]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[$rt]:{exposure:"event"},[Zrt]:{exposure:"hidden"},[est]:{exposure:"hidden"},[s2e]:{exposure:"hidden"},[lBn]:{exposure:"hidden"},[gBn]:{exposure:"hidden"},[uBn]:{exposure:"event"},[dBn]:{exposure:"event"},[hBn]:{exposure:"event"},[pBn]:{exposure:"event"},[cQ]:{exposure:"hidden"},[ZK]:{exposure:"hidden"},[Xrt]:{exposure:"event"},[eV]:{exposure:"hidden"},[lQ]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[py]:{exposure:"hidden"},[a2e]:{exposure:"hidden"},[mBn]:{exposure:"hidden"},[tst]:{exposure:"hidden"},[nst]:{exposure:"hidden"},[vk]:{exposure:"hidden"},[A2e]:{exposure:"hidden"},[tBn]:{exposure:"event"},[nBn]:{exposure:"event"},[oBn]:{exposure:"event"},[iBn]:{exposure:"event"},[ist]:{exposure:"event"},[rst]:{exposure:"event"},[l2e]:{exposure:"hidden"},[g2e]:{exposure:"hidden"},[sst]:{exposure:"hidden"},[ast]:{exposure:"hidden"},[Ast]:{exposure:"hidden"},[cst]:{exposure:"hidden"},[lst]:{exposure:"hidden"},[gst]:{exposure:"hidden"},[ust]:{exposure:"hidden"},[_Bn]:{exposure:"event"}},LBn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Kf=t=>{const e=FBn[t];if(e)return e;for(const[n,o]of LBn)if(t.indexOf(n)===0)return o},Rk=(t,e)=>{try{let n;return JSON.stringify(t,(o,i)=>{var r;return Ek(i)?((r=n)!==null&&r!==void 0||(n=new WeakMap),n.has(i)||n.set(i,_st(i)),n.get(i)):typeof i=="bigint"?i.toString():i},e)}catch{return Bit(t)}},x8=t=>{const e=No?.createElement("a");return Eo(e)?null:(e.href=t,e)},Tk=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," ")}},lV=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},ine=function(t,e){const n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},zst=(t,e)=>t>=e&&Eit(),Jst=(t,e,n,o)=>{if(t===0){if(Eit()){const i=e+1;return i===n&&o(),i}return e}return 0},kk=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],HBn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...kk],gV="<masked>",OBn=["li_fat_id"];function Wst(t,e,n){if(!No)return{};const o=e?[...kk,...n||[]]:[],i=jst(lV(No.URL,o,gV),t),r=(function(){const s={};return vl(OBn,function(a){const A=nV(a);s[a]=A||null}),s})();return jg(r,i)}function jst(t,e){const n=HBn.concat(e||[]),o={};return vl(n,function(i){const r=Tk(t,i);o[i]=r||null}),o}function qst(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?Tk(No.referrer,n):"";i.length&&(o.ph_keyword=i)}return o}function Xst(){return navigator.language||navigator.userLanguage}function GBn(){const t=Xst();return typeof t=="string"?t.split("-")[0]:void 0}const rne="$direct";function $st(){return No?.referrer||rne}function Zst(t,e,n=!1){const o=t?[...kk,...e||[]]:[],i=n?rQ(sd?.href):sd?.href,r=i?.substring(0,1e3);return{r:$st().substring(0,1e3),u:r?lV(r,o,gV):void 0}}function eat(t,e=!1){var n;const{r:o,u:i}=t,r=e?rQ(i):i,s={$referrer:o,$referring_domain:o==null?void 0:o==rne?rne:(n=x8(o))===null||n===void 0?void 0:n.host};if(r){s.$current_url=r;const a=x8(r);s.$host=a?.host,s.$pathname=a?.pathname;const A=jst(r);jg(s,A)}if(o){const a=qst(o);jg(s,a)}return s}function tat(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function YBn(){try{return new Date().getTimezoneOffset()}catch{return}}const UBn={flags:lQ,surveys:$te},KBn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],sne=t=>`${t}_cookie_identity_change_pending`,ane=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",E8=[k4,C8,MM,sQ,DM,lQ,XK,aQ],w2e=t=>E8.indexOf(t)!==-1,nat=[Sk,jK],oat=t=>nat.indexOf(t)!==-1,gQ=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch{return t===e}},Fk=t=>{if(!t)return{};const e=JSON.parse(t);return xA(e)?e:{}},iat=(t,e)=>{vl(t,(n,o)=>{const i=Kf(o);i&&i.exposure!=="event"||{}.hasOwnProperty.call(e,o)||delete t[o]})};var P2e=class{constructor(e,n,o=!0){if(this.Qo={},this.Jo=!1,this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=new Map,this.ia=!1,this.na=!1,this.sa=!1,this.ra=new Set,this.oa=new Set,this.Ir=e,this.aa=o,this.props={},this.la=void 0,this.ua=(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.hi=e.disable_persistence||!!n,this.No=this.ha(e),this.Xo=this.ca(e),this.load(),this.da(),e.debug&&gi.info("Persistence loaded",e.persistence,sn({},this.props)),this.update_config(e,e,n),this.save(),Fn){const i=()=>this.flush();jc(Fn,"beforeunload",i,{capture:!1}),jc(Fn,"pagehide",i,{capture:!1}),this.va=r=>{if(this.Jo&&(!r.storageArea||r.storageArea===Fn?.localStorage)&&r.key)if(r.key!==this.ua){if(this.Xo){const s=cV.find(a=>r.key===this.fa(a));s&&this.pa(r.key,s)}}else this.pa(r.key,Um)},jc(Fn,"storage",this.va)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([n,o])=>{const i=this.ea.get(n);if(!w2e(n)||i===!0)return;if(o===!0)return void this.ga(n,!0);const r=new Set(i||[]);o.forEach(s=>r.add(s)),r.size&&this.ga(n,r)})}onCrossTabFeatureFlagChange(e){return this.oa.add(e),()=>this.oa.delete(e)}destroy(){this.va&&Fn&&(Fn.removeEventListener("storage",this.va),this.va=void 0),this.oa.clear()}pa(e,n,o=!0){if(this.hi)return!1;let i,r;try{if(r=uc.Ot(e),ad(r)){const A=this.ma(n);return A.storageValue=null,n!==Um&&(A.persisted=!1),!1}i=Fk(r)}catch{return!1}const s=n===Um?i:uc.Dt(this.ua);if(s&&this.ya(s))return!1;const a=this.ba(i,n,o);return n===Um&&this.Xo&&!gQ(this._a().main,i)||this.wa(i,n,!0,r),a}ya(e){const n=this.props[T4],o=e[T4];return!Eo(n)&&!Eo(o)&&n!==o}wa(e,n,o,i){const r=this.ma(n);r.storageValue=i,n!==Um&&(r.persisted=o);try{r.fingerprint=this.ka(e,n)}catch{r.fingerprint=void 0}}ba(e,n,o){let i=!1;return E8.forEach(r=>{var s;const a=(s=Kf(r))===null||s===void 0?void 0:s.storageGroup;if(n===Um&&this.Xo&&a||n!==Um&&a!==n)return;const A=r in e,c=this.Sa(r,A?e[r]:void 0),l=this.ea.has(r)?r in this.props:A;l===r in this.props&&gQ(c,this.props[r])||(l?this.xa(r,c,!1):this.Ca(r,!1),i=!0)}),i&&o&&this.oa.forEach(r=>r()),i}$a(){if(!this.Jo)return!1;try{this.sa=!1;const e=uc.Ot(this.ua),n=this.ma(Um);let o,i=!1,r=!1;if(e!==n.storageValue)if(ad(e))n.storageValue=null;else{if(o=Fk(e),this.sa=!this.na&&this.ya(o),this.sa)return!1;r=this.ba(o,Um,!1),!this.Xo||gQ(this._a().main,o)?this.wa(o,Um,!0,e):n.storageValue=e,i=!0}return this.Xo&&cV.forEach(s=>{const a=uc.Ot(this.fa(s)),A=this.ma(s),c=o||{},l=i&&E8.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.ba(c,s,!1)||r));const g=Fk(a);r=this.ba(g,s,!1)||r,this.wa(g,s,!0,a)}),r}catch{return!1}}ga(e,n){this.ea.set(e,n);const o=Kf(e);o?.volatile||(this.ma((this.Xo?o?.storageGroup:void 0)||Um).fingerprint=void 0,this.Ta(e))}Ia(){E8.forEach(e=>this.ea.set(e,!0))}da(){if(this.Jo)try{const e=uc.Ot(this.ua),n=Fk(e);this.ma(Um).storageValue=e,E8.forEach(o=>{var i;const r=this.Xo?(i=Kf(o))===null||i===void 0?void 0:i.storageGroup:void 0,s=r?uc.Ot(this.fa(r)):null;if(r){const A=this.ma(r);A.storageValue=s,A.persisted=!ad(s)}const a=r&&!ad(s)?Fk(s):n;o in this.props?this.Ma(o,a[o],this.props[o]):o in a&&this.ga(o,!0)})}catch{}}Sa(e,n){const o=this.ea.get(e);if(!o)return n;if(o===!0)return this.props[e];if(e==="$active_feature_flags"){const s=new Set(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}Ma(e,n,o){if(!w2e(e))return;const i=this.ea.get(e);if(i===!0)return;let r=n;if(this.Jo)try{var s;const A=this.Xo?(s=Kf(e))===null||s===void 0?void 0:s.storageGroup:void 0,c=A?this.fa(A):this.ua;r=Fk(uc.Ot(c))[e]}catch{}const a=new Set(i||[]);if(e==="$active_feature_flags"){if(!Eo(n)&&!As(n)||!Eo(r)&&!As(r)||!As(o))return void this.ga(e,!0);const A=new Set(n||[]),c=new Set(r||[]),l=new Set(o);new Set([...A,...l]).forEach(g=>{A.has(g)!==l.has(g)&&a.add(g)}),a.forEach(g=>{c.has(g)===l.has(g)&&a.delete(g)})}else{if(!xA(o))return void(gQ(r,o)?this.ea.delete(e):this.ga(e,!0));{if(!Eo(n)&&!xA(n)||Eo(n)&&nx(o)&&Eo(r))return void this.ga(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&&gQ(A[l],o[l])||a.add(l)}),a.forEach(l=>{l in c==l in o&&gQ(c[l],o[l])&&a.delete(l)})}}a.size?this.ga(e,a):this.ea.delete(e)}Ea(){var e;const n=(e=this.Ir)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return qd(n)&&n>0?n:0}Pa(e){if(this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const n=I2e(e,this.Ir.cookie_persisted_properties||[]),o=yst(n,this.Ir.cookie_persisted_properties||[]),i=JSON.stringify(n)+"|"+JSON.stringify(o),r=cd.Ot(this.ua)||void 0;r&&C2e(this.ua,r)===i&&(this.Ra=i,this.Aa=r)}catch{}else try{const n=cd.Ot(this.ua)||void 0;this.Ra=n?C2e(this.ua,n):void 0,this.Aa=n}catch{}}syncCookieProperties(){return this.Fa(this.Ir)}Fa(e,n=!1){if(this.hi&&!n||this.ta||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let o;try{o=cd.Ot(this.ua)||void 0}catch{}if(!o||o===this.Aa)return!1;const i=C2e(this.ua,o);let r;try{r=f2e(JSON.parse(o))}catch{return!1}if((cd.Ot(this.ua)||void 0)!==o)return!1;this.Ra=i,this.Aa=o;const s=xst(this.ua,o),a=[...RM,...s.properties],A={};if(Object.keys(r).forEach(m=>{const _=r[m];(Eo(_)||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[T4],u=l[py],h=jg({},l);[...RM,...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||RM.indexOf(m)===-1||_!==!1&&_!==0)&&delete h[m]}}),this.props=jg(h,r),E8.forEach(m=>{const _=m in this.props;m in l===_&&gQ(l[m],this.props[m])||(_?this.Ma(m,l[m],this.props[m]):this.ga(m,!0))}),!c||"$user_state"in r||"$user_state"in this.props||this.xa(py,y8);const d=this.props[T4],p=this.props[py];return!c||d===g&&p===u||(this.na=!0,this.Yo=!0,Z0.$t(sne(this.ua),!0),this.Ca(aQ),this.Ca(C8),this.Ca(k4),this.Ca(MM),this.Ca(sQ),this.Ca(DM),this.Ca(lQ),this.Ca(eV),this.Ca(cQ),p!=="anonymous"||u!=="identified"&&r.$user_state!=="anonymous"&&(Eo(g)||d===g)||(iat(this.props,r),this.Ca(AQ)),p==="identified"?this.props.$user_id=d:delete this.props.$user_id,this.Ca(Xte)),!0}consumeCookieIdentityChange(){const e=sne(this.ua),n=this.Yo||!!Z0.Ot(e);return this.Yo=!1,n&&Z0.Lt(e),n}Oa(e=!1){return!(this.ta||this.hi&&!e||!this.Ir.cookieWinsOnConflict||this.Ir.persistence.toLowerCase()!=="localstorage+cookie"||(this.ta=!0,0))}Da(){this.ta&&(Eo(this.La)||(clearTimeout(this.La),this.La=void 0),delete this.Qo[Um],this.Na(!0))}qa(e=!0){if(this.ta)try{e?this.Da():Eo(this.La)||(clearTimeout(this.La),this.La=void 0)}finally{this.ta=!1}}isDisabled(){return!!this.hi}ha(e){KBn.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=[...RM,...a];return sn(sn({},uc),{},{Dt(l){try{let u,h={};try{u=cd.Ot(l)||void 0,h=u?f2e(JSON.parse(u)):{}}catch{}const d=JSON.parse(uc.Ot(l)||"{}");let p;if(A){const m=xst(l,u),_=[...RM,...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[T4],y=(g=d.$user_state)!==null&&g!==void 0?g:y8;c.forEach(x=>{if(_.indexOf(x)!==-1&&!(x in h)&&(I||x!=="distinct_id"&&x!=="$user_state")){const E=d[x];(m.isValid||RM.indexOf(x)===-1||E!==!1&&E!==0)&&delete d[x]}}),!I||"$user_state"in h||"$user_state"in d||(d[py]=y8),!I||("distinct_id"in f?f[T4]:d[T4])===C&&("$user_state"in f?f[py]:d[py])===y||(_2e.forEach(x=>delete d[x]),f.$user_state==="identified"&&"distinct_id"in f?d.$user_id=f[T4]:delete d.$user_id,f.$user_state!=="identified"&&(delete d[Xrt],delete d[AQ]),delete d.__alias)}p=jg(d,f)}else p=jg(h,d);return uc.$t(l,p),p}catch{}return null},$t(l,g,u,h,d,p){const m=uc.$t(l,g,void 0,void 0,p);try{const _=I2e(g,a);if(Object.keys(_).length){if(A){const f=nne(l),I=yst(_,a);if(cd.$t(f,I,u,h,d,p),cd.Ot(f)!==JSON.stringify(I)){cd.Lt(f,h);const C=I2e(g);return cd.$t(l,C,u,h,d,p),m}}cd.$t(l,_,u,h,d,p)}}catch(_){uc.Pt(_)}return m},Lt(l,g){try{Fn?.localStorage.removeItem(l),cd.Lt(l,g),cd.Lt(nne(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=y2e:s==="cookie"&&cd.Et()?(o=cd,i=!0):n.Et()?(o=n,r=!0,i=!0):cd.Et()?(o=cd,i=!0):o=y2e,this.Jo=r,this.Ko=i,o}fa(e){return`${this.ua}__${e}`}ca(e){return this.Jo&&!!e.split_storage}properties(){const e={};return vl(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.hi&&!e)return;const n=this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie",o=n?uc.Dt(this.ua):null;let i={};if(n)try{i=f2e(cd.Dt(this.ua)),vl(i,(A,c)=>{(Eo(A)||ad(A)||A==="")&&delete i[c]})}catch{}const r=this.No.Dt(this.ua);if(r&&(this.props=jg({},r)),this.Xo&&this.ja(),n&&r){var s,a;const A=o?.[T4],c=(s=o?.$user_state)!==null&&s!==void 0?s:y8,l=r[T4],g=(a=r.$user_state)!==null&&a!==void 0?a:y8;if(l!==A||g!==c){this.Yo=!0,Z0.$t(sne(this.ua),!0);const u=jg({},this.props);_2e.forEach(d=>delete u[d]),g!=="anonymous"||c!=="identified"&&i.$user_state!=="anonymous"&&(Eo(A)||l===A)||(iat(u,i),delete u[AQ]),this.props=u;const h=new Set;_2e.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={};vl(this.props,(m,_)=>{var f;((f=Kf(_))===null||f===void 0?void 0:f.storageGroup)===d&&(p[_]=m)}),nx(p)?(uc.Lt(this.fa(d)),this.Qo[d]={}):uc.$t(this.fa(d),p)&&(this.Qo[d]={persisted:!0,fingerprint:this.ka(p,d)})})}}Z0.Ot(sne(this.ua))&&(this.Yo=!0)}ja(){for(const e of cV){const n=uc.Dt(this.fa(e));if(n&&!nx(n)){const o=this.ma(e);o.persisted=!0,this.Ba(e)||(o.fingerprint=this.ka(n,e)),this.Ha(e,n)||jg(this.props,n)}}}Ba(e){return Object.keys(this.props).some(n=>{var o;return((o=Kf(n))===null||o===void 0?void 0:o.storageGroup)===e})}Ha(e,n){const o=UBn[e];if(!o)return!1;const i=n[o],r=this.props[o];return qd(i)&&qd(r)&&r>i}refreshKey(e){var n;if(this.hi||this.ra.has(e))return;const o=this.Xo?(n=Kf(e))===null||n===void 0?void 0:n.storageGroup:void 0,i=o?uc.Dt(this.fa(o)):this.No.Dt(this.ua);if(i&&e in i)this.xa(e,i[e],!1);else{if(o){const r=this.No.Dt(this.ua);if(r&&e in r)return void this.xa(e,r[e],!1)}this.Ca(e,!1)}}save(){if(this.hi)return;const e=this.Ea();e>0?Eo(this.La)&&(this.La=setTimeout(()=>{this.La=void 0,this.Na()},e)):this.Na()}flush(){Eo(this.La)||(clearTimeout(this.La),this.La=void 0,this.Na())}Na(e=!1){if(this.hi||this.ta&&!e)return;e||(this.syncCookieProperties(),this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie"||nat.forEach(r=>this.refreshKey(r)));const n=!e&&!this.ia;n||(this.sa=!1);const o=!!n&&this.$a();if(this.sa)return void(this.Ir.debug&&gi.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Xo)return this.za(),void(o&&this.oa.forEach(r=>r()));const i=this.Ua(this.No,this.ua,this.props,Um);i==="written"&&this.Pa(this.props),i!=="failed"&&(this.ea.clear(),this.na=!1,this.ra.clear()),o&&this.oa.forEach(r=>r())}za(){const{main:e,groups:n}=this._a(),o=this.Ua(this.No,this.ua,e,Um);o==="written"&&this.Pa(e),o!=="failed"&&(this.na=!1,this.ra.clear(),E8.forEach(r=>{var s;!((s=Kf(r))===null||s===void 0)&&s.storageGroup||this.ea.delete(r)}));for(const r of cV){var i;const s=n[r];if(nx(s)&&!(!((i=this.Qo[r])===null||i===void 0)&&i.persisted)){E8.forEach(A=>{var c;((c=Kf(A))===null||c===void 0?void 0:c.storageGroup)===r&&this.ea.delete(A)});continue}const a=this.Ua(uc,this.fa(r),s,r);a!=="failed"&&E8.forEach(A=>{const c=Kf(A);c?.storageGroup!==r||a!=="written"&&c.volatile||this.ea.delete(A)})}}_a(){const e={},n={flags:{},surveys:{}};return vl(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}}ka(e,n){if(n===Um)return JSON.stringify(e)+"|"+this.Wa+"|"+this.Va+"|"+this.Ga;const o={};return vl(e,(i,r)=>{var s;o[r]=!((s=Kf(r))===null||s===void 0)&&s.volatile?"__volatile__":i}),JSON.stringify(o)}Ua(e,n,o,i){const r=this.ma(i);if(i!==Um&&!r.dirty&&!Eo(r.fingerprint))return"skipped";let s;try{if(s=this.ka(o,i),s===r.fingerprint)return r.dirty=!1,"skipped"}catch{s=void 0}return e.$t(n,o,this.Wa,this.Va,this.Ga,this.Ir.debug)?(r.dirty=!1,i!==Um&&(r.persisted=!0),Eo(s)||(r.fingerprint=s),this.Jo&&(r.storageValue=uc.Ot(n)),"written"):(this.Ir.debug&&gi.warn(`failed to persist storage entry "${n}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ia(),Eo(this.La)||(clearTimeout(this.La),this.La=void 0),this.No.Lt(this.ua,!1),this.No.Lt(this.ua,!0),!e&&this.aa)for(const n of cV)uc.Lt(this.fa(n));e?delete this.Qo[Um]:this.Qo={},this.Ra=void 0,this.Aa=void 0}clear(){this.remove(),this.props={}}register_once(e,n,o){if(xA(e)){this.syncCookieProperties(),Eo(n)&&(n="None"),this.Wa=Eo(o)?this.Za:o;let i=!1;if(vl(e,(r,s)=>{this.props.hasOwnProperty(s)&&this.props[s]!==n||(this.xa(s,r),i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(xA(e)){this.syncCookieProperties(),this.Wa=Eo(n)?this.Za:n;let o=!1;if(vl(e,(i,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==i||xA(i)||As(i))&&(this.xa(r,i),o=!0)}),o)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const n=typeof e=="string"?[e]:e;let o=!1;for(const i of n)i in this.props&&(this.Ca(i),o=!0);o&&this.save()}update_campaign_params(){const e=No?.URL;if(e===this.la)return;const n=Wst(this.Ir.custom_campaign_params,this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties),o=!nx(h2e(n));return o&&this.register(n),this.la=e,o?n:void 0}update_search_keyword(){this.register((function(){const e=No?.referrer;return e?qst(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:$st(),$referring_domain:No?.referrer&&((e=x8(No.referrer))===null||e===void 0?void 0:e.host)||rne},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=Zst(this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties,this.Ir.disable_capture_url_hashes);this.register_once({[vk]:this.Ko?{r:ane(e.r),u:e.u?ane(e.u):void 0}:e},void 0)}get_initial_props(){const e={};vl([nst,tst],o=>{const i=this.props[o];i&&vl(i,function(r,s){e["$initial_"+vye(s)]=r})});const n=this.props[vk];if(n){const o=(function(i,r=!1){const s=eat(i,r),a={};return vl(s,function(A,c){a[`$initial_${vye(c)}`]=A}),a})(n,this.Ir.disable_capture_url_hashes);jg(e,o)}return e}safe_merge(e){return vl(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.hi&&!A;A||this.Fa(n,c),this.Ir=e,!A&&(i||r||a)&&(this.Ra=void 0,this.Aa=void 0,this.Fa(sn(sn({},e),{},{cookie_persisted_properties:n.cookie_persisted_properties}),c));const l=s||a?this.ha(e):this.No;this.Qa();const g=this.ca(e),u=s||g!==this.Xo,h=!A&&(u||e.cross_subdomain_cookie!==this.Va||e.secure_cookie!==this.Ga)&&this.Oa(c);this.ia=u;try{if(this.Za=this.Wa=e.cookie_expiration,this.set_disabled(A),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),u){const d=this.props;this.clear(),this.No=l,this.Xo=g,this.props=d,this.save()}else a&&(this.No=l,A||(delete this.Qo[Um],this.Na()))}finally{this.ia=!1,h&&this.qa()}}Qa(){const e=this.props[vk];if(!this.Ko||!xA(e)||typeof e.r!="string")return;const n=ane(e.r),o=typeof e.u=="string"?ane(e.u):e.u;n===e.r&&o===e.u||this.xa(vk,sn(sn({},e),{},{r:n,u:o}))}set_disabled(e){this.hi=e,this.hi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Va&&(this.Va=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,n){const o=this.props.__timers||{};o[e]=n,this.xa($ye,o),this.save()}remove_event_timer(e){const n=this.props.__timers||{},o=n[e];return Eo(o)||(delete n[e],this.xa($ye,n),this.save()),o}get_property(e){return this.props[e]}set_property(e,n){this.xa(e,n),this.save()}xa(e,n,o=!0){var i;const r=this.props[e];this.props[e]=n,o&&(e!=="distinct_id"&&e!=="$user_state"||r===n||(this.na=!0),oat(e)&&!gQ(r,n)&&this.ra.add(e),this.Ma(e,r,n),!((i=Kf(e))===null||i===void 0)&&i.volatile||this.Ta(e))}Ca(e,n=!0){delete this.props[e],n&&(w2e(e)&&this.ga(e,!0),oat(e)&&this.ra.add(e),this.Ta(e))}Ta(e){var n;const o=(n=Kf(e))===null||n===void 0?void 0:n.storageGroup;o&&(this.ma(o).dirty=!0)}ma(e){return this.Qo[e]||(this.Qo[e]={})}};const D3={GZipJS:"gzip-js",Base64:"base64"},uV={Activation:"events",Cancellation:"cancelEvents"},M2e={Popover:"popover",API:"api",Widget:"widget"},N3={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},D2e={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},N2e={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 VBn={SHOWN:"product tour shown"},rat={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},sat=Ad("[RateLimiter]");var zBn=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=>{sat.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void sat.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=(qd(A.dropped)?A.dropped:0)+1;A.dropped=l,!this.lastEventRateLimited&&this.Ja(l)&&(A.dropped=0)}return this.lastEventRateLimited=c,(i=this.instance.persistence)===null||i===void 0||i.set_property("$capture_rate_limit",A),{isRateLimited:c,remainingTokens:A.tokens}}Ka(e){const n=this.instance.config.property_denylist;return!As(n)||!n.includes(e)}Xa(){var e;if(this.Ka("$current_url")&&this.Ka("$pathname")&&sd?.pathname)return`${(e=sd.origin)!==null&&e!==void 0?e:""}${sd.pathname}`}Ja(e){var n,o;const{captureEventsBurstLimit:i,captureEventsPerSecond:r}=this,s=this.Xa(),a=this.Ka("$session_id")?(n=(o=this.instance).get_session_id)===null||n===void 0?void 0:n.call(o):void 0,A=[`${e} event(s) dropped since the last warning`,s?`triggered on ${s}`:void 0,a?`session ${a}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${A}. Config is set to ${r} events per second and ${i} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}};const uQ=Ad("[RemoteConfig]");var aat=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}Ya(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()}tl(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return uQ.info("Using preloaded remote config",this.remoteConfig),void this.el(this.remoteConfig);if(this._instance.il())return void uQ.warn("Remote config is disabled. Falling back to local config.");this.Ya(e=>{if(!e)return uQ.info("No config found after loading remote JS config. Falling back to JSON."),void this.tl(n=>{this.el(n.json,n)});this.el(e)})}catch(e){uQ.error("Error loading remote config",e),this.el()}}el(e,n){!e&&n&&(n.statusCode===0?n.error||uQ.warn("Failed to fetch remote config from PostHog."):uQ.error("Failed to fetch remote config from PostHog."));try{this._instance.el(e?{ok:!0,config:e}:{ok:!1})}catch(i){uQ.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){uQ.error("Error loading feature flags",i)}}},m5=Uint8Array,ox=Uint16Array,Lk=Uint32Array,R2e=new m5([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]),T2e=new m5([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]),Aat=new m5([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),cat=function(t,e){for(var n=new ox(31),o=0;31>o;++o)n[o]=e+=1<<t[o-1];var i=new Lk(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]},lat=cat(R2e,2),k2e=lat[1];lat[0][28]=258,k2e[258]=28;for(var gat=cat(T2e,0)[1],uat=new ox(32768),ld=0;32768>ld;++ld){var Hk=(43690&ld)>>>1|(21845&ld)<<1;uat[ld]=((65280&(Hk=(61680&(Hk=(52428&Hk)>>>2|(13107&Hk)<<2))>>>4|(3855&Hk)<<4))>>>8|(255&Hk)<<8)>>>1}var dV=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]=uat[a[t[i]-1]++]>>>15-t[i];return s},kM=new m5(288);for(ld=0;144>ld;++ld)kM[ld]=8;for(ld=144;256>ld;++ld)kM[ld]=9;for(ld=256;280>ld;++ld)kM[ld]=7;for(ld=280;288>ld;++ld)kM[ld]=8;var cne=new m5(32);for(ld=0;32>ld;++ld)cne[ld]=5;var JBn=dV(kM,9),WBn=dV(cne,5),dat=function(t){return(t/8|0)+(7&t&&1)},hat=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var o=new(t instanceof ox?ox:t instanceof Lk?Lk:m5)(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},hV=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8,t[o+2]|=n>>>16},F2e=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 m5(0),0];if(i==1){var s=new m5(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=L2e(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 m5(h),d]},L2e=function(t,e,n){return t.s==-1?Math.max(L2e(t.l,e,n+1),L2e(t.r,e,n+1)):e[t.s]=n},pat=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]},pV=function(t,e){for(var n=0,o=0;e.length>o;++o)n+=t[o]*e[o];return n},H2e=function(t,e,n){var o=n.length,i=dat(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)},mat=function(t,e,n,o,i,r,s,a,A,c,l){B8(e,l++,n),++i[256];for(var g=F2e(i,15),u=g[0],h=g[1],d=F2e(r,15),p=d[0],m=d[1],_=pat(u),f=_[0],I=_[1],C=pat(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=F2e(E,7),Q=S[0],w=S[1],M=19;M>4&&!Q[Aat[M-1]];--M);var k,R,F,O,U=c+5<<3,Y=pV(i,kM)+pV(r,cne)+s,J=pV(i,u)+pV(r,p)+s+14+3*M+pV(E,Q)+(2*E[16]+3*E[17]+7*E[18]);if(Y>=U&&J>=U)return H2e(e,l,t.subarray(A,A+c));if(B8(e,l,1+(Y>J)),l+=2,Y>J){k=dV(u,h),R=u,F=dV(p,m),O=p;var ee=dV(Q,w);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[Aat[B]]);l+=3*M;for(var W=[f,y],q=0;2>q;++q){var oe=W[q];for(B=0;oe.length>B;++B)B8(e,l,ee[se=31&oe[B]]),l+=Q[se],se>15&&(B8(e,l,oe[B]>>>5&127),l+=oe[B]>>>12)}}else k=JBn,R=kM,F=WBn,O=cne;for(B=0;a>B;++B)if(o[B]>255){var se;hV(e,l,k[257+(se=o[B]>>>18&31)]),l+=R[se+257],se>7&&(B8(e,l,o[B]>>>23&31),l+=R2e[se]);var ie=31&o[B];hV(e,l,F[ie]),l+=O[ie],ie>3&&(hV(e,l,o[B]>>>5&8191),l+=T2e[ie])}else hV(e,l,k[o[B]]),l+=R[o[B]];return hV(e,l,k[256]),l+R[256]},jBn=new Lk([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qBn=(function(){for(var t=new Lk(256),e=0;256>e;++e){for(var n=e,o=9;--o;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),O2e=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function XBn(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=qBn[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 m5(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=H2e(I,C,g.subarray(y,x)):(I[y]=m,C=H2e(I,C,g.subarray(y,_)))}else{for(var E=jBn[u-1],B=E>>>13,S=8191&E,Q=(1<<h)-1,w=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 Lk(25e3),U=new ox(288),Y=new ox(32),J=0,ee=0,W=(y=0,0),q=0,oe=0;_>y;++y){var se=F(y),ie=32767&y,ge=M[se];if(w[ie]=ge,M[se]=ie,y>=q){var ue=_-y;if((J>7e3||W>24576)&&ue>423){C=mat(g,I,0,O,U,Y,ee,W,oe,y-oe,C),W=J=ee=0,oe=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,me=S,ye=ie-ge&32767;if(ue>2&&se==F(y-ye))for(var Me=Math.min(B,ue)-1,we=Math.min(32767,y),he=Math.min(258,ue);we>=ye&&--me&&ie!=ge;){if(g[y+le]==g[y+le-ye]){for(var Qe=0;he>Qe&&g[y+Qe]==g[y+Qe-ye];++Qe);if(Qe>le){if(le=Qe,_e=ye,Qe>Me)break;var ve=Math.min(ye,Qe-2),Pe=0;for(Ie=0;ve>Ie;++Ie){var Fe=y-ye+Ie+32768&32767,Re=Fe-w[Fe]+32768&32767;Re>Pe&&(Pe=Re,ge=Fe)}}}ye+=(ie=ge)-(ge=w[ie])+32768&32767}if(_e){O[W++]=268435456|k2e[le]<<18|gat[_e];var Be=31&k2e[le],ke=31&gat[_e];ee+=R2e[Be]+T2e[ke],++U[257+Be],++Y[ke],q=y+le,++J}else O[W++]=g[y],++U[g[y]]}}C=mat(g,I,m,O,U,Y,ee,W,oe,y-oe,C)}return hat(f,0,d+dat(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&&O2e(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),O2e(c,l-8,n.d()),O2e(c,l-4,o),c}const $Bn=!!Sye||!!YK,_at=new WeakMap,fat="text/plain";let G2e=0,lne=!1;const Iat=(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}`:""}`},mV=(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 vl(c,function(d,p){Eo(d)||Eo(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},Y2e=t=>{if(t.nl)return t.nl;const{data:e,compression:n}=t;if(!e)return;if(n===D3.GZipJS){const i=XBn((function(r){var s=r.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(r);for(var a=new m5(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 m5(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 hat(a,0,A)})(Rk(e)),{mtime:0});return{contentType:fat,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===D3.Base64){const i=(function(s){return s&&btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g,(a,A)=>String.fromCharCode(parseInt(A,16))))})(Rk(e)),r=(s=>"data="+encodeURIComponent(typeof s=="string"?s:Rk(s)))(i);return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}const o=Rk(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}},Cat=t=>{const e=()=>t.transport==="sendBeacon"?{url:mV(t.url,{compression:D3.Base64}),encodedBody:Y2e(sn(sn({},t),{},{compression:D3.Base64,nl:void 0}))}:{url:Iat(t.url,"compression"),encodedBody:Y2e(sn(sn({},t),{},{compression:void 0,nl:void 0}))};let n;try{n=Y2e(t)}catch(i){if(Srt(t.compression,Tk(t.url,"compression")))return gi.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return n&&Srt(t.compression,Tk(t.url,"compression"))&&!((o=n.body)instanceof ArrayBuffer?Vye(new Uint8Array(o)):ArrayBuffer.isView(o)&&Vye(new Uint8Array(o.buffer,o.byteOffset,o.byteLength)))?(lne=!0,e()):{url:t.url,encodedBody:n};var o},yat=t=>{try{return Cat(t)}catch(n){var e;return gi.error(n),void((e=t.callback)===null||e===void 0||e.call(t,{statusCode:0,error:n}))}},ZBn=(function(){var t=Wg(function*(e){const n=yield(function(i){return zye.apply(this,arguments)})(Rk(e.data),Ym.DEBUG,{rethrow:!0});if(!n)return e;const o=yield n.arrayBuffer();return sn(sn({},e),{},{nl:{contentType:fat,body:o,estimatedSize:o.byteLength}})});return function(e){return t.apply(this,arguments)}})(),e9n=/Failed to fetch|NetworkError|Load failed/i,xat=t=>t?.name==="TypeError"&&e9n.test(t?.message||""),Eat=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,Ute):void 0})(t());return Eo(e)?void 0:Math.min(e,3e4)}catch{return}},Bat=t=>{const e=yat(t);if(!e)return;const n=new Sye;_at.set(n,!0);const{url:o,encodedBody:i}=e;n.open(t.method||"GET",o,!0);const{contentType:r,body:s}=i??{};vl(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,Eat(()=>n.getResponseHeader("Retry-After")))}},n.send(s)},bat=t=>{const e=yat(t);if(!e)return;const{url:n,encodedBody:o}=e,{contentType:i,body:r,estimatedSize:s}=o??{},a=new Headers;vl(t.headers,function(d,p){a.append(p,d)}),i&&a.append("Content-Type",i);let A=null,c=!1;if(xit){const d=new xit;A={signal:d.signal,timeout:setTimeout(()=>{c=!0;try{d.abort(lrt("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"||xat(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=()=>{G2e-=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??(Eo(r)?0:void 0);d.keepalive=d.method==="POST"&&!t.sl&&d.keepalive!==!1&&d.body===r&&!Eo(p)&&p>=0&&52428.8>G2e+p,d.keepalive&&(u=p,G2e+=u),YK(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,Eat(()=>m.headers.get("Retry-After")))})).catch(m=>{h(),g(m)}).finally(h)}catch(d){h(),g(d)}},U2e=t=>{try{var e;const{url:n,encodedBody:o}=Cat(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 U2e(sn(sn({},t),{},{data:l(A.slice(0,c))})),void U2e(sn(sn({},t),{},{data:l(A.slice(c))}))}gi.warn(`Beacon of ~${s??0} bytes was rejected by the browser, falling back to ${YK?"fetch":"XHR"}`),YK?bat(sn(sn({},t),{},{sl:!0})):Bat(t)}catch(n){gi.warn("Beacon send failed",n)}},Sat=(t,e,n,o)=>{const i=o==="query"?e==="POST"?"sent_at":"_":void 0;return mV(n===D3.GZipJS?Iat(t,"compression"):t,sn(sn({},i?{[i]:Date.now().toString()}:{}),n===D3.GZipJS?{}:{compression:n}))},t9n=(()=>{const t=[];return YK&&t.push({transport:"fetch",method:bat}),Sye&&t.push({transport:"XHR",method:Bat}),F_?.sendBeacon&&t.push({transport:"sendBeacon",method:U2e}),t})();let Qat=!$Bn&&dy?.indexOf("MSIE")===-1&&dy?.indexOf("Mozilla")===-1;function vat(t,e,n){var o,i,r;n&&(e=sn(sn({},e),{},{callback:s=>n(s)})),t.__loaded?Qat?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,(Eo(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((s,a)=>{var A,c,l;const g=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"&&Eo(g.compression)&&g.data&&(g.compression=D3.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=Sat(g.url,g.method,g.compression,g.timestampMode);const h=t9n.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 _;xat(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===D3.GZipJS&&V5n&&typeof Promise<"u"&&!lne?ZBn(g).then(m=>{p(m)}).catch(m=>{if(Qrt(m))return lne=!0,void p(sn(sn({},g),{},{compression:void 0,url:Sat(s.url,s.method,void 0,s.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;const f="name"in _?String(_.name):"";return Qrt(_)||f===brt})(m)&&(lne=!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 n9n=class{constructor(e,n){this.rl=!0,this.ol=[],this.al=E9(n?.flush_interval_ms||3e3,250,5e3,gi.createLogger("flush interval"),3e3),this.ll=e}enqueue(e){this.ol.push(e),this.ul||this.hl()}unload(){this.cl();const e=this.ol.length>0?this.dl():{},n=Object.values(e);[...n.filter(o=>o.url.indexOf("/e")===0),...n.filter(o=>o.url.indexOf("/e")!==0)].map(o=>{this.vl(o,"sendBeacon")})}enable(){this.rl=!1,this.hl()}hl(){this.rl||(this.ul=setTimeout(()=>{if(this.cl(),this.ol.length>0){const e=this.dl();for(const n in e)this.vl(e[n])}},this.al))}vl(e,n){try{this.ll(e,n)}catch(o){gi.error(o)}}cl(){clearTimeout(this.ul),this.ul=void 0}dl(){const e={};return vl(this.ol,n=>{var o;const i=n,r=((i?i.batchKey:null)||i.url)+(i.batchGroup?`:${i.batchGroup}`:"");Eo(e[r])&&(e[r]=sn(sn({},i),{},{data:[]})),(o=e[r].data)===null||o===void 0||o.push(i.data)}),this.ol=[],e}};const o9n=["retriesPerformedSoFar"];var i9n=class{constructor(e){this._instance=e,this.fl=!1,this.pl=3e3,this.ol=[],this.ol=[],this.gl=!0,this.resume()}resume(){if(!Eo(Fn)&&"onLine"in Fn.navigator){if(this.gl=Fn.navigator.onLine,this.ml)return;this.ml=()=>{this.gl=!0,this.yl()},this.bl=()=>{this.gl=!1},jc(Fn,"online",this.ml),jc(Fn,"offline",this.bl)}}get length(){return this.ol.length}retriableRequest(e,n){let{retriesPerformedSoFar:o}=e,i=wrt(e,o9n);I8(o)&&(i.url=mV(i.url,{retry_count:o})),vat(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.ol.push({retryAt:r,requestOptions:e});let s=`Enqueued failed request for retry in ${i}`;navigator.onLine||(s+=" (Browser is offline)"),gi.warn(s),this.fl||(this.fl=!0,this._l())}_l(){if(this.wl&&clearTimeout(this.wl),this.ol.length===0)return this.fl=!1,void(this.wl=void 0);this.wl=setTimeout(()=>{this.gl&&this.ol.length>0&&this.yl(),this._l()},this.pl)}yl(){const e=Date.now(),n=[],o=this.ol.filter(i=>e>i.retryAt||(n.push(i),!1));if(this.ol=n,o.length>0)for(const{requestOptions:i}of o)this.retriableRequest(i)}unload(){this.wl&&(clearTimeout(this.wl),this.wl=void 0),this.fl=!1,Eo(Fn)||(this.ml&&(Fn.removeEventListener("online",this.ml),this.ml=void 0),this.bl&&(Fn.removeEventListener("offline",this.bl),this.bl=void 0));for(const{requestOptions:e}of this.ol)try{this._instance._send_request(sn(sn({},e),{},{transport:"sendBeacon"}))}catch(n){gi.error(n)}this.ol=[]}},r9n=class{constructor(e){this._instance=e,this.kl=()=>{var n,o,i,r;this.Sl||(this.Sl={});const s=this.scrollElement(),a=this.scrollY(),A=s?Math.max(0,s.scrollHeight-s.clientHeight):0,c=a+(s?.clientHeight||0),l=s?.scrollHeight||0;this.Sl.lastScrollY=Math.ceil(a),this.Sl.maxScrollY=Math.max(a,(n=this.Sl.maxScrollY)!==null&&n!==void 0?n:0),this.Sl.maxScrollHeight=Math.max(A,(o=this.Sl.maxScrollHeight)!==null&&o!==void 0?o:0),this.Sl.lastContentY=c,this.Sl.maxContentY=Math.max(c,(i=this.Sl.maxContentY)!==null&&i!==void 0?i:0),this.Sl.maxContentHeight=Math.max(l,(r=this.Sl.maxContentHeight)!==null&&r!==void 0?r:0)}}get xl(){return this._instance.config.scroll_root_selector}getContext(){return this.Sl}resetContext(){const e=this.Sl;return this.Sl=void 0,setTimeout(this.kl,0),e}startMeasuringScrollPosition(){jc(Fn,"scroll",this.kl,{capture:!0}),jc(Fn,"scrollend",this.kl,{capture:!0}),jc(Fn,"resize",this.kl)}scrollElement(){if(this.xl){const o=As(this.xl)?this.xl:[this.xl];for(const i of o){var e;const r=Fn==null||(e=Fn.document)===null||e===void 0?void 0:e.querySelector(i);if(r)return r}return}var n;return Fn==null||(n=Fn.document)===null||n===void 0?void 0:n.documentElement}Cl(e){var n,o;const i=e==="y"?"scrollTop":"scrollLeft";if(this.xl){const r=this.scrollElement();return r&&r[i]||0}return Fn?e==="y"?Fn.scrollY||Fn.pageYOffset||((n=Fn.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.scrollTop)||0:Fn.scrollX||Fn.pageXOffset||((o=Fn.document)===null||o===void 0||(o=o.documentElement)===null||o===void 0?void 0:o.scrollLeft)||0:0}scrollY(){return this.Cl("y")}scrollX(){return this.Cl("x")}};const s9n=t=>Zst(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes);var wat=class{constructor(e,n,o,i){this.qe=r=>{const s=this.$l();if(s&&s.sessionId===r)return;const a={sessionId:r,props:this.Tl(this._instance)};this.Il.register({[a2e]:a})},this._instance=e,this.Ml=n,this.Il=o,this.Tl=i||s9n,this.Ml.onSessionId(this.qe)}$l(){return this.Il.props[a2e]}getSetOnceProps(){var e;const n=(e=this.$l())===null||e===void 0?void 0:e.props;return n?"r"in n?eat(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 vl(h2e(this.getSetOnceProps()),(n,o)=>{o==="$current_url"&&(o="url"),e[`$session_entry_${vye(o)}`]=n}),e}},gne=class{on(e,n){return this.El[e]||(this.El[e]=[]),this.El[e].push(n),()=>{this.El[e]=this.El[e].filter(o=>o!==n)}}emit(e,n){for(const o of this.El[e]||[])o(n);for(const o of this.El["*"]||[])o(e,n)}constructor(){this.El={}}};const Ok=Ad("[SessionId]"),Pat=864e5;var Mat=class{on(e,n){return this.Pl.on(e,n)}constructor(e,n,o){var i;if(this.Rl=null,this.Al=null,this.Fl=[],this.Ol=void 0,this.Dl=!1,this.Pl=new gne,this.Ll=(s,a)=>!(!I8(s)||!I8(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.Ir=e.config,this.Il=e.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Nl=void 0,this._sessionActivityTimestamp=null,this.ql=n||F4,this.jl=o||F4;const r=this.Ir.persistence_name||this.Ir.token;if(this._sessionTimeoutMs=1e3*E9(this.Ir.session_idle_timeout_seconds||1800,60,36e3,Ok.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Bl(),this.Hl="ph_"+r+"_window_id",this.zl="ph_"+r+"_primary_window_exists",this.Ul()){const s=Z0.Dt(this.Hl),a=Z0.Dt(this.zl);s&&!a?this.je=s:Z0.Lt(this.Hl),Z0.$t(this.zl,!0)}!((i=this.Ir.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Ir.bootstrap.sessionID),this.Wl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Eo(this.Fl)&&(this.Fl=[]),this.Fl.push(e),this.Xt&&e(this.Xt,this.je),()=>{this.Fl=this.Fl.filter(n=>n!==e)}}Ul(){return this.Ir.persistence!=="memory"&&!this.Il.hi&&Z0.Et()}Vl(e){e!==this.je&&(this.je=e,this.Ul()&&Z0.$t(this.Hl,e))}Gl(){return this.je?this.je:this.Ul()?Z0.Dt(this.Hl):null}Zl(e){const n=this.Rl;return!ad(n)&&!ad(e)&&5e3>Math.abs(e-n)}Ql(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.Zl(n)||(this.Rl=n,this.Il.register({[Qk]:[n,e,o]}))}Jl(){var e;const n=(e=this.Ir)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return I8(n)&&n>0}Kl(){this.Jl()?this.Il.refreshKey(Qk):(this.Il.flush(),this.Il.load())}Xl(){var e;if(ad(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Rl)return;this.Kl();const[,n,o]=this.Yl();n===this.Xt&&o===this._sessionStartTimestamp&&(this.Rl=this._sessionActivityTimestamp,this.Il.register({[Qk]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Il.flush())}tu(){const[e]=this.Yl(),n=I8(e)?e:0,o=I8(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,o)}eu(e){return this.Kl(),this.Ll(e,this.tu())}Yl(){const e=this.Il.props[Qk];return As(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Rl=null,this.Nl=void 0,clearTimeout(this.iu),this.iu=void 0,this.Ql(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 Ok.error("Bootstrap sessionID cannot be in the future"):s}catch(s){return void Ok.error("Invalid sessionID in bootstrap",s)}})(e);return!Eo(o)&&(n?this.Nl={sessionId:e,sessionStartTimestamp:o}:this.Ql(e,new Date().getTime(),o),!0)}destroy(){this.Dl=!0,this.Xl(),clearTimeout(this.iu),this.iu=void 0,this.Ol&&Fn&&(Fn.removeEventListener(ene,this.Ol,{capture:!1}),this.Ol=void 0),this.Fl=[]}Wl(){this.Ol=()=>{this.Xl(),this.Ul()&&Z0.Lt(this.zl)},jc(Fn,ene,this.Ol,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,n=null,o=!1){if(this.Ir.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const i=n||new Date().getTime(),r=this.Xt;if(o)this.Al=i;else if(ad(this.Al)||this.Al>i||i-this.Al>=1e3){var s,a;(s=(a=this.Il).syncCookieProperties)===null||s===void 0||s.call(a),this.Al=i}let[,A,c]=this.Yl();const l=!Eo(r)&&A!==r,g=this.tu();let u=this.Gl();const h=this.Nl,d=!!h&&(h.sessionStartTimestamp>i+6e4||i-h.sessionStartTimestamp>Pat),p=h?d:I8(c)&&Math.abs(i-c)>Pat;let m=!1,_=l,f=!A||!!h;const I=A;let C=!f&&!e&&this.Ll(i,g);if(C&&(C=this.eu(i),C||Ok.info("cross-tab refresh kept the session alive",{sessionId:A}),[,A,c]=this.Yl(),C||(f=!A||!!h)),f||C||p){_=!1;const B=h&&!d;A=B?h.sessionId:this.ql(),u=this.jl(),Ok.info("new session ID assigned",{sessionId:A,windowId:u,bootstrapped:!!B,changeReason:{noSessionId:f,activityTimeout:C,sessionPastMaximumLength:p}}),c=B?h.sessionStartTimestamp:i,this.Nl=void 0,m=!0}else u||(u=this.jl(),m=!0),_=_||A!==I,_&&(Ok.info("adopted cross-tab session id",{sessionId:A,windowId:u}),m=!0);const y=I8(g)&&e&&!p?g:i,x=I8(c)?c:new Date().getTime();this.Vl(u),this.Ql(A,y,x),e||this.Bl();const E={noSessionId:f,activityTimeout:C,sessionPastMaximumLength:p,crossTabAdoption:_};return m&&this.Fl.forEach(B=>B(A,u,E)),{sessionId:A,windowId:u,sessionStartTimestamp:x,changeReason:m?E:void 0,lastActivityTimestamp:g}}Bl(){this.Dl||(clearTimeout(this.iu),this.iu=setTimeout(()=>{if(!this.Dl)if(this.eu(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Pl.emit("forcedIdleReset",{idleSessionId:e})}else this.Bl()},1.1*this.sessionTimeoutMs))}};const Dat=function(t,e){if(!t)return!1;const n=t.userAgent;if(n&&wit(n,e))return!0;try{const o=t?.userAgentData;if(o?.brands&&o.brands.some(i=>wit(i?.brand,e)))return!0}catch{}return!!t.webdriver};function Nat(){return(Nat=Wg(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 a9n(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 Rat(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 une=(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}},dne=t=>t.toLowerCase(),Tat={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=>une(n,o))),not_regex:(t,e)=>e.every(n=>t.every(o=>!une(n,o))),icontains:(t,e)=>e.map(dne).some(n=>t.map(dne).some(o=>n.includes(o))),not_icontains:(t,e)=>e.map(dne).every(n=>t.map(dne).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 kat(t,e){return!t||Object.entries(t).every(([n,o])=>{const i=e?.[n];if(i==null)return!1;const r=Tat[o.operator];return!!r&&r(o.values.map(String),[String(i)])})}function K2e(t,e,n){return Rk({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}const V2e="custom",Fat="i.posthog.com",A9n=/^\/static\//,c9n=["/s/","/e/","/i/"];var l9n=class{constructor(e){this.nu={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let n=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace(`.${Fat}`,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.nu[this.apiHost]||(this.nu[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":V2e),this.nu[this.apiHost]}su(e){if(!A9n.test(e))return;const n=this.instance.config.asset_host;return typeof n=="string"&&n.trim().replace(/\/$/,"")||void 0}ru(e){const n=x8(e);return n?n.protocol+"//"+n.host+n.pathname:void 0}ou(e,n,o){if(e==="ui")return o;let i=o;const r=this.instance.config.rewriteRequestPath;if(r){var s;const a=((s=x8(o))===null||s===void 0?void 0:s.href)||o;i=r(new URL(a)).toString()}if(r&&e==="api"&&c9n.some(a=>n.indexOf(a)===0)){const a=this.ru(i);if(a){const A=this.apiHost;let c=this.au;c?.apiHost===A&&c.rewriteRequestPath===r||(c={apiHost:A,rewriteRequestPath:r,urls:new Set},this.au=c),c.urls.add(a)}}return i}isIngestionEndpoint(e){const n=this.au,o=this.ru(e);return n?.apiHost===this.apiHost&&n.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!o&&n.urls.has(o)}endpointFor(e,n=""){if(n&&(n=n[0]==="/"?n:`/${n}`),e==="ui")return this.ou(e,n,this.uiHost+n);if(e==="flags")return this.ou(e,n,this.flagsApiHost+n);if(e==="assets"){const i=this.su(n);if(i)return this.ou(e,n,`${i}${n}`)}if(this.region===V2e)return this.ou(e,n,this.apiHost+n);const o=Fat+n;switch(e){case"assets":return this.ou(e,n,`https://${this.region}-assets.${o}`);case"api":return this.ou(e,n,`https://${this.region}.${o}`)}}};const _l=Ad("[Surveys]"),Lat=t=>{try{const e=(n=>((o,i)=>`seenSurvey_${(function(r){return r.current_iteration&&r.current_iteration>0?`${r.id}_${r.current_iteration}`:r.id})(i)}`)(0,n))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(e){_l.error("Failed to persist survey seen state",e)}},g9n=[M2e.Popover,M2e.Widget,M2e.API],u9n={ignoreConditions:!1,ignoreDelay:!1,displayType:N2e.Popover},d9n=Ad("[PostHog ExternalIntegrations]"),h9n={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var p9n=class{constructor(e){this._instance=e}Ho(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 d9n.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.Ho(h9n[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())}}},m9n=class{constructor(e,n){this.A=e,this.bo=n,this.lu=new Map,this.To=!1}add(e){var n=this;return Wg(function*(){if(n.To)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.lu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);n.lu.set(e.name,e);try{const o=e.setup(n.bo);o&&(yield o)}catch(o){const i=n.lu.get(e.name)===e;i&&n.lu.delete(e.name),n.A.error(`Failed to set up browser extension "${e.name}"`,o),i&&n.uu(e)}})()}getExtension(e){return this.lu.get(e)}dispose(){if(this.To)return;this.To=!0;const e=Array.from(this.lu.values()).reverse();this.lu.clear();for(const n of e)this.uu(n)}uu(e){try{var n;const o=(n=e.dispose)===null||n===void 0?void 0:n.call(e);o&&L_(o.then)&&o.then(void 0,i=>{this.A.error(`Failed to dispose browser extension "${e.name}"`,i)})}catch(o){this.A.error(`Failed to dispose browser extension "${e.name}"`,o)}}},_9n=class{constructor(e){this._instance=e}initialize(){}get(e){const n=this._instance.persistence;if(typeof e=="string")return n?.get_property(e);const o={};for(const i of e){const r=n?.get_property(i);Eo(r)||(o[i]=r)}return o}set(e,n){var o;(o=this._instance.persistence)===null||o===void 0||o.register(typeof e=="string"?{[e]:n}:e)}remove(e){var n;(n=this._instance.persistence)===null||n===void 0||n.unregister(e)}};const Hat="extensionsRemoteConfig";var f9n=class{constructor(e){this.instance=e,this.To=!1,this.A=gi,this.hu=e.cu,this.kv=new _9n(e),this.onEvent=n=>Ane(this.instance.on("eventCaptured",o=>{try{n({event:o.event,properties:o.properties})}catch(i){this.A.error("Browser extension event listener failed",i)}})),this.onRemoteConfig=n=>{if(this.To)return Ane(()=>{});const o=r=>{try{n(r)}catch(s){this.A.error("Browser extension remote config listener failed",s)}},i=this.instance.du.on(Hat,o);return this.hu&&o(this.hu),Ane(i)},this.vu=new m9n(gi.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property(qye);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.vu.add(e)}getExtension(e){return this.vu.getExtension(e)}capture(e,n,o){o?this.instance.capture(e,n,{timestamp:o.timestamp,uuid:o.uuid,$set:o.set,$set_once:o.setOnce}):this.instance.capture(e,n)}registerDynamicEventProperties(e){return Ane(this.instance.fu(e))}handleRemoteConfig(e){this.To||(this.hu=e,this.instance.du.emit(Hat,e))}sendRequest(e){var n=this;return Wg(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?mV(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"?Qye.Base64:void 0,timestampMode:i.sentAt};return i.transport==="sendBeacon"?(n.instance._send_request(a),{statusCode:202}):new Promise(A=>{a.callback=A,n.instance._send_request(a)})}).apply(this,arguments)}dispose(){this.To||(this.To=!0,this.vu.dispose())}};const _V={};let z2e=0;const fV=()=>{},Oat='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Gk="Surveys module not available",Gat="sanitize_properties is deprecated. Use before_send instead",Yat="Invalid value for property_denylist config: ",I9n=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],C9n=["$feature_flag_called","$$heatmap","$snapshot"],Uat=t=>t.charAt(0)==="$"&&!as(C9n,t),y9n=/^[A-Za-z0-9_-]{1,400}$/,Kat=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Vat=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,x9n=["token","distinct_id",ost],IV="posthog",E9n=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},J2e=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:CBn(No?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:fV,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:(Fn==null||(e=Fn.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:dst,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:fV},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:vBn,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:E9n(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))},B9n=[["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"]],zat=t=>{const e={};for(const[i,r]of B9n)Eo(t[i])||(e[r]=t[i]);const n=jg({},e,t),o=t.__preview_external_dependency_versioned_paths;return Eo(o)||(Eo(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),nA(o)&&Eo(t.asset_host)&&(n.asset_host=o)),As(t.property_blacklist)&&(Eo(t.property_denylist)?n.property_denylist=t.property_blacklist:As(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:gi.error(Yat+t.property_denylist)),n};var b9n=class{constructor(){this.__forceAllowLocalhost=!1}get pu(){return this.__forceAllowLocalhost}set pu(e){gi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},CV=class BM{gu(e){if(!e)return;const n=this.lu.indexOf(e);n!==-1&&this.lu.splice(n,1)}mu(e,n){var o;return this.gu(e),this.lu.push(n),(o=n.initialize)===null||o===void 0||o.call(n),n}yu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}bu(){if(this._u||this.config.reuseAnonymousId||this.config.segment||this.yu())return;const e=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!e&&!this.config.disable_persistence||this.wu)return;let n,o,i;e?(n=`persistence is set to '${this.config.persistence}'`,o=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(n="persistence is disabled (disable_persistence is true)",o="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._u=!0,console.warn("[PostHog.js]",`${n} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${o}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${i}`)}ku(){if(this.yu()||this.get_distinct_id()!=="$posthog_cookieless")return;const e=this.persistence;if(!e)return;this.Su()||e.load(!0);const n=this.get_distinct_id();if(!n||n==="$posthog_cookieless"){const o=this.config.get_device_id(F4());this.register({distinct_id:o,$device_id:o}),e.set_property(py,y8)}this.xu()}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.Cu=!1,this.$u=!1,this.webPerformance=new b9n,this.Tu=!1,this.version=Ym.LIB_VERSION,this.Iu=new Set,this.Mu="",this.du=new gne,this.lu=[],this.Eu=[],this.Pu=!1,this.wu=!1,this._u=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=J2e(),this.SentryIntegration=kBn,this.sentryIntegration=o=>(function(i,r){const s=Kst(i,r);return{name:Ust,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 r9n(this),this.pageViewManager=new Vst(this),this.rateLimiter=new zBn(this),this.requestRouter=new l9n(this),this.consent=new QBn(this),this.externalIntegrations=new p9n(this);const n=(e=BM.__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!==IV){var i;const r=(i=_V[o])!==null&&i!==void 0?i:new BM;return r._init(e,n,o),_V[o]=r,_V[IV][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=J2e(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=J2e(n.defaults),l=zat(n),g=jg({},c,l,{name:o,token:a});xA(c.rageclick)&&xA(l.rageclick)&&(g.rageclick=jg({},c.rageclick,l.rageclick)),xA(c.session_recording)&&xA(l.session_recording)&&(g.session_recording=jg({},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:D3.GZipJS;const u=this.Su();if(this.persistence=new P2e(this.config,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new P2e(sn(sn({},this.config),{},{persistence:"sessionStorage"}),u,!1),this.Mu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!u&&Z0.Et()){const _=Z0.Dt(this.Mu);As(_)&&_.forEach(f=>{nA(f)&&this.Iu.add(f)})}else Z0.Lt(this.Mu);const h=sn({},this.persistence.props),d=sn({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new n9n((_,f)=>this.ju(_,f),this.config.request_queue_config),this.Bu=new i9n(this),this.__request_queue=[];const p=this.yu();p||(this.sessionManager=new Mat(this),this.sessionPropsManager=new wat(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.wu=!!m&&!KK(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(F4()),y=n.bootstrap.isIdentifiedID?C:_;this.persistence.set_property(py,n.bootstrap.isIdentifiedID?Zte:y8),this.register({distinct_id:_,$device_id:y})}}if(p)this.register_once({distinct_id:c2e,$device_id:null},"");else if(!this.get_distinct_id()){const _=this.config.get_device_id(F4());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(py,y8)}return jc(Fn,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),jc(Fn,"pageshow",()=>{var _;this.Cu=!1,this.$u||(_=this.Bu)===null||_===void 0||_.resume()}),n.segment?Yst(this,()=>this.Wu()):this.Wu(),L_(this.config._onCapture)&&this.config._onCapture!==fV&&(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 Nat.apply(this,arguments)})().then(_=>{_&&this.register({[Xye]:_})}).catch(fV),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.lu.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=BM.__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.du.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({},BM.__defaultExtensionClasses),this.config.__extensionClasses),i=[];var r,s,a,A,c,l,g;o.exceptions&&this.lu.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new o.exceptions(this)),o.historyAutocapture&&this.lu.push(this.historyAutocapture=new o.historyAutocapture(this)),o.tracingHeaders&&this.lu.push(this.tracingHeaders=new o.tracingHeaders(this)),o.siteApps&&this.lu.push(this.siteApps=new o.siteApps(this)),o.sessionRecording&&!e&&this.lu.push(this.sessionRecording=new o.sessionRecording(this)),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),o.autocapture&&this.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.lu.push(this.metrics=(A=this.metrics)!==null&&A!==void 0?A:new o.metrics(this)),o.conversations&&this.lu.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new o.conversations(this)),o.productTours&&this.lu.push(this.productTours=new o.productTours(this)),o.heatmaps&&this.lu.push(this.heatmaps=new o.heatmaps(this)),o.webVitalsAutocapture&&this.lu.push(this.webVitalsAutocapture=new o.webVitalsAutocapture(this)),o.exceptionObserver&&this.lu.push(this.exceptionObserver=new o.exceptionObserver(this)),o.deadClicksAutocapture&&this.lu.push(this.deadClicksAutocapture=new o.deadClicksAutocapture(this,TBn)),o.toolbar&&this.lu.push(this.toolbar=(l=this.toolbar)!==null&&l!==void 0?l:new o.toolbar(this)),o.experiments&&this.lu.push(this.experiments=(g=this.experiments)!==null&&g!==void 0?g:new o.experiments(this)),this.lu.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.lu.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({[ist]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[rst]:o}),this.config.__preview_deferred_init_extensions&&gi.info(`PostHog extensions initialized (${o}ms)`)}el(e){var n;if(!No||!No.body)return gi.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.el(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=e),this.cu=e,this.compression=void 0,e.ok){var o;const i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=as(i.supportedCompression,D3.GZipJS)?D3.GZipJS:as(i.supportedCompression,D3.Base64)?D3.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:dst}),(n=this.Xu)===null||n===void 0||n.handleRemoteConfig(e),this.lu.forEach(i=>{var r;return(r=i.onRemoteConfig)===null||r===void 0?void 0:r.call(i,e)})}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.yu())&&this.th()},1),this.eh=new aat(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()&&wk(this.__request_queue,e=>this.ju(e)),this.__request_queue=[],this.Yu()}_handle_unload(){var e,n,o,i,r,s;this.Cu=!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(hst),(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(hst,null,{transport:"sendBeacon"})}_send_request(e){vat(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){z2e++;try{let n;const o=[],i=[],r=[];wk(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){wk(a,function(c){try{if(As(c[0])){let l=A;vl(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{z2e--}}push(e){if(z2e>0&&As(e)&&nA(e[0])){const n=BM.prototype[e[0]];return void(L_(n)&&n.apply(this,e.slice(1)))}this._execute_array([e])}get nh(){return{property:Krt,persistenceKey:Sk,cookieName:"_fbc",pattern:Kat,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[Sk]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(Sk)}}}get sh(){return{property:Vrt,persistenceKey:jK,cookieName:"_fbp",pattern:Vat,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[jK]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(jK)}}}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.yu())return;const n=nV(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)&&Kat.test(n)?this.oh(r,n,s):void r.unregister();const a=nA(e)&&y9n.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)&&Vat.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(Eo(e)||!nA(e))return void gi.error("No event name provided to posthog.capture");this.ku();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=crt(o?.uuid,F4);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=_(Krt),I=_(Vrt),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!==mst,e===pst);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=[],wk(Y,W=>{ee.push(U(W))});else{const W={};vl(Ek(Y)?_st(Y):Y,(q,oe)=>{O.has(q)||(W[oe]=U(q))}),ee=W}return ee})(R)})(u,R=>nA(R)?R.slice(0,E):R)),u.timestamp=l,Eo(o?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=c),h&&(u.properties=((R,F=[])=>{const O={},U=Y=>{R[Y]!==void 0&&(O[Y]=R[Y])};return O4n.forEach(U),F.forEach(U),O})(u.properties,x9n)),e===N3.DISMISSED||e===N3.SENT){const R=n?.[D2e.SURVEY_ID],F=n?.[D2e.SURVEY_ITERATION];Lat({id:R,current_iteration:F}),u.$set=sn(sn({},u.$set),{},{[a9n({id:R,current_iteration:F},e===N3.SENT?"responded":"dismissed")]:!0})}else e===N3.SHOWN&&(u.$set=sn(sn({},u.$set),{},{[D2e.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var E;if(e===VBn.SHOWN){const R=n?.[rat.TOUR_TYPE];R&&(u.$set=sn(sn({},u.$set),{},{[`${rat.TOUR_LAST_SEEN_DATE}/${R}`]:new Date().toISOString()}))}const B=sn(sn({},u.properties.$set),u.$set);if(nx(B)||this.setPersonPropertiesForFlags(B),!Fs(this.config.before_send)){const R=this.Os(u);if(!R)return;u=R,u.uuid=crt(u.uuid,F4)}this.sessionRecording&&!this.Pu&&Uat(e)&&(this.Pu=!0,setTimeout(()=>this.Pu=!1,3e4));const S=C.filter(({channel:R,update:F})=>{var O,U,Y;const J=(O=(U=u.$set)===null||U===void 0?void 0:U[R.property])!==null&&O!==void 0?O: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.du.emit("eventCaptured",u);const Q=(i=o?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),w=o?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(Q),M=sn(sn(sn({method:"POST",url:Q,data:u,compression:"best-available",preferSyncCompression:o?.send_instantly,timestampMode:w?"body":"capture-body",batchKey:o?._batchKey},w&&(!((r=u.properties)===null||r===void 0)&&r.$session_id)?{batchGroup:u.properties.$session_id+(u.properties.$window_id?`-${u.properties.$window_id}`:"")}:{}),o?.transport?{transport:o.transport}:{}),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.Cu&&(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 f9n(this)}fu(e){this.Eu.push(e);let n=!0;return()=>{if(!n)return;n=!1;const o=this.Eu.indexOf(e);o!==-1&&this.Eu.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.Iu.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.yu()&&(a[ost]=!0),e==="$snapshot"){const f=sn(sn({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=f.distinct_id,(!nA(a.distinct_id)&&!qd(a.distinct_id)||KK(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?[...kk,...I||[]]:[],[w,M]=irt(dy),[k,R]=(function(se){for(let ie=0;srt.length>ie;ie++){const[ge,ue,Ie]=srt[ie],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={};Eo(C)||(O.detectGoogleSearchApp=C);const U={},Y=(x=navigator)===null||x===void 0||(x=x.userAgentData)===null||x===void 0?void 0:x.platform,J=(E=navigator)===null||E===void 0?void 0:E.maxTouchPoints,ee=Fn==null||(B=Fn.screen)===null||B===void 0?void 0:B.width,W=Fn==null||(S=Fn.screen)===null||S===void 0?void 0:S.height,q=Fn?.devicePixelRatio;Eo(Y)||(U.userAgentDataPlatform=Y),Eo(J)||(U.maxTouchPoints=J),Eo(ee)||(U.screenWidth=ee),Eo(W)||(U.screenHeight=W),Eo(q)||(U.devicePixelRatio=q);const oe=jg(h2e({$os:w,$os_version:M,$browser:nrt(dy,navigator.vendor,F,O),$webview_app:k,$webview_app_version:R,$device:rrt(dy),$device_type:A4n(dy,U),$timezone:tat(),$timezone_offset:YBn()}),{$current_url:lV(y?rQ(sd?.href):sd?.href,Q,gV),$host:sd?.host,$pathname:sd?.pathname,$raw_user_agent:dy.length>1e3?dy.substring(0,997)+"...":dy,$browser_version:a4n(dy,navigator.vendor,F,O),$browser_language:Xst(),$browser_language_prefix:GBn(),$screen_height:Fn?.screen.height,$screen_width:Fn?.screen.width,$viewport_height:Fn?.innerHeight,$viewport_width:Fn?.innerWidth,$lib:f8.LIB_NAME,$lib_version:f8.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return f8.SDK_DIST_CHANNEL&&(oe.$sdk_dist_channel=f8.SDK_DIST_CHANNEL),oe})(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&&jg(a,this.sessionPropsManager.getSessionProps());try{var c;if(this.sessionRecording){const f=this.sessionRecording.sdkDebugProperties,I=!this.Pu&&Uat(e);for(const C in f)(I||as(I9n,C))&&(a[C]=f[C])}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===V2e&&(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=jg(a,l),e==="$pageview"&&No&&(a.title=No.title),!Eo(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)),vl(["$referrer","$referring_domain"],f=>{f in g&&delete u[f]});const p={};if(this.Eu.length>0)for(const f of this.Eu.slice())try{jg(p,f())}catch(I){gi.error("Failed to produce browser extension event properties",I)}a=jg({},A,g,u,sn(sn({},p),a)),a.$is_identified=this._isIdentified(),As(this.config.property_denylist)?vl(this.config.property_denylist,function(f){delete a[f]}):gi.error(Yat+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const m=this.config.sanitize_properties;m&&(gi.error(Gat),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.Tu&&!o)return e;const r=this.persistence.get_initial_props(),s=(i=this.sessionPropsManager)===null||i===void 0?void 0:i.getSetOnceProps();let a=jg({},r,s||{},e||{});const A=this.config.sanitize_properties;return A&&(gi.error(Gat),a=A(a,"$set_once")),n&&(this.Tu=!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.Iu.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.Iu.delete(e),this.mh()}_h(e,n){this.register({[e]:n})}Hu(){this.Iu.forEach(e=>{var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(e)}),this.Iu.clear(),this.mh()}mh(){var e;if(!this.Mu)return;if(this.config.persistence==="memory"||!((e=this.sessionPersistence)===null||e===void 0)&&e.hi||!Z0.Et())return void Z0.Lt(this.Mu);const n=[];this.Iu.forEach(o=>n.push(o)),n.length>0?Z0.$t(this.Mu,n):Z0.Lt(this.Mu)}getFeatureFlag(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlagResult(e,n)}getAllFeatureFlags(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,n){var o,i;return(o=(i=this.featureFlags)===null||i===void 0?void 0:i.isFeatureEnabled(e,n))!==null&&o!==void 0?o:n?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)===null||e===void 0||e.reloadFeatureFlags()}updateFlags(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateFlags(e,n,o)}updateEarlyAccessFeatureEnrollment(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateEarlyAccessFeatureEnrollment(e,n,o)}getEarlyAccessFeatures(e,n=!1,o){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getEarlyAccessFeatures(e,n,o)}on(e,n){return this.du.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Gk}),()=>{})}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:Gk})}getActiveMatchingSurveys(e,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:Gk})}onActiveMatchingSurveysChanged(e){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(e):(e([],{isLoaded:!1,error:Gk}),()=>{})}renderSurvey(e,n){var o;(o=this.surveys)===null||o===void 0||o.renderSurvey(e,n)}displaySurvey(e,n=u9n){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:Gk}}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:Gk})}wh(e){return!e||KK(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(qd(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.ku();const i=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,s=this.gh(!1),a=this.persistence.Oa();let A=!1;try{const l=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property("__alias")&&(this.unregister(Xte),this.register({distinct_id:e}));const g=(this.persistence.get_property("$user_state")||"anonymous")===y8,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,Zte),this.setPersonPropertiesForFlags({$set:n||{},$set_once:o||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$identify",d,{$set:n||{},$set_once:o||{}})&&(this.Ou=K2e(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,Zte);const d=n||{},p=o||{};this.setPersonPropertiesForFlags({$set:d,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$set",{$set:d,$set_once:p})&&(this.Ou=K2e(e,n,o))}else(n||o)&&this.setPersonProperties(n,o);u||r||s?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(cQ)):h&&(n||o)&&this.reloadFeatureFlags(),A=!0}finally{a&&this.persistence.qa(A)}}setPersonProperties(e,n){if(!e&&!n||!this.bh("posthog.setPersonProperties"))return;const o=K2e(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(mst,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.il());const g=this.get_property(qye),u=this.get_property(Xye),h=this.get_property(qK);(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.Oa)===null||c===void 0?void 0:c.call(A);let m=!1;try{var _,f,I,C,y,x,E,B,S,Q,w,M,k;if((_=this.persistence)===null||_===void 0||_.clear(),(f=this.sessionPersistence)===null||f===void 0||f.clear(),this.Iu.clear(),this.mh(),Eo(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:c2e,$device_id:null},"");else{const O=this.config.get_device_id(F4());this.register_once({distinct_id:O,$device_id:e?O:g},""),e||Eo(u)||this.register({[Xye]:u})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),o&&(o.distinctID&&!this.yu()&&((k=this.persistence)===null||k===void 0||k.set_property("$user_state",o.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.distinctID})),(w=this.featureFlags)===null||w===void 0||w.initialize(),!Fs(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.qa)===null||F===void 0||F.call(R,m))}this.reloadFeatureFlags()}shutdown(e){var n=this;return Wg(function*(){var o,i,r,s,a,A,c,l;if(n.__loaded){n.$u=!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")?(Eo(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;jg(this.config,zat(e));const f=this.Su();(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 P2e(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.$t("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.il()),(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.xu(),(m=this.externalIntegrations)===null||m===void 0||m.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&Yst(this,fV,!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:BM.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:IV;return n!==IV&&(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.bu(),this._h(A2e,!0),!0)}Su(){if(this.config.cookieless_mode==="always")return!0;const e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}xu(){var e,n;const o=this.Su();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.hi)!==o&&((r=this.persistence)===null||r===void 0||r.set_disabled(o)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.hi)!==o&&((s=this.sessionPersistence)===null||s===void 0||s.set_disabled(o)),o&&(this.Iu.clear(),this.mh()),o}opt_in_capturing(e){var n;if(this.config.cookieless_mode!=="always"){if(this.yu()){var o,i,r,s,a,A;(o=this.sessionRecording)===null||o===void 0||o.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),(i=this.sessionManager)===null||i===void 0||i.destroy(),(r=this.pageViewManager)===null||r===void 0||r.destroy(),this.sessionManager=new Mat(this),this.pageViewManager=new Vst(this),this.persistence&&(this.sessionPropsManager=new wat(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=BM.__defaultExtensionClasses)===null||A===void 0?void 0:A.sessionRecording;var c,l;h&&(this.sessionRecording=this.mu(this.sessionRecording,new h(this)),this.cu&&((c=this.sessionRecording)===null||c===void 0||(l=c.onRemoteConfig)===null||l===void 0||l.call(c,this.cu)))}var g,u;this.consent.optInOut(!0),this.xu(),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()),(Eo(e?.captureEventName)||e?.captureEventName)&&this.capture((u=e?.captureEventName)!==null&&u!==void 0?u:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else gi.warn(Oat)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void gi.warn(Oat);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.xu(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:c2e,$device_id:null}),this.gu(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.xu()}_is_bot(){return F_?Dat(F_,this.config.custom_blocked_useragents):void 0}th(){No&&(No.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(d2e,{title:No.title},{send_instantly:!0}),this.Au&&(No.removeEventListener(tV,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),jc(No,tV,this.Au)))}debug(e){e===!1?(Fn?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Fn?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}il(){const e=this.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&&!Fs(n[o]),A=i in n&&!Fs(n[i]);return a?n[o]:!!A&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${o}' instead. The old field will be removed in a future major version.`),n[i])})(e,"advanced_disable_flags","advanced_disable_decide",0,gi)}Os(e){var n;if(Fs(this.config.before_send))return e;const o=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(q5n),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),Fs(r)){const a=`Event '${e.event}' was rejected in beforeSend function`;return j5n(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&&Fs(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.Wo)===null||e===void 0?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,o){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(o)})}Du(e){const n=hy(e)&&!e,o=uc.Et()&&uc.Ot("ph_debug")==="true";return!n&&(!!o||e)}};CV.__defaultExtensionClasses={},CV.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]]=fBn(t.prototype[e[n]])})(CV,["identify"]);var Jat=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 W2e="$copy_autocapture",j2e=Ad("[AutoCapture]");function q2e(t,e){return e.length>t?e.slice(0,t)+"...":e}function S9n(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do e=e.previousSibling;while(e&&!b9(e));return e}function Q9n(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(x2e(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=>!Nk(x)||sV(x)));const h=[],d={};let p,m=!1,_=!1;if(vl(c,x=>{const E=Nk(x);if(j1(x,"a")&&!n&&!i?.includes("href")){const B=x.getAttribute("href");m=!!(E&&B&&aV(B))&&(s?rQ(B):B)}as(Dk(x),"ph-no-capture")&&(_=!0),h.push((function(B,S,Q,w,M=!1){const k=B.tagName.toLowerCase(),R={tag_name:k};B2e.indexOf(k)>-1&&!Q&&(R.$el_text=k.toLowerCase()==="a"||k.toLowerCase()==="button"?q2e(1024,Lst(B)):q2e(1024,iV(B)));const F=Dk(B);S||w?.includes("class")||0>=F.length||(R.classes=F.filter(function(J){return J!==""})),vl(B.attributes,function(J){var ee;if((!sV(B)||["name","id","class","aria-label"].indexOf(J.name)!==-1)&&!w?.includes(J.name)&&!S&&aV(J.value)&&(!nA(ee=J.name)||ee.substring(0,10)!=="_ngcontent"&&ee.substring(0,7)!=="_nghost")){let W=J.value;J.name==="class"&&(W=E2e(W).join(" ")),R["attr__"+J.name]=q2e(1024,J.name==="href"&&M?rQ(W):W)}});let O=1,U=1,Y=B;for(;Y=S9n(Y);)O++,Y.tagName===B.tagName&&U++;return R.nth_child=O,R.nth_of_type=U,R})(x,n,o,i,s)),vl((function(B){if(!Nk(B))return{};const S={};return vl(B.attributes,function(Q){if(Q.name&&Q.name.indexOf("data-ph-capture-attribute")===0){const w=Q.name.replace("data-ph-capture-attribute-",""),M=Q.value;w&&M&&aV(M)&&(S[w]=M)}}),S})(x),(B,S)=>{({}).hasOwnProperty.call(d,S)||(d[S]=B)})}),_)return{props:{},explicitNoCapture:_};if(u>0&&(t=c[u],h.splice(0,u)),o||(h[0].$el_text=j1(t,"a")||j1(t,"button")?Lst(t):iV(t)),m){var f,I;h[0].attr__href=m;const x=(f=x8(m))===null||f===void 0?void 0:f.host,E=Fn==null||(I=Fn.location)===null||I===void 0?void 0:I.host;x&&E&&x!==E&&(p=m)}return{props:jg((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 w=sn(sn(sn(sn({},E.text?{text:E.text}:{}),{},{"nth-child":(B=E.nth_child)!==null&&B!==void 0?B:0,"nth-of-type":(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 tne(w).sort(([k],[R])=>(function(F,O){return O>F?-1:F>O?1:0})(k,R)).forEach(([k,R])=>M[Ost(k.toString())]=Ost(R.toString())),Q+=":",Q+=tne(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:NBn(E),attr_id:E.attr__id,nth_child:E.nth_child,nth_of_type:E.nth_of_type,attributes:{}};return tne(E).filter(([w])=>w.indexOf("attr__")===0).forEach(([w,M])=>Q.attributes[w]=M),Q})})(C)):"")},!((a=h[0])===null||a===void 0)&&a.$el_text?{$el_text:(A=h[0])===null||A===void 0?void 0:A.$el_text}:{},p&&e.type==="click"?{$external_click_url:p}:{},d),target:t};var C,y}var v9n=class{do(){this.vo=void 0,clearTimeout(this.fo),this.fo=void 0}po(e){var n;if(!Nk(e))return!0;const o=(n=this.mo().css_selector_ignorelist)!==null&&n!==void 0?n:Q2e,i=new Set;let r=e;for(;r;){if(i.size>=1e3||i.has(r))return!0;i.add(r);const s=r,a=Dk(s);if(as(a,"ph-no-capture")||as(a,"ph-sensitive")||sV(s)||o.some(c=>b2e(s,c)))return!0;const A=r.parentNode;r=x2e(A)?A.host:A&&b9(A)?A:null}return!1}yo(e){if(!this.isEnabled||e.type==="pointercancel")return void this.do();if(e.type==="pointerdown"){this.do();const i=rV(e);var n;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&b9(i)&&(this.vo={target:i,excluded:this.po(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(n=this.bo)===null||n===void 0?void 0:n.distinctId}))}const o=this.vo;o&&(e.pointerId!==o.id||Math.abs(e.clientX-o.x)>5||Math.abs(e.clientY-o.y)>5?this.do():e.type==="pointerup"&&(o.released=!0,this.fo=setTimeout(()=>this.do(),0)))}_o(e){var n;const o=this.vo;this.do();const i=rV(e);if(o?.released&&o.target.isConnected&&o.distinctId===((n=this.bo)===null||n===void 0?void 0:n.distinctId)&&e.pointerId===o.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-o.x)&&5>=Math.abs(e.clientY-o.y)&&i&&(j1(i,"html")||j1(i,"body"))){var r;if(o.excluded)return null;const s=(r=this.mo().css_selector_ignorelist)!==null&&r!==void 0?r:Q2e;return[i,No?.documentElement,No?.body].some(a=>{if(!a)return!1;const A=Dk(a);return as(A,"ph-no-capture")||as(A,"ph-sensitive")||!Nk(a)||sV(a)||s.some(c=>b2e(a,c))})?null:o.target}}constructor(e){this.wo=e,this.name="autocapture",this.ko=!1,this.So=null,this.xo=!1,this.Co=new Map,this.$o=!1,this.Ir={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.To=!1,this.wo.refresh(this.Ir),this.rageclicks=new Jat(this.Ir.rageclick),this.Io=null}setup(e){this.Mo(),this.bo=e;const n=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.To?n.dispose():(this.Eo=n,this.startIfEnabled())}dispose(){var e;this.To||(this.To=!0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.Co.clear(),this.Io=null,this.Po())}mo(){return this.wo.refresh(this.Ir),this.Ir}Mo(){var e,n;return this.mo(),this.Ir.url_allowlist=(e=this.Ir.url_allowlist)===null||e===void 0?void 0:e.map(o=>new RegExp(o)),this.Ir.url_ignorelist=(n=this.Ir.url_ignorelist)===null||n===void 0?void 0:n.map(o=>new RegExp(o)),this.Ir}Ro(){if(!this.isBrowserSupported())return void j2e.info("Disabling Automatic Event Collection because this browser is not supported");if(!Fn||!No)return;const e=this.Ao=n=>{n=n||Fn?.event;try{if(n.type==="blur")return void this.do();if(n.type.indexOf("pointer")===0)return void this.yo(n);const o=n.type==="click"?this._o(n):void 0;if(ad(o))return;this.Fo(n,"$autocapture",o)}catch(o){j2e.error("Failed to capture event",o)}};if(jc(Fn,"blur",e),jc(No,"submit",e,{capture:!0}),jc(No,"change",e,{capture:!0}),jc(No,"click",e,{capture:!0}),vl(["pointerdown","pointermove","pointerup","pointercancel"],n=>{jc(No,n,e,{capture:!0})}),this.mo().capture_copied_text){const n=this.Oo=o=>{o=o||Fn?.event;try{this.Fo(o,W2e)}catch(i){j2e.error("Failed to capture clipboard event",i)}};jc(No,"copy",n,{capture:!0}),jc(No,"cut",n,{capture:!0}),jc(No,"paste",n,{capture:!0})}}Po(){this.do(),this.Ao&&(Fn?.removeEventListener("blur",this.Ao),vl(["pointerdown","pointermove","pointerup","pointercancel"],e=>{No?.removeEventListener(e,this.Ao,!0)}),No?.removeEventListener("submit",this.Ao,!0),No?.removeEventListener("change",this.Ao,!0),No?.removeEventListener("click",this.Ao,!0),this.Ao=void 0),this.Oo&&(No?.removeEventListener("copy",this.Oo,!0),No?.removeEventListener("cut",this.Oo,!0),No?.removeEventListener("paste",this.Oo,!0),this.Oo=void 0),this.ko=!1}startIfEnabled(){this.isEnabled||this.do(),!this.To&&this.bo&&this.isEnabled&&!this.ko&&(this.Ro(),this.ko=!0)}onRemoteConfig(e){if(this.To)return;if(this.xo=!0,!e.ok)return void this.startIfEnabled();const n=e.config;n.elementsChainAsString&&(this.$o=n.elementsChainAsString);const o=n.autocapture_opt_out;var i;hy(o)&&((i=this.bo)===null||i===void 0||i.kv.set("$autocapture_disabled_server_side",o),this.So=o),this.startIfEnabled()}setElementSelectors(e,n=this){if(this.To)return;e.size?this.Co.set(n,new Set(e)):this.Co.delete(n);const o=new Set;this.Co.forEach(i=>{i.forEach(r=>o.add(r))}),this.Io=o}getElementSelectors(e,n){var o;const i=[];return(o=this.Io)===null||o===void 0||o.forEach(r=>{const s=No?.querySelectorAll(r);s?.forEach(a=>{e!==a&&n!==a||as(i,r)||i.push(r)})}),i}get isEnabled(){var e,n;if(this.To)return!1;const o=(e=this.bo)===null||e===void 0?void 0:e.kv.get(zrt),i=this.So,r=this.mo();if(!r.remoteRequestsDisabled&&!this.xo)return!1;const s=r.remoteRequestsDisabled&&!this.xo;if(ad(i)&&!hy(o)&&!s)return!1;const a=(n=this.So)!==null&&n!==void 0?n:!!o;return!!r.enabled&&!a}Fo(e,n="$autocapture",o){if(!this.isEnabled)return void this.do();let i=o||rV(e);bst(i)&&(i=i.parentNode||null);const r=this.Mo();var s;n==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&r.rageclick&&(!((s=this.rageclicks)===null||s===void 0)&&s.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&Dst(i,r.rageclick)&&this.Fo(e,"$rageclick",o);const a=n===W2e,A=a?sn(sn({},r),{},{dom_event_allowlist:void 0}):r;if(i&&(function(u,h,d,p,m,_){var f;if(!Fn||v2e(u)||d?.url_allowlist&&!Sst(d.url_allowlist,_)||d?.url_ignorelist&&Sst(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}=Nst(u,p);if(!(function(x,E){const B=E?.element_allowlist;if(Eo(B))return!0;for(const S of x)if(B.some(Q=>S.tagName.toLowerCase()===Q))return!0;return!1})(C,d)||!S2e(C,d?.css_selector_allowlist)||S2e(C,(f=d?.css_selector_ignorelist)!==null&&f!==void 0?f:Q2e))return!1;try{const x=Fn.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&&(B2e.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}=Q9n(i,{e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.$o,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(h)return!1;const p=this.getElementSelectors(i,d);if(p&&p.length>0&&(u.$element_selectors=p),n===W2e){const m=e.type||"clipboard";if(m!=="paste"){var l,g;const _=Fn==null||(l=Fn.getSelection())===null||l===void 0?void 0:l.toString(),f=Qst(_);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.bo)===null||c===void 0||c.capture(n,u),!0}}isBrowserSupported(){return L_(No?.querySelectorAll)}},w9n=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.il(),e.url_allowlist=o?.url_allowlist,e.url_ignorelist=o?.url_ignorelist,e.dom_event_allowlist=o?.dom_event_allowlist,e.element_allowlist=o?.element_allowlist,e.css_selector_allowlist=o?.css_selector_allowlist,e.css_selector_ignorelist=o?.css_selector_ignorelist,e.element_attribute_ignorelist=o?.element_attribute_ignorelist,e.capture_copied_text=o?.capture_copied_text}};const yV=Ad("[ExceptionAutocapture]"),Wat=()=>{},jat=t=>{var e;if(L_(t))return(e=t.__posthog_layer__)!==null&&e!==void 0?e:t.__rrweb_layer__};function xV(t,e,n){try{if(!(e in t))return Wat;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=jat(r);for(;s;){if(s.next===i)return void(s.next=o.next);r=s.next,s=jat(r)}}}catch{return Wat}}const P9n=Ad("[TracingHeaders]"),FM=Ad("[Web Vitals]"),qat=9e5,Xat=["CLS","FCP","INP","LCP"],M9n=["INP","LCP"],D9n=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],X2e="disabled",$at="lazy_loading",b8=Ad("[SessionRecording]"),N9n=[l2e,g2e,sst,ast,Ast,cst,lst,gst,ust],R9n=Ad("[Heatmaps]");function $2e(t){return xA(t)&&"clientX"in t&&"clientY"in t&&qd(t.clientX)&&qd(t.clientY)}const hne=Ad("[Product Tours]"),Z2e=t=>{var e;return!t.config.disable_product_tours&&!!(!((e=t.persistence)===null||e===void 0)&&e.get_property(i2e))},T9n=["$set_once","$set"],S9=Ad("[SiteApps]"),Zat="Error while initializing PostHog app with config id ",eAt=(t,e)=>t?.then?t.then(e):e(t),Yk="SDK is not enabled or survey functionality is not yet loaded",tAt="Disabled. Not loading surveys.";var k9n=class{constructor(e,n){this.wo=e,this.Th=n,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=!1,this.Eh=[],this.Ph=[],this.Rh=null,this.Ah=null,this.To=!1,this.Fh=new Set,this.onRemoteConfig=o=>{if(this.To||this.Ir.disableSurveys)return;if(!o.ok)return this.Mh=!0,this.Oh({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),_l.warn("Remote config unavailable. Not loading surveys.");const i=o.config.surveys;if(Fs(i))return _l.warn("Flags not loaded yet. Not loading surveys.");this.Dh=hy(i)?i:i.length>0,_l.info(`flags response received, isSurveysEnabled: ${this.Dh}`),this.loadIfEnabled()},this.Oh=o=>{this.Ph.slice().forEach(i=>this.Lh(i,o))}}setup(e){if(!this.To)return this.Nh=e,eAt(e.kv.initialize(),()=>{if(this.Nh!==e||this.To)return;this.Nh=void 0,this.bo=e;const n=e.onRemoteConfig(this.onRemoteConfig);this.To?n.dispose():(this.Eo=n,this.loadIfEnabled())})}dispose(){var e,n,o,i,r;this.To||(this.To=!0,this.Nh=void 0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,(n=this._surveyEventReceiver)===null||n===void 0||n.dispose(),this._surveyEventReceiver=null,(o=this._surveyManager)===null||o===void 0||(i=o.dispose)===null||i===void 0||i.call(o),this._surveyManager=null,this.Eh=[],this.Ph.forEach(s=>{s.active=!1}),this.Ph=[],(r=this.qh)===null||r===void 0||r.call(this),this.qh=void 0,this.Rh=null,this.Fh.forEach(s=>clearTimeout(s)),this.Fh.clear())}get Ir(){return this.wo.get()}initialize(){this.loadIfEnabled()}reset(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.clearInMemoryInProgressSurveyState)===null||n===void 0||n.call(e);try{var o;(o=this._surveyEventReceiver)===null||o===void 0||o.reset(),localStorage.removeItem("lastSeenSurveyDate");const i=[];for(let r=0;r<localStorage.length;r++){const s=localStorage.key(r);(s?.startsWith("seenSurvey_")||s?.startsWith("inProgressSurvey_"))&&i.push(s)}i.forEach(r=>localStorage.removeItem(r))}catch{}this.Oh()}loadIfEnabled(){if(this.To||!this.bo)return;const e=this.Ir;if(this._surveyManager)return;if(this.Ih)return void _l.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void _l.info(tAt);if(e.cookielessMode&&this.wo.isOptedOut())return void _l.info("Not loading surveys in cookieless mode without consent.");const n=this.wo.getExtensions();if(!n)return void this.jh("PostHog Extensions not found.");if(Eo(this.Dh)&&!e.advancedEnableSurveys)return;const o=this.Dh||e.advancedEnableSurveys;this.Ih=!0,this.Mh=!1;try{const i=n.generateSurveys;if(i)return this.Bh(i,o),void(this.Ih=!1);const r=n.loadExternalDependency;if(!r)return this.jh(u2e),void(this.Ih=!1);r(s=>{try{if(this.To)return;const a=this.wo.getExtensions();s||!a?.generateSurveys?this.jh("Could not load surveys script",s):this.Bh(a.generateSurveys,o)}finally{this.Ih=!1}})}catch(i){throw this.Ih=!1,this.jh("Error initializing surveys",i),i}}Bh(e,n){var o,i;if(this.To)return;this._surveyManager=e(n),this._surveyEventReceiver=this.wo.createEventReceiver(this.Oh);const r=(o=(i=this.bo)!==null&&i!==void 0?i:this.Th)===null||o===void 0?void 0:o.kv.get($K);r&&this.Hh(r),_l.info("Surveys loaded successfully"),this.zh(),this.Oh(),this.Uh({isLoaded:!0})}jh(e,n){this.Mh=!0,_l.error(e,n),this.Oh({isLoaded:!1,error:e}),this.Uh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Eh.push(e),this._surveyManager&&this.Uh({isLoaded:!0}),()=>{this.Eh=this.Eh.filter(n=>n!==e)}}getSurveys(e,n=!1){var o;const i=(o=this.bo)!==null&&o!==void 0?o:this.Th;if(!i||this.To)return;if(this.Ir.disableSurveys)return _l.info(tAt),e([]);const r=i.kv.get($K);if(r&&!n)return e(r,{isLoaded:!0}),void(this.Wh()&&this.getSurveys(()=>{},!0));if(this.Rh)return void this.Rh.then(({surveys:A,context:c})=>{this.To||e(A,c)}).catch(A=>_l.error("Error in survey callback",A));const s=this.Vh("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Ir.requestTimeoutMs}).then(A=>{try{return this.Gh(i,A)}catch(c){return _l.error("Error processing surveys response",c),this.Gh(i,{statusCode:0,error:c})}},A=>this.Gh(i,{statusCode:0,error:A}));this.Rh=s;const a=()=>{this.Rh===s&&(this.Rh=null)};s.then(A=>{a(),this.To||(this.Oh(A.context),e(A.surveys,A.context))},a).catch(A=>_l.error("Error in survey callback",A))}Vh(e,n){const o=this.bo;return o?o.sendRequest(e,n):new Promise(i=>i({statusCode:0,error:new Error(Yk)}))}Gh(e,n){if(this.To)return{surveys:[],context:{isLoaded:!1,error:Yk}};const o=n.statusCode;if(o!==200||!n.json){const r=`Surveys API could not be loaded, status: ${o}`;return o!==0?_l.error(r):n.error||_l.warn(r),this.Ah=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Ah=null;const i=n.json.surveys||[];return e.kv.set({[$K]:i,[$te]:Date.now()}),this.Hh(i),{surveys:i,context:{isLoaded:!0}}}Hh(e){var n;const o=e.filter(i=>(function(r){return!(!r.start_date||r.end_date)})(i)&&(Rat(i)||(function(r){var s;return!!(!((s=r.conditions)===null||s===void 0||(s=s.actions)===null||s===void 0||(s=s.values)===null||s===void 0)&&s.length)})(i)));(n=this._surveyEventReceiver)===null||n===void 0||n.replace(o)}Wh(){return this.Zh()&&!this.Rh&&!this.Qh()}Zh(){var e,n;const o=(e=(n=this.bo)!==null&&n!==void 0?n:this.Th)===null||e===void 0?void 0:e.kv.get($te);return qd(o)&&Date.now()-o>3e5}Qh(){return qd(this.Ah)&&3e5>Date.now()-this.Ah}markSurveyAsSeen(e,n){var o;const i={id:e,current_iteration:(o=n?.iteration)!==null&&o!==void 0?o:null};Lat(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this.Oh()}Uh(e){for(const n of this.Eh)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(o){_l.error("Error in survey callback",o)}}getActiveMatchingSurveys(e,n=!1){if(!Fs(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);_l.warn("init was not called")}onActiveMatchingSurveysChanged(e){var n,o;if(this.To)return()=>{};const i={callback:e,active:!0,revision:0};this.Ph.push(i),this.zh();const r=(n=(o=this.bo)!==null&&o!==void 0?o:this.Th)===null||n===void 0?void 0:n.kv.get($K);return this.Ir.disableSurveys||!this._surveyManager&&this.Mh&&!this.Ih||!r&&!Fs(this.Ah)&&!this.Rh?this.Lh(i,{isLoaded:!1}):this._surveyManager&&this.Lh(i),()=>{var s;i.active=!1,this.Ph=this.Ph.filter(a=>a!==i),this.Ph.length===0&&((s=this.qh)===null||s===void 0||s.call(this),this.qh=void 0)}}zh(){var e,n,o;this._surveyManager&&this.Ph.length>0&&((e=this.qh)!==null&&e!==void 0||(this.qh=(n=(o=this.wo).onMatchingConditionsChanged)===null||n===void 0?void 0:n.call(o,this.Oh)))}Lh(e,n){if(this.To||!e.active)return;const o=++e.revision,i=r=>{if(!this.To&&e.active&&o===e.revision)try{const s=n??{isLoaded:!0},a=JSON.stringify([r,s]);if(a===e.lastResult)return;e.lastResult=a,e.callback(r,s)}catch(s){_l.error("Error in active matching surveys callback",s)}};try{n&&!n.isLoaded?i([]):this.getActiveMatchingSurveys(i)}catch(r){_l.error("Error in active matching surveys callback",r)}}Jh(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}Kh(e){if(Fs(this._surveyManager))return{eligible:!1,reason:Yk};const n=typeof e=="string"?this.Jh(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}Xh(e){if(!this.wo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(Fs(this._surveyManager))return{eligible:!1,reason:Yk};const n=typeof e=="string"?this.Jh(e):e;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Fs(this._surveyManager))return _l.warn("init was not called"),{visible:!1,disabledReason:Yk};const n=this.Xh(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return Fs(this._surveyManager)?(_l.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Yk})):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.Xh(s);o({visible:a.eligible,disabledReason:a.reason})}else o({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(e,n,o){var i;if(!this.wo.isCapturing())return;if(Fs(this._surveyManager))return void _l.warn("init was not called");const r=typeof e=="string"?this.Jh(e):e;if(!r?.id)return void _l.warn("Survey not found");if(!g9n.includes(r.type))return void _l.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){_l.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const a=setTimeout(()=>{var A,c;this.Fh.delete(a),!this.To&&this.wo.isCapturing()&&(_l.info(`Rendering survey ${r.id} with delay of ${(A=r.appearance)===null||A===void 0?void 0:A.surveyPopupDelaySeconds} seconds`),(c=this._surveyManager)===null||c===void 0||c.renderSurvey(r,s,o),_l.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Fh.add(a)}this._surveyManager.renderSurvey(r,s,o)}else _l.warn("Survey element not found")}displaySurvey(e,n){var o;if(!this.wo.isCapturing())return;if(Fs(this._surveyManager))return void _l.warn("init was not called");const i=this.Jh(e);if(!i)return void _l.warn("Survey not found");let r=i;if(!((o=i.appearance)===null||o===void 0)&&o.surveyPopupDelaySeconds&&n.ignoreDelay&&(r=sn(sn({},i),{},{appearance:sn(sn({},i.appearance),{},{surveyPopupDelaySeconds:0})})),n.displayType!==N2e.Popover&&n.initialResponses&&_l.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){const s=this.Kh(i);if(!s.eligible)return void _l.warn("Survey is not eligible to be displayed: ",s.reason)}n.displayType!==N2e.Inline?this._surveyManager.handlePopoverSurvey(r,n):this.renderSurvey(r,n.selector,n.properties)}cancelPendingSurvey(e){Fs(this._surveyManager)?_l.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.handlePageUnload)===null||n===void 0||n.call(e)}};function Uk(t,e,n){if(Fs(t))return!1;switch(n){case"exact":return t===e;case"contains":{const o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(o,"i").test(t)}case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}var F9n=class{constructor(e){this._instance=e,this.Yh=new Set,this.tc=new Set,this.ec=new gne,this.nc=(n,o)=>this.sc(n,o)&&this.rc(n,o)&&this.oc(n,o)&&this.ac(n,o),this.sc=(n,o)=>!o?.event||n?.event===o?.event}init(){var e,n;Eo((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.lc=(n=this._instance)===null||n===void 0?void 0:n._addCaptureHook((o,i)=>{this.on(o,i)}))}dispose(){var e,n;(e=this.lc)===null||e===void 0||e.call(this),this.lc=void 0,(n=this._instance)===null||n===void 0||(n=n.autocapture)===null||n===void 0||n.setElementSelectors(new Set,this),this.ec=new gne}register(e){var n,o;if(!Eo((n=this._instance)===null||n===void 0?void 0:n._addCaptureHook)&&(e.forEach(i=>{var r;this.Yh.add(i),(r=i.steps)===null||r===void 0||r.forEach(s=>{this.tc.add(s?.event||"")})}),(o=this._instance)===null||o===void 0?void 0:o.autocapture)){const i=new Set;this.Yh.forEach(r=>{var s;(s=r.steps)===null||s===void 0||s.forEach(a=>{a?.selector&&i.add(a.selector)})}),this._instance.autocapture.setElementSelectors(i,this)}}replace(e){this.Yh.clear(),this.tc.clear(),this.register(e)}on(e,n){n!=null&&e.length!=0&&(this.tc.has(e)||this.tc.has(n.event))&&this.Yh.forEach(o=>{this.uc(n,o)&&this.ec.emit("actionCaptured",o.name)})}hc(e){this.onAction("actionCaptured",n=>e(n))}uc(e,n){if(n?.steps==null)return!1;for(const o of n.steps)if(this.nc(e,o))return!0;return!1}onAction(e,n){return this.ec.on(e,n)}rc(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"||!Uk(i,n.url,n.url_matching||"contains"))return!1}return!0}oc(e,n){return!!this.cc(e,n)&&!!this.dc(e,n)&&!!this.vc(e,n)}cc(e,n){var o;if(!n?.href)return!0;const i=this.fc(e);if(i.length>0)return i.some(s=>Uk(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&&Uk((function(s){const a=s.match(/(?::|")href="(.*?)"/);return a?a[1]:""})(r),n.href,n.href_matching||"exact")}dc(e,n){var o;if(!n?.text)return!0;const i=this.fc(e);if(i.length>0)return i.some(c=>Uk(c.text,n.text,n.text_matching||"exact")||Uk(c.$el_text,n.text,n.text_matching||"exact"));const r=(e==null||(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)||"";return!!r&&(s=(function(c){const l=[],g=/(?::|")text="(.*?)"/g;let u;for(;!Fs(u=g.exec(c));)l.includes(u[1])||l.push(u[1]);return l})(r),a=n.text,A=n.text_matching||"exact",s.some(c=>Uk(c,a,A)));var s,a,A}vc(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}fc(e){var n;return(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements)==null?[]:e?.properties.$elements}ac(e,n){return!n?.properties||n.properties.length===0||kat(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)}},L9n=class{constructor(e,n){var o,i;this.gc=[],this._instance=e,this.mc=n,this.yc=new Map,this.bc=new Map,this._c=new Map,this.wc=(o=this._instance)===null||o===void 0||(i=o.onSessionId)===null||i===void 0?void 0:i.call(o,r=>this.kc(r))}Sc(e){return!1}xc(){return null}Cc(e){}$c(){}Tc(e,n){return!!e&&kat(e.propertyFilters,n?.properties)}Ic(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}Mc(e,n,o){const i=(o===uV.Activation?this.yc:this.bc).get(e);let r=[];return this.Ec(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.Tc(A,n)})}register(e){this.Pc(e,!1)}replace(e){this.Pc(e,!0)}Pc(e,n){var o;Eo((o=this._instance)===null||o===void 0?void 0:o._addCaptureHook)||(this.Rc(e,n),this.Ac(e,n))}Ac(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._c.clear(),o.length===0)return void(n&&((i=this.Fc)===null||i===void 0||i.replace([])));this.Fc||(this.Fc=new F9n(this._instance),this.Fc.init(),this.Fc.hc(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._c.get(A.name))!==null&&c!==void 0?c:[];l.includes(s.id)||l.push(s.id),this._c.set(A.name,l)}})}),n?this.Fc.replace(r):this.Fc.register(r)}Oc(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)})}Rc(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.Ic(e,uV.Activation),A=this.Ic(e,uV.Cancellation);n?(this.yc=a,this.bc=A):(this.Oc(this.yc,a),this.Oc(this.bc,A)),(r.length!==0||s.length!==0||e.some(c=>{var l;return(l=c.conditions)===null||l===void 0||(l=l.actions)===null||l===void 0||(l=l.values)===null||l===void 0?void 0:l.length}))&&((o=this.lc)!==null&&o!==void 0||(this.lc=(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.Dc(),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.Lc(e,s,n);if(A==="consume")return r.info("event consumed activated item, removing it",{event:e,itemId:s}),void this.Nc([s]);if(A==="persist")return r.info("shown item promoted to persisted activation",{event:e,itemId:s}),this.qc(s),void this.jc([s])}if(this.bc.has(e)){const A=this.Mc(e,n,uV.Cancellation);A.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:A.map(c=>c.id)}),this.Nc(A.map(c=>c.id)),A.forEach(c=>this.Bc(c.id)))}if(!this.yc.has(e))return;r.info("event name matched",{event:e,eventPayload:n,items:this.yc.get(e)});const a=this.Mc(e,n,uV.Activation);this.Hc(a.map(A=>A.id))}onAction(e){this._c.has(e)&&this.Hc(this._c.get(e)||[])}Hc(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.Sc(s)?this.qc(s)&&this.zc(s):r.push(s);r.length>0&&(this.gc=[...new Set([...this.gc,...r])]),this.Dc().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.Uc()}qc(e){this.gc=this.gc.filter(o=>o!==e);const n=this.Wc();return!n.includes(e)&&(this.Vc([...n,e]),this.Gc(),!0)}Nc(e){const n=new Set(e);this.gc=this.gc.filter(r=>!n.has(r));const o=this.Zc(),i=o.filter(r=>!n.has(r));i.length!==o.length&&(this.Vc(i),i.length===0&&this.Qc()),this.jc(e),this.Uc()}Uc(){try{var e;(e=this.mc)===null||e===void 0||e.call(this)}catch(n){this.Dc().error("Error while handling activated items change",n)}}Jc(){var e;const n=this.xc();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:{}}zc(e){if(!this.xc())return;const n=this.Jc();this.Cc(sn(sn({},n),{},{[e]:Date.now()}))}jc(e){if(!this.xc())return;const n=this.Jc(),o={};let i=!1;for(const[r,s]of Object.entries(n))e.includes(r)?i=!0:o[r]=s;i&&(nx(o)?this.$c():this.Cc(o))}Kc(){this.xc()&&this.$c()}getActivationTimestamp(e){if(!this.Wc().includes(e))return;const n=this.Jc()[e];return qd(n)?n:void 0}Zc(){var e;const n=this.Xc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[n])||[]}Wc(){var e,n,o;const i=this.Zc();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.Yc()],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:[]}Gc(){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.td(o)}Qc(){this.ed()}kc(e){var n;const o=(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0?void 0:n.props[this.Yc()];if(o&&o!==e){const i=this.Zc(),r=this.Jc();i.length>0&&(this.Vc([]),i.filter(s=>qd(r[s])).forEach(s=>this.Bc(s))),this.Qc(),this.Kc(),i.length>0&&this.Uc()}}getActivatedIds(){return[...new Set([...this.Wc(),...this.gc])].filter(e=>!this.nd(e))}dispose(){var e,n,o;(e=this.wc)===null||e===void 0||e.call(this),this.wc=void 0,(n=this.lc)===null||n===void 0||n.call(this),this.lc=void 0,(o=this.Fc)===null||o===void 0||o.dispose(),this.Fc=void 0}reset(){this.gc=[],this.Zc().length>0&&this.Vc([]),this.Qc(),this.Kc(),this.Uc()}getEventToItemsMap(){return this.yc}sd(){return this.Fc}},H9n=class extends L9n{constructor(e,n){super(e,n)}Xc(){return $rt}Yc(){return Zrt}xc(){return est}Cc(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated_timestamps:e})}$c(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}Sc(e){var n;let o;this.Ec(r=>{o=r.find(s=>s.id===e)});const i=o==null||(n=o.appearance)===null||n===void 0?void 0:n.surveyPopupDelaySeconds;return qd(i)&&i>0}rd(){return N3.SHOWN}Ec(e){var n;(n=this._instance)===null||n===void 0||n.getSurveys(e)}Bc(e){var n;(n=this._instance)===null||n===void 0||n.cancelPendingSurvey(e)}Dc(){return _l}Vc(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated:e})}td(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated_session:e})}ed(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}nd(){return!1}Lc(e,n,o){var i;if(e===N3.SENT&&(o==null||(i=o.properties)===null||i===void 0?void 0:i.$survey_completed)===!1)return"ignore";let r;return this.Ec(s=>{r=s.find(a=>a.id===n)}),!r||(function(s){var a;return Rat(s)&&!!(!((a=s.conditions)===null||a===void 0||(a=a.events)===null||a===void 0)&&a.repeatedActivation)||s.schedule==="always"})(r)?e===N3.SHOWN?"consume":"ignore":e===N3.SHOWN?"persist":e===N3.DISMISSED||e===N3.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},O9n=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const n={};for(const o of e){const i=this._instance.get_property(o);Eo(i)||(n[o]=i)}return n}set(e,n){this._instance.register(typeof e=="string"?{[e]:n}:e)}remove(e){typeof e!="string"?e.forEach(n=>this._instance.unregister(n)):this._instance.unregister(e)}},G9n=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(e){return new H9n(this._instance,e)}onMatchingConditionsChanged(e){const n=this._instance._addCaptureHook(s=>{s!=="$pageview"&&s!==N3.SHOWN&&s!==N3.DISMISSED&&s!==N3.SENT||e()}),o=()=>e();jc(Fn,"PHSurveyShown",o);let i=!1;const r=this._instance.onFeatureFlags(()=>{i&&e()});return i=!0,()=>{i=!1,n(),r(),Fn?.removeEventListener("PHSurveyShown",o)}}};const Y9n=Fn?.location?ine(Fn.location.hash,"__posthog")||ine(location.hash,"state"):null,nAt="_postHogToolbarParams",oAt=Ad("[Toolbar]"),iAt=Ad("[FeatureFlags]");var U9n=class{constructor(e,n=!1){this.od=!1,this.update(e,n)}update(e,n){this.ad=((o,i)=>{var r,s,a,A,c,l,g,u;return{bootstrap:{featureFlags:(r=(s=o.bootstrap)===null||s===void 0?void 0:s.featureFlags)!==null&&r!==void 0?r:void 0,featureFlagPayloads:(a=(A=o.bootstrap)===null||A===void 0?void 0:A.featureFlagPayloads)!==null&&a!==void 0?a:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!o.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!o.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!o.advanced_feature_flags_dedup_per_session,cacheTtlMs:o.feature_flag_cache_ttl_ms,refreshIntervalMs:(c=o.remote_config_refresh_interval_ms)!==null&&c!==void 0?c:3e5,idleRefreshBackoff:Eo(o.remote_config_refresh_interval_ms),requestTimeoutMs:o.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(l=o.feature_flag_request_max_retries)!==null&&l!==void 0?l:1),compression:o.disable_compression?void 0:"best-available",evaluationContexts:(g=(u=o.evaluation_contexts)!==null&&u!==void 0?u:o.evaluation_environments)!==null&&g!==void 0?g:[],flagKeys:As(o.flag_keys)?o.flag_keys:void 0}})(e,n),!e.evaluation_environments||e.evaluation_contexts||this.od||(iAt.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.od=!0),Eo(e.flag_keys)||As(e.flag_keys)||iAt.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.ad}};const rAt=Ad("[FeatureFlags]"),LM=Ad("[FeatureFlags]",{debugEnabled:!0}),exe=`" failed. Feature flags didn't load in time.`,K9n=[502,504],sAt=["click","keydown","wheel","touchstart","pointerdown"],aAt="connection_error",AAt=t=>{const e={};for(let n=0;t.length>n;n++)e[t[n]]=!0;return e},cAt=t=>{const e={};for(const[n,o]of tne(t||{}))o&&(e[n]=o);return e},lAt=t=>Ek(t)&&(t.name==="RangeError"&&t.message.indexOf("Maximum call stack size exceeded")===0||t.name==="InternalError"&&t.message==="too much recursion"),L4=Ad("[Error tracking]"),txe="webkit-masked-url:",V9n=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],z9n=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",txe],J9n=["__firefox__","__gCrWeb"],gAt="Refusing to render web experiment since the viewer is a likely bot",W9n={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>une(e,t),not_regex:(t,e)=>!une(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},_5=Ad("[Conversations]"),HM="Conversations not available yet.";function uAt(t,e){var n,o,i,r,s,a,A;const c=(n=t?.flushIntervalMs)!==null&&n!==void 0?n:3e3,l=(o=t?.maxBufferSize)!==null&&o!==void 0?o:100,g=e?.consoleCapture?void 0:(i=t?.maxLogsPerInterval)!==null&&i!==void 0?i:1e3,u=Eo(g)?Math.max(l,2048):Math.max(l,g),h=sn(sn({},(function(){let d="",p="";try{const m=F_?.userAgent;m&&([d,p]=irt(m))}catch{}return(function(m,_){const f=(function(I){if(I)return{}.hasOwnProperty.call(Nrt,I)?Nrt[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 j9n=["debug","log","warn","error","info"],q9n=t=>{for(;t?.__rrweb_original__;)t=t.__rrweb_original__;return t},dAt="console",hAt="__posthogHandledLogsRequestError",nxe=(t,e)=>{const n=t instanceof Error?t:new Error(e);return n[hAt]=!0,n},pAt=t=>!!t&&typeof t=="object"&&t[hAt]===!0,pne=Ad("[NetworkMetrics]"),oxe=()=>{var t;return!(Fn==null||(t=Fn.performance)===null||t===void 0)&&t.now?Fn.performance.now():Date.now()},X9n={"http:":80,"https:":443},$9n=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),mAt=(t,e)=>{var n;const o=String(e);return{method:String(t).toUpperCase(),url:((n=x8(o))===null||n===void 0?void 0:n.href)||o}},ixe=(t,e,n,o,i,r,s=!1)=>{try{var a,A;const c=i();if(!c)return;const l=n||void 0,g=oxe()-o,u=x8(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=$9n.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)||X9n[_.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){pne.error("Failed to record network metric",c)}},_At=()=>{},Z9n=(t,e)=>L_(Fn?.fetch)?xV(Fn,"fetch",n=>function(...o){const i=oxe(),r=n.apply(this,o);if(!e())return r;try{var s,a,A;const[c,l]=o,g=mAt((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=>(ixe(t,g,u?.status,i,e,void 0,!0),u),u=>{throw ixe(t,g,void 0,i,e,u),u})}catch(c){return pne.error("Failed to observe fetch",c),r}}):_At,e7n=(t,e)=>{var n;const o=Fn==null||(n=Fn.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!o)return _At;const i=new WeakMap,r=xV(o,"open",a=>function(...A){try{_at.has(this)||i.set(this,mAt(A[0],A[1]))}catch(c){pne.error("Failed to observe XHR open",c)}return a.apply(this,A)}),s=xV(o,"send",a=>function(...A){let c;try{const l=i.get(this);if(l&&e()){const g=oxe();c=()=>{this.removeEventListener("loadend",c),ixe(t,l,this.status,g,e)},jc(this,"loadend",c)}}catch(l){pne.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()}},mne={featureFlags:class{constructor(t){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=rAt,this.ud={},this.hd={},this.dd=[],this.vd=!1,this.fd=!1,this.pd=0,this.gd=!1,this.md=!1,this.yd=!1,this.bd=!1,this._d=0,this.wd=!1,this.rn=()=>{const e=this.kd();this._d=0,e&&this.reloadFeatureFlags()},this.Sd=()=>{var e,n;const o=this.xd,i=(e=this.Cd)!==null&&e!==void 0?e:o;Eo(o)||Eo(i)||this.Ir.remoteRequestsDisabled||!No||No.visibilityState==="hidden"||Date.now()-((n=this.$d)!==null&&n!==void 0?n:0)<i||(this.Cd=this.wd||!this.Ir.idleRefreshBackoff?o:Math.min(2*i,36e5),this.wd=!1,this.reloadFeatureFlags(),this.Td())},this.Id=()=>{this.wd&&this.Cd===this.xd||this.Md()},this.sn=()=>{No?.visibilityState==="visible"&&this.Md()},"get"in t?this.wo=t:(this._instance=t,this.Ed=new U9n(t.config,t.il()),this.wo=this.Ed)}updateConfig(t,e){var n;(n=this.Ed)===null||n===void 0||n.update(t,e),this.bo&&this.Pd()}setup(t){return this.Nh=t,this.A=t.logger.createLogger("[FeatureFlags]"),eAt(t.kv.initialize(),()=>{this.Nh===t&&(this.Nh=void 0,this.bo=t,this.Rd(t))})}Rd(t){var e;if(this.bo===t)return Fn&&jc(Fn,"online",this.rn),this.Pd(),this.Ad=t.registerDynamicEventProperties(()=>this.Fd()?this.ud:this.hd),this.Od=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.onCrossTabFeatureFlagChange(()=>{this.Dd(),this.Ld(),this.Nd()}),this.Ld(),this.initialize()}Md(){this.wd=!0,this.Cd=this.xd,this.Sd()}Pd(){const t=this.Ir.refreshIntervalMs,e=!this.Ir.remoteRequestsDisabled&&No&&!Eo(t)&&t>0?t:void 0;this.Ir.idleRefreshBackoff||(this.Cd=e),e!==this.xd&&(this.qd(),Eo(e)||(this.xd=e,this.Cd=e,this.Td(),No?.addEventListener&&(jc(No,tV,this.sn),wk(sAt,n=>{jc(No,n,this.Id,{capture:!0})}))))}Td(){Eo(this.xd)||(Eo(this.jd)||clearInterval(this.jd),this.$d=Date.now(),this.jd=setInterval(this.Sd,this.xd))}qd(){var t;Eo(this.jd)||(clearInterval(this.jd),this.jd=void 0,No==null||(t=No.removeEventListener)===null||t===void 0||t.call(No,"visibilitychange",this.sn),wk(sAt,e=>{var n;No==null||(n=No.removeEventListener)===null||n===void 0||n.call(No,e,this.Id,{capture:!0})})),this.xd=void 0,this.Cd=void 0,this.wd=!1,this.$d=void 0}destroy(){this.Bd()}dispose(){this.Bd()}Bd(){var t,e;this.qd(),this.pd++,this.md=!1,this.Nh=void 0,this.bo&&(this.Hd(),(t=this.Ad)===null||t===void 0||t.dispose(),this.Ad=void 0,(e=this.Od)===null||e===void 0||e.call(this),this.Od=void 0,this.dd=[],Fn?.removeEventListener("online",this.rn),this.bo=void 0)}get Ir(){return this.wo.get()}zd(t){var e;return this.Ud&&t in this.Ud?this.Ud[t]:(e=this.bo)===null||e===void 0?void 0:e.kv.get(t)}Dd(){return!!this.Ud&&(this.Ud=void 0,!0)}Wd(){var t;return!Eo((t=this.bo)===null||t===void 0?void 0:t.kv.get("$enabled_feature_flags"))&&this.Dd()}$t(t){this.Vd(()=>{var e;return(e=this.bo)===null||e===void 0?void 0:e.kv.set(t)})}Gd(t,e,n){var o;if(!(!((o=this._instance)===null||o===void 0)&&o.persistence)||!t.$enabled_feature_flags)return;const i=this.zd("$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.zd("$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={[C8]:d,[k4]:d,[sQ]:p};t.$feature_flag_details&&(m[MM]=d);for(const _ of[DM,lQ,XK])Eo(t[_])||(m[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(m)}Lt(t){this.Vd(()=>{var e;return(e=this.bo)===null||e===void 0?void 0:e.kv.remove(t)})}Vd(t){try{t()}catch(e){this.A.error("Failed to update feature flag persistence",e)}}Ld(){const t={};for(const o of[C8,sQ,DM,B9]){const i=this.zd(o);Eo(i)||(t[o]=i)}this.ud=t;const e=sn({},t),n=this.zd(k4);if(n)for(const[o,i]of Object.entries(n))e[`$feature/${o}`]=i;this.hd=e}Fd(){const t=this.Ir.cacheTtlMs;if(!t||0>=t)return!1;const e=this.zd(lQ);return typeof e!="number"||Date.now()-e>t}Zd(){return!!this.Fd()&&(this.bd||this.fd||(this.bd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Qd(){const t=this.Ir.evaluationContexts;return t?.length?t.filter(e=>{const n=e&&typeof e=="string"&&e.trim().length>0;return n||this.A.error("Invalid evaluation context found:",e,"Expected non-empty string"),n}):[]}Jd(){const t=this.Ir.flagKeys;if(!Eo(t))return t.filter(e=>{const n=e&&typeof e=="string"&&e.trim().length>0;return n||this.A.error("Invalid flag key found:",e,"Expected non-empty string"),n})}initialize(){var t,e;const n=this.Ir,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=>!Eo(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.Kd({featureFlags:a,featureFlagPayloads:A},void 0,{persist:!1})}}updateFlags(t,e,n){var o,i;const r=n?.merge&&(o=this.zd("$enabled_feature_flags"))!==null&&o!==void 0?o:{},s=n?.merge&&(i=this.zd("$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:Ert(g),variant:Brt(g),reason:void 0,metadata:Eo(A?.[l])?void 0:{id:0,version:void 0,description:void 0,payload:A[l]}};this.Kd({flags:c})}get hasLoadedFlags(){return this.vd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.zd(MM),e=this.zd(B9),n=this.zd(NM);if(!n&&!e)return t||{};const o=jg({},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=Eo(c)?(r=A?.enabled)!==null&&r!==void 0&&r:!!c,g=Eo(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.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:o}),this.ld=!0),o}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(n=>{const o=t[n];return{key:n,enabled:Ert(o),variant:Brt(o),payload:xrt(e[n])}})}getFlagVariants(){const t=this.zd(k4),e=this.zd(B9);if(!e)return t||{};const n=jg({},t||{}),o=Object.keys(e);for(let i=0;o.length>i;i++)n[o[i]]=e[o[i]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.ld=!0),n}getFlagPayloads(){const t=this.zd(sQ),e=this.zd(NM);if(!e)return t||{};const n=jg({},t||{}),o=Object.keys(e);for(let i=0;o.length>i;i++)n[o[i]]=e[o[i]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.ld=!0),n}reloadFeatureFlags(){this.gd||this.Ir.featureFlagsDisabled||this.kd()||(this.fd&&(this.md=!0),this.Xd||(this.dd.slice().forEach(t=>{try{t()}catch(e){this.A.error("Error while running feature flags reloading callback",e)}}),this.Xd=setTimeout(()=>{this.Yd()},5)))}Hd(){clearTimeout(this.Xd),this.Xd=void 0}onReloading(t){return this.dd.push(t),()=>{this.dd=this.dd.filter(e=>e!==t)}}ensureFlagsLoaded(){this.vd||this.fd||this.Xd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.gd=t}resetFlagCallReported(){this.Lt(cQ)}Yd(t){this.Hd();const e=this.bo;if(!e||this.Ir.remoteRequestsDisabled||this.kd())return;if(this.fd)return void(this.md=!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.zd("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.zd(AQ),timezone:tat()};Eo(e.deviceId)||(n.$device_id=e.deviceId),(t?.disableFlags||this.Ir.featureFlagsDisabled)&&(n.disable_flags=!0);const o=this.Qd();o.length&&(n.evaluation_contexts=o);const i=this.Jd();Eo(i)||(n.flag_keys=i);const r=this.Ir.onlyEvaluateSurveyFeatureFlags,s="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),a=this.pd;this.fd=!0;const A=()=>{this.md&&(this.md=!1,this.Yd())},c=d=>{var p,m;const _=(p=d.json)!==null&&p!==void 0?p:{},f=d.statusCode!==200;if(this.fd=!1,a!==this.pd)return void A();if(this.tv(d.statusCode),f||this.md||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.md)return;this.yd=!f;const I=[];d.error?I.push(d.error instanceof Error&&d.error.name==="AbortError"?"timeout":d.error instanceof Error?aAt:"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.$t({[eV]:I}),C?this.A.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):n.disable_flags||this.Kd(_,f,{partialResponse:r}),A()},l=d=>{this.fd=!1,a===this.pd&&(this.$t({[eV]:[aAt]}),this.A.error("Feature flag request failed",d),this.Wd()&&this.Nd(!0)),A()};let g=this.Ir.requestMaxRetries;const u=()=>g>0&&a===this.pd,h=()=>{if(a!==this.pd||!this.bo||this.Ir.remoteRequestsDisabled)return this.fd=!1,void A();try{e.sendRequest(s,{target:"flags",method:"POST",body:n,compression:this.Ir.compression,sentAt:"body",timeoutMs:this.Ir.requestTimeoutMs}).then(d=>{if((p=>K9n.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()}kd(){return zst(this._d,3)}tv(t){this._d=Jst(t,this._d,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,e={}){var n;if(e.fresh&&!this.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+t+exe);if(this.Zd())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.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+t+exe);if(this.Zd())return;const n=this.getFlagVariants(),o=t in n,i=n[t],r=this.getFlagPayloads()[t],s=String(i),a=this.zd("$feature_flag_request_id")||void 0,A=this.zd("$feature_flag_evaluated_at")||void 0;let c,l=this.zd("$flag_call_reported")||{};if(this.Ir.deduplicateCallsPerSession){var g;const S=(g=this.bo)===null||g===void 0?void 0:g.session.sessionId,Q=this.zd(ZK);S&&S!==Q&&(l={},c=S)}if(e.send_event||!("send_event"in e))if(t in l&&l[t].includes(s))c&&this.$t({[cQ]:l,[ZK]: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.$t(sn({[cQ]:l},c?{[ZK]:c}:{}));const S=this.getFeatureFlagDetails(t),Q=[...(u=this.zd("$feature_flag_errors"))!==null&&u!==void 0?u:[]];Eo(i)&&Q.push("flag_missing");const w={$feature_flag:t,$feature_flag_response:i,$feature_flag_payload:r??null,$feature_flag_request_id:a,$feature_flag_evaluated_at:A,$feature_flag_bootstrapped_response:(h=(d=this.Ir.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.Ir.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.yd};Eo(S==null||(_=S.metadata)===null||_===void 0?void 0:_.has_experiment)||(w.$feature_flag_has_experiment=S.metadata.has_experiment),Eo(S==null||(f=S.metadata)===null||f===void 0?void 0:f.version)||(w.$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&&(w.$feature_flag_reason=M),!(S==null||(x=S.metadata)===null||x===void 0)&&x.id&&(w.$feature_flag_id=S.metadata.id),Eo(S?.original_variant)&&Eo(S?.original_enabled)||(w.$feature_flag_original_response=Eo(S.original_variant)?S.original_enabled:S.original_variant),!(S==null||(E=S.metadata)===null||E===void 0)&&E.original_payload&&(w.$feature_flag_original_payload=S==null||(B=S.metadata)===null||B===void 0?void 0:B.original_payload),Q.length&&(w.$feature_flag_error=Q.join(",")),this.ev(w)}else c&&this.$t({[cQ]:l,[ZK]:c});return o?{key:t,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:xrt(r)}:void 0}ev(t){try{var e;(e=this.bo)===null||e===void 0||e.capture("$feature_flag_called",t)}catch(n){this.A.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(t,e){this.iv(t,e)}iv(t,e){var n=this;return Wg(function*(){const o=n.bo;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.Qd();r.length&&(i.evaluation_contexts=r);const s=n.Jd();let a;Eo(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.Ir.compression,sentAt:"body",timeoutMs:n.Ir.requestTimeoutMs})).json)===null||A===void 0?void 0:A.featureFlagPayloads;a=c?.[t]||void 0}catch(c){return void n.A.error("Remote config feature flag request failed",c)}try{e(a)}catch(c){n.A.error("Remote config feature flag callback failed",c)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.yd)return e.defaultValue;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+exe),e.defaultValue;const n=this.getFeatureFlag(t,e);return Eo(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.Kd(t,e,n)}Kd(t,e,n){if(!this.bo)return;this.vd=!0;const o=((i,r={},s={},a={},A,c=rAt)=>{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!Eo((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{[C8]:u,[k4]:I,[XK]:!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({[C8]:Object.keys(cAt(m)),[k4]:m||{},[sQ]:_||{},[MM]:f||{},[XK]:i.minimalFlagCalledEvents===!0},d?{[DM]:d}:{}),p?{[lQ]:p}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.A);if(o)if(n?.persist===!1){const i=!Eo(this.bo.kv.get(k4));this.Ud=o,i||this.$t(o)}else this.Dd(),this.Gd(o,t,!!n?.partialResponse),this.$t(o);else e&&this.Wd();e||(this.bd=!1),this.Nd(e)}override(t,e=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.nv(t)}nv(t){if(this.bo){if(t===!1)return this.Lt([B9,NM]),this.Nd(),void LM.info("All overrides cleared");if(As(t))return this.$t({[B9]:AAt(t)}),this.Nd(),void LM.info("Flag overrides set",{flags:t});if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var e;const n=t;this.ld=!!((e=n.suppressWarning)!==null&&e!==void 0&&e);const o={},i=n.flags,r=n.payloads;return i&&(o[B9]=As(i)?AAt(i):i),r&&(o[NM]=r),Object.keys(o).length&&this.$t(o),i===!1&&r===!1?this.Lt([B9,NM]):i===!1?this.Lt(B9):r===!1&&this.Lt(NM),this.Nd(),i===!1?LM.info("Flag overrides cleared"):i&&LM.info("Flag overrides set",{flags:i}),void(r===!1?LM.info("Payload overrides cleared"):r&&LM.info("Payload overrides set",{payloads:r}))}if(t&&typeof t=="object")return this.$t({[B9]:t}),this.Nd(),void LM.info("Flag overrides set",{flags:t});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.vd){const{flags:e,flagVariants:n}=this.sv();try{t(e,n)}catch(o){this.A.error("Error while running feature flags callback",o)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var o;const i=(this.zd("$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.$t({[C8]:Object.keys(cAt(a)),[k4]:a,[aQ]:sn(sn({},this.zd("$stored_person_properties")||{}),r)}),this.Nd();try{var A;(A=this.bo)===null||A===void 0||A.capture("$feature_enrollment_update",s)}catch(c){this.A.error("Failed to capture early access feature enrollment",c)}}getEarlyAccessFeatures(t,e=!1,n){const o=this.zd(r2e);!o||e?this.rv(t,n):t(o)}rv(t,e){var n=this;return Wg(function*(){const o=n.bo;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.$t({[r2e]:r})}catch(s){return void n.A.error("Early access feature request failed",s)}try{t(r)}catch(s){n.A.error("Early access feature callback failed",s)}})()}sv(){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),{})}}Nd(t){this.Ld();const{flags:e,flagVariants:n}=this.sv();this.featureFlagEventHandlers.forEach(o=>{try{o(e,n,{errorsLoading:t})}catch(i){this.A.error("Error while running feature flags callback",i)}})}setPersonPropertiesForFlags(t,e=!0){this.ov(t,e)}ov(t,e=!0){const n=this.zd("$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.$t({[aQ]:sn(sn(sn({},n),r),o)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const n=sn({},this.zd("$stored_person_properties")||{});t.forEach(o=>{delete n[o]}),this.$t({[aQ]:n}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(aQ),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const n=this.zd("$stored_group_properties")||{},o=sn({},n);for(const i of Object.keys(t))o[i]=sn(sn({},n[i]),t[i]);this.$t({[AQ]:o}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.zd("$stored_group_properties")||{};this.$t({[AQ]:sn(sn({},e),{},{[t]:{}})})}else this.Lt(AQ)}reset(){this.pd++,this.md=!1,this.ud={},this.hd={},this.Ud=void 0,this.vd=!1,this.gd=!1,this.yd=!1,this.$anon_distinct_id=void 0,this.Hd(),this.ld=!1,this._d=0}}},t7n={sessionRecording:class{get Ir(){return this._instance.config}get Il(){return this._instance.persistence}get started(){var t;return!!(!((t=this.av)===null||t===void 0)&&t.isStarted)}get status(){var t,e;return this.lv==="awaiting_config"||this.lv==="missing_config"?this.lv:(t=(e=this.av)===null||e===void 0?void 0:e.status)!==null&&t!==void 0?t:this.lv}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.lv=X2e,this.uv=void 0,this.hv=!1,this.Je=(()=>{var e,n;if(!No?.visibilityState||No.visibilityState==="visible")return!0;const o=Fn==null||(e=Fn.performance)===null||e===void 0||(n=e.getEntriesByType)===null||n===void 0?void 0:n.call(e,"visibility-state");return!o?.length||o.some(i=>i.name==="visible")})(),this.sn=()=>{var e,n;No?.visibilityState==="visible"&&(this.Je=!0,(e=this.av)===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.Ir.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');No?.addEventListener&&jc(No,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.hv=!0,No==null||(e=No.removeEventListener)===null||e===void 0||e.call(No,"visibilitychange",this.sn),t?this.dv(!0):this.stopRecording()}get vv(){var t;const e=!!(!((t=this._instance.get_property("$session_recording_remote_config"))===null||t===void 0)&&t.enabled),n=!this.Ir.disable_session_recording,o=this.Ir.disable_session_recording||this._instance.consent.isOptedOut();return Fn&&e&&n&&!o}startIfEnabledOrStop(t){var e;if(this.hv||this.vv&&(!((e=this.av)===null||e===void 0)&&e.isStarted))return;const n=!Eo(Object.assign)&&!Eo(Array.from);this.vv&&n?(this.fv(t),b8.info("starting")):(this.lv=X2e,this.stopRecording())}fv(t){var e,n;if(this.vv)if(this.lv!=="awaiting_config"&&this.lv!=="missing_config"&&(this.lv=$at),(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.pv(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.gv,s=>{if(!this.hv&&this.vv&&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.pv(t);this.lv="disabled"})}}stopRecording(){var t,e;(t=this.uv)===null||t===void 0||t.call(this),this.uv=void 0,(e=this.av)===null||e===void 0||e.stop()}dv(t=!1){var e,n;(e=this.uv)===null||e===void 0||e.call(this),this.uv=void 0,(n=this.av)===null||n===void 0||n.discard({discardProducerEvents:t})}mv(){var t,e;(t=this.Il)===null||t===void 0||t.unregister("$session_is_sampled"),(e=this.Il)===null||e===void 0||e.unregister("$replay_sample_rate")}yv(t,e){if(Fs(t))return null;const n=qd(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}bv(t){if(this.Il){var e,n;const o=this.Il,i=()=>{var r;const s=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.yv((r=this.Ir.session_recording)===null||r===void 0?void 0:r.sampleRate,"session_recording.sampleRate"),A=this.yv(s?.sampleRate,"remote config sampleRate"),c=a??A;Fs(c)&&this.mv();const l=s?.minimumDurationMilliseconds;o.register({[qK]: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:Eo(l)?null:l,endpoint:s?.endpoint,triggerMatchType:s?.triggerMatchType,masking:s?.masking,urlTriggers:s?.urlTriggers,version:s?.version,triggerGroups:s?.triggerGroups})})};i(),(e=this.uv)===null||e===void 0||e.call(this),this.uv=(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.bv(e),void this.dv()):(this.bv(e),void this.startIfEnabledOrStop()):(this.lv==="awaiting_config"&&(this.lv="missing_config",this._instance.register_for_session({[g2e]:!0}),b8.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var n;!((n=this.av)===null||n===void 0)&&n.log?this.av.log(t,e):b8.warn("log called before recorder was ready")}get gv(){var t,e;const n=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.get_property(qK);return(n==null||(e=n.scriptConfig)===null||e===void 0?void 0:e.script)||"lazy-recorder"}_v(){const t=this._instance.get_property(qK);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!Fs(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}pv(t){var e,n,o;if(!this.hv&&this.vv&&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({[l2e]:!0});var i;if(this.av||(this.av=(i=Ur.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording(this._instance,this.Je),this.av._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._v())return this.lv==="missing_config"||this.lv==="awaiting_config"?void 0:(this.lv="awaiting_config",b8.info("persisted remote config is stale, requesting fresh config before starting"),void new aat(this._instance).load());this.lv=$at,(n=(o=this.av).setDocumentWasEverVisible)===null||n===void 0||n.call(o,this.Je),this.av.start(t)}else this.lv=X2e}onRRwebEmit(t){var e,n;(e=this.av)===null||e===void 0||(n=e.onRRwebEmit)===null||n===void 0||n.call(e,t)}overrideLinkedFlag(){var t,e;this.av||(e=this.Il)===null||e===void 0||e.register({$replay_override_linked_flag:!0}),(t=this.av)===null||t===void 0||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.av||(e=this.Il)===null||e===void 0||e.register({$replay_override_sampling:!0}),(t=this.av)===null||t===void 0||t.overrideSampling()}overrideTrigger(t){var e,n;this.av||(n=this.Il)===null||n===void 0||n.register({[t==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.av)===null||e===void 0||e.overrideTrigger(t)}get sdkDebugProperties(){var t;const e={};for(const o of N9n){var n;const i=(n=this._instance.sessionPersistence)===null||n===void 0?void 0:n.get_property(o);Eo(i)||(e[o]=i)}return sn(sn({},e),((t=this.av)===null||t===void 0?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,e){var n;return!!(!((n=this.av)===null||n===void 0)&&n.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;(t=this.av)===null||t===void 0||(e=t.flushBeforeIdentityReset)===null||e===void 0||e.call(t)}}},n7n={autocapture:class extends v9n{constructor(t){super(new w9n(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.wv=!1,this._instance=t,this.Sv=this.xv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.Cv();return!!(t.path||t.search||this.$v(t))}startIfEnabled(){this.isEnabled&&(gi.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Sv=this.xv(),this.startIfEnabled()}stop(){this.Tv&&this.Tv(),this.Tv=void 0,this.Iv&&this.Iv(),this.Iv=void 0,gi.info("History API monitoring stopped")}monitorHistoryChanges(){Fn&&Fn.history&&(this.Mv("pushState"),this.Mv("replaceState"),this.Ev(),this.$v()&&this.Pv())}Mv(t){var e;if(!Fn||!((e=Fn.history[t])===null||e===void 0)&&e.__posthog_wrapped__)return;const n=this;xV(Fn.history,t,o=>function(i,r,s){var a;n.Rv(s)&&n.Av(),o.call(this,i,r,s),n.Fv(t,!n.wv&&(Fn==null||(a=Fn.event)===null||a===void 0?void 0:a.type)!=="popstate")})}xv(){const t=Fn?.location;if(t?.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}Cv(){const t=this._instance.config.capture_pageview;return t==="history_change"?{path:!0}:xA(t)?t:{}}$v(t=this.Cv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Ov(t){const e=this.Cv(),n=this.Sv;return!(!n||!(e.path&&t.pathname!==n.pathname||e.search&&t.search!==n.search||this.$v(e)&&t.hash!==n.hash))}Fv(t,e=!1){try{e||this.Av();const n=this.xv();if(!n)return;if(this.Ov(n)){const o=()=>this._instance.capture(d2e,{navigation_type:t});e?(this.Dv=o,Promise.resolve().then(()=>this.Av())):o()}this.Sv=n}catch(n){gi.error(`Error capturing ${t} pageview`,n)}}Rv(t){var e,n;return!(Fs(t)||!Fn)&&((e=x8(String(t)))===null||e===void 0?void 0:e.href)!==((n=Fn.location)===null||n===void 0?void 0:n.href)}Av(){const t=this.Dv;if(t){this.Dv=void 0,this.wv=!0;try{t()}catch(e){gi.error("Error capturing deferred pageview",e)}finally{this.wv=!1}this.Sv=this.xv()}}Ev(){if(this.Tv)return;const t=()=>{this.Fv("popstate")};jc(Fn,"popstate",t),this.Tv=()=>{Fn&&Fn.removeEventListener("popstate",t)}}Pv(){if(this.Iv)return;const t=()=>{this.Fv("hashchange")};jc(Fn,"hashchange",t),this.Iv=()=>{Fn&&Fn.removeEventListener("hashchange",t)}}},heatmaps:class{get Ir(){return this.instance.config}constructor(t){var e;this.Lv=!1,this.ko=!1,this.Nv=null,this.instance=t,this.Lv=!!(!((e=this.instance.persistence)===null||e===void 0)&&e.props[Zye]),this.rageclicks=new Jat(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return xA(this.Ir.capture_heatmaps)&&this.Ir.capture_heatmaps.flush_interval_milliseconds&&(t=this.Ir.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Fs(this.Ir.capture_heatmaps)?Fs(this.Ir.enable_heatmaps)?this.Lv:this.Ir.enable_heatmaps:this.Ir.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ko)return;R9n.info("starting..."),this.qv(),this.sn()}else{var t;clearInterval((t=this.Nv)!==null&&t!==void 0?t:void 0),this.jv(),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({[Zye]:n}),this.Lv=n,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Bv(t){$2e(t.originalEvent)&&this.Mr(t.originalEvent,"deadclick")}sn(){this.Nv&&clearInterval(this.Nv),this.Nv=No?.visibilityState==="visible"?setInterval(this.yl.bind(this),this.flushIntervalMilliseconds):null}qv(){Fn&&No&&(this.Hv=this.yl.bind(this),jc(Fn,ene,this.Hv),this.zv=t=>this.Mr(t||Fn?.event),jc(No,"click",this.zv,{capture:!0}),this.Uv=t=>this.Wv(t||Fn?.event),jc(No,"mousemove",this.Uv,{capture:!0}),this.Vv=new Gst(this.instance,RBn,this.Bv.bind(this)),this.Vv.startIfEnabledOrStop(),this.Gv=this.sn.bind(this),jc(No,tV,this.Gv),this.ko=!0)}jv(){var t;Fn&&No&&(this.Hv&&Fn.removeEventListener(ene,this.Hv),this.zv&&No.removeEventListener("click",this.zv,{capture:!0}),this.Uv&&No.removeEventListener("mousemove",this.Uv,{capture:!0}),this.Gv&&No.removeEventListener(tV,this.Gv),clearTimeout(this.Zv),(t=this.Vv)===null||t===void 0||t.stop(),this.ko=!1)}Qv(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:Fn)===null||l===void 0?void 0:l.getComputedStyle(c).position}catch{return!1}if(as(a,h))return!0;c=vst(c)}return!1})(rV(t),["fixed","sticky"],i);return{x:t.clientX+(r?0:o),y:t.clientY+(r?0:n),target_fixed:r,type:e}}Mr(t,e="click"){var n;if(Bst(t.target)||!$2e(t))return;const o=this.Qv(t,e);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&Dst(rV(t),this.instance.config.rageclick)&&this.Zs(sn(sn({},o),{},{type:"rageclick"})),this.Zs(o)}Wv(t){!Bst(t.target)&&$2e(t)&&(clearTimeout(this.Zv),this.Zv=setTimeout(()=>{this.Zs(this.Qv(t,"mousemove"))},500))}Zs(t){if(!Fn)return;const e=this.Ir.disable_capture_url_hashes?rQ(Fn.location.href):Fn.location.href,n=this.Ir.custom_personal_data_properties,o=this.Ir.mask_personal_data_properties?[...kk,...n||[]]:[],i=lV(e,o,gV);this.Rt=this.Rt||{},this.Rt[i]||(this.Rt[i]=[]),this.Rt[i].push(t)}yl(){this.Rt&&!nx(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Gst,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.Lv=!1,this.ko=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Jv=()=>{clearTimeout(this.Kv),this.Kv=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.Xv=n=>{var o;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Fs(n?.name)||Fs(n?.value))return void FM.error("Invalid metric received",n);const i=typeof n.navigationURL=="string"?n.navigationURL:void 0,r=this.Yv(i);if(Eo(r))return;const s=qd(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${r}`;if(this.tf&&n.value>=this.tf)return void FM.error("Ignoring metric with value >= "+this.tf,n);this.Rt.navigationKey!==s&&(this.Jv(),this.Kv=setTimeout(this.Jv,this.flushToCaptureTimeoutMs)),Eo(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=r),this.Rt.firstMetricTimestamp=Eo(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(o=this._instance.sessionManager)===null||o===void 0?void 0:o.checkAndGetSessionAndWindowId(!0),A=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 D9n){const g=l==="url"&&typeof n.attribution[l]=="string"?this.Yv(n.attribution[l]):n.attribution[l];Eo(g)||(c[l]=g)}A.attribution=c}else delete A.attribution;Eo(a)||(A.$session_id=a.sessionId,A.$window_id=a.windowId),this.Rt.metrics.push(A),this.Rt.metrics.length===this.allowedMetrics.length&&this.Jv()},this.ef=()=>{if(this.ko)return;let n,o,i,r,s=!1;const a=Ur.__PosthogExtensions__,A=a?.postHogWebVitalsCallbacksByFlavor,c=A?.[this.if]||(this.if==="web-vitals"&&Eo(A)?a?.postHogWebVitalsCallbacks:void 0);if(!Eo(c)){const u=c.withoutAttribution,h=this.attributionMetrics;s=!Eo(u),n=h.indexOf("LCP")>-1?c.onLCP:u?.onLCP||c.onLCP,o=h.indexOf("CLS")>-1?c.onCLS:u?.onCLS||c.onCLS,i=h.indexOf("FCP")>-1?c.onFCP:u?.onFCP||c.onFCP,r=h.indexOf("INP")>-1?c.onINP:u?.onINP||c.onINP}if(!(n&&o&&i&&r))return void FM.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.Xv.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&o(this.Xv.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Xv.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&r(this.Xv.bind(this),g),this.ko=!0},this.Lv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[n2e]),this.startIfEnabled()}get nf(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const n=xA(this.nf)?(t=this.nf)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return Fs(n)?((e=this._instance.persistence)===null||e===void 0?void 0:e.props.$web_vitals_allowed_metrics)||Xat:n}get flushToCaptureTimeoutMs(){return(xA(this.nf)?this.nf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=xA(this.nf)?this.nf.web_vitals_attribution:void 0;return hy(t)?t?Xat:[]:As(t)?t:M9n}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=xA(this.nf)?this.nf.__preview_web_vitals_soft_navs:void 0;return t!=null&&t}get tf(){const t=xA(this.nf)&&qd(this.nf.__web_vitals_max_value)?this.nf.__web_vitals_max_value:qat;return t>0&&6e4>=t?qat:t}get isEnabled(){const t=sd?.protocol;if(t!=="http:"&&t!=="https:")return FM.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=xA(this.nf)?this.nf.web_vitals:hy(this.nf)?this.nf:void 0;return hy(e)?e:this.Lv}startIfEnabled(){this.isEnabled&&!this.ko&&(FM.info("enabled, starting..."),this.Ho(this.ef))}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({[n2e]:n}),this._instance.persistence.register({[jrt]:o})),this.Lv=n,this.startIfEnabled()}get if(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ho(t){var e;const n=Ur.__PosthogExtensions__,o=this.if,i=n?.postHogWebVitalsCallbacksByFlavor;i?.[o]||o==="web-vitals"&&Eo(i)&&n?.postHogWebVitalsCallbacks?t():n==null||(e=n.loadExternalDependency)===null||e===void 0||e.call(n,this._instance,o,r=>{r?FM.error("failed to load script",r):t()})}Yv(t){const e=t||Fn?.location.href;if(!e)return void FM.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?rQ(e):e,o=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...kk,...o||[]]:[];return lV(n,i,gV)}}},o7n={exceptionObserver:class{constructor(t){var e;this.ef=()=>{var n;if(!Fn||!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.sf&&this.Ir.capture_unhandled_errors&&(this.sf=o(this.captureException.bind(this))),!this.rf&&this.Ir.capture_unhandled_rejections&&(this.rf=i(this.captureException.bind(this))),!this.af&&this.Ir.capture_console_errors&&(this.af=r(this.captureException.bind(this)))}catch(s){yV.error("failed to start",s),this.lf()}},this._instance=t,this.uf=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[e2e]),this.wt=new e4n(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,A:yV})),this.Ir=this.hf(),this.startIfEnabledOrStop()}hf(){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):(Eo(t)?this.uf:t)&&(e=sn(sn({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Ir.capture_console_errors||this.Ir.capture_unhandled_errors||this.Ir.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(yV.info("enabled"),this.lf(),this.Ho(this.ef)):this.lf()}Ho(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 yV.error("failed to load script",i);t()})}lf(){var t,e,n;(t=this.sf)===null||t===void 0||t.call(this),this.sf=void 0,(e=this.rf)===null||e===void 0||e.call(this),this.rf=void 0,(n=this.af)===null||n===void 0||n.call(this),this.af=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.uf=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[e2e]:this.uf}),this.Ir=this.hf(),this.startIfEnabledOrStop())}onConfigChange(){this.Ir=this.hf()}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 yV.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.cf=[],this.df=new u4n([new Q4n,new k4n,new w4n,new v4n,new R4n,new N4n,new M4n,new T4n],(function(o,...i){return(r,s=0)=>{const a=[],A=r.split(`
|
|
240
|
+
at ${i.filename}:${r}:${s}`}};const P4n=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var M4n=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(P4n);return i&&(n=i[1],o=i[2]),[n,o]}};const D4n=["fatal","error","warning","log","info","debug"];function yrt(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 N4n=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(Pye(e))return e.constructor.name;const n="name"in e?e.name:void 0;return nA(n)&&!KK(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: ${yrt(e)}`}isSeverityLevel(e){return nA(e)&&!KK(e)&&D4n.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(Ek(o))return o}}getObjectClassName(e){try{const n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}},R4n=class{match(e){return Pye(e)}coerce(e,n){var o;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${yrt(e)}`,stack:(o=n.syntheticException)===null||o===void 0?void 0:o.stack,synthetic:!0}}},T4n=class{match(e){return Sit(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}}},k4n=class{match(e){return Rte(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Pye(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 Sit(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 Vte="$message",zte="$timestamp",F4n=new Set([Vte,zte]),Kye={enabled:!0,max_bytes:32768};function Jte(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:Kye.enabled,max_bytes:H4n(t.max_bytes,Kye.max_bytes)}:sn({},Kye)}var L4n=class{constructor(e){this.ns=[],this.ss=0,this.Ir=Jte(e)}setConfig(e){this.Ir=Jte(e),this.rs()}add(e){const n=(function(i){let r;try{r=Bit(i)}catch{return}try{const s=JSON.parse(r);if(!xA(s))return;const a=s,A=a[Vte],c=a[zte];return!nA(A)||A.trim().length===0||!nA(c)&&!qd(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.Ir.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.Ir.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function H4n(t,e){if(!qd(t)||t===1/0||t===-1/0)return e;const n=Math.floor(t);return 0>n?e:n}const xrt=t=>{if(typeof t!="string")return t;try{return JSON.parse(t)}catch{return t}};function Ert(t){return typeof t=="string"||t}function Brt(t){return typeof t=="string"?t:void 0}const O4n=["$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"],brt="NativeGzipValidationError",Vye=t=>t.length>=2&&t[0]===31&&t[1]===139,Srt=(t,e)=>t===Qye.GZipJS||e===Qye.GZipJS||e==="gzip",Qrt=t=>!(!t||typeof t!="object")&&("name"in t?String(t.name):"")==="NotReadableError";let WK;const Wte=t=>{throw lrt(brt,`Native gzip produced invalid output: ${t}`)},G4n=(vrt=Wg(function*(t,e){18>t.size&&Wte("too-short");const n=new Uint8Array(yield t.slice(0,10).arrayBuffer());Vye(n)&&n[2]===8||Wte("invalid-header");const o=new DataView(yield t.slice(t.size-8).arrayBuffer());o.getUint32(0,!0)!==(r=>{const s=(()=>{if(WK)return WK;WK=[];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;WK[A]=c>>>0}return WK})();let a=4294967295;for(let A=0;r.length>A;A++)a=s[255&(a^r[A])]^a>>>8;return(4294967295^a)>>>0})(e)&&Wte("invalid-crc");const i=e.length>>>0;o.getUint32(4,!0)!==i&&Wte("invalid-size")}),function(t,e){return vrt.apply(this,arguments)});var vrt;function zye(){return zye=Wg(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=Wg(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 G4n(c,i),c}catch(i){if(n?.rethrow)throw i;return e&&console.error("Failed to gzip compress data",i),null}var o}),zye.apply(this,arguments)}function wrt(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 Y4n={}.propertyIsEnumerable;function jte(t,e){try{return Prt(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function Jye(t,e,n,o){if(0>=n.remainingNodes)return{stringValue:Oye};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:Oye};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 Jye(i.call(t),e,n,o+1)}catch{}return As(t)?{arrayValue:{values:U4n(t,e,n,o+1)}}:{kvlistValue:{values:Prt(t,e,n,o+1)}}}finally{n.ancestors.delete(t)}}return{stringValue:bk(String(t))}}function U4n(t,e,n,o){const i=[],r=Math.min(t.length,1e3);let s=0;for(;r>s&&n.remainingNodes>0;s++)try{const a=s in t?t[s]:void 0;if(Fs(a))continue;i.push(Jye(a,e,n,o))}catch{i.push({stringValue:zK})}return t.length>s&&i.push({stringValue:Oye}),i}function Prt(t,e,n,o){const i=[];for(const r in t)if(Y4n.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)||Eo(s))continue;i.push({key:bk(r),value:Jye(s,e,n,o)})}catch{i.push({key:bk(r),value:{stringValue:zK}})}}return i}function Mrt(t,e,n){return sn(sn(sn(sn({},art({},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 K4n=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function Drt(t,e){const n=art({},t),o={};for(const i of K4n)({}).hasOwnProperty.call(n,i)&&(o[i]=n[i],delete n[i]);return[...jte(n,e),...jte(o,e)]}const Nrt={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"},Rrt={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}},V4n=Rrt.info;function z4n(t){try{return bk(String(t))}catch{return zK}}function J4n(t,e,n,o){const i=t.level||"info",{text:r,number:s}=Rrt[i]||V4n,a=(function(u=Date.now()){return String(u)+"000000"})(qd(o)?o:void 0),A={};e.distinctId&&(A.posthogDistinctId=e.distinctId),e.sessionId&&(A.sessionId=e.sessionId),e.windowId&&(A["window.id"]=e.windowId),Fs(e.sessionStartTimestamp)||(A.sessionStartTimestamp=String(e.sessionStartTimestamp)),Fs(e.lastActivityTimestamp)||(A.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(A["url.full"]=e.currentUrl),e.screenName&&(A["screen.name"]=e.screenName),e.appState&&(A["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(A.feature_flags=e.activeFeatureFlags);const c=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=zK}Object.defineProperty(c,h,{value:d,enumerable:!0,writable:!0,configurable:!0})}}const g={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:s,severityText:r,body:{stringValue:z4n(t.body)},attributes:jte(c,n)};return t.trace_id&&(g.traceId=t.trace_id),t.span_id&&(g.spanId=t.span_id),Eo(t.trace_flags)||(g.flags=t.trace_flags),g}function Trt(t,e,n){return Mrt(t,e,n)}function krt(t,e,n,o){return{resourceLogs:[{resource:{attributes:Drt(e)},scopeLogs:[{scope:{name:n,version:o},logRecords:t}]}]}}var Frt=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=urt(()=>{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 Lrt(){return .75+.5*Math.random()}function Hrt(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 W4n=class{constructor(e,n,o,i,r,s=()=>Promise.resolve(),a){var A;this._instance=e,this.Ir=n,this.A=o,this.cs=i,this.ds=r,this.vs=s,this.fs=a,this.ps=new Frt(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new Art,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(x9.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.Ir.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,n){var o;if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;const i=this.Os(e);if(i===null)return;if(!i.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;const r={record:J4n(i,(o=n?.context)!==null&&o!==void 0?o:this.cs(),this.A,n?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){const n=this.Ir.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.A.info("Log was rejected in beforeSend function"),null;i=s}catch(s){return this.A.error("Error in beforeSend function for log:",s),null}return i}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),n=e-this.xs;return this.Ps>n&&n>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return Wg(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return Wg(function*(){var n;e.ps.clear();let o=(n=e._instance.getPersistedProperty(x9.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=krt(l.map(h=>h.record),e.qs(),(s=e.fs)!==null&&s!==void 0?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),u=yield e._instance.js(g);if(e._s!==A)return;if(u.kind==="too-large"&&l.length>1)e.Es=Math.max(1,Math.floor(l.length/2)),e.A.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(u),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),u.kind==="retry-later"||(u.kind==="too-large"?e.A.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):u.kind==="ok"&&e.Ir.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Ir.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(l.length),o=(a=e._instance.getPersistedProperty(x9.LogsQueue))!==null&&a!==void 0?a:[],r+=l.length,u.kind==="fatal"))throw u.error}})()}Bs(e){var n=this;return Wg(function*(){var o;const i=Math.max(0,e-n.bs),r=(o=n._instance.getPersistedProperty(x9.LogsQueue))!==null&&o!==void 0?o:[];n._instance.setPersistedProperty(x9.LogsQueue,r.slice(i)),yield n.vs()})()}qs(){return Trt(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var n;if(this._instance.optedOut)return;const o=(n=this._instance.getPersistedProperty(x9.LogsQueue))!==null&&n!==void 0?n:[];this.Is>o.length||(o.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),o.push(e),this._instance.setPersistedProperty(x9.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(Hrt(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(x9.LogsQueue);return!!e&&e.length>0}shutdown(e){var n=this;return Wg(function*(){n.ps.clear();const o=n.flush().catch(()=>{});e!==void 0?yield drt(o,e):yield o})()}flushWithTimeout(e){var n=this;return Wg(function*(){const o=n.flush();yield drt(o,e,()=>{o.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=Lrt(),this.A.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const Wye=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Ort(t){return String(t)+"000000"}function Grt(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 j4n=class{constructor(e,n,o){this._instance=e,this.Ir=n,this.A=o,this.zs=new Map,this.ps=new Frt(()=>this.flush().catch(i=>{this.A.error("Metrics flush failed:",i)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new Art,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=Wg(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.A.warn("Dropping metric with empty name");if(typeof n.value!="number"||!Number.isFinite(n.value))return void this.A.warn(`Dropping metric '${n.name}': value must be a finite number`);if(n.type==="count"&&0>n.value)return void this.A.warn(`Dropping count '${n.name}': counters are monotonic, value must be >= 0`);let o,i;try{o=n.attributes?sn({},n.attributes):void 0,i=Grt(n.type,n.name,n.unit,o)}catch(a){return void this.A.warn(`Dropping metric '${n.name}': attributes could not be serialized`,a)}let r=this.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.A.warn(`Metric name '${n.name}' is already used as a ${s}; recording it as a ${n.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(r,n.value),this.Fs()}Ks(){return this.Ir.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.A.warn(`Metric series cap reached (${this.Ir.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(Wye.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,Wye)]+=1;break}}}Os(e){const n=this.Ir.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.A.info("Metric was rejected in beforeSend function"),null;i=s}catch(s){return this.A.error("Error in beforeSend function for metric:",s),null}return i}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(Hrt(this.Ir.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return Wg(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=Lrt()):(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.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.A.error("Failed to send metrics batch:",i.error)}})()}Js(e){return n=this.co(e),o=(function(s,a,A){return Mrt(s,a,A)})(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Drt(o)},scopeMetrics:[{scope:{name:i,version:r},metrics:n}]}]};var n,o,i,r}co(e){const n=Ort(Date.now()),o=new Map;for(const a of e.values()){var i;const A=Grt(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=jte((i=a.attributes)!==null&&i!==void 0?i:{},this.A),g=Ort(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:Wye})}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 Yrt=(t,{debugEnabled:e}={})=>{const n={N(o,...i){Fn&&(f8.DEBUG||Fn.POSTHOG_DEBUG||e)&&!Eo(Fn.console)&&Fn.console&&("__rrweb_original__"in Fn.console[o]?Fn.console[o].__rrweb_original__:Fn.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)=>Yrt(`${t} ${o}`,i)};return n},gi=Yrt("[PostHog.js]"),Ad=gi.createLogger,q4n=Ad("[ExternalScriptsLoader]"),qte=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 q4n.warn(`${e} was requested but loading of external scripts is disabled.`),n("Loading of external scripts is disabled");const o=qte(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(qte(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={},Urt=(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(qte(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=Urt(t,e);jye[i]=c;const l=qte(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,Urt(t,e),n)},Ur.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{const o=t.requestRouter.endpointFor("api",e);PM(t,o,n)},f8.DEBUG=!1,f8.LIB_VERSION="1.435.5",f8.LIB_NAME="web";var Ym=f8;const X4n="$people_distinct_id",T4="distinct_id",qye="$device_id",Xye="$device_model",Xte="__alias",$4n="__cmpns",Krt="$fbc",Sk="$fbc_persistence",Vrt="$fbp",jK="$fbp_persistence",$ye="__timers",zrt="$autocapture_disabled_server_side",Zye="$heatmaps_enabled_server_side",e2e="$exception_capture_enabled_server_side",Jrt="$error_tracking_suppression_rules",t2e="$error_tracking_capture_extension_exceptions",n2e="$web_vitals_enabled_server_side",o2e="$dead_clicks_enabled_server_side",i2e="$product_tours_enabled_server_side",Wrt="$logs_capture_enabled_server_side",jrt="$web_vitals_allowed_metrics",qK="$session_recording_remote_config",Z4n="$session_recording_enabled_server_side",eBn="$replay_sample_rate",tBn="$replay_override_sampling",nBn="$replay_override_linked_flag",oBn="$replay_override_url_trigger",iBn="$replay_override_event_trigger",Qk="$sesid",qrt="$session_is_sampled",rBn="$session_past_minimum_duration",sBn="$session_recording_url_trigger_activated_session",aBn="$session_recording_event_trigger_activated_session",ABn="$debug_first_full_snapshot_timestamp",cBn="$sess_rec_flush_size",k4="$enabled_feature_flags",C8="$active_feature_flags",r2e="$early_access_features",MM="$feature_flag_details",sQ="$feature_flag_payloads",DM="$feature_flag_request_id",XK="$minimal_flag_called_events",B9="$override_feature_flags",NM="$override_feature_flag_payloads",aQ="$stored_person_properties",AQ="$stored_group_properties",Xrt="$groups",$K="$surveys",$te="$surveys_loaded_at",$rt="$surveys_activated",Zrt="$surveys_activated_session",est="$surveys_activated_timestamps",s2e="ph_product_tours",lBn="$product_tours_activated",gBn="$product_tours_activated_session",uBn="$conversations_widget_session_id",dBn="$conversations_ticket_id",hBn="$conversations_widget_state",pBn="$conversations_user_traits",cQ="$flag_call_reported",ZK="$flag_call_reported_session_id",eV="$feature_flag_errors",lQ="$feature_flag_evaluated_at",py="$user_state",a2e="$client_session_props",mBn="$capture_rate_limit",tst="$initial_campaign_params",nst="$initial_referrer_info",vk="$initial_person_info",A2e="$epp",c2e="$posthog_cookieless",ost="$cookieless_mode",ist="$sdk_debug_extensions_init_method",rst="$sdk_debug_extensions_init_time_ms",l2e="$sdk_debug_recording_script_not_loaded",g2e="$sdk_debug_replay_stale_config",sst="$sdk_debug_replay_event_trigger_status",ast="$sdk_debug_replay_linked_flag_trigger_status",Ast="$sdk_debug_replay_matched_recording_trigger_groups",cst="$sdk_debug_replay_pending_trigger_conditions",lst="$sdk_debug_replay_remote_trigger_matching_config",gst="$sdk_debug_replay_trigger_groups_count",ust="$sdk_debug_replay_url_trigger_status",_Bn="$session_recording_start_reason",u2e="PostHog loadExternalDependency extension not found.",y8="anonymous",Zte="identified",dst="identified_only",tV="visibilitychange",ene="beforeunload",d2e="$pageview",hst="$pageleave",pst="$identify",mst="$groupidentify";function wk(t,e){As(t)&&t.forEach(e)}function vl(t,e){if(!Fs(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)wye.call(t,n)&&e(t[n],n)}const jg=function(t,...e){for(const n of e)for(const o in n)n[o]!==void 0&&(t[o]=n[o]);return t};function tne(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 fBn=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)}}},h2e=function(t){const e={};return vl(t,function(n,o){(nA(n)&&n.length>0||qd(n))&&(e[o]=n)}),e};function _st(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 IBn=["herokuapp.com","vercel.app","netlify.app"];function CBn(t){const e=t?.hostname;if(!nA(e))return!1;const n=e.split(".").slice(-2).join(".");for(const o of IBn)if(n===o)return!1;return!0}function jc(t,e,n,o){const{capture:i=!1,passive:r=!0}=o??{};t?.addEventListener(e,n,{capture:i,passive:r})}function p2e(t){return t.name==="ph_toolbar_internal"}const nV=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 qd(t)&&isFinite(t)&&Math.floor(t)===t});var yBn=class Jnt{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 Jnt(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 Jnt(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}},xBn=class{generate(){const e=this.generateOrAbort();if(!Eo(e))return e;{this.Ct=0;const n=this.generateOrAbort();if(Eo(n))throw new Error("Could not generate UUID after timestamp reset");return n}}generateOrAbort(){const e=(()=>{const n=Date.now();return qd(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 yBn.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 EBn}};let fst=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};Fn&&!Eo(Fn.crypto)&&crypto.getRandomValues&&(fst=t=>crypto.getRandomValues(t));var EBn=class{nextUint32(){return this.Rt.length>this.At||(fst(this.Rt),this.At=0),this.Rt[this.At++]}constructor(){this.Rt=new Uint32Array(8),this.At=1/0}};let Ist;const F4=()=>BBn().toString(),BBn=()=>(Ist||(Ist=new xBn)).generate();let oV="";const bBn=/[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_${F4()}`;cd.$t(t,"xyz"),Pk=nV(t)==='"xyz"',cd.Lt(t)}catch{Pk=!1}return Pk},Pt(t){gi.error("cookieStore error: "+t)},Ot:nV,Dt(t){let e;try{e=JSON.parse(cd.Ot(t))||{}}catch{}return e},$t(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(oV)return oV;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_"+F4();for(;!oV&&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",oV=_)}return oV})(c);if(!g){const u=(h=>{const d=h.match(bBn);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(nV(t))))try{cd.$t(t,"",-1,e)}catch{return}}};let m2e=null;const uc={Et(){if(!ad(m2e))return m2e;let t=!0;if(Eo(Fn))t=!1;else try{const e="__mplssupport__";uc.$t(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"),m2e=t,t},Pt(t){gi.error("localStorage error: "+t)},Ot(t){try{return Fn?.localStorage.getItem(t)}catch(e){uc.Pt(e)}return null},Dt(t){try{return JSON.parse(uc.Ot(t))||{}}catch{}return null},$t(t,e){try{return Fn?.localStorage.setItem(t,JSON.stringify(e)),!0}catch(n){uc.Pt(n)}return!1},Lt(t){try{Fn?.localStorage.removeItem(t)}catch(e){uc.Pt(e)}}},_2e=[aQ,C8,k4,MM,sQ,DM,lQ,eV,cQ],RM=[qye,T4,Qk,qrt,A2e,vk,Sk,py],nne=t=>t+"_cpm",SBn=["__proto__","constructor","prototype"],f2e=t=>{if(!xA(t))return{};const e={};return Object.keys(t).forEach(n=>{SBn.indexOf(n)===-1&&(e[n]=t[n])}),e},I2e=(t,e=[])=>{const n={};return[...RM,...e].forEach(o=>{const i=t[o];Eo(i)||ad(i)||i===""||(n[o]=i)}),n},Cst=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)},yst=(t,e)=>({p:e,f:Cst(JSON.stringify(t))}),xst=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const n=cd.Dt(nne(t)),o=n?.f===Cst(e)&&As(n.p);return{properties:o?n.p:[],isValid:o}}catch{return{properties:[],isValid:!1}}},C2e=(t,e)=>e+"|"+(cd.Ot(nne(t))||""),Mk={},y2e={Et:()=>!0,Pt(t){gi.error("memoryStorage error: "+t)},Ot:t=>t in Mk?Mk[t]:null,Dt:t=>t in Mk?Mk[t]:null,$t:(t,e)=>(Mk[t]=e,!0),Lt(t){delete Mk[t]}};let TM=null;const Z0={Et(){if(!ad(TM))return TM;if(TM=!0,Eo(Fn))TM=!1;else try{const t="__support__";Z0.$t(t,"xyz"),Z0.Ot(t)!=='"xyz"'&&(TM=!1),Z0.Lt(t)}catch{TM=!1}return TM},Pt(t){gi.error("sessionStorage error: ",t)},Ot(t){try{return Fn?.sessionStorage.getItem(t)}catch(e){Z0.Pt(e)}return null},Dt(t){try{return JSON.parse(Z0.Ot(t))||null}catch{}return null},$t(t,e){try{return Fn?.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(n){Z0.Pt(n)}return!1},Lt(t){try{Fn?.sessionStorage.removeItem(t)}catch(e){Z0.Pt(e)}}};var QBn=class{constructor(e){this._instance=e}get Ir(){return this._instance.config}get consent(){return this.Do()?0:this.Lo}isOptedOut(){return this.Ir.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Ir.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Ir.opt_out_capturing_by_default}optInOut(e){this.No.$t(this.qo,e?1:0,this.Ir.cookie_expiration,this.Ir.cross_subdomain_cookie,this.Ir.secure_cookie)}reset(){this.No.Lt(this.qo,this.Ir.cross_subdomain_cookie)}get qo(){const{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:o}=this._instance.config;return o||(n?n+e:"__ph_opt_in_out_"+e)}get Lo(){const e=this.No.Ot(this.qo);return Mye(e)?1:as($5n,e)?0:-1}get No(){const e=this.Ir.opt_out_capturing_persistence_type,n=e==="localStorage"?uc:cd,o=n.Et()?n:y2e;if(!this.jo||this.jo!==o){this.jo=o;const i=e==="localStorage"?cd:uc;i.Ot(this.qo)&&(this.jo.Ot(this.qo)||this.optInOut(Mye(i.Ot(this.qo))),i.Lt(this.qo,this.Ir.cross_subdomain_cookie))}return this.jo}Do(){return!!this.Ir.respect_dnt&&[F_?.doNotTrack,F_?.msDoNotTrack,Ur.doNotTrack,F_?.globalPrivacyControl].some(e=>Mye(e))}};function Est(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 Bst(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 bst(t){return!!t&&t.nodeType===3}function x2e(t){return!!t&&t.nodeType===11&&b9(t.host)}function E2e(t){return t?Dte(t).split(/\s+/):[]}function Sst(t,e){const n=(function(o){var i;const r=Fn==null||(i=Fn.location)===null||i===void 0?void 0:i.href;return Eo(r)?void 0:Est(o,r)})(e);return!!(n&&t&&t.some(o=>n.match(o)))}function Dk(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 E2e(e)}function Qst(t){return Fs(t)?null:Dte(t).split(/(\s+)/).filter(e=>aV(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function iV(t){let e="";return Nk(t)&&!sV(t)&&t.childNodes&&t.childNodes.length&&vl(t.childNodes,function(n){var o;bst(n)&&n.textContent&&(e+=(o=Qst(n.textContent))!==null&&o!==void 0?o:"")}),Dte(e)}function rV(t){var e;return Eo(t.target)?t.srcElement||null:!((e=t.target)===null||e===void 0)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null}const B2e=["a","button","form","input","select","textarea","label"];function b2e(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 S2e(t,e){if(Eo(e))return!0;for(const n of t)if(e.some(o=>b2e(n,o)))return!0;return!1}function vst(t){const e=t.parentNode;return!(!e||!b9(e))&&e}const Q2e=[".ph-no-autocapture","[data-ph-no-autocapture]"],wst=["next","previous","prev",">","<"],vBn=[...wst,"+","-","−","–"],Pst=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Mst=[".ph-no-rageclick",".ph-no-capture"],wBn=["","text","search","email","password","url","tel","number"];function Dst(t,e){if(!Fn||v2e(t))return!1;let n,o,i;var r,s;if(hy(e)?(n=!!e&&Mst,o=void 0,i=!1):(n=(r=e?.css_selector_ignorelist)!==null&&r!==void 0?r:Mst,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")?as(wBn,(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}=Nst(t,!1);return!(function(A,c){if(A===!1||Eo(A))return!1;let l;if(A===!0)l=wst;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=>Pst(g,h)||Pst(u,h)))})(o,a.map(A=>{var c;return{safeText:iV(A).toLowerCase(),ariaLabel:((c=A.getAttribute("aria-label"))===null||c===void 0?void 0:c.toLowerCase().trim())||""}}))&&!S2e(a,n)}const v2e=t=>!t||j1(t,"html")||!b9(t),Nst=(t,e)=>{if(!Fn||v2e(t))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const o=[t];let i=t;for(;i.parentNode&&!j1(i,"body");){if(x2e(i.parentNode)){o.push(i.parentNode.host),i=i.parentNode.host;continue}const r=vst(i);if(!r)break;if(e||B2e.indexOf(r.tagName.toLowerCase())>-1)n=!0;else try{const s=Fn.getComputedStyle(r);s&&s.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}o.push(r),i=r}return{parentIsUsefulElement:n,targetElementList:o}};function Nk(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=Dk(r);if(as(s,"ph-sensitive")||as(s,"ph-no-capture"))return!1}if(as(Dk(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 sV(t){return!!(j1(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||j1(t,"select")||j1(t,"textarea")||t.getAttribute("contenteditable")==="true")}const Rst=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}))$"),Tst=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,PBn=[16,15,14,13],MBn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),kst=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Fst=/[0-9A-Za-z_]/;function DBn(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 aV(t,e=!0){return!(Fs(t)||nA(t)&&(t=Dte(t),(e?Rst.test((t||"").replace(/[- ]/g,"")):(function(n){let o;for(Tst.lastIndex=0;o=Tst.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 PBn){const A=s+a;if(r.length>=A){const c=r.slice(s,A);if(Rst.test(c)&&DBn(c))return!0}}}return!1})(t))||(e?MBn.test(t):(function(n){let o;for(kst.lastIndex=0;o=kst.exec(n);){const i=o[1],r=o[3];if(!(i&&r&&Fst.test(i)&&Fst.test(r)))return!0}return!1})(t))))}function Lst(t){let e=iV(t);return e=`${e} ${Hst(t)}`.trim(),aV(e)?e:""}function Hst(t){let e="";return t&&t.childNodes&&t.childNodes.length&&vl(t.childNodes,function(n){var o;if(n&&((o=n.tagName)===null||o===void 0?void 0:o.toLowerCase())==="span")try{const i=iV(n);e=`${e} ${i}`.trim(),n.childNodes&&n.childNodes.length&&(e=`${e} ${Hst(n)}`.trim())}catch(i){gi.error("[AutoCapture]",i)}}),e}function Ost(t){return t.replace(/"|\\"/g,'\\"')}function NBn(t){const e=t.attr__class;if(e)return As(e)?e:E2e(e)}const one=Ad("[Dead Clicks]"),RBn=()=>!0,TBn=t=>{var e;const n=!!(!((e=t.instance.persistence)===null||e===void 0)&&e.get_property(o2e)),o=t.instance.config.capture_dead_clicks;return hy(o)?o:!!xA(o)||n};var Gst=class{get lazyLoadedDeadClicksAutocapture(){return this.Bo}constructor(e,n,o){this.instance=e,this.isEnabled=n,this.onCapture=o,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const n=e.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[o2e]:n.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Ho(()=>{this.zo()}):this.stop()}Ho(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?one.error("failed to load script",r):e()})}zo(){var e;if(No){if(!this.Bo&&(!((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.Bo=Ur.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Bo.start(No),one.info("starting...")}}else one.error("`document` not found. Cannot start.")}stop(){this.Bo&&(this.Bo.stop(),this.Bo=void 0,one.info("stopping..."))}};const AV=Ad("[SegmentIntegration]");function Yst(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()||F4();a.config.get_device_id=d,l&&h.id()&&(a.register({distinct_id:h.id(),$device_id:d()}),a.persistence.set_property(py,Zte)),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||AV.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()||(AV.info("No userId set, resetting PostHog"),A.reset()),d||(c=void 0),u.event.userId&&u.event.userId!==A.get_distinct_id()&&(AV.info("UserId set, identifying with PostHog"),A.identify(u.event.userId));let p=A.calculateEventProperties(h,u.event.properties);if(!Fs(l)){const m=u.event.properties||{},_={};for(const I of Object.keys(p))wye.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),Fs(x))return null}catch(B){return AV.error("Error in Segment filterProperties:",B),null}return x})(l,_);if(Fs(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,d2e)},identify(u){return g(u,pst)},screen(u){return g(u,"$screen")}}})(t,a,{filterProperties:r})).then(()=>{e()},A=>{AV.error("Failed to register the Segment integration",A),e()})},n)}const Ust="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 kBn=class{constructor(e,n,o,i,r,s){this.name=Ust,this.setupOnce=function(a){a(Kst(e,{organization:n,projectId:o,prefix:i,severityAllowList:r,sendExceptionsToPostHog:s==null||s}))}}},Vst=class{constructor(e){this.Uo=(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.Wo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Vo()}Vo(){var e;this.Go=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Uo)}destroy(){var e;(e=this.Go)===null||e===void 0||e.call(this),this.Go=void 0}doPageView(e,n){var o;const i=this.Zo(e,n);return this.Wo={pathname:(o=Fn?.location.pathname)!==null&&o!==void 0?o:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var n;return this.Zo(e,(n=this.Wo)===null||n===void 0?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Wo)===null||e===void 0?void 0:e.pageViewId}}Zo(e,n){const o=this.Wo;if(!o)return{$pageview_id:n};let i={$pageview_id:n,$prev_pageview_id:o.pageViewId};const r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:s,lastScrollY:a,maxScrollY:A,maxContentHeight:c,lastContentY:l,maxContentY:g}=r;if(!(Eo(s)||Eo(a)||Eo(A)||Eo(c)||Eo(l)||Eo(g))){s=Math.ceil(s),a=Math.ceil(a),A=Math.ceil(A),c=Math.ceil(c),l=Math.ceil(l),g=Math.ceil(g);const u=s>1?E9(a/s,0,1,gi):1,h=s>1?E9(A/s,0,1,gi):1,d=c>1?E9(l/c,0,1,gi):1,p=c>1?E9(g/c,0,1,gi):1;i=jg(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 cV=["flags","surveys"],FBn={[X4n]:{exposure:"hidden"},[Xte]:{exposure:"hidden"},[$4n]:{exposure:"hidden"},[$ye]:{exposure:"hidden"},[Sk]:{exposure:"hidden"},[jK]:{exposure:"hidden"},[zrt]:{exposure:"event"},[Zye]:{exposure:"hidden"},[Wrt]:{exposure:"hidden"},[e2e]:{exposure:"event"},[Jrt]:{exposure:"hidden"},[t2e]:{exposure:"event"},[n2e]:{exposure:"event"},[o2e]:{exposure:"event"},[i2e]:{exposure:"hidden"},[jrt]:{exposure:"event"},[qK]:{exposure:"hidden"},[Z4n]:{exposure:"hidden"},[Qk]:{exposure:"hidden"},[qrt]:{exposure:"event"},[eBn]:{exposure:"event",shouldSkipFromEventProperties:t=>ad(t)},[rBn]:{exposure:"event"},[sBn]:{exposure:"event"},[aBn]:{exposure:"event"},[ABn]:{exposure:"event"},[cBn]:{exposure:"hidden"},[k4]:{exposure:"hidden",storageGroup:"flags"},[C8]:{exposure:"hidden",storageGroup:"flags"},[r2e]:{exposure:"hidden"},[MM]:{exposure:"hidden",storageGroup:"flags"},[sQ]:{exposure:"hidden",storageGroup:"flags"},[DM]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[XK]:{exposure:"hidden",storageGroup:"flags"},[B9]:{exposure:"hidden"},[NM]:{exposure:"hidden"},[aQ]:{exposure:"hidden"},[AQ]:{exposure:"hidden"},[$K]:{exposure:"hidden",storageGroup:"surveys"},[$te]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[$rt]:{exposure:"event"},[Zrt]:{exposure:"hidden"},[est]:{exposure:"hidden"},[s2e]:{exposure:"hidden"},[lBn]:{exposure:"hidden"},[gBn]:{exposure:"hidden"},[uBn]:{exposure:"event"},[dBn]:{exposure:"event"},[hBn]:{exposure:"event"},[pBn]:{exposure:"event"},[cQ]:{exposure:"hidden"},[ZK]:{exposure:"hidden"},[Xrt]:{exposure:"event"},[eV]:{exposure:"hidden"},[lQ]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[py]:{exposure:"hidden"},[a2e]:{exposure:"hidden"},[mBn]:{exposure:"hidden"},[tst]:{exposure:"hidden"},[nst]:{exposure:"hidden"},[vk]:{exposure:"hidden"},[A2e]:{exposure:"hidden"},[tBn]:{exposure:"event"},[nBn]:{exposure:"event"},[oBn]:{exposure:"event"},[iBn]:{exposure:"event"},[ist]:{exposure:"event"},[rst]:{exposure:"event"},[l2e]:{exposure:"hidden"},[g2e]:{exposure:"hidden"},[sst]:{exposure:"hidden"},[ast]:{exposure:"hidden"},[Ast]:{exposure:"hidden"},[cst]:{exposure:"hidden"},[lst]:{exposure:"hidden"},[gst]:{exposure:"hidden"},[ust]:{exposure:"hidden"},[_Bn]:{exposure:"event"}},LBn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Kf=t=>{const e=FBn[t];if(e)return e;for(const[n,o]of LBn)if(t.indexOf(n)===0)return o},Rk=(t,e)=>{try{let n;return JSON.stringify(t,(o,i)=>{var r;return Ek(i)?((r=n)!==null&&r!==void 0||(n=new WeakMap),n.has(i)||n.set(i,_st(i)),n.get(i)):typeof i=="bigint"?i.toString():i},e)}catch{return Bit(t)}},x8=t=>{const e=No?.createElement("a");return Eo(e)?null:(e.href=t,e)},Tk=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," ")}},lV=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},ine=function(t,e){const n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},zst=(t,e)=>t>=e&&Eit(),Jst=(t,e,n,o)=>{if(t===0){if(Eit()){const i=e+1;return i===n&&o(),i}return e}return 0},kk=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],HBn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...kk],gV="<masked>",OBn=["li_fat_id"];function Wst(t,e,n){if(!No)return{};const o=e?[...kk,...n||[]]:[],i=jst(lV(No.URL,o,gV),t),r=(function(){const s={};return vl(OBn,function(a){const A=nV(a);s[a]=A||null}),s})();return jg(r,i)}function jst(t,e){const n=HBn.concat(e||[]),o={};return vl(n,function(i){const r=Tk(t,i);o[i]=r||null}),o}function qst(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?Tk(No.referrer,n):"";i.length&&(o.ph_keyword=i)}return o}function Xst(){return navigator.language||navigator.userLanguage}function GBn(){const t=Xst();return typeof t=="string"?t.split("-")[0]:void 0}const rne="$direct";function $st(){return No?.referrer||rne}function Zst(t,e,n=!1){const o=t?[...kk,...e||[]]:[],i=n?rQ(sd?.href):sd?.href,r=i?.substring(0,1e3);return{r:$st().substring(0,1e3),u:r?lV(r,o,gV):void 0}}function eat(t,e=!1){var n;const{r:o,u:i}=t,r=e?rQ(i):i,s={$referrer:o,$referring_domain:o==null?void 0:o==rne?rne:(n=x8(o))===null||n===void 0?void 0:n.host};if(r){s.$current_url=r;const a=x8(r);s.$host=a?.host,s.$pathname=a?.pathname;const A=jst(r);jg(s,A)}if(o){const a=qst(o);jg(s,a)}return s}function tat(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function YBn(){try{return new Date().getTimezoneOffset()}catch{return}}const UBn={flags:lQ,surveys:$te},KBn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],sne=t=>`${t}_cookie_identity_change_pending`,ane=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",E8=[k4,C8,MM,sQ,DM,lQ,XK,aQ],w2e=t=>E8.indexOf(t)!==-1,nat=[Sk,jK],oat=t=>nat.indexOf(t)!==-1,gQ=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch{return t===e}},Fk=t=>{if(!t)return{};const e=JSON.parse(t);return xA(e)?e:{}},iat=(t,e)=>{vl(t,(n,o)=>{const i=Kf(o);i&&i.exposure!=="event"||{}.hasOwnProperty.call(e,o)||delete t[o]})};var P2e=class{constructor(e,n,o=!0){if(this.Qo={},this.Jo=!1,this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=new Map,this.ia=!1,this.na=!1,this.sa=!1,this.ra=new Set,this.oa=new Set,this.Ir=e,this.aa=o,this.props={},this.la=void 0,this.ua=(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.hi=e.disable_persistence||!!n,this.No=this.ha(e),this.Xo=this.ca(e),this.load(),this.da(),e.debug&&gi.info("Persistence loaded",e.persistence,sn({},this.props)),this.update_config(e,e,n),this.save(),Fn){const i=()=>this.flush();jc(Fn,"beforeunload",i,{capture:!1}),jc(Fn,"pagehide",i,{capture:!1}),this.va=r=>{if(this.Jo&&(!r.storageArea||r.storageArea===Fn?.localStorage)&&r.key)if(r.key!==this.ua){if(this.Xo){const s=cV.find(a=>r.key===this.fa(a));s&&this.pa(r.key,s)}}else this.pa(r.key,Um)},jc(Fn,"storage",this.va)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([n,o])=>{const i=this.ea.get(n);if(!w2e(n)||i===!0)return;if(o===!0)return void this.ga(n,!0);const r=new Set(i||[]);o.forEach(s=>r.add(s)),r.size&&this.ga(n,r)})}onCrossTabFeatureFlagChange(e){return this.oa.add(e),()=>this.oa.delete(e)}destroy(){this.va&&Fn&&(Fn.removeEventListener("storage",this.va),this.va=void 0),this.oa.clear()}pa(e,n,o=!0){if(this.hi)return!1;let i,r;try{if(r=uc.Ot(e),ad(r)){const A=this.ma(n);return A.storageValue=null,n!==Um&&(A.persisted=!1),!1}i=Fk(r)}catch{return!1}const s=n===Um?i:uc.Dt(this.ua);if(s&&this.ya(s))return!1;const a=this.ba(i,n,o);return n===Um&&this.Xo&&!gQ(this._a().main,i)||this.wa(i,n,!0,r),a}ya(e){const n=this.props[T4],o=e[T4];return!Eo(n)&&!Eo(o)&&n!==o}wa(e,n,o,i){const r=this.ma(n);r.storageValue=i,n!==Um&&(r.persisted=o);try{r.fingerprint=this.ka(e,n)}catch{r.fingerprint=void 0}}ba(e,n,o){let i=!1;return E8.forEach(r=>{var s;const a=(s=Kf(r))===null||s===void 0?void 0:s.storageGroup;if(n===Um&&this.Xo&&a||n!==Um&&a!==n)return;const A=r in e,c=this.Sa(r,A?e[r]:void 0),l=this.ea.has(r)?r in this.props:A;l===r in this.props&&gQ(c,this.props[r])||(l?this.xa(r,c,!1):this.Ca(r,!1),i=!0)}),i&&o&&this.oa.forEach(r=>r()),i}$a(){if(!this.Jo)return!1;try{this.sa=!1;const e=uc.Ot(this.ua),n=this.ma(Um);let o,i=!1,r=!1;if(e!==n.storageValue)if(ad(e))n.storageValue=null;else{if(o=Fk(e),this.sa=!this.na&&this.ya(o),this.sa)return!1;r=this.ba(o,Um,!1),!this.Xo||gQ(this._a().main,o)?this.wa(o,Um,!0,e):n.storageValue=e,i=!0}return this.Xo&&cV.forEach(s=>{const a=uc.Ot(this.fa(s)),A=this.ma(s),c=o||{},l=i&&E8.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.ba(c,s,!1)||r));const g=Fk(a);r=this.ba(g,s,!1)||r,this.wa(g,s,!0,a)}),r}catch{return!1}}ga(e,n){this.ea.set(e,n);const o=Kf(e);o?.volatile||(this.ma((this.Xo?o?.storageGroup:void 0)||Um).fingerprint=void 0,this.Ta(e))}Ia(){E8.forEach(e=>this.ea.set(e,!0))}da(){if(this.Jo)try{const e=uc.Ot(this.ua),n=Fk(e);this.ma(Um).storageValue=e,E8.forEach(o=>{var i;const r=this.Xo?(i=Kf(o))===null||i===void 0?void 0:i.storageGroup:void 0,s=r?uc.Ot(this.fa(r)):null;if(r){const A=this.ma(r);A.storageValue=s,A.persisted=!ad(s)}const a=r&&!ad(s)?Fk(s):n;o in this.props?this.Ma(o,a[o],this.props[o]):o in a&&this.ga(o,!0)})}catch{}}Sa(e,n){const o=this.ea.get(e);if(!o)return n;if(o===!0)return this.props[e];if(e==="$active_feature_flags"){const s=new Set(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}Ma(e,n,o){if(!w2e(e))return;const i=this.ea.get(e);if(i===!0)return;let r=n;if(this.Jo)try{var s;const A=this.Xo?(s=Kf(e))===null||s===void 0?void 0:s.storageGroup:void 0,c=A?this.fa(A):this.ua;r=Fk(uc.Ot(c))[e]}catch{}const a=new Set(i||[]);if(e==="$active_feature_flags"){if(!Eo(n)&&!As(n)||!Eo(r)&&!As(r)||!As(o))return void this.ga(e,!0);const A=new Set(n||[]),c=new Set(r||[]),l=new Set(o);new Set([...A,...l]).forEach(g=>{A.has(g)!==l.has(g)&&a.add(g)}),a.forEach(g=>{c.has(g)===l.has(g)&&a.delete(g)})}else{if(!xA(o))return void(gQ(r,o)?this.ea.delete(e):this.ga(e,!0));{if(!Eo(n)&&!xA(n)||Eo(n)&&nx(o)&&Eo(r))return void this.ga(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&&gQ(A[l],o[l])||a.add(l)}),a.forEach(l=>{l in c==l in o&&gQ(c[l],o[l])&&a.delete(l)})}}a.size?this.ga(e,a):this.ea.delete(e)}Ea(){var e;const n=(e=this.Ir)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return qd(n)&&n>0?n:0}Pa(e){if(this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const n=I2e(e,this.Ir.cookie_persisted_properties||[]),o=yst(n,this.Ir.cookie_persisted_properties||[]),i=JSON.stringify(n)+"|"+JSON.stringify(o),r=cd.Ot(this.ua)||void 0;r&&C2e(this.ua,r)===i&&(this.Ra=i,this.Aa=r)}catch{}else try{const n=cd.Ot(this.ua)||void 0;this.Ra=n?C2e(this.ua,n):void 0,this.Aa=n}catch{}}syncCookieProperties(){return this.Fa(this.Ir)}Fa(e,n=!1){if(this.hi&&!n||this.ta||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let o;try{o=cd.Ot(this.ua)||void 0}catch{}if(!o||o===this.Aa)return!1;const i=C2e(this.ua,o);let r;try{r=f2e(JSON.parse(o))}catch{return!1}if((cd.Ot(this.ua)||void 0)!==o)return!1;this.Ra=i,this.Aa=o;const s=xst(this.ua,o),a=[...RM,...s.properties],A={};if(Object.keys(r).forEach(m=>{const _=r[m];(Eo(_)||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[T4],u=l[py],h=jg({},l);[...RM,...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||RM.indexOf(m)===-1||_!==!1&&_!==0)&&delete h[m]}}),this.props=jg(h,r),E8.forEach(m=>{const _=m in this.props;m in l===_&&gQ(l[m],this.props[m])||(_?this.Ma(m,l[m],this.props[m]):this.ga(m,!0))}),!c||"$user_state"in r||"$user_state"in this.props||this.xa(py,y8);const d=this.props[T4],p=this.props[py];return!c||d===g&&p===u||(this.na=!0,this.Yo=!0,Z0.$t(sne(this.ua),!0),this.Ca(aQ),this.Ca(C8),this.Ca(k4),this.Ca(MM),this.Ca(sQ),this.Ca(DM),this.Ca(lQ),this.Ca(eV),this.Ca(cQ),p!=="anonymous"||u!=="identified"&&r.$user_state!=="anonymous"&&(Eo(g)||d===g)||(iat(this.props,r),this.Ca(AQ)),p==="identified"?this.props.$user_id=d:delete this.props.$user_id,this.Ca(Xte)),!0}consumeCookieIdentityChange(){const e=sne(this.ua),n=this.Yo||!!Z0.Ot(e);return this.Yo=!1,n&&Z0.Lt(e),n}Oa(e=!1){return!(this.ta||this.hi&&!e||!this.Ir.cookieWinsOnConflict||this.Ir.persistence.toLowerCase()!=="localstorage+cookie"||(this.ta=!0,0))}Da(){this.ta&&(Eo(this.La)||(clearTimeout(this.La),this.La=void 0),delete this.Qo[Um],this.Na(!0))}qa(e=!0){if(this.ta)try{e?this.Da():Eo(this.La)||(clearTimeout(this.La),this.La=void 0)}finally{this.ta=!1}}isDisabled(){return!!this.hi}ha(e){KBn.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=[...RM,...a];return sn(sn({},uc),{},{Dt(l){try{let u,h={};try{u=cd.Ot(l)||void 0,h=u?f2e(JSON.parse(u)):{}}catch{}const d=JSON.parse(uc.Ot(l)||"{}");let p;if(A){const m=xst(l,u),_=[...RM,...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[T4],y=(g=d.$user_state)!==null&&g!==void 0?g:y8;c.forEach(x=>{if(_.indexOf(x)!==-1&&!(x in h)&&(I||x!=="distinct_id"&&x!=="$user_state")){const E=d[x];(m.isValid||RM.indexOf(x)===-1||E!==!1&&E!==0)&&delete d[x]}}),!I||"$user_state"in h||"$user_state"in d||(d[py]=y8),!I||("distinct_id"in f?f[T4]:d[T4])===C&&("$user_state"in f?f[py]:d[py])===y||(_2e.forEach(x=>delete d[x]),f.$user_state==="identified"&&"distinct_id"in f?d.$user_id=f[T4]:delete d.$user_id,f.$user_state!=="identified"&&(delete d[Xrt],delete d[AQ]),delete d.__alias)}p=jg(d,f)}else p=jg(h,d);return uc.$t(l,p),p}catch{}return null},$t(l,g,u,h,d,p){const m=uc.$t(l,g,void 0,void 0,p);try{const _=I2e(g,a);if(Object.keys(_).length){if(A){const f=nne(l),I=yst(_,a);if(cd.$t(f,I,u,h,d,p),cd.Ot(f)!==JSON.stringify(I)){cd.Lt(f,h);const C=I2e(g);return cd.$t(l,C,u,h,d,p),m}}cd.$t(l,_,u,h,d,p)}}catch(_){uc.Pt(_)}return m},Lt(l,g){try{Fn?.localStorage.removeItem(l),cd.Lt(l,g),cd.Lt(nne(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=y2e:s==="cookie"&&cd.Et()?(o=cd,i=!0):n.Et()?(o=n,r=!0,i=!0):cd.Et()?(o=cd,i=!0):o=y2e,this.Jo=r,this.Ko=i,o}fa(e){return`${this.ua}__${e}`}ca(e){return this.Jo&&!!e.split_storage}properties(){const e={};return vl(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.hi&&!e)return;const n=this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie",o=n?uc.Dt(this.ua):null;let i={};if(n)try{i=f2e(cd.Dt(this.ua)),vl(i,(A,c)=>{(Eo(A)||ad(A)||A==="")&&delete i[c]})}catch{}const r=this.No.Dt(this.ua);if(r&&(this.props=jg({},r)),this.Xo&&this.ja(),n&&r){var s,a;const A=o?.[T4],c=(s=o?.$user_state)!==null&&s!==void 0?s:y8,l=r[T4],g=(a=r.$user_state)!==null&&a!==void 0?a:y8;if(l!==A||g!==c){this.Yo=!0,Z0.$t(sne(this.ua),!0);const u=jg({},this.props);_2e.forEach(d=>delete u[d]),g!=="anonymous"||c!=="identified"&&i.$user_state!=="anonymous"&&(Eo(A)||l===A)||(iat(u,i),delete u[AQ]),this.props=u;const h=new Set;_2e.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={};vl(this.props,(m,_)=>{var f;((f=Kf(_))===null||f===void 0?void 0:f.storageGroup)===d&&(p[_]=m)}),nx(p)?(uc.Lt(this.fa(d)),this.Qo[d]={}):uc.$t(this.fa(d),p)&&(this.Qo[d]={persisted:!0,fingerprint:this.ka(p,d)})})}}Z0.Ot(sne(this.ua))&&(this.Yo=!0)}ja(){for(const e of cV){const n=uc.Dt(this.fa(e));if(n&&!nx(n)){const o=this.ma(e);o.persisted=!0,this.Ba(e)||(o.fingerprint=this.ka(n,e)),this.Ha(e,n)||jg(this.props,n)}}}Ba(e){return Object.keys(this.props).some(n=>{var o;return((o=Kf(n))===null||o===void 0?void 0:o.storageGroup)===e})}Ha(e,n){const o=UBn[e];if(!o)return!1;const i=n[o],r=this.props[o];return qd(i)&&qd(r)&&r>i}refreshKey(e){var n;if(this.hi||this.ra.has(e))return;const o=this.Xo?(n=Kf(e))===null||n===void 0?void 0:n.storageGroup:void 0,i=o?uc.Dt(this.fa(o)):this.No.Dt(this.ua);if(i&&e in i)this.xa(e,i[e],!1);else{if(o){const r=this.No.Dt(this.ua);if(r&&e in r)return void this.xa(e,r[e],!1)}this.Ca(e,!1)}}save(){if(this.hi)return;const e=this.Ea();e>0?Eo(this.La)&&(this.La=setTimeout(()=>{this.La=void 0,this.Na()},e)):this.Na()}flush(){Eo(this.La)||(clearTimeout(this.La),this.La=void 0,this.Na())}Na(e=!1){if(this.hi||this.ta&&!e)return;e||(this.syncCookieProperties(),this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie"||nat.forEach(r=>this.refreshKey(r)));const n=!e&&!this.ia;n||(this.sa=!1);const o=!!n&&this.$a();if(this.sa)return void(this.Ir.debug&&gi.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Xo)return this.za(),void(o&&this.oa.forEach(r=>r()));const i=this.Ua(this.No,this.ua,this.props,Um);i==="written"&&this.Pa(this.props),i!=="failed"&&(this.ea.clear(),this.na=!1,this.ra.clear()),o&&this.oa.forEach(r=>r())}za(){const{main:e,groups:n}=this._a(),o=this.Ua(this.No,this.ua,e,Um);o==="written"&&this.Pa(e),o!=="failed"&&(this.na=!1,this.ra.clear(),E8.forEach(r=>{var s;!((s=Kf(r))===null||s===void 0)&&s.storageGroup||this.ea.delete(r)}));for(const r of cV){var i;const s=n[r];if(nx(s)&&!(!((i=this.Qo[r])===null||i===void 0)&&i.persisted)){E8.forEach(A=>{var c;((c=Kf(A))===null||c===void 0?void 0:c.storageGroup)===r&&this.ea.delete(A)});continue}const a=this.Ua(uc,this.fa(r),s,r);a!=="failed"&&E8.forEach(A=>{const c=Kf(A);c?.storageGroup!==r||a!=="written"&&c.volatile||this.ea.delete(A)})}}_a(){const e={},n={flags:{},surveys:{}};return vl(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}}ka(e,n){if(n===Um)return JSON.stringify(e)+"|"+this.Wa+"|"+this.Va+"|"+this.Ga;const o={};return vl(e,(i,r)=>{var s;o[r]=!((s=Kf(r))===null||s===void 0)&&s.volatile?"__volatile__":i}),JSON.stringify(o)}Ua(e,n,o,i){const r=this.ma(i);if(i!==Um&&!r.dirty&&!Eo(r.fingerprint))return"skipped";let s;try{if(s=this.ka(o,i),s===r.fingerprint)return r.dirty=!1,"skipped"}catch{s=void 0}return e.$t(n,o,this.Wa,this.Va,this.Ga,this.Ir.debug)?(r.dirty=!1,i!==Um&&(r.persisted=!0),Eo(s)||(r.fingerprint=s),this.Jo&&(r.storageValue=uc.Ot(n)),"written"):(this.Ir.debug&&gi.warn(`failed to persist storage entry "${n}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ia(),Eo(this.La)||(clearTimeout(this.La),this.La=void 0),this.No.Lt(this.ua,!1),this.No.Lt(this.ua,!0),!e&&this.aa)for(const n of cV)uc.Lt(this.fa(n));e?delete this.Qo[Um]:this.Qo={},this.Ra=void 0,this.Aa=void 0}clear(){this.remove(),this.props={}}register_once(e,n,o){if(xA(e)){this.syncCookieProperties(),Eo(n)&&(n="None"),this.Wa=Eo(o)?this.Za:o;let i=!1;if(vl(e,(r,s)=>{this.props.hasOwnProperty(s)&&this.props[s]!==n||(this.xa(s,r),i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(xA(e)){this.syncCookieProperties(),this.Wa=Eo(n)?this.Za:n;let o=!1;if(vl(e,(i,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==i||xA(i)||As(i))&&(this.xa(r,i),o=!0)}),o)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const n=typeof e=="string"?[e]:e;let o=!1;for(const i of n)i in this.props&&(this.Ca(i),o=!0);o&&this.save()}update_campaign_params(){const e=No?.URL;if(e===this.la)return;const n=Wst(this.Ir.custom_campaign_params,this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties),o=!nx(h2e(n));return o&&this.register(n),this.la=e,o?n:void 0}update_search_keyword(){this.register((function(){const e=No?.referrer;return e?qst(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:$st(),$referring_domain:No?.referrer&&((e=x8(No.referrer))===null||e===void 0?void 0:e.host)||rne},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=Zst(this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties,this.Ir.disable_capture_url_hashes);this.register_once({[vk]:this.Ko?{r:ane(e.r),u:e.u?ane(e.u):void 0}:e},void 0)}get_initial_props(){const e={};vl([nst,tst],o=>{const i=this.props[o];i&&vl(i,function(r,s){e["$initial_"+vye(s)]=r})});const n=this.props[vk];if(n){const o=(function(i,r=!1){const s=eat(i,r),a={};return vl(s,function(A,c){a[`$initial_${vye(c)}`]=A}),a})(n,this.Ir.disable_capture_url_hashes);jg(e,o)}return e}safe_merge(e){return vl(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.hi&&!A;A||this.Fa(n,c),this.Ir=e,!A&&(i||r||a)&&(this.Ra=void 0,this.Aa=void 0,this.Fa(sn(sn({},e),{},{cookie_persisted_properties:n.cookie_persisted_properties}),c));const l=s||a?this.ha(e):this.No;this.Qa();const g=this.ca(e),u=s||g!==this.Xo,h=!A&&(u||e.cross_subdomain_cookie!==this.Va||e.secure_cookie!==this.Ga)&&this.Oa(c);this.ia=u;try{if(this.Za=this.Wa=e.cookie_expiration,this.set_disabled(A),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),u){const d=this.props;this.clear(),this.No=l,this.Xo=g,this.props=d,this.save()}else a&&(this.No=l,A||(delete this.Qo[Um],this.Na()))}finally{this.ia=!1,h&&this.qa()}}Qa(){const e=this.props[vk];if(!this.Ko||!xA(e)||typeof e.r!="string")return;const n=ane(e.r),o=typeof e.u=="string"?ane(e.u):e.u;n===e.r&&o===e.u||this.xa(vk,sn(sn({},e),{},{r:n,u:o}))}set_disabled(e){this.hi=e,this.hi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Va&&(this.Va=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,n){const o=this.props.__timers||{};o[e]=n,this.xa($ye,o),this.save()}remove_event_timer(e){const n=this.props.__timers||{},o=n[e];return Eo(o)||(delete n[e],this.xa($ye,n),this.save()),o}get_property(e){return this.props[e]}set_property(e,n){this.xa(e,n),this.save()}xa(e,n,o=!0){var i;const r=this.props[e];this.props[e]=n,o&&(e!=="distinct_id"&&e!=="$user_state"||r===n||(this.na=!0),oat(e)&&!gQ(r,n)&&this.ra.add(e),this.Ma(e,r,n),!((i=Kf(e))===null||i===void 0)&&i.volatile||this.Ta(e))}Ca(e,n=!0){delete this.props[e],n&&(w2e(e)&&this.ga(e,!0),oat(e)&&this.ra.add(e),this.Ta(e))}Ta(e){var n;const o=(n=Kf(e))===null||n===void 0?void 0:n.storageGroup;o&&(this.ma(o).dirty=!0)}ma(e){return this.Qo[e]||(this.Qo[e]={})}};const D3={GZipJS:"gzip-js",Base64:"base64"},uV={Activation:"events",Cancellation:"cancelEvents"},M2e={Popover:"popover",API:"api",Widget:"widget"},N3={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},D2e={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},N2e={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 VBn={SHOWN:"product tour shown"},rat={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},sat=Ad("[RateLimiter]");var zBn=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=>{sat.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void sat.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=(qd(A.dropped)?A.dropped:0)+1;A.dropped=l,!this.lastEventRateLimited&&this.Ja(l)&&(A.dropped=0)}return this.lastEventRateLimited=c,(i=this.instance.persistence)===null||i===void 0||i.set_property("$capture_rate_limit",A),{isRateLimited:c,remainingTokens:A.tokens}}Ka(e){const n=this.instance.config.property_denylist;return!As(n)||!n.includes(e)}Xa(){var e;if(this.Ka("$current_url")&&this.Ka("$pathname")&&sd?.pathname)return`${(e=sd.origin)!==null&&e!==void 0?e:""}${sd.pathname}`}Ja(e){var n,o;const{captureEventsBurstLimit:i,captureEventsPerSecond:r}=this,s=this.Xa(),a=this.Ka("$session_id")?(n=(o=this.instance).get_session_id)===null||n===void 0?void 0:n.call(o):void 0,A=[`${e} event(s) dropped since the last warning`,s?`triggered on ${s}`:void 0,a?`session ${a}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${A}. Config is set to ${r} events per second and ${i} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}};const uQ=Ad("[RemoteConfig]");var aat=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}Ya(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()}tl(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return uQ.info("Using preloaded remote config",this.remoteConfig),void this.el(this.remoteConfig);if(this._instance.il())return void uQ.warn("Remote config is disabled. Falling back to local config.");this.Ya(e=>{if(!e)return uQ.info("No config found after loading remote JS config. Falling back to JSON."),void this.tl(n=>{this.el(n.json,n)});this.el(e)})}catch(e){uQ.error("Error loading remote config",e),this.el()}}el(e,n){!e&&n&&(n.statusCode===0?n.error||uQ.warn("Failed to fetch remote config from PostHog."):uQ.error("Failed to fetch remote config from PostHog."));try{this._instance.el(e?{ok:!0,config:e}:{ok:!1})}catch(i){uQ.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){uQ.error("Error loading feature flags",i)}}},m5=Uint8Array,ox=Uint16Array,Lk=Uint32Array,R2e=new m5([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]),T2e=new m5([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]),Aat=new m5([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),cat=function(t,e){for(var n=new ox(31),o=0;31>o;++o)n[o]=e+=1<<t[o-1];var i=new Lk(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]},lat=cat(R2e,2),k2e=lat[1];lat[0][28]=258,k2e[258]=28;for(var gat=cat(T2e,0)[1],uat=new ox(32768),ld=0;32768>ld;++ld){var Hk=(43690&ld)>>>1|(21845&ld)<<1;uat[ld]=((65280&(Hk=(61680&(Hk=(52428&Hk)>>>2|(13107&Hk)<<2))>>>4|(3855&Hk)<<4))>>>8|(255&Hk)<<8)>>>1}var dV=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]=uat[a[t[i]-1]++]>>>15-t[i];return s},kM=new m5(288);for(ld=0;144>ld;++ld)kM[ld]=8;for(ld=144;256>ld;++ld)kM[ld]=9;for(ld=256;280>ld;++ld)kM[ld]=7;for(ld=280;288>ld;++ld)kM[ld]=8;var cne=new m5(32);for(ld=0;32>ld;++ld)cne[ld]=5;var JBn=dV(kM,9),WBn=dV(cne,5),dat=function(t){return(t/8|0)+(7&t&&1)},hat=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var o=new(t instanceof ox?ox:t instanceof Lk?Lk:m5)(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},hV=function(t,e,n){var o=e/8|0;t[o]|=n<<=7&e,t[o+1]|=n>>>8,t[o+2]|=n>>>16},F2e=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 m5(0),0];if(i==1){var s=new m5(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=L2e(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 m5(h),d]},L2e=function(t,e,n){return t.s==-1?Math.max(L2e(t.l,e,n+1),L2e(t.r,e,n+1)):e[t.s]=n},pat=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]},pV=function(t,e){for(var n=0,o=0;e.length>o;++o)n+=t[o]*e[o];return n},H2e=function(t,e,n){var o=n.length,i=dat(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)},mat=function(t,e,n,o,i,r,s,a,A,c,l){B8(e,l++,n),++i[256];for(var g=F2e(i,15),u=g[0],h=g[1],d=F2e(r,15),p=d[0],m=d[1],_=pat(u),f=_[0],I=_[1],C=pat(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=F2e(E,7),Q=S[0],w=S[1],M=19;M>4&&!Q[Aat[M-1]];--M);var k,R,F,O,U=c+5<<3,Y=pV(i,kM)+pV(r,cne)+s,J=pV(i,u)+pV(r,p)+s+14+3*M+pV(E,Q)+(2*E[16]+3*E[17]+7*E[18]);if(Y>=U&&J>=U)return H2e(e,l,t.subarray(A,A+c));if(B8(e,l,1+(Y>J)),l+=2,Y>J){k=dV(u,h),R=u,F=dV(p,m),O=p;var ee=dV(Q,w);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[Aat[B]]);l+=3*M;for(var W=[f,y],q=0;2>q;++q){var oe=W[q];for(B=0;oe.length>B;++B)B8(e,l,ee[se=31&oe[B]]),l+=Q[se],se>15&&(B8(e,l,oe[B]>>>5&127),l+=oe[B]>>>12)}}else k=JBn,R=kM,F=WBn,O=cne;for(B=0;a>B;++B)if(o[B]>255){var se;hV(e,l,k[257+(se=o[B]>>>18&31)]),l+=R[se+257],se>7&&(B8(e,l,o[B]>>>23&31),l+=R2e[se]);var ie=31&o[B];hV(e,l,F[ie]),l+=O[ie],ie>3&&(hV(e,l,o[B]>>>5&8191),l+=T2e[ie])}else hV(e,l,k[o[B]]),l+=R[o[B]];return hV(e,l,k[256]),l+R[256]},jBn=new Lk([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qBn=(function(){for(var t=new Lk(256),e=0;256>e;++e){for(var n=e,o=9;--o;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t})(),O2e=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function XBn(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=qBn[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 m5(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=H2e(I,C,g.subarray(y,x)):(I[y]=m,C=H2e(I,C,g.subarray(y,_)))}else{for(var E=jBn[u-1],B=E>>>13,S=8191&E,Q=(1<<h)-1,w=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 Lk(25e3),U=new ox(288),Y=new ox(32),J=0,ee=0,W=(y=0,0),q=0,oe=0;_>y;++y){var se=F(y),ie=32767&y,ge=M[se];if(w[ie]=ge,M[se]=ie,y>=q){var ue=_-y;if((J>7e3||W>24576)&&ue>423){C=mat(g,I,0,O,U,Y,ee,W,oe,y-oe,C),W=J=ee=0,oe=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,me=S,ye=ie-ge&32767;if(ue>2&&se==F(y-ye))for(var Me=Math.min(B,ue)-1,we=Math.min(32767,y),he=Math.min(258,ue);we>=ye&&--me&&ie!=ge;){if(g[y+le]==g[y+le-ye]){for(var Qe=0;he>Qe&&g[y+Qe]==g[y+Qe-ye];++Qe);if(Qe>le){if(le=Qe,_e=ye,Qe>Me)break;var ve=Math.min(ye,Qe-2),Pe=0;for(Ie=0;ve>Ie;++Ie){var Fe=y-ye+Ie+32768&32767,Re=Fe-w[Fe]+32768&32767;Re>Pe&&(Pe=Re,ge=Fe)}}}ye+=(ie=ge)-(ge=w[ie])+32768&32767}if(_e){O[W++]=268435456|k2e[le]<<18|gat[_e];var Be=31&k2e[le],ke=31&gat[_e];ee+=R2e[Be]+T2e[ke],++U[257+Be],++Y[ke],q=y+le,++J}else O[W++]=g[y],++U[g[y]]}}C=mat(g,I,m,O,U,Y,ee,W,oe,y-oe,C)}return hat(f,0,d+dat(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&&O2e(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),O2e(c,l-8,n.d()),O2e(c,l-4,o),c}const $Bn=!!Sye||!!YK,_at=new WeakMap,fat="text/plain";let G2e=0,lne=!1;const Iat=(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}`:""}`},mV=(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 vl(c,function(d,p){Eo(d)||Eo(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},Y2e=t=>{if(t.nl)return t.nl;const{data:e,compression:n}=t;if(!e)return;if(n===D3.GZipJS){const i=XBn((function(r){var s=r.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(r);for(var a=new m5(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 m5(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 hat(a,0,A)})(Rk(e)),{mtime:0});return{contentType:fat,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===D3.Base64){const i=(function(s){return s&&btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g,(a,A)=>String.fromCharCode(parseInt(A,16))))})(Rk(e)),r=(s=>"data="+encodeURIComponent(typeof s=="string"?s:Rk(s)))(i);return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}const o=Rk(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}},Cat=t=>{const e=()=>t.transport==="sendBeacon"?{url:mV(t.url,{compression:D3.Base64}),encodedBody:Y2e(sn(sn({},t),{},{compression:D3.Base64,nl:void 0}))}:{url:Iat(t.url,"compression"),encodedBody:Y2e(sn(sn({},t),{},{compression:void 0,nl:void 0}))};let n;try{n=Y2e(t)}catch(i){if(Srt(t.compression,Tk(t.url,"compression")))return gi.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return n&&Srt(t.compression,Tk(t.url,"compression"))&&!((o=n.body)instanceof ArrayBuffer?Vye(new Uint8Array(o)):ArrayBuffer.isView(o)&&Vye(new Uint8Array(o.buffer,o.byteOffset,o.byteLength)))?(lne=!0,e()):{url:t.url,encodedBody:n};var o},yat=t=>{try{return Cat(t)}catch(n){var e;return gi.error(n),void((e=t.callback)===null||e===void 0||e.call(t,{statusCode:0,error:n}))}},ZBn=(function(){var t=Wg(function*(e){const n=yield(function(i){return zye.apply(this,arguments)})(Rk(e.data),Ym.DEBUG,{rethrow:!0});if(!n)return e;const o=yield n.arrayBuffer();return sn(sn({},e),{},{nl:{contentType:fat,body:o,estimatedSize:o.byteLength}})});return function(e){return t.apply(this,arguments)}})(),e9n=/Failed to fetch|NetworkError|Load failed/i,xat=t=>t?.name==="TypeError"&&e9n.test(t?.message||""),Eat=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,Ute):void 0})(t());return Eo(e)?void 0:Math.min(e,3e4)}catch{return}},Bat=t=>{const e=yat(t);if(!e)return;const n=new Sye;_at.set(n,!0);const{url:o,encodedBody:i}=e;n.open(t.method||"GET",o,!0);const{contentType:r,body:s}=i??{};vl(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,Eat(()=>n.getResponseHeader("Retry-After")))}},n.send(s)},bat=t=>{const e=yat(t);if(!e)return;const{url:n,encodedBody:o}=e,{contentType:i,body:r,estimatedSize:s}=o??{},a=new Headers;vl(t.headers,function(d,p){a.append(p,d)}),i&&a.append("Content-Type",i);let A=null,c=!1;if(xit){const d=new xit;A={signal:d.signal,timeout:setTimeout(()=>{c=!0;try{d.abort(lrt("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"||xat(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=()=>{G2e-=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??(Eo(r)?0:void 0);d.keepalive=d.method==="POST"&&!t.sl&&d.keepalive!==!1&&d.body===r&&!Eo(p)&&p>=0&&52428.8>G2e+p,d.keepalive&&(u=p,G2e+=u),YK(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,Eat(()=>m.headers.get("Retry-After")))})).catch(m=>{h(),g(m)}).finally(h)}catch(d){h(),g(d)}},U2e=t=>{try{var e;const{url:n,encodedBody:o}=Cat(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 U2e(sn(sn({},t),{},{data:l(A.slice(0,c))})),void U2e(sn(sn({},t),{},{data:l(A.slice(c))}))}gi.warn(`Beacon of ~${s??0} bytes was rejected by the browser, falling back to ${YK?"fetch":"XHR"}`),YK?bat(sn(sn({},t),{},{sl:!0})):Bat(t)}catch(n){gi.warn("Beacon send failed",n)}},Sat=(t,e,n,o)=>{const i=o==="query"?e==="POST"?"sent_at":"_":void 0;return mV(n===D3.GZipJS?Iat(t,"compression"):t,sn(sn({},i?{[i]:Date.now().toString()}:{}),n===D3.GZipJS?{}:{compression:n}))},t9n=(()=>{const t=[];return YK&&t.push({transport:"fetch",method:bat}),Sye&&t.push({transport:"XHR",method:Bat}),F_?.sendBeacon&&t.push({transport:"sendBeacon",method:U2e}),t})();let Qat=!$Bn&&dy?.indexOf("MSIE")===-1&&dy?.indexOf("Mozilla")===-1;function vat(t,e,n){var o,i,r;n&&(e=sn(sn({},e),{},{callback:s=>n(s)})),t.__loaded?Qat?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,(Eo(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((s,a)=>{var A,c,l;const g=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"&&Eo(g.compression)&&g.data&&(g.compression=D3.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=Sat(g.url,g.method,g.compression,g.timestampMode);const h=t9n.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 _;xat(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===D3.GZipJS&&V5n&&typeof Promise<"u"&&!lne?ZBn(g).then(m=>{p(m)}).catch(m=>{if(Qrt(m))return lne=!0,void p(sn(sn({},g),{},{compression:void 0,url:Sat(s.url,s.method,void 0,s.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;const f="name"in _?String(_.name):"";return Qrt(_)||f===brt})(m)&&(lne=!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 n9n=class{constructor(e,n){this.rl=!0,this.ol=[],this.al=E9(n?.flush_interval_ms||3e3,250,5e3,gi.createLogger("flush interval"),3e3),this.ll=e}enqueue(e){this.ol.push(e),this.ul||this.hl()}unload(){this.cl();const e=this.ol.length>0?this.dl():{},n=Object.values(e);[...n.filter(o=>o.url.indexOf("/e")===0),...n.filter(o=>o.url.indexOf("/e")!==0)].map(o=>{this.vl(o,"sendBeacon")})}enable(){this.rl=!1,this.hl()}hl(){this.rl||(this.ul=setTimeout(()=>{if(this.cl(),this.ol.length>0){const e=this.dl();for(const n in e)this.vl(e[n])}},this.al))}vl(e,n){try{this.ll(e,n)}catch(o){gi.error(o)}}cl(){clearTimeout(this.ul),this.ul=void 0}dl(){const e={};return vl(this.ol,n=>{var o;const i=n,r=((i?i.batchKey:null)||i.url)+(i.batchGroup?`:${i.batchGroup}`:"");Eo(e[r])&&(e[r]=sn(sn({},i),{},{data:[]})),(o=e[r].data)===null||o===void 0||o.push(i.data)}),this.ol=[],e}};const o9n=["retriesPerformedSoFar"];var i9n=class{constructor(e){this._instance=e,this.fl=!1,this.pl=3e3,this.ol=[],this.ol=[],this.gl=!0,this.resume()}resume(){if(!Eo(Fn)&&"onLine"in Fn.navigator){if(this.gl=Fn.navigator.onLine,this.ml)return;this.ml=()=>{this.gl=!0,this.yl()},this.bl=()=>{this.gl=!1},jc(Fn,"online",this.ml),jc(Fn,"offline",this.bl)}}get length(){return this.ol.length}retriableRequest(e,n){let{retriesPerformedSoFar:o}=e,i=wrt(e,o9n);I8(o)&&(i.url=mV(i.url,{retry_count:o})),vat(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.ol.push({retryAt:r,requestOptions:e});let s=`Enqueued failed request for retry in ${i}`;navigator.onLine||(s+=" (Browser is offline)"),gi.warn(s),this.fl||(this.fl=!0,this._l())}_l(){if(this.wl&&clearTimeout(this.wl),this.ol.length===0)return this.fl=!1,void(this.wl=void 0);this.wl=setTimeout(()=>{this.gl&&this.ol.length>0&&this.yl(),this._l()},this.pl)}yl(){const e=Date.now(),n=[],o=this.ol.filter(i=>e>i.retryAt||(n.push(i),!1));if(this.ol=n,o.length>0)for(const{requestOptions:i}of o)this.retriableRequest(i)}unload(){this.wl&&(clearTimeout(this.wl),this.wl=void 0),this.fl=!1,Eo(Fn)||(this.ml&&(Fn.removeEventListener("online",this.ml),this.ml=void 0),this.bl&&(Fn.removeEventListener("offline",this.bl),this.bl=void 0));for(const{requestOptions:e}of this.ol)try{this._instance._send_request(sn(sn({},e),{},{transport:"sendBeacon"}))}catch(n){gi.error(n)}this.ol=[]}},r9n=class{constructor(e){this._instance=e,this.kl=()=>{var n,o,i,r;this.Sl||(this.Sl={});const s=this.scrollElement(),a=this.scrollY(),A=s?Math.max(0,s.scrollHeight-s.clientHeight):0,c=a+(s?.clientHeight||0),l=s?.scrollHeight||0;this.Sl.lastScrollY=Math.ceil(a),this.Sl.maxScrollY=Math.max(a,(n=this.Sl.maxScrollY)!==null&&n!==void 0?n:0),this.Sl.maxScrollHeight=Math.max(A,(o=this.Sl.maxScrollHeight)!==null&&o!==void 0?o:0),this.Sl.lastContentY=c,this.Sl.maxContentY=Math.max(c,(i=this.Sl.maxContentY)!==null&&i!==void 0?i:0),this.Sl.maxContentHeight=Math.max(l,(r=this.Sl.maxContentHeight)!==null&&r!==void 0?r:0)}}get xl(){return this._instance.config.scroll_root_selector}getContext(){return this.Sl}resetContext(){const e=this.Sl;return this.Sl=void 0,setTimeout(this.kl,0),e}startMeasuringScrollPosition(){jc(Fn,"scroll",this.kl,{capture:!0}),jc(Fn,"scrollend",this.kl,{capture:!0}),jc(Fn,"resize",this.kl)}scrollElement(){if(this.xl){const o=As(this.xl)?this.xl:[this.xl];for(const i of o){var e;const r=Fn==null||(e=Fn.document)===null||e===void 0?void 0:e.querySelector(i);if(r)return r}return}var n;return Fn==null||(n=Fn.document)===null||n===void 0?void 0:n.documentElement}Cl(e){var n,o;const i=e==="y"?"scrollTop":"scrollLeft";if(this.xl){const r=this.scrollElement();return r&&r[i]||0}return Fn?e==="y"?Fn.scrollY||Fn.pageYOffset||((n=Fn.document)===null||n===void 0||(n=n.documentElement)===null||n===void 0?void 0:n.scrollTop)||0:Fn.scrollX||Fn.pageXOffset||((o=Fn.document)===null||o===void 0||(o=o.documentElement)===null||o===void 0?void 0:o.scrollLeft)||0:0}scrollY(){return this.Cl("y")}scrollX(){return this.Cl("x")}};const s9n=t=>Zst(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties,t?.config.disable_capture_url_hashes);var wat=class{constructor(e,n,o,i){this.qe=r=>{const s=this.$l();if(s&&s.sessionId===r)return;const a={sessionId:r,props:this.Tl(this._instance)};this.Il.register({[a2e]:a})},this._instance=e,this.Ml=n,this.Il=o,this.Tl=i||s9n,this.Ml.onSessionId(this.qe)}$l(){return this.Il.props[a2e]}getSetOnceProps(){var e;const n=(e=this.$l())===null||e===void 0?void 0:e.props;return n?"r"in n?eat(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 vl(h2e(this.getSetOnceProps()),(n,o)=>{o==="$current_url"&&(o="url"),e[`$session_entry_${vye(o)}`]=n}),e}},gne=class{on(e,n){return this.El[e]||(this.El[e]=[]),this.El[e].push(n),()=>{this.El[e]=this.El[e].filter(o=>o!==n)}}emit(e,n){for(const o of this.El[e]||[])o(n);for(const o of this.El["*"]||[])o(e,n)}constructor(){this.El={}}};const Ok=Ad("[SessionId]"),Pat=864e5;var Mat=class{on(e,n){return this.Pl.on(e,n)}constructor(e,n,o){var i;if(this.Rl=null,this.Al=null,this.Fl=[],this.Ol=void 0,this.Dl=!1,this.Pl=new gne,this.Ll=(s,a)=>!(!I8(s)||!I8(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.Ir=e.config,this.Il=e.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Nl=void 0,this._sessionActivityTimestamp=null,this.ql=n||F4,this.jl=o||F4;const r=this.Ir.persistence_name||this.Ir.token;if(this._sessionTimeoutMs=1e3*E9(this.Ir.session_idle_timeout_seconds||1800,60,36e3,Ok.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Bl(),this.Hl="ph_"+r+"_window_id",this.zl="ph_"+r+"_primary_window_exists",this.Ul()){const s=Z0.Dt(this.Hl),a=Z0.Dt(this.zl);s&&!a?this.je=s:Z0.Lt(this.Hl),Z0.$t(this.zl,!0)}!((i=this.Ir.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Ir.bootstrap.sessionID),this.Wl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Eo(this.Fl)&&(this.Fl=[]),this.Fl.push(e),this.Xt&&e(this.Xt,this.je),()=>{this.Fl=this.Fl.filter(n=>n!==e)}}Ul(){return this.Ir.persistence!=="memory"&&!this.Il.hi&&Z0.Et()}Vl(e){e!==this.je&&(this.je=e,this.Ul()&&Z0.$t(this.Hl,e))}Gl(){return this.je?this.je:this.Ul()?Z0.Dt(this.Hl):null}Zl(e){const n=this.Rl;return!ad(n)&&!ad(e)&&5e3>Math.abs(e-n)}Ql(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.Zl(n)||(this.Rl=n,this.Il.register({[Qk]:[n,e,o]}))}Jl(){var e;const n=(e=this.Ir)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return I8(n)&&n>0}Kl(){this.Jl()?this.Il.refreshKey(Qk):(this.Il.flush(),this.Il.load())}Xl(){var e;if(ad(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Rl)return;this.Kl();const[,n,o]=this.Yl();n===this.Xt&&o===this._sessionStartTimestamp&&(this.Rl=this._sessionActivityTimestamp,this.Il.register({[Qk]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Il.flush())}tu(){const[e]=this.Yl(),n=I8(e)?e:0,o=I8(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,o)}eu(e){return this.Kl(),this.Ll(e,this.tu())}Yl(){const e=this.Il.props[Qk];return As(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Rl=null,this.Nl=void 0,clearTimeout(this.iu),this.iu=void 0,this.Ql(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 Ok.error("Bootstrap sessionID cannot be in the future"):s}catch(s){return void Ok.error("Invalid sessionID in bootstrap",s)}})(e);return!Eo(o)&&(n?this.Nl={sessionId:e,sessionStartTimestamp:o}:this.Ql(e,new Date().getTime(),o),!0)}destroy(){this.Dl=!0,this.Xl(),clearTimeout(this.iu),this.iu=void 0,this.Ol&&Fn&&(Fn.removeEventListener(ene,this.Ol,{capture:!1}),this.Ol=void 0),this.Fl=[]}Wl(){this.Ol=()=>{this.Xl(),this.Ul()&&Z0.Lt(this.zl)},jc(Fn,ene,this.Ol,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,n=null,o=!1){if(this.Ir.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const i=n||new Date().getTime(),r=this.Xt;if(o)this.Al=i;else if(ad(this.Al)||this.Al>i||i-this.Al>=1e3){var s,a;(s=(a=this.Il).syncCookieProperties)===null||s===void 0||s.call(a),this.Al=i}let[,A,c]=this.Yl();const l=!Eo(r)&&A!==r,g=this.tu();let u=this.Gl();const h=this.Nl,d=!!h&&(h.sessionStartTimestamp>i+6e4||i-h.sessionStartTimestamp>Pat),p=h?d:I8(c)&&Math.abs(i-c)>Pat;let m=!1,_=l,f=!A||!!h;const I=A;let C=!f&&!e&&this.Ll(i,g);if(C&&(C=this.eu(i),C||Ok.info("cross-tab refresh kept the session alive",{sessionId:A}),[,A,c]=this.Yl(),C||(f=!A||!!h)),f||C||p){_=!1;const B=h&&!d;A=B?h.sessionId:this.ql(),u=this.jl(),Ok.info("new session ID assigned",{sessionId:A,windowId:u,bootstrapped:!!B,changeReason:{noSessionId:f,activityTimeout:C,sessionPastMaximumLength:p}}),c=B?h.sessionStartTimestamp:i,this.Nl=void 0,m=!0}else u||(u=this.jl(),m=!0),_=_||A!==I,_&&(Ok.info("adopted cross-tab session id",{sessionId:A,windowId:u}),m=!0);const y=I8(g)&&e&&!p?g:i,x=I8(c)?c:new Date().getTime();this.Vl(u),this.Ql(A,y,x),e||this.Bl();const E={noSessionId:f,activityTimeout:C,sessionPastMaximumLength:p,crossTabAdoption:_};return m&&this.Fl.forEach(B=>B(A,u,E)),{sessionId:A,windowId:u,sessionStartTimestamp:x,changeReason:m?E:void 0,lastActivityTimestamp:g}}Bl(){this.Dl||(clearTimeout(this.iu),this.iu=setTimeout(()=>{if(!this.Dl)if(this.eu(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Pl.emit("forcedIdleReset",{idleSessionId:e})}else this.Bl()},1.1*this.sessionTimeoutMs))}};const Dat=function(t,e){if(!t)return!1;const n=t.userAgent;if(n&&wit(n,e))return!0;try{const o=t?.userAgentData;if(o?.brands&&o.brands.some(i=>wit(i?.brand,e)))return!0}catch{}return!!t.webdriver};function Nat(){return(Nat=Wg(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 a9n(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 Rat(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 une=(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}},dne=t=>t.toLowerCase(),Tat={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=>une(n,o))),not_regex:(t,e)=>e.every(n=>t.every(o=>!une(n,o))),icontains:(t,e)=>e.map(dne).some(n=>t.map(dne).some(o=>n.includes(o))),not_icontains:(t,e)=>e.map(dne).every(n=>t.map(dne).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 kat(t,e){return!t||Object.entries(t).every(([n,o])=>{const i=e?.[n];if(i==null)return!1;const r=Tat[o.operator];return!!r&&r(o.values.map(String),[String(i)])})}function K2e(t,e,n){return Rk({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}const V2e="custom",Fat="i.posthog.com",A9n=/^\/static\//,c9n=["/s/","/e/","/i/"];var l9n=class{constructor(e){this.nu={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let n=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace(`.${Fat}`,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.nu[this.apiHost]||(this.nu[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":V2e),this.nu[this.apiHost]}su(e){if(!A9n.test(e))return;const n=this.instance.config.asset_host;return typeof n=="string"&&n.trim().replace(/\/$/,"")||void 0}ru(e){const n=x8(e);return n?n.protocol+"//"+n.host+n.pathname:void 0}ou(e,n,o){if(e==="ui")return o;let i=o;const r=this.instance.config.rewriteRequestPath;if(r){var s;const a=((s=x8(o))===null||s===void 0?void 0:s.href)||o;i=r(new URL(a)).toString()}if(r&&e==="api"&&c9n.some(a=>n.indexOf(a)===0)){const a=this.ru(i);if(a){const A=this.apiHost;let c=this.au;c?.apiHost===A&&c.rewriteRequestPath===r||(c={apiHost:A,rewriteRequestPath:r,urls:new Set},this.au=c),c.urls.add(a)}}return i}isIngestionEndpoint(e){const n=this.au,o=this.ru(e);return n?.apiHost===this.apiHost&&n.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!o&&n.urls.has(o)}endpointFor(e,n=""){if(n&&(n=n[0]==="/"?n:`/${n}`),e==="ui")return this.ou(e,n,this.uiHost+n);if(e==="flags")return this.ou(e,n,this.flagsApiHost+n);if(e==="assets"){const i=this.su(n);if(i)return this.ou(e,n,`${i}${n}`)}if(this.region===V2e)return this.ou(e,n,this.apiHost+n);const o=Fat+n;switch(e){case"assets":return this.ou(e,n,`https://${this.region}-assets.${o}`);case"api":return this.ou(e,n,`https://${this.region}.${o}`)}}};const _l=Ad("[Surveys]"),Lat=t=>{try{const e=(n=>((o,i)=>`seenSurvey_${(function(r){return r.current_iteration&&r.current_iteration>0?`${r.id}_${r.current_iteration}`:r.id})(i)}`)(0,n))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(e){_l.error("Failed to persist survey seen state",e)}},g9n=[M2e.Popover,M2e.Widget,M2e.API],u9n={ignoreConditions:!1,ignoreDelay:!1,displayType:N2e.Popover},d9n=Ad("[PostHog ExternalIntegrations]"),h9n={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var p9n=class{constructor(e){this._instance=e}Ho(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 d9n.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.Ho(h9n[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())}}},m9n=class{constructor(e,n){this.A=e,this.bo=n,this.lu=new Map,this.To=!1}add(e){var n=this;return Wg(function*(){if(n.To)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(n.lu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);n.lu.set(e.name,e);try{const o=e.setup(n.bo);o&&(yield o)}catch(o){const i=n.lu.get(e.name)===e;i&&n.lu.delete(e.name),n.A.error(`Failed to set up browser extension "${e.name}"`,o),i&&n.uu(e)}})()}getExtension(e){return this.lu.get(e)}dispose(){if(this.To)return;this.To=!0;const e=Array.from(this.lu.values()).reverse();this.lu.clear();for(const n of e)this.uu(n)}uu(e){try{var n;const o=(n=e.dispose)===null||n===void 0?void 0:n.call(e);o&&L_(o.then)&&o.then(void 0,i=>{this.A.error(`Failed to dispose browser extension "${e.name}"`,i)})}catch(o){this.A.error(`Failed to dispose browser extension "${e.name}"`,o)}}},_9n=class{constructor(e){this._instance=e}initialize(){}get(e){const n=this._instance.persistence;if(typeof e=="string")return n?.get_property(e);const o={};for(const i of e){const r=n?.get_property(i);Eo(r)||(o[i]=r)}return o}set(e,n){var o;(o=this._instance.persistence)===null||o===void 0||o.register(typeof e=="string"?{[e]:n}:e)}remove(e){var n;(n=this._instance.persistence)===null||n===void 0||n.unregister(e)}};const Hat="extensionsRemoteConfig";var f9n=class{constructor(e){this.instance=e,this.To=!1,this.A=gi,this.hu=e.cu,this.kv=new _9n(e),this.onEvent=n=>Ane(this.instance.on("eventCaptured",o=>{try{n({event:o.event,properties:o.properties})}catch(i){this.A.error("Browser extension event listener failed",i)}})),this.onRemoteConfig=n=>{if(this.To)return Ane(()=>{});const o=r=>{try{n(r)}catch(s){this.A.error("Browser extension remote config listener failed",s)}},i=this.instance.du.on(Hat,o);return this.hu&&o(this.hu),Ane(i)},this.vu=new m9n(gi.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property(qye);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.vu.add(e)}getExtension(e){return this.vu.getExtension(e)}capture(e,n,o){o?this.instance.capture(e,n,{timestamp:o.timestamp,uuid:o.uuid,$set:o.set,$set_once:o.setOnce}):this.instance.capture(e,n)}registerDynamicEventProperties(e){return Ane(this.instance.fu(e))}handleRemoteConfig(e){this.To||(this.hu=e,this.instance.du.emit(Hat,e))}sendRequest(e){var n=this;return Wg(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?mV(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"?Qye.Base64:void 0,timestampMode:i.sentAt};return i.transport==="sendBeacon"?(n.instance._send_request(a),{statusCode:202}):new Promise(A=>{a.callback=A,n.instance._send_request(a)})}).apply(this,arguments)}dispose(){this.To||(this.To=!0,this.vu.dispose())}};const _V={};let z2e=0;const fV=()=>{},Oat='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Gk="Surveys module not available",Gat="sanitize_properties is deprecated. Use before_send instead",Yat="Invalid value for property_denylist config: ",I9n=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],C9n=["$feature_flag_called","$$heatmap","$snapshot"],Uat=t=>t.charAt(0)==="$"&&!as(C9n,t),y9n=/^[A-Za-z0-9_-]{1,400}$/,Kat=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Vat=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,x9n=["token","distinct_id",ost],IV="posthog",E9n=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},J2e=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:CBn(No?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:fV,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:(Fn==null||(e=Fn.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:dst,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:fV},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:vBn,ignore_text_selection:!0}:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:E9n(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))},B9n=[["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"]],zat=t=>{const e={};for(const[i,r]of B9n)Eo(t[i])||(e[r]=t[i]);const n=jg({},e,t),o=t.__preview_external_dependency_versioned_paths;return Eo(o)||(Eo(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),nA(o)&&Eo(t.asset_host)&&(n.asset_host=o)),As(t.property_blacklist)&&(Eo(t.property_denylist)?n.property_denylist=t.property_blacklist:As(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:gi.error(Yat+t.property_denylist)),n};var b9n=class{constructor(){this.__forceAllowLocalhost=!1}get pu(){return this.__forceAllowLocalhost}set pu(e){gi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},CV=class BM{gu(e){if(!e)return;const n=this.lu.indexOf(e);n!==-1&&this.lu.splice(n,1)}mu(e,n){var o;return this.gu(e),this.lu.push(n),(o=n.initialize)===null||o===void 0||o.call(n),n}yu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}bu(){if(this._u||this.config.reuseAnonymousId||this.config.segment||this.yu())return;const e=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!e&&!this.config.disable_persistence||this.wu)return;let n,o,i;e?(n=`persistence is set to '${this.config.persistence}'`,o=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(n="persistence is disabled (disable_persistence is true)",o="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._u=!0,console.warn("[PostHog.js]",`${n} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${o}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${i}`)}ku(){if(this.yu()||this.get_distinct_id()!=="$posthog_cookieless")return;const e=this.persistence;if(!e)return;this.Su()||e.load(!0);const n=this.get_distinct_id();if(!n||n==="$posthog_cookieless"){const o=this.config.get_device_id(F4());this.register({distinct_id:o,$device_id:o}),e.set_property(py,y8)}this.xu()}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.Cu=!1,this.$u=!1,this.webPerformance=new b9n,this.Tu=!1,this.version=Ym.LIB_VERSION,this.Iu=new Set,this.Mu="",this.du=new gne,this.lu=[],this.Eu=[],this.Pu=!1,this.wu=!1,this._u=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=J2e(),this.SentryIntegration=kBn,this.sentryIntegration=o=>(function(i,r){const s=Kst(i,r);return{name:Ust,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 r9n(this),this.pageViewManager=new Vst(this),this.rateLimiter=new zBn(this),this.requestRouter=new l9n(this),this.consent=new QBn(this),this.externalIntegrations=new p9n(this);const n=(e=BM.__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!==IV){var i;const r=(i=_V[o])!==null&&i!==void 0?i:new BM;return r._init(e,n,o),_V[o]=r,_V[IV][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=J2e(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=J2e(n.defaults),l=zat(n),g=jg({},c,l,{name:o,token:a});xA(c.rageclick)&&xA(l.rageclick)&&(g.rageclick=jg({},c.rageclick,l.rageclick)),xA(c.session_recording)&&xA(l.session_recording)&&(g.session_recording=jg({},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:D3.GZipJS;const u=this.Su();if(this.persistence=new P2e(this.config,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new P2e(sn(sn({},this.config),{},{persistence:"sessionStorage"}),u,!1),this.Mu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!u&&Z0.Et()){const _=Z0.Dt(this.Mu);As(_)&&_.forEach(f=>{nA(f)&&this.Iu.add(f)})}else Z0.Lt(this.Mu);const h=sn({},this.persistence.props),d=sn({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new n9n((_,f)=>this.ju(_,f),this.config.request_queue_config),this.Bu=new i9n(this),this.__request_queue=[];const p=this.yu();p||(this.sessionManager=new Mat(this),this.sessionPropsManager=new wat(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.wu=!!m&&!KK(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(F4()),y=n.bootstrap.isIdentifiedID?C:_;this.persistence.set_property(py,n.bootstrap.isIdentifiedID?Zte:y8),this.register({distinct_id:_,$device_id:y})}}if(p)this.register_once({distinct_id:c2e,$device_id:null},"");else if(!this.get_distinct_id()){const _=this.config.get_device_id(F4());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(py,y8)}return jc(Fn,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),jc(Fn,"pageshow",()=>{var _;this.Cu=!1,this.$u||(_=this.Bu)===null||_===void 0||_.resume()}),n.segment?Yst(this,()=>this.Wu()):this.Wu(),L_(this.config._onCapture)&&this.config._onCapture!==fV&&(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 Nat.apply(this,arguments)})().then(_=>{_&&this.register({[Xye]:_})}).catch(fV),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.lu.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=BM.__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.du.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({},BM.__defaultExtensionClasses),this.config.__extensionClasses),i=[];var r,s,a,A,c,l,g;o.exceptions&&this.lu.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new o.exceptions(this)),o.historyAutocapture&&this.lu.push(this.historyAutocapture=new o.historyAutocapture(this)),o.tracingHeaders&&this.lu.push(this.tracingHeaders=new o.tracingHeaders(this)),o.siteApps&&this.lu.push(this.siteApps=new o.siteApps(this)),o.sessionRecording&&!e&&this.lu.push(this.sessionRecording=new o.sessionRecording(this)),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),o.autocapture&&this.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.lu.push(this.metrics=(A=this.metrics)!==null&&A!==void 0?A:new o.metrics(this)),o.conversations&&this.lu.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new o.conversations(this)),o.productTours&&this.lu.push(this.productTours=new o.productTours(this)),o.heatmaps&&this.lu.push(this.heatmaps=new o.heatmaps(this)),o.webVitalsAutocapture&&this.lu.push(this.webVitalsAutocapture=new o.webVitalsAutocapture(this)),o.exceptionObserver&&this.lu.push(this.exceptionObserver=new o.exceptionObserver(this)),o.deadClicksAutocapture&&this.lu.push(this.deadClicksAutocapture=new o.deadClicksAutocapture(this,TBn)),o.toolbar&&this.lu.push(this.toolbar=(l=this.toolbar)!==null&&l!==void 0?l:new o.toolbar(this)),o.experiments&&this.lu.push(this.experiments=(g=this.experiments)!==null&&g!==void 0?g:new o.experiments(this)),this.lu.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.lu.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({[ist]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[rst]:o}),this.config.__preview_deferred_init_extensions&&gi.info(`PostHog extensions initialized (${o}ms)`)}el(e){var n;if(!No||!No.body)return gi.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.el(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=e),this.cu=e,this.compression=void 0,e.ok){var o;const i=e.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=as(i.supportedCompression,D3.GZipJS)?D3.GZipJS:as(i.supportedCompression,D3.Base64)?D3.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:dst}),(n=this.Xu)===null||n===void 0||n.handleRemoteConfig(e),this.lu.forEach(i=>{var r;return(r=i.onRemoteConfig)===null||r===void 0?void 0:r.call(i,e)})}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.yu())&&this.th()},1),this.eh=new aat(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()&&wk(this.__request_queue,e=>this.ju(e)),this.__request_queue=[],this.Yu()}_handle_unload(){var e,n,o,i,r,s;this.Cu=!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(hst),(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(hst,null,{transport:"sendBeacon"})}_send_request(e){vat(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){z2e++;try{let n;const o=[],i=[],r=[];wk(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){wk(a,function(c){try{if(As(c[0])){let l=A;vl(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{z2e--}}push(e){if(z2e>0&&As(e)&&nA(e[0])){const n=BM.prototype[e[0]];return void(L_(n)&&n.apply(this,e.slice(1)))}this._execute_array([e])}get nh(){return{property:Krt,persistenceKey:Sk,cookieName:"_fbc",pattern:Kat,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[Sk]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(Sk)}}}get sh(){return{property:Vrt,persistenceKey:jK,cookieName:"_fbp",pattern:Vat,register:(e,n)=>{var o;return(o=this.persistence)===null||o===void 0?void 0:o.register({[jK]:{value:e,delivered:n}})},unregister:()=>{var e;return(e=this.persistence)===null||e===void 0?void 0:e.unregister(jK)}}}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.yu())return;const n=nV(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)&&Kat.test(n)?this.oh(r,n,s):void r.unregister();const a=nA(e)&&y9n.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)&&Vat.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(Eo(e)||!nA(e))return void gi.error("No event name provided to posthog.capture");this.ku();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=crt(o?.uuid,F4);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=_(Krt),I=_(Vrt),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!==mst,e===pst);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=[],wk(Y,W=>{ee.push(U(W))});else{const W={};vl(Ek(Y)?_st(Y):Y,(q,oe)=>{O.has(q)||(W[oe]=U(q))}),ee=W}return ee})(R)})(u,R=>nA(R)?R.slice(0,E):R)),u.timestamp=l,Eo(o?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=c),h&&(u.properties=((R,F=[])=>{const O={},U=Y=>{R[Y]!==void 0&&(O[Y]=R[Y])};return O4n.forEach(U),F.forEach(U),O})(u.properties,x9n)),e===N3.DISMISSED||e===N3.SENT){const R=n?.[D2e.SURVEY_ID],F=n?.[D2e.SURVEY_ITERATION];Lat({id:R,current_iteration:F}),u.$set=sn(sn({},u.$set),{},{[a9n({id:R,current_iteration:F},e===N3.SENT?"responded":"dismissed")]:!0})}else e===N3.SHOWN&&(u.$set=sn(sn({},u.$set),{},{[D2e.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var E;if(e===VBn.SHOWN){const R=n?.[rat.TOUR_TYPE];R&&(u.$set=sn(sn({},u.$set),{},{[`${rat.TOUR_LAST_SEEN_DATE}/${R}`]:new Date().toISOString()}))}const B=sn(sn({},u.properties.$set),u.$set);if(nx(B)||this.setPersonPropertiesForFlags(B),!Fs(this.config.before_send)){const R=this.Os(u);if(!R)return;u=R,u.uuid=crt(u.uuid,F4)}this.sessionRecording&&!this.Pu&&Uat(e)&&(this.Pu=!0,setTimeout(()=>this.Pu=!1,3e4));const S=C.filter(({channel:R,update:F})=>{var O,U,Y;const J=(O=(U=u.$set)===null||U===void 0?void 0:U[R.property])!==null&&O!==void 0?O: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.du.emit("eventCaptured",u);const Q=(i=o?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),w=o?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(Q),M=sn(sn(sn({method:"POST",url:Q,data:u,compression:"best-available",preferSyncCompression:o?.send_instantly,timestampMode:w?"body":"capture-body",batchKey:o?._batchKey},w&&(!((r=u.properties)===null||r===void 0)&&r.$session_id)?{batchGroup:u.properties.$session_id+(u.properties.$window_id?`-${u.properties.$window_id}`:"")}:{}),o?.transport?{transport:o.transport}:{}),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.Cu&&(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 f9n(this)}fu(e){this.Eu.push(e);let n=!0;return()=>{if(!n)return;n=!1;const o=this.Eu.indexOf(e);o!==-1&&this.Eu.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.Iu.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.yu()&&(a[ost]=!0),e==="$snapshot"){const f=sn(sn({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=f.distinct_id,(!nA(a.distinct_id)&&!qd(a.distinct_id)||KK(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?[...kk,...I||[]]:[],[w,M]=irt(dy),[k,R]=(function(se){for(let ie=0;srt.length>ie;ie++){const[ge,ue,Ie]=srt[ie],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={};Eo(C)||(O.detectGoogleSearchApp=C);const U={},Y=(x=navigator)===null||x===void 0||(x=x.userAgentData)===null||x===void 0?void 0:x.platform,J=(E=navigator)===null||E===void 0?void 0:E.maxTouchPoints,ee=Fn==null||(B=Fn.screen)===null||B===void 0?void 0:B.width,W=Fn==null||(S=Fn.screen)===null||S===void 0?void 0:S.height,q=Fn?.devicePixelRatio;Eo(Y)||(U.userAgentDataPlatform=Y),Eo(J)||(U.maxTouchPoints=J),Eo(ee)||(U.screenWidth=ee),Eo(W)||(U.screenHeight=W),Eo(q)||(U.devicePixelRatio=q);const oe=jg(h2e({$os:w,$os_version:M,$browser:nrt(dy,navigator.vendor,F,O),$webview_app:k,$webview_app_version:R,$device:rrt(dy),$device_type:A4n(dy,U),$timezone:tat(),$timezone_offset:YBn()}),{$current_url:lV(y?rQ(sd?.href):sd?.href,Q,gV),$host:sd?.host,$pathname:sd?.pathname,$raw_user_agent:dy.length>1e3?dy.substring(0,997)+"...":dy,$browser_version:a4n(dy,navigator.vendor,F,O),$browser_language:Xst(),$browser_language_prefix:GBn(),$screen_height:Fn?.screen.height,$screen_width:Fn?.screen.width,$viewport_height:Fn?.innerHeight,$viewport_width:Fn?.innerWidth,$lib:f8.LIB_NAME,$lib_version:f8.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return f8.SDK_DIST_CHANNEL&&(oe.$sdk_dist_channel=f8.SDK_DIST_CHANNEL),oe})(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&&jg(a,this.sessionPropsManager.getSessionProps());try{var c;if(this.sessionRecording){const f=this.sessionRecording.sdkDebugProperties,I=!this.Pu&&Uat(e);for(const C in f)(I||as(I9n,C))&&(a[C]=f[C])}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===V2e&&(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=jg(a,l),e==="$pageview"&&No&&(a.title=No.title),!Eo(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)),vl(["$referrer","$referring_domain"],f=>{f in g&&delete u[f]});const p={};if(this.Eu.length>0)for(const f of this.Eu.slice())try{jg(p,f())}catch(I){gi.error("Failed to produce browser extension event properties",I)}a=jg({},A,g,u,sn(sn({},p),a)),a.$is_identified=this._isIdentified(),As(this.config.property_denylist)?vl(this.config.property_denylist,function(f){delete a[f]}):gi.error(Yat+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const m=this.config.sanitize_properties;m&&(gi.error(Gat),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.Tu&&!o)return e;const r=this.persistence.get_initial_props(),s=(i=this.sessionPropsManager)===null||i===void 0?void 0:i.getSetOnceProps();let a=jg({},r,s||{},e||{});const A=this.config.sanitize_properties;return A&&(gi.error(Gat),a=A(a,"$set_once")),n&&(this.Tu=!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.Iu.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.Iu.delete(e),this.mh()}_h(e,n){this.register({[e]:n})}Hu(){this.Iu.forEach(e=>{var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(e)}),this.Iu.clear(),this.mh()}mh(){var e;if(!this.Mu)return;if(this.config.persistence==="memory"||!((e=this.sessionPersistence)===null||e===void 0)&&e.hi||!Z0.Et())return void Z0.Lt(this.Mu);const n=[];this.Iu.forEach(o=>n.push(o)),n.length>0?Z0.$t(this.Mu,n):Z0.Lt(this.Mu)}getFeatureFlag(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var o;return(o=this.featureFlags)===null||o===void 0?void 0:o.getFeatureFlagResult(e,n)}getAllFeatureFlags(){var e,n;return(e=(n=this.featureFlags)===null||n===void 0?void 0:n.getAllFeatureFlags())!==null&&e!==void 0?e:[]}isFeatureEnabled(e,n){var o,i;return(o=(i=this.featureFlags)===null||i===void 0?void 0:i.isFeatureEnabled(e,n))!==null&&o!==void 0?o:n?.defaultValue}reloadFeatureFlags(){var e;(e=this.featureFlags)===null||e===void 0||e.reloadFeatureFlags()}updateFlags(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateFlags(e,n,o)}updateEarlyAccessFeatureEnrollment(e,n,o){var i;(i=this.featureFlags)===null||i===void 0||i.updateEarlyAccessFeatureEnrollment(e,n,o)}getEarlyAccessFeatures(e,n=!1,o){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getEarlyAccessFeatures(e,n,o)}on(e,n){return this.du.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Gk}),()=>{})}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:Gk})}getActiveMatchingSurveys(e,n=!1){this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:Gk})}onActiveMatchingSurveysChanged(e){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(e):(e([],{isLoaded:!1,error:Gk}),()=>{})}renderSurvey(e,n){var o;(o=this.surveys)===null||o===void 0||o.renderSurvey(e,n)}displaySurvey(e,n=u9n){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:Gk}}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:Gk})}wh(e){return!e||KK(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(qd(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.ku();const i=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,s=this.gh(!1),a=this.persistence.Oa();let A=!1;try{const l=this.get_distinct_id();this.register({$user_id:e}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),e!==l&&e!==this.get_property("__alias")&&(this.unregister(Xte),this.register({distinct_id:e}));const g=(this.persistence.get_property("$user_state")||"anonymous")===y8,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,Zte),this.setPersonPropertiesForFlags({$set:n||{},$set_once:o||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$identify",d,{$set:n||{},$set_once:o||{}})&&(this.Ou=K2e(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,Zte);const d=n||{},p=o||{};this.setPersonPropertiesForFlags({$set:d,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$set",{$set:d,$set_once:p})&&(this.Ou=K2e(e,n,o))}else(n||o)&&this.setPersonProperties(n,o);u||r||s?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(cQ)):h&&(n||o)&&this.reloadFeatureFlags(),A=!0}finally{a&&this.persistence.qa(A)}}setPersonProperties(e,n){if(!e&&!n||!this.bh("posthog.setPersonProperties"))return;const o=K2e(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(mst,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.il());const g=this.get_property(qye),u=this.get_property(Xye),h=this.get_property(qK);(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.Oa)===null||c===void 0?void 0:c.call(A);let m=!1;try{var _,f,I,C,y,x,E,B,S,Q,w,M,k;if((_=this.persistence)===null||_===void 0||_.clear(),(f=this.sessionPersistence)===null||f===void 0||f.clear(),this.Iu.clear(),this.mh(),Eo(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:c2e,$device_id:null},"");else{const O=this.config.get_device_id(F4());this.register_once({distinct_id:O,$device_id:e?O:g},""),e||Eo(u)||this.register({[Xye]:u})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),o&&(o.distinctID&&!this.yu()&&((k=this.persistence)===null||k===void 0||k.set_property("$user_state",o.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:o.distinctID})),(w=this.featureFlags)===null||w===void 0||w.initialize(),!Fs(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.qa)===null||F===void 0||F.call(R,m))}this.reloadFeatureFlags()}shutdown(e){var n=this;return Wg(function*(){var o,i,r,s,a,A,c,l;if(n.__loaded){n.$u=!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")?(Eo(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;jg(this.config,zat(e));const C=this.Su();if(this.persistence){const x=this.config.persistence==="sessionStorage"||this.config.persistence==="memory";var m,_;if(x&&this.sessionPersistence!==this.persistence&&((m=this.sessionPersistence)===null||m===void 0||m.remove(),(_=this.sessionPersistence)===null||_===void 0||_.destroy()),this.persistence.update_config(this.config,n,C),x)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new P2e(sn(sn({},this.config),{},{persistence:"sessionStorage"}),C,!1);else{var f;(f=this.sessionPersistence)===null||f===void 0||f.update_config(sn(sn({},this.config),{},{persistence:"sessionStorage"}),sn(sn({},n),{},{persistence:"sessionStorage"}),C)}}const y=this.Du(this.config.debug);var I;hy(y)&&(this.config.debug=y),hy(this.config.debug)&&(this.config.debug?(Ym.DEBUG=!0,uc.Et()&&uc.$t("ph_debug",!0),gi.info("set_config",{config:e,oldConfig:n,newConfig:sn({},this.config)})):(Ym.DEBUG=!1,uc.Et()&&uc.Lt("ph_debug"))),(o=this.featureFlags)===null||o===void 0||(i=o.updateConfig)===null||i===void 0||i.call(o,this.config,this.il()),(r=this.exceptionObserver)===null||r===void 0||r.onConfigChange(),(s=this.exceptions)===null||s===void 0||s.onConfigChange(),(a=this.metrics)===null||a===void 0||a.onConfigChange(),(A=this.sessionRecording)===null||A===void 0||A.startIfEnabledOrStop(),(c=this.tracingHeaders)===null||c===void 0||c.startIfEnabledOrStop(),(l=this.autocapture)===null||l===void 0||l.startIfEnabled(),(g=this.heatmaps)===null||g===void 0||g.startIfEnabled(),("capture_pageview"in e||"disable_capture_url_hashes"in e)&&((I=this.historyAutocapture)===null||I===void 0||I.startIfEnabledOrStop()),(u=this.exceptionObserver)===null||u===void 0||u.startIfEnabledOrStop(),(h=this.deadClicksAutocapture)===null||h===void 0||h.startIfEnabledOrStop(),(d=this.surveys)===null||d===void 0||d.loadIfEnabled(),this.xu(),(p=this.externalIntegrations)===null||p===void 0||p.startIfEnabledOrStop(),!n.segment&&this.config.segment&&this.persistence&&Yst(this,fV,!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:BM.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:IV;return n!==IV&&(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.bu(),this._h(A2e,!0),!0)}Su(){if(this.config.cookieless_mode==="always")return!0;const e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}xu(){var e,n;const o=this.Su();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.hi)!==o&&((r=this.persistence)===null||r===void 0||r.set_disabled(o)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.hi)!==o&&((s=this.sessionPersistence)===null||s===void 0||s.set_disabled(o)),this.mh(),o}opt_in_capturing(e){var n;if(this.config.cookieless_mode!=="always"){if(this.yu()){var o,i,r,s,a,A;(o=this.sessionRecording)===null||o===void 0||o.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),(i=this.sessionManager)===null||i===void 0||i.destroy(),(r=this.pageViewManager)===null||r===void 0||r.destroy(),this.sessionManager=new Mat(this),this.pageViewManager=new Vst(this),this.persistence&&(this.sessionPropsManager=new wat(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=BM.__defaultExtensionClasses)===null||A===void 0?void 0:A.sessionRecording;var c,l;h&&(this.sessionRecording=this.mu(this.sessionRecording,new h(this)),this.cu&&((c=this.sessionRecording)===null||c===void 0||(l=c.onRemoteConfig)===null||l===void 0||l.call(c,this.cu)))}var g,u;this.consent.optInOut(!0),this.xu(),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()),(Eo(e?.captureEventName)||e?.captureEventName)&&this.capture((u=e?.captureEventName)!==null&&u!==void 0?u:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else gi.warn(Oat)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void gi.warn(Oat);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.xu(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:c2e,$device_id:null}),this.gu(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.xu()}_is_bot(){return F_?Dat(F_,this.config.custom_blocked_useragents):void 0}th(){No&&(No.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(d2e,{title:No.title},{send_instantly:!0}),this.Au&&(No.removeEventListener(tV,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),jc(No,tV,this.Au)))}debug(e){e===!1?(Fn?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(Fn?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}il(){const e=this.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&&!Fs(n[o]),A=i in n&&!Fs(n[i]);return a?n[o]:!!A&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${o}' instead. The old field will be removed in a future major version.`),n[i])})(e,"advanced_disable_flags","advanced_disable_decide",0,gi)}Os(e){var n;if(Fs(this.config.before_send))return e;const o=Object.keys((n=e.properties)!==null&&n!==void 0?n:{}).filter(q5n),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),Fs(r)){const a=`Event '${e.event}' was rejected in beforeSend function`;return j5n(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&&Fs(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.Wo)===null||e===void 0?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,o){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(o)})}Du(e){const n=hy(e)&&!e,o=uc.Et()&&uc.Ot("ph_debug")==="true";return!n&&(!!o||e)}};CV.__defaultExtensionClasses={},CV.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]]=fBn(t.prototype[e[n]])})(CV,["identify"]);var Jat=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 W2e="$copy_autocapture",j2e=Ad("[AutoCapture]");function q2e(t,e){return e.length>t?e.slice(0,t)+"...":e}function S9n(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do e=e.previousSibling;while(e&&!b9(e));return e}function Q9n(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(x2e(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=>!Nk(x)||sV(x)));const h=[],d={};let p,m=!1,_=!1;if(vl(c,x=>{const E=Nk(x);if(j1(x,"a")&&!n&&!i?.includes("href")){const B=x.getAttribute("href");m=!!(E&&B&&aV(B))&&(s?rQ(B):B)}as(Dk(x),"ph-no-capture")&&(_=!0),h.push((function(B,S,Q,w,M=!1){const k=B.tagName.toLowerCase(),R={tag_name:k};B2e.indexOf(k)>-1&&!Q&&(R.$el_text=k.toLowerCase()==="a"||k.toLowerCase()==="button"?q2e(1024,Lst(B)):q2e(1024,iV(B)));const F=Dk(B);S||w?.includes("class")||0>=F.length||(R.classes=F.filter(function(J){return J!==""})),vl(B.attributes,function(J){var ee;if((!sV(B)||["name","id","class","aria-label"].indexOf(J.name)!==-1)&&!w?.includes(J.name)&&!S&&aV(J.value)&&(!nA(ee=J.name)||ee.substring(0,10)!=="_ngcontent"&&ee.substring(0,7)!=="_nghost")){let W=J.value;J.name==="class"&&(W=E2e(W).join(" ")),R["attr__"+J.name]=q2e(1024,J.name==="href"&&M?rQ(W):W)}});let O=1,U=1,Y=B;for(;Y=S9n(Y);)O++,Y.tagName===B.tagName&&U++;return R.nth_child=O,R.nth_of_type=U,R})(x,n,o,i,s)),vl((function(B){if(!Nk(B))return{};const S={};return vl(B.attributes,function(Q){if(Q.name&&Q.name.indexOf("data-ph-capture-attribute")===0){const w=Q.name.replace("data-ph-capture-attribute-",""),M=Q.value;w&&M&&aV(M)&&(S[w]=M)}}),S})(x),(B,S)=>{({}).hasOwnProperty.call(d,S)||(d[S]=B)})}),_)return{props:{},explicitNoCapture:_};if(u>0&&(t=c[u],h.splice(0,u)),o||(h[0].$el_text=j1(t,"a")||j1(t,"button")?Lst(t):iV(t)),m){var f,I;h[0].attr__href=m;const x=(f=x8(m))===null||f===void 0?void 0:f.host,E=Fn==null||(I=Fn.location)===null||I===void 0?void 0:I.host;x&&E&&x!==E&&(p=m)}return{props:jg((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 w=sn(sn(sn(sn({},E.text?{text:E.text}:{}),{},{"nth-child":(B=E.nth_child)!==null&&B!==void 0?B:0,"nth-of-type":(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 tne(w).sort(([k],[R])=>(function(F,O){return O>F?-1:F>O?1:0})(k,R)).forEach(([k,R])=>M[Ost(k.toString())]=Ost(R.toString())),Q+=":",Q+=tne(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:NBn(E),attr_id:E.attr__id,nth_child:E.nth_child,nth_of_type:E.nth_of_type,attributes:{}};return tne(E).filter(([w])=>w.indexOf("attr__")===0).forEach(([w,M])=>Q.attributes[w]=M),Q})})(C)):"")},!((a=h[0])===null||a===void 0)&&a.$el_text?{$el_text:(A=h[0])===null||A===void 0?void 0:A.$el_text}:{},p&&e.type==="click"?{$external_click_url:p}:{},d),target:t};var C,y}var v9n=class{do(){this.vo=void 0,clearTimeout(this.fo),this.fo=void 0}po(e){var n;if(!Nk(e))return!0;const o=(n=this.mo().css_selector_ignorelist)!==null&&n!==void 0?n:Q2e,i=new Set;let r=e;for(;r;){if(i.size>=1e3||i.has(r))return!0;i.add(r);const s=r,a=Dk(s);if(as(a,"ph-no-capture")||as(a,"ph-sensitive")||sV(s)||o.some(c=>b2e(s,c)))return!0;const A=r.parentNode;r=x2e(A)?A.host:A&&b9(A)?A:null}return!1}yo(e){if(!this.isEnabled||e.type==="pointercancel")return void this.do();if(e.type==="pointerdown"){this.do();const i=rV(e);var n;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&b9(i)&&(this.vo={target:i,excluded:this.po(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(n=this.bo)===null||n===void 0?void 0:n.distinctId}))}const o=this.vo;o&&(e.pointerId!==o.id||Math.abs(e.clientX-o.x)>5||Math.abs(e.clientY-o.y)>5?this.do():e.type==="pointerup"&&(o.released=!0,this.fo=setTimeout(()=>this.do(),0)))}_o(e){var n;const o=this.vo;this.do();const i=rV(e);if(o?.released&&o.target.isConnected&&o.distinctId===((n=this.bo)===null||n===void 0?void 0:n.distinctId)&&e.pointerId===o.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-o.x)&&5>=Math.abs(e.clientY-o.y)&&i&&(j1(i,"html")||j1(i,"body"))){var r;if(o.excluded)return null;const s=(r=this.mo().css_selector_ignorelist)!==null&&r!==void 0?r:Q2e;return[i,No?.documentElement,No?.body].some(a=>{if(!a)return!1;const A=Dk(a);return as(A,"ph-no-capture")||as(A,"ph-sensitive")||!Nk(a)||sV(a)||s.some(c=>b2e(a,c))})?null:o.target}}constructor(e){this.wo=e,this.name="autocapture",this.ko=!1,this.So=null,this.xo=!1,this.Co=new Map,this.$o=!1,this.Ir={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.To=!1,this.wo.refresh(this.Ir),this.rageclicks=new Jat(this.Ir.rageclick),this.Io=null}setup(e){this.Mo(),this.bo=e;const n=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.To?n.dispose():(this.Eo=n,this.startIfEnabled())}dispose(){var e;this.To||(this.To=!0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.Co.clear(),this.Io=null,this.Po())}mo(){return this.wo.refresh(this.Ir),this.Ir}Mo(){var e,n;return this.mo(),this.Ir.url_allowlist=(e=this.Ir.url_allowlist)===null||e===void 0?void 0:e.map(o=>new RegExp(o)),this.Ir.url_ignorelist=(n=this.Ir.url_ignorelist)===null||n===void 0?void 0:n.map(o=>new RegExp(o)),this.Ir}Ro(){if(!this.isBrowserSupported())return void j2e.info("Disabling Automatic Event Collection because this browser is not supported");if(!Fn||!No)return;const e=this.Ao=n=>{n=n||Fn?.event;try{if(n.type==="blur")return void this.do();if(n.type.indexOf("pointer")===0)return void this.yo(n);const o=n.type==="click"?this._o(n):void 0;if(ad(o))return;this.Fo(n,"$autocapture",o)}catch(o){j2e.error("Failed to capture event",o)}};if(jc(Fn,"blur",e),jc(No,"submit",e,{capture:!0}),jc(No,"change",e,{capture:!0}),jc(No,"click",e,{capture:!0}),vl(["pointerdown","pointermove","pointerup","pointercancel"],n=>{jc(No,n,e,{capture:!0})}),this.mo().capture_copied_text){const n=this.Oo=o=>{o=o||Fn?.event;try{this.Fo(o,W2e)}catch(i){j2e.error("Failed to capture clipboard event",i)}};jc(No,"copy",n,{capture:!0}),jc(No,"cut",n,{capture:!0}),jc(No,"paste",n,{capture:!0})}}Po(){this.do(),this.Ao&&(Fn?.removeEventListener("blur",this.Ao),vl(["pointerdown","pointermove","pointerup","pointercancel"],e=>{No?.removeEventListener(e,this.Ao,!0)}),No?.removeEventListener("submit",this.Ao,!0),No?.removeEventListener("change",this.Ao,!0),No?.removeEventListener("click",this.Ao,!0),this.Ao=void 0),this.Oo&&(No?.removeEventListener("copy",this.Oo,!0),No?.removeEventListener("cut",this.Oo,!0),No?.removeEventListener("paste",this.Oo,!0),this.Oo=void 0),this.ko=!1}startIfEnabled(){this.isEnabled||this.do(),!this.To&&this.bo&&this.isEnabled&&!this.ko&&(this.Ro(),this.ko=!0)}onRemoteConfig(e){if(this.To)return;if(this.xo=!0,!e.ok)return void this.startIfEnabled();const n=e.config;n.elementsChainAsString&&(this.$o=n.elementsChainAsString);const o=n.autocapture_opt_out;var i;hy(o)&&((i=this.bo)===null||i===void 0||i.kv.set("$autocapture_disabled_server_side",o),this.So=o),this.startIfEnabled()}setElementSelectors(e,n=this){if(this.To)return;e.size?this.Co.set(n,new Set(e)):this.Co.delete(n);const o=new Set;this.Co.forEach(i=>{i.forEach(r=>o.add(r))}),this.Io=o}getElementSelectors(e,n){var o;const i=[];return(o=this.Io)===null||o===void 0||o.forEach(r=>{const s=No?.querySelectorAll(r);s?.forEach(a=>{e!==a&&n!==a||as(i,r)||i.push(r)})}),i}get isEnabled(){var e,n;if(this.To)return!1;const o=(e=this.bo)===null||e===void 0?void 0:e.kv.get(zrt),i=this.So,r=this.mo();if(!r.remoteRequestsDisabled&&!this.xo)return!1;const s=r.remoteRequestsDisabled&&!this.xo;if(ad(i)&&!hy(o)&&!s)return!1;const a=(n=this.So)!==null&&n!==void 0?n:!!o;return!!r.enabled&&!a}Fo(e,n="$autocapture",o){if(!this.isEnabled)return void this.do();let i=o||rV(e);bst(i)&&(i=i.parentNode||null);const r=this.Mo();var s;n==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&r.rageclick&&(!((s=this.rageclicks)===null||s===void 0)&&s.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&Dst(i,r.rageclick)&&this.Fo(e,"$rageclick",o);const a=n===W2e,A=a?sn(sn({},r),{},{dom_event_allowlist:void 0}):r;if(i&&(function(u,h,d,p,m,_){var f;if(!Fn||v2e(u)||d?.url_allowlist&&!Sst(d.url_allowlist,_)||d?.url_ignorelist&&Sst(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}=Nst(u,p);if(!(function(x,E){const B=E?.element_allowlist;if(Eo(B))return!0;for(const S of x)if(B.some(Q=>S.tagName.toLowerCase()===Q))return!0;return!1})(C,d)||!S2e(C,d?.css_selector_allowlist)||S2e(C,(f=d?.css_selector_ignorelist)!==null&&f!==void 0?f:Q2e))return!1;try{const x=Fn.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&&(B2e.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}=Q9n(i,{e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.$o,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(h)return!1;const p=this.getElementSelectors(i,d);if(p&&p.length>0&&(u.$element_selectors=p),n===W2e){const m=e.type||"clipboard";if(m!=="paste"){var l,g;const _=Fn==null||(l=Fn.getSelection())===null||l===void 0?void 0:l.toString(),f=Qst(_);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.bo)===null||c===void 0||c.capture(n,u),!0}}isBrowserSupported(){return L_(No?.querySelectorAll)}},w9n=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.il(),e.url_allowlist=o?.url_allowlist,e.url_ignorelist=o?.url_ignorelist,e.dom_event_allowlist=o?.dom_event_allowlist,e.element_allowlist=o?.element_allowlist,e.css_selector_allowlist=o?.css_selector_allowlist,e.css_selector_ignorelist=o?.css_selector_ignorelist,e.element_attribute_ignorelist=o?.element_attribute_ignorelist,e.capture_copied_text=o?.capture_copied_text}};const yV=Ad("[ExceptionAutocapture]"),Wat=()=>{},jat=t=>{var e;if(L_(t))return(e=t.__posthog_layer__)!==null&&e!==void 0?e:t.__rrweb_layer__};function xV(t,e,n){try{if(!(e in t))return Wat;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=jat(r);for(;s;){if(s.next===i)return void(s.next=o.next);r=s.next,s=jat(r)}}}catch{return Wat}}const P9n=Ad("[TracingHeaders]"),FM=Ad("[Web Vitals]"),qat=9e5,Xat=["CLS","FCP","INP","LCP"],M9n=["INP","LCP"],D9n=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],X2e="disabled",$at="lazy_loading",b8=Ad("[SessionRecording]"),N9n=[l2e,g2e,sst,ast,Ast,cst,lst,gst,ust],R9n=Ad("[Heatmaps]");function $2e(t){return xA(t)&&"clientX"in t&&"clientY"in t&&qd(t.clientX)&&qd(t.clientY)}const hne=Ad("[Product Tours]"),Z2e=t=>{var e;return!t.config.disable_product_tours&&!!(!((e=t.persistence)===null||e===void 0)&&e.get_property(i2e))},T9n=["$set_once","$set"],S9=Ad("[SiteApps]"),Zat="Error while initializing PostHog app with config id ",eAt=(t,e)=>t?.then?t.then(e):e(t),Yk="SDK is not enabled or survey functionality is not yet loaded",tAt="Disabled. Not loading surveys.";var k9n=class{constructor(e,n){this.wo=e,this.Th=n,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=!1,this.Eh=[],this.Ph=[],this.Rh=null,this.Ah=null,this.To=!1,this.Fh=new Set,this.onRemoteConfig=o=>{if(this.To||this.Ir.disableSurveys)return;if(!o.ok)return this.Mh=!0,this.Oh({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),_l.warn("Remote config unavailable. Not loading surveys.");const i=o.config.surveys;if(Fs(i))return _l.warn("Flags not loaded yet. Not loading surveys.");this.Dh=hy(i)?i:i.length>0,_l.info(`flags response received, isSurveysEnabled: ${this.Dh}`),this.loadIfEnabled()},this.Oh=o=>{this.Ph.slice().forEach(i=>this.Lh(i,o))}}setup(e){if(!this.To)return this.Nh=e,eAt(e.kv.initialize(),()=>{if(this.Nh!==e||this.To)return;this.Nh=void 0,this.bo=e;const n=e.onRemoteConfig(this.onRemoteConfig);this.To?n.dispose():(this.Eo=n,this.loadIfEnabled())})}dispose(){var e,n,o,i,r;this.To||(this.To=!0,this.Nh=void 0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,(n=this._surveyEventReceiver)===null||n===void 0||n.dispose(),this._surveyEventReceiver=null,(o=this._surveyManager)===null||o===void 0||(i=o.dispose)===null||i===void 0||i.call(o),this._surveyManager=null,this.Eh=[],this.Ph.forEach(s=>{s.active=!1}),this.Ph=[],(r=this.qh)===null||r===void 0||r.call(this),this.qh=void 0,this.Rh=null,this.Fh.forEach(s=>clearTimeout(s)),this.Fh.clear())}get Ir(){return this.wo.get()}initialize(){this.loadIfEnabled()}reset(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.clearInMemoryInProgressSurveyState)===null||n===void 0||n.call(e);try{var o;(o=this._surveyEventReceiver)===null||o===void 0||o.reset(),localStorage.removeItem("lastSeenSurveyDate");const i=[];for(let r=0;r<localStorage.length;r++){const s=localStorage.key(r);(s?.startsWith("seenSurvey_")||s?.startsWith("inProgressSurvey_"))&&i.push(s)}i.forEach(r=>localStorage.removeItem(r))}catch{}this.Oh()}loadIfEnabled(){if(this.To||!this.bo)return;const e=this.Ir;if(this._surveyManager)return;if(this.Ih)return void _l.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void _l.info(tAt);if(e.cookielessMode&&this.wo.isOptedOut())return void _l.info("Not loading surveys in cookieless mode without consent.");const n=this.wo.getExtensions();if(!n)return void this.jh("PostHog Extensions not found.");if(Eo(this.Dh)&&!e.advancedEnableSurveys)return;const o=this.Dh||e.advancedEnableSurveys;this.Ih=!0,this.Mh=!1;try{const i=n.generateSurveys;if(i)return this.Bh(i,o),void(this.Ih=!1);const r=n.loadExternalDependency;if(!r)return this.jh(u2e),void(this.Ih=!1);r(s=>{try{if(this.To)return;const a=this.wo.getExtensions();s||!a?.generateSurveys?this.jh("Could not load surveys script",s):this.Bh(a.generateSurveys,o)}finally{this.Ih=!1}})}catch(i){throw this.Ih=!1,this.jh("Error initializing surveys",i),i}}Bh(e,n){var o,i;if(this.To)return;this._surveyManager=e(n),this._surveyEventReceiver=this.wo.createEventReceiver(this.Oh);const r=(o=(i=this.bo)!==null&&i!==void 0?i:this.Th)===null||o===void 0?void 0:o.kv.get($K);r&&this.Hh(r),_l.info("Surveys loaded successfully"),this.zh(),this.Oh(),this.Uh({isLoaded:!0})}jh(e,n){this.Mh=!0,_l.error(e,n),this.Oh({isLoaded:!1,error:e}),this.Uh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Eh.push(e),this._surveyManager&&this.Uh({isLoaded:!0}),()=>{this.Eh=this.Eh.filter(n=>n!==e)}}getSurveys(e,n=!1){var o;const i=(o=this.bo)!==null&&o!==void 0?o:this.Th;if(!i||this.To)return;if(this.Ir.disableSurveys)return _l.info(tAt),e([]);const r=i.kv.get($K);if(r&&!n)return e(r,{isLoaded:!0}),void(this.Wh()&&this.getSurveys(()=>{},!0));if(this.Rh)return void this.Rh.then(({surveys:A,context:c})=>{this.To||e(A,c)}).catch(A=>_l.error("Error in survey callback",A));const s=this.Vh("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Ir.requestTimeoutMs}).then(A=>{try{return this.Gh(i,A)}catch(c){return _l.error("Error processing surveys response",c),this.Gh(i,{statusCode:0,error:c})}},A=>this.Gh(i,{statusCode:0,error:A}));this.Rh=s;const a=()=>{this.Rh===s&&(this.Rh=null)};s.then(A=>{a(),this.To||(this.Oh(A.context),e(A.surveys,A.context))},a).catch(A=>_l.error("Error in survey callback",A))}Vh(e,n){const o=this.bo;return o?o.sendRequest(e,n):new Promise(i=>i({statusCode:0,error:new Error(Yk)}))}Gh(e,n){if(this.To)return{surveys:[],context:{isLoaded:!1,error:Yk}};const o=n.statusCode;if(o!==200||!n.json){const r=`Surveys API could not be loaded, status: ${o}`;return o!==0?_l.error(r):n.error||_l.warn(r),this.Ah=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Ah=null;const i=n.json.surveys||[];return e.kv.set({[$K]:i,[$te]:Date.now()}),this.Hh(i),{surveys:i,context:{isLoaded:!0}}}Hh(e){var n;const o=e.filter(i=>(function(r){return!(!r.start_date||r.end_date)})(i)&&(Rat(i)||(function(r){var s;return!!(!((s=r.conditions)===null||s===void 0||(s=s.actions)===null||s===void 0||(s=s.values)===null||s===void 0)&&s.length)})(i)));(n=this._surveyEventReceiver)===null||n===void 0||n.replace(o)}Wh(){return this.Zh()&&!this.Rh&&!this.Qh()}Zh(){var e,n;const o=(e=(n=this.bo)!==null&&n!==void 0?n:this.Th)===null||e===void 0?void 0:e.kv.get($te);return qd(o)&&Date.now()-o>3e5}Qh(){return qd(this.Ah)&&3e5>Date.now()-this.Ah}markSurveyAsSeen(e,n){var o;const i={id:e,current_iteration:(o=n?.iteration)!==null&&o!==void 0?o:null};Lat(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this.Oh()}Uh(e){for(const n of this.Eh)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(o){_l.error("Error in survey callback",o)}}getActiveMatchingSurveys(e,n=!1){if(!Fs(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);_l.warn("init was not called")}onActiveMatchingSurveysChanged(e){var n,o;if(this.To)return()=>{};const i={callback:e,active:!0,revision:0};this.Ph.push(i),this.zh();const r=(n=(o=this.bo)!==null&&o!==void 0?o:this.Th)===null||n===void 0?void 0:n.kv.get($K);return this.Ir.disableSurveys||!this._surveyManager&&this.Mh&&!this.Ih||!r&&!Fs(this.Ah)&&!this.Rh?this.Lh(i,{isLoaded:!1}):this._surveyManager&&this.Lh(i),()=>{var s;i.active=!1,this.Ph=this.Ph.filter(a=>a!==i),this.Ph.length===0&&((s=this.qh)===null||s===void 0||s.call(this),this.qh=void 0)}}zh(){var e,n,o;this._surveyManager&&this.Ph.length>0&&((e=this.qh)!==null&&e!==void 0||(this.qh=(n=(o=this.wo).onMatchingConditionsChanged)===null||n===void 0?void 0:n.call(o,this.Oh)))}Lh(e,n){if(this.To||!e.active)return;const o=++e.revision,i=r=>{if(!this.To&&e.active&&o===e.revision)try{const s=n??{isLoaded:!0},a=JSON.stringify([r,s]);if(a===e.lastResult)return;e.lastResult=a,e.callback(r,s)}catch(s){_l.error("Error in active matching surveys callback",s)}};try{n&&!n.isLoaded?i([]):this.getActiveMatchingSurveys(i)}catch(r){_l.error("Error in active matching surveys callback",r)}}Jh(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}Kh(e){if(Fs(this._surveyManager))return{eligible:!1,reason:Yk};const n=typeof e=="string"?this.Jh(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}Xh(e){if(!this.wo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(Fs(this._surveyManager))return{eligible:!1,reason:Yk};const n=typeof e=="string"?this.Jh(e):e;return n?this._surveyManager.checkSurveyRenderability(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Fs(this._surveyManager))return _l.warn("init was not called"),{visible:!1,disabledReason:Yk};const n=this.Xh(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return Fs(this._surveyManager)?(_l.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Yk})):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.Xh(s);o({visible:a.eligible,disabledReason:a.reason})}else o({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(e,n,o){var i;if(!this.wo.isCapturing())return;if(Fs(this._surveyManager))return void _l.warn("init was not called");const r=typeof e=="string"?this.Jh(e):e;if(!r?.id)return void _l.warn("Survey not found");if(!g9n.includes(r.type))return void _l.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){_l.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const a=setTimeout(()=>{var A,c;this.Fh.delete(a),!this.To&&this.wo.isCapturing()&&(_l.info(`Rendering survey ${r.id} with delay of ${(A=r.appearance)===null||A===void 0?void 0:A.surveyPopupDelaySeconds} seconds`),(c=this._surveyManager)===null||c===void 0||c.renderSurvey(r,s,o),_l.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Fh.add(a)}this._surveyManager.renderSurvey(r,s,o)}else _l.warn("Survey element not found")}displaySurvey(e,n){var o;if(!this.wo.isCapturing())return;if(Fs(this._surveyManager))return void _l.warn("init was not called");const i=this.Jh(e);if(!i)return void _l.warn("Survey not found");let r=i;if(!((o=i.appearance)===null||o===void 0)&&o.surveyPopupDelaySeconds&&n.ignoreDelay&&(r=sn(sn({},i),{},{appearance:sn(sn({},i.appearance),{},{surveyPopupDelaySeconds:0})})),n.displayType!==N2e.Popover&&n.initialResponses&&_l.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),n.ignoreConditions===!1){const s=this.Kh(i);if(!s.eligible)return void _l.warn("Survey is not eligible to be displayed: ",s.reason)}n.displayType!==N2e.Inline?this._surveyManager.handlePopoverSurvey(r,n):this.renderSurvey(r,n.selector,n.properties)}cancelPendingSurvey(e){Fs(this._surveyManager)?_l.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,n;(e=this._surveyManager)===null||e===void 0||(n=e.handlePageUnload)===null||n===void 0||n.call(e)}};function Uk(t,e,n){if(Fs(t))return!1;switch(n){case"exact":return t===e;case"contains":{const o=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(o,"i").test(t)}case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}var F9n=class{constructor(e){this._instance=e,this.Yh=new Set,this.tc=new Set,this.ec=new gne,this.nc=(n,o)=>this.sc(n,o)&&this.rc(n,o)&&this.oc(n,o)&&this.ac(n,o),this.sc=(n,o)=>!o?.event||n?.event===o?.event}init(){var e,n;Eo((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.lc=(n=this._instance)===null||n===void 0?void 0:n._addCaptureHook((o,i)=>{this.on(o,i)}))}dispose(){var e,n;(e=this.lc)===null||e===void 0||e.call(this),this.lc=void 0,(n=this._instance)===null||n===void 0||(n=n.autocapture)===null||n===void 0||n.setElementSelectors(new Set,this),this.ec=new gne}register(e){var n,o;if(!Eo((n=this._instance)===null||n===void 0?void 0:n._addCaptureHook)&&(e.forEach(i=>{var r;this.Yh.add(i),(r=i.steps)===null||r===void 0||r.forEach(s=>{this.tc.add(s?.event||"")})}),(o=this._instance)===null||o===void 0?void 0:o.autocapture)){const i=new Set;this.Yh.forEach(r=>{var s;(s=r.steps)===null||s===void 0||s.forEach(a=>{a?.selector&&i.add(a.selector)})}),this._instance.autocapture.setElementSelectors(i,this)}}replace(e){this.Yh.clear(),this.tc.clear(),this.register(e)}on(e,n){n!=null&&e.length!=0&&(this.tc.has(e)||this.tc.has(n.event))&&this.Yh.forEach(o=>{this.uc(n,o)&&this.ec.emit("actionCaptured",o.name)})}hc(e){this.onAction("actionCaptured",n=>e(n))}uc(e,n){if(n?.steps==null)return!1;for(const o of n.steps)if(this.nc(e,o))return!0;return!1}onAction(e,n){return this.ec.on(e,n)}rc(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"||!Uk(i,n.url,n.url_matching||"contains"))return!1}return!0}oc(e,n){return!!this.cc(e,n)&&!!this.dc(e,n)&&!!this.vc(e,n)}cc(e,n){var o;if(!n?.href)return!0;const i=this.fc(e);if(i.length>0)return i.some(s=>Uk(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&&Uk((function(s){const a=s.match(/(?::|")href="(.*?)"/);return a?a[1]:""})(r),n.href,n.href_matching||"exact")}dc(e,n){var o;if(!n?.text)return!0;const i=this.fc(e);if(i.length>0)return i.some(c=>Uk(c.text,n.text,n.text_matching||"exact")||Uk(c.$el_text,n.text,n.text_matching||"exact"));const r=(e==null||(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)||"";return!!r&&(s=(function(c){const l=[],g=/(?::|")text="(.*?)"/g;let u;for(;!Fs(u=g.exec(c));)l.includes(u[1])||l.push(u[1]);return l})(r),a=n.text,A=n.text_matching||"exact",s.some(c=>Uk(c,a,A)));var s,a,A}vc(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}fc(e){var n;return(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements)==null?[]:e?.properties.$elements}ac(e,n){return!n?.properties||n.properties.length===0||kat(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)}},L9n=class{constructor(e,n){var o,i;this.gc=[],this._instance=e,this.mc=n,this.yc=new Map,this.bc=new Map,this._c=new Map,this.wc=(o=this._instance)===null||o===void 0||(i=o.onSessionId)===null||i===void 0?void 0:i.call(o,r=>this.kc(r))}Sc(e){return!1}xc(){return null}Cc(e){}$c(){}Tc(e,n){return!!e&&kat(e.propertyFilters,n?.properties)}Ic(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}Mc(e,n,o){const i=(o===uV.Activation?this.yc:this.bc).get(e);let r=[];return this.Ec(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.Tc(A,n)})}register(e){this.Pc(e,!1)}replace(e){this.Pc(e,!0)}Pc(e,n){var o;Eo((o=this._instance)===null||o===void 0?void 0:o._addCaptureHook)||(this.Rc(e,n),this.Ac(e,n))}Ac(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._c.clear(),o.length===0)return void(n&&((i=this.Fc)===null||i===void 0||i.replace([])));this.Fc||(this.Fc=new F9n(this._instance),this.Fc.init(),this.Fc.hc(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._c.get(A.name))!==null&&c!==void 0?c:[];l.includes(s.id)||l.push(s.id),this._c.set(A.name,l)}})}),n?this.Fc.replace(r):this.Fc.register(r)}Oc(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)})}Rc(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.Ic(e,uV.Activation),A=this.Ic(e,uV.Cancellation);n?(this.yc=a,this.bc=A):(this.Oc(this.yc,a),this.Oc(this.bc,A)),(r.length!==0||s.length!==0||e.some(c=>{var l;return(l=c.conditions)===null||l===void 0||(l=l.actions)===null||l===void 0||(l=l.values)===null||l===void 0?void 0:l.length}))&&((o=this.lc)!==null&&o!==void 0||(this.lc=(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.Dc(),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.Lc(e,s,n);if(A==="consume")return r.info("event consumed activated item, removing it",{event:e,itemId:s}),void this.Nc([s]);if(A==="persist")return r.info("shown item promoted to persisted activation",{event:e,itemId:s}),this.qc(s),void this.jc([s])}if(this.bc.has(e)){const A=this.Mc(e,n,uV.Cancellation);A.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:A.map(c=>c.id)}),this.Nc(A.map(c=>c.id)),A.forEach(c=>this.Bc(c.id)))}if(!this.yc.has(e))return;r.info("event name matched",{event:e,eventPayload:n,items:this.yc.get(e)});const a=this.Mc(e,n,uV.Activation);this.Hc(a.map(A=>A.id))}onAction(e){this._c.has(e)&&this.Hc(this._c.get(e)||[])}Hc(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.Sc(s)?this.qc(s)&&this.zc(s):r.push(s);r.length>0&&(this.gc=[...new Set([...this.gc,...r])]),this.Dc().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.Uc()}qc(e){this.gc=this.gc.filter(o=>o!==e);const n=this.Wc();return!n.includes(e)&&(this.Vc([...n,e]),this.Gc(),!0)}Nc(e){const n=new Set(e);this.gc=this.gc.filter(r=>!n.has(r));const o=this.Zc(),i=o.filter(r=>!n.has(r));i.length!==o.length&&(this.Vc(i),i.length===0&&this.Qc()),this.jc(e),this.Uc()}Uc(){try{var e;(e=this.mc)===null||e===void 0||e.call(this)}catch(n){this.Dc().error("Error while handling activated items change",n)}}Jc(){var e;const n=this.xc();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:{}}zc(e){if(!this.xc())return;const n=this.Jc();this.Cc(sn(sn({},n),{},{[e]:Date.now()}))}jc(e){if(!this.xc())return;const n=this.Jc(),o={};let i=!1;for(const[r,s]of Object.entries(n))e.includes(r)?i=!0:o[r]=s;i&&(nx(o)?this.$c():this.Cc(o))}Kc(){this.xc()&&this.$c()}getActivationTimestamp(e){if(!this.Wc().includes(e))return;const n=this.Jc()[e];return qd(n)?n:void 0}Zc(){var e;const n=this.Xc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[n])||[]}Wc(){var e,n,o;const i=this.Zc();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.Yc()],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:[]}Gc(){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.td(o)}Qc(){this.ed()}kc(e){var n;const o=(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0?void 0:n.props[this.Yc()];if(o&&o!==e){const i=this.Zc(),r=this.Jc();i.length>0&&(this.Vc([]),i.filter(s=>qd(r[s])).forEach(s=>this.Bc(s))),this.Qc(),this.Kc(),i.length>0&&this.Uc()}}getActivatedIds(){return[...new Set([...this.Wc(),...this.gc])].filter(e=>!this.nd(e))}dispose(){var e,n,o;(e=this.wc)===null||e===void 0||e.call(this),this.wc=void 0,(n=this.lc)===null||n===void 0||n.call(this),this.lc=void 0,(o=this.Fc)===null||o===void 0||o.dispose(),this.Fc=void 0}reset(){this.gc=[],this.Zc().length>0&&this.Vc([]),this.Qc(),this.Kc(),this.Uc()}getEventToItemsMap(){return this.yc}sd(){return this.Fc}},H9n=class extends L9n{constructor(e,n){super(e,n)}Xc(){return $rt}Yc(){return Zrt}xc(){return est}Cc(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated_timestamps:e})}$c(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}Sc(e){var n;let o;this.Ec(r=>{o=r.find(s=>s.id===e)});const i=o==null||(n=o.appearance)===null||n===void 0?void 0:n.surveyPopupDelaySeconds;return qd(i)&&i>0}rd(){return N3.SHOWN}Ec(e){var n;(n=this._instance)===null||n===void 0||n.getSurveys(e)}Bc(e){var n;(n=this._instance)===null||n===void 0||n.cancelPendingSurvey(e)}Dc(){return _l}Vc(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated:e})}td(e){var n;(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$surveys_activated_session:e})}ed(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}nd(){return!1}Lc(e,n,o){var i;if(e===N3.SENT&&(o==null||(i=o.properties)===null||i===void 0?void 0:i.$survey_completed)===!1)return"ignore";let r;return this.Ec(s=>{r=s.find(a=>a.id===n)}),!r||(function(s){var a;return Rat(s)&&!!(!((a=s.conditions)===null||a===void 0||(a=a.events)===null||a===void 0)&&a.repeatedActivation)||s.schedule==="always"})(r)?e===N3.SHOWN?"consume":"ignore":e===N3.SHOWN?"persist":e===N3.DISMISSED||e===N3.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},O9n=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const n={};for(const o of e){const i=this._instance.get_property(o);Eo(i)||(n[o]=i)}return n}set(e,n){this._instance.register(typeof e=="string"?{[e]:n}:e)}remove(e){typeof e!="string"?e.forEach(n=>this._instance.unregister(n)):this._instance.unregister(e)}},G9n=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(e){return new H9n(this._instance,e)}onMatchingConditionsChanged(e){const n=this._instance._addCaptureHook(s=>{s!=="$pageview"&&s!==N3.SHOWN&&s!==N3.DISMISSED&&s!==N3.SENT||e()}),o=()=>e();jc(Fn,"PHSurveyShown",o);let i=!1;const r=this._instance.onFeatureFlags(()=>{i&&e()});return i=!0,()=>{i=!1,n(),r(),Fn?.removeEventListener("PHSurveyShown",o)}}};const Y9n=Fn?.location?ine(Fn.location.hash,"__posthog")||ine(location.hash,"state"):null,nAt="_postHogToolbarParams",oAt=Ad("[Toolbar]"),iAt=Ad("[FeatureFlags]");var U9n=class{constructor(e,n=!1){this.od=!1,this.update(e,n)}update(e,n){this.ad=((o,i)=>{var r,s,a,A,c,l,g,u;return{bootstrap:{featureFlags:(r=(s=o.bootstrap)===null||s===void 0?void 0:s.featureFlags)!==null&&r!==void 0?r:void 0,featureFlagPayloads:(a=(A=o.bootstrap)===null||A===void 0?void 0:A.featureFlagPayloads)!==null&&a!==void 0?a:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!o.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!o.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!o.advanced_feature_flags_dedup_per_session,cacheTtlMs:o.feature_flag_cache_ttl_ms,refreshIntervalMs:(c=o.remote_config_refresh_interval_ms)!==null&&c!==void 0?c:3e5,idleRefreshBackoff:Eo(o.remote_config_refresh_interval_ms),requestTimeoutMs:o.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(l=o.feature_flag_request_max_retries)!==null&&l!==void 0?l:1),compression:o.disable_compression?void 0:"best-available",evaluationContexts:(g=(u=o.evaluation_contexts)!==null&&u!==void 0?u:o.evaluation_environments)!==null&&g!==void 0?g:[],flagKeys:As(o.flag_keys)?o.flag_keys:void 0}})(e,n),!e.evaluation_environments||e.evaluation_contexts||this.od||(iAt.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.od=!0),Eo(e.flag_keys)||As(e.flag_keys)||iAt.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.ad}};const rAt=Ad("[FeatureFlags]"),LM=Ad("[FeatureFlags]",{debugEnabled:!0}),exe=`" failed. Feature flags didn't load in time.`,K9n=[502,504],sAt=["click","keydown","wheel","touchstart","pointerdown"],aAt="connection_error",AAt=t=>{const e={};for(let n=0;t.length>n;n++)e[t[n]]=!0;return e},cAt=t=>{const e={};for(const[n,o]of tne(t||{}))o&&(e[n]=o);return e},lAt=t=>Ek(t)&&(t.name==="RangeError"&&t.message.indexOf("Maximum call stack size exceeded")===0||t.name==="InternalError"&&t.message==="too much recursion"),L4=Ad("[Error tracking]"),txe="webkit-masked-url:",V9n=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],z9n=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",txe],J9n=["__firefox__","__gCrWeb"],gAt="Refusing to render web experiment since the viewer is a likely bot",W9n={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>une(e,t),not_regex:(t,e)=>!une(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},_5=Ad("[Conversations]"),HM="Conversations not available yet.";function uAt(t,e){var n,o,i,r,s,a,A;const c=(n=t?.flushIntervalMs)!==null&&n!==void 0?n:3e3,l=(o=t?.maxBufferSize)!==null&&o!==void 0?o:100,g=e?.consoleCapture?void 0:(i=t?.maxLogsPerInterval)!==null&&i!==void 0?i:1e3,u=Eo(g)?Math.max(l,2048):Math.max(l,g),h=sn(sn({},(function(){let d="",p="";try{const m=F_?.userAgent;m&&([d,p]=irt(m))}catch{}return(function(m,_){const f=(function(I){if(I)return{}.hasOwnProperty.call(Nrt,I)?Nrt[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 j9n=["debug","log","warn","error","info"],q9n=t=>{for(;t?.__rrweb_original__;)t=t.__rrweb_original__;return t},dAt="console",hAt="__posthogHandledLogsRequestError",nxe=(t,e)=>{const n=t instanceof Error?t:new Error(e);return n[hAt]=!0,n},pAt=t=>!!t&&typeof t=="object"&&t[hAt]===!0,pne=Ad("[NetworkMetrics]"),oxe=()=>{var t;return!(Fn==null||(t=Fn.performance)===null||t===void 0)&&t.now?Fn.performance.now():Date.now()},X9n={"http:":80,"https:":443},$9n=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),mAt=(t,e)=>{var n;const o=String(e);return{method:String(t).toUpperCase(),url:((n=x8(o))===null||n===void 0?void 0:n.href)||o}},ixe=(t,e,n,o,i,r,s=!1)=>{try{var a,A;const c=i();if(!c)return;const l=n||void 0,g=oxe()-o,u=x8(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=$9n.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)||X9n[_.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){pne.error("Failed to record network metric",c)}},_At=()=>{},Z9n=(t,e)=>L_(Fn?.fetch)?xV(Fn,"fetch",n=>function(...o){const i=oxe(),r=n.apply(this,o);if(!e())return r;try{var s,a,A;const[c,l]=o,g=mAt((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=>(ixe(t,g,u?.status,i,e,void 0,!0),u),u=>{throw ixe(t,g,void 0,i,e,u),u})}catch(c){return pne.error("Failed to observe fetch",c),r}}):_At,e7n=(t,e)=>{var n;const o=Fn==null||(n=Fn.XMLHttpRequest)===null||n===void 0?void 0:n.prototype;if(!o)return _At;const i=new WeakMap,r=xV(o,"open",a=>function(...A){try{_at.has(this)||i.set(this,mAt(A[0],A[1]))}catch(c){pne.error("Failed to observe XHR open",c)}return a.apply(this,A)}),s=xV(o,"send",a=>function(...A){let c;try{const l=i.get(this);if(l&&e()){const g=oxe();c=()=>{this.removeEventListener("loadend",c),ixe(t,l,this.status,g,e)},jc(this,"loadend",c)}}catch(l){pne.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()}},mne={featureFlags:class{constructor(t){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=rAt,this.ud={},this.hd={},this.dd=[],this.vd=!1,this.fd=!1,this.pd=0,this.gd=!1,this.md=!1,this.yd=!1,this.bd=!1,this._d=0,this.wd=!1,this.rn=()=>{const e=this.kd();this._d=0,e&&this.reloadFeatureFlags()},this.Sd=()=>{var e,n;const o=this.xd,i=(e=this.Cd)!==null&&e!==void 0?e:o;Eo(o)||Eo(i)||this.Ir.remoteRequestsDisabled||!No||No.visibilityState==="hidden"||Date.now()-((n=this.$d)!==null&&n!==void 0?n:0)<i||(this.Cd=this.wd||!this.Ir.idleRefreshBackoff?o:Math.min(2*i,36e5),this.wd=!1,this.reloadFeatureFlags(),this.Td())},this.Id=()=>{this.wd&&this.Cd===this.xd||this.Md()},this.sn=()=>{No?.visibilityState==="visible"&&this.Md()},"get"in t?this.wo=t:(this._instance=t,this.Ed=new U9n(t.config,t.il()),this.wo=this.Ed)}updateConfig(t,e){var n;(n=this.Ed)===null||n===void 0||n.update(t,e),this.bo&&this.Pd()}setup(t){return this.Nh=t,this.A=t.logger.createLogger("[FeatureFlags]"),eAt(t.kv.initialize(),()=>{this.Nh===t&&(this.Nh=void 0,this.bo=t,this.Rd(t))})}Rd(t){var e;if(this.bo===t)return Fn&&jc(Fn,"online",this.rn),this.Pd(),this.Ad=t.registerDynamicEventProperties(()=>this.Fd()?this.ud:this.hd),this.Od=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.onCrossTabFeatureFlagChange(()=>{this.Dd(),this.Ld(),this.Nd()}),this.Ld(),this.initialize()}Md(){this.wd=!0,this.Cd=this.xd,this.Sd()}Pd(){const t=this.Ir.refreshIntervalMs,e=!this.Ir.remoteRequestsDisabled&&No&&!Eo(t)&&t>0?t:void 0;this.Ir.idleRefreshBackoff||(this.Cd=e),e!==this.xd&&(this.qd(),Eo(e)||(this.xd=e,this.Cd=e,this.Td(),No?.addEventListener&&(jc(No,tV,this.sn),wk(sAt,n=>{jc(No,n,this.Id,{capture:!0})}))))}Td(){Eo(this.xd)||(Eo(this.jd)||clearInterval(this.jd),this.$d=Date.now(),this.jd=setInterval(this.Sd,this.xd))}qd(){var t;Eo(this.jd)||(clearInterval(this.jd),this.jd=void 0,No==null||(t=No.removeEventListener)===null||t===void 0||t.call(No,"visibilitychange",this.sn),wk(sAt,e=>{var n;No==null||(n=No.removeEventListener)===null||n===void 0||n.call(No,e,this.Id,{capture:!0})})),this.xd=void 0,this.Cd=void 0,this.wd=!1,this.$d=void 0}destroy(){this.Bd()}dispose(){this.Bd()}Bd(){var t,e;this.qd(),this.pd++,this.md=!1,this.Nh=void 0,this.bo&&(this.Hd(),(t=this.Ad)===null||t===void 0||t.dispose(),this.Ad=void 0,(e=this.Od)===null||e===void 0||e.call(this),this.Od=void 0,this.dd=[],Fn?.removeEventListener("online",this.rn),this.bo=void 0)}get Ir(){return this.wo.get()}zd(t){var e;return this.Ud&&t in this.Ud?this.Ud[t]:(e=this.bo)===null||e===void 0?void 0:e.kv.get(t)}Dd(){return!!this.Ud&&(this.Ud=void 0,!0)}Wd(){var t;return!Eo((t=this.bo)===null||t===void 0?void 0:t.kv.get("$enabled_feature_flags"))&&this.Dd()}$t(t){this.Vd(()=>{var e;return(e=this.bo)===null||e===void 0?void 0:e.kv.set(t)})}Gd(t,e,n){var o;if(!(!((o=this._instance)===null||o===void 0)&&o.persistence)||!t.$enabled_feature_flags)return;const i=this.zd("$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.zd("$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={[C8]:d,[k4]:d,[sQ]:p};t.$feature_flag_details&&(m[MM]=d);for(const _ of[DM,lQ,XK])Eo(t[_])||(m[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(m)}Lt(t){this.Vd(()=>{var e;return(e=this.bo)===null||e===void 0?void 0:e.kv.remove(t)})}Vd(t){try{t()}catch(e){this.A.error("Failed to update feature flag persistence",e)}}Ld(){const t={};for(const o of[C8,sQ,DM,B9]){const i=this.zd(o);Eo(i)||(t[o]=i)}this.ud=t;const e=sn({},t),n=this.zd(k4);if(n)for(const[o,i]of Object.entries(n))e[`$feature/${o}`]=i;this.hd=e}Fd(){const t=this.Ir.cacheTtlMs;if(!t||0>=t)return!1;const e=this.zd(lQ);return typeof e!="number"||Date.now()-e>t}Zd(){return!!this.Fd()&&(this.bd||this.fd||(this.bd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Qd(){const t=this.Ir.evaluationContexts;return t?.length?t.filter(e=>{const n=e&&typeof e=="string"&&e.trim().length>0;return n||this.A.error("Invalid evaluation context found:",e,"Expected non-empty string"),n}):[]}Jd(){const t=this.Ir.flagKeys;if(!Eo(t))return t.filter(e=>{const n=e&&typeof e=="string"&&e.trim().length>0;return n||this.A.error("Invalid flag key found:",e,"Expected non-empty string"),n})}initialize(){var t,e;const n=this.Ir,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=>!Eo(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.Kd({featureFlags:a,featureFlagPayloads:A},void 0,{persist:!1})}}updateFlags(t,e,n){var o,i;const r=n?.merge&&(o=this.zd("$enabled_feature_flags"))!==null&&o!==void 0?o:{},s=n?.merge&&(i=this.zd("$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:Ert(g),variant:Brt(g),reason:void 0,metadata:Eo(A?.[l])?void 0:{id:0,version:void 0,description:void 0,payload:A[l]}};this.Kd({flags:c})}get hasLoadedFlags(){return this.vd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.zd(MM),e=this.zd(B9),n=this.zd(NM);if(!n&&!e)return t||{};const o=jg({},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=Eo(c)?(r=A?.enabled)!==null&&r!==void 0&&r:!!c,g=Eo(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.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:o}),this.ld=!0),o}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(n=>{const o=t[n];return{key:n,enabled:Ert(o),variant:Brt(o),payload:xrt(e[n])}})}getFlagVariants(){const t=this.zd(k4),e=this.zd(B9);if(!e)return t||{};const n=jg({},t||{}),o=Object.keys(e);for(let i=0;o.length>i;i++)n[o[i]]=e[o[i]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.ld=!0),n}getFlagPayloads(){const t=this.zd(sQ),e=this.zd(NM);if(!e)return t||{};const n=jg({},t||{}),o=Object.keys(e);for(let i=0;o.length>i;i++)n[o[i]]=e[o[i]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.ld=!0),n}reloadFeatureFlags(){this.gd||this.Ir.featureFlagsDisabled||this.kd()||(this.fd&&(this.md=!0),this.Xd||(this.dd.slice().forEach(t=>{try{t()}catch(e){this.A.error("Error while running feature flags reloading callback",e)}}),this.Xd=setTimeout(()=>{this.Yd()},5)))}Hd(){clearTimeout(this.Xd),this.Xd=void 0}onReloading(t){return this.dd.push(t),()=>{this.dd=this.dd.filter(e=>e!==t)}}ensureFlagsLoaded(){this.vd||this.fd||this.Xd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.gd=t}resetFlagCallReported(){this.Lt(cQ)}Yd(t){this.Hd();const e=this.bo;if(!e||this.Ir.remoteRequestsDisabled||this.kd())return;if(this.fd)return void(this.md=!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.zd("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.zd(AQ),timezone:tat()};Eo(e.deviceId)||(n.$device_id=e.deviceId),(t?.disableFlags||this.Ir.featureFlagsDisabled)&&(n.disable_flags=!0);const o=this.Qd();o.length&&(n.evaluation_contexts=o);const i=this.Jd();Eo(i)||(n.flag_keys=i);const r=this.Ir.onlyEvaluateSurveyFeatureFlags,s="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),a=this.pd;this.fd=!0;const A=()=>{this.md&&(this.md=!1,this.Yd())},c=d=>{var p,m;const _=(p=d.json)!==null&&p!==void 0?p:{},f=d.statusCode!==200;if(this.fd=!1,a!==this.pd)return void A();if(this.tv(d.statusCode),f||this.md||(this.$anon_distinct_id=void 0),n.disable_flags&&!this.md)return;this.yd=!f;const I=[];d.error?I.push(d.error instanceof Error&&d.error.name==="AbortError"?"timeout":d.error instanceof Error?aAt:"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.$t({[eV]:I}),C?this.A.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):n.disable_flags||this.Kd(_,f,{partialResponse:r}),A()},l=d=>{this.fd=!1,a===this.pd&&(this.$t({[eV]:[aAt]}),this.A.error("Feature flag request failed",d),this.Wd()&&this.Nd(!0)),A()};let g=this.Ir.requestMaxRetries;const u=()=>g>0&&a===this.pd,h=()=>{if(a!==this.pd||!this.bo||this.Ir.remoteRequestsDisabled)return this.fd=!1,void A();try{e.sendRequest(s,{target:"flags",method:"POST",body:n,compression:this.Ir.compression,sentAt:"body",timeoutMs:this.Ir.requestTimeoutMs}).then(d=>{if((p=>K9n.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()}kd(){return zst(this._d,3)}tv(t){this._d=Jst(t,this._d,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,e={}){var n;if(e.fresh&&!this.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+t+exe);if(this.Zd())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.yd)return;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+t+exe);if(this.Zd())return;const n=this.getFlagVariants(),o=t in n,i=n[t],r=this.getFlagPayloads()[t],s=String(i),a=this.zd("$feature_flag_request_id")||void 0,A=this.zd("$feature_flag_evaluated_at")||void 0;let c,l=this.zd("$flag_call_reported")||{};if(this.Ir.deduplicateCallsPerSession){var g;const S=(g=this.bo)===null||g===void 0?void 0:g.session.sessionId,Q=this.zd(ZK);S&&S!==Q&&(l={},c=S)}if(e.send_event||!("send_event"in e))if(t in l&&l[t].includes(s))c&&this.$t({[cQ]:l,[ZK]: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.$t(sn({[cQ]:l},c?{[ZK]:c}:{}));const S=this.getFeatureFlagDetails(t),Q=[...(u=this.zd("$feature_flag_errors"))!==null&&u!==void 0?u:[]];Eo(i)&&Q.push("flag_missing");const w={$feature_flag:t,$feature_flag_response:i,$feature_flag_payload:r??null,$feature_flag_request_id:a,$feature_flag_evaluated_at:A,$feature_flag_bootstrapped_response:(h=(d=this.Ir.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.Ir.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.yd};Eo(S==null||(_=S.metadata)===null||_===void 0?void 0:_.has_experiment)||(w.$feature_flag_has_experiment=S.metadata.has_experiment),Eo(S==null||(f=S.metadata)===null||f===void 0?void 0:f.version)||(w.$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&&(w.$feature_flag_reason=M),!(S==null||(x=S.metadata)===null||x===void 0)&&x.id&&(w.$feature_flag_id=S.metadata.id),Eo(S?.original_variant)&&Eo(S?.original_enabled)||(w.$feature_flag_original_response=Eo(S.original_variant)?S.original_enabled:S.original_variant),!(S==null||(E=S.metadata)===null||E===void 0)&&E.original_payload&&(w.$feature_flag_original_payload=S==null||(B=S.metadata)===null||B===void 0?void 0:B.original_payload),Q.length&&(w.$feature_flag_error=Q.join(",")),this.ev(w)}else c&&this.$t({[cQ]:l,[ZK]:c});return o?{key:t,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:xrt(r)}:void 0}ev(t){try{var e;(e=this.bo)===null||e===void 0||e.capture("$feature_flag_called",t)}catch(n){this.A.error("Failed to capture feature flag call",n)}}getRemoteConfigPayload(t,e){this.iv(t,e)}iv(t,e){var n=this;return Wg(function*(){const o=n.bo;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.Qd();r.length&&(i.evaluation_contexts=r);const s=n.Jd();let a;Eo(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.Ir.compression,sentAt:"body",timeoutMs:n.Ir.requestTimeoutMs})).json)===null||A===void 0?void 0:A.featureFlagPayloads;a=c?.[t]||void 0}catch(c){return void n.A.error("Remote config feature flag request failed",c)}try{e(a)}catch(c){n.A.error("Remote config feature flag callback failed",c)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.yd)return e.defaultValue;if(!(this.vd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+exe),e.defaultValue;const n=this.getFeatureFlag(t,e);return Eo(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.Kd(t,e,n)}Kd(t,e,n){if(!this.bo)return;this.vd=!0;const o=((i,r={},s={},a={},A,c=rAt)=>{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!Eo((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{[C8]:u,[k4]:I,[XK]:!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({[C8]:Object.keys(cAt(m)),[k4]:m||{},[sQ]:_||{},[MM]:f||{},[XK]:i.minimalFlagCalledEvents===!0},d?{[DM]:d}:{}),p?{[lQ]:p}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),n,this.A);if(o)if(n?.persist===!1){const i=!Eo(this.bo.kv.get(k4));this.Ud=o,i||this.$t(o)}else this.Dd(),this.Gd(o,t,!!n?.partialResponse),this.$t(o);else e&&this.Wd();e||(this.bd=!1),this.Nd(e)}override(t,e=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.nv(t)}nv(t){if(this.bo){if(t===!1)return this.Lt([B9,NM]),this.Nd(),void LM.info("All overrides cleared");if(As(t))return this.$t({[B9]:AAt(t)}),this.Nd(),void LM.info("Flag overrides set",{flags:t});if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var e;const n=t;this.ld=!!((e=n.suppressWarning)!==null&&e!==void 0&&e);const o={},i=n.flags,r=n.payloads;return i&&(o[B9]=As(i)?AAt(i):i),r&&(o[NM]=r),Object.keys(o).length&&this.$t(o),i===!1&&r===!1?this.Lt([B9,NM]):i===!1?this.Lt(B9):r===!1&&this.Lt(NM),this.Nd(),i===!1?LM.info("Flag overrides cleared"):i&&LM.info("Flag overrides set",{flags:i}),void(r===!1?LM.info("Payload overrides cleared"):r&&LM.info("Payload overrides set",{payloads:r}))}if(t&&typeof t=="object")return this.$t({[B9]:t}),this.Nd(),void LM.info("Flag overrides set",{flags:t});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.vd){const{flags:e,flagVariants:n}=this.sv();try{t(e,n)}catch(o){this.A.error("Error while running feature flags callback",o)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var o;const i=(this.zd("$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.$t({[C8]:Object.keys(cAt(a)),[k4]:a,[aQ]:sn(sn({},this.zd("$stored_person_properties")||{}),r)}),this.Nd();try{var A;(A=this.bo)===null||A===void 0||A.capture("$feature_enrollment_update",s)}catch(c){this.A.error("Failed to capture early access feature enrollment",c)}}getEarlyAccessFeatures(t,e=!1,n){const o=this.zd(r2e);!o||e?this.rv(t,n):t(o)}rv(t,e){var n=this;return Wg(function*(){const o=n.bo;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.$t({[r2e]:r})}catch(s){return void n.A.error("Early access feature request failed",s)}try{t(r)}catch(s){n.A.error("Early access feature callback failed",s)}})()}sv(){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),{})}}Nd(t){this.Ld();const{flags:e,flagVariants:n}=this.sv();this.featureFlagEventHandlers.forEach(o=>{try{o(e,n,{errorsLoading:t})}catch(i){this.A.error("Error while running feature flags callback",i)}})}setPersonPropertiesForFlags(t,e=!0){this.ov(t,e)}ov(t,e=!0){const n=this.zd("$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.$t({[aQ]:sn(sn(sn({},n),r),o)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const n=sn({},this.zd("$stored_person_properties")||{});t.forEach(o=>{delete n[o]}),this.$t({[aQ]:n}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(aQ),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const n=this.zd("$stored_group_properties")||{},o=sn({},n);for(const i of Object.keys(t))o[i]=sn(sn({},n[i]),t[i]);this.$t({[AQ]:o}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.zd("$stored_group_properties")||{};this.$t({[AQ]:sn(sn({},e),{},{[t]:{}})})}else this.Lt(AQ)}reset(){this.pd++,this.md=!1,this.ud={},this.hd={},this.Ud=void 0,this.vd=!1,this.gd=!1,this.yd=!1,this.$anon_distinct_id=void 0,this.Hd(),this.ld=!1,this._d=0}}},t7n={sessionRecording:class{get Ir(){return this._instance.config}get Il(){return this._instance.persistence}get started(){var t;return!!(!((t=this.av)===null||t===void 0)&&t.isStarted)}get status(){var t,e;return this.lv==="awaiting_config"||this.lv==="missing_config"?this.lv:(t=(e=this.av)===null||e===void 0?void 0:e.status)!==null&&t!==void 0?t:this.lv}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.lv=X2e,this.uv=void 0,this.hv=!1,this.Je=(()=>{var e,n;if(!No?.visibilityState||No.visibilityState==="visible")return!0;const o=Fn==null||(e=Fn.performance)===null||e===void 0||(n=e.getEntriesByType)===null||n===void 0?void 0:n.call(e,"visibility-state");return!o?.length||o.some(i=>i.name==="visible")})(),this.sn=()=>{var e,n;No?.visibilityState==="visible"&&(this.Je=!0,(e=this.av)===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.Ir.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');No?.addEventListener&&jc(No,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.hv=!0,No==null||(e=No.removeEventListener)===null||e===void 0||e.call(No,"visibilitychange",this.sn),t?this.dv(!0):this.stopRecording()}get vv(){var t;const e=!!(!((t=this._instance.get_property("$session_recording_remote_config"))===null||t===void 0)&&t.enabled),n=!this.Ir.disable_session_recording,o=this.Ir.disable_session_recording||this._instance.consent.isOptedOut();return Fn&&e&&n&&!o}startIfEnabledOrStop(t){var e;if(this.hv||this.vv&&(!((e=this.av)===null||e===void 0)&&e.isStarted))return;const n=!Eo(Object.assign)&&!Eo(Array.from);this.vv&&n?(this.fv(t),b8.info("starting")):(this.lv=X2e,this.stopRecording())}fv(t){var e,n;if(this.vv)if(this.lv!=="awaiting_config"&&this.lv!=="missing_config"&&(this.lv=$at),(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.pv(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.gv,s=>{if(!this.hv&&this.vv&&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.pv(t);this.lv="disabled"})}}stopRecording(){var t,e;(t=this.uv)===null||t===void 0||t.call(this),this.uv=void 0,(e=this.av)===null||e===void 0||e.stop()}dv(t=!1){var e,n;(e=this.uv)===null||e===void 0||e.call(this),this.uv=void 0,(n=this.av)===null||n===void 0||n.discard({discardProducerEvents:t})}mv(){var t,e;(t=this.Il)===null||t===void 0||t.unregister("$session_is_sampled"),(e=this.Il)===null||e===void 0||e.unregister("$replay_sample_rate")}yv(t,e){if(Fs(t))return null;const n=qd(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}bv(t){if(this.Il){var e,n;const o=this.Il,i=()=>{var r;const s=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.yv((r=this.Ir.session_recording)===null||r===void 0?void 0:r.sampleRate,"session_recording.sampleRate"),A=this.yv(s?.sampleRate,"remote config sampleRate"),c=a??A;Fs(c)&&this.mv();const l=s?.minimumDurationMilliseconds;o.register({[qK]: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:Eo(l)?null:l,endpoint:s?.endpoint,triggerMatchType:s?.triggerMatchType,masking:s?.masking,urlTriggers:s?.urlTriggers,version:s?.version,triggerGroups:s?.triggerGroups})})};i(),(e=this.uv)===null||e===void 0||e.call(this),this.uv=(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.bv(e),void this.dv()):(this.bv(e),void this.startIfEnabledOrStop()):(this.lv==="awaiting_config"&&(this.lv="missing_config",this._instance.register_for_session({[g2e]:!0}),b8.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var n;!((n=this.av)===null||n===void 0)&&n.log?this.av.log(t,e):b8.warn("log called before recorder was ready")}get gv(){var t,e;const n=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.get_property(qK);return(n==null||(e=n.scriptConfig)===null||e===void 0?void 0:e.script)||"lazy-recorder"}_v(){const t=this._instance.get_property(qK);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!Fs(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}pv(t){var e,n,o;if(!this.hv&&this.vv&&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({[l2e]:!0});var i;if(this.av||(this.av=(i=Ur.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording(this._instance,this.Je),this.av._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._v())return this.lv==="missing_config"||this.lv==="awaiting_config"?void 0:(this.lv="awaiting_config",b8.info("persisted remote config is stale, requesting fresh config before starting"),void new aat(this._instance).load());this.lv=$at,(n=(o=this.av).setDocumentWasEverVisible)===null||n===void 0||n.call(o,this.Je),this.av.start(t)}else this.lv=X2e}onRRwebEmit(t){var e,n;(e=this.av)===null||e===void 0||(n=e.onRRwebEmit)===null||n===void 0||n.call(e,t)}overrideLinkedFlag(){var t,e;this.av||(e=this.Il)===null||e===void 0||e.register({$replay_override_linked_flag:!0}),(t=this.av)===null||t===void 0||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.av||(e=this.Il)===null||e===void 0||e.register({$replay_override_sampling:!0}),(t=this.av)===null||t===void 0||t.overrideSampling()}overrideTrigger(t){var e,n;this.av||(n=this.Il)===null||n===void 0||n.register({[t==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.av)===null||e===void 0||e.overrideTrigger(t)}get sdkDebugProperties(){var t;const e={};for(const o of N9n){var n;const i=(n=this._instance.sessionPersistence)===null||n===void 0?void 0:n.get_property(o);Eo(i)||(e[o]=i)}return sn(sn({},e),((t=this.av)===null||t===void 0?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,e){var n;return!!(!((n=this.av)===null||n===void 0)&&n.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;(t=this.av)===null||t===void 0||(e=t.flushBeforeIdentityReset)===null||e===void 0||e.call(t)}}},n7n={autocapture:class extends v9n{constructor(t){super(new w9n(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.wv=!1,this._instance=t,this.Sv=this.xv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.Cv();return!!(t.path||t.search||this.$v(t))}startIfEnabled(){this.isEnabled&&(gi.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Sv=this.xv(),this.startIfEnabled()}stop(){this.Tv&&this.Tv(),this.Tv=void 0,this.Iv&&this.Iv(),this.Iv=void 0,gi.info("History API monitoring stopped")}monitorHistoryChanges(){Fn&&Fn.history&&(this.Mv("pushState"),this.Mv("replaceState"),this.Ev(),this.$v()&&this.Pv())}Mv(t){var e;if(!Fn||!((e=Fn.history[t])===null||e===void 0)&&e.__posthog_wrapped__)return;const n=this;xV(Fn.history,t,o=>function(i,r,s){var a;n.Rv(s)&&n.Av(),o.call(this,i,r,s),n.Fv(t,!n.wv&&(Fn==null||(a=Fn.event)===null||a===void 0?void 0:a.type)!=="popstate")})}xv(){const t=Fn?.location;if(t?.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}Cv(){const t=this._instance.config.capture_pageview;return t==="history_change"?{path:!0}:xA(t)?t:{}}$v(t=this.Cv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Ov(t){const e=this.Cv(),n=this.Sv;return!(!n||!(e.path&&t.pathname!==n.pathname||e.search&&t.search!==n.search||this.$v(e)&&t.hash!==n.hash))}Fv(t,e=!1){try{e||this.Av();const n=this.xv();if(!n)return;if(this.Ov(n)){const o=()=>this._instance.capture(d2e,{navigation_type:t});e?(this.Dv=o,Promise.resolve().then(()=>this.Av())):o()}this.Sv=n}catch(n){gi.error(`Error capturing ${t} pageview`,n)}}Rv(t){var e,n;return!(Fs(t)||!Fn)&&((e=x8(String(t)))===null||e===void 0?void 0:e.href)!==((n=Fn.location)===null||n===void 0?void 0:n.href)}Av(){const t=this.Dv;if(t){this.Dv=void 0,this.wv=!0;try{t()}catch(e){gi.error("Error capturing deferred pageview",e)}finally{this.wv=!1}this.Sv=this.xv()}}Ev(){if(this.Tv)return;const t=()=>{this.Fv("popstate")};jc(Fn,"popstate",t),this.Tv=()=>{Fn&&Fn.removeEventListener("popstate",t)}}Pv(){if(this.Iv)return;const t=()=>{this.Fv("hashchange")};jc(Fn,"hashchange",t),this.Iv=()=>{Fn&&Fn.removeEventListener("hashchange",t)}}},heatmaps:class{get Ir(){return this.instance.config}constructor(t){var e;this.Lv=!1,this.ko=!1,this.Nv=null,this.instance=t,this.Lv=!!(!((e=this.instance.persistence)===null||e===void 0)&&e.props[Zye]),this.rageclicks=new Jat(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return xA(this.Ir.capture_heatmaps)&&this.Ir.capture_heatmaps.flush_interval_milliseconds&&(t=this.Ir.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Fs(this.Ir.capture_heatmaps)?Fs(this.Ir.enable_heatmaps)?this.Lv:this.Ir.enable_heatmaps:this.Ir.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ko)return;R9n.info("starting..."),this.qv(),this.sn()}else{var t;clearInterval((t=this.Nv)!==null&&t!==void 0?t:void 0),this.jv(),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({[Zye]:n}),this.Lv=n,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Bv(t){$2e(t.originalEvent)&&this.Mr(t.originalEvent,"deadclick")}sn(){this.Nv&&clearInterval(this.Nv),this.Nv=No?.visibilityState==="visible"?setInterval(this.yl.bind(this),this.flushIntervalMilliseconds):null}qv(){Fn&&No&&(this.Hv=this.yl.bind(this),jc(Fn,ene,this.Hv),this.zv=t=>this.Mr(t||Fn?.event),jc(No,"click",this.zv,{capture:!0}),this.Uv=t=>this.Wv(t||Fn?.event),jc(No,"mousemove",this.Uv,{capture:!0}),this.Vv=new Gst(this.instance,RBn,this.Bv.bind(this)),this.Vv.startIfEnabledOrStop(),this.Gv=this.sn.bind(this),jc(No,tV,this.Gv),this.ko=!0)}jv(){var t;Fn&&No&&(this.Hv&&Fn.removeEventListener(ene,this.Hv),this.zv&&No.removeEventListener("click",this.zv,{capture:!0}),this.Uv&&No.removeEventListener("mousemove",this.Uv,{capture:!0}),this.Gv&&No.removeEventListener(tV,this.Gv),clearTimeout(this.Zv),(t=this.Vv)===null||t===void 0||t.stop(),this.ko=!1)}Qv(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:Fn)===null||l===void 0?void 0:l.getComputedStyle(c).position}catch{return!1}if(as(a,h))return!0;c=vst(c)}return!1})(rV(t),["fixed","sticky"],i);return{x:t.clientX+(r?0:o),y:t.clientY+(r?0:n),target_fixed:r,type:e}}Mr(t,e="click"){var n;if(Bst(t.target)||!$2e(t))return;const o=this.Qv(t,e);!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&Dst(rV(t),this.instance.config.rageclick)&&this.Zs(sn(sn({},o),{},{type:"rageclick"})),this.Zs(o)}Wv(t){!Bst(t.target)&&$2e(t)&&(clearTimeout(this.Zv),this.Zv=setTimeout(()=>{this.Zs(this.Qv(t,"mousemove"))},500))}Zs(t){if(!Fn)return;const e=this.Ir.disable_capture_url_hashes?rQ(Fn.location.href):Fn.location.href,n=this.Ir.custom_personal_data_properties,o=this.Ir.mask_personal_data_properties?[...kk,...n||[]]:[],i=lV(e,o,gV);this.Rt=this.Rt||{},this.Rt[i]||(this.Rt[i]=[]),this.Rt[i].push(t)}yl(){this.Rt&&!nx(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Gst,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.Lv=!1,this.ko=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Jv=()=>{clearTimeout(this.Kv),this.Kv=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.Xv=n=>{var o;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Fs(n?.name)||Fs(n?.value))return void FM.error("Invalid metric received",n);const i=typeof n.navigationURL=="string"?n.navigationURL:void 0,r=this.Yv(i);if(Eo(r))return;const s=qd(n.navigationId)||typeof n.navigationId=="string"?`navigation:${n.navigationId}`:`url:${r}`;if(this.tf&&n.value>=this.tf)return void FM.error("Ignoring metric with value >= "+this.tf,n);this.Rt.navigationKey!==s&&(this.Jv(),this.Kv=setTimeout(this.Jv,this.flushToCaptureTimeoutMs)),Eo(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=r),this.Rt.firstMetricTimestamp=Eo(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(o=this._instance.sessionManager)===null||o===void 0?void 0:o.checkAndGetSessionAndWindowId(!0),A=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 D9n){const g=l==="url"&&typeof n.attribution[l]=="string"?this.Yv(n.attribution[l]):n.attribution[l];Eo(g)||(c[l]=g)}A.attribution=c}else delete A.attribution;Eo(a)||(A.$session_id=a.sessionId,A.$window_id=a.windowId),this.Rt.metrics.push(A),this.Rt.metrics.length===this.allowedMetrics.length&&this.Jv()},this.ef=()=>{if(this.ko)return;let n,o,i,r,s=!1;const a=Ur.__PosthogExtensions__,A=a?.postHogWebVitalsCallbacksByFlavor,c=A?.[this.if]||(this.if==="web-vitals"&&Eo(A)?a?.postHogWebVitalsCallbacks:void 0);if(!Eo(c)){const u=c.withoutAttribution,h=this.attributionMetrics;s=!Eo(u),n=h.indexOf("LCP")>-1?c.onLCP:u?.onLCP||c.onLCP,o=h.indexOf("CLS")>-1?c.onCLS:u?.onCLS||c.onCLS,i=h.indexOf("FCP")>-1?c.onFCP:u?.onFCP||c.onFCP,r=h.indexOf("INP")>-1?c.onINP:u?.onINP||c.onINP}if(!(n&&o&&i&&r))return void FM.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.Xv.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&o(this.Xv.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Xv.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&r(this.Xv.bind(this),g),this.ko=!0},this.Lv=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[n2e]),this.startIfEnabled()}get nf(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const n=xA(this.nf)?(t=this.nf)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return Fs(n)?((e=this._instance.persistence)===null||e===void 0?void 0:e.props.$web_vitals_allowed_metrics)||Xat:n}get flushToCaptureTimeoutMs(){return(xA(this.nf)?this.nf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=xA(this.nf)?this.nf.web_vitals_attribution:void 0;return hy(t)?t?Xat:[]:As(t)?t:M9n}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=xA(this.nf)?this.nf.__preview_web_vitals_soft_navs:void 0;return t!=null&&t}get tf(){const t=xA(this.nf)&&qd(this.nf.__web_vitals_max_value)?this.nf.__web_vitals_max_value:qat;return t>0&&6e4>=t?qat:t}get isEnabled(){const t=sd?.protocol;if(t!=="http:"&&t!=="https:")return FM.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=xA(this.nf)?this.nf.web_vitals:hy(this.nf)?this.nf:void 0;return hy(e)?e:this.Lv}startIfEnabled(){this.isEnabled&&!this.ko&&(FM.info("enabled, starting..."),this.Ho(this.ef))}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({[n2e]:n}),this._instance.persistence.register({[jrt]:o})),this.Lv=n,this.startIfEnabled()}get if(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Ho(t){var e;const n=Ur.__PosthogExtensions__,o=this.if,i=n?.postHogWebVitalsCallbacksByFlavor;i?.[o]||o==="web-vitals"&&Eo(i)&&n?.postHogWebVitalsCallbacks?t():n==null||(e=n.loadExternalDependency)===null||e===void 0||e.call(n,this._instance,o,r=>{r?FM.error("failed to load script",r):t()})}Yv(t){const e=t||Fn?.location.href;if(!e)return void FM.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?rQ(e):e,o=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...kk,...o||[]]:[];return lV(n,i,gV)}}},o7n={exceptionObserver:class{constructor(t){var e;this.ef=()=>{var n;if(!Fn||!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.sf&&this.Ir.capture_unhandled_errors&&(this.sf=o(this.captureException.bind(this))),!this.rf&&this.Ir.capture_unhandled_rejections&&(this.rf=i(this.captureException.bind(this))),!this.af&&this.Ir.capture_console_errors&&(this.af=r(this.captureException.bind(this)))}catch(s){yV.error("failed to start",s),this.lf()}},this._instance=t,this.uf=!!(!((e=this._instance.persistence)===null||e===void 0)&&e.props[e2e]),this.wt=new e4n(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,A:yV})),this.Ir=this.hf(),this.startIfEnabledOrStop()}hf(){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):(Eo(t)?this.uf:t)&&(e=sn(sn({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Ir.capture_console_errors||this.Ir.capture_unhandled_errors||this.Ir.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(yV.info("enabled"),this.lf(),this.Ho(this.ef)):this.lf()}Ho(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 yV.error("failed to load script",i);t()})}lf(){var t,e,n;(t=this.sf)===null||t===void 0||t.call(this),this.sf=void 0,(e=this.rf)===null||e===void 0||e.call(this),this.rf=void 0,(n=this.af)===null||n===void 0||n.call(this),this.af=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.uf=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[e2e]:this.uf}),this.Ir=this.hf(),this.startIfEnabledOrStop())}onConfigChange(){this.Ir=this.hf()}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 yV.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.cf=[],this.df=new u4n([new Q4n,new k4n,new w4n,new v4n,new R4n,new N4n,new M4n,new T4n],(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=frt.test(d)?d.replace(frt,"$1"):d;if(!p.match(/\S*Error: /)){for(const m of i){const _=m(p,o);if(_){a.push(_);const f=E4n(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(b4n(a,l)>=50)break}}const g=[...l].sort((h,d)=>d.start-h.start),u=g[g.length-1];if(u){const h=Irt(a,u);a.splice(u.start-h,h);for(const d of g)d.start-=h}for(const h of g)B4n(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++)S4n(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",I4n,x4n)),this._instance=t,this.cf=(e=(n=this._instance.persistence)===null||n===void 0?void 0:n.get_property("$error_tracking_suppression_rules"))!==null&&e!==void 0?e:[],this.vf=Jte(this.ff()),this.pf=new L4n(this.vf)}onConfigChange(){this.vf=Jte(this.ff()),this.pf.setConfig(this.vf)}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.cf=r,this._instance.persistence&&this._instance.persistence.register({[Jrt]:this.cf,[t2e]:s})}get gf(){var t;const e=!!this._instance.get_property(t2e),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.df.buildFromUnknown(t,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(t,e){if(this.vf.enabled)try{if(!nA(t)||t.trim().length===0)return void L4.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)=>F4n.has(a)?(r.push(a),s):(s[a]=i[a],s),{}),droppedKeys:r}})(this.mf(e));o.length>0&&L4.warn("Ignoring reserved exception step fields",{droppedKeys:o}),this.pf.add(sn({[Vte]:t,[zte]:new Date().toISOString()},n))}catch(n){L4.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.yf(e)){if(this.bf(e))return this._f("Exception dropped: matched a suppression rule"),void L4.info("Skipping exception capture because a suppression rule matched");if(!this.gf&&this.wf(e))return this._f("Exception dropped: thrown by a browser extension"),void L4.info("Skipping exception capture because it was thrown by an extension");if(!this.gf&&this.kf(e))return this._f("Exception dropped: thrown by an injected browser script"),void L4.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Sf(e))return this._f("Exception dropped: thrown by the PostHog SDK"),void L4.info("Skipping exception capture because it was thrown by the PostHog SDK")}const n=this.vf.enabled&&Fs(t.$exception_steps)?this.xf(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.pf.clear(),i}catch(i){return lAt(i)||L4.error("Failed to capture exception event. Dropping this exception.",i),void this.pf.clear()}}catch(e){return void(lAt(e)||L4.error("Failed to process exception event. Ignoring this exception.",e))}}xf(t){try{const e=this.pf.getAttachable();return e.length===0?t:sn(sn({},t),{},{$exception_steps:e})}catch(e){return L4.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}_f(t){this.vf.enabled&&this.pf.add({[Vte]:t,[zte]:new Date().toISOString()})}mf(t){return xA(t)?sn({},t):{}}ff(){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:{}}bf(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.cf.some(n=>{const o=n.values.map(i=>{const r=Tat[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 L4.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}wf(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&&z9n.some(i=>o.startsWith(i)));return n.length!==0&&(!n.every(({filename:o})=>!!o&&o.startsWith(txe))||t.some(({type:o,value:i})=>o==="NoResponse"||nA(i)&&V9n.some(({value:r,exact:s})=>s?i===r:i.includes(r)))&&!e.some(({in_app:o,filename:i})=>o&&!i?.startsWith(txe)))}kf(t){return t.some(({value:e})=>nA(e)&&J9n.some(n=>e.includes(n)))}Sf(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}yf(t){return!Fs(t)&&As(t)}}},i7n=sn({productTours:class{get Il(){return this._instance.persistence}constructor(t){this.Cf=null,this.$f=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if("productTours"in e){var n,o;if(this.Il&&this.Il.register({[i2e]:!!e.productTours}),!Z2e(this._instance))return!this.Cf&&Fs((n=this.Il)===null||n===void 0?void 0:n.props.ph_product_tours)||hne.info("product tours disabled; stopping and clearing cached tours"),(o=this.Cf)===null||o===void 0||o.stop(),this.Cf=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Cf&&Z2e(this._instance)&&this.Ho(()=>this.Tf())}Ho(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?hne.error("Could not load product tours script",i):t()})}Tf(){var t;!this.Cf&&(!((t=Ur.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours)&&(this.Cf=Ur.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(As(this.$f)&&!e)return void t(this.$f,{isLoaded:!0});const n=this.Il;if(n){const o=n.props[s2e];if(As(o)&&!e)return this.$f=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(!Z2e(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||hne.warn(s):hne.error(s),void t([],{isLoaded:!1,error:s})}const r=As(o.json.product_tours)?o.json.product_tours:[];this.$f=r,n&&n.register({[s2e]:r}),t(r,{isLoaded:!0})}})}getActiveProductTours(t){Fs(this.Cf)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Cf.getActiveProductTours(t)}showProductTour(t){var e;(e=this.Cf)===null||e===void 0||e.showTourById(t)}previewTour(t){this.Cf?this.Cf.previewTour(t):this.Ho(()=>{var e;this.Tf(),(e=this.Cf)===null||e===void 0||e.previewTour(t)})}dismissProductTour(){var t;(t=this.Cf)===null||t===void 0||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.Cf)===null||t===void 0||t.nextStep()}previousStep(){var t;(t=this.Cf)===null||t===void 0||t.previousStep()}clearCache(){var t;this.$f=null,(t=this.Il)===null||t===void 0||t.unregister("ph_product_tours")}resetTour(t){var e;(e=this.Cf)===null||e===void 0||e.resetTour(t)}resetAllTours(){var t;(t=this.Cf)===null||t===void 0||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.Cf)===null||e===void 0||e.cancelPendingTour(t)}}},mne),r7n={siteApps:class{constructor(t){this._instance=t,this.If=0,this.Mf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ef(t,e){if(!e)return;const n=this.globalsForEvent(e);this.Mf.push(n),this.Mf.length>1e3&&(this.Mf=this.Mf.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.Ef.bind(this));this.Pf=()=>{t(),this.Mf=[],this.Pf=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({},wrt(t,T9n)),{},{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}}Rf(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)||(S9.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)||(S9.error("prepare_external_dependency_script returned null"),null):t}Af(){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.If++,this.Ff)return this.Of();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.Rf(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.Ff=()=>{l.forEach(m=>m()),this.Ff=void 0},this.Of()}Of(){let t=!1;return()=>{var e;t||(t=!0,this.If--,this.If===0&&((e=this.Ff)===null||e===void 0||e.call(this)))}}Df(t,e=!0){const n=this.Af();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.Mf.length&&(S9.info(`Processing ${this.Mf.length} events for site app with id ${t.id}`),this.Mf.forEach(s=>this.Df(()=>{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.Pf)===null||r===void 0||r.call(this))};let o=!1;const i=r=>{e.errored=!r,e.loaded=!0,S9.info(`Site app with id ${t.id} ${r?"loaded":"errored"}`),o&&n()};try{const{processEvent:r}=this.Df(s=>t.init({posthog:this._instance,callback(a){s(),i(a)}}),!1);r&&(e.processEvent=r),o=!0}catch(r){S9.error(Zat+t.id,r),i(!1)}if(o&&e.loaded)try{n()}catch(r){S9.error(`Error while processing buffered events PostHog app with config id ${t.id}`,r),e.errored=!0}}Lf(){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)}Nf(t){if(Object.keys(this.apps).length===0)return;const e=this.globalsForEvent(t);for(const n of Object.values(this.apps))try{this.Df(()=>{var o;return(o=n.processEvent)===null||o===void 0?void 0:o.call(n,e)})}catch(o){S9.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.Lf(),void this._instance.on("eventCaptured",a=>this.Nf(a))):void S9.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Pf)===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 S9.error(Zat+a,c)})}else S9.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},s7n={tracingHeaders:class{constructor(t){this._instance=t,this.qf=void 0,this.jf=void 0,this.Bf=void 0,this.ef=()=>{const e=this.Hf();var n,o;e?(Eo(this.qf)&&(this.qf=(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)),Eo(this.jf)&&(this.jf=(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.lf()}}initialize(){this.startIfEnabledOrStop()}Ho(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 P9n.error("failed to load script",i);t()})}zf(){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}Hf(){const t=this.zf();return As(t)?(As(this.Bf)?this.Bf.splice(0,this.Bf.length,...t):this.Bf=[...t],t.length>0?this.Bf:void 0):(As(this.Bf)&&this.Bf.splice(0),this.Bf=t||void 0,this.Bf)}lf(){var t,e;(t=this.qf)===null||t===void 0||t.call(this),(e=this.jf)===null||e===void 0||e.call(this),this.qf=void 0,this.jf=void 0}startIfEnabledOrStop(){this.Hf()?this.Ho(this.ef):this.lf()}}},a7n=sn({surveys:class extends k9n{constructor(t){var e;super(new G9n(t),(e=t,{get projectToken(){return e.config.token},kv:new O9n(e)})),this._instance=t}Vh(t,e){const n=e.query?mV(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})})}}},mne),A7n={toolbar:class{constructor(t){this.instance=t}Uf(t){Ur.ph_toolbar_state=t}Wf(){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(p2e(this.instance.config)||!Fn||!No)return!1;t=(o=t)!==null&&o!==void 0?o:Fn.location,n=(i=n)!==null&&i!==void 0?i:Fn.history;try{if(!e){try{Fn.localStorage.setItem("test","test"),Fn.localStorage.removeItem("test")}catch{return!1}e=Fn?.localStorage}const r=Y9n||ine(t.hash,"__posthog")||ine(t.hash,"state");let s;const a=r?grt(()=>JSON.parse(atob(decodeURIComponent(r))))||grt(()=>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(nAt)||"{}"),s.source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}Vf(t){const e=Ur.ph_load_toolbar||Ur.ph_load_editor;!Fs(e)&&L_(e)?e(t,this.instance):oAt.warn("No toolbar load function found")}loadToolbar(t){const e=!!No?.getElementById("__POSTHOG_TOOLBAR__");if(!Fn||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(Fn.localStorage.setItem(nAt,JSON.stringify(sn(sn({},o),{},{source:void 0}))),this.Wf()===2)this.Vf(o);else if(this.Wf()===0){var i,r;this.Uf(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 oAt.error("[Toolbar] Failed to load",s),void this.Uf(0);this.Uf(2),this.Vf(o)}),jc(Fn,"turbolinks:load",()=>{this.Uf(0),this.loadToolbar(o)})}return!0}Gf(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,n=void 0){return this.maybeLoadToolbar(t,e,n)}}},c7n=sn({experiments:class ex{get Ir(){return this._instance.config}constructor(e){this._instance=e,this.getWebExperimentsAndEvaluateDisplayLogic=(n=!1)=>{this.getWebExperiments(o=>{ex.Zf("retrieved web experiments from the server"),this.Qf=new Map,o.forEach(i=>{if(i.feature_flag_key){var r;this.Qf&&(ex.Zf("setting flag key ",i.feature_flag_key," to web experiment ",i),(r=this.Qf)===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.Jf(i.name,s,i.variants[s].transforms)}else if(i.variants)for(const s in i.variants){const a=i.variants[s];ex.Kf(a,this._instance)&&this.Jf(i.name,s,a.transforms)}})},n)},this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}initialize(){}onFeatureFlags(e){if(this._is_bot())ex.Zf(gAt);else if(!this.Ir.disable_web_experiments){if(Fs(this.Qf))return this.Qf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ex.Zf("applying feature flags",e),e.forEach(n=>{var o;if(this.Qf&&(!((o=this.Qf)===null||o===void 0)&&o.has(n))){var i;const r=this._instance.getFeatureFlag(n),s=(i=this.Qf)===null||i===void 0?void 0:i.get(n);r&&s?.variants[r]&&this.Jf(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){const e=ex.getWindowLocation();if(e?.search){const n=Tk(e?.search,"__experiment_id"),o=Tk(e?.search,"__experiment_variant");n&&o&&(ex.Zf(`previewing web experiments ${n} && ${o}`),this.getWebExperiments(i=>{this.Xf(parseInt(n),o,i)},!1,!0))}}loadIfEnabled(){this.Ir.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,o){if(this.Ir.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.Ir.token}`),method:"GET",timestampMode:"query",callback:r=>e(r.statusCode===200&&r.json&&r.json.experiments||[])})}Xf(e,n,o){const i=o.filter(r=>r.id===e);i&&i.length>0&&(ex.Zf(`Previewing web experiment [${i[0].name}] with variant [${n}]`),this.Jf(i[0].name,n,i[0].variants[n].transforms))}static Kf(e,n){return!Fs(e.conditions)&&ex.Yf(e,n)&&ex.tp(e)}static Yf(e,n){var o;if(Fs(e.conditions)||Fs((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=Est(n,i.href);return!(!((r=e.conditions)===null||r===void 0)&&r.url)||W9n[(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 Fn?.location}static tp(e){var n;if(Fs(e.conditions)||Fs((n=e.conditions)===null||n===void 0?void 0:n.utm))return!0;const o=Wst();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 Zf(e,...n){gi.info(`[WebExperiments] ${e}`,n)}Jf(e,n,o){this._is_bot()?ex.Zf(gAt):n!=="control"?o.forEach(i=>{if(i.selector){var r;ex.Zf(`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.Zf("Control variants leave the page unmodified.")}_is_bot(){return F_&&this._instance?Dat(F_,this.Ir.custom_blocked_useragents):void 0}}},mne),l7n={conversations:class{constructor(t){this._instance=t,this.ep=void 0,this._conversationsManager=null,this.np=!1,this.ne=null,this.sp=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations||(this.rp=t.ok,!t.ok))return;const e=t.config.conversations;Fs(e)||(hy(e)?this.ep=e:(this.ep=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;(t=this._conversationsManager)===null||t===void 0||t.reset(),this._conversationsManager=null,this.ep=void 0,this.ne=null,this.rp=void 0,this.sp=!1}loadIfEnabled(){if(this._conversationsManager||this.np||this._instance.config.disable_conversations||p2e(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=Ur?.__PosthogExtensions__;if(t&&!Eo(this.ep)&&this.ep)if(this.ne&&this.ne.token){this.np=!0;try{const e=t.initConversations;if(e)return this.op(e),void(this.np=!1);const n=t.loadExternalDependency;if(!n)return void this.ap(u2e);n(this._instance,"conversations",o=>{o||!t.initConversations?this.ap("Could not load conversations script",o):this.op(t.initConversations),this.np=!1})}catch(e){this.ap("Error initializing conversations",e),this.np=!1}}else _5.error("Conversations enabled but missing token in remote config.")}op(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.sp=!1,_5.info("Conversations loaded successfully")}catch(e){this.ap("Error completing conversations initialization",e)}else _5.error("Cannot complete initialization: remote config is null")}ap(t,e){_5.error(t,e),this._conversationsManager=null,this.np=!1,this.sp=!0}show(){this._conversationsManager?this._conversationsManager.show():_5.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.ep===!0&&!ad(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":p2e(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.rp===!1?"remote_config_failed":Eo(this.ep)?this.rp?"disabled_in_project":"remote_config_pending":this.ep?Fs(this.ne)||!this.ne.token?"missing_token":Ur?.__PosthogExtensions__?this.np?"initializing":this.sp?"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 Wg(function*(){return o._conversationsManager?o._conversationsManager.sendMessage(t,e,n):(_5.warn(HM),null)})()}getMessages(t,e){var n=this;return Wg(function*(){return n._conversationsManager?n._conversationsManager.getMessages(t,e):(_5.warn(HM),null)})()}markAsRead(t){var e=this;return Wg(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(_5.warn(HM),null)})()}getTickets(t){var e=this;return Wg(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(_5.warn(HM),null)})()}requestRestoreLink(t){var e=this;return Wg(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(_5.warn(HM),null)})()}restoreFromToken(t){var e=this;return Wg(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(_5.warn(HM),null)})()}restoreFromUrlToken(){var t=this;return Wg(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(_5.warn(HM),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()}}},g7n={logs:class{constructor(t){var e;this._instance=t,this.name="logs",this.lp=!1,this.up=!1,this.hp=!1,this.A=Ad("[logs]"),this.cp=sn(sn({},this.A),{},{error:(...n)=>{n.some(pAt)||this.A.error(...n)}}),this.ol=[],this.dp=[],this._d=0,this.To=!1,this.vp=[],this.fp=[],this.pp=!1,this.gp=!1,this.mp=()=>{var n,o;this.To||(this._d=0,(n=this.yp)===null||n===void 0||n.onReconnect(),(o=this.bp)===null||o===void 0||o.onReconnect())},this._instance&&(!((e=this._instance.config.logs)===null||e===void 0)&&e.captureConsoleLogs)&&(this.lp=!0),Fn&&jc(Fn,"online",this.mp)}_p(t,e,n,o){var i;const r=uAt((i=this._instance)===null||i===void 0||(i=i.config)===null||i===void 0?void 0:i.logs,n);return[new W4n(this.wp(t,e),r,this.cp,()=>this.kp(),s=>s(),void 0,o),r]}Sp(){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.yp&&this.xp===e||((n=this.yp)===null||n===void 0||n.reset(),this.xp=e,[this.yp,this.Cp]=this._p(()=>this.ol,o=>{this.ol=o})),this.yp}$p(){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.bp&&this.Tp===e||((n=this.bp)===null||n===void 0||n.reset(),this.Tp=e,[this.bp,this.Ip]=this._p(()=>this.dp,o=>{this.dp=o},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},dAt)),this.bp}setup(t){var e;if(this.To)return;this.bo=t,!((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0||(e=e.logs)===null||e===void 0)&&e.captureConsoleLogs&&(this.lp=!0),(this.lp||this.Mp()&&this.Ep())&&this.Pp();let n=!1;const o=t.onRemoteConfig(i=>{var r;n=i.ok&&((r=i.config.logs)===null||r===void 0?void 0:r.captureConsoleLogs)===!0,this.onRemoteConfig(i)});this.To?o.dispose():(this.Eo=o,n||this.loadIfEnabled())}dispose(){var t,e,n,o;this.To||(this.To=!0,this.Rp(),(t=this.Eo)===null||t===void 0||t.dispose(),this.Eo=void 0,this.bo=void 0,this.hp=!1,Fn?.removeEventListener("online",this.mp),(e=this.Ap)===null||e===void 0||e.call(this),this.Ap=void 0,(n=this.yp)===null||n===void 0||n.reset(),(o=this.bp)===null||o===void 0||o.reset())}onRemoteConfig(t){var e,n;if(this.To)return;const o=t.ok?(e=t.config.logs)===null||e===void 0?void 0:e.captureConsoleLogs:void 0;Fs(o)?this.Fp():((n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.register({$logs_capture_enabled_server_side:!!o}),o?(this.lp=!0,this.up||this.Pp(),this.loadIfEnabled()):this.Fp())}reset(){var t,e,n,o;this.Rp(),(t=this.yp)===null||t===void 0||t.clearQueue(),this.ol=[],(e=this.yp)===null||e===void 0||e.reset(),(n=this.bp)===null||n===void 0||n.clearQueue(),this.dp=[],(o=this.bp)===null||o===void 0||o.reset(),this._d=0}captureLog(t){this.To||this.Sp().captureLog(t)}captureConsoleLog(t){this.To||this.$p().captureLog(t)}captureBufferedConsoleLog(t,e,n){this.To||this.$p().captureLog(t,{context:e,occurredAtMs:n})}Ep(){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[Wrt])}Mp(){var t,e,n;return!(!((t=this._instance)===null||t===void 0||(e=t.il)===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.Rp(),(t=this.bp)===null||t===void 0||t.clearQueue(),this.dp=[]}Fp(){this.lp||this.Rp()}Pp(){var t;if(this.pp||!Ur?.console)return;const e=uAt((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0?void 0:t.logs).maxBufferSize;let n=!0;this.fp.push(()=>{n=!1});for(const o of j9n){let i;try{i=q9n(Ur.console[o])}catch{continue}i&&this.fp.push(xV(Ur.console,o,r=>{const s=(...a)=>{try{n&&this.Op(o,a,e)}catch{}return r.apply(Ur.console,a)};return s.__rrweb_original__=i,s}))}this.pp=!0,this.Dp=setTimeout(()=>{this.Rp()},3e4)}Op(t,e,n){var o;if(this.pp&&!this.gp&&e.length!==0)if(!((o=this._instance)===null||o===void 0)&&o.is_capturing()){if(n>this.vp.length){this.gp=!0;try{this.vp.push({level:t,args:e,occurredAtMs:Date.now(),context:this.kp()})}finally{this.gp=!1}}}else this.Rp()}Rp(){if(this.vp=[],this.pp){this.pp=!1,this.Dp&&(clearTimeout(this.Dp),this.Dp=void 0);for(const t of this.fp)t();this.fp=[]}}Lp(){const t=this.vp;return this.Rp(),t}get logger(){return this.Np||(this.Np={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.Np}flushLogs(t){t?this.qp(t):(this.yp&&this.yp.flush().catch(e=>this.jp(e)),this.bp&&this.bp.flush().catch(e=>this.jp(e)))}jp(t){pAt(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.To||!this.lp||this.up||this.hp)return;const t=Ur?.__PosthogExtensions__;if(!t)return this.A.error("PostHog Extensions not found."),void this.Rp();const e=t.loadExternalDependency;if(!e)return this.A.error(u2e),void this.Rp();this.hp=!0;try{e(this._instance,"logs",n=>{if(this.hp=!1,this.To||!this.lp)return;const o=t.logs;if(n||!o?.initializeLogs)this.A.error("Could not load logs script",n),this.Rp();else{var i;const a=this.Lp();var r,s;this.Ap=o.initializeLogs((i=this.bo)!==null&&i!==void 0?i:this._instance),this.up=!0,a.length>0&&((r=o.replayConsoleBuffer)===null||r===void 0||r.call(o,(s=this.bo)!==null&&s!==void 0?s:this._instance,a))}})}catch(n){throw this.hp=!1,n}}wp(t,e){const n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:o=>o===x9.LogsQueue?t():void 0,setPersistedProperty(o,i){var r;o===x9.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(zst(this._d,3))return void e({kind:"fatal",error:nxe(void 0,"logs endpoint is unreachable, dropping batch")});let n=!1;const o=r=>{n||(n=!0,clearTimeout(i),e(r))},i=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),o({kind:"retry-later",error:nxe(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Bp(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:r=>{const s=r.statusCode;if(this.Hp(s),s>=200&&300>s)o({kind:"ok"});else if(s===413)o({kind:"too-large"});else if(s!==0&&s!==408&&s!==429&&500>s)o({kind:"fatal",error:new Error(`logs request failed with status ${s}`)});else{var a;s===0?(r.error||this.A.warn("Logs request failed before receiving an HTTP response"),o({kind:"retry-later",error:nxe(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}`)})}}})})}Hp(t){(t!==0||this._instance.__loaded)&&(this._d=Jst(t,this._d,3,()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}qp(t){this.ol.length>0&&this.zp(t,this.ol,this.Cp,Ym.LIB_NAME,e=>{this.ol=e}),this.dp.length>0&&this.zp(t,this.dp,this.Ip,dAt,e=>{this.dp=e})}zp(t,e,n,o,i){if(e.length===0)return;const r=e.map(a=>a.record);i([]);const s=krt(r,Trt(n,Ym.LIB_NAME,Ym.LIB_VERSION),o,Ym.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Bp(),data:s,compression:"best-available",batchKey:"logs",transport:t})}Bp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}kp(){var t;const e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:n,windowId:o,sessionStartTimestamp:i,lastActivityTimestamp:r}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=n,e.windowId=o,Fs(i)||(e.sessionStartTimestamp=i),Fs(r)||(e.lastActivityTimestamp=r)}if(!(Ur==null||(t=Ur.location)===null||t===void 0)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?rQ(Ur.location.href):Ur.location.href),this._instance.featureFlags){const n=this._instance.featureFlags.getFlags();n&&n.length>0&&(e.activeFeatureFlags=n)}return e}}},u7n={metrics:class{constructor(t){this._instance=t,this.A=Ad("[metrics]"),this.To=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.To)return;const e=!!(!((t=this._instance.config.metrics)===null||t===void 0)&&t.network);e&&!this.Up?this.Up=(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=e7n(n,i);return()=>{o=!1,r(),s()}})(this._instance):!e&&this.Up&&(this.Up(),this.Up=void 0)}Sp(){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.yp&&this.xp===e||((n=this.yp)===null||n===void 0||n.reset(),this.xp=e,this.yp=new j4n(this.wp(),(function(o){var i,r,s,a,A;const c=o?.resourceAttributes;return{serviceName:(i=c?.["service.name"])!==null&&i!==void 0?i:o?.serviceName,serviceVersion:(r=c?.["service.version"])!==null&&r!==void 0?r:o?.serviceVersion,environment:(s=c?.["deployment.environment"])!==null&&s!==void 0?s:o?.environment,resourceAttributes:c,beforeSend:o?.beforeSend,flushIntervalMs:(a=o?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(A=o?.maxSeriesPerFlush)!==null&&A!==void 0?A:1e3}})(e),this.A)),this.yp}count(t,e=1,n){this.Sp().count(t,e,n)}gauge(t,e,n){this.Sp().gauge(t,e,n)}histogram(t,e,n){this.Sp().histogram(t,e,n)}flush(t){if(!this.yp)return Promise.resolve();if(t){const e=this.yp.drainWindow();return e&&this.Ys(e,t),Promise.resolve()}return this.yp.flush().catch(e=>this.A.error("PostHog metrics flush failed:",e))}reset(){var t;(t=this.yp)===null||t===void 0||t.reset()}dispose(){var t,e;this.To=!0,(t=this.Up)===null||t===void 0||t.call(this),this.Up=void 0,(e=this.yp)===null||e===void 0||e.reset()}wp(){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.Wp(),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}`)})}}}))})}Wp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};CV.__defaultExtensionClasses=sn({},sn(sn(sn(sn(sn(sn(sn(sn(sn(sn(sn(sn(sn({},mne),t7n),n7n),o7n),i7n),r7n),a7n),s7n),A7n),c7n),l7n),g7n),u7n));var Kk=(function(){Ym.SDK_DIST_CHANNEL="npm";const t=_V[IV]=new CV;return(function(){function e(){e.done||(e.done=!0,Qat=!1,vl(_V,function(n){n._dom_loaded()}))}No?.addEventListener?No.readyState==="complete"?e():jc(No,"DOMContentLoaded",e,{capture:!1}):Fn&&gi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),t})();class OM 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 fAt 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 rxe extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const n=e?.cause?e.cause instanceof Error?e.cause:new fAt(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 IAt=(()=>{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})(),d7n=typeof globalThis.AbortController=="function",CAt=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",h7n=typeof globalThis.ReadableStream=="function",p7n=typeof globalThis.FormData=="function",yAt=["get","post","put","patch","head","delete"],m7n={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},sxe=2147483647,_7n=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,xAt=Symbol("stop");class EAt{options;constructor(e){this.options=e}}const f7n=t=>new EAt(t),I7n={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},C7n={next:!0},y7n={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},x7n=t=>{if(!t)return 0;if(t instanceof FormData){let e=0;for(const[n,o]of t)e+=_7n,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},BAt=(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))}}))},E7n=(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(BAt(t.body,n,e),{status:t.status,statusText:t.statusText,headers:t.headers})},B7n=(t,e,n)=>{if(!t.body)return t;const o=x7n(n??t.body);return new Request(t,{duplex:"half",body:BAt(t.body,o,e)})},GM=t=>t!==null&&typeof t=="object",_ne=(...t)=>{for(const e of t)if((!GM(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return axe({},...t)},bAt=(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 fne(t,e,n){return Object.hasOwn(e,n)&&e[n]===void 0?[]:axe(t[n]??[],e[n]??[])}const SAt=(t={},e={})=>({beforeRequest:fne(t,e,"beforeRequest"),beforeRetry:fne(t,e,"beforeRetry"),afterResponse:fne(t,e,"afterResponse"),beforeError:fne(t,e,"beforeError")}),b7n=(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(GM(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},axe=(...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(GM(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&&(!GM(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:b7n(i,A);continue}GM(A)&&a in e&&(A=axe(e[a],A)),e={...e,[a]:A}}GM(s.hooks)&&(o=SAt(o,s.hooks),e.hooks=o),GM(s.headers)&&(n=bAt(n,s.headers),e.headers=n)}return i!==void 0&&(e.searchParams=i),r.length>0&&(r.length===1?e.signal=r[0]:CAt?e.signal=AbortSignal.any(r):e.signal=r.at(-1)),e},S7n=t=>yAt.includes(t)?t.toUpperCase():t,QAt={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},Q7n=(t={})=>{if(typeof t=="number")return{...QAt,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{...QAt,...e}};class Axe extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}}async function v7n(t,e,n,o){return new Promise((i,r)=>{const s=setTimeout(()=>{n&&n.abort(),r(new Axe(t))},o.timeout);o.fetch(t,e).then(i).catch(r).then(()=>{clearTimeout(s)})})}async function w7n(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 P7n=(t,e)=>{const n={};for(const o in e)Object.hasOwn(e,o)&&!(o in y7n)&&!(o in I7n)&&(!(o in t)||o in C7n)&&(n[o]=e[o]);return n},M7n=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 D7n(t){return t instanceof OM||t?.name===OM.name}function N7n(t){return t instanceof Axe||t?.name===Axe.name}let vAt=class Wnt{static create(e,n){const o=new Wnt(e,n),i=async()=>{if(typeof o.#e.timeout=="number"&&o.#e.timeout>sxe)throw new RangeError(`The \`timeout\` option cannot be greater than ${sxe}`);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 EAt)throw o.#r(A),o.#r(s),new rxe(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 OM(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(!h7n)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");const a=s.clone();return o.#r(s),E7n(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(m7n))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:bAt(this.#t.headers,n.headers),hooks:SAt({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},n.hooks),method:S7n(n.method??this.#t.method??"GET"),prefixUrl:String(n.prefixUrl||""),retry:Q7n(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}d7n&&CAt&&(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),IAt&&(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&&(p7n&&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),M7n(this.#e.searchParams)){const r="?"+(typeof this.#e.searchParams=="string"?this.#e.searchParams.replace(/^\?/,""):new URLSearchParams(Wnt.#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(!IAt)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 fAt(e);if(n instanceof rxe)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(N7n(e)&&!this.#e.retry.retryOnTimeout)throw e;if(D7n(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),sxe);if(this.#n<1)throw n;if(await w7n(o,this.#i?{signal:this.#i}:{}),n instanceof rxe&&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===xAt)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=P7n(this.request,this.#e);return this.#s=this.request,this.request=this.#s.clone(),this.#e.timeout===!1?this.#e.fetch(this.#s,e):v7n(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:B7n(e,this.#e.onUploadProgress,n??this.#e.body??void 0)}};const cxe=t=>{const e=(n,o)=>vAt.create(n,_ne(t,o));for(const n of yAt)e[n]=(o,i)=>vAt.create(o,_ne(t,i,{method:n}));return e.create=n=>cxe(_ne(n)),e.extend=n=>(typeof n=="function"&&(n=n(t??{})),cxe(_ne(t,n))),e.stop=xAt,e.retry=f7n,e},R7n=cxe();class T7n extends OM{constructor(e,n,o,i){super(e,n,o),this.name="RegistryHTTPError",this.message=i}}function EV(t){return typeof window<"u"?window[t]:null}function YM(){const t=EV("TSCIRCUIT_REGISTRY_API_BASE_URL")||void 0||"https://registry-api.tscircuit.com",e=EV("TSCIRCUIT_REGISTRY_TOKEN");return R7n.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 T7n(i,n,o,l.join(" | "))}]}})}function Ine(){return!!EV("TSCIRCUIT_REGISTRY_TOKEN")}const Cne={get:(t,e)=>YM().get(t,e),post:(t,e)=>YM().post(t,e),put:(t,e)=>YM().put(t,e),delete:(t,e)=>YM().delete(t,e),patch:(t,e)=>YM().patch(t,e)},k7n="phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo",F7n="https://postpig.tscircuit.com",wAt="runframe:anonymous-id",lxe=()=>typeof window<"u",PAt=t=>t.includes("localhost")||t.includes("127.0.0.1"),L7n=t=>{try{return new URL(t).hostname}catch{return null}},H7n=()=>{if(!lxe())return null;let t=null;return document.referrer&&(t=L7n(document.referrer)),t??window.location.hostname},O7n=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,G7n=()=>{if(!lxe())return null;try{const t=window.localStorage.getItem(wAt);if(t)return t;const e=O7n();return window.localStorage.setItem(wAt,e),e}catch{return null}},Y7n=()=>EV("TSCIRCUIT_USE_RUNFRAME_FOR_CLI")===!0,MAt=()=>!lxe()||PAt(window.location.hostname)&&!Y7n()?!1:(Kk.__loaded||Kk.init(k7n,{api_host:F7n,person_profiles:"always"}),!0),U7n=()=>{if(!MAt())return null;const t=H7n(),e=t!=null&&!PAt(t);let n=null;e||(n=G7n());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}},K7n=(t,{source:e,...n})=>{const o=U7n();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),Kk.identify(s,A)}Kk.capture(t,{...n,source:e,embed_domain:i,runframe_anonymous_id:r,identity_type:a})},V7n=t=>{K7n("runframe_activity",t)};MAt();function z7n(t){const e=String.fromCodePoint(...t);return btoa(e)}var tm=Uint8Array,R3=Uint16Array,gxe=Int32Array,yne=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]),xne=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]),uxe=new tm([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),DAt=function(t,e){for(var n=new R3(31),o=0;o<31;++o)n[o]=e+=1<<t[o-1];for(var i=new gxe(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}},NAt=DAt(yne,2),RAt=NAt.b,dxe=NAt.r;RAt[28]=258,dxe[258]=28;for(var TAt=DAt(xne,0),J7n=TAt.b,kAt=TAt.r,hxe=new R3(32768),gd=0;gd<32768;++gd){var dQ=(gd&43690)>>1|(gd&21845)<<1;dQ=(dQ&52428)>>2|(dQ&13107)<<2,dQ=(dQ&61680)>>4|(dQ&3855)<<4,hxe[gd]=((dQ&65280)>>8|(dQ&255)<<8)>>1}for(var Q9=(function(t,e,n){for(var o=t.length,i=0,r=new R3(e);i<o;++i)t[i]&&++r[t[i]-1];var s=new R3(e);for(i=1;i<e;++i)s[i]=s[i-1]+r[i-1]<<1;var a;if(n){a=new R3(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[hxe[g]>>A]=c}else for(a=new R3(o),i=0;i<o;++i)t[i]&&(a[i]=hxe[s[t[i]-1]++]>>15-t[i]);return a}),hQ=new tm(288),gd=0;gd<144;++gd)hQ[gd]=8;for(var gd=144;gd<256;++gd)hQ[gd]=9;for(var gd=256;gd<280;++gd)hQ[gd]=7;for(var gd=280;gd<288;++gd)hQ[gd]=8;for(var BV=new tm(32),gd=0;gd<32;++gd)BV[gd]=5;var W7n=Q9(hQ,9,0),j7n=Q9(hQ,9,1),q7n=Q9(BV,5,0),X7n=Q9(BV,5,1),pxe=function(t){for(var e=t[0],n=1;n<t.length;++n)t[n]>e&&(e=t[n]);return e},H4=function(t,e,n){var o=e/8|0;return(t[o]|t[o+1]<<8)>>(e&7)&n},mxe=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(e&7)},_xe=function(t){return(t+7)/8|0},Vk=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))},$7n=["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||$7n[t]);if(o.code=t,Error.captureStackTrace&&Error.captureStackTrace(o,ix),!n)throw o;return o},FAt=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(me){var ye=n.length;if(me>ye){var Me=new tm(Math.max(ye*2,me));Me.set(n),n=Me}},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=H4(t,g,1);var f=H4(t,g+1,3);if(g+=3,f)if(f==1)h=j7n,d=X7n,p=9,m=5;else if(f==2){var x=H4(t,g,31)+257,E=H4(t,g+10,15)+4,B=x+H4(t,g+5,31)+1;g+=14;for(var S=new tm(B),Q=new tm(19),w=0;w<E;++w)Q[uxe[w]]=H4(t,g+w*3,7);g+=E*3;for(var M=pxe(Q),k=(1<<M)-1,R=Q9(Q,M,1),w=0;w<B;){var F=R[H4(t,g,k)];g+=F&15;var I=F>>4;if(I<16)S[w++]=I;else{var O=0,U=0;for(I==16?(U=3+H4(t,g,3),g+=2,O=S[w-1]):I==17?(U=3+H4(t,g,7),g+=3):I==18&&(U=11+H4(t,g,127),g+=7);U--;)S[w++]=O}}var Y=S.subarray(0,x),J=S.subarray(x);p=pxe(Y),m=pxe(J),h=Q9(Y,p,1),d=Q9(J,m,1)}else ix(1);else{var I=_xe(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,q=g;;q=g){var O=h[mxe(t,g)&ee],oe=O>>4;if(g+=O&15,g>_){A&&ix(0);break}if(O||ix(2),oe<256)n[u++]=oe;else if(oe==256){q=g,h=null;break}else{var se=oe-254;if(oe>264){var w=oe-257,ie=yne[w];se=H4(t,g,(1<<ie)-1)+RAt[w],g+=ie}var ge=d[mxe(t,g)&W],ue=ge>>4;ge||ix(3),g+=ge&15;var J=J7n[ue];if(ue>3){var ie=xne[ue];J+=mxe(t,g)&(1<<ie)-1,g+=ie}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=q,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?Vk(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},bV=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},fxe=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:GAt,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 R3(u+1),d=Ixe(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}},Ixe=function(t,e,n){return t.s==-1?Math.max(Ixe(t.l,e,n+1),Ixe(t.r,e,n+1)):e[t.s]=n},LAt=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new R3(++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}},SV=function(t,e){for(var n=0,o=0;o<e.length;++o)n+=t[o]*e[o];return n},HAt=function(t,e,n){var o=n.length,i=_xe(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},OAt=function(t,e,n,o,i,r,s,a,A,c,l){S8(e,l++,n),++i[256];for(var g=fxe(i,15),u=g.t,h=g.l,d=fxe(r,15),p=d.t,m=d.l,_=LAt(u),f=_.c,I=_.n,C=LAt(p),y=C.c,x=C.n,E=new R3(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=fxe(E,7),Q=S.t,w=S.l,M=19;M>4&&!Q[uxe[M-1]];--M);var k=c+5<<3,R=SV(i,hQ)+SV(r,BV)+s,F=SV(i,u)+SV(r,p)+s+14+3*M+SV(E,Q)+2*E[16]+3*E[17]+7*E[18];if(A>=0&&k<=R&&k<=F)return HAt(e,l,t.subarray(A,A+c));var O,U,Y,J;if(S8(e,l,1+(F<R)),l+=2,F<R){O=Q9(u,h,0),U=u,Y=Q9(p,m,0),J=p;var ee=Q9(Q,w,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[uxe[B]]);l+=3*M;for(var W=[f,y],q=0;q<2;++q)for(var oe=W[q],B=0;B<oe.length;++B){var se=oe[B]&31;S8(e,l,ee[se]),l+=Q[se],se>15&&(S8(e,l,oe[B]>>5&127),l+=oe[B]>>12)}}else O=W7n,U=hQ,Y=q7n,J=BV;for(var B=0;B<a;++B){var ie=o[B];if(ie>255){var se=ie>>18&31;bV(e,l,O[se+257]),l+=U[se+257],se>7&&(S8(e,l,ie>>23&31),l+=yne[se]);var ge=ie&31;bV(e,l,Y[ge]),l+=J[ge],ge>3&&(bV(e,l,ie>>5&8191),l+=xne[ge])}else bV(e,l,O[ie]),l+=U[ie]}return bV(e,l,O[256]),l+U[256]},Z7n=new gxe([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),GAt=new tm(0),e6n=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 R3(32768),m=r.h||new R3(d+1),_=Math.ceil(n/3),f=2*_,I=function(we){return(t[we]^t[we+1]<<_^t[we+2]<<f)&d},C=new gxe(25e3),y=new R3(288),x=new R3(32),E=0,B=0,S=r.i||0,Q=0,w=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,w<=S){var O=s-S;if((E>7e3||Q>24576)&&(O>423||!c)){l=OAt(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 q=Math.min(u,O)-1,oe=Math.min(32767,S),se=Math.min(258,O);W<=oe&&--ee&&R!=F;){if(t[S+Y]==t[S+Y-W]){for(var ie=0;ie<se&&t[S+ie]==t[S+ie-W];++ie);if(ie>Y){if(Y=ie,J=W,ie>q)break;for(var ge=Math.min(W,ie-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|dxe[Y]<<18|kAt[J];var me=dxe[Y]&31,ye=kAt[J]&31;B+=yne[me]+xne[ye],++y[257+me],++x[ye],w=S+Y,++E}else C[Q++]=t[S],++y[t[S]]}}for(S=Math.max(S,w);S<s;++S)C[Q++]=t[S],++y[t[S]];l=OAt(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=w)}else{for(var S=r.w||0;S<s+c;S+=65535){var Me=S+65535;Me>=s&&(A[l/8|0]=c,Me=s),l=HAt(A,l+1,t.subarray(S,Me))}r.i=s}return Vk(a,0,o+_xe(l)+i)},t6n=(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})(),n6n=function(){var t=-1;return{p:function(e){for(var n=t,o=0;o<e.length;++o)n=t6n[n&255^e[o]]^n>>>8;t=n},d:function(){return~t}}},YAt=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}}},UAt=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 e6n(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)},QV=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},o6n=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&&QV(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)}},i6n=function(t){return 10+(t.filename?t.filename.length+1:0)},r6n=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=YAt();i.p(e.dictionary),QV(t,2,i.d())}},KAt=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},Cxe=(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=FAt(this.p,this.s,this.o);this.ondata(Vk(o,n,this.s.b),this.d),this.o=Vk(o,this.s.b-32768),this.s.b=this.o.length,this.p=Vk(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 yxe(t,e){e||(e={});var n=n6n(),o=t.length;n.p(t);var i=UAt(t,e,i6n(e),8),r=i.length;return o6n(i,e),QV(i,r-8,n.d()),QV(i,r-4,o),i}function VAt(t,e){e||(e={});var n=YAt();n.p(t);var o=UAt(t,e,e.dictionary?6:2,4);return r6n(o,e),QV(o,o.length-4,n.d()),o}var Ene=(function(){function t(e,n){Cxe.call(this,e,n),this.v=e&&e.dictionary?2:1}return t.prototype.push=function(e,n){if(Cxe.prototype.e.call(this,e),this.v){if(this.p.length<6&&!n)return;this.p=this.p.subarray(KAt(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)),Cxe.prototype.c.call(this,n)},t})();function s6n(t,e){return FAt(t.subarray(KAt(t,e),-4),{i:2},e,e)}var zAt=typeof TextEncoder<"u"&&new TextEncoder,a6n=typeof TextDecoder<"u"&&new TextDecoder,A6n=0;try{a6n.decode(GAt,{stream:!0}),A6n=1}catch{}function xxe(t,e){var n;if(zAt)return zAt.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 Vk(i,0,r)}function c6n(t,e){const n=JSON.stringify(t),o=yxe(xxe(n));return`https://tscircuit.com/editor?#data:application/gzip;base64,${z7n(o)}`}function zr(...t){return K5n(R4(t))}const JAt=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),Exe=d5n,Bne=te.forwardRef(({className:t,...e},n)=>V.jsx(git,{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}));Bne.displayName=git.displayName;const v9=te.forwardRef(({className:t,...e},n)=>V.jsx(uit,{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}));v9.displayName=uit.displayName;const q1=te.forwardRef(({className:t,...e},n)=>V.jsx(dit,{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}));q1.displayName=dit.displayName;const WAt="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 Bxe,jAt;function l6n(){if(jAt)return Bxe;jAt=1,Bxe=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 Bxe}var bxe,qAt;function g6n(){if(qAt)return bxe;qAt=1;var t=l6n(),e=Object.prototype.toString;return bxe=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"},bxe}var Sxe={exports:{}},XAt;function u6n(){return XAt||(XAt=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})()})(Sxe)),Sxe.exports}var Qxe,$At;function d6n(){if($At)return Qxe;$At=1;var t=g6n(),e=u6n();return Qxe=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},Qxe}var h6n=d6n();const p6n=uy(h6n);var vxe={exports:{}},ZAt;function ect(){return ZAt||(ZAt=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})(vxe)),vxe.exports}var wxe,tct;function m6n(){if(tct)return wxe;tct=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=ect(),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="",w="",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="",w=!1,x=o.tagBegin}),t(g,i.char,function(F){E+=F}),g)),t(C,o.cdata,t({},i.char,function(F){E+=F,E.substr(-3)==="]]>"&&(k(r.text,E.slice(0,-3)),E="",x=o.data)})),t(C,o.tagBegin,(u={},t(u,i.space,n),t(u,i.char,function(F){B=F,x=o.tagName}),t(u,i.slash,function(){B="",w=!0}),u)),t(C,o.tagName,(h={},t(h,i.space,function(){w?x=o.tagEnd:(x=o.attributeNameStart,k(r.openTag,B))}),t(h,i.gt,function(){k(w?r.closeTag:r.openTag,B),E="",x=o.data}),t(h,i.slash,function(){x=o.tagEnd,k(r.openTag,B)}),t(h,i.char,function(F){B+=F,B==="![CDATA["&&(x=o.cdata,E="",B="")}),h)),t(C,o.tagEnd,(d={},t(d,i.gt,function(){k(r.closeTag,B),E="",x=o.data}),t(d,i.char,n),d)),t(C,o.attributeNameStart,(p={},t(p,i.char,function(F){S=F,x=o.attributeName}),t(p,i.gt,function(){E="",x=o.data}),t(p,i.space,n),t(p,i.slash,function(){w=!0,x=o.tagEnd}),p)),t(C,o.attributeName,(m={},t(m,i.space,function(){x=o.attributeNameEnd}),t(m,i.equal,function(){k(r.attributeName,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(){w=!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),w=!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 wxe={State:o,Action:i,Type:r,create:A},wxe}var Pxe,nct;function _6n(){if(nct)return Pxe;nct=1;var t=ect(),e=m6n(),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 Pxe={parseSync:s,create:r,NodeType:o},Pxe}var f6n=_6n(),I6n=function(e){var n=f6n.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")},C6n=function(e){return p6n(e,function(n){return x6n(n)?n:y6n(n)})},y6n=function(e){return e.replace(/[-|:]([a-z])/gi,function(n,o){return o.toUpperCase()})},x6n=function(e){return/^(data|aria)(-\w+)/.test(e)},E6n=function(e){if(e){var n=String(e);return/[&<>]/.test(n)?"<![CDATA[".concat(n.replace(/]]>/,"]]]]><![CDATA[>"),"]]>"):n}return""},B6n=function(e){return String(e).replace(/&/g,"&").replace(/'/g,"'").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},vV=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=C6n(l)),l};return a(I6n(e))},oct=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 E6n(c.value);var l="";for(var g in c.attributes){var u=i(g,c.attributes[g],B6n,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,"/>")},pQ=t=>{const e=Math.round(t*1e3)/1e3;return`${Number(e.toFixed(3))}mm`},ict=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]]),b6n=[...ict.keys()];function rct(t){return ict.get(t)}var sct={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}}},Mxe=new Set;for(const[t,e]of Object.entries(sct)){Mxe.add(t);for(const n of Object.keys(e.variants))Mxe.add(n)}function S6n(t){for(const e of Object.values(sct)){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=rct(i);if(r!=null)return{baseUnit:e.baseUnit,conversionFactor:r*o}}}return{baseUnit:t,conversionFactor:1}}function X1(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=X1(t.x,e),l=X1(t.x,e),g=X1(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=rct(i);if(e&&s!=null)return{parsedUnit:null,unitOfValue:e,value:Number.parseFloat(r)*s};if(s!=null&&!Mxe.has(i))return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(r)*s};const{baseUnit:a,conversionFactor:A}=S6n(i);return{parsedUnit:i,unitOfValue:a,value:A*Number.parseFloat(r)}}b6n.filter(t=>t!=="").sort((t,e)=>e.length-t.length).map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|");var zk=[{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"}],Q6n=zk[zk.length-1];function H_(t){if(t==null)return"";if(t===0)return"0";const e=Math.abs(t);let n=zk.findIndex(s=>{const a=e/s.value;return a>=1&&a<1e3});n===-1&&(n=zk.indexOf(Q6n));let o=zk[n],i=t/o.value;for(;n>0&&Math.abs(Number(i.toPrecision(3)))>=1e3;)n-=1,o=zk[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 wl;(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})(wl||(wl={}));var act;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(act||(act={}));const Sr=wl.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mQ=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=wl.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 f5 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 f5))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,wl.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()}}f5.create=t=>new f5(t);const wV=(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,wl.jsonStringifyReplacer)}`;break;case lo.unrecognized_keys:n=`Unrecognized key(s) in object: ${wl.joinValues(t.keys,", ")}`;break;case lo.invalid_union:n="Invalid input";break;case lo.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${wl.joinValues(t.options)}`;break;case lo.invalid_enum_value:n=`Invalid enum value. Expected ${wl.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}"`:wl.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,wl.assertNever(t)}return{message:n}};let v6n=wV;function Dxe(){return v6n}const Nxe=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=Dxe(),o=Nxe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===wV?void 0:wV].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"}),PV=t=>({status:"dirty",value:t}),rx=t=>({status:"valid",value:t}),Act=t=>t.status==="aborted",cct=t=>t.status==="dirty",Jk=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 w9{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 lct=(t,e)=>{if(Jk(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 f5(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 mQ(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:mQ(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:mQ(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:mQ(e)},i=this._parseSync({data:e,path:o.path,parent:o});return lct(o,i)}"~validate"(e){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:mQ(e)};if(!this["~standard"].async)try{const o=this._parseSync({data:e,path:[],parent:n});return Jk(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=>Jk(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:mQ(e)},i=this._parse({data:e,path:o.path,parent:o}),r=await(bne(i)?i:Promise.resolve(i));return lct(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 fQ({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 w8.create(this,this._def)}nullable(){return zM.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return M9.create(this)}promise(){return RV.create(this,this._def)}or(e){return vne.create([this,e],this._def)}and(e){return wne.create(this,e,this._def)}transform(e){return new fQ({...EA(this._def),schema:this,typeName:Ea.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Dne({...EA(this._def),innerType:this,defaultValue:n,typeName:Ea.ZodDefault})}brand(){return new fct({typeName:Ea.ZodBranded,type:this,...EA(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Nne({...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 Oxe.create(this,e)}readonly(){return Rne.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const w6n=/^c[^\s-]{8,}$/i,P6n=/^[0-9a-z]+$/,M6n=/^[0-9A-HJKMNP-TV-Z]{26}$/i,D6n=/^[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,N6n=/^[a-z0-9_-]{21}$/i,R6n=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,T6n=/^[-+]?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)?)??$/,k6n=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,F6n="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Rxe;const L6n=/^(?:(?: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])$/,H6n=/^(?:(?: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])$/,O6n=/^(([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]))$/,G6n=/^(([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])$/,Y6n=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,U6n=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,gct="((\\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])))",K6n=new RegExp(`^${gct}$`);function uct(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 V6n(t){return new RegExp(`^${uct(t)}$`)}function z6n(t){let e=`${gct}T${uct(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 J6n(t,e){return!!((e==="v4"||!e)&&L6n.test(t)||(e==="v6"||!e)&&O6n.test(t))}function W6n(t,e){if(!R6n.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 j6n(t,e){return!!((e==="v4"||!e)&&H6n.test(t)||(e==="v6"||!e)&&G6n.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")k6n.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")Rxe||(Rxe=new RegExp(F6n,"u")),Rxe.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")D6n.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")N6n.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")w6n.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")P6n.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")M6n.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"?z6n(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"?K6n.test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{code:lo.invalid_string,validation:"date",message:r.message}),o.dirty()):r.kind==="time"?V6n(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"?T6n.test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{validation:"duration",code:lo.invalid_string,message:r.message}),o.dirty()):r.kind==="ip"?J6n(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"?W6n(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"?j6n(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"?Y6n.test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{validation:"base64",code:lo.invalid_string,message:r.message}),o.dirty()):r.kind==="base64url"?U6n.test(e.data)||(i=this._getOrReturnCtx(e,i),rr(i,{validation:"base64url",code:lo.invalid_string,message:r.message}),o.dirty()):wl.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 q6n(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 UM 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"?wl.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"?q6n(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()):wl.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 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]})}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"&&wl.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)}}UM.create=t=>new UM({checks:[],typeName:Ea.ZodNumber,coerce:t?.coerce||!1,...EA(t)});class KM 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()):wl.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 KM({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:o,message:is.toString(i)}]})}_addCheck(e){return new KM({...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}}KM.create=t=>new KM({checks:[],typeName:Ea.ZodBigInt,coerce:t?.coerce??!1,...EA(t)});class Sne 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)}}Sne.create=t=>new Sne({typeName:Ea.ZodBoolean,coerce:t?.coerce||!1,...EA(t)});class Wk 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()):wl.assertNever(r);return{status:o.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Wk({...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}}Wk.create=t=>new Wk({checks:[],coerce:t?.coerce||!1,typeName:Ea.ZodDate,...EA(t)});class dct 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)}}dct.create=t=>new dct({typeName:Ea.ZodSymbol,...EA(t)});class Txe 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)}}Txe.create=t=>new Txe({typeName:Ea.ZodUndefined,...EA(t)});class Qne 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)}}Qne.create=t=>new Qne({typeName:Ea.ZodNull,...EA(t)});class MV extends Bc{constructor(){super(...arguments),this._any=!0}_parse(e){return rx(e.data)}}MV.create=t=>new MV({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 _Q extends Bc{_parse(e){const n=this._getOrReturnCtx(e);return rr(n,{code:lo.invalid_type,expected:Sr.never,received:n.parsedType}),Zs}}_Q.create=t=>new _Q({typeName:Ea.ZodNever,...EA(t)});class hct 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)}}hct.create=t=>new hct({typeName:Ea.ZodVoid,...EA(t)});class M9 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 w9(n,s,n.path,a)))).then(s=>my.mergeArray(o,s));const r=[...n.data].map((s,a)=>i.type._parseSync(new w9(n,s,n.path,a)));return my.mergeArray(o,r)}get element(){return this._def.type}min(e,n){return new M9({...this._def,minLength:{value:e,message:is.toString(n)}})}max(e,n){return new M9({...this._def,maxLength:{value:e,message:is.toString(n)}})}length(e,n){return new M9({...this._def,exactLength:{value:e,message:is.toString(n)}})}nonempty(e){return this.min(1,e)}}M9.create=(t,e)=>new M9({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ea.ZodArray,...EA(e)});function qk(t){if(t instanceof Km){const e={};for(const n in t.shape){const o=t.shape[n];e[n]=w8.create(qk(o))}return new Km({...t._def,shape:()=>e})}else return t instanceof M9?new M9({...t._def,type:qk(t.element)}):t instanceof w8?w8.create(qk(t.unwrap())):t instanceof zM?zM.create(qk(t.unwrap())):t instanceof v8?v8.create(t.items.map(e=>qk(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=wl.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 _Q&&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 w9(i,g,i.path,c)),alwaysSet:c in i.data})}if(this._def.catchall instanceof _Q){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 w9(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 wl.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 wl.objectKeys(this.shape))e[o]||(n[o]=this.shape[o]);return new Km({...this._def,shape:()=>n})}deepPartial(){return qk(this)}partial(e){const n={};for(const o of wl.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 wl.objectKeys(this.shape))if(e&&!e[o])n[o]=this.shape[o];else{let r=this.shape[o];for(;r instanceof w8;)r=r._def.innerType;n[o]=r}return new Km({...this._def,shape:()=>n})}keyof(){return mct(wl.objectKeys(this.shape))}}Km.create=(t,e)=>new Km({shape:()=>t,unknownKeys:"strip",catchall:_Q.create(),typeName:Ea.ZodObject,...EA(e)}),Km.strictCreate=(t,e)=>new Km({shape:()=>t,unknownKeys:"strict",catchall:_Q.create(),typeName:Ea.ZodObject,...EA(e)}),Km.lazycreate=(t,e)=>new Km({shape:t,unknownKeys:"strip",catchall:_Q.create(),typeName:Ea.ZodObject,...EA(e)});class vne 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 f5(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 f5(A));return rr(n,{code:lo.invalid_union,unionErrors:a}),Zs}}get options(){return this._def.options}}vne.create=(t,e)=>new vne({options:t,typeName:Ea.ZodUnion,...EA(e)});const Q8=t=>t instanceof Lxe?Q8(t.schema):t instanceof fQ?Q8(t.innerType()):t instanceof Mne?[t.value]:t instanceof VM?t.options:t instanceof Hxe?wl.objectValues(t.enum):t instanceof Dne?Q8(t._def.innerType):t instanceof Txe?[void 0]:t instanceof Qne?[null]:t instanceof w8?[void 0,...Q8(t.unwrap())]:t instanceof zM?[null,...Q8(t.unwrap())]:t instanceof fct||t instanceof Rne?Q8(t.unwrap()):t instanceof Nne?Q8(t._def.innerType):[];class kxe 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 kxe({typeName:Ea.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...EA(o)})}}function Fxe(t,e){const n=mQ(t),o=mQ(e);if(t===e)return{valid:!0,data:t};if(n===Sr.object&&o===Sr.object){const i=wl.objectKeys(e),r=wl.objectKeys(t).filter(a=>i.indexOf(a)!==-1),s={...t,...e};for(const a of r){const A=Fxe(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=Fxe(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 wne extends Bc{_parse(e){const{status:n,ctx:o}=this._processInputParams(e),i=(r,s)=>{if(Act(r)||Act(s))return Zs;const a=Fxe(r.value,s.value);return a.valid?((cct(r)||cct(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}))}}wne.create=(t,e,n)=>new wne({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 w9(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 w9(o,a,o.path,a)),value:s._parse(new w9(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 pct 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 w9(o,a,o.path,[c,"key"])),value:r._parse(new w9(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}}}}pct.create=(t,e,n)=>new pct({valueType:e,keyType:t,typeName:Ea.ZodMap,...EA(n)});class DV 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 w9(o,A,o.path,c)));return o.common.async?Promise.all(a).then(A=>s(A)):s(a)}min(e,n){return new DV({...this._def,minSize:{value:e,message:is.toString(n)}})}max(e,n){return new DV({...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)}}DV.create=(t,e)=>new DV({valueType:t,minSize:null,maxSize:null,typeName:Ea.ZodSet,...EA(e)});class NV 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 Nxe({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Dxe(),wV].filter(c=>!!c),issueData:{code:lo.invalid_arguments,argumentsError:A}})}function i(a,A){return Nxe({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Dxe(),wV].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 RV){const a=this;return rx(async function(...A){const c=new f5([]),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 f5([o(A,c.error)]);const l=Reflect.apply(s,this,c.data),g=a._def.returns.safeParse(l,r);if(!g.success)throw new f5([i(l,g.error)]);return g.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new NV({...this._def,args:v8.create(e).rest(jk.create())})}returns(e){return new NV({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,o){return new NV({args:e||v8.create([]).rest(jk.create()),returns:n||jk.create(),typeName:Ea.ZodFunction,...EA(o)})}}class Lxe 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})}}Lxe.create=(t,e)=>new Lxe({getter:t,typeName:Ea.ZodLazy,...EA(e)});class Mne 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}}Mne.create=(t,e)=>new Mne({value:t,typeName:Ea.ZodLiteral,...EA(e)});function mct(t,e){return new VM({values:t,typeName:Ea.ZodEnum,...EA(e)})}class VM extends Bc{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),o=this._def.values;return rr(n,{expected:wl.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 VM.create(e,{...this._def,...n})}exclude(e,n=this._def){return VM.create(this.options.filter(o=>!e.includes(o)),{...this._def,...n})}}VM.create=mct;class Hxe extends Bc{_parse(e){const n=wl.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(e);if(o.parsedType!==Sr.string&&o.parsedType!==Sr.number){const i=wl.objectValues(n);return rr(o,{expected:wl.joinValues(i),received:o.parsedType,code:lo.invalid_type}),Zs}if(this._cache||(this._cache=new Set(wl.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const i=wl.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}}Hxe.create=(t,e)=>new Hxe({values:t,typeName:Ea.ZodNativeEnum,...EA(e)});class RV 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})))}}RV.create=(t,e)=>new RV({type:t,typeName:Ea.ZodPromise,...EA(e)});class fQ 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"?PV(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"?PV(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(!Jk(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=>Jk(s)?Promise.resolve(i.transform(s.value,r)).then(a=>({status:n.value,value:a})):Zs);wl.assertNever(i)}}fQ.create=(t,e,n)=>new fQ({schema:t,typeName:Ea.ZodEffects,effect:e,...EA(n)}),fQ.createWithPreprocess=(t,e,n)=>new fQ({schema:e,effect:{type:"preprocess",transform:t},typeName:Ea.ZodEffects,...EA(n)});class w8 extends Bc{_parse(e){return this._getType(e)===Sr.undefined?rx(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}w8.create=(t,e)=>new w8({innerType:t,typeName:Ea.ZodOptional,...EA(e)});class zM extends Bc{_parse(e){return this._getType(e)===Sr.null?rx(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}zM.create=(t,e)=>new zM({innerType:t,typeName:Ea.ZodNullable,...EA(e)});class Dne 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}}Dne.create=(t,e)=>new Dne({innerType:t,typeName:Ea.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...EA(e)});class Nne 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 f5(o.common.issues)},input:o.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new f5(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}}Nne.create=(t,e)=>new Nne({innerType:t,typeName:Ea.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...EA(e)});class _ct 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}}}_ct.create=t=>new _ct({typeName:Ea.ZodNaN,...EA(t)});class fct 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 Oxe 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(),PV(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 Oxe({in:e,out:n,typeName:Ea.ZodPipeline})}}class Rne extends Bc{_parse(e){const n=this._def.innerType._parse(e),o=i=>(Jk(i)&&(i.value=Object.freeze(i.value)),i);return bne(n)?n.then(i=>o(i)):o(n)}unwrap(){return this._def.innerType}}Rne.create=(t,e)=>new Rne({innerType:t,typeName:Ea.ZodReadonly,...EA(e)});function Ict(t,e){const n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function P0(t,e={},n){return t?MV.create().superRefine((o,i)=>{const r=t(o);if(r instanceof Promise)return r.then(s=>{if(!s){const a=Ict(e,o),A=a.fatal??n??!0;i.addIssue({code:"custom",...a,fatal:A})}});if(!r){const s=Ict(e,o),a=s.fatal??n??!0;i.addIssue({code:"custom",...s,fatal:a})}}):MV.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=UM.create;KM.create;const je=Sne.create;Wk.create;const Cct=Qne.create,ud=MV.create,Gxe=jk.create;_Q.create;const dn=M9.create,Pt=Km.create,xo=vne.create,_y=kxe.create;wne.create;const IQ=v8.create,bc=Pne.create,CQ=NV.create,qe=Mne.create,Kn=VM.create,yQ=RV.create;w8.create,zM.create;const yct=fQ.createWithPreprocess,I5={string:(t=>P9.create({...t,coerce:!0})),number:(t=>UM.create({...t,coerce:!0})),boolean:(t=>Sne.create({...t,coerce:!0})),bigint:(t=>KM.create({...t,coerce:!0})),date:(t=>Wk.create({...t,coerce:!0}))},X6n=Zs;var P8=Z().or(_t()).transform(t=>X1(t,"Ω").value),JM=Z().or(_t()).transform(t=>X1(t,"F").value).transform(t=>Number.parseFloat(t.toPrecision(12))),Tne=Z().or(_t()).transform(t=>X1(t,"H").value),O_=Z().or(_t()).transform(t=>X1(t,"V").value),ce=Z().or(_t()).transform(t=>X1(t).value),fy=Z().or(_t()).transform(t=>X1(t,"Hz").value),lt=ce,T3=Z().or(_t()).transform(t=>X1(t,"A").value),Xk=Z().or(_t()).transform(t=>X1(t).value),$6n=Xk,Pl=Xk,xct=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)),Ect=_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=Pt({x:lt,y:lt}),Z6n=Ti,D9=Pt({x:lt,y:lt,z:lt}),e8n=D9,kne=Pt({width:_t(),height:_t()}),t8n=t=>{const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";return Array.from({length:t},()=>e[Math.floor(Math.random()*e.length)]).join("")},so=t=>Z().optional().default(()=>`${t}_${t8n(10)}`),M8=Kn(["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"]),n8n=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"]),Fne=Pt({project_relative_path:Z(),url:Z(),mimetype:Z()}),Lne=Ti.extend({rotation:oA.optional()}),Yxe=Pt({size:Ti.optional(),thickness:lt.optional()}),Bct=Pt({font:Yxe.optional()}),TV=Pt({value:Z(),at:Lne.optional(),layer:Z().optional(),uuid:Z().optional(),hide:je().optional(),effects:Bct.optional()}),bct=Pt({Reference:TV.optional(),Value:TV.optional(),Datasheet:TV.optional(),Description:TV.optional()}),Sct=Pt({through_hole:je().optional(),smd:je().optional(),exclude_from_pos_files:je().optional(),exclude_from_bom:je().optional()}),Qct=Pt({name:Z(),type:Z(),shape:Z().optional(),at:Lne.optional(),size:Ti.optional(),drill:lt.optional(),layers:dn(Z()).optional(),removeUnusedLayers:je().optional(),uuid:Z().optional()}),vct=Pt({path:Z(),offset:D9.optional(),scale:D9.optional(),rotate:D9.optional()}),wct=Pt({footprintName:Z().optional(),version:xo([_t(),Z()]).optional(),generator:Z().optional(),generatorVersion:xo([_t(),Z()]).optional(),layer:Z().optional(),properties:bct.optional(),attributes:Sct.optional(),pads:dn(Qct).optional(),embeddedFonts:je().optional(),model:vct.optional()}),Pct=Pt({hide:je().optional()}),Mct=Pt({offset:lt.optional(),hide:je().optional()}),Dct=Pt({font:Yxe.optional(),justify:xo([Z(),dn(Z())]).optional(),hide:je().optional()}),xQ=Pt({value:Z(),id:xo([_t(),Z()]).optional(),at:Lne.optional(),effects:Dct.optional()}),Nct=Pt({Reference:xQ.optional(),Value:xQ.optional(),Footprint:xQ.optional(),Datasheet:xQ.optional(),Description:xQ.optional(),ki_keywords:xQ.optional(),ki_fp_filters:xQ.optional()}),Rct=Pt({symbolName:Z().optional(),extends:Z().optional(),pinNumbers:Pct.optional(),pinNames:Mct.optional(),excludeFromSim:je().optional(),inBom:je().optional(),onBoard:je().optional(),properties:Nct.optional(),embeddedFonts:je().optional()}),Ml=Pt({error_type:Z(),message:Z(),is_fatal:je().optional()}),WM=Kn(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),Bg=Pt({type:qe("source_component"),ftype:Z().optional(),source_component_id:Z(),name:Z(),manufacturer_part_number:Z().optional(),supplier_part_numbers:bc(WM,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()}),Uxe=Bg.extend({ftype:qe("simple_capacitor"),capacitance:JM,max_voltage_rating:O_.optional(),display_capacitance:Z().optional(),max_decoupling_trace_length:lt.optional()}),Kxe=Bg.extend({ftype:qe("simple_resistor"),resistance:P8,display_resistance:Z().optional()}),Hne=Bg.extend({ftype:qe("simple_diode")}),Tct=Bg.extend({ftype:qe("simple_fiducial")}),Vxe=Hne.extend({ftype:qe("simple_led"),color:Z().optional(),wavelength:Z().optional()}),kct=Bg.extend({ftype:qe("simple_ground")}),zxe=Bg.extend({ftype:qe("simple_chip")}),Jxe=Bg.extend({ftype:qe("simple_power_source"),voltage:O_}),Fct=Bg.extend({ftype:qe("simple_current_source"),current:T3,frequency:fy.optional(),peak_to_peak_current:T3.optional(),wave_shape:Kn(["sine","square","triangle","sawtooth","dc"]).optional().default("dc"),phase:_t().optional(),duty_cycle:_t().min(0).max(1).optional()}),Lct=Bg.extend({ftype:qe("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")}),Hct=Bg.extend({ftype:qe("simple_ammeter")}),Oct=Pt({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()}),Wxe=Bg.extend({ftype:qe("simple_battery"),capacity:Ect}),jxe=Bg.extend({ftype:qe("simple_inductor"),inductance:Tne,display_inductance:Z().optional(),max_current_rating:_t().optional()}),qxe=Bg.extend({ftype:qe("simple_push_button")}),Xxe=Bg.extend({ftype:qe("simple_potentiometer"),max_resistance:P8,display_max_resistance:Z().optional()}),Gct=Bg.extend({ftype:qe("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()}),$xe=Bg.extend({ftype:qe("simple_pin_header"),pin_count:_t(),gender:Kn(["male","female"]).optional().default("male")}),Yct=["usb_c","m2","jst_sh","jst_gh","jst_zh","jst_ph","jst_xh","jst_vh"],Uct=Bg.extend({ftype:qe("simple_connector"),standard:Kn(Yct).optional(),pin_count:_t().int().positive().optional()}),Zxe=Bg.extend({ftype:qe("simple_pinout")}),e3e=Bg.extend({ftype:qe("simple_resonator"),load_capacitance:JM,equivalent_series_resistance:P8.optional(),frequency:fy}),t3e=Bg.extend({ftype:qe("simple_transistor"),transistor_type:Kn(["npn","pnp"])}),n3e=Bg.extend({ftype:qe("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()}),o3e=Bg.extend({ftype:qe("simple_mosfet"),channel_type:Kn(["n","p"]),mosfet_mode:Kn(["enhancement","depletion"])}),i3e=Bg.extend({ftype:qe("simple_op_amp")}),r3e=Bg.extend({ftype:qe("simple_switch")}),s3e=Pt({type:qe("source_project_metadata"),name:Z().optional(),software_used_string:Z().optional(),project_url:Z().optional(),source_filesystem_md5_hash:Z().optional(),created_at:xct.optional()}),Kct=Ml.extend({type:qe("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:qe("source_missing_property_error").default("source_missing_property_error")}).describe("The source code is missing a property"),Vct=Ml.extend({type:qe("source_failed_to_create_component_error"),source_failed_to_create_component_error_id:so("source_failed_to_create_component_error"),error_type:qe("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:Pt({x:_t().optional(),y:_t().optional()}).optional(),schematic_center:Pt({x:_t().optional(),y:_t().optional()}).optional()}).describe("Error emitted when a component fails to be constructed"),a3e=Ml.extend({type:qe("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:Gxe().optional(),expected_format:Z().optional(),subcircuit_id:Z().optional(),error_type:qe("source_invalid_component_property_error").default("source_invalid_component_property_error")}).describe("The source component property is invalid"),A3e=Ml.extend({type:qe("source_trace_not_connected_error"),source_trace_not_connected_error_id:so("source_trace_not_connected_error"),error_type:qe("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"),zct=Pt({type:qe("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:qe("source_property_ignored_warning").default("source_property_ignored_warning"),message:Z()}).describe("The source property was ignored"),c3e=Pt({type:qe("source_pin_missing_trace_warning"),source_pin_missing_trace_warning_id:so("source_pin_missing_trace_warning"),warning_type:qe("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"),l3e=Pt({type:qe("source_missing_manufacturer_part_number_warning"),source_missing_manufacturer_part_number_warning_id:so("source_missing_manufacturer_part_number_warning"),warning_type:qe("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"),g3e=Pt({type:qe("source_refdes_convention_warning"),source_refdes_convention_warning_id:so("source_refdes_convention_warning"),warning_type:qe("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"),Jct=Bg.extend({ftype:qe("simple_voltage_probe")}),Wct=Bg.extend({ftype:qe("interconnect")}),u3e=Ml.extend({type:qe("source_i2c_misconfigured_error"),source_i2c_misconfigured_error_id:so("source_i2c_misconfigured_error"),error_type:qe("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"),kV=Ml.extend({type:qe("source_component_misconfigured_error"),source_component_misconfigured_error_id:so("source_component_misconfigured_error"),error_type:qe("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"),jct=Bg.extend({ftype:qe("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:Pl.optional(),rise_time:Pl.optional(),fall_time:Pl.optional(),pulse_width:Pl.optional(),period:Pl.optional()}),qct=xo([Kxe,Uxe,Hne,Tct,Vxe,kct,zxe,Jxe,Fct,Hct,Wxe,jxe,qxe,Xxe,Gct,$xe,Uct,Zxe,e3e,r3e,t3e,n3e,o3e,i3e,Lct,Jct,Wct,jct,s3e,Kct,a3e,Vct,A3e,zct,c3e,l3e,g3e,u3e,kV]),Xct=Pt({type:qe("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(Oct),$ct=Pt({type:qe("source_component_internal_connection"),source_component_internal_connection_id:Z(),source_component_id:Z(),source_port_ids:dn(Z()),subcircuit_id:Z().optional()}),Zct=Pt({type:qe("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()}),elt=Pt({type:qe("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()}),tlt=Pt({type:qe("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()}),nlt=Pt({type:qe("source_board"),source_board_id:Z(),source_group_id:Z(),title:Z().optional()}).describe("Defines a board in the source domain"),olt=Ml.extend({type:qe("source_ambiguous_port_reference"),source_ambiguous_port_reference_id:so("source_ambiguous_port_reference"),error_type:qe("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"),ilt=Pt({type:qe("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"),$k=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6","inner7","inner8"],d3e=Kn($k),Pr=d3e.or(Pt({name:d3e})).transform(t=>typeof t=="string"?t:t.name),Vm=Kn(["top","bottom"]),rlt=Pt({type:qe("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"),slt=Pt({type:qe("source_unnamed_trace_warning"),source_unnamed_trace_warning_id:so("source_unnamed_trace_warning"),warning_type:qe("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"),alt=Pt({type:qe("source_no_power_pin_defined_warning"),source_no_power_pin_defined_warning_id:so("source_no_power_pin_defined_warning"),warning_type:qe("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"),Alt=Pt({type:qe("source_no_ground_pin_defined_warning"),source_no_ground_pin_defined_warning_id:so("source_no_ground_pin_defined_warning"),warning_type:qe("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"),clt=Pt({type:qe("source_component_pins_underspecified_warning"),source_component_pins_underspecified_warning_id:so("source_component_pins_underspecified_warning"),warning_type:qe("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"),llt=Ml.extend({type:qe("source_pin_must_be_connected_error"),source_pin_must_be_connected_error_id:so("source_pin_must_be_connected_error"),error_type:qe("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"),glt=Ml.extend({type:qe("unknown_error_finding_part"),unknown_error_finding_part_id:so("unknown_error_finding_part"),error_type:qe("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"),FV=Pt({type:qe("source_part_not_found_warning"),source_part_not_found_warning_id:so("source_part_not_found_warning"),warning_type:qe("source_part_not_found_warning").default("source_part_not_found_warning"),message:Z(),source_component_id:Z().optional(),subcircuit_id:Z().optional(),supplier_name:WM.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"),ult=Pt({type:qe("source_confusing_net_name_warning"),source_confusing_net_name_warning_id:so("source_confusing_net_name_warning"),warning_type:qe("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"),dlt=Pt({type:qe("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"),hlt=Pt({type:qe("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()}),plt=bc(Pt({left_margin:ce.optional(),right_margin:ce.optional(),top_margin:ce.optional(),bottom_margin:ce.optional()})),mlt=Pt({left_size:_t(),right_size:_t(),top_size:_t().optional(),bottom_size:_t().optional()}),_lt=Pt({left_side:Pt({pins:dn(_t()),direction:Kn(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:Pt({pins:dn(_t()),direction:Kn(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:Pt({pins:dn(_t()),direction:Kn(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:Pt({pins:dn(_t()),direction:Kn(["left-to-right","right-to-left"]).optional()}).optional()}),flt=xo([mlt,_lt]),Ilt=Pt({type:qe("schematic_component"),size:kne,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:plt.optional(),box_width:ce.optional(),symbol_name:Z().optional(),port_arrangement:flt.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)}),o8n=Pt({kicad_symbol:Rct.optional()}).catchall(Gxe()),Clt=Pt({type:qe("schematic_symbol"),schematic_symbol_id:Z(),name:Z().optional(),metadata:o8n.optional()}).describe("Defines a named schematic symbol that can be referenced by components."),ylt=Pt({type:qe("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"),xlt=Pt({type:qe("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"),Elt=Pt({type:qe("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"),Blt=Pt({type:qe("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"),blt=Pt({type:qe("schematic_trace"),schematic_trace_id:Z(),schematic_sheet_id:Z().optional(),source_trace_id:Z().optional(),junctions:dn(Pt({x:_t(),y:_t()})),edges:dn(Pt({from:Pt({x:_t(),y:_t()}),to:Pt({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()}),i8n=Kn(["center","left","right","top","bottom"]),h3e=Pt({text:Z(),is_overlined:je().optional()}),Slt=Pt({type:qe("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(h3e).min(1).optional(),display_superscript:Z().optional(),font_size:_t().default(.18),position:Pt({x:lt,y:lt}),rotation:_t().default(0),anchor:xo([i8n.describe("legacy"),M8]).default("center"),color:Z().default("#000000"),subcircuit_id:Z().optional()}),Qlt=Pt({type:qe("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(h3e).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"),vlt=Pt({type:qe("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()}),wlt=Ml.extend({type:qe("schematic_error"),schematic_error_id:Z(),error_type:qe("schematic_port_not_found").default("schematic_port_not_found"),subcircuit_id:Z().optional()}).describe("Defines a schematic error on the schematic"),Plt=Ml.extend({type:qe("schematic_layout_error"),schematic_layout_error_id:so("schematic_layout_error"),error_type:qe("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"),One=Pt({type:qe("schematic_debug_object"),label:Z().optional(),subcircuit_id:Z().optional()}),Mlt=One.extend({shape:qe("rect"),center:Ti,size:kne}),Dlt=One.extend({shape:qe("line"),start:Ti,end:Ti}),Nlt=One.extend({shape:qe("point"),center:Ti}),Rlt=_y("shape",[Mlt,Dlt,Nlt]),Tlt=Pt({type:qe("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"),p3e=Pt({type:qe("schematic_manual_edit_conflict_warning"),schematic_manual_edit_conflict_warning_id:so("schematic_manual_edit_conflict_warning"),warning_type:qe("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"),klt=Pt({type:qe("schematic_component_overlap_warning"),schematic_component_overlap_warning_id:so("schematic_component_overlap_warning"),warning_type:qe("schematic_component_overlap_warning").default("schematic_component_overlap_warning"),message:Z(),schematic_component_ids:IQ([Z(),Z()]),schematic_sheet_id:Z().optional()}).describe("Warning emitted when the rendered bounds of two schematic components overlap"),Flt=Pt({type:qe("schematic_component_styling_warning"),schematic_component_styling_warning_id:so("schematic_component_styling_warning"),warning_type:qe("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"),Llt=Pt({type:qe("schematic_element_outside_sheet_warning"),schematic_element_outside_sheet_warning_id:so("schematic_element_outside_sheet_warning"),warning_type:qe("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"),Hlt=lt.pipe(_t().positive().finite()),Olt=Pt({type:qe("schematic_graphic"),schematic_graphic_id:so("schematic_graphic"),schematic_sheet_id:Z().optional(),asset:Fne.optional(),svg_content:Z().optional(),width:Hlt.optional(),height:Hlt.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"})}),Glt=Pt({type:qe("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"),Ylt=Pt({type:qe("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"),Ult=Pt({type:qe("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"),m3e=Kn(["a4","ansi_b"]),Klt=Pt({type:qe("schematic_sheet"),schematic_sheet_id:so("schematic_sheet"),name:Z().optional(),sheet_index:_t().optional(),sheet_size:m3e.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"),Vlt=Pt({type:qe("schematic_missing_sheet_warning"),schematic_missing_sheet_warning_id:so("schematic_missing_sheet_warning"),warning_type:qe("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."),zlt=Pt({x:lt,y:lt,bulge:_t().optional()}),_3e=Pt({vertices:dn(zlt)}),f3e=Pt({outer_ring:_3e,inner_rings:dn(_3e).default([])}),I3e={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"},r8n={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}},Jlt=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=>I3e[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").'),LV=Kn(["leftside_top","leftside_bottom","rightside_top","rightside_bottom","topside_left","topside_right","bottomside_left","bottomside_right"]),s8n=[["leftside_top","bottomside_left","rightside_bottom","topside_right"],["leftside_bottom","bottomside_right","rightside_top","topside_left"]],a8n=(t,e)=>{for(const n of s8n){const o=n.indexOf(t),i=n.indexOf(e);if(o!==-1&&i!==-1)return(i-o+n.length)%n.length*90}return null},Wlt=Pt({x:lt,y:lt,via:je().optional(),via_to_layer:Pr.optional()}),A8n=dn(Wlt),N9=Pt({x:lt,y:lt,via:je().optional(),to_layer:Pr.optional(),trace_width:lt.optional()}),jlt=Pt({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()}),qlt=Pt({type:qe("pcb_component"),pcb_component_id:so("pcb_component"),source_component_id:Z(),center:Ti,layer:Pr,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:Jlt.optional(),pin1_location:LV.optional().describe("Location of pin 1 on the unrotated, top-view component footprint"),supplier_pin1_location_map:bc(WM,LV).optional().describe("Pin 1 location for each supplier's unrotated, top-view footprint"),metadata:Pt({kicad_footprint:wct.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"),Gne=Pt({type:qe("pcb_debug_object"),pcb_debug_object_id:so("pcb_debug_object"),label:Z().optional(),subcircuit_id:Z().optional()}),Xlt=Gne.extend({shape:qe("rect"),center:Ti,size:kne}),$lt=Gne.extend({shape:qe("line"),start:Ti,end:Ti}),Zlt=Gne.extend({shape:qe("point"),center:Ti}),e0t=_y("shape",[Xlt,$lt,Zlt]),t0t=Pt({type:qe("pcb_hole"),pcb_hole_id:so("pcb_hole"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),pcb_component_id:Z().optional(),hole_shape:qe("circle"),hole_diameter:_t(),x:lt,y:lt,is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional()}),c8n=t0t.describe("Defines a circular hole on the PCB"),n0t=Pt({type:qe("pcb_hole"),pcb_hole_id:so("pcb_hole"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),pcb_component_id:Z().optional(),hole_shape:qe("rect"),hole_width:_t(),hole_height:_t(),x:lt,y:lt,is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional()}),l8n=n0t.describe("Defines a rectangular (square-capable) hole on the PCB. Use equal width/height for square."),o0t=Pt({type:qe("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()}),g8n=o0t.describe("Defines a circular or square hole on the PCB"),i0t=Pt({type:qe("pcb_hole"),pcb_hole_id:so("pcb_hole"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),pcb_component_id:Z().optional(),hole_shape:qe("oval"),hole_width:_t(),hole_height:_t(),x:lt,y:lt,is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional()}),u8n=i0t.describe("Defines an oval hole on the PCB"),r0t=Pt({type:qe("pcb_hole"),pcb_hole_id:so("pcb_hole"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),pcb_component_id:Z().optional(),hole_shape:qe("pill"),hole_width:_t(),hole_height:_t(),x:lt,y:lt,is_covered_with_solder_mask:je().optional(),soldermask_margin:_t().optional()}),d8n=r0t.describe("Defines a pill-shaped hole on the PCB"),s0t=Pt({type:qe("pcb_hole"),pcb_hole_id:so("pcb_hole"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),pcb_component_id:Z().optional(),hole_shape:qe("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()}),h8n=s0t.describe("Defines a rotated pill-shaped hole on the PCB"),a0t=o0t.or(i0t).or(r0t).or(s0t).or(t0t).or(n0t),p8n=Pt({type:qe("pcb_plated_hole"),shape:qe("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(Pr),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()}),m8n=Pt({type:qe("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(Pr),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()}),_8n=Pt({type:qe("pcb_plated_hole"),shape:qe("circular_hole_with_rect_pad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),hole_shape:qe("circle"),pad_shape:qe("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(Pr),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()}),f8n=Pt({type:qe("pcb_plated_hole"),shape:qe("pill_hole_with_rect_pad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),hole_shape:qe("pill"),pad_shape:qe("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(Pr),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()}),I8n=Pt({type:qe("pcb_plated_hole"),shape:qe("rotated_pill_hole_with_rect_pad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),hole_shape:qe("rotated_pill"),pad_shape:qe("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(Pr),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=Pt({type:qe("pcb_plated_hole"),shape:qe("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(Pt({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(Pr),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()}),A0t=xo([p8n,m8n,_8n,f8n,I8n,C8n]),c0t=Pt({type:qe("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(Pr),is_board_pinout:je().optional()}).describe("Defines a port on the PCB"),y8n=Pt({type:qe("pcb_smtpad"),shape:qe("circle"),pcb_smtpad_id:so("pcb_smtpad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),x:lt,y:lt,radius:_t(),layer:Pr,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()}),x8n=Pt({type:qe("pcb_smtpad"),shape:qe("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:Pr,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()}),E8n=Pt({type:qe("pcb_smtpad"),shape:qe("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:Pr,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()}),l0t=Pt({type:qe("pcb_smtpad"),shape:qe("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:Pr,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()}),B8n=Pt({type:qe("pcb_smtpad"),shape:qe("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:Pr,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()}),b8n=Pt({type:qe("pcb_smtpad"),shape:qe("polygon"),pcb_smtpad_id:so("pcb_smtpad"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),points:dn(Ti),layer:Pr,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()}),g0t=_y("shape",[y8n,x8n,E8n,B8n,l0t,b8n]).describe("Defines an SMT pad on the PCB"),S8n=Pt({type:qe("pcb_solder_paste"),shape:qe("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:Pr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),Q8n=Pt({type:qe("pcb_solder_paste"),shape:qe("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:Pr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),v8n=Pt({type:qe("pcb_solder_paste"),shape:qe("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:Pr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),w8n=Pt({type:qe("pcb_solder_paste"),shape:qe("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:Pr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),P8n=Pt({type:qe("pcb_solder_paste"),shape:qe("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:Pr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),M8n=Pt({type:qe("pcb_solder_paste"),shape:qe("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:Pr,pcb_component_id:Z().optional(),pcb_smtpad_id:Z().optional()}),u0t=xo([S8n,Q8n,v8n,w8n,P8n,M8n]).describe("Defines solderpaste on the PCB"),d0t=Pt({type:qe("pcb_text"),pcb_text_id:so("pcb_text"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),text:Z(),center:Ti,layer:Pr,width:ce,height:ce,lines:_t(),align:Kn(["bottom-left"])}).describe("Defines text on the PCB"),h0t=Pt({route_type:qe("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:Pr}),p0t=Pt({route_type:qe("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:Pr,to_layer:Pr}),m0t=Pt({route_type:qe("through_pad"),start:Ti,end:Ti,width:lt,start_layer:Pr,end_layer:Pr,pcb_smtpad_id:Z().optional(),pcb_plated_hole_id:Z().optional()}),C3e=xo([h0t,p0t,m0t]),_0t=Pt({type:qe("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(C3e)}).describe("Defines a trace on the PCB"),f0t=Pt({type:qe("pcb_trace_warning"),pcb_trace_warning_id:so("pcb_trace_warning"),warning_type:qe("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"),I0t=Pt({type:qe("pcb_trace_too_long_warning"),pcb_trace_too_long_warning_id:so("pcb_trace_too_long_warning"),warning_type:qe("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"),C0t=Pt({type:qe("pcb_trace_too_many_vias_warning"),pcb_trace_too_many_vias_warning_id:so("pcb_trace_too_many_vias_warning"),warning_type:qe("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"),y0t=Ml.extend({type:qe("pcb_trace_error"),pcb_trace_error_id:so("pcb_trace_error"),error_type:qe("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"),x0t=Ml.extend({type:qe("pcb_trace_missing_error"),pcb_trace_missing_error_id:so("pcb_trace_missing_error"),error_type:qe("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"),E0t=Ml.extend({type:qe("pcb_port_not_matched_error"),pcb_error_id:so("pcb_error"),error_type:qe("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"),B0t=Ml.extend({type:qe("pcb_port_not_connected_error"),pcb_port_not_connected_error_id:so("pcb_port_not_connected_error"),error_type:qe("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"),b0t=Pt({type:qe("pcb_net"),pcb_net_id:so("pcb_net"),source_net_id:Z().optional(),highlight_color:Z().optional()}).describe("Defines a net on the PCB"),Yne=Pt({type:qe("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:Pr.optional(),to_layer:Pr.optional(),layers:dn(Pr),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"),S0t=Pt({type:qe("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(jlt).describe("Defines the board outline of the PCB"),Q0t=Pt({type:qe("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"),v0t=Ml.extend({type:qe("pcb_placement_error"),pcb_placement_error_id:so("pcb_placement_error"),error_type:qe("pcb_placement_error").default("pcb_placement_error"),subcircuit_id:Z().optional()}).describe("Defines a placement error on the PCB"),w0t=Ml.extend({type:qe("pcb_packing_error"),pcb_packing_error_id:so("pcb_packing_error"),error_type:qe("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"),P0t=Ml.extend({type:qe("pcb_panelization_placement_error"),pcb_panelization_placement_error_id:so("pcb_panelization_placement_error"),error_type:qe("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"),M0t=Pt({type:qe("pcb_trace_hint"),pcb_trace_hint_id:so("pcb_trace_hint"),pcb_port_id:Z(),pcb_component_id:Z(),route:dn(N9),subcircuit_id:Z().optional()}).describe("A hint that can be used during generation of a PCB trace"),D0t=Pt({type:qe("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"),N0t=Pt({type:qe("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"),R0t=Pt({type:qe("pcb_silkscreen_text"),pcb_silkscreen_text_id:so("pcb_silkscreen_text"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),font:qe("tscircuit2024").default("tscircuit2024"),font_size:lt.default("0.2mm"),pcb_component_id:Z(),text:Z(),is_knockout:je().default(!1).optional(),knockout_padding:Pt({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:Pr,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"),T0t=Pt({type:qe("pcb_copper_text"),pcb_copper_text_id:so("pcb_copper_text"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),font:qe("tscircuit2024").default("tscircuit2024"),font_size:lt.default("0.2mm"),pcb_component_id:Z(),text:Z(),is_knockout:je().default(!1).optional(),knockout_padding:Pt({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:Pr,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"),k0t=Pt({type:qe("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:Pr,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"),F0t=Pt({type:qe("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"),L0t=Pt({type:qe("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"),D8n=Pt({type:qe("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:Fne.optional()}),H0t=D8n.extend({shape:qe("brep"),brep_shape:f3e}).describe("Defines a BRep silkscreen graphic on the PCB"),O0t=_y("shape",[H0t]).describe("Defines a silkscreen graphic on the PCB"),G0t=Pt({type:qe("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:Pr,ccw_rotation:_t().optional()}).describe("Defines a silkscreen pill on the PCB"),y3e=Pt({type:qe("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:so("pcb_fabrication_note_text"),subcircuit_id:Z().optional(),pcb_group_id:Z().optional(),font:qe("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"),x3e=Pt({type:qe("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:so("pcb_fabrication_note_path"),pcb_component_id:Z(),subcircuit_id:Z().optional(),layer:Pr,route:dn(Ti),stroke_width:ce,color:Z().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),E3e=Pt({type:qe("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"),B3e=Pt({type:qe("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:Pt({x:_t(),y:_t()}).optional(),font:qe("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"),b3e=Pt({type:qe("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:qe("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"),S3e=Pt({type:qe("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"),Q3e=Pt({type:qe("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"),v3e=Pt({type:qe("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"),w3e=Pt({type:qe("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:Pt({x:_t(),y:_t()}).optional(),font:qe("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"),Y0t=Ml.extend({type:qe("pcb_footprint_overlap_error"),pcb_error_id:so("pcb_error"),error_type:qe("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"),U0t=Ml.extend({type:qe("pcb_courtyard_overlap_error"),pcb_error_id:so("pcb_error"),error_type:qe("pcb_courtyard_overlap_error").default("pcb_courtyard_overlap_error"),pcb_component_ids:IQ([Z(),Z()])}).describe("Error emitted when the courtyard (CrtYd) of one PCB component overlaps with the courtyard of another"),K0t=Pt({type:qe("pcb_keepout"),shape:qe("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()}),P3e=Pt({type:qe("pcb_keepout"),shape:qe("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(Pt({type:qe("pcb_keepout"),shape:qe("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(K0t),Une=Pt({type:qe("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()}),V0t=Une.extend({shape:qe("rect"),center:Ti,width:ce,height:ce,rotation:oA.optional(),corner_radius:ce.optional()}),z0t=Une.extend({shape:qe("circle"),center:Ti,radius:ce}),J0t=Une.extend({shape:qe("polygon"),points:dn(Ti)}),W0t=Une.extend({shape:qe("path"),route:dn(Ti),slot_width:ce,slot_length:ce.optional(),space_between_slots:ce.optional(),slot_corner_radius:ce.optional()}),M3e=_y("shape",[V0t,z0t,J0t,W0t]).describe("Defines a cutout on the PCB, removing board material."),j0t=Ml.extend({type:qe("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:qe("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),source_component_id:Z()}).describe("Defines a missing footprint error on the PCB"),HV=Ml.extend({type:qe("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:qe("external_footprint_load_error").default("external_footprint_load_error")}).describe("Defines an error when an external footprint fails to load"),D3e=Ml.extend({type:qe("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:qe("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"),q0t=Pt({type:qe("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:Pt({trace_clearance:ce}).optional(),autorouter_used_string:Z().optional()}).describe("Defines a group of components on the PCB"),X0t=Ml.extend({type:qe("pcb_autorouting_error"),pcb_error_id:so("pcb_autorouting_error"),error_type:qe("pcb_autorouting_error").default("pcb_autorouting_error"),subcircuit_id:Z().optional()}).describe("The autorouting has failed to route a portion of the board"),N3e=Pt({type:qe("pcb_manual_edit_conflict_warning"),pcb_manual_edit_conflict_warning_id:so("pcb_manual_edit_conflict_warning"),warning_type:qe("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"),$0t=Kn(["x-","x+","y+","y-"]),Z0t=Pt({type:qe("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:qe("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:$0t,recommended_facing_direction:$0t,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"),egt=Pt({type:qe("pcb_component_missing_courtyard_warning"),pcb_component_missing_courtyard_warning_id:so("pcb_component_missing_courtyard_warning"),warning_type:qe("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"),R3e=Pt({type:qe("supplier_footprint_mismatch_warning"),supplier_footprint_mismatch_warning_id:so("supplier_footprint_mismatch_warning"),warning_type:qe("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:WM.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"),tgt=Pt({type:qe("pcb_fabricator_extra_charge_warning"),pcb_fabricator_extra_charge_warning_id:so("pcb_fabricator_extra_charge_warning"),warning_type:qe("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."),ngt=Pt({type:qe("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:Pr.optional(),x:lt,y:lt}).describe("Defines a routing target within a pcb_group for a source_trace or source_net"),ogt=Pt({type:qe("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"),igt=Pt({type:qe("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:Pr,points:dn(Ti)}).describe("Defines a polygon region of a ground plane"),rgt=Pt({type:qe("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"),T3e=Pt({type:qe("pcb_copper_pour"),pcb_copper_pour_id:so("pcb_copper_pour"),pcb_group_id:Z().optional(),subcircuit_id:Z().optional(),layer:Pr,source_net_id:Z().optional(),covered_with_solder_mask:je().optional().default(!0)}),sgt=T3e.extend({shape:qe("rect"),center:Ti,width:ce,height:ce,rotation:oA.optional()}),agt=T3e.extend({shape:qe("brep"),brep_shape:f3e}),Agt=T3e.extend({shape:qe("polygon"),points:dn(Ti)}),k3e=_y("shape",[sgt,agt,Agt]).describe("Defines a copper pour on the PCB."),cgt=Ml.extend({type:qe("pcb_component_outside_board_error"),pcb_component_outside_board_error_id:so("pcb_component_outside_board_error"),error_type:qe("pcb_component_outside_board_error").default("pcb_component_outside_board_error"),pcb_component_id:Z(),pcb_board_id:Z(),component_center:Ti,component_bounds:Pt({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"),lgt=Ml.extend({type:qe("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:qe("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"),Kne=Ml.extend({type:qe("pcb_component_invalid_layer_error"),pcb_component_invalid_layer_error_id:so("pcb_component_invalid_layer_error"),error_type:qe("pcb_component_invalid_layer_error").default("pcb_component_invalid_layer_error"),pcb_component_id:Z().optional(),source_component_id:Z(),layer:Pr,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)"),ggt=Ml.extend({type:qe("pcb_via_clearance_error"),pcb_error_id:so("pcb_error"),error_type:qe("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:Pt({x:_t().optional(),y:_t().optional()}).optional(),subcircuit_id:Z().optional()}).describe("Error emitted when vias are closer than the allowed clearance"),ugt=Ml.extend({type:qe("pcb_via_trace_clearance_error"),pcb_via_trace_clearance_error_id:so("pcb_via_trace_clearance_error"),error_type:qe("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:Pt({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"),dgt=Ml.extend({type:qe("pcb_pad_pad_clearance_error"),pcb_pad_pad_clearance_error_id:so("pcb_pad_pad_clearance_error"),error_type:qe("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:Pt({x:_t().optional(),y:_t().optional()}).optional(),subcircuit_id:Z().optional()}).describe("Error emitted when pads are closer than the allowed clearance"),hgt=Ml.extend({type:qe("pcb_pad_trace_clearance_error"),pcb_pad_trace_clearance_error_id:so("pcb_pad_trace_clearance_error"),error_type:qe("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:Pt({x:_t().optional(),y:_t().optional()}).optional(),subcircuit_id:Z().optional()}).describe("Error emitted when a pad and trace are closer than allowed clearance"),F3e=Pt({type:qe("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"),L3e=Pt({type:qe("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"),H3e=Pt({type:qe("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"),O3e=Pt({type:qe("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"),G3e=Pt({type:qe("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"),N8n=["obj","stl","3mf","gltf","glb","step","wrl"],pgt=["x+","x-","y+","y-","z+","z-"],R8n={obj:"z+",stl:"z+","3mf":"z+",gltf:"y+",glb:"y+",step:"z+",wrl:"y+"},mgt=Pt({type:qe("cad_component"),cad_component_id:Z(),pcb_component_id:Z(),source_component_id:Z(),position:D9,rotation:D9.optional(),size:D9.optional(),layer:Pr.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:Fne.optional(),model_unit_to_mm_scale_factor:_t().optional(),model_board_normal_direction:Kn(pgt).optional().describe(`The direction in the model's coordinate space that is considered "up" or "coming out of the board surface"`),model_origin_position:D9.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"),Y3e=Kn(["sinewave","square","triangle","sawtooth"]),T8n=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%")),_gt=Pt({type:qe("simulation_voltage_source"),simulation_voltage_source_id:so("simulation_voltage_source"),is_dc_source:qe(!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"),fgt=Pt({type:qe("simulation_voltage_source"),simulation_voltage_source_id:so("simulation_voltage_source"),is_dc_source:qe(!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:Y3e.optional(),phase:oA.optional(),duty_cycle:T8n.optional(),pulse_delay:Pl.optional(),rise_time:Pl.optional(),fall_time:Pl.optional(),pulse_width:Pl.optional(),period:Pl.optional(),ac_magnitude:O_.optional(),ac_phase:oA.optional()}).describe("Defines an AC voltage source for simulation"),Igt=xo([_gt,fgt]).describe("Defines a voltage source for simulation"),k8n=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%")),Cgt=Pt({type:qe("simulation_current_source"),simulation_current_source_id:so("simulation_current_source"),is_dc_source:qe(!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:T3,ac_magnitude:T3.optional(),ac_phase:oA.optional()}).describe("Defines a DC current source for simulation"),ygt=Pt({type:qe("simulation_current_source"),simulation_current_source_id:so("simulation_current_source"),is_dc_source:qe(!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:T3.optional(),frequency:fy.optional(),peak_to_peak_current:T3.optional(),wave_shape:Y3e.optional(),phase:oA.optional(),duty_cycle:k8n.optional(),ac_magnitude:T3.optional(),ac_phase:oA.optional()}).describe("Defines an AC current source for simulation"),xgt=xo([Cgt,ygt]).describe("Defines a current source for simulation"),Vne=P0(t=>t==="V"||t==="A"),U3e=P0(t=>t==="Ω"||t==="F"||t==="H"||t==="V"||t==="A"),Egt=xo([qe("spice_dc_sweep"),qe("spice_dc_operating_point"),qe("spice_transient_analysis"),qe("spice_ac_analysis")]),Bgt=Pt({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"),bgt=Pt({type:qe("simulation_experiment"),simulation_experiment_id:so("simulation_experiment"),name:Z(),experiment_type:Egt,time_per_step:Xk.optional(),start_time_ms:Pl.optional(),end_time_ms:Pl.optional(),spice_options:Bgt.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:Vne.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=Pt({simulation_parameter_sweep_id:Z(),sweep_index:_t().int().nonnegative(),parameter_value:_t(),parameter_unit:U3e}),Sgt=Pt({type:qe("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:Xk,start_time_ms:Pl,end_time_ms:Pl,name:Z().optional(),color:Z().optional()}).describe("Stores voltage measurements over time for a simulation"),Qgt=Pt({type:qe("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:Xk,start_time_ms:Pl,end_time_ms:Pl,name:Z().optional(),color:Z().optional()}).describe("Stores current measurements over time for a simulation"),vgt=Pt({type:qe("simulation_switch"),simulation_switch_id:so("simulation_switch"),source_component_id:Z().optional(),closes_at:Pl.optional(),opens_at:Pl.optional(),starts_closed:je().optional(),switching_frequency:fy.optional()}).describe("Defines a switch for simulation timing control"),wgt=Pt({type:qe("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."})}),Pgt=Pt({type:qe("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."})}),Mgt=Ml.extend({type:qe("simulation_unknown_experiment_error"),simulation_unknown_experiment_error_id:so("simulation_unknown_experiment_error"),error_type:qe("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."),F8n=Kn(["resistance","capacitance","inductance","voltage","current"]),OV=Pt({type:qe("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:U3e}),Dgt=_y("parameter_type",[OV.extend({parameter_type:qe("resistance"),resistor_source_component_id:Z()}),OV.extend({parameter_type:qe("capacitance"),capacitor_source_component_id:Z()}),OV.extend({parameter_type:qe("inductance"),inductor_source_component_id:Z()}),OV.extend({parameter_type:qe("voltage"),source_net_id:Z()}),OV.extend({parameter_type:qe("current"),current_source_component_id:Z()})]).describe("Repeats a simulation experiment over component parameter values"),Ngt=Pt({type:qe("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()}),Rgt=Pt({type:qe("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()}),Tgt=Pt({type:qe("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:Vne,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"}),kgt=Pt({type:qe("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:Vne,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"}),K3e=Pt({re:_t(),im:_t()}),Fgt=Pt({type:qe("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(K3e),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"}),Lgt=Pt({type:qe("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(K3e),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"}),Hgt=Pt({type:qe("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"),Ogt=Pt({type:qe("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"),Ggt=t=>t!==void 0,Ygt=Pt({type:qe("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(Ggt).length,o=[t.simulation_transient_current_graph_id,t.simulation_current_probe_id].filter(Ggt).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."})}),V3e=xo([Zct,Xct,$ct,qct,tlt,elt,zxe,Uxe,Hne,Vxe,Kxe,Jxe,Wxe,jxe,$xe,Zxe,e3e,r3e,t3e,n3e,o3e,i3e,Xxe,qxe,ilt,rlt,nlt,s3e,a3e,A3e,c3e,slt,ult,l3e,g3e,alt,Alt,clt,llt,glt,FV,u3e,kV,olt,qlt,e0t,a0t,j0t,HV,D3e,N3e,Z0t,egt,R3e,tgt,A0t,P3e,c0t,b0t,d0t,_0t,f0t,I0t,C0t,Yne,g0t,u0t,S0t,Q0t,q0t,M0t,D0t,N0t,R0t,G0t,T0t,k0t,F0t,L0t,O0t,y0t,x0t,v0t,w0t,P0t,E0t,B0t,ggt,ugt,dgt,hgt,x3e,y3e,E3e,B3e,b3e,S3e,Q3e,v3e,w3e,X0t,Y0t,U0t,ngt,M3e,ogt,igt,rgt,k3e,cgt,lgt,Kne,F3e,L3e,H3e,O3e,G3e,dlt,Slt,ylt,xlt,Elt,Blt,Ilt,Clt,Qlt,blt,hlt,wlt,Plt,vlt,Rlt,Tlt,p3e,klt,Flt,Vlt,Llt,Olt,Glt,Klt,Ylt,Ult,mgt,Igt,xgt,bgt,Sgt,Qgt,Ngt,Rgt,Tgt,kgt,Fgt,Lgt,Dgt,vgt,wgt,Pgt,Ygt,Mgt,Hgt,Ogt]),O4=V3e;const R9=Object.freeze(Object.defineProperty({__proto__:null,all_layers:$k,any_circuit_element:V3e,any_soup_element:O4,any_source_component:qct,asset:Fne,base_circuit_json_error:Ml,battery_capacity:Ect,brep_shape:f3e,cadModelDefaultDirectionMap:R8n,cad_component:mgt,cad_model_axis_directions:pgt,cad_model_formats:N8n,capacitance:JM,circuit_json_footprint_load_error:D3e,current:T3,distance:lt,duration_ms:Xk,experiment_type:Egt,external_footprint_load_error:HV,frequency:fy,getRotationBetweenPcbPin1Locations:a8n,getZodPrefixedIdWithDefault:so,inductance:Tne,insertionDirectionToCanonical:I3e,insertionDirectionToVector:r8n,insertion_direction:Jlt,kicadAt:Lne,kicadEffects:Bct,kicadFont:Yxe,kicadFootprintAttributes:Sct,kicadFootprintMetadata:wct,kicadFootprintModel:vct,kicadFootprintPad:Qct,kicadFootprintProperties:bct,kicadProperty:TV,kicadSymbolEffects:Dct,kicadSymbolMetadata:Rct,kicadSymbolPinNames:Mct,kicadSymbolPinNumbers:Pct,kicadSymbolProperties:Nct,kicadSymbolProperty:xQ,layer_ref:Pr,layer_string:d3e,length:ce,manufacturing_drc_properties:jlt,ms:Pl,ninePointAnchor:M8,parseAndConvertSiUnit:X1,pcbRenderLayer:n8n,pcb_autorouting_error:X0t,pcb_board:S0t,pcb_breakout_point:ngt,pcb_component:qlt,pcb_component_invalid_layer_error:Kne,pcb_component_missing_courtyard_warning:egt,pcb_component_not_on_board_edge_error:lgt,pcb_component_outside_board_error:cgt,pcb_connector_not_in_accessible_orientation_warning:Z0t,pcb_copper_pour:k3e,pcb_copper_pour_brep:agt,pcb_copper_pour_polygon:Agt,pcb_copper_pour_rect:sgt,pcb_copper_text:T0t,pcb_courtyard_circle:O3e,pcb_courtyard_outline:L3e,pcb_courtyard_overlap_error:U0t,pcb_courtyard_pill:G3e,pcb_courtyard_polygon:H3e,pcb_courtyard_rect:F3e,pcb_cutout:M3e,pcb_cutout_circle:z0t,pcb_cutout_path:W0t,pcb_cutout_polygon:J0t,pcb_cutout_rect:V0t,pcb_debug_line:$lt,pcb_debug_object:e0t,pcb_debug_object_base:Gne,pcb_debug_point:Zlt,pcb_debug_rect:Xlt,pcb_fabrication_note_dimension:B3e,pcb_fabrication_note_path:x3e,pcb_fabrication_note_rect:E3e,pcb_fabrication_note_text:y3e,pcb_fabricator_extra_charge_warning:tgt,pcb_footprint_overlap_error:Y0t,pcb_ground_plane:ogt,pcb_ground_plane_region:igt,pcb_group:q0t,pcb_hole:a0t,pcb_hole_circle_or_square_shape:g8n,pcb_hole_circle_shape:c8n,pcb_hole_oval_shape:u8n,pcb_hole_pill_shape:d8n,pcb_hole_rect_shape:l8n,pcb_hole_rotated_pill_shape:h8n,pcb_keepout:P3e,pcb_keepout_outline:K0t,pcb_manual_edit_conflict_warning:N3e,pcb_missing_footprint_error:j0t,pcb_net:b0t,pcb_note_dimension:w3e,pcb_note_line:v3e,pcb_note_path:Q3e,pcb_note_rect:S3e,pcb_note_text:b3e,pcb_packing_error:w0t,pcb_pad_pad_clearance_error:dgt,pcb_pad_trace_clearance_error:hgt,pcb_panel:Q0t,pcb_panelization_placement_error:P0t,pcb_pin1_location:LV,pcb_placement_error:v0t,pcb_plated_hole:A0t,pcb_port:c0t,pcb_port_not_connected_error:B0t,pcb_port_not_matched_error:E0t,pcb_route_hint:Wlt,pcb_route_hints:A8n,pcb_silkscreen_circle:F0t,pcb_silkscreen_graphic:O0t,pcb_silkscreen_graphic_brep:H0t,pcb_silkscreen_line:D0t,pcb_silkscreen_oval:L0t,pcb_silkscreen_path:N0t,pcb_silkscreen_pill:G0t,pcb_silkscreen_rect:k0t,pcb_silkscreen_text:R0t,pcb_smtpad:g0t,pcb_smtpad_pill:l0t,pcb_solder_paste:u0t,pcb_text:d0t,pcb_thermal_spoke:rgt,pcb_trace:_0t,pcb_trace_error:y0t,pcb_trace_hint:M0t,pcb_trace_missing_error:x0t,pcb_trace_route_point:C3e,pcb_trace_route_point_through_pad:m0t,pcb_trace_route_point_via:p0t,pcb_trace_route_point_wire:h0t,pcb_trace_too_long_warning:I0t,pcb_trace_too_many_vias_warning:C0t,pcb_trace_warning:f0t,pcb_via:Yne,pcb_via_clearance_error:ggt,pcb_via_trace_clearance_error:ugt,point:Ti,point3:D9,point_with_bulge:zlt,port_arrangement:flt,position:Z6n,position3:e8n,resistance:P8,ring:_3e,rotation:oA,route_hint_point:N9,schematic_arc:Blt,schematic_box:dlt,schematic_circle:Elt,schematic_component:Ilt,schematic_component_overlap_warning:klt,schematic_component_port_arrangement_by_sides:_lt,schematic_component_port_arrangement_by_size:mlt,schematic_component_styling_warning:Flt,schematic_debug_line:Dlt,schematic_debug_object:Rlt,schematic_debug_object_base:One,schematic_debug_point:Nlt,schematic_debug_rect:Mlt,schematic_element_outside_sheet_warning:Llt,schematic_error:wlt,schematic_graphic:Olt,schematic_group:Glt,schematic_layout_error:Plt,schematic_line:ylt,schematic_manual_edit_conflict_warning:p3e,schematic_missing_sheet_warning:Vlt,schematic_net_label:vlt,schematic_path:hlt,schematic_pin_styles:plt,schematic_port:Qlt,schematic_rect:xlt,schematic_sheet:Klt,schematic_sheet_size:m3e,schematic_symbol:Clt,schematic_table:Ylt,schematic_table_cell:Ult,schematic_text:Slt,schematic_text_part:h3e,schematic_trace:blt,schematic_voltage_probe:Tlt,simulation_ac_current_source:ygt,simulation_ac_sweep_current_graph:Lgt,simulation_ac_sweep_voltage_graph:Fgt,simulation_ac_voltage_source:fgt,simulation_complex_sample:K3e,simulation_current_probe:Pgt,simulation_current_source:xgt,simulation_dc_current_source:Cgt,simulation_dc_operating_point_current:Rgt,simulation_dc_operating_point_voltage:Ngt,simulation_dc_sweep_current_graph:kgt,simulation_dc_sweep_unit:Vne,simulation_dc_sweep_voltage_graph:Tgt,simulation_dc_voltage_source:_gt,simulation_experiment:bgt,simulation_op_amp:Hgt,simulation_oscilloscope_trace:Ygt,simulation_parameter_sweep:Dgt,simulation_parameter_sweep_coordinate:D8,simulation_parameter_type:F8n,simulation_parameter_unit:U3e,simulation_spice_subcircuit:Ogt,simulation_switch:vgt,simulation_transient_current_graph:Qgt,simulation_transient_voltage_graph:Sgt,simulation_unknown_experiment_error:Mgt,simulation_voltage_probe:wgt,simulation_voltage_source:Igt,size:kne,source_ambiguous_port_reference:olt,source_board:nlt,source_component_base:Bg,source_component_internal_connection:$ct,source_component_misconfigured_error:kV,source_component_pins_underspecified_warning:clt,source_confusing_net_name_warning:ult,source_failed_to_create_component_error:Vct,source_group:elt,source_i2c_misconfigured_error:u3e,source_interconnect:Wct,source_invalid_component_property_error:a3e,source_manually_placed_via:rlt,source_missing_manufacturer_part_number_warning:l3e,source_missing_property_error:Kct,source_net:tlt,source_no_ground_pin_defined_warning:Alt,source_no_power_pin_defined_warning:alt,source_part_not_found_warning:FV,source_pcb_ground_plane:ilt,source_pin_attributes:Oct,source_pin_missing_trace_warning:c3e,source_pin_must_be_connected_error:llt,source_port:Xct,source_project_metadata:s3e,source_property_ignored_warning:zct,source_refdes_convention_warning:g3e,source_simple_ammeter:Hct,source_simple_battery:Wxe,source_simple_capacitor:Uxe,source_simple_chip:zxe,source_simple_connector:Uct,source_simple_connector_standards:Yct,source_simple_crystal:Gct,source_simple_current_source:Fct,source_simple_diode:Hne,source_simple_fiducial:Tct,source_simple_fuse:Lct,source_simple_ground:kct,source_simple_inductor:jxe,source_simple_led:Vxe,source_simple_mosfet:o3e,source_simple_op_amp:i3e,source_simple_pin_header:$xe,source_simple_pinout:Zxe,source_simple_potentiometer:Xxe,source_simple_power_source:Jxe,source_simple_push_button:qxe,source_simple_resistor:Kxe,source_simple_resonator:e3e,source_simple_switch:r3e,source_simple_test_point:n3e,source_simple_transistor:t3e,source_simple_voltage_probe:Jct,source_simple_voltage_source:jct,source_trace:Zct,source_trace_not_connected_error:A3e,source_unnamed_trace_warning:slt,spice_simulation_options:Bgt,supplier_footprint_mismatch_warning:R3e,supplier_name:WM,time:$6n,timestamp:xct,unknown_error_finding_part:glt,visible_layer:Vm,voltage:O_,wave_shape:Y3e},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 L8n=/^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 H8n(t){const e=t.match(L8n);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 O8n(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 GV(t){return typeof t>"u"}function G_(t,e=0){return{a:1,c:0,e:t,b:0,d:1,f:e}}function YV(...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 YV(r,...i)}}}function l0(...t){return YV(...t)}const{cos:G8n,sin:Y8n}=Math;function N8(t,e,n){const o=G8n(t),i=Y8n(t),r={a:o,c:-i,e:0,b:i,d:o,f:0};return GV(e)||GV(n)?r:YV([G_(e,n),r,G_(-e,-n)])}function sx(t,e=void 0,n=void 0,o=void 0){GV(e)&&(e=t);const i={a:t,c:0,e:0,b:0,d:e,f:0};return GV(n)||GV(o)?i:YV([G_(n,o),i,G_(-n,-o)])}function U8n(t){return R8(t)}function R8(t){return`matrix(${t.a},${t.b},${t.c},${t.d},${t.e},${t.f})`}function K8n(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 V8n(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=O8n(d),_=YV([p,m]);return K8n(_)}function z8n(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n}function zne(t,e,n,o){var i=Error.call(this,t);return Object.setPrototypeOf&&Object.setPrototypeOf(i,zne.prototype),i.expected=e,i.found=n,i.location=o,i.name="SyntaxError",i}z8n(zne,Error);function z3e(t,e,n){return n=n||" ",t.length>e?t:(e-=t.length,n+=n.repeat(e),t+n.slice(0,e))}zne.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=z3e("",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"})]})]})},Rdn=t=>t.activeSubSolver?[t,...Rdn(t.activeSubSolver)]:[t],tLi=({solver:t})=>{const e=Rdn(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(eLi,{solver:n})]},n.getSolverName()))})},nLi=({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(tLi,{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]})]})},oLi=t=>t!==null&&"pipelineDef"in t&&Array.isArray(t.pipelineDef),iLi=(t,e,n)=>{const o=t.currentPipelineStageIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},rLi=(t,e)=>{const o=t.pipelineDef[e].solverName,i=iLi(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}},sLi=({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})},aLi=({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,"%"]})]})},Tdn=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)},ALi=t=>Object.entries(t).map(([e,n])=>`${e}: ${Tdn(n)}`).join(", "),cLi=({stats:t})=>{if(!t||Object.keys(t).length===0)return V.jsx("span",{children:"-"});const e=Object.entries(t),n=ALi(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,": ",Tdn(i)]},o))})]})},kje=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(kje);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=kje(o));return e},lLi=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=kje(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)}`)}},gLi=({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"})}),kdn=t=>{let e=t;for(;e.activeSubSolver;)e=e.activeSubSolver;return e},Fdn=({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,_)=>rLi(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):lLi(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=kdn(t);for(;!t.solved&&!t.failed&&(t.step(),kdn(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 _=oLi(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(gLi,{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(sLi,{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(aLi,{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(cLi,{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(Fdn,{solver:m.solverInstance,onStepUntilPhase:e,onDownloadInput:n,isNested:!0,indentLevel:i+1,triggerRender:r})})})]},m.name)})})]})})]})};function uLi({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 dLi=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}},hLi=({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(nLi,{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(dLi,{fallback:V.jsx(uLi,{graphics:u}),children:A==="canvas"?V.jsx(ZFi,{graphics:u}):V.jsx(qFi,{graphics:u})}),d&&V.jsx(Fdn,{solver:a,onStepUntilPhase:p,triggerRender:s})]})};const pLi=()=>{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)},[])},mLi=1e3,bE=(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)},mLi)},Fje=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"},_Li=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]},J6="https://github.com/tscircuit/tscircuit-autorouter/issues/new",Ldn="https://github.com/tscircuit/copper-pour-solver/issues/new",Hdn="https://github.com/tscircuit/calculate-packing/issues/new",fLi="https://github.com/tscircuit/matchpack/issues/new",Odn="https://github.com/tscircuit/schematic-trace-solver/issues/new?template=json-bug-report.yml",ILi={PackSolver2:Hdn,LayoutPipelineSolver:fLi,AutoroutingPipelineSolver:J6,AssignableAutoroutingPipeline2:J6,AssignableAutoroutingPipeline3:J6,AutoroutingPipeline1_OriginalUnravel:J6,AutoroutingPipelineSolver3_HgPortPointPathing:J6,AutoroutingPipelineSolver4:J6,AutoroutingPipelineSolver5:J6,AutoroutingPipelineSolver7_MultiGraph:J6,AutoroutingPipelineSolver8:J6,CopperPourPipelineSolver:Ldn,SchematicTracePipelineSolver:Odn},CLi=t=>t.toLowerCase().includes("pack")?I7i:t.toLowerCase().includes("rout")?kAn:g7i,Gdn=t=>{const e=ILi[t];if(e)return e;const n=t.toLowerCase();return n.includes("autorout")?J6:n.includes("schematic")&&n.includes("trace")?Odn:n.includes("copperpour")?Ldn:n.includes("pack")?Hdn:null},yLi=t=>`${Fje(`${t.componentName}-${t.solverName}`)}-solver-input.json`,Ydn=t=>{bE(JSON.stringify(t.solverParams,null,2),{fileName:yLi(t),mimeType:"application/json"})},xLi=({solverEvent:t})=>{const e=Gdn(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(Zc,{type:"button",variant:"outline",size:"sm",onClick:()=>Ydn(t),children:[V.jsx(V$,{className:"rf-w-4 rf-h-4"}),"Download"]}),e?V.jsx(Zc,{asChild:!0,variant:"outline",size:"sm",children:V.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[V.jsx(Gpe,{className:"rf-w-4 rf-h-4"}),"Report"]})}):V.jsxs(Zc,{type:"button",variant:"outline",size:"sm",disabled:!0,title:"No report link configured for this solver",children:[V.jsx(Gpe,{className:"rf-w-4 rf-h-4"}),"Report"]})]})},ELi=({solverEvent:t})=>{const e=Gdn(t.solverName);return e?V.jsx(Zc,{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(Gpe,{className:"rf-w-4 rf-h-4"})})}):V.jsx(Zc,{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(Gpe,{className:"rf-w-4 rf-h-4"})})},BLi=({solverEvents:t=[]})=>{const[e,n]=te.useState(null);pLi();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=vRe[r.solverName];if(!a)return{instance:null,error:`Solver class "${r.solverName}" not found in SOLVERS registry. Available: ${Object.keys(vRe).join(", ")}`,classFound:!1};try{return{instance:new a(..._Li(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=CLi(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(xLi,{solverEvent:r}),V.jsx("div",{className:"rf-min-h-0 rf-flex-1",children:V.jsx(KB,{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(hLi,{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(ELi,{solverEvent:r}),V.jsx(Zc,{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:()=>Ydn(r),children:V.jsx(V$,{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"})})})]})},bLi=new Map([["custom","Custom"],["fanout","Fanout"],["single_layer_fanout","Single layer fanout"],["tscircuit_simplify","Simplify"]]),SLi=new Set(["tscircuit","default","auto","auto_local"]);function QLi(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 vLi(t){const e=t.autorouterName?.trim(),n=e?.replace(/-/g,"_"),o=n&&bLi.get(n);if(o)return o;if(n&&!SLi.has(n))return e;const i=t.solverName?.trim();if(i)return QLi(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 Lje="#fbbf24";function wLi(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 Udn(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 PLi(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 Kdn(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,...PLi(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 MLi(t){const e=[],n=[],o=t.endSimpleRouteJson;if(!o)return{lines:e,circles:n};const i=new Set(Udn(t));for(const r of o.traces??[])if(i.has(r.pcb_trace_id))for(const s of Kdn(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:Lje,layer:c}),A.route_type==="via"&&n.push({center:{x:A.x,y:A.y},radius:A.outer_diameter/2,stroke:Lje,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 DLi(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 NLi=new Set(["pcb_trace","pcb_via","pcb_copper_pour","pcb_ground_plane","pcb_ground_plane_region","pcb_thermal_spoke","pcb_breakout_point"]);function RLi(t,e,n){const o=n==="input"?e.startSimpleRouteJson??e.errorSimpleRouteJson:e.endSimpleRouteJson,i=t.filter(c=>!NLi.has(c.type)&&!c.type.endsWith("_error")&&!c.type.endsWith("_warning"));if(!o)return i;const r=n==="input"?o.traces??[]:wLi(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=Kdn(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}_${DLi(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 Hje=(t,e)=>t.phaseName||`Phase ${t.phaseOrdinal??e+1}`,Vdn=t=>t.componentDisplayName?.match(/name="([^"]+)"/)?.[1]?.replace(/^\./,"")||t.componentDisplayName||t.subcircuit_id||"Board",zdn=t=>t.startSimpleRouteJson??t.endSimpleRouteJson??t.errorSimpleRouteJson,TLi={is_showing_autorouting:!0,is_showing_rats_nest:!1,is_showing_drc_errors:!1,is_showing_drc_warnings:!1,is_showing_pcb_groups:!1},kLi=({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&&zdn(R)===zdn(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:RLi(t??[],m,y),[t,m,x,y]),B=te.useMemo(()=>m&&y==="output"&&a?MLi(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(kAn,{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=Hje(m,p),Q=m.status==="running"&&n,w=!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=Udn(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:`${Vdn(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:Hje(R,F),children:Hje(R,F)}),R.status==="complete"?V.jsx(K$,{"aria-label":"Captured",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-green-600"}):R.status==="error"?V.jsx(Zze,{"aria-label":"Failed",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-red-500"}):n?V.jsx(a4,{"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:[vLi(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:Lje}}),"Highlight changes (all layers)"]}),V.jsxs("span",{children:[y==="input"?"Before this phase":"After this phase"," ","· ",k," traces"]})]}),w&&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(wje,{circuitJson:E,height:u,allowEditing:!1,clickToInteractEnabled:!1,initialState:TLi,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`,` · ${Vdn(m)}`]}),V.jsxs("div",{className:"rf-flex rf-items-center rf-gap-4",children:[V.jsxs("button",{type:"button",disabled:!x,onClick:()=>bE(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(V$,{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(zY,{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."})]})]})},Jdn=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{te.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{Kk.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{Kk.captureException(i,{error_type:o.type})}catch{}}},[n])},FLi=t=>{te.useEffect(()=>{try{V7n(t)}catch{}},[t.source,t.component,t.isWebEmbedded,t.activeTab])},Wdn="0.0.2861",LLi={version:Wdn},Oje={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Gje=new Map,D_e=t=>{const e=Gje.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,o])=>[n,o.getState()])):{}},HLi=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};const o=Gje.get(n.name);if(o)return{type:"tracked",store:t,...o};const i={connection:e.connect(n),stores:{}};return Gje.set(n.name,i),{type:"tracked",store:t,...i}},jdn=(t,e={})=>(n,o,i)=>{const{enabled:r,anonymousActionType:s,store:a,...A}=e;let c;try{c=(r??(Oje?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(Oje?"production":void 0)!=="production"&&r&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,o,i);const{connection:l,...g}=HLi(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}`},{...D_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=(..._)=>{(Oje?"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 Yje(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"})]})]})},Rdn=t=>t.activeSubSolver?[t,...Rdn(t.activeSubSolver)]:[t],tLi=({solver:t})=>{const e=Rdn(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(eLi,{solver:n})]},n.getSolverName()))})},nLi=({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(tLi,{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]})]})},oLi=t=>t!==null&&"pipelineDef"in t&&Array.isArray(t.pipelineDef),iLi=(t,e,n)=>{const o=t.currentPipelineStageIndex;return e<o?"Completed":e===o&&t.activeSubSolver?t.activeSubSolver.failed?"Failed":"In Progress":"Not Started"},rLi=(t,e)=>{const o=t.pipelineDef[e].solverName,i=iLi(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}},sLi=({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})},aLi=({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,"%"]})]})},Tdn=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)},ALi=t=>Object.entries(t).map(([e,n])=>`${e}: ${Tdn(n)}`).join(", "),cLi=({stats:t})=>{if(!t||Object.keys(t).length===0)return V.jsx("span",{children:"-"});const e=Object.entries(t),n=ALi(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,": ",Tdn(i)]},o))})]})},kje=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(kje);const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||(e[n]=kje(o));return e},lLi=(t,e)=>{try{if(typeof t.getConstructorParams!="function"){alert(`getConstructorParams() is not implemented for ${e}`);return}const n=kje(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)}`)}},gLi=({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"})}),kdn=t=>{let e=t;for(;e.activeSubSolver;)e=e.activeSubSolver;return e},Fdn=({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,_)=>rLi(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):lLi(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=kdn(t);for(;!t.solved&&!t.failed&&(t.step(),kdn(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 _=oLi(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(gLi,{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(sLi,{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(aLi,{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(cLi,{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(Fdn,{solver:m.solverInstance,onStepUntilPhase:e,onDownloadInput:n,isNested:!0,indentLevel:i+1,triggerRender:r})})})]},m.name)})})]})})]})};function uLi({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 dLi=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}},hLi=({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(nLi,{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(dLi,{fallback:V.jsx(uLi,{graphics:u}),children:A==="canvas"?V.jsx(ZFi,{graphics:u}):V.jsx(qFi,{graphics:u})}),d&&V.jsx(Fdn,{solver:a,onStepUntilPhase:p,triggerRender:s})]})};const pLi=()=>{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)},[])},mLi=1e3,bE=(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)},mLi)},Fje=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"},_Li=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]},J6="https://github.com/tscircuit/tscircuit-autorouter/issues/new",Ldn="https://github.com/tscircuit/copper-pour-solver/issues/new",Hdn="https://github.com/tscircuit/calculate-packing/issues/new",fLi="https://github.com/tscircuit/matchpack/issues/new",Odn="https://github.com/tscircuit/schematic-trace-solver/issues/new?template=json-bug-report.yml",ILi={PackSolver2:Hdn,LayoutPipelineSolver:fLi,AutoroutingPipelineSolver:J6,AssignableAutoroutingPipeline2:J6,AssignableAutoroutingPipeline3:J6,AutoroutingPipeline1_OriginalUnravel:J6,AutoroutingPipelineSolver3_HgPortPointPathing:J6,AutoroutingPipelineSolver4:J6,AutoroutingPipelineSolver5:J6,AutoroutingPipelineSolver7_MultiGraph:J6,AutoroutingPipelineSolver8:J6,CopperPourPipelineSolver:Ldn,SchematicTracePipelineSolver:Odn},CLi=t=>t.toLowerCase().includes("pack")?I7i:t.toLowerCase().includes("rout")?kAn:g7i,Gdn=t=>{const e=ILi[t];if(e)return e;const n=t.toLowerCase();return n.includes("autorout")?J6:n.includes("schematic")&&n.includes("trace")?Odn:n.includes("copperpour")?Ldn:n.includes("pack")?Hdn:null},yLi=t=>`${Fje(`${t.componentName}-${t.solverName}`)}-solver-input.json`,Ydn=t=>{bE(JSON.stringify(t.solverParams,null,2),{fileName:yLi(t),mimeType:"application/json"})},xLi=({solverEvent:t})=>{const e=Gdn(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(Zc,{type:"button",variant:"outline",size:"sm",onClick:()=>Ydn(t),children:[V.jsx(V$,{className:"rf-w-4 rf-h-4"}),"Download"]}),e?V.jsx(Zc,{asChild:!0,variant:"outline",size:"sm",children:V.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[V.jsx(Gpe,{className:"rf-w-4 rf-h-4"}),"Report"]})}):V.jsxs(Zc,{type:"button",variant:"outline",size:"sm",disabled:!0,title:"No report link configured for this solver",children:[V.jsx(Gpe,{className:"rf-w-4 rf-h-4"}),"Report"]})]})},ELi=({solverEvent:t})=>{const e=Gdn(t.solverName);return e?V.jsx(Zc,{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(Gpe,{className:"rf-w-4 rf-h-4"})})}):V.jsx(Zc,{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(Gpe,{className:"rf-w-4 rf-h-4"})})},BLi=({solverEvents:t=[]})=>{const[e,n]=te.useState(null);pLi();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=vRe[r.solverName];if(!a)return{instance:null,error:`Solver class "${r.solverName}" not found in SOLVERS registry. Available: ${Object.keys(vRe).join(", ")}`,classFound:!1};try{return{instance:new a(..._Li(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=CLi(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(xLi,{solverEvent:r}),V.jsx("div",{className:"rf-min-h-0 rf-flex-1",children:V.jsx(KB,{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(hLi,{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(ELi,{solverEvent:r}),V.jsx(Zc,{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:()=>Ydn(r),children:V.jsx(V$,{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"})})})]})},bLi=new Map([["custom","Custom"],["fanout","Fanout"],["single_layer_fanout","Single layer fanout"],["tscircuit_simplify","Simplify"]]),SLi=new Set(["tscircuit","default","auto","auto_local"]);function QLi(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 vLi(t){const e=t.autorouterName?.trim(),n=e?.replace(/-/g,"_"),o=n&&bLi.get(n);if(o)return o;if(n&&!SLi.has(n))return e;const i=t.solverName?.trim();if(i)return QLi(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 Lje="#fbbf24";function wLi(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 Udn(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 PLi(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 Kdn(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,...PLi(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 MLi(t){const e=[],n=[],o=t.endSimpleRouteJson;if(!o)return{lines:e,circles:n};const i=new Set(Udn(t));for(const r of o.traces??[])if(i.has(r.pcb_trace_id))for(const s of Kdn(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:Lje,layer:c}),A.route_type==="via"&&n.push({center:{x:A.x,y:A.y},radius:A.outer_diameter/2,stroke:Lje,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 DLi(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 NLi=new Set(["pcb_trace","pcb_via","pcb_copper_pour","pcb_ground_plane","pcb_ground_plane_region","pcb_thermal_spoke","pcb_breakout_point"]);function RLi(t,e,n){const o=n==="input"?e.startSimpleRouteJson??e.errorSimpleRouteJson:e.endSimpleRouteJson,i=t.filter(c=>!NLi.has(c.type)&&!c.type.endsWith("_error")&&!c.type.endsWith("_warning"));if(!o)return i;const r=n==="input"?o.traces??[]:wLi(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=Kdn(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}_${DLi(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 Hje=(t,e)=>t.phaseName||`Phase ${t.phaseOrdinal??e+1}`,Vdn=t=>t.componentDisplayName?.match(/name="([^"]+)"/)?.[1]?.replace(/^\./,"")||t.componentDisplayName||t.subcircuit_id||"Board",zdn=t=>t.startSimpleRouteJson??t.endSimpleRouteJson??t.errorSimpleRouteJson,TLi={is_showing_autorouting:!0,is_showing_rats_nest:!1,is_showing_drc_errors:!1,is_showing_drc_warnings:!1,is_showing_pcb_groups:!1},kLi=({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&&zdn(R)===zdn(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:RLi(t??[],m,y),[t,m,x,y]),B=te.useMemo(()=>m&&y==="output"&&a?MLi(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(kAn,{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=Hje(m,p),Q=m.status==="running"&&n,w=!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=Udn(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:`${Vdn(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:Hje(R,F),children:Hje(R,F)}),R.status==="complete"?V.jsx(K$,{"aria-label":"Captured",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-green-600"}):R.status==="error"?V.jsx(Zze,{"aria-label":"Failed",className:"rf-h-3 rf-w-3 rf-shrink-0 rf-text-red-500"}):n?V.jsx(a4,{"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:[vLi(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:Lje}}),"Highlight changes (all layers)"]}),V.jsxs("span",{children:[y==="input"?"Before this phase":"After this phase"," ","· ",k," traces"]})]}),w&&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(wje,{circuitJson:E,height:u,allowEditing:!1,clickToInteractEnabled:!1,initialState:TLi,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`,` · ${Vdn(m)}`]}),V.jsxs("div",{className:"rf-flex rf-items-center rf-gap-4",children:[V.jsxs("button",{type:"button",disabled:!x,onClick:()=>bE(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(V$,{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(zY,{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."})]})]})},Jdn=({errorMessage:t,errorStack:e,circuitJsonErrors:n})=>{te.useEffect(()=>{if(t){const o=new Error(t);e&&(o.stack=e);try{Kk.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{Kk.captureException(i,{error_type:o.type})}catch{}}},[n])},FLi=t=>{te.useEffect(()=>{try{V7n(t)}catch{}},[t.source,t.component,t.isWebEmbedded,t.activeTab])},Wdn="0.0.2863",LLi={version:Wdn},Oje={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},Gje=new Map,D_e=t=>{const e=Gje.get(t);return e?Object.fromEntries(Object.entries(e.stores).map(([n,o])=>[n,o.getState()])):{}},HLi=(t,e,n)=>{if(t===void 0)return{type:"untracked",connection:e.connect(n)};const o=Gje.get(n.name);if(o)return{type:"tracked",store:t,...o};const i={connection:e.connect(n),stores:{}};return Gje.set(n.name,i),{type:"tracked",store:t,...i}},jdn=(t,e={})=>(n,o,i)=>{const{enabled:r,anonymousActionType:s,store:a,...A}=e;let c;try{c=(r??(Oje?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(Oje?"production":void 0)!=="production"&&r&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),t(n,o,i);const{connection:l,...g}=HLi(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}`},{...D_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=(..._)=>{(Oje?"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 Yje(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" } } }
|