@tscircuit/runframe 0.0.640 → 0.0.642
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.
|
@@ -241,7 +241,7 @@ Check the render method of %s.`,Os(Rc)||"Unknown"));var tn=eE(He,lt);tn.payload=
|
|
|
241
241
|
You might need to use a local HTTP server (instead of file://): https://reactjs.org/link/react-devtools-faq`:""),"font-weight:bold")}rB.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=bde,rB.createPortal=Knn,rB.createRoot=Jnn,rB.findDOMNode=Onn,rB.flushSync=Znn,rB.hydrate=znn,rB.hydrateRoot=qnn,rB.render=Hnn,rB.unmountComponentAtNode=Vnn,rB.unstable_batchedUpdates=nde,rB.unstable_renderSubtreeIntoContainer=jnn,rB.version=vde,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}(),rB}var rfe;function afe(){if(rfe)return _8.exports;rfe=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(process.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(e){console.error(e)}}}return process.env.NODE_ENV==="production"?(i(),_8.exports=Dje()):_8.exports=Rje(),_8.exports}var ofe;function Nje(){if(ofe)return NM;ofe=1;var i=afe();if(process.env.NODE_ENV==="production")NM.createRoot=i.createRoot,NM.hydrateRoot=i.hydrateRoot;else{var e=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;NM.createRoot=function(t,n){e.usingClientEntryPoint=!0;try{return i.createRoot(t,n)}finally{e.usingClientEntryPoint=!1}},NM.hydrateRoot=function(t,n,r){e.usingClientEntryPoint=!0;try{return i.hydrateRoot(t,n,r)}finally{e.usingClientEntryPoint=!1}}}return NM}var sfe=Nje(),It=BE();const yg=HE(It),lfe=AS({__proto__:null,default:yg},[It]);function _m(i,e,{checkForDefaultPrevented:t=!0}={}){return function(r){if(i==null||i(r),t===!1||!r.defaultPrevented)return e==null?void 0:e(r)}}function UM(i,e=[]){let t=[];function n(a,o){const s=It.createContext(o),l=t.length;t=[...t,o];const c=A=>{var b;const{scope:f,children:p,...v}=A,B=((b=f==null?void 0:f[i])==null?void 0:b[l])||s,x=It.useMemo(()=>v,Object.values(v));return ht.jsx(B.Provider,{value:x,children:p})};c.displayName=a+"Provider";function u(A,f){var B;const p=((B=f==null?void 0:f[i])==null?void 0:B[l])||s,v=It.useContext(p);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${A}\` must be used within \`${a}\``)}return[c,u]}const r=()=>{const a=t.map(o=>It.createContext(o));return function(s){const l=(s==null?void 0:s[i])||a;return It.useMemo(()=>({[`__scope${i}`]:{...s,[i]:l}}),[s,l])}};return r.scopeName=i,[n,Tje(r,...e)]}function Tje(...i){const e=i[0];if(i.length===1)return e;const t=()=>{const n=i.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(a){const o=n.reduce((s,{useScope:l,scopeName:c})=>{const A=l(a)[`__scope${c}`];return{...s,...A}},{});return It.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}function cfe(i,e){if(typeof i=="function")return i(e);i!=null&&(i.current=e)}function B8(...i){return e=>{let t=!1;const n=i.map(r=>{const a=cfe(r,e);return!t&&typeof a=="function"&&(t=!0),a});if(t)return()=>{for(let r=0;r<n.length;r++){const a=n[r];typeof a=="function"?a():cfe(i[r],null)}}}}function aB(...i){return It.useCallback(B8(...i),i)}function PR(i){const e=Pje(i),t=It.forwardRef((n,r)=>{const{children:a,...o}=n,s=It.Children.toArray(a),l=s.find(Fje);if(l){const c=l.props.children,u=s.map(A=>A===l?It.Children.count(c)>1?It.Children.only(null):It.isValidElement(c)?c.props.children:null:A);return ht.jsx(e,{...o,ref:r,children:It.isValidElement(c)?It.cloneElement(c,void 0,u):null})}return ht.jsx(e,{...o,ref:r,children:a})});return t.displayName=`${i}.Slot`,t}var Uje=PR("Slot");function Pje(i){const e=It.forwardRef((t,n)=>{const{children:r,...a}=t;if(It.isValidElement(r)){const o=Lje(r),s=kje(a,r.props);return r.type!==It.Fragment&&(s.ref=n?B8(n,o):o),It.cloneElement(r,s)}return It.Children.count(r)>1?It.Children.only(null):null});return e.displayName=`${i}.SlotClone`,e}var Gje=Symbol("radix.slottable");function Fje(i){return It.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===Gje}function kje(i,e){const t={...e};for(const n in e){const r=i[n],a=e[n];/^on[A-Z]/.test(n)?r&&a?t[n]=(...s)=>{const l=a(...s);return r(...s),l}:r&&(t[n]=r):n==="style"?t[n]={...r,...a}:n==="className"&&(t[n]=[r,a].filter(Boolean).join(" "))}return{...i,...t}}function Lje(i){var n,r;let e=(n=Object.getOwnPropertyDescriptor(i.props,"ref"))==null?void 0:n.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?i.ref:(e=(r=Object.getOwnPropertyDescriptor(i,"ref"))==null?void 0:r.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?i.props.ref:i.props.ref||i.ref)}function ufe(i){const e=i+"CollectionProvider",[t,n]=UM(e),[r,a]=t(e,{collectionRef:{current:null},itemMap:new Map}),o=B=>{const{scope:x,children:b}=B,Q=yg.useRef(null),R=yg.useRef(new Map).current;return ht.jsx(r,{scope:x,itemMap:R,collectionRef:Q,children:b})};o.displayName=e;const s=i+"CollectionSlot",l=PR(s),c=yg.forwardRef((B,x)=>{const{scope:b,children:Q}=B,R=a(s,b),k=aB(x,R.collectionRef);return ht.jsx(l,{ref:k,children:Q})});c.displayName=s;const u=i+"CollectionItemSlot",A="data-radix-collection-item",f=PR(u),p=yg.forwardRef((B,x)=>{const{scope:b,children:Q,...R}=B,k=yg.useRef(null),K=aB(x,k),Y=a(u,b);return yg.useEffect(()=>(Y.itemMap.set(k,{ref:k,...R}),()=>void Y.itemMap.delete(k))),ht.jsx(f,{[A]:"",ref:K,children:Q})});p.displayName=u;function v(B){const x=a(i+"CollectionConsumer",B);return yg.useCallback(()=>{const Q=x.collectionRef.current;if(!Q)return[];const R=Array.from(Q.querySelectorAll(`[${A}]`));return Array.from(x.itemMap.values()).sort((Y,J)=>R.indexOf(Y.ref.current)-R.indexOf(J.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:o,Slot:c,ItemSlot:p},v,n]}var yw=globalThis!=null&&globalThis.document?It.useLayoutEffect:()=>{},Oje=lfe[" useId ".trim().toString()]||(()=>{}),zje=0;function b8(i){const[e,t]=It.useState(Oje());return yw(()=>{t(n=>n??String(zje++))},[i]),e?`radix-${e}`:""}var Oz=afe();const Hje=HE(Oz);var Yje=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],YE=Yje.reduce((i,e)=>{const t=PR(`Primitive.${e}`),n=It.forwardRef((r,a)=>{const{asChild:o,...s}=r,l=o?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),ht.jsx(l,{...s,ref:a})});return n.displayName=`Primitive.${e}`,{...i,[e]:n}},{});function Afe(i,e){i&&Oz.flushSync(()=>i.dispatchEvent(e))}function cQ(i){const e=It.useRef(i);return It.useEffect(()=>{e.current=i}),It.useMemo(()=>(...t)=>{var n;return(n=e.current)==null?void 0:n.call(e,...t)},[])}var Vje=lfe[" useInsertionEffect ".trim().toString()]||yw;function zz({prop:i,defaultProp:e,onChange:t=()=>{},caller:n}){const[r,a,o]=Kje({defaultProp:e,onChange:t}),s=i!==void 0,l=s?i:r;{const u=It.useRef(i!==void 0);It.useEffect(()=>{const A=u.current;A!==s&&console.warn(`${n} is changing from ${A?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=s},[s,n])}const c=It.useCallback(u=>{var A;if(s){const f=jje(u)?u(i):u;f!==i&&((A=o.current)==null||A.call(o,f))}else a(u)},[s,i,a,o]);return[l,c]}function Kje({defaultProp:i,onChange:e}){const[t,n]=It.useState(i),r=It.useRef(t),a=It.useRef(e);return Vje(()=>{a.current=e},[e]),It.useEffect(()=>{var o;r.current!==t&&((o=a.current)==null||o.call(a,t),r.current=t)},[t,r]),[t,n,a]}function jje(i){return typeof i=="function"}var Jje=It.createContext(void 0);function Hz(i){const e=It.useContext(Jje);return i||e||"ltr"}var Yz="rovingFocusGroup.onEntryFocus",qje={bubbles:!1,cancelable:!0},GR="RovingFocusGroup",[Vz,dfe,Zje]=ufe(GR),[Wje,S8]=UM(GR,[Zje]),[Xje,$je]=Wje(GR),ffe=It.forwardRef((i,e)=>ht.jsx(Vz.Provider,{scope:i.__scopeRovingFocusGroup,children:ht.jsx(Vz.Slot,{scope:i.__scopeRovingFocusGroup,children:ht.jsx(eJe,{...i,ref:e})})}));ffe.displayName=GR;var eJe=It.forwardRef((i,e)=>{const{__scopeRovingFocusGroup:t,orientation:n,loop:r=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...A}=i,f=It.useRef(null),p=aB(e,f),v=Hz(a),[B,x]=zz({prop:o,defaultProp:s??null,onChange:l,caller:GR}),[b,Q]=It.useState(!1),R=cQ(c),k=dfe(t),K=It.useRef(!1),[Y,J]=It.useState(0);return It.useEffect(()=>{const W=f.current;if(W)return W.addEventListener(Yz,R),()=>W.removeEventListener(Yz,R)},[R]),ht.jsx(Xje,{scope:t,orientation:n,dir:v,loop:r,currentTabStopId:B,onItemFocus:It.useCallback(W=>x(W),[x]),onItemShiftTab:It.useCallback(()=>Q(!0),[]),onFocusableItemAdd:It.useCallback(()=>J(W=>W+1),[]),onFocusableItemRemove:It.useCallback(()=>J(W=>W-1),[]),children:ht.jsx(YE.div,{tabIndex:b||Y===0?-1:0,"data-orientation":n,...A,ref:p,style:{outline:"none",...i.style},onMouseDown:_m(i.onMouseDown,()=>{K.current=!0}),onFocus:_m(i.onFocus,W=>{const $=!K.current;if(W.target===W.currentTarget&&$&&!b){const X=new CustomEvent(Yz,qje);if(W.currentTarget.dispatchEvent(X),!X.defaultPrevented){const de=k().filter(ve=>ve.focusable),ue=de.find(ve=>ve.active),ge=de.find(ve=>ve.id===B),Qe=[ue,ge,...de].filter(Boolean).map(ve=>ve.ref.current);gfe(Qe,u)}}K.current=!1}),onBlur:_m(i.onBlur,()=>Q(!1))})})}),hfe="RovingFocusGroupItem",pfe=It.forwardRef((i,e)=>{const{__scopeRovingFocusGroup:t,focusable:n=!0,active:r=!1,tabStopId:a,children:o,...s}=i,l=b8(),c=a||l,u=$je(hfe,t),A=u.currentTabStopId===c,f=dfe(t),{onFocusableItemAdd:p,onFocusableItemRemove:v,currentTabStopId:B}=u;return It.useEffect(()=>{if(n)return p(),()=>v()},[n,p,v]),ht.jsx(Vz.ItemSlot,{scope:t,id:c,focusable:n,active:r,children:ht.jsx(YE.span,{tabIndex:A?0:-1,"data-orientation":u.orientation,...s,ref:e,onMouseDown:_m(i.onMouseDown,x=>{n?u.onItemFocus(c):x.preventDefault()}),onFocus:_m(i.onFocus,()=>u.onItemFocus(c)),onKeyDown:_m(i.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){u.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const b=iJe(x,u.orientation,u.dir);if(b!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let R=f().filter(k=>k.focusable).map(k=>k.ref.current);if(b==="last")R.reverse();else if(b==="prev"||b==="next"){b==="prev"&&R.reverse();const k=R.indexOf(x.currentTarget);R=u.loop?rJe(R,k+1):R.slice(k+1)}setTimeout(()=>gfe(R))}}),children:typeof o=="function"?o({isCurrentTabStop:A,hasTabStop:B!=null}):o})})});pfe.displayName=hfe;var tJe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function nJe(i,e){return e!=="rtl"?i:i==="ArrowLeft"?"ArrowRight":i==="ArrowRight"?"ArrowLeft":i}function iJe(i,e,t){const n=nJe(i.key,t);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return tJe[n]}function gfe(i,e=!1){const t=document.activeElement;for(const n of i)if(n===t||(n.focus({preventScroll:e}),document.activeElement!==t))return}function rJe(i,e){return i.map((t,n)=>i[(e+n)%i.length])}var mfe=ffe,yfe=pfe;function aJe(i,e){return It.useReducer((t,n)=>e[t][n]??t,i)}var PM=i=>{const{present:e,children:t}=i,n=oJe(e),r=typeof t=="function"?t({present:n.isPresent}):It.Children.only(t),a=aB(n.ref,sJe(r));return typeof t=="function"||n.isPresent?It.cloneElement(r,{ref:a}):null};PM.displayName="Presence";function oJe(i){const[e,t]=It.useState(),n=It.useRef(null),r=It.useRef(i),a=It.useRef("none"),o=i?"mounted":"unmounted",[s,l]=aJe(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return It.useEffect(()=>{const c=Q8(n.current);a.current=s==="mounted"?c:"none"},[s]),yw(()=>{const c=n.current,u=r.current;if(u!==i){const f=a.current,p=Q8(c);i?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==p?"ANIMATION_OUT":"UNMOUNT"),r.current=i}},[i,l]),yw(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,A=p=>{const B=Q8(n.current).includes(p.animationName);if(p.target===e&&B&&(l("ANIMATION_END"),!r.current)){const x=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=x)})}},f=p=>{p.target===e&&(a.current=Q8(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",A),e.addEventListener("animationend",A),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",A),e.removeEventListener("animationend",A)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:It.useCallback(c=>{n.current=c?getComputedStyle(c):null,t(c)},[])}}function Q8(i){return(i==null?void 0:i.animationName)||"none"}function sJe(i){var n,r;let e=(n=Object.getOwnPropertyDescriptor(i.props,"ref"))==null?void 0:n.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?i.ref:(e=(r=Object.getOwnPropertyDescriptor(i,"ref"))==null?void 0:r.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?i.props.ref:i.props.ref||i.ref)}var w8="Tabs",[lJe,nin]=UM(w8,[S8]),vfe=S8(),[cJe,Kz]=lJe(w8),Cfe=It.forwardRef((i,e)=>{const{__scopeTabs:t,value:n,onValueChange:r,defaultValue:a,orientation:o="horizontal",dir:s,activationMode:l="automatic",...c}=i,u=Hz(s),[A,f]=zz({prop:n,onChange:r,defaultProp:a??"",caller:w8});return ht.jsx(cJe,{scope:t,baseId:b8(),value:A,onValueChange:f,orientation:o,dir:u,activationMode:l,children:ht.jsx(YE.div,{dir:u,"data-orientation":o,...c,ref:e})})});Cfe.displayName=w8;var Ife="TabsList",Efe=It.forwardRef((i,e)=>{const{__scopeTabs:t,loop:n=!0,...r}=i,a=Kz(Ife,t),o=vfe(t);return ht.jsx(mfe,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:n,children:ht.jsx(YE.div,{role:"tablist","aria-orientation":a.orientation,...r,ref:e})})});Efe.displayName=Ife;var _fe="TabsTrigger",xfe=It.forwardRef((i,e)=>{const{__scopeTabs:t,value:n,disabled:r=!1,...a}=i,o=Kz(_fe,t),s=vfe(t),l=Sfe(o.baseId,n),c=Qfe(o.baseId,n),u=n===o.value;return ht.jsx(yfe,{asChild:!0,...s,focusable:!r,active:u,children:ht.jsx(YE.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:l,...a,ref:e,onMouseDown:_m(i.onMouseDown,A=>{!r&&A.button===0&&A.ctrlKey===!1?o.onValueChange(n):A.preventDefault()}),onKeyDown:_m(i.onKeyDown,A=>{[" ","Enter"].includes(A.key)&&o.onValueChange(n)}),onFocus:_m(i.onFocus,()=>{const A=o.activationMode!=="manual";!u&&!r&&A&&o.onValueChange(n)})})})});xfe.displayName=_fe;var Bfe="TabsContent",bfe=It.forwardRef((i,e)=>{const{__scopeTabs:t,value:n,forceMount:r,children:a,...o}=i,s=Kz(Bfe,t),l=Sfe(s.baseId,n),c=Qfe(s.baseId,n),u=n===s.value,A=It.useRef(u);return It.useEffect(()=>{const f=requestAnimationFrame(()=>A.current=!1);return()=>cancelAnimationFrame(f)},[]),ht.jsx(PM,{present:r||u,children:({present:f})=>ht.jsx(YE.div,{"data-state":u?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":l,hidden:!f,id:c,tabIndex:0,...o,ref:e,style:{...i.style,animationDuration:A.current?"0s":void 0},children:f&&a})})});bfe.displayName=Bfe;function Sfe(i,e){return`${i}-trigger-${e}`}function Qfe(i,e){return`${i}-content-${e}`}var uJe=Cfe,wfe=Efe,Mfe=xfe,Dfe=bfe;function Rfe(i){var e,t,n="";if(typeof i=="string"||typeof i=="number")n+=i;else if(typeof i=="object")if(Array.isArray(i)){var r=i.length;for(e=0;e<r;e++)i[e]&&(t=Rfe(i[e]))&&(n&&(n+=" "),n+=t)}else for(t in i)i[t]&&(n&&(n+=" "),n+=t);return n}function dS(){for(var i,e,t=0,n="",r=arguments.length;t<r;t++)(i=arguments[t])&&(e=Rfe(i))&&(n&&(n+=" "),n+=e);return n}const jz="-",AJe=i=>{const e=fJe(i),{conflictingClassGroups:t,conflictingClassGroupModifiers:n}=i;return{getClassGroupId:o=>{const s=o.split(jz);return s[0]===""&&s.length!==1&&s.shift(),Nfe(s,e)||dJe(o)},getConflictingClassGroupIds:(o,s)=>{const l=t[o]||[];return s&&n[o]?[...l,...n[o]]:l}}},Nfe=(i,e)=>{var o;if(i.length===0)return e.classGroupId;const t=i[0],n=e.nextPart.get(t),r=n?Nfe(i.slice(1),n):void 0;if(r)return r;if(e.validators.length===0)return;const a=i.join(jz);return(o=e.validators.find(({validator:s})=>s(a)))==null?void 0:o.classGroupId},Tfe=/^\[(.+)\]$/,dJe=i=>{if(Tfe.test(i)){const e=Tfe.exec(i)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},fJe=i=>{const{theme:e,prefix:t}=i,n={nextPart:new Map,validators:[]};return pJe(Object.entries(i.classGroups),t).forEach(([a,o])=>{Jz(o,n,a,e)}),n},Jz=(i,e,t,n)=>{i.forEach(r=>{if(typeof r=="string"){const a=r===""?e:Ufe(e,r);a.classGroupId=t;return}if(typeof r=="function"){if(hJe(r)){Jz(r(n),e,t,n);return}e.validators.push({validator:r,classGroupId:t});return}Object.entries(r).forEach(([a,o])=>{Jz(o,Ufe(e,a),t,n)})})},Ufe=(i,e)=>{let t=i;return e.split(jz).forEach(n=>{t.nextPart.has(n)||t.nextPart.set(n,{nextPart:new Map,validators:[]}),t=t.nextPart.get(n)}),t},hJe=i=>i.isThemeGetter,pJe=(i,e)=>e?i.map(([t,n])=>{const r=n.map(a=>typeof a=="string"?e+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([o,s])=>[e+o,s])):a);return[t,r]}):i,gJe=i=>{if(i<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,n=new Map;const r=(a,o)=>{t.set(a,o),e++,e>i&&(e=0,n=t,t=new Map)};return{get(a){let o=t.get(a);if(o!==void 0)return o;if((o=n.get(a))!==void 0)return r(a,o),o},set(a,o){t.has(a)?t.set(a,o):r(a,o)}}},Pfe="!",mJe=i=>{const{separator:e,experimentalParseClassName:t}=i,n=e.length===1,r=e[0],a=e.length,o=s=>{const l=[];let c=0,u=0,A;for(let x=0;x<s.length;x++){let b=s[x];if(c===0){if(b===r&&(n||s.slice(x,x+a)===e)){l.push(s.slice(u,x)),u=x+a;continue}if(b==="/"){A=x;continue}}b==="["?c++:b==="]"&&c--}const f=l.length===0?s:s.substring(u),p=f.startsWith(Pfe),v=p?f.substring(1):f,B=A&&A>u?A-u:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:v,maybePostfixModifierPosition:B}};return t?s=>t({className:s,parseClassName:o}):o},yJe=i=>{if(i.length<=1)return i;const e=[];let t=[];return i.forEach(n=>{n[0]==="["?(e.push(...t.sort(),n),t=[]):t.push(n)}),e.push(...t.sort()),e},vJe=i=>({cache:gJe(i.cacheSize),parseClassName:mJe(i),...AJe(i)}),CJe=/\s+/,IJe=(i,e)=>{const{parseClassName:t,getClassGroupId:n,getConflictingClassGroupIds:r}=e,a=[],o=i.trim().split(CJe);let s="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:u,hasImportantModifier:A,baseClassName:f,maybePostfixModifierPosition:p}=t(c);let v=!!p,B=n(v?f.substring(0,p):f);if(!B){if(!v){s=c+(s.length>0?" "+s:s);continue}if(B=n(f),!B){s=c+(s.length>0?" "+s:s);continue}v=!1}const x=yJe(u).join(":"),b=A?x+Pfe:x,Q=b+B;if(a.includes(Q))continue;a.push(Q);const R=r(B,v);for(let k=0;k<R.length;++k){const K=R[k];a.push(b+K)}s=c+(s.length>0?" "+s:s)}return s};function EJe(){let i=0,e,t,n="";for(;i<arguments.length;)(e=arguments[i++])&&(t=Gfe(e))&&(n&&(n+=" "),n+=t);return n}const Gfe=i=>{if(typeof i=="string")return i;let e,t="";for(let n=0;n<i.length;n++)i[n]&&(e=Gfe(i[n]))&&(t&&(t+=" "),t+=e);return t};function _Je(i,...e){let t,n,r,a=o;function o(l){const c=e.reduce((u,A)=>A(u),i());return t=vJe(c),n=t.cache.get,r=t.cache.set,a=s,s(l)}function s(l){const c=n(l);if(c)return c;const u=IJe(l,t);return r(l,u),u}return function(){return a(EJe.apply(null,arguments))}}const GI=i=>{const e=t=>t[i]||[];return e.isThemeGetter=!0,e},Ffe=/^\[(?:([a-z-]+):)?(.+)\]$/i,xJe=/^\d+\/\d+$/,BJe=new Set(["px","full","screen"]),bJe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,SJe=/\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$/,QJe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,wJe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,MJe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,uQ=i=>GM(i)||BJe.has(i)||xJe.test(i),vw=i=>FM(i,"length",FJe),GM=i=>!!i&&!Number.isNaN(Number(i)),qz=i=>FM(i,"number",GM),FR=i=>!!i&&Number.isInteger(Number(i)),DJe=i=>i.endsWith("%")&&GM(i.slice(0,-1)),I0=i=>Ffe.test(i),Cw=i=>bJe.test(i),RJe=new Set(["length","size","percentage"]),NJe=i=>FM(i,RJe,kfe),TJe=i=>FM(i,"position",kfe),UJe=new Set(["image","url"]),PJe=i=>FM(i,UJe,LJe),GJe=i=>FM(i,"",kJe),kR=()=>!0,FM=(i,e,t)=>{const n=Ffe.exec(i);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):t(n[2]):!1},FJe=i=>SJe.test(i)&&!QJe.test(i),kfe=()=>!1,kJe=i=>wJe.test(i),LJe=i=>MJe.test(i),OJe=_Je(()=>{const i=GI("colors"),e=GI("spacing"),t=GI("blur"),n=GI("brightness"),r=GI("borderColor"),a=GI("borderRadius"),o=GI("borderSpacing"),s=GI("borderWidth"),l=GI("contrast"),c=GI("grayscale"),u=GI("hueRotate"),A=GI("invert"),f=GI("gap"),p=GI("gradientColorStops"),v=GI("gradientColorStopPositions"),B=GI("inset"),x=GI("margin"),b=GI("opacity"),Q=GI("padding"),R=GI("saturate"),k=GI("scale"),K=GI("sepia"),Y=GI("skew"),J=GI("space"),W=GI("translate"),$=()=>["auto","contain","none"],X=()=>["auto","hidden","clip","visible","scroll"],de=()=>["auto",I0,e],ue=()=>[I0,e],ge=()=>["",uQ,vw],be=()=>["auto",GM,I0],Qe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ve=()=>["solid","dashed","dotted","double","none"],Be=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ie=()=>["start","end","center","between","around","evenly","stretch"],Te=()=>["","0",I0],Ne=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Le=()=>[GM,I0];return{cacheSize:500,separator:":",theme:{colors:[kR],spacing:[uQ,vw],blur:["none","",Cw,I0],brightness:Le(),borderColor:[i],borderRadius:["none","","full",Cw,I0],borderSpacing:ue(),borderWidth:ge(),contrast:Le(),grayscale:Te(),hueRotate:Le(),invert:Te(),gap:ue(),gradientColorStops:[i],gradientColorStopPositions:[DJe,vw],inset:de(),margin:de(),opacity:Le(),padding:ue(),saturate:Le(),scale:Le(),sepia:Te(),skew:Le(),space:ue(),translate:ue()},classGroups:{aspect:[{aspect:["auto","square","video",I0]}],container:["container"],columns:[{columns:[Cw]}],"break-after":[{"break-after":Ne()}],"break-before":[{"break-before":Ne()}],"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:[...Qe(),I0]}],overflow:[{overflow:X()}],"overflow-x":[{"overflow-x":X()}],"overflow-y":[{"overflow-y":X()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[B]}],"inset-x":[{"inset-x":[B]}],"inset-y":[{"inset-y":[B]}],start:[{start:[B]}],end:[{end:[B]}],top:[{top:[B]}],right:[{right:[B]}],bottom:[{bottom:[B]}],left:[{left:[B]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",FR,I0]}],basis:[{basis:de()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",I0]}],grow:[{grow:Te()}],shrink:[{shrink:Te()}],order:[{order:["first","last","none",FR,I0]}],"grid-cols":[{"grid-cols":[kR]}],"col-start-end":[{col:["auto",{span:["full",FR,I0]},I0]}],"col-start":[{"col-start":be()}],"col-end":[{"col-end":be()}],"grid-rows":[{"grid-rows":[kR]}],"row-start-end":[{row:["auto",{span:[FR,I0]},I0]}],"row-start":[{"row-start":be()}],"row-end":[{"row-end":be()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",I0]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",I0]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...Ie()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Ie(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Ie(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[Q]}],px:[{px:[Q]}],py:[{py:[Q]}],ps:[{ps:[Q]}],pe:[{pe:[Q]}],pt:[{pt:[Q]}],pr:[{pr:[Q]}],pb:[{pb:[Q]}],pl:[{pl:[Q]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[J]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[J]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",I0,e]}],"min-w":[{"min-w":[I0,e,"min","max","fit"]}],"max-w":[{"max-w":[I0,e,"none","full","min","max","fit","prose",{screen:[Cw]},Cw]}],h:[{h:[I0,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[I0,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[I0,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[I0,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Cw,vw]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",qz]}],"font-family":[{font:[kR]}],"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",I0]}],"line-clamp":[{"line-clamp":["none",GM,qz]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",uQ,I0]}],"list-image":[{"list-image":["none",I0]}],"list-style-type":[{list:["none","disc","decimal",I0]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[i]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[i]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ve(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",uQ,vw]}],"underline-offset":[{"underline-offset":["auto",uQ,I0]}],"text-decoration-color":[{decoration:[i]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ue()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",I0]}],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",I0]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Qe(),TJe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",NJe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},PJe]}],"bg-color":[{bg:[i]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...ve(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:ve()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...ve()]}],"outline-offset":[{"outline-offset":[uQ,I0]}],"outline-w":[{outline:[uQ,vw]}],"outline-color":[{outline:[i]}],"ring-w":[{ring:ge()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[i]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[uQ,vw]}],"ring-offset-color":[{"ring-offset":[i]}],shadow:[{shadow:["","inner","none",Cw,GJe]}],"shadow-color":[{shadow:[kR]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...Be(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Be()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[n]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Cw,I0]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[A]}],saturate:[{saturate:[R]}],sepia:[{sepia:[K]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[A]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[R]}],"backdrop-sepia":[{"backdrop-sepia":[K]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",I0]}],duration:[{duration:Le()}],ease:[{ease:["linear","in","out","in-out",I0]}],delay:[{delay:Le()}],animate:[{animate:["none","spin","ping","pulse","bounce",I0]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[FR,I0]}],"translate-x":[{"translate-x":[W]}],"translate-y":[{"translate-y":[W]}],"skew-x":[{"skew-x":[Y]}],"skew-y":[{"skew-y":[Y]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",I0]}],accent:[{accent:["auto",i]}],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",I0]}],"caret-color":[{caret:[i]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ue()}],"scroll-mx":[{"scroll-mx":ue()}],"scroll-my":[{"scroll-my":ue()}],"scroll-ms":[{"scroll-ms":ue()}],"scroll-me":[{"scroll-me":ue()}],"scroll-mt":[{"scroll-mt":ue()}],"scroll-mr":[{"scroll-mr":ue()}],"scroll-mb":[{"scroll-mb":ue()}],"scroll-ml":[{"scroll-ml":ue()}],"scroll-p":[{"scroll-p":ue()}],"scroll-px":[{"scroll-px":ue()}],"scroll-py":[{"scroll-py":ue()}],"scroll-ps":[{"scroll-ps":ue()}],"scroll-pe":[{"scroll-pe":ue()}],"scroll-pt":[{"scroll-pt":ue()}],"scroll-pr":[{"scroll-pr":ue()}],"scroll-pb":[{"scroll-pb":ue()}],"scroll-pl":[{"scroll-pl":ue()}],"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",I0]}],fill:[{fill:[i,"none"]}],"stroke-w":[{stroke:[uQ,vw,qz]}],stroke:[{stroke:[i,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});var Ka=typeof window<"u"?window:void 0,oB=typeof globalThis<"u"?globalThis:Ka,Lfe=Array.prototype,Ofe=Lfe.forEach,zfe=Lfe.indexOf,PB=oB==null?void 0:oB.navigator,YA=oB==null?void 0:oB.document,sB=oB==null?void 0:oB.location,Zz=oB==null?void 0:oB.fetch,Wz=oB!=null&&oB.XMLHttpRequest&&"withCredentials"in new oB.XMLHttpRequest?oB.XMLHttpRequest:void 0,Hfe=oB==null?void 0:oB.AbortController,lB=PB==null?void 0:PB.userAgent,E0=Ka??{},AQ={DEBUG:!1,LIB_VERSION:"1.253.4"},Xz="$copy_autocapture",zJe=["$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"],dQ=function(i){return i.GZipJS="gzip-js",i.Base64="base64",i}({}),HJe=["fatal","error","warning","log","info","debug"];function xm(i,e){return i.indexOf(e)!==-1}var M8=function(i){return i.trim()},$z=function(i){return i.replace(/^\$/,"")},YJe=Array.isArray,Yfe=Object.prototype,Vfe=Yfe.hasOwnProperty,D8=Yfe.toString,qI=YJe||function(i){return D8.call(i)==="[object Array]"},ob=i=>typeof i=="function",T1=i=>i===Object(i)&&!qI(i),kM=i=>{if(T1(i)){for(var e in i)if(Vfe.call(i,e))return!1;return!0}return!1},wu=i=>i===void 0,U1=i=>D8.call(i)=="[object String]",eH=i=>U1(i)&&i.trim().length===0,Iw=i=>i===null,yv=i=>wu(i)||Iw(i),gx=i=>D8.call(i)=="[object Number]",fS=i=>D8.call(i)==="[object Boolean]",VJe=i=>i instanceof FormData,KJe=i=>xm(zJe,i),Kfe=i=>{var e={t:function(t){if(Ka&&(AQ.DEBUG||E0.POSTHOG_DEBUG)&&!wu(Ka.console)&&Ka.console){for(var n=("__rrweb_original__"in Ka.console[t])?Ka.console[t].__rrweb_original__:Ka.console[t],r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];n(i,...a)}},info:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];e.t("log",...n)},warn:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];e.t("warn",...n)},error:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];e.t("error",...n)},critical:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];console.error(i,...n)},uninitializedWarning:t=>{e.error("You must initialize PostHog before calling "+t)},createLogger:t=>Kfe(i+" "+t)};return e},yd=Kfe("[PostHog.js]"),L_=yd.createLogger,jJe=L_("[ExternalScriptsLoader]"),jfe=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return jJe.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var n=YA==null?void 0:YA.querySelectorAll("script");if(n){for(var r=0;r<n.length;r++)if(n[r].src===e)return t()}var a=()=>{if(!YA)return t("document not found");var o=YA.createElement("script");if(o.type="text/javascript",o.crossOrigin="anonymous",o.src=e,o.onload=c=>t(void 0,c),o.onerror=c=>t(c),i.config.prepare_external_dependency_script&&(o=i.config.prepare_external_dependency_script(o)),!o)return t("prepare_external_dependency_script returned null");var s,l=YA.querySelectorAll("body > script");l.length>0?(s=l[0].parentNode)==null||s.insertBefore(o,l[0]):YA.body.appendChild(o)};YA!=null&&YA.body?a():YA==null||YA.addEventListener("DOMContentLoaded",a)};function vA(){return vA=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},vA.apply(null,arguments)}function Jfe(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}E0.__PosthogExtensions__=E0.__PosthogExtensions__||{},E0.__PosthogExtensions__.loadExternalDependency=(i,e,t)=>{var n="/static/"+e+".js?v="+i.version;if(e==="remote-config"&&(n="/array/"+i.config.token+"/config.js"),e==="toolbar"){var r=3e5;n=n+"&t="+Math.floor(Date.now()/r)*r}var a=i.requestRouter.endpointFor("assets",n);jfe(i,a,t)},E0.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var n=i.requestRouter.endpointFor("api",e);jfe(i,n,t)};var R8={};function Ew(i,e,t){if(qI(i)){if(Ofe&&i.forEach===Ofe)i.forEach(e,t);else if("length"in i&&i.length===+i.length){for(var n=0,r=i.length;n<r;n++)if(n in i&&e.call(t,i[n],n)===R8)return}}}function zC(i,e,t){if(!yv(i)){if(qI(i))return Ew(i,e,t);if(VJe(i)){for(var n of i.entries())if(e.call(t,n[1],n[0])===R8)return}else for(var r in i)if(Vfe.call(i,r)&&e.call(t,i[r],r)===R8)return}}var bE=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return Ew(t,function(r){for(var a in r)r[a]!==void 0&&(i[a]=r[a])}),i},N8=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return Ew(t,function(r){Ew(r,function(a){i.push(a)})}),i};function T8(i){for(var e=Object.keys(i),t=e.length,n=new Array(t);t--;)n[t]=[e[t],i[e[t]]];return n}var qfe=function(i){try{return i()}catch{return}},JJe=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return i.apply(this,t)}catch(r){yd.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),yd.critical(r)}}},tH=function(i){var e={};return zC(i,function(t,n){(U1(t)&&t.length>0||gx(t))&&(e[n]=t)}),e};function qJe(i,e){return t=i,n=a=>U1(a)&&!Iw(e)?a.slice(0,e):a,r=new Set,function a(o,s){return o!==Object(o)?n?n(o,s):o:r.has(o)?void 0:(r.add(o),qI(o)?(l=[],Ew(o,c=>{l.push(a(c))})):(l={},zC(o,(c,u)=>{r.has(c)||(l[u]=a(c,u))})),l);var l}(t);var t,n,r}var ZJe=["herokuapp.com","vercel.app","netlify.app"];function WJe(i){var e=i==null?void 0:i.hostname;if(!U1(e))return!1;var t=e.split(".").slice(-2).join(".");for(var n of ZJe)if(t===n)return!1;return!0}function Zfe(i,e){for(var t=0;t<i.length;t++)if(e(i[t]))return i[t]}function d1(i,e,t,n){var{capture:r=!1,passive:a=!0}=n??{};i==null||i.addEventListener(e,t,{capture:r,passive:a})}var Wfe="$people_distinct_id",LR="__alias",OR="__timers",Xfe="$autocapture_disabled_server_side",nH="$heatmaps_enabled_server_side",$fe="$exception_capture_enabled_server_side",iH="$error_tracking_suppression_rules",ehe="$web_vitals_enabled_server_side",the="$dead_clicks_enabled_server_side",nhe="$web_vitals_allowed_metrics",rH="$session_recording_enabled_server_side",ihe="$console_log_recording_enabled_server_side",rhe="$session_recording_network_payload_capture",ahe="$session_recording_masking",ohe="$session_recording_canvas_recording",she="$replay_sample_rate",lhe="$replay_minimum_duration",che="$replay_script_config",U8="$sesid",zR="$session_is_sampled",aH="$session_recording_url_trigger_activated_session",oH="$session_recording_event_trigger_activated_session",LM="$enabled_feature_flags",P8="$early_access_features",sH="$feature_flag_details",HR="$stored_person_properties",U9="$stored_group_properties",lH="$surveys",G8="$surveys_activated",F8="$flag_call_reported",fQ="$user_state",cH="$client_session_props",uH="$capture_rate_limit",AH="$initial_campaign_params",dH="$initial_referrer_info",k8="$initial_person_info",L8="$epp",uhe="__POSTHOG_TOOLBAR__",O8="$posthog_cookieless",XJe=[Wfe,LR,"__cmpns",OR,rH,nH,U8,LM,iH,fQ,P8,sH,U9,HR,lH,F8,cH,uH,AH,dH,L8,k8];function Ahe(i){return i instanceof Element&&(i.id===uhe||!(i.closest==null||!i.closest(".toolbar-global-fade-container")))}function z8(i){return!!i&&i.nodeType===1}function _w(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function dhe(i){return!!i&&i.nodeType===3}function fhe(i){return!!i&&i.nodeType===11}function fH(i){return i?M8(i).split(/\s+/):[]}function hhe(i){var e=Ka==null?void 0:Ka.location.href;return!!(e&&i&&i.some(t=>e.match(t)))}function H8(i){var e="";switch(typeof i.className){case"string":e=i.className;break;case"object":e=(i.className&&"baseVal"in i.className?i.className.baseVal:null)||i.getAttribute("class")||"";break;default:e=""}return fH(e)}function phe(i){return yv(i)?null:M8(i).split(/(\s+)/).filter(e=>OM(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Y8(i){var e="";return pH(i)&&!yhe(i)&&i.childNodes&&i.childNodes.length&&zC(i.childNodes,function(t){var n;dhe(t)&&t.textContent&&(e+=(n=phe(t.textContent))!==null&&n!==void 0?n:"")}),M8(e)}function ghe(i){return wu(i.target)?i.srcElement||null:(e=i.target)!=null&&e.shadowRoot?i.composedPath()[0]||null:i.target||null;var e}var hH=["a","button","form","input","select","textarea","label"];function mhe(i){var e=i.parentNode;return!(!e||!z8(e))&&e}function $Je(i,e,t,n,r){var a,o,s;if(t===void 0&&(t=void 0),!Ka||!i||_w(i,"html")||!z8(i)||(a=t)!=null&&a.url_allowlist&&!hhe(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&hhe(t.url_ignorelist))return!1;if((s=t)!=null&&s.dom_event_allowlist){var l=t.dom_event_allowlist;if(l&&!l.some(x=>e.type===x))return!1}for(var c=!1,u=[i],A=!0,f=i;f.parentNode&&!_w(f,"body");)if(fhe(f.parentNode))u.push(f.parentNode.host),f=f.parentNode.host;else{if(!(A=mhe(f)))break;if(n||hH.indexOf(A.tagName.toLowerCase())>-1)c=!0;else{var p=Ka.getComputedStyle(A);p&&p.getPropertyValue("cursor")==="pointer"&&(c=!0)}u.push(A),f=A}if(!function(x,b){var Q=b==null?void 0:b.element_allowlist;if(wu(Q))return!0;var R,k=function(Y){if(Q.some(J=>Y.tagName.toLowerCase()===J))return{v:!0}};for(var K of x)if(R=k(K))return R.v;return!1}(u,t)||!function(x,b){var Q=b==null?void 0:b.css_selector_allowlist;if(wu(Q))return!0;var R,k=function(Y){if(Q.some(J=>Y.matches(J)))return{v:!0}};for(var K of x)if(R=k(K))return R.v;return!1}(u,t))return!1;var v=Ka.getComputedStyle(i);if(v&&v.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var B=i.tagName.toLowerCase();switch(B){case"html":return!1;case"form":return(r||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(e.type)>=0;default:return c?(r||["click"]).indexOf(e.type)>=0:(r||["click"]).indexOf(e.type)>=0&&(hH.indexOf(B)>-1||i.getAttribute("contenteditable")==="true")}}function pH(i){for(var e=i;e.parentNode&&!_w(e,"body");e=e.parentNode){var t=H8(e);if(xm(t,"ph-sensitive")||xm(t,"ph-no-capture"))return!1}if(xm(H8(i),"ph-include"))return!0;var n=i.type||"";if(U1(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var r=i.name||i.id||"";return!(U1(r)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,"")))}function yhe(i){return!!(_w(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||_w(i,"select")||_w(i,"textarea")||i.getAttribute("contenteditable")==="true")}var vhe="(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})",eqe=new RegExp("^(?:"+vhe+")$"),tqe=new RegExp(vhe),Che="\\d{3}-?\\d{2}-?\\d{4}",nqe=new RegExp("^("+Che+")$"),iqe=new RegExp("("+Che+")");function OM(i,e){return e===void 0&&(e=!0),!(yv(i)||U1(i)&&(i=M8(i),(e?eqe:tqe).test((i||"").replace(/[- ]/g,""))||(e?nqe:iqe).test(i)))}function Ihe(i){var e=Y8(i);return OM(e=(e+" "+Ehe(i)).trim())?e:""}function Ehe(i){var e="";return i&&i.childNodes&&i.childNodes.length&&zC(i.childNodes,function(t){var n;if(t&&((n=t.tagName)==null?void 0:n.toLowerCase())==="span")try{var r=Y8(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Ehe(t)).trim())}catch(a){yd.error("[AutoCapture]",a)}}),e}function rqe(i){return function(e){var t=e.map(n=>{var r,a,o="";if(n.tag_name&&(o+=n.tag_name),n.attr_class)for(var s of(n.attr_class.sort(),n.attr_class))o+="."+s.replace(/"/g,"");var l=vA({},n.text?{text:n.text}:{},{"nth-child":(r=n.nth_child)!==null&&r!==void 0?r:0,"nth-of-type":(a=n.nth_of_type)!==null&&a!==void 0?a:0},n.href?{href:n.href}:{},n.attr_id?{attr_id:n.attr_id}:{},n.attributes),c={};return T8(l).sort((u,A)=>{var[f]=u,[p]=A;return f.localeCompare(p)}).forEach(u=>{var[A,f]=u;return c[_he(A.toString())]=_he(f.toString())}),o+=":",o+=T8(c).map(u=>{var[A,f]=u;return A+'="'+f+'"'}).join("")});return t.join(";")}(function(e){return e.map(t=>{var n,r,a={text:(n=t.$el_text)==null?void 0:n.slice(0,400),tag_name:t.tag_name,href:(r=t.attr__href)==null?void 0:r.slice(0,2048),attr_class:aqe(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return T8(t).filter(o=>{var[s]=o;return s.indexOf("attr__")===0}).forEach(o=>{var[s,l]=o;return a.attributes[s]=l}),a})}(i))}function _he(i){return i.replace(/"|\\"/g,'\\"')}function aqe(i){var e=i.attr__class;return e?qI(e)?e:fH(e):void 0}class xhe{constructor(){this.clicks=[]}isRageClick(e,t,n){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<30&&n-r.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}var oqe=["localhost","127.0.0.1"],zM=i=>{var e=YA==null?void 0:YA.createElement("a");return wu(e)?null:(e.href=i,e)},sqe=function(i,e){var t,n;e===void 0&&(e="&");var r=[];return zC(i,function(a,o){wu(a)||wu(o)||o==="undefined"||(t=encodeURIComponent((s=>s instanceof File)(a)?a.name:a.toString()),n=encodeURIComponent(o),r[r.length]=n+"="+t)}),r.join(e)},V8=function(i,e){for(var t,n=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<n.length;r++){var a=n[r].split("=");if(a[0]===e){t=a;break}}if(!qI(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{yd.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},gH=function(i,e,t){if(!i||!e||!e.length)return i;for(var n=i.split("#"),r=n[0]||"",a=n[1],o=r.split("?"),s=o[1],l=o[0],c=(s||"").split("&"),u=[],A=0;A<c.length;A++){var f=c[A].split("=");qI(f)&&(e.includes(f[0])?u.push(f[0]+"="+t):u.push(c[A]))}var p=l;return s!=null&&(p+="?"+u.join("&")),a!=null&&(p+="#"+a),p},K8=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Bhe=L_("[AutoCapture]");function mH(i,e){return e.length>i?e.slice(0,i)+"...":e}function lqe(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!z8(e));return e}function cqe(i,e,t,n){var r=i.tagName.toLowerCase(),a={tag_name:r};hH.indexOf(r)>-1&&!t&&(r.toLowerCase()==="a"||r.toLowerCase()==="button"?a.$el_text=mH(1024,Ihe(i)):a.$el_text=mH(1024,Y8(i)));var o=H8(i);o.length>0&&(a.classes=o.filter(function(u){return u!==""})),zC(i.attributes,function(u){var A;if((!yhe(i)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(n==null||!n.includes(u.name))&&!e&&OM(u.value)&&(A=u.name,!U1(A)||A.substring(0,10)!=="_ngcontent"&&A.substring(0,7)!=="_nghost")){var f=u.value;u.name==="class"&&(f=fH(f).join(" ")),a["attr__"+u.name]=mH(1024,f)}});for(var s=1,l=1,c=i;c=lqe(c);)s++,c.tagName===i.tagName&&l++;return a.nth_child=s,a.nth_of_type=l,a}function uqe(i,e){for(var t,n,{e:r,maskAllElementAttributes:a,maskAllText:o,elementAttributeIgnoreList:s,elementsChainAsString:l}=e,c=[i],u=i;u.parentNode&&!_w(u,"body");)fhe(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var A,f=[],p={},v=!1,B=!1;if(zC(c,k=>{var K=pH(k);k.tagName.toLowerCase()==="a"&&(v=k.getAttribute("href"),v=K&&v&&OM(v)&&v),xm(H8(k),"ph-no-capture")&&(B=!0),f.push(cqe(k,a,o,s));var Y=function(J){if(!pH(J))return{};var W={};return zC(J.attributes,function($){if($.name&&$.name.indexOf("data-ph-capture-attribute")===0){var X=$.name.replace("data-ph-capture-attribute-",""),de=$.value;X&&de&&OM(de)&&(W[X]=de)}}),W}(k);bE(p,Y)}),B)return{props:{},explicitNoCapture:B};if(o||(i.tagName.toLowerCase()==="a"||i.tagName.toLowerCase()==="button"?f[0].$el_text=Ihe(i):f[0].$el_text=Y8(i)),v){var x,b;f[0].attr__href=v;var Q=(x=zM(v))==null?void 0:x.host,R=Ka==null||(b=Ka.location)==null?void 0:b.host;Q&&R&&Q!==R&&(A=v)}return{props:bE({$event_type:r.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:rqe(f)},(t=f[0])!=null&&t.$el_text?{$el_text:(n=f[0])==null?void 0:n.$el_text}:{},A&&r.type==="click"?{$external_click_url:A}:{},p)}}class Aqe{constructor(e){this.i=!1,this.o=null,this.rageclicks=new xhe,this.h=!1,this.instance=e,this.m=null}get S(){var e,t,n=T1(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map(r=>new RegExp(r)),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map(r=>new RegExp(r)),n}$(){if(this.isBrowserSupported()){if(Ka&&YA){var e=n=>{n=n||(Ka==null?void 0:Ka.event);try{this.k(n)}catch(r){Bhe.error("Failed to capture event",r)}};if(d1(YA,"submit",e,{capture:!0}),d1(YA,"change",e,{capture:!0}),d1(YA,"click",e,{capture:!0}),this.S.capture_copied_text){var t=n=>{n=n||(Ka==null?void 0:Ka.event),this.k(n,Xz)};d1(YA,"copy",t,{capture:!0}),d1(YA,"cut",t,{capture:!0})}}}else Bhe.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.i&&(this.$(),this.i=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.h=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Xfe]:!!e.autocapture_opt_out}),this.o=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.m=e}getElementSelectors(e){var t,n=[];return(t=this.m)==null||t.forEach(r=>{var a=YA==null?void 0:YA.querySelectorAll(r);a==null||a.forEach(o=>{e===o&&n.push(r)})}),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[Xfe],r=this.o;if(Iw(r)&&!fS(n)&&!this.instance.I())return!1;var a=(t=this.o)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!a}k(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,r=ghe(e);dhe(r)&&(r=r.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.k(e,"$rageclick");var a=t===Xz;if(r&&$Je(r,e,this.S,a,a?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:s}=uqe(r,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.S.element_attribute_ignorelist,elementsChainAsString:this.h});if(s)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(o.$element_selectors=l),t===Xz){var c,u=phe(Ka==null||(c=Ka.getSelection())==null?void 0:c.toString()),A=e.type||"clipboard";if(!u)return!1;o.$selected_content=u,o.$copy_type=A}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return ob(YA==null?void 0:YA.querySelectorAll)}}Math.trunc||(Math.trunc=function(i){return i<0?Math.ceil(i):Math.floor(i)}),Number.isInteger||(Number.isInteger=function(i){return gx(i)&&isFinite(i)&&Math.floor(i)===i});var bhe="0123456789abcdef";class j8{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,n,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||e<0||t<0||n<0||r<0||e>0xffffffffffff||t>4095||n>1073741823||r>4294967295)throw new RangeError("invalid field value");var a=new Uint8Array(16);return a[0]=e/Math.pow(2,40),a[1]=e/Math.pow(2,32),a[2]=e/Math.pow(2,24),a[3]=e/Math.pow(2,16),a[4]=e/Math.pow(2,8),a[5]=e,a[6]=112|t>>>8,a[7]=t,a[8]=128|n>>>24,a[9]=n>>>16,a[10]=n>>>8,a[11]=n,a[12]=r>>>24,a[13]=r>>>16,a[14]=r>>>8,a[15]=r,new j8(a)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+bhe.charAt(this.bytes[t]>>>4)+bhe.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new j8(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var n=this.bytes[t]-e.bytes[t];if(n!==0)return Math.sign(n)}return 0}}class dqe{constructor(){this.P=0,this.R=0,this.T=new fqe}generate(){var e=this.generateOrAbort();if(wu(e)){this.P=0;var t=this.generateOrAbort();if(wu(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.P)this.P=e,this.M();else{if(!(e+1e4>this.P))return;this.R++,this.R>4398046511103&&(this.P++,this.M())}return j8.fromFieldsV7(this.P,Math.trunc(this.R/Math.pow(2,30)),this.R&Math.pow(2,30)-1,this.T.nextUint32())}M(){this.R=1024*this.T.nextUint32()+(1023&this.T.nextUint32())}}var She,Qhe=i=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<i.length;e++)i[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return i};Ka&&!wu(Ka.crypto)&&crypto.getRandomValues&&(Qhe=i=>crypto.getRandomValues(i));class fqe{constructor(){this.C=new Uint32Array(8),this.F=1/0}nextUint32(){return this.F>=this.C.length&&(Qhe(this.C),this.F=0),this.C[this.F++]}}var xw=()=>hqe().toString(),hqe=()=>(She||(She=new dqe)).generate(),YR="",pqe=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function gqe(i,e){if(e){var t=function(r,a){if(a===void 0&&(a=YA),YR)return YR;if(!a||["localhost","127.0.0.1"].includes(r))return"";for(var o=r.split("."),s=Math.min(o.length,8),l="dmn_chk_"+xw();!YR&&s--;){var c=o.slice(s).join("."),u=l+"=1;domain=."+c+";path=/";a.cookie=u+";max-age=3",a.cookie.includes(l)&&(a.cookie=u+";max-age=0",YR=c)}return YR}(i);if(!t){var n=(r=>{var a=r.match(pqe);return a?a[0]:""})(i);n!==t&&yd.info("Warning: cookie subdomain discovery mismatch",n,t),t=n}return t?"; domain=."+t:""}return""}var hQ={O:()=>!!YA,A:function(i){yd.error("cookieStore error: "+i)},D:function(i){if(YA){try{for(var e=i+"=",t=YA.cookie.split(";").filter(a=>a.length),n=0;n<t.length;n++){for(var r=t[n];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return decodeURIComponent(r.substring(e.length,r.length))}}catch{}return null}},L:function(i){var e;try{e=JSON.parse(hQ.D(i))||{}}catch{}return e},j:function(i,e,t,n,r){if(YA)try{var a="",o="",s=gqe(YA.location.hostname,n);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),a="; expires="+l.toUTCString()}r&&(o="; secure");var c=i+"="+encodeURIComponent(JSON.stringify(e))+a+"; SameSite=Lax; path=/"+s+o;return c.length>3686.4&&yd.warn("cookieStore warning: large cookie, len="+c.length),YA.cookie=c,c}catch{return}},N:function(i,e){try{hQ.j(i,"",-1,e)}catch{return}}},yH=null,VE={O:function(){if(!Iw(yH))return yH;var i=!0;if(wu(Ka))i=!1;else try{var e="__mplssupport__";VE.j(e,"xyz"),VE.D(e)!=='"xyz"'&&(i=!1),VE.N(e)}catch{i=!1}return i||yd.error("localStorage unsupported; falling back to cookie store"),yH=i,i},A:function(i){yd.error("localStorage error: "+i)},D:function(i){try{return Ka==null?void 0:Ka.localStorage.getItem(i)}catch(e){VE.A(e)}return null},L:function(i){try{return JSON.parse(VE.D(i))||{}}catch{}return null},j:function(i,e){try{Ka==null||Ka.localStorage.setItem(i,JSON.stringify(e))}catch(t){VE.A(t)}},N:function(i){try{Ka==null||Ka.localStorage.removeItem(i)}catch(e){VE.A(e)}}},mqe=["distinct_id",U8,zR,L8,k8],J8=vA({},VE,{L:function(i){try{var e={};try{e=hQ.L(i)||{}}catch{}var t=bE(e,JSON.parse(VE.D(i)||"{}"));return VE.j(i,t),t}catch{}return null},j:function(i,e,t,n,r,a){try{VE.j(i,e,void 0,void 0,a);var o={};mqe.forEach(s=>{e[s]&&(o[s]=e[s])}),Object.keys(o).length&&hQ.j(i,o,t,n,r,a)}catch(s){VE.A(s)}},N:function(i,e){try{Ka==null||Ka.localStorage.removeItem(i),hQ.N(i,e)}catch(t){VE.A(t)}}}),q8={},yqe={O:function(){return!0},A:function(i){yd.error("memoryStorage error: "+i)},D:function(i){return q8[i]||null},L:function(i){return q8[i]||null},j:function(i,e){q8[i]=e},N:function(i){delete q8[i]}},P9=null,O_={O:function(){if(!Iw(P9))return P9;if(P9=!0,wu(Ka))P9=!1;else try{var i="__support__";O_.j(i,"xyz"),O_.D(i)!=='"xyz"'&&(P9=!1),O_.N(i)}catch{P9=!1}return P9},A:function(i){yd.error("sessionStorage error: ",i)},D:function(i){try{return Ka==null?void 0:Ka.sessionStorage.getItem(i)}catch(e){O_.A(e)}return null},L:function(i){try{return JSON.parse(O_.D(i))||null}catch{}return null},j:function(i,e){try{Ka==null||Ka.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){O_.A(t)}},N:function(i){try{Ka==null||Ka.sessionStorage.removeItem(i)}catch(e){O_.A(e)}}},HM=function(i){return i[i.PENDING=-1]="PENDING",i[i.DENIED=0]="DENIED",i[i.GRANTED=1]="GRANTED",i}({});class vqe{constructor(e){this._instance=e}get S(){return this._instance.config}get consent(){return this.U()?HM.DENIED:this.q}isOptedOut(){return this.consent===HM.DENIED||this.consent===HM.PENDING&&this.S.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(e){this.B.j(this.H,e?1:0,this.S.cookie_expiration,this.S.cross_subdomain_cookie,this.S.secure_cookie)}reset(){this.B.N(this.H,this.S.cross_subdomain_cookie)}get H(){var{token:e,opt_out_capturing_cookie_prefix:t}=this._instance.config;return(t||"__ph_opt_in_out_")+e}get q(){var e=this.B.D(this.H);return e==="1"?HM.GRANTED:e==="0"?HM.DENIED:HM.PENDING}get B(){if(!this.W){var e=this.S.opt_out_capturing_persistence_type;this.W=e==="localStorage"?VE:hQ;var t=e==="localStorage"?hQ:VE;t.D(this.H)&&(this.W.D(this.H)||this.optInOut(t.D(this.H)==="1"),t.N(this.H,this.S.cross_subdomain_cookie))}return this.W}U(){return!!this.S.respect_dnt&&!!Zfe([PB==null?void 0:PB.doNotTrack,PB==null?void 0:PB.msDoNotTrack,E0.doNotTrack],e=>xm([!0,1,"1","yes"],e))}}var Z8=L_("[Dead Clicks]"),Cqe=()=>!0,Iqe=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(the)),n=i.instance.config.capture_dead_clicks;return fS(n)?n:t};class whe{get lazyLoadedDeadClicksAutocapture(){return this.G}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[the]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.J(()=>{this.V()})}J(e){var t,n;(t=E0.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=E0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",r=>{r?Z8.error("failed to load script",r):e()})}V(){var e;if(YA){if(!this.G&&(e=E0.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=T1(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.G=E0.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.G.start(YA),Z8.info("starting...")}}else Z8.error("`document` not found. Cannot start.")}stop(){this.G&&(this.G.stop(),this.G=void 0,Z8.info("stopping..."))}}function GB(i,e,t,n,r){return e>t&&(yd.warn("min cannot be greater than max."),e=t),gx(i)?i>t?(n&&yd.warn(n+" cannot be greater than max: "+t+". Using max value instead."),t):i<e?(n&&yd.warn(n+" cannot be less than min: "+e+". Using min value instead."),e):i:(n&&yd.warn(n+" must be a number. using max or fallback. max: "+t+", fallback: "+r),GB(r||t,e,t,n))}class Mhe{constructor(e){this.K={},this.Y=()=>{Object.keys(this.K).forEach(t=>{var n=this.X(t)+this.Z;n>=this.tt?delete this.K[t]:this.it(t,n)})},this.X=t=>this.K[String(t)],this.it=(t,n)=>{this.K[String(t)]=n},this.consumeRateLimit=t=>{var n,r=(n=this.X(t))!==null&&n!==void 0?n:this.tt;if((r=Math.max(r-1,0))===0)return!0;this.it(t,r);var a,o=r===0;return o&&((a=this.et)==null||a.call(this,t)),o},this.rt=e,this.et=this.rt.et,this.tt=GB(this.rt.bucketSize,0,100,"rate limiter bucket size"),this.Z=GB(this.rt.refillRate,0,this.tt,"rate limiter refill rate"),this.st=GB(this.rt.refillInterval,0,864e5,"rate limiter refill interval"),setInterval(()=>{this.Y()},this.st)}}var W8=L_("[ExceptionAutocapture]");class Eqe{constructor(e){var t,n,r;this.nt=()=>{var a;if(Ka&&this.isEnabled&&(a=E0.__PosthogExtensions__)!=null&&a.errorWrappingFunctions){var o=E0.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=E0.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=E0.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ot&&this.S.capture_unhandled_errors&&(this.ot=o(this.captureException.bind(this))),!this.lt&&this.S.capture_unhandled_rejections&&(this.lt=s(this.captureException.bind(this))),!this.ut&&this.S.capture_console_errors&&(this.ut=l(this.captureException.bind(this)))}catch(c){W8.error("failed to start",c),this.ht()}}},this._instance=e,this.dt=!((t=this._instance.persistence)==null||!t.props[$fe]),this.S=this.vt(),this.ct=new Mhe({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4}),this.startIfEnabled()}vt(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return T1(e)?t=vA({},t,e):(wu(e)?this.dt:e)&&(t=vA({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.S.capture_console_errors||this.S.capture_unhandled_errors||this.S.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(W8.info("enabled"),this.J(this.nt))}J(e){var t,n;(t=E0.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=E0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",r=>{if(r)return W8.error("failed to load script",r);e()})}ht(){var e,t,n;(e=this.ot)==null||e.call(this),this.ot=void 0,(t=this.lt)==null||t.call(this),this.lt=void 0,(n=this.ut)==null||n.call(this),this.ut=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.dt=!!t||!1,this.S=this.vt(),this._instance.persistence&&this._instance.persistence.register({[$fe]:this.dt}),this.startIfEnabled()}captureException(e){var t,n=this._instance.requestRouter.endpointFor("ui");e.$exception_personURL=n+"/project/"+this._instance.config.token+"/person/"+this._instance.get_distinct_id();var r=(t=e.$exception_list[0].type)!==null&&t!==void 0?t:"Exception";this.ct.consumeRateLimit(r)?W8.info("Skipping exception capture because of client rate limiting.",{exception:e.$exception_list[0].type}):this._instance.exceptions.sendExceptionEvent(e)}}function Dhe(i){return!wu(Event)&&Rhe(i,Event)}function Rhe(i,e){try{return i instanceof e}catch{return!1}}function Nhe(i){switch(Object.prototype.toString.call(i)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return Rhe(i,Error)}}function X8(i,e){return Object.prototype.toString.call(i)==="[object "+e+"]"}function vH(i){return X8(i,"DOMError")}var The=/\(error: (.*)\)/,Uhe=50,YM="?";function CH(i,e,t,n){var r={platform:"web:javascript",filename:i,function:e==="<anonymous>"?YM:e,in_app:!0};return wu(t)||(r.lineno=t),wu(n)||(r.colno=n),r}var _qe=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,xqe=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Bqe=/\((\S*)(?::(\d+))(?::(\d+))\)/,bqe=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Sqe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Qqe=function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];var n=e.sort((r,a)=>r[0]-a[0]).map(r=>r[1]);return function(r,a){a===void 0&&(a=0);for(var o=[],s=r.split(`
|
|
242
242
|
`),l=a;l<s.length;l++){var c=s[l];if(!(c.length>1024)){var u=The.test(c)?c.replace(The,"$1"):c;if(!u.match(/\S*Error: /)){for(var A of n){var f=A(u);if(f){o.push(f);break}}if(o.length>=Uhe)break}}}return function(p){if(!p.length)return[];var v=Array.from(p);return v.reverse(),v.slice(0,Uhe).map(B=>vA({},B,{filename:B.filename||wqe(v).filename,function:B.function||YM}))}(o)}}([30,i=>{var e=_qe.exec(i);if(e){var[,t,n,r]=e;return CH(t,YM,+n,+r)}var a=xqe.exec(i);if(a){if(a[2]&&a[2].indexOf("eval")===0){var o=Bqe.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[s,l]=Ghe(a[1]||YM,a[2]);return CH(l,s,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}}],[50,i=>{var e=bqe.exec(i);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var t=Sqe.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}var n=e[3],r=e[1]||YM;return[r,n]=Ghe(r,n),CH(n,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]);function wqe(i){return i[i.length-1]||{}}var $8,Phe,IH,Ghe=(i,e)=>{var t=i.indexOf("safari-extension")!==-1,n=i.indexOf("safari-web-extension")!==-1;return t||n?[i.indexOf("@")!==-1?i.split("@")[0]:YM,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},Mqe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function EH(i,e){e===void 0&&(e=0);var t=i.stacktrace||i.stack||"",n=function(o){return o&&Dqe.test(o.message)?1:0}(i);try{var r=Qqe,a=function(o,s){var l=function(c){var u=globalThis._posthogChunkIds;if(!u)return{};var A=Object.keys(u);return IH&&A.length===Phe||(Phe=A.length,IH=A.reduce((f,p)=>{$8||($8={});var v=$8[p];if(v)f[v[0]]=v[1];else for(var B=c(p),x=B.length-1;x>=0;x--){var b=B[x],Q=b==null?void 0:b.filename,R=u[p];if(Q&&R){f[Q]=R,$8[p]=[Q,R];break}}return f},{})),IH}(s);return o.forEach(c=>{c.filename&&(c.chunk_id=l[c.filename])}),o}(r(t,n),r);return a.slice(0,a.length-e)}catch{}return[]}var Dqe=/Minified React error #\d+;/i;function Rqe(i,e){var t,n,r=EH(i),a=(t=e==null?void 0:e.handled)===null||t===void 0||t,o=(n=e==null?void 0:e.synthetic)!==null&&n!==void 0&&n;return{type:e!=null&&e.overrideExceptionType?e.overrideExceptionType:i.name,value:function(s){var l=s.message;return l.error&&typeof l.error.message=="string"?String(l.error.message):String(l)}(i),stacktrace:{frames:r,type:"raw"},mechanism:{handled:a,synthetic:o}}}function Fhe(i,e){var t=Rqe(i,e);return i.cause&&Nhe(i.cause)&&i.cause!==i?[t,...Fhe(i.cause,{handled:e==null?void 0:e.handled,synthetic:e==null?void 0:e.synthetic})]:[t]}function _H(i,e){return{$exception_list:Fhe(i,e),$exception_level:"error"}}function xH(i,e){var t,n,r,a=(t=e==null?void 0:e.handled)===null||t===void 0||t,o=(n=e==null?void 0:e.synthetic)===null||n===void 0||n,s={type:e!=null&&e.overrideExceptionType?e.overrideExceptionType:(r=e==null?void 0:e.defaultExceptionType)!==null&&r!==void 0?r:"Error",value:i||(e==null?void 0:e.defaultExceptionMessage),mechanism:{handled:a,synthetic:o}};if(e!=null&&e.syntheticException){var l=EH(e.syntheticException,1);l.length&&(s.stacktrace={frames:l,type:"raw"})}return{$exception_list:[s],$exception_level:"error"}}function Nqe(i){return U1(i)&&!eH(i)&&HJe.indexOf(i)>=0}function Tqe(i,e){var t,n,r=(t=e==null?void 0:e.handled)===null||t===void 0||t,a=(n=e==null?void 0:e.synthetic)===null||n===void 0||n,o=e!=null&&e.overrideExceptionType?e.overrideExceptionType:Dhe(i)?i.constructor.name:"Error",s="Non-Error 'exception' captured with keys: "+function(u,A){A===void 0&&(A=40);var f=Object.keys(u);if(f.sort(),!f.length)return"[object has no keys]";for(var p=f.length;p>0;p--){var v=f.slice(0,p).join(", ");if(!(v.length>A))return p===f.length||v.length<=A?v:v.slice(0,A)+"..."}return""}(i),l={type:o,value:s,mechanism:{handled:r,synthetic:a}};if(e!=null&&e.syntheticException){var c=EH(e==null?void 0:e.syntheticException,1);c.length&&(l.stacktrace={frames:c,type:"raw"})}return{$exception_list:[l],$exception_level:Nqe(i.level)?i.level:"error"}}function Uqe(i,e){var{error:t,event:n}=i,r={$exception_list:[]},a=t||n;if(vH(a)||function(f){return X8(f,"DOMException")}(a)){var o=a;if(function(f){return"stack"in f}(a))r=_H(a,e);else{var s=o.name||(vH(o)?"DOMError":"DOMException"),l=o.message?s+": "+o.message:s;r=xH(l,vA({},e,{overrideExceptionType:vH(o)?"DOMError":"DOMException",defaultExceptionMessage:l}))}return"code"in o&&(r.$exception_DOMException_code=""+o.code),r}if(function(f){return X8(f,"ErrorEvent")}(a)&&a.error)return _H(a.error,e);if(Nhe(a))return _H(a,e);if(function(f){return X8(f,"Object")}(a)||Dhe(a))return Tqe(a,e);if(wu(t)&&U1(n)){var c="Error",u=n,A=n.match(Mqe);return A&&(c=A[1],u=A[2]),xH(u,vA({},e,{overrideExceptionType:c,defaultExceptionMessage:u}))}return xH(a,e)}function khe(i,e,t){try{if(!(e in i))return()=>{};var n=i[e],r=t(n);return ob(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),i[e]=r,()=>{i[e]=n}}catch{return()=>{}}}class Pqe{constructor(e){var t;this._instance=e,this.ft=(Ka==null||(t=Ka.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(yd.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.gt&&this.gt(),this.gt=void 0,yd.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(Ka&&Ka.history){var n=this;(e=Ka.history.pushState)!=null&&e.__posthog_wrapped__||khe(Ka.history,"pushState",r=>function(a,o,s){r.call(this,a,o,s),n._t("pushState")}),(t=Ka.history.replaceState)!=null&&t.__posthog_wrapped__||khe(Ka.history,"replaceState",r=>function(a,o,s){r.call(this,a,o,s),n._t("replaceState")}),this.bt()}}_t(e){try{var t,n=Ka==null||(t=Ka.location)==null?void 0:t.pathname;if(!n)return;n!==this.ft&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ft=n}catch(r){yd.error("Error capturing "+e+" pageview",r)}}bt(){if(!this.gt){var e=()=>{this._t("popstate")};d1(Ka,"popstate",e),this.gt=()=>{Ka&&Ka.removeEventListener("popstate",e)}}}}function eU(i){var e,t;return((e=JSON.stringify(i,(t=[],function(n,r){if(T1(r)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(r)?"[Circular]":(t.push(r),r)}return r})))==null?void 0:e.length)||0}function BH(i,e){if(e===void 0&&(e=66060288e-1),i.size>=e&&i.data.length>1){var t=Math.floor(i.data.length/2),n=i.data.slice(0,t),r=i.data.slice(t);return[BH({size:eU(n),data:n,sessionId:i.sessionId,windowId:i.windowId}),BH({size:eU(r),data:r,sessionId:i.sessionId,windowId:i.windowId})].flatMap(a=>a)}return[i]}var pQ=(i=>(i[i.DomContentLoaded=0]="DomContentLoaded",i[i.Load=1]="Load",i[i.FullSnapshot=2]="FullSnapshot",i[i.IncrementalSnapshot=3]="IncrementalSnapshot",i[i.Meta=4]="Meta",i[i.Custom=5]="Custom",i[i.Plugin=6]="Plugin",i))(pQ||{}),Pb=(i=>(i[i.Mutation=0]="Mutation",i[i.MouseMove=1]="MouseMove",i[i.MouseInteraction=2]="MouseInteraction",i[i.Scroll=3]="Scroll",i[i.ViewportResize=4]="ViewportResize",i[i.Input=5]="Input",i[i.TouchMove=6]="TouchMove",i[i.MediaInteraction=7]="MediaInteraction",i[i.StyleSheetRule=8]="StyleSheetRule",i[i.CanvasMutation=9]="CanvasMutation",i[i.Font=10]="Font",i[i.Log=11]="Log",i[i.Drag=12]="Drag",i[i.StyleDeclaration=13]="StyleDeclaration",i[i.Selection=14]="Selection",i[i.AdoptedStyleSheet=15]="AdoptedStyleSheet",i[i.CustomElement=16]="CustomElement",i))(Pb||{}),bH="[SessionRecording]",SH="redacted",tU={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:i=>i,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com","bam.nr-data.net"]},Gqe=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],Fqe=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],kqe=["/s/","/e/","/i/"];function Lhe(i,e,t,n){if(yv(i))return i;var r=(e==null?void 0:e["content-length"])||function(a){return new Blob([a]).size}(i);return U1(r)&&(r=parseInt(r)),r>t?bH+" "+n+" body too large to record ("+r+" bytes)":i}function Ohe(i,e){if(yv(i))return i;var t=i;return OM(t,!1)||(t=bH+" "+e+" body "+SH),zC(Fqe,n=>{var r,a;(r=t)!=null&&r.length&&((a=t)==null?void 0:a.indexOf(n))!==-1&&(t=bH+" "+e+" body "+SH+" as might contain: "+n)}),t}var Lqe=(i,e)=>{var t,n,r,a={payloadSizeLimitBytes:tU.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...tU.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...tU.payloadHostDenyList]},o=i.session_recording.recordHeaders!==!1&&e.recordHeaders,s=i.session_recording.recordBody!==!1&&e.recordBody,l=i.capture_performance!==!1&&e.recordPerformance,c=(t=a,r=Math.min(1e6,(n=t.payloadSizeLimitBytes)!==null&&n!==void 0?n:1e6),f=>(f!=null&&f.requestBody&&(f.requestBody=Lhe(f.requestBody,f.requestHeaders,r,"Request")),f!=null&&f.responseBody&&(f.responseBody=Lhe(f.responseBody,f.responseHeaders,r,"Response")),f)),u=f=>{return c(((B,x)=>{var b,Q=zM(B.name),R=x.indexOf("http")===0?(b=zM(x))==null?void 0:b.pathname:x;R==="/"&&(R="");var k=Q==null?void 0:Q.pathname.replace(R||"","");if(!(Q&&k&&kqe.some(K=>k.indexOf(K)===0)))return B})((v=(p=f).requestHeaders,yv(v)||zC(Object.keys(v??{}),B=>{Gqe.includes(B.toLowerCase())&&(v[B]=SH)}),p),i.api_host));var p,v},A=ob(i.session_recording.maskNetworkRequestFn);return A&&ob(i.session_recording.maskCapturedNetworkRequestFn)&&yd.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),A&&(i.session_recording.maskCapturedNetworkRequestFn=f=>{var p=i.session_recording.maskNetworkRequestFn({url:f.name});return vA({},f,{name:p==null?void 0:p.url})}),a.maskRequestFn=ob(i.session_recording.maskCapturedNetworkRequestFn)?f=>{var p,v=u(f);return v&&(p=i.session_recording.maskCapturedNetworkRequestFn==null?void 0:i.session_recording.maskCapturedNetworkRequestFn(v))!==null&&p!==void 0?p:void 0}:f=>function(p){if(!wu(p))return p.requestBody=Ohe(p.requestBody,"Request"),p.responseBody=Ohe(p.responseBody,"Response"),p}(u(f)),vA({},tU,a,{recordHeaders:o,recordBody:s,recordPerformance:l,recordInitialRequests:l})};class Oqe{constructor(e,t){var n,r;t===void 0&&(t={}),this.yt={},this.wt=a=>{if(!this.yt[a]){var o,s;this.yt[a]=!0;var l=this.St(a);(o=(s=this.rt).onBlockedNode)==null||o.call(s,a,l)}},this.$t=a=>{var o=this.St(a);if((o==null?void 0:o.nodeName)!=="svg"&&o instanceof Element){var s=o.closest("svg");if(s)return[this._rrweb.mirror.getId(s),s]}return[a,o]},this.St=a=>this._rrweb.mirror.getNode(a),this.kt=a=>{var o,s,l,c,u,A,f,p;return((o=(s=a.removes)==null?void 0:s.length)!==null&&o!==void 0?o:0)+((l=(c=a.attributes)==null?void 0:c.length)!==null&&l!==void 0?l:0)+((u=(A=a.texts)==null?void 0:A.length)!==null&&u!==void 0?u:0)+((f=(p=a.adds)==null?void 0:p.length)!==null&&f!==void 0?f:0)},this.throttleMutations=a=>{if(a.type!==3||a.data.source!==0)return a;var o=a.data,s=this.kt(o);o.attributes&&(o.attributes=o.attributes.filter(c=>{var[u]=this.$t(c.id);return!this.ct.consumeRateLimit(u)&&c}));var l=this.kt(o);return l!==0||s===l?a:void 0},this._rrweb=e,this.rt=t,this.ct=new Mhe({bucketSize:(n=this.rt.bucketSize)!==null&&n!==void 0?n:100,refillRate:(r=this.rt.refillRate)!==null&&r!==void 0?r:10,refillInterval:1e3,et:this.wt})}}var sb=Uint8Array,cB=Uint16Array,VM=Uint32Array,QH=new sb([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]),wH=new sb([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]),zhe=new sb([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Hhe=function(i,e){for(var t=new cB(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];var r=new VM(t[30]);for(n=1;n<30;++n)for(var a=t[n];a<t[n+1];++a)r[a]=a-t[n]<<5|n;return[t,r]},Yhe=Hhe(QH,2),zqe=Yhe[0],MH=Yhe[1];zqe[28]=258,MH[258]=28;for(var Vhe=Hhe(wH,0)[1],Khe=new cB(32768),FI=0;FI<32768;++FI){var G9=(43690&FI)>>>1|(21845&FI)<<1;G9=(61680&(G9=(52428&G9)>>>2|(13107&G9)<<2))>>>4|(3855&G9)<<4,Khe[FI]=((65280&G9)>>>8|(255&G9)<<8)>>>1}var VR=function(i,e,t){for(var n=i.length,r=0,a=new cB(e);r<n;++r)++a[i[r]-1];var o,s=new cB(e);for(r=0;r<e;++r)s[r]=s[r-1]+a[r-1]<<1;for(o=new cB(n),r=0;r<n;++r)o[r]=Khe[s[i[r]-1]++]>>>15-i[r];return o},F9=new sb(288);for(FI=0;FI<144;++FI)F9[FI]=8;for(FI=144;FI<256;++FI)F9[FI]=9;for(FI=256;FI<280;++FI)F9[FI]=7;for(FI=280;FI<288;++FI)F9[FI]=8;var nU=new sb(32);for(FI=0;FI<32;++FI)nU[FI]=5;var Hqe=VR(F9,9),Yqe=VR(nU,5),jhe=function(i){return(i/8>>0)+(7&i&&1)},Jhe=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var n=new(i instanceof cB?cB:i instanceof VM?VM:sb)(t-e);return n.set(i.subarray(e,t)),n},gQ=function(i,e,t){t<<=7&e;var n=e/8>>0;i[n]|=t,i[n+1]|=t>>>8},KR=function(i,e,t){t<<=7&e;var n=e/8>>0;i[n]|=t,i[n+1]|=t>>>8,i[n+2]|=t>>>16},DH=function(i,e){for(var t=[],n=0;n<i.length;++n)i[n]&&t.push({s:n,f:i[n]});var r=t.length,a=t.slice();if(!r)return[new sb(0),0];if(r==1){var o=new sb(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort(function(K,Y){return K.f-Y.f}),t.push({s:-1,f:25001});var s=t[0],l=t[1],c=0,u=1,A=2;for(t[0]={s:-1,f:s.f+l.f,l:s,r:l};u!=r-1;)s=t[t[c].f<t[A].f?c++:A++],l=t[c!=u&&t[c].f<t[A].f?c++:A++],t[u++]={s:-1,f:s.f+l.f,l:s,r:l};var f=a[0].s;for(n=1;n<r;++n)a[n].s>f&&(f=a[n].s);var p=new cB(f+1),v=RH(t[u-1],p,0);if(v>e){n=0;var B=0,x=v-e,b=1<<x;for(a.sort(function(K,Y){return p[Y.s]-p[K.s]||K.f-Y.f});n<r;++n){var Q=a[n].s;if(!(p[Q]>e))break;B+=b-(1<<v-p[Q]),p[Q]=e}for(B>>>=x;B>0;){var R=a[n].s;p[R]<e?B-=1<<e-p[R]++-1:++n}for(;n>=0&&B;--n){var k=a[n].s;p[k]==e&&(--p[k],++B)}v=e}return[new sb(p),v]},RH=function(i,e,t){return i.s==-1?Math.max(RH(i.l,e,t+1),RH(i.r,e,t+1)):e[i.s]=t},qhe=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new cB(++e),n=0,r=i[0],a=1,o=function(l){t[n++]=l},s=1;s<=e;++s)if(i[s]==r&&s!=e)++a;else{if(!r&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(r),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(r);a=1,r=i[s]}return[t.subarray(0,n),e]},jR=function(i,e){for(var t=0,n=0;n<e.length;++n)t+=i[n]*e[n];return t},NH=function(i,e,t){var n=t.length,r=jhe(e+2);i[r]=255&n,i[r+1]=n>>>8,i[r+2]=255^i[r],i[r+3]=255^i[r+1];for(var a=0;a<n;++a)i[r+a+4]=t[a];return 8*(r+4+n)},Zhe=function(i,e,t,n,r,a,o,s,l,c,u){gQ(e,u++,t),++r[256];for(var A=DH(r,15),f=A[0],p=A[1],v=DH(a,15),B=v[0],x=v[1],b=qhe(f),Q=b[0],R=b[1],k=qhe(B),K=k[0],Y=k[1],J=new cB(19),W=0;W<Q.length;++W)J[31&Q[W]]++;for(W=0;W<K.length;++W)J[31&K[W]]++;for(var $=DH(J,7),X=$[0],de=$[1],ue=19;ue>4&&!X[zhe[ue-1]];--ue);var ge,be,Qe,ve,Be=c+5<<3,Ie=jR(r,F9)+jR(a,nU)+o,Te=jR(r,f)+jR(a,B)+o+14+3*ue+jR(J,X)+(2*J[16]+3*J[17]+7*J[18]);if(Be<=Ie&&Be<=Te)return NH(e,u,i.subarray(l,l+c));if(gQ(e,u,1+(Te<Ie)),u+=2,Te<Ie){ge=VR(f,p),be=f,Qe=VR(B,x),ve=B;var Ne=VR(X,de);for(gQ(e,u,R-257),gQ(e,u+5,Y-1),gQ(e,u+10,ue-4),u+=14,W=0;W<ue;++W)gQ(e,u+3*W,X[zhe[W]]);u+=3*ue;for(var Le=[Q,K],Pe=0;Pe<2;++Pe){var rt=Le[Pe];for(W=0;W<rt.length;++W){var $e=31&rt[W];gQ(e,u,Ne[$e]),u+=X[$e],$e>15&&(gQ(e,u,rt[W]>>>5&127),u+=rt[W]>>>12)}}}else ge=Hqe,be=F9,Qe=Yqe,ve=nU;for(W=0;W<s;++W)if(n[W]>255){$e=n[W]>>>18&31,KR(e,u,ge[$e+257]),u+=be[$e+257],$e>7&&(gQ(e,u,n[W]>>>23&31),u+=QH[$e]);var pt=31&n[W];KR(e,u,Qe[pt]),u+=ve[pt],pt>3&&(KR(e,u,n[W]>>>5&8191),u+=wH[pt])}else KR(e,u,ge[n[W]]),u+=be[n[W]];return KR(e,u,ge[256]),u+be[256]},Vqe=new VM([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Kqe=function(){for(var i=new VM(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i}(),jqe=function(){var i=4294967295;return{p:function(e){for(var t=i,n=0;n<e.length;++n)t=Kqe[255&t^e[n]]^t>>>8;i=t},d:function(){return 4294967295^i}}},Jqe=function(i,e,t,n,r){return function(a,o,s,l,c,u){var A=a.length,f=new sb(l+A+5*(1+Math.floor(A/7e3))+c),p=f.subarray(l,f.length-c),v=0;if(!o||A<8)for(var B=0;B<=A;B+=65535){var x=B+65535;x<A?v=NH(p,v,a.subarray(B,x)):(p[B]=u,v=NH(p,v,a.subarray(B,A)))}else{for(var b=Vqe[o-1],Q=b>>>13,R=8191&b,k=(1<<s)-1,K=new cB(32768),Y=new cB(k+1),J=Math.ceil(s/3),W=2*J,$=function(fn){return(a[fn]^a[fn+1]<<J^a[fn+2]<<W)&k},X=new VM(25e3),de=new cB(288),ue=new cB(32),ge=0,be=0,Qe=(B=0,0),ve=0,Be=0;B<A;++B){var Ie=$(B),Te=32767&B,Ne=Y[Ie];if(K[Te]=Ne,Y[Ie]=Te,ve<=B){var Le=A-B;if((ge>7e3||Qe>24576)&&Le>423){v=Zhe(a,p,0,X,de,ue,be,Qe,Be,B-Be,v),Qe=ge=be=0,Be=B;for(var Pe=0;Pe<286;++Pe)de[Pe]=0;for(Pe=0;Pe<30;++Pe)ue[Pe]=0}var rt=2,$e=0,pt=R,Ct=Te-Ne&32767;if(Le>2&&Ie==$(B-Ct))for(var kt=Math.min(Q,Le)-1,Ht=Math.min(32767,B),it=Math.min(258,Le);Ct<=Ht&&--pt&&Te!=Ne;){if(a[B+rt]==a[B+rt-Ct]){for(var wt=0;wt<it&&a[B+wt]==a[B+wt-Ct];++wt);if(wt>rt){if(rt=wt,$e=Ct,wt>kt)break;var Qt=Math.min(Ct,wt-2),Bt=0;for(Pe=0;Pe<Qt;++Pe){var Kt=B-Ct+Pe+32768&32767,Gt=Kt-K[Kt]+32768&32767;Gt>Bt&&(Bt=Gt,Ne=Kt)}}}Ct+=(Te=Ne)-(Ne=K[Te])+32768&32767}if($e){X[Qe++]=268435456|MH[rt]<<18|Vhe[$e];var ii=31&MH[rt],ti=31&Vhe[$e];be+=QH[ii]+wH[ti],++de[257+ii],++ue[ti],ve=B+rt,++ge}else X[Qe++]=a[B],++de[a[B]]}}v=Zhe(a,p,u,X,de,ue,be,Qe,Be,B-Be,v)}return Jhe(f,0,l+jhe(v)+c)}(i,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+e.mem,t,n,!0)},TH=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8},qqe=function(i,e){var t=e.filename;if(i[0]=31,i[1]=139,i[2]=8,i[8]=e.level<2?4:e.level==9?2:0,i[9]=3,e.mtime!=0&&TH(i,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){i[3]=8;for(var n=0;n<=t.length;++n)i[n+10]=t.charCodeAt(n)}},Zqe=function(i){return 10+(i.filename&&i.filename.length+1||0)};function Whe(i,e){e===void 0&&(e={});var t=jqe(),n=i.length;t.p(i);var r=Jqe(i,e,Zqe(e),8),a=r.length;return qqe(r,e),TH(r,a-8,t.d()),TH(r,a-4,n),r}function Xhe(i,e){var t=i.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(i);for(var n=new sb(i.length+(i.length>>>1)),r=0,a=function(c){n[r++]=c},o=0;o<t;++o){if(r+5>n.length){var s=new sb(r+8+(t-o<<1));s.set(n),n=s}var l=i.charCodeAt(o);l<128||e?a(l):l<2048?(a(192|l>>>6),a(128|63&l)):l>55295&&l<57344?(a(240|(l=65536+(1047552&l)|1023&i.charCodeAt(++o))>>>18),a(128|l>>>12&63),a(128|l>>>6&63),a(128|63&l)):(a(224|l>>>12),a(128|l>>>6&63),a(128|63&l))}return Jhe(n,0,r)}function Wqe(i,e){return function(t){for(var n=0,r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r),n|=0;return Math.abs(n)}(i)%100<GB(100*e,0,100)}var Bw="disabled",UH="sampled",iU="active",k9="buffering",PH="paused",GH="trigger",hS=GH+"_activated",mx=GH+"_pending",pS=GH+"_"+Bw;function $he(i,e){return e.some(t=>t.matching==="regex"&&new RegExp(t.url).test(i))}class epe{constructor(e){this.xt=e}triggerStatus(e){var t=this.xt.map(n=>n.triggerStatus(e));return t.includes(hS)?hS:t.includes(mx)?mx:pS}stop(){this.xt.forEach(e=>e.stop())}}class tpe{constructor(e){this.xt=e}triggerStatus(e){var t=new Set;for(var n of this.xt)t.add(n.triggerStatus(e));switch(t.delete(pS),t.size){case 0:return pS;case 1:return Array.from(t)[0];default:return mx}}stop(){this.xt.forEach(e=>e.stop())}}class Xqe{triggerStatus(){return mx}stop(){}}class $qe{constructor(e){this.Et=[],this.It=[],this.urlBlocked=!1,this._instance=e}onRemoteConfig(e){var t,n;this.Et=((t=e.sessionRecording)==null?void 0:t.urlTriggers)||[],this.It=((n=e.sessionRecording)==null?void 0:n.urlBlocklist)||[]}Pt(e){var t;return this.Et.length===0?pS:((t=this._instance)==null?void 0:t.get_property(aH))===e?hS:mx}triggerStatus(e){var t=this.Pt(e),n=t===hS?hS:t===mx?mx:pS;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:n}),n}checkUrlTriggerConditions(e,t,n){if(Ka!==void 0&&Ka.location.href){var r=Ka.location.href,a=this.urlBlocked,o=$he(r,this.It);a&&o||(o&&!a?e():!o&&a&&t(),$he(r,this.Et)&&n("url"))}}stop(){}}class eZe{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this.Rt=()=>{},this._instance=e}triggerStatus(){var e=mx;return yv(this.linkedFlag)&&(e=pS),this.linkedFlagSeen&&(e=hS),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:e}),e}onRemoteConfig(e,t){var n;if(this.linkedFlag=((n=e.sessionRecording)==null?void 0:n.linkedFlag)||null,!yv(this.linkedFlag)&&!this.linkedFlagSeen){var r=U1(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,a=U1(this.linkedFlag)?null:this.linkedFlag.variant;this.Rt=this._instance.onFeatureFlags((o,s)=>{var l=!1;if(T1(s)&&r in s){var c=s[r];l=fS(c)?c===!0:a?c===a:!!c}this.linkedFlagSeen=l,l&&t(r,a)})}}stop(){this.Rt()}}class tZe{constructor(e){this.Tt=[],this._instance=e}onRemoteConfig(e){var t;this.Tt=((t=e.sessionRecording)==null?void 0:t.eventTriggers)||[]}Mt(e){var t;return this.Tt.length===0?pS:((t=this._instance)==null?void 0:t.get_property(oH))===e?hS:mx}triggerStatus(e){var t=this.Mt(e),n=t===hS?hS:t===mx?mx:pS;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:n}),n}stop(){}}function nZe(i){return i.isRecordingEnabled?k9:Bw}function iZe(i){if(!i.receivedFlags)return k9;if(!i.isRecordingEnabled)return Bw;if(i.urlTriggerMatching.urlBlocked)return PH;var e=i.isSampled===!0,t=new epe([i.eventTriggerMatching,i.urlTriggerMatching,i.linkedFlagMatching]).triggerStatus(i.sessionId);return e?UH:t===hS?iU:t===mx?k9:i.isSampled===!1?Bw:iU}function rZe(i){if(!i.receivedFlags)return k9;if(!i.isRecordingEnabled)return Bw;if(i.urlTriggerMatching.urlBlocked)return PH;var e=new tpe([i.eventTriggerMatching,i.urlTriggerMatching,i.linkedFlagMatching]).triggerStatus(i.sessionId),t=e!==pS,n=fS(i.isSampled);return t&&e===mx?k9:t&&e===pS||n&&!i.isSampled?Bw:i.isSampled===!0?UH:iU}var JR="[SessionRecording]",yx=L_(JR);function rU(){var i;return E0==null||(i=E0.__PosthogExtensions__)==null||(i=i.rrweb)==null?void 0:i.record}var aZe=3e5,oZe=[Pb.MouseMove,Pb.MouseInteraction,Pb.Scroll,Pb.ViewportResize,Pb.Input,Pb.TouchMove,Pb.MediaInteraction,Pb.Drag],npe=i=>({rrwebMethod:i,enqueuedAt:Date.now(),attempt:1});function L9(i){return function(e,t){for(var n="",r=0;r<e.length;){var a=e[r++];n+=String.fromCharCode(a)}return n}(Whe(Xhe(JSON.stringify(i))))}function ipe(i){return i.type===pQ.Custom&&i.data.tag==="sessionIdle"}class sZe{get sessionId(){return this.Ct}get Ft(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this.Ot}get At(){if(!this._instance.sessionManager)throw new Error(JR+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Dt(){var e,t;return this.Lt.triggerStatus(this.sessionId)===mx?6e4:(e=(t=this._instance.config.session_recording)==null?void 0:t.full_snapshot_interval_millis)!==null&&e!==void 0?e:aZe}get jt(){var e=this._instance.get_property(zR);return fS(e)?e:null}get Nt(){var e,t,n=(e=this.C)==null?void 0:e.data[((t=this.C)==null?void 0:t.data.length)-1],{sessionStartTimestamp:r}=this.At.checkAndGetSessionAndWindowId(!0);return n?n.timestamp-r:null}get zt(){var e=!!this._instance.get_property(rH),t=!this._instance.config.disable_session_recording;return Ka&&e&&t}get Ut(){var e=!!this._instance.get_property(ihe),t=this._instance.config.enable_recording_console_log;return t??e}get qt(){var e,t,n,r,a,o,s=this._instance.config.session_recording.captureCanvas,l=this._instance.get_property(ohe),c=(e=(t=s==null?void 0:s.recordCanvas)!==null&&t!==void 0?t:l==null?void 0:l.enabled)!==null&&e!==void 0&&e,u=(n=(r=s==null?void 0:s.canvasFps)!==null&&r!==void 0?r:l==null?void 0:l.fps)!==null&&n!==void 0?n:4,A=(a=(o=s==null?void 0:s.canvasQuality)!==null&&o!==void 0?o:l==null?void 0:l.quality)!==null&&a!==void 0?a:.4;if(typeof A=="string"){var f=parseFloat(A);A=isNaN(f)?.4:f}return{enabled:c,fps:GB(u,0,12,"canvas recording fps",4),quality:GB(A,0,1,"canvas recording quality",.4)}}get Bt(){var e,t,n=this._instance.get_property(rhe),r={recordHeaders:(e=this._instance.config.session_recording)==null?void 0:e.recordHeaders,recordBody:(t=this._instance.config.session_recording)==null?void 0:t.recordBody},a=(r==null?void 0:r.recordHeaders)||(n==null?void 0:n.recordHeaders),o=(r==null?void 0:r.recordBody)||(n==null?void 0:n.recordBody),s=T1(this._instance.config.capture_performance)?this._instance.config.capture_performance.network_timing:this._instance.config.capture_performance,l=!!(fS(s)?s:n!=null&&n.capturePerformance);return a||o||l?{recordHeaders:a,recordBody:o,recordPerformance:l}:void 0}get Ht(){var e,t,n,r,a,o,s=this._instance.get_property(ahe),l={maskAllInputs:(e=this._instance.config.session_recording)==null?void 0:e.maskAllInputs,maskTextSelector:(t=this._instance.config.session_recording)==null?void 0:t.maskTextSelector,blockSelector:(n=this._instance.config.session_recording)==null?void 0:n.blockSelector},c=(r=l==null?void 0:l.maskAllInputs)!==null&&r!==void 0?r:s==null?void 0:s.maskAllInputs,u=(a=l==null?void 0:l.maskTextSelector)!==null&&a!==void 0?a:s==null?void 0:s.maskTextSelector,A=(o=l==null?void 0:l.blockSelector)!==null&&o!==void 0?o:s==null?void 0:s.blockSelector;return wu(c)&&wu(u)&&wu(A)?void 0:{maskAllInputs:c==null||c,maskTextSelector:u,blockSelector:A}}get Wt(){var e=this._instance.get_property(she);return gx(e)?e:null}get Gt(){var e=this._instance.get_property(lhe);return gx(e)?e:null}get status(){return this.Jt?this.Vt({receivedFlags:this.Jt,isRecordingEnabled:this.zt,isSampled:this.jt,urlTriggerMatching:this.Kt,eventTriggerMatching:this.Yt,linkedFlagMatching:this.Xt,sessionId:this.sessionId}):k9}constructor(e){if(this.Vt=nZe,this.Jt=!1,this.Qt=[],this.Zt="unknown",this.ti=Date.now(),this.Lt=new Xqe,this.ii=void 0,this.ei=void 0,this.ri=void 0,this.si=void 0,this.ni=void 0,this._forceAllowLocalhostNetworkCapture=!1,this.oi=()=>{this.ai()},this.li=()=>{this.ui("browser offline",{})},this.hi=()=>{this.ui("browser online",{})},this.di=()=>{if(YA!=null&&YA.visibilityState){var r="window "+YA.visibilityState;this.ui(r,{})}},this._instance=e,this.Ot=!1,this.vi="/s/",this.ci=void 0,this.Jt=!1,!this._instance.sessionManager)throw yx.error("started without valid sessionManager"),new Error(JR+" started without valid sessionManager. This is a bug.");if(this._instance.config.__preview_experimental_cookieless_mode)throw new Error(JR+" cannot be used with __preview_experimental_cookieless_mode.");this.Xt=new eZe(this._instance),this.Kt=new $qe(this._instance),this.Yt=new tZe(this._instance);var{sessionId:t,windowId:n}=this.At.checkAndGetSessionAndWindowId();this.Ct=t,this.fi=n,this.C=this.pi(),this.Ft>=this.At.sessionTimeoutMs&&yx.warn("session_idle_threshold_ms ("+this.Ft+") is greater than the session timeout ("+this.At.sessionTimeoutMs+"). Session will never be detected as idle")}startIfEnabledOrStop(e){this.zt?(this.gi(e),d1(Ka,"beforeunload",this.oi),d1(Ka,"offline",this.li),d1(Ka,"online",this.hi),d1(Ka,"visibilitychange",this.di),this.mi(),this.bi(),yv(this.ii)&&(this.ii=this._instance.on("eventCaptured",t=>{try{if(t.event==="$pageview"){var n=t!=null&&t.properties.$current_url?this.yi(t==null?void 0:t.properties.$current_url):"";if(!n)return;this.ui("$pageview",{href:n})}}catch(r){yx.error("Could not add $pageview to rrweb session",r)}})),this.ei||(this.ei=this.At.onSessionId((t,n,r)=>{var a,o;r&&(this.ui("$session_id_change",{sessionId:t,windowId:n,changeReason:r}),(a=this._instance)==null||(a=a.persistence)==null||a.unregister(oH),(o=this._instance)==null||(o=o.persistence)==null||o.unregister(aH))}))):this.stopRecording()}stopRecording(){var e,t,n,r;this.Ot&&this.ci&&(this.ci(),this.ci=void 0,this.Ot=!1,Ka==null||Ka.removeEventListener("beforeunload",this.oi),Ka==null||Ka.removeEventListener("offline",this.li),Ka==null||Ka.removeEventListener("online",this.hi),Ka==null||Ka.removeEventListener("visibilitychange",this.di),this.pi(),clearInterval(this.wi),(e=this.ii)==null||e.call(this),this.ii=void 0,(t=this.ni)==null||t.call(this),this.ni=void 0,(n=this.ei)==null||n.call(this),this.ei=void 0,(r=this.si)==null||r.call(this),this.si=void 0,this.Yt.stop(),this.Kt.stop(),this.Xt.stop(),yx.info("stopped"))}Si(){var e;(e=this._instance.persistence)==null||e.unregister(zR)}$i(e){var t,n=this.Ct!==e,r=this.Wt;if(gx(r)){var a=this.jt,o=n||!fS(a),s=o?Wqe(e,r):a;o&&(s?this.ki(UH):yx.warn("Sample rate ("+r+") has determined that this sessionId ("+e+") will not be sent to the server."),this.ui("samplingDecisionMade",{sampleRate:r,isSampled:s})),(t=this._instance.persistence)==null||t.register({[zR]:s})}else this.Si()}onRemoteConfig(e){var t,n,r,a;this.ui("$remote_config_received",e),this.xi(e),(t=e.sessionRecording)!=null&&t.endpoint&&(this.vi=(a=e.sessionRecording)==null?void 0:a.endpoint),this.mi(),((n=e.sessionRecording)==null?void 0:n.triggerMatchType)==="any"?(this.Vt=iZe,this.Lt=new epe([this.Yt,this.Kt])):(this.Vt=rZe,this.Lt=new tpe([this.Yt,this.Kt])),this._instance.register_for_session({$sdk_debug_replay_remote_trigger_matching_config:(r=e.sessionRecording)==null?void 0:r.triggerMatchType}),this.Kt.onRemoteConfig(e),this.Yt.onRemoteConfig(e),this.Xt.onRemoteConfig(e,(o,s)=>{this.ki("linked_flag_matched",{flag:o,variant:s})}),this.Jt=!0,this.startIfEnabledOrStop()}mi(){gx(this.Wt)&&yv(this.si)&&(this.si=this.At.onSessionId(e=>{this.$i(e)}))}xi(e){if(this._instance.persistence){var t,n=this._instance.persistence,r=()=>{var a,o,s,l,c,u,A,f,p,v=(a=e.sessionRecording)==null?void 0:a.sampleRate,B=yv(v)?null:parseFloat(v);yv(B)&&this.Si();var x=(o=e.sessionRecording)==null?void 0:o.minimumDurationMilliseconds;n.register({[rH]:!!e.sessionRecording,[ihe]:(s=e.sessionRecording)==null?void 0:s.consoleLogRecordingEnabled,[rhe]:vA({capturePerformance:e.capturePerformance},(l=e.sessionRecording)==null?void 0:l.networkPayloadCapture),[ahe]:(c=e.sessionRecording)==null?void 0:c.masking,[ohe]:{enabled:(u=e.sessionRecording)==null?void 0:u.recordCanvas,fps:(A=e.sessionRecording)==null?void 0:A.canvasFps,quality:(f=e.sessionRecording)==null?void 0:f.canvasQuality},[she]:B,[lhe]:wu(x)?null:x,[che]:(p=e.sessionRecording)==null?void 0:p.scriptConfig})};r(),(t=this.ri)==null||t.call(this),this.ri=this.At.onSessionId(r)}}log(e,t){var n;t===void 0&&(t="log"),(n=this._instance.sessionRecording)==null||n.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}gi(e){if(!wu(Object.assign)&&!wu(Array.from)&&!(this.Ot||this._instance.config.disable_session_recording||this._instance.consent.isOptedOut())){var t;this.Ot=!0,this.At.checkAndGetSessionAndWindowId(),rU()?this.Ei():(t=E0.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,this.Ii,n=>{if(n)return yx.error("could not load recorder",n);this.Ei()}),yx.info("starting"),this.status===iU&&this.ki(e||"recording_initialized")}}get Ii(){var e;return((e=this._instance)==null||(e=e.persistence)==null||(e=e.get_property(che))==null?void 0:e.script)||"recorder"}Pi(e){var t;return e.type===3&&oZe.indexOf((t=e.data)==null?void 0:t.source)!==-1}Ri(e){var t=this.Pi(e);t||this.Zt||e.timestamp-this.ti>this.Ft&&(this.Zt=!0,clearInterval(this.wi),this.ui("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this.ti,threshold:this.Ft,bufferLength:this.C.data.length,bufferSize:this.C.size}),this.ai());var n=!1;if(t&&(this.ti=e.timestamp,this.Zt)){var r=this.Zt==="unknown";this.Zt=!1,r||(this.ui("sessionNoLongerIdle",{reason:"user activity",type:e.type}),n=!0)}if(!this.Zt){var{windowId:a,sessionId:o}=this.At.checkAndGetSessionAndWindowId(!t,e.timestamp),s=this.Ct!==o,l=this.fi!==a;this.fi=a,this.Ct=o,s||l?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):n&&this.Ti()}}Mi(e){try{return e.rrwebMethod(),!0}catch(t){return this.Qt.length<10?this.Qt.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):yx.warn("could not emit queued rrweb event.",t,e),!1}}ui(e,t){return this.Mi(npe(()=>rU().addCustomEvent(e,t)))}Ci(){return this.Mi(npe(()=>rU().takeFullSnapshot()))}Ei(){var e,t,n,r,a={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},o=this._instance.config.session_recording;for(var[s,l]of Object.entries(o||{}))s in a&&(s==="maskInputOptions"?a.maskInputOptions=vA({password:!0},l):a[s]=l);this.qt&&this.qt.enabled&&(a.recordCanvas=!0,a.sampling={canvas:this.qt.fps},a.dataURLOptions={type:"image/webp",quality:this.qt.quality}),this.Ht&&(a.maskAllInputs=(t=this.Ht.maskAllInputs)===null||t===void 0||t,a.maskTextSelector=(n=this.Ht.maskTextSelector)!==null&&n!==void 0?n:void 0,a.blockSelector=(r=this.Ht.blockSelector)!==null&&r!==void 0?r:void 0);var c=rU();if(c){this.Fi=(e=this.Fi)!==null&&e!==void 0?e:new Oqe(c,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(A,f)=>{var p="Too many mutations on node '"+A+"'. Rate limiting. This could be due to SVG animations or something similar";yx.info(p,{node:f}),this.log(JR+" "+p,"warn")}});var u=this.Oi();this.ci=c(vA({emit:A=>{this.onRRwebEmit(A)},plugins:u},a)),this.ti=Date.now(),this.Zt=fS(this.Zt)?this.Zt:"unknown",this.ui("$session_options",{sessionRecordingOptions:a,activePlugins:u.map(A=>A==null?void 0:A.name)}),this.ui("$posthog_config",{config:this._instance.config})}else yx.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}Ti(){if(this.wi&&clearInterval(this.wi),this.Zt!==!0){var e=this.Dt;e&&(this.wi=setInterval(()=>{this.Ci()},e))}}Oi(){var e,t,n=[],r=(e=E0.__PosthogExtensions__)==null||(e=e.rrwebPlugins)==null?void 0:e.getRecordConsolePlugin;r&&this.Ut&&n.push(r());var a=(t=E0.__PosthogExtensions__)==null||(t=t.rrwebPlugins)==null?void 0:t.getRecordNetworkPlugin;return this.Bt&&ob(a)&&(!oqe.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?n.push(a(Lqe(this._instance.config,this.Bt))):yx.info("NetworkCapture not started because we are on localhost.")),n}onRRwebEmit(e){var t;if(this.Ai(),e&&T1(e)){if(e.type===pQ.Meta){var n=this.yi(e.data.href);if(this.Di=n,!n)return;e.data.href=n}else this.Li();if(this.Kt.checkUrlTriggerConditions(()=>this.ji(),()=>this.Ni(),f=>this.zi(f)),!this.Kt.urlBlocked||(r=e).type===pQ.Custom&&r.data.tag==="recording paused"){var r;e.type===pQ.FullSnapshot&&this.Ti(),e.type===pQ.FullSnapshot&&this.Jt&&this.Lt.triggerStatus(this.sessionId)===mx&&this.pi();var a=this.Fi?this.Fi.throttleMutations(e):e;if(a){var o=function(f){var p=f;if(p&&T1(p)&&p.type===6&&T1(p.data)&&p.data.plugin==="rrweb/console@1"){p.data.payload.payload.length>10&&(p.data.payload.payload=p.data.payload.payload.slice(0,10),p.data.payload.payload.push("...[truncated]"));for(var v=[],B=0;B<p.data.payload.payload.length;B++)p.data.payload.payload[B]&&p.data.payload.payload[B].length>2e3?v.push(p.data.payload.payload[B].slice(0,2e3)+"...[truncated]"):v.push(p.data.payload.payload[B]);return p.data.payload.payload=v,f}return f}(a);if(this.Ri(o),this.Zt!==!0||ipe(o)){if(ipe(o)){var s=o.data.payload;if(s){var l=s.lastActivityTimestamp,c=s.threshold;o.timestamp=l+c}}var u=(t=this._instance.config.session_recording.compress_events)===null||t===void 0||t?function(f){if(eU(f)<1024)return f;try{if(f.type===pQ.FullSnapshot)return vA({},f,{data:L9(f.data),cv:"2024-10"});if(f.type===pQ.IncrementalSnapshot&&f.data.source===Pb.Mutation)return vA({},f,{cv:"2024-10",data:vA({},f.data,{texts:L9(f.data.texts),attributes:L9(f.data.attributes),removes:L9(f.data.removes),adds:L9(f.data.adds)})});if(f.type===pQ.IncrementalSnapshot&&f.data.source===Pb.StyleSheetRule)return vA({},f,{cv:"2024-10",data:vA({},f.data,{adds:f.data.adds?L9(f.data.adds):void 0,removes:f.data.removes?L9(f.data.removes):void 0})})}catch(p){yx.error("could not compress event - will use uncompressed event",p)}return f}(o):o,A={$snapshot_bytes:eU(u),$snapshot_data:u,$session_id:this.Ct,$window_id:this.fi};this.status!==Bw?this.Ui(A):this.pi()}}}}}Li(){if(!this._instance.config.capture_pageview&&Ka){var e=this.yi(Ka.location.href);this.Di!==e&&(this.ui("$url_changed",{href:e}),this.Di=e)}}Ai(){if(this.Qt.length){var e=[...this.Qt];this.Qt=[],e.forEach(t=>{Date.now()-t.enqueuedAt<=2e3&&this.Mi(t)})}}yi(e){var t=this._instance.config.session_recording;if(t.maskNetworkRequestFn){var n,r={url:e};return(n=r=t.maskNetworkRequestFn(r))==null?void 0:n.url}return e}pi(){return this.C={size:0,data:[],sessionId:this.Ct,windowId:this.fi},this.C}ai(){this.qi&&(clearTimeout(this.qi),this.qi=void 0);var e=this.Gt,t=this.Nt,n=gx(t)&&t>=0,r=gx(e)&&n&&t<e;return this.status===k9||this.status===PH||this.status===Bw||r?(this.qi=setTimeout(()=>{this.ai()},2e3),this.C):(this.C.data.length>0&&BH(this.C).forEach(a=>{this.Bi({$snapshot_bytes:a.size,$snapshot_data:a.data,$session_id:a.sessionId,$window_id:a.windowId,$lib:"web",$lib_version:AQ.LIB_VERSION})}),this.pi())}Ui(e){var t,n=2+(((t=this.C)==null?void 0:t.data.length)||0);!this.Zt&&(this.C.size+e.$snapshot_bytes+n>943718.4||this.C.sessionId!==this.Ct)&&(this.C=this.ai()),this.C.size+=e.$snapshot_bytes,this.C.data.push(e.$snapshot_data),this.qi||this.Zt||(this.qi=setTimeout(()=>{this.ai()},2e3))}Bi(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this.vi),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}zi(e){var t;this.Lt.triggerStatus(this.sessionId)===mx&&((t=this._instance)==null||(t=t.persistence)==null||t.register({[e==="url"?aH:oH]:this.Ct}),this.ai(),this.ki(e+"_trigger_matched"))}ji(){this.Kt.urlBlocked||(this.Kt.urlBlocked=!0,clearInterval(this.wi),yx.info("recording paused due to URL blocker"),this.ui("recording paused",{reason:"url blocker"}))}Ni(){this.Kt.urlBlocked&&(this.Kt.urlBlocked=!1,this.Ci(),this.Ti(),this.ui("recording resumed",{reason:"left blocked url"}),yx.info("recording resumed"))}bi(){this.Yt.Tt.length!==0&&yv(this.ni)&&(this.ni=this._instance.on("eventCaptured",e=>{try{this.Yt.Tt.includes(e.event)&&this.zi("event")}catch(t){yx.error("Could not activate event trigger",t)}}))}overrideLinkedFlag(){this.Xt.linkedFlagSeen=!0,this.Ci(),this.ki("linked_flag_overridden")}overrideSampling(){var e;(e=this._instance.persistence)==null||e.register({[zR]:!0}),this.Ci(),this.ki("sampling_overridden")}overrideTrigger(e){this.zi(e)}ki(e,t){this._instance.register_for_session({$session_recording_start_reason:e}),yx.info(e.replace("_"," "),t),xm(["recording_initialized","session_id_changed"],e)||this.ui(e,t)}get sdkDebugProperties(){var{sessionStartTimestamp:e}=this.At.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.C.data.length,$sdk_debug_replay_internal_buffer_size:this.C.size,$sdk_debug_current_session_duration:this.Nt,$sdk_debug_session_start:e}}}var FH=L_("[SegmentIntegration]");function lZe(i,e){var t=i.config.segment;if(!t)return e();(function(n,r){var a=n.config.segment;if(!a)return r();var o=l=>{var c=()=>l.anonymousId()||xw();n.config.get_device_id=c,l.id()&&(n.register({distinct_id:l.id(),$device_id:c()}),n.persistence.set_property(fQ,"identified")),r()},s=a.user();"then"in s&&ob(s.then)?s.then(l=>o(l)):o(s)})(i,()=>{t.register((n=>{Promise&&Promise.resolve||FH.warn("This browser does not have Promise support, and can not use the segment integration");var r=(a,o)=>{if(!o)return a;a.event.userId||a.event.anonymousId===n.get_distinct_id()||(FH.info("No userId set, resetting PostHog"),n.reset()),a.event.userId&&a.event.userId!==n.get_distinct_id()&&(FH.info("UserId set, identifying with PostHog"),n.identify(a.event.userId));var s=n.calculateEventProperties(o,a.event.properties);return a.event.properties=Object.assign({},s,a.event.properties),a};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:a=>r(a,a.event.event),page:a=>r(a,"$pageview"),identify:a=>r(a,"$identify"),screen:a=>r(a,"$screen")}})(i)).then(()=>{e()})})}var rpe="posthog-js";function ape(i,e){var{organization:t,projectId:n,prefix:r,severityAllowList:a=["error"]}=e===void 0?{}:e;return o=>{var s,l,c,u,A;if(!(a==="*"||a.includes(o.level))||!i.__loaded)return o;o.tags||(o.tags={});var f=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/person/"+i.get_distinct_id());o.tags["PostHog Person URL"]=f,i.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var p=((s=o.exception)==null?void 0:s.values)||[],v=p.map(x=>vA({},x,{stacktrace:x.stacktrace?vA({},x.stacktrace,{type:"raw",frames:(x.stacktrace.frames||[]).map(b=>vA({},b,{platform:"web:javascript"}))}):void 0})),B={$exception_message:((l=p[0])==null?void 0:l.value)||o.message,$exception_type:(c=p[0])==null?void 0:c.type,$exception_personURL:f,$exception_level:o.level,$exception_list:v,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((u=p[0])==null?void 0:u.value)||o.message,$sentry_exception_type:(A=p[0])==null?void 0:A.type,$sentry_tags:o.tags};return t&&n&&(B.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+o.event_id),i.exceptions.sendExceptionEvent(B),o}}class cZe{constructor(e,t,n,r,a){this.name=rpe,this.setupOnce=function(o){o(ape(e,{organization:t,projectId:n,prefix:r,severityAllowList:a}))}}}var uZe=Ka!=null&&Ka.location?K8(Ka.location.hash,"__posthog")||K8(location.hash,"state"):null,ope="_postHogToolbarParams",spe=L_("[Toolbar]"),bw=function(i){return i[i.UNINITIALIZED=0]="UNINITIALIZED",i[i.LOADING=1]="LOADING",i[i.LOADED=2]="LOADED",i}(bw||{});class AZe{constructor(e){this.instance=e}Hi(e){E0.ph_toolbar_state=e}Wi(){var e;return(e=E0.ph_toolbar_state)!==null&&e!==void 0?e:bw.UNINITIALIZED}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),!Ka||!YA)return!1;e=e??Ka.location,n=n??Ka.history;try{if(!t){try{Ka.localStorage.setItem("test","test"),Ka.localStorage.removeItem("test")}catch{return!1}t=Ka==null?void 0:Ka.localStorage}var r,a=uZe||K8(e.hash,"__posthog")||K8(e.hash,"state"),o=a?qfe(()=>JSON.parse(atob(decodeURIComponent(a))))||qfe(()=>JSON.parse(decodeURIComponent(a))):null;return o&&o.action==="ph_authorize"?((r=o).source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(ope)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token)&&(this.loadToolbar(r),!0)}catch{return!1}}Gi(e){var t=E0.ph_load_toolbar||E0.ph_load_editor;!yv(t)&&ob(t)?t(e,this.instance):spe.warn("No toolbar load function found")}loadToolbar(e){var t=!(YA==null||!YA.getElementById(uhe));if(!Ka||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=vA({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(Ka.localStorage.setItem(ope,JSON.stringify(vA({},r,{source:void 0}))),this.Wi()===bw.LOADED)this.Gi(r);else if(this.Wi()===bw.UNINITIALIZED){var a;this.Hi(bw.LOADING),(a=E0.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",o=>{if(o)return spe.error("[Toolbar] Failed to load",o),void this.Hi(bw.UNINITIALIZED);this.Hi(bw.LOADED),this.Gi(r)}),d1(Ka,"turbolinks:load",()=>{this.Hi(bw.UNINITIALIZED),this.loadToolbar(r)})}return!0}Ji(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}var dZe=L_("[TracingHeaders]");class fZe{constructor(e){this.Vi=void 0,this.Ki=void 0,this.nt=()=>{var t,n;wu(this.Vi)&&((t=E0.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.sessionManager)),wu(this.Ki)&&((n=E0.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(this._instance.sessionManager))},this._instance=e}J(e){var t,n;(t=E0.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=E0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",r=>{if(r)return dZe.error("failed to load script",r);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.J(this.nt):((e=this.Vi)==null||e.call(this),(t=this.Ki)==null||t.call(this),this.Vi=void 0,this.Ki=void 0)}}var Sw=L_("[Web Vitals]"),lpe=9e5;class hZe{constructor(e){var t;this.Yi=!1,this.i=!1,this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Xi=()=>{clearTimeout(this.Qi),this.C.metrics.length!==0&&(this._instance.capture("$web_vitals",this.C.metrics.reduce((n,r)=>vA({},n,{["$web_vitals_"+r.name+"_event"]:vA({},r),["$web_vitals_"+r.name+"_value"]:r.value}),{})),this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Zi=n=>{var r,a=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(wu(a))Sw.error("Could not read session ID. Dropping metrics!");else{this.C=this.C||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.te();wu(o)||(yv(n==null?void 0:n.name)||yv(n==null?void 0:n.value)?Sw.error("Invalid metric received",n):this.ie&&n.value>=this.ie?Sw.error("Ignoring metric with value >= "+this.ie,n):(this.C.url!==o&&(this.Xi(),this.Qi=setTimeout(this.Xi,this.flushToCaptureTimeoutMs)),wu(this.C.url)&&(this.C.url=o),this.C.firstMetricTimestamp=wu(this.C.firstMetricTimestamp)?Date.now():this.C.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.C.metrics.push(vA({},n,{$current_url:o,$session_id:a.sessionId,$window_id:a.windowId,timestamp:Date.now()})),this.C.metrics.length===this.allowedMetrics.length&&this.Xi()))}},this.nt=()=>{var n,r,a,o,s=E0.__PosthogExtensions__;wu(s)||wu(s.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:r,onFCP:a,onINP:o}=s.postHogWebVitalsCallbacks),n&&r&&a&&o?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.Zi.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Zi.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Zi.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this.Zi.bind(this)),this.i=!0):Sw.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.Yi=!((t=this._instance.persistence)==null||!t.props[ehe]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=T1(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return wu(n)?((t=this._instance.persistence)==null?void 0:t.props[nhe])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(T1(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get ie(){var e=T1(this._instance.config.capture_performance)&&gx(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:lpe;return 0<e&&e<=6e4?lpe:e}get isEnabled(){var e=sB==null?void 0:sB.protocol;if(e!=="http:"&&e!=="https:")return Sw.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=T1(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:fS(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return fS(t)?t:this.Yi}startIfEnabled(){this.isEnabled&&!this.i&&(Sw.info("enabled, starting..."),this.J(this.nt))}onRemoteConfig(e){var t=T1(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=T1(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[ehe]:t}),this._instance.persistence.register({[nhe]:n})),this.Yi=t,this.startIfEnabled()}J(e){var t,n;(t=E0.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks&&e(),(n=E0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"web-vitals",r=>{r?Sw.error("failed to load script",r):e()})}te(){var e=Ka?Ka.location.href:void 0;return e||Sw.error("Could not determine current URL"),e}}var pZe=L_("[Heatmaps]");function cpe(i){return T1(i)&&"clientX"in i&&"clientY"in i&&gx(i.clientX)&&gx(i.clientY)}class gZe{constructor(e){var t;this.rageclicks=new xhe,this.Yi=!1,this.i=!1,this.ee=null,this.instance=e,this.Yi=!((t=this.instance.persistence)==null||!t.props[nH])}get flushIntervalMilliseconds(){var e=5e3;return T1(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return wu(this.instance.config.capture_heatmaps)?wu(this.instance.config.enable_heatmaps)?this.Yi:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.i)return;pZe.info("starting..."),this.re(),this.ee=setInterval(this.se.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval((e=this.ee)!==null&&e!==void 0?e:void 0),(t=this.ne)==null||t.stop(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[nH]:t}),this.Yi=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.C;return this.C=void 0,e}oe(e){this.ae(e.originalEvent,"deadclick")}re(){Ka&&YA&&(d1(Ka,"beforeunload",this.se.bind(this)),d1(YA,"click",e=>this.ae(e||(Ka==null?void 0:Ka.event)),{capture:!0}),d1(YA,"mousemove",e=>this.le(e||(Ka==null?void 0:Ka.event)),{capture:!0}),this.ne=new whe(this.instance,Cqe,this.oe.bind(this)),this.ne.startIfEnabled(),this.i=!0)}ue(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=function(s,l,c){for(var u=s;u&&z8(u)&&!_w(u,"body");){if(u===c)return!1;if(xm(l,Ka==null?void 0:Ka.getComputedStyle(u).position))return!0;u=mhe(u)}return!1}(ghe(e),["fixed","sticky"],a);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:n),target_fixed:o,type:t}}ae(e,t){var n;if(t===void 0&&(t="click"),!Ahe(e.target)&&cpe(e)){var r=this.ue(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.he(vA({},r,{type:"rageclick"})),this.he(r)}}le(e){!Ahe(e.target)&&cpe(e)&&(clearTimeout(this.de),this.de=setTimeout(()=>{this.he(this.ue(e,"mousemove"))},500))}he(e){if(Ka){var t=Ka.location.href;this.C=this.C||{},this.C[t]||(this.C[t]=[]),this.C[t].push(e)}}se(){this.C&&!kM(this.C)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class mZe{constructor(e){this._instance=e}doPageView(e,t){var n,r=this.ve(e,t);return this.ce={pathname:(n=Ka==null?void 0:Ka.location.pathname)!==null&&n!==void 0?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.ve(e,(t=this.ce)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.ce)==null?void 0:e.pageViewId}}ve(e,t){var n=this.ce;if(!n)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:n.pageViewId},a=this._instance.scrollManager.getContext();if(a&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:s,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:A}=a;if(!(wu(o)||wu(s)||wu(l)||wu(c)||wu(u)||wu(A))){o=Math.ceil(o),s=Math.ceil(s),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),A=Math.ceil(A);var f=o<=1?1:GB(s/o,0,1),p=o<=1?1:GB(l/o,0,1),v=c<=1?1:GB(u/c,0,1),B=c<=1?1:GB(A/c,0,1);r=bE(r,{$prev_pageview_last_scroll:s,$prev_pageview_last_scroll_percentage:f,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:p,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:A,$prev_pageview_max_content_percentage:B})}}return n.pathname&&(r.$prev_pageview_pathname=n.pathname),n.timestamp&&(r.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),r}}var yZe=function(i){var e,t,n,r,a="";for(e=t=0,n=(i=(i+"").replace(/\r\n/g,`
|
|
243
243
|
`).replace(/\r/g,`
|
|
244
|
-
`)).length,r=0;r<n;r++){var o=i.charCodeAt(r),s=null;o<128?t++:s=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),Iw(s)||(t>e&&(a+=i.substring(e,t)),a+=s,e=t=r+1)}return t>e&&(a+=i.substring(e,i.length)),a},vZe=!!Wz||!!Zz,upe="text/plain",aU=(i,e)=>{var[t,n]=i.split("?"),r=vA({},e);n==null||n.split("&").forEach(o=>{var[s]=o.split("=");delete r[s]});var a=sqe(r);return t+"?"+(a=a?(n?n+"&":"")+a:n)},qR=(i,e)=>JSON.stringify(i,(t,n)=>typeof n=="bigint"?n.toString():n,e),kH=i=>{var{data:e,compression:t}=i;if(e){if(t===dQ.GZipJS){var n=Whe(Xhe(qR(e)),{mtime:0}),r=new Blob([n],{type:upe});return{contentType:upe,body:r,estimatedSize:r.size}}if(t===dQ.Base64){var a=function(l){var c,u,A,f,p,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",B=0,x=0,b="",Q=[];if(!l)return l;l=yZe(l);do c=(p=l.charCodeAt(B++)<<16|l.charCodeAt(B++)<<8|l.charCodeAt(B++))>>18&63,u=p>>12&63,A=p>>6&63,f=63&p,Q[x++]=v.charAt(c)+v.charAt(u)+v.charAt(A)+v.charAt(f);while(B<l.length);switch(b=Q.join(""),l.length%3){case 1:b=b.slice(0,-2)+"==";break;case 2:b=b.slice(0,-1)+"="}return b}(qR(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:qR(l)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var s=qR(e);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}}},ZR=[];Zz&&ZR.push({transport:"fetch",method:i=>{var e,t,{contentType:n,body:r,estimatedSize:a}=(e=kH(i))!==null&&e!==void 0?e:{},o=new Headers;zC(i.headers,function(u,A){o.append(A,u)}),n&&o.append("Content-Type",n);var s=i.url,l=null;if(Hfe){var c=new Hfe;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),i.timeout)}}Zz(s,vA({method:(i==null?void 0:i.method)||"GET",headers:o,keepalive:i.method==="POST"&&(a||0)<52428.8,body:r,signal:(t=l)==null?void 0:t.signal},i.fetchOptions)).then(u=>u.text().then(A=>{var f={statusCode:u.status,text:A};if(u.status===200)try{f.json=JSON.parse(A)}catch(p){yd.error(p)}i.callback==null||i.callback(f)})).catch(u=>{yd.error(u),i.callback==null||i.callback({statusCode:0,text:u})}).finally(()=>l?clearTimeout(l.timeout):null)}}),Wz&&ZR.push({transport:"XHR",method:i=>{var e,t=new Wz;t.open(i.method||"GET",i.url,!0);var{contentType:n,body:r}=(e=kH(i))!==null&&e!==void 0?e:{};zC(i.headers,function(a,o){t.setRequestHeader(o,a)}),n&&t.setRequestHeader("Content-Type",n),i.timeout&&(t.timeout=i.timeout),t.withCredentials=!0,t.onreadystatechange=()=>{if(t.readyState===4){var a={statusCode:t.status,text:t.responseText};if(t.status===200)try{a.json=JSON.parse(t.responseText)}catch{}i.callback==null||i.callback(a)}},t.send(r)}}),PB!=null&&PB.sendBeacon&&ZR.push({transport:"sendBeacon",method:i=>{var e=aU(i.url,{beacon:"1"});try{var t,{contentType:n,body:r}=(t=kH(i))!==null&&t!==void 0?t:{},a=typeof r=="string"?new Blob([r],{type:n}):r;PB.sendBeacon(e,a)}catch{}}});var KM=function(i,e){if(!function(t){try{new RegExp(t)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(i)}catch{return!1}};function Ape(i,e,t){return qR({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var CZe={exact:(i,e)=>e.some(t=>i.some(n=>t===n)),is_not:(i,e)=>e.every(t=>i.every(n=>t!==n)),regex:(i,e)=>e.some(t=>i.some(n=>KM(t,n))),not_regex:(i,e)=>e.every(t=>i.every(n=>!KM(t,n))),icontains:(i,e)=>e.map(oU).some(t=>i.map(oU).some(n=>t.includes(n))),not_icontains:(i,e)=>e.map(oU).every(t=>i.map(oU).every(n=>!t.includes(n)))},oU=i=>i.toLowerCase(),IZe=L_("[Error tracking]");class EZe{constructor(e){var t,n;this.fe=[],this._instance=e,this.fe=(t=(n=this._instance.persistence)==null?void 0:n.get_property(iH))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,n,r=(t=(n=e.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[];this.fe=r,this._instance.persistence&&this._instance.persistence.register({[iH]:this.fe})}sendExceptionEvent(e){this.pe(e)?IZe.info("Skipping exception capture because a suppression rule matched"):this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}pe(e){var t=e.$exception_list;if(!t||!qI(t)||t.length===0)return!1;var n=t.reduce((r,a)=>{var{type:o,value:s}=a;return U1(o)&&o.length>0&&r.$exception_types.push(o),U1(s)&&s.length>0&&r.$exception_values.push(s),r},{$exception_types:[],$exception_values:[]});return this.fe.some(r=>{var a=r.values.map(o=>{var s,l=CZe[o.operator],c=qI(o.value)?o.value:[o.value],u=(s=n[o.key])!==null&&s!==void 0?s:[];return c.length>0&&l(c,u)});return r.type==="OR"?a.some(Boolean):a.every(Boolean)})}}var lb="Mobile",sU="iOS",gS="Android",WR="Tablet",dpe=gS+" "+WR,fpe="iPad",hpe="Apple",ppe=hpe+" Watch",XR="Safari",jM="BlackBerry",gpe="Samsung",mpe=gpe+"Browser",ype=gpe+" Internet",O9="Chrome",_Ze=O9+" OS",vpe=O9+" "+sU,LH="Internet Explorer",Cpe=LH+" "+lb,OH="Opera",xZe=OH+" Mini",zH="Edge",Ipe="Microsoft "+zH,JM="Firefox",Epe=JM+" "+sU,$R="Nintendo",e5="PlayStation",qM="Xbox",_pe=gS+" "+lb,xpe=lb+" "+XR,t5="Windows",HH=t5+" Phone",Bpe="Nokia",YH="Ouya",bpe="Generic",BZe=bpe+" "+lb.toLowerCase(),Spe=bpe+" "+WR.toLowerCase(),VH="Konqueror",Lx="(\\d+(\\.\\d+)?)",KH=new RegExp("Version/"+Lx),bZe=new RegExp(qM,"i"),SZe=new RegExp(e5+" \\w+","i"),QZe=new RegExp($R+" \\w+","i"),jH=new RegExp(jM+"|PlayBook|BB10","i"),wZe={"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"},MZe=(i,e)=>e&&xm(e,hpe)||function(t){return xm(t,XR)&&!xm(t,O9)&&!xm(t,gS)}(i),Qpe=function(i,e){return e=e||"",xm(i," OPR/")&&xm(i,"Mini")?xZe:xm(i," OPR/")?OH:jH.test(i)?jM:xm(i,"IE"+lb)||xm(i,"WPDesktop")?Cpe:xm(i,mpe)?ype:xm(i,zH)||xm(i,"Edg/")?Ipe:xm(i,"FBIOS")?"Facebook "+lb:xm(i,"UCWEB")||xm(i,"UCBrowser")?"UC Browser":xm(i,"CriOS")?vpe:xm(i,"CrMo")||xm(i,O9)?O9:xm(i,gS)&&xm(i,XR)?_pe:xm(i,"FxiOS")?Epe:xm(i.toLowerCase(),VH.toLowerCase())?VH:MZe(i,e)?xm(i,lb)?xpe:XR:xm(i,JM)?JM:xm(i,"MSIE")||xm(i,"Trident/")?LH:xm(i,"Gecko")?JM:""},DZe={[Cpe]:[new RegExp("rv:"+Lx)],[Ipe]:[new RegExp(zH+"?\\/"+Lx)],[O9]:[new RegExp("("+O9+"|CrMo)\\/"+Lx)],[vpe]:[new RegExp("CriOS\\/"+Lx)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Lx)],[XR]:[KH],[xpe]:[KH],[OH]:[new RegExp("(Opera|OPR)\\/"+Lx)],[JM]:[new RegExp(JM+"\\/"+Lx)],[Epe]:[new RegExp("FxiOS\\/"+Lx)],[VH]:[new RegExp("Konqueror[:/]?"+Lx,"i")],[jM]:[new RegExp(jM+" "+Lx),KH],[_pe]:[new RegExp("android\\s"+Lx,"i")],[ype]:[new RegExp(mpe+"\\/"+Lx)],[LH]:[new RegExp("(rv:|MSIE )"+Lx)],Mozilla:[new RegExp("rv:"+Lx)]},RZe=function(i,e){var t=Qpe(i,e),n=DZe[t];if(wu(n))return null;for(var r=0;r<n.length;r++){var a=n[r],o=i.match(a);if(o)return parseFloat(o[o.length-2])}return null},wpe=[[new RegExp(qM+"; "+qM+" (.*?)[);]","i"),i=>[qM,i&&i[1]||""]],[new RegExp($R,"i"),[$R,""]],[new RegExp(e5,"i"),[e5,""]],[jH,[jM,""]],[new RegExp(t5,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[HH,""];if(new RegExp(lb).test(e)&&!/IEMobile\b/.test(e))return[t5+" "+lb,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var n=t[1],r=wZe[n]||"";return/arm/i.test(e)&&(r="RT"),[t5,r]}return[t5,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>{if(i&&i[3]){var e=[i[3],i[4],i[5]||"0"];return[sU,e.join(".")]}return[sU,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=wu(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+gS+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+gS+")","i"),i=>{if(i&&i[2]){var e=[i[2],i[3],i[4]||"0"];return[gS,e.join(".")]}return[gS,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];if(i&&i[1]){var t=[i[1],i[2],i[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[_Ze,""]],[/Linux|debian/i,["Linux",""]]],Mpe=function(i){return QZe.test(i)?$R:SZe.test(i)?e5:bZe.test(i)?qM:new RegExp(YH,"i").test(i)?YH:new RegExp("("+HH+"|WPDesktop)","i").test(i)?HH:/iPad/.test(i)?fpe:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?ppe:jH.test(i)?jM:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(Bpe,"i").test(i)?Bpe:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?!new RegExp(lb).test(i)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)?/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?gS:dpe:gS:new RegExp("(pda|"+lb+")","i").test(i)?BZe:new RegExp(WR,"i").test(i)&&!new RegExp(WR+" pc","i").test(i)?Spe:""},lU="https?://(.*)",cU=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],NZe=N8(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],cU),JH="<masked>";function Dpe(i,e,t){if(!YA)return{};var n=e?N8([],cU,t||[]):[];return Rpe(gH(YA.URL,n,JH),i)}function Rpe(i,e){var t=NZe.concat(e||[]),n={};return zC(t,function(r){var a=V8(i,r);n[r]=a||null}),n}function Npe(i){var e=function(a){return a?a.search(lU+"google.([^/?]*)")===0?"google":a.search(lU+"bing.com")===0?"bing":a.search(lU+"yahoo.com")===0?"yahoo":a.search(lU+"duckduckgo.com")===0?"duckduckgo":null:null}(i),t=e!="yahoo"?"q":"p",n={};if(!Iw(e)){n.$search_engine=e;var r=YA?V8(YA.referrer,t):"";r.length&&(n.ph_keyword=r)}return n}function Tpe(){return navigator.language||navigator.userLanguage}function Upe(){return(YA==null?void 0:YA.referrer)||"$direct"}function Ppe(i,e){var t=i?N8([],cU,e||[]):[],n=sB==null?void 0:sB.href.substring(0,1e3);return{r:Upe().substring(0,1e3),u:n?gH(n,t,JH):void 0}}function Gpe(i){var e,{r:t,u:n}=i,r={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=zM(t))==null?void 0:e.host};if(n){r.$current_url=n;var a=zM(n);r.$host=a==null?void 0:a.host,r.$pathname=a==null?void 0:a.pathname;var o=Rpe(n);bE(r,o)}if(t){var s=Npe(t);bE(r,s)}return r}function Fpe(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function TZe(){try{return new Date().getTimezoneOffset()}catch{return}}function UZe(i,e){if(!lB)return{};var t,n,r,a=i?N8([],cU,e||[]):[],[o,s]=function(l){for(var c=0;c<wpe.length;c++){var[u,A]=wpe[c],f=u.exec(l),p=f&&(ob(A)?A(f,l):A);if(p)return p}return["",""]}(lB);return bE(tH({$os:o,$os_version:s,$browser:Qpe(lB,navigator.vendor),$device:Mpe(lB),$device_type:(n=lB,r=Mpe(n),r===fpe||r===dpe||r==="Kobo"||r==="Kindle Fire"||r===Spe?WR:r===$R||r===qM||r===e5||r===YH?"Console":r===ppe?"Wearable":r?lb:"Desktop"),$timezone:Fpe(),$timezone_offset:TZe()}),{$current_url:gH(sB==null?void 0:sB.href,a,JH),$host:sB==null?void 0:sB.host,$pathname:sB==null?void 0:sB.pathname,$raw_user_agent:lB.length>1e3?lB.substring(0,997)+"...":lB,$browser_version:RZe(lB,navigator.vendor),$browser_language:Tpe(),$browser_language_prefix:(t=Tpe(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:Ka==null?void 0:Ka.screen.height,$screen_width:Ka==null?void 0:Ka.screen.width,$viewport_height:Ka==null?void 0:Ka.innerHeight,$viewport_width:Ka==null?void 0:Ka.innerWidth,$lib:"web",$lib_version:AQ.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var mS=L_("[FeatureFlags]"),qH="$active_feature_flags",ZM="$override_feature_flags",kpe="$feature_flag_payloads",n5="$override_feature_flag_payloads",Lpe="$feature_flag_request_id",Ope=i=>{var e={};for(var[t,n]of T8(i||{}))n&&(e[t]=n);return e},PZe=i=>{var e=i.flags;return e?(i.featureFlags=Object.fromEntries(Object.keys(e).map(t=>{var n;return[t,(n=e[t].variant)!==null&&n!==void 0?n:e[t].enabled]})),i.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var n;return(n=e[t].metadata)==null?void 0:n.payload}).map(t=>{var n;return[t,(n=e[t].metadata)==null?void 0:n.payload]}))):mS.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),i},GZe=function(i){return i.FeatureFlags="feature_flags",i.Recordings="recordings",i}({}),zpe=new Set(["7c6f7b45","66c1f69c","2727f65a","f3287528","8cc9a311","eb9f671b","c0e1c6f9","057989ec","723f4019","7b102104","563359d3","bad973ea","f6f2c4f4","59454a61","89ad1076","4edd0da1","26c52e72","a970bd2e","89cf4454","16e2b4e7","fba0e7b6","301c8488","bc65d69e","fe66a3c5","37926ca6","52a196df","d32a7577","42c4c9ef","6883bd5a","04809ff7","e59430a8","61be3dd8","7fa5500b","bf027177","8cfdba9b","96f6df5f","569798e9","0ebc61a5","1b5d7b92","17ebb0a4","f97ea965","85cc817b","3044dfc1","0c3fe5c3","b1f95fa3","8a6342e8","72365c68","12d34ad9","733853ec","3beeb69a","0645bb64","32de7f98","5dcbee21","3fe85053","ad960278","9466e5dd","7ca97b2d","2ee2a65c","28fde5f2","85c52f49","0ad823f4","f11b6cc9","aacf8af9","ab3e62b3","3a85ff15","8a67d3c4","f5e91ef1","4b873698","c5dae949","5b643d76","9599c892","34377448","2189e408","3be9ad53","1a14ce7c","2a164ded","8d53ea86","53bdb37d","bfc3f590","8df38ede","bdb81e49","38fde5c0","8d707e6d","73cbc496","f9d8a5ef","d3a9f8c4","a980d8cd","5bcfe086","e4818f68","4f11fb39","a13c6ae3","150c7fbb","98f3d658","f84f7377","1924dd9c","1f6b63b3","24748755","7c0f717c","8a87f11b","49f57f22","3c9e9234","3772f65b","dff631b6","cd609d40","f853c7f7","952db5ee","c5aa8a79","2d21b6fd","79b7164c","4110e26c","a7d3b43f","84e1b8f6","75cc0998","07f78e33","10ca9b1a","ce441b18","01eb8256","c0ac4b67","8e8e5216","db7943dd","fa133a95","498a4508","21bbda67","7dbfed69","be3ec24c","fc80b8e2"]);class FZe{constructor(e){this.ge=!1,this._e=!1,this.me=!1,this.be=!1,this.ye=!1,this.we=!1,this.Se=!1,this._instance=e,this.featureFlagEventHandlers=[]}flags(){if(this._instance.config.__preview_remote_config)this.we=!0;else{var e=!this.$e&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.ke({disableFlags:e})}}get hasLoadedFlags(){return this._e}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(sH),t=this._instance.get_property(ZM),n=this._instance.get_property(n5);if(!n&&!t)return e||{};var r=bE({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of a){var s,l,c=r[o],u=t==null?void 0:t[o],A=wu(u)?(s=c==null?void 0:c.enabled)!==null&&s!==void 0&&s:!!u,f=wu(u)?c.variant:typeof u=="string"?u:void 0,p=n==null?void 0:n[o],v=vA({},c,{enabled:A,variant:A?f??(c==null?void 0:c.variant):void 0});A!==(c==null?void 0:c.enabled)&&(v.original_enabled=c==null?void 0:c.enabled),f!==(c==null?void 0:c.variant)&&(v.original_variant=c==null?void 0:c.variant),p&&(v.metadata=vA({},c==null?void 0:c.metadata,{payload:p,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),r[o]=v}return this.ge||(mS.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.ge=!0),r}getFlagVariants(){var e=this._instance.get_property(LM),t=this._instance.get_property(ZM);if(!t)return e||{};for(var n=bE({},e),r=Object.keys(t),a=0;a<r.length;a++)n[r[a]]=t[r[a]];return this.ge||(mS.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ge=!0),n}getFlagPayloads(){var e=this._instance.get_property(kpe),t=this._instance.get_property(n5);if(!t)return e||{};for(var n=bE({},e||{}),r=Object.keys(t),a=0;a<r.length;a++)n[r[a]]=t[r[a]];return this.ge||(mS.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ge=!0),n}reloadFeatureFlags(){this.be||this._instance.config.advanced_disable_feature_flags||this.$e||(this.$e=setTimeout(()=>{this.ke()},5))}xe(){clearTimeout(this.$e),this.$e=void 0}ensureFlagsLoaded(){this._e||this.me||this.$e||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.be=e}ke(e){var t;if(this.xe(),!this._instance.I())if(this.me)this.ye=!0;else{var n={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:vA({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(HR)||{}),group_properties:this._instance.get_property(U9)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0);var r=this._instance.config.__preview_flags_v2&&this._instance.config.__preview_remote_config,a=function(l){var c=function(u){for(var A=2166136261,f=0;f<u.length;f++)A^=u.charCodeAt(f),A+=(A<<1)+(A<<4)+(A<<7)+(A<<8)+(A<<24);return("00000000"+(A>>>0).toString(16)).slice(-8)}(l);return zpe==null?void 0:zpe.has(c)}(this._instance.config.token)?"/decide?v=4":r?"/flags/?v=2":"/flags/?v=2&config=true",o=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",s=this._instance.requestRouter.endpointFor("api",a+o);r&&(n.timezone=Fpe()),this.me=!0,this._instance.Ee({method:"POST",url:s,data:n,compression:this._instance.config.disable_compression?void 0:dQ.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var c,u,A=!0;if(l.statusCode===200&&(this.ye||(this.$anon_distinct_id=void 0),A=!1),this.me=!1,this.we||(this.we=!0,this._instance.Ie((u=l.json)!==null&&u!==void 0?u:{})),!n.disable_flags||this.ye)if(this.Se=!A,l.json&&(c=l.json.quotaLimited)!=null&&c.includes(GZe.FeatureFlags))mS.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.");else{var f;n.disable_flags||this.receivedFeatureFlags((f=l.json)!==null&&f!==void 0?f:{},A),this.ye&&(this.ye=!1,this.ke())}}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),this._e||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants()[e],r=""+n,a=this._instance.get_property(Lpe)||void 0,o=this._instance.get_property(F8)||{};if((t.send_event||!("send_event"in t))&&(!(e in o)||!o[e].includes(r))){var s,l,c,u,A,f,p,v,B;qI(o[e])?o[e].push(r):o[e]=[r],(s=this._instance.persistence)==null||s.register({[F8]:o});var x=this.getFeatureFlagDetails(e),b={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:a,$feature_flag_bootstrapped_response:((l=this._instance.config.bootstrap)==null||(l=l.featureFlags)==null?void 0:l[e])||null,$feature_flag_bootstrapped_payload:((c=this._instance.config.bootstrap)==null||(c=c.featureFlagPayloads)==null?void 0:c[e])||null,$used_bootstrap_value:!this.Se};wu(x==null||(u=x.metadata)==null?void 0:u.version)||(b.$feature_flag_version=x.metadata.version);var Q,R=(A=x==null||(f=x.reason)==null?void 0:f.description)!==null&&A!==void 0?A:x==null||(p=x.reason)==null?void 0:p.code;R&&(b.$feature_flag_reason=R),x!=null&&(v=x.metadata)!=null&&v.id&&(b.$feature_flag_id=x.metadata.id),wu(x==null?void 0:x.original_variant)&&wu(x==null?void 0:x.original_enabled)||(b.$feature_flag_original_response=wu(x.original_variant)?x.original_enabled:x.original_variant),x!=null&&(B=x.metadata)!=null&&B.original_payload&&(b.$feature_flag_original_payload=x==null||(Q=x.metadata)==null?void 0:Q.original_payload),this._instance.capture("$feature_flag_called",b)}return n}mS.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var n=this._instance.config.token;this._instance.Ee({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:{distinct_id:this._instance.get_distinct_id(),token:n},compression:this._instance.config.disable_compression?void 0:dQ.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:r=>{var a,o=(a=r.json)==null?void 0:a.featureFlagPayloads;t((o==null?void 0:o[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this._e||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);mS.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this._instance.persistence){this._e=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads(),a=this.getFlagsWithDetails();(function(o,s,l,c,u){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var A=PZe(o),f=A.flags,p=A.featureFlags,v=A.featureFlagPayloads;if(p){var B=o.requestId;if(qI(p)){mS.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var x={};if(p)for(var b=0;b<p.length;b++)x[p[b]]=!0;s&&s.register({[qH]:p,[LM]:x})}else{var Q=p,R=v,k=f;o.errorsWhileComputingFlags&&(Q=vA({},l,Q),R=vA({},c,R),k=vA({},u,k)),s&&s.register(vA({[qH]:Object.keys(Ope(Q)),[LM]:Q||{},[kpe]:R||{},[sH]:k||{}},B?{[Lpe]:B}:{}))}}})(e,this._instance.persistence,n,r,a),this.Pe(t)}}override(e,t){t===void 0&&(t=!1),mS.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return mS.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(ZM),this._instance.persistence.unregister(n5),void this.Pe();if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;if(this.ge=!!((t=n.suppressWarning)!==null&&t!==void 0&&t),"flags"in n){if(n.flags===!1)this._instance.persistence.unregister(ZM);else if(n.flags)if(qI(n.flags)){for(var r={},a=0;a<n.flags.length;a++)r[n.flags[a]]=!0;this._instance.persistence.register({[ZM]:r})}else this._instance.persistence.register({[ZM]:n.flags})}return"payloads"in n&&(n.payloads===!1?this._instance.persistence.unregister(n5):n.payloads&&this._instance.persistence.register({[n5]:n.payloads})),void this.Pe()}this.Pe()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._e){var{flags:t,flagVariants:n}=this.Re();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t){var n,r=(this._instance.get_property(P8)||[]).find(l=>l.flagKey===e),a={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};r&&(o.$early_access_feature_name=r.name),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(a,!1);var s=vA({},this.getFlagVariants(),{[e]:t});(n=this._instance.persistence)==null||n.register({[qH]:Object.keys(Ope(s)),[LM]:s}),this.Pe()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this._instance.get_property(P8),a=n?"&"+n.map(o=>"stage="+o).join("&"):"";if(r&&!t)return e(r);this._instance.Ee({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+a),method:"GET",callback:o=>{var s;if(o.json){var l=o.json.earlyAccessFeatures;return(s=this._instance.persistence)==null||s.register({[P8]:l}),e(l)}}})}Re(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(n=>t[n]),flagVariants:Object.keys(t).filter(n=>t[n]).reduce((n,r)=>(n[r]=t[r],n),{})}}Pe(e){var{flags:t,flagVariants:n}=this.Re();this.featureFlagEventHandlers.forEach(r=>r(t,n,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(HR)||{};this._instance.register({[HR]:vA({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(HR)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(U9)||{};Object.keys(n).length!==0&&Object.keys(n).forEach(r=>{n[r]=vA({},n[r],e[r]),delete e[r]}),this._instance.register({[U9]:vA({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(U9)||{};this._instance.register({[U9]:vA({},t,{[e]:{}})})}else this._instance.unregister(U9)}}var kZe=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class ZH{constructor(e){this.S=e,this.props={},this.Te=!1,this.Me=(t=>{var n="";return t.token&&(n=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+n+"_posthog"})(e),this.B=this.Ce(e),this.load(),e.debug&&yd.info("Persistence loaded",e.persistence,vA({},this.props)),this.update_config(e,e),this.save()}Ce(e){kZe.indexOf(e.persistence.toLowerCase())===-1&&(yd.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&VE.O()?VE:t==="localstorage+cookie"&&J8.O()?J8:t==="sessionstorage"&&O_.O()?O_:t==="memory"?yqe:t==="cookie"?hQ:J8.O()?J8:hQ}properties(){var e={};return zC(this.props,function(t,n){if(n===LM&&T1(t))for(var r=Object.keys(t),a=0;a<r.length;a++)e["$feature/"+r[a]]=t[r[a]];else s=n,l=!1,(Iw(o=XJe)?l:zfe&&o.indexOf===zfe?o.indexOf(s)!=-1:(zC(o,function(c){if(l||(l=c===s))return R8}),l))||(e[n]=t);var o,s,l}),e}load(){if(!this.Fe){var e=this.B.L(this.Me);e&&(this.props=bE({},e))}}save(){this.Fe||this.B.j(this.Me,this.props,this.Oe,this.Ae,this.De,this.S.debug)}remove(){this.B.N(this.Me,!1),this.B.N(this.Me,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(T1(e)){wu(t)&&(t="None"),this.Oe=wu(n)?this.Le:n;var r=!1;if(zC(e,(a,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=a,r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(T1(e)){this.Oe=wu(t)?this.Le:t;var n=!1;if(zC(e,(r,a)=>{e.hasOwnProperty(a)&&this.props[a]!==r&&(this.props[a]=r,n=!0)}),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Te){var e=Dpe(this.S.custom_campaign_params,this.S.mask_personal_data_properties,this.S.custom_personal_data_properties);kM(tH(e))||this.register(e),this.Te=!0}}update_search_keyword(){var e;this.register((e=YA==null?void 0:YA.referrer)?Npe(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Upe(),$referring_domain:YA!=null&&YA.referrer&&((e=zM(YA.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[AH]||this.props[dH]||this.register_once({[k8]:Ppe(this.S.mask_personal_data_properties,this.S.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};zC([dH,AH],o=>{var s=this.props[o];s&&zC(s,function(l,c){e["$initial_"+$z(c)]=l})});var t,n,r=this.props[k8];if(r){var a=(t=Gpe(r),n={},zC(t,function(o,s){n["$initial_"+$z(s)]=o}),n);bE(e,a)}return e}safe_merge(e){return zC(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t){if(this.Le=this.Oe=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var n=this.Ce(e),r=this.props;this.clear(),this.B=n,this.props=r,this.save()}}set_disabled(e){this.Fe=e,this.Fe?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ae&&(this.Ae=e,this.remove(),this.save())}set_secure(e){e!==this.De&&(this.De=e,this.remove(),this.save())}set_event_timer(e,t){var n=this.props[OR]||{};n[e]=t,this.props[OR]=n,this.save()}remove_event_timer(e){var t=(this.props[OR]||{})[e];return wu(t)||(delete this.props[OR][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}class Hpe{constructor(){this.je={},this.je={}}on(e,t){return this.je[e]||(this.je[e]=[]),this.je[e].push(t),()=>{this.je[e]=this.je[e].filter(n=>n!==t)}}emit(e,t){for(var n of this.je[e]||[])n(t);for(var r of this.je["*"]||[])r(e,t)}}class z9{constructor(e){this.Ne=new Hpe,this.ze=(t,n)=>this.Ue(t,n)&&this.qe(t,n)&&this.Be(t,n),this.Ue=(t,n)=>n==null||!n.event||(t==null?void 0:t.event)===(n==null?void 0:n.event),this._instance=e,this.He=new Set,this.We=new Set}init(){var e;if(!wu((e=this._instance)==null?void 0:e.Ge)){var t;(t=this._instance)==null||t.Ge((n,r)=>{this.on(n,r)})}}register(e){var t,n;if(!wu((t=this._instance)==null?void 0:t.Ge)&&(e.forEach(o=>{var s,l;(s=this.We)==null||s.add(o),(l=o.steps)==null||l.forEach(c=>{var u;(u=this.He)==null||u.add((c==null?void 0:c.event)||"")})}),(n=this._instance)!=null&&n.autocapture)){var r,a=new Set;e.forEach(o=>{var s;(s=o.steps)==null||s.forEach(l=>{l!=null&&l.selector&&a.add(l==null?void 0:l.selector)})}),(r=this._instance)==null||r.autocapture.setElementSelectors(a)}}on(e,t){var n;t!=null&&e.length!=0&&(this.He.has(e)||this.He.has(t==null?void 0:t.event))&&this.We&&((n=this.We)==null?void 0:n.size)>0&&this.We.forEach(r=>{this.Je(t,r)&&this.Ne.emit("actionCaptured",r.name)})}Ve(e){this.onAction("actionCaptured",t=>e(t))}Je(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var n of t.steps)if(this.ze(e,n))return!0;return!1}onAction(e,t){return this.Ne.on(e,t)}qe(e,t){if(t!=null&&t.url){var n,r=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!r||typeof r!="string"||!z9.Ke(r,t==null?void 0:t.url,(t==null?void 0:t.url_matching)||"contains"))return!1}return!0}static Ke(e,t,n){switch(n){case"regex":return!!Ka&&KM(e,t);case"exact":return t===e;case"contains":var r=z9.Ye(t).replace(/_/g,".").replace(/%/g,".*");return KM(e,r);default:return!1}}static Ye(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Be(e,t){if((t!=null&&t.href||t!=null&&t.tag_name||t!=null&&t.text)&&!this.Xe(e).some(a=>!(t!=null&&t.href&&!z9.Ke(a.href||"",t==null?void 0:t.href,(t==null?void 0:t.href_matching)||"exact"))&&(t==null||!t.tag_name||a.tag_name===(t==null?void 0:t.tag_name))&&!(t!=null&&t.text&&!z9.Ke(a.text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact")&&!z9.Ke(a.$el_text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact"))))return!1;if(t!=null&&t.selector){var n,r=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(!r||!r.includes(t==null?void 0:t.selector))return!1}return!0}Xe(e){return(e==null?void 0:e.properties.$elements)==null?[]:e==null?void 0:e.properties.$elements}}var KE=L_("[Surveys]"),WH="seenSurvey_",LZe=(i,e)=>{var t="$survey_"+e+"/"+i.id;return i.current_iteration&&i.current_iteration>0&&(t="$survey_"+e+"/"+i.id+"/"+i.current_iteration),t};class OZe{constructor(e){this._instance=e,this.Qe=new Map,this.Ze=new Map}register(e){var t;wu((t=this._instance)==null?void 0:t.Ge)||(this.tr(e),this.ir(e))}ir(e){var t=e.filter(n=>{var r,a;return((r=n.conditions)==null?void 0:r.actions)&&((a=n.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0});t.length!==0&&(this.er==null&&(this.er=new z9(this._instance),this.er.init(),this.er.Ve(n=>{this.onAction(n)})),t.forEach(n=>{var r,a,o,s,l;n.conditions&&(r=n.conditions)!=null&&r.actions&&(a=n.conditions)!=null&&(a=a.actions)!=null&&a.values&&((o=n.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((s=this.er)==null||s.register(n.conditions.actions.values),(l=n.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach(c=>{if(c&&c.name){var u=this.Ze.get(c.name);u&&u.push(n.id),this.Ze.set(c.name,u||[n.id])}}))}))}tr(e){var t;e.filter(n=>{var r,a;return((r=n.conditions)==null?void 0:r.events)&&((a=n.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0}).length!==0&&((t=this._instance)==null||t.Ge((n,r)=>{this.onEvent(n,r)}),e.forEach(n=>{var r;(r=n.conditions)==null||(r=r.events)==null||(r=r.values)==null||r.forEach(a=>{if(a&&a.name){var o=this.Qe.get(a.name);o&&o.push(n.id),this.Qe.set(a.name,o||[n.id])}})}))}onEvent(e,t){var n,r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[G8])||[];if(e==="survey shown"&&t&&r.length>0){var a;KE.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:r});var o=t==null||(a=t.properties)==null?void 0:a.$survey_id;if(o){var s=r.indexOf(o);s>=0&&(r.splice(s,1),this.rr(r))}}else this.Qe.has(e)&&(KE.info("survey event matched, updating activated surveys",{event:e,surveys:this.Qe.get(e)}),this.rr(r.concat(this.Qe.get(e)||[])))}onAction(e){var t,n=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[G8])||[];this.Ze.has(e)&&this.rr(n.concat(this.Ze.get(e)||[]))}rr(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[G8]:[...new Set(e)]})}getSurveys(){var e,t=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[G8];return t||[]}getEventToSurveys(){return this.Qe}sr(){return this.er}}class zZe{constructor(e){this.nr=null,this.ar=!1,this.lr=!1,this.ur=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){var t=e.surveys;if(yv(t))return KE.warn("Flags not loaded yet. Not loading surveys.");var n=qI(t);this.hr=n?t.length>0:t,KE.info("flags response received, hasSurveys: "+this.hr),this.hr&&this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(WH)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach(r=>localStorage.removeItem(r))}loadIfEnabled(){if(!this.nr)if(this.lr)KE.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)KE.info("Disabled. Not loading surveys.");else if(this.hr){var e=E0==null?void 0:E0.__PosthogExtensions__;if(e){this.lr=!0;try{var t=e.generateSurveys;if(t)return void this.dr(t);var n=e.loadExternalDependency;if(!n)return void this.vr("PostHog loadExternalDependency extension not found.");n(this._instance,"surveys",r=>{r||!e.generateSurveys?this.vr("Could not load surveys script",r):this.dr(e.generateSurveys)})}catch(r){throw this.vr("Error initializing surveys",r),r}finally{this.lr=!1}}else KE.error("PostHog Extensions not found.")}else KE.info("No surveys to load.")}dr(e){this.nr=e(this._instance),this._surveyEventReceiver=new OZe(this._instance),KE.info("Surveys loaded successfully"),this.cr({isLoaded:!0})}vr(e,t){KE.error(e,t),this.cr({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.ur.push(e),this.nr&&this.cr({isLoaded:!0}),()=>{this.ur=this.ur.filter(t=>t!==e)}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return KE.info("Disabled. Not loading surveys."),e([]);var n=this._instance.get_property(lH);if(n&&!t)return e(n,{isLoaded:!0});if(this.ar)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.ar=!0,this._instance.Ee({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:r=>{var a;this.ar=!1;var o=r.statusCode;if(o!==200||!r.json){var s="Surveys API could not be loaded, status: "+o;return KE.error(s),e([],{isLoaded:!1,error:s})}var l,c=r.json.surveys||[],u=c.filter(A=>function(f){return!(!f.start_date||f.end_date)}(A)&&(function(f){var p;return!((p=f.conditions)==null||(p=p.events)==null||(p=p.values)==null||!p.length)}(A)||function(f){var p;return!((p=f.conditions)==null||(p=p.actions)==null||(p=p.values)==null||!p.length)}(A)));return u.length>0&&((l=this._surveyEventReceiver)==null||l.register(u)),(a=this._instance.persistence)==null||a.register({[lH]:c}),e(c,{isLoaded:!0})}})}catch(r){throw this.ar=!1,r}}cr(e){for(var t of this.ur)try{e.isLoaded?this.getSurveys(t):t([],e)}catch(n){KE.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!yv(this.nr))return this.nr.getActiveMatchingSurveys(e,t);KE.warn("init was not called")}pr(e){var t=null;return this.getSurveys(n=>{var r;t=(r=n.find(a=>a.id===e))!==null&&r!==void 0?r:null}),t}gr(e){if(yv(this.nr))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.pr(e):e;return t?this.nr.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(yv(this.nr))return KE.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.gr(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return yv(this.nr)?(KE.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(n=>{this.getSurveys(r=>{var a,o=(a=r.find(l=>l.id===e))!==null&&a!==void 0?a:null;if(o){var s=this.gr(o);n({visible:s.eligible,disabledReason:s.reason})}else n({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t){if(yv(this.nr))KE.warn("init was not called");else{var n=this.pr(e),r=YA==null?void 0:YA.querySelector(t);n?r?this.nr.renderSurvey(n,r):KE.warn("Survey element not found"):KE.warn("Survey not found")}}}(function(i){return i.Button="button",i.Tab="tab",i.Selector="selector",i})({}),function(i){return i.TopLeft="top_left",i.TopRight="top_right",i.TopCenter="top_center",i.MiddleLeft="middle_left",i.MiddleRight="middle_right",i.MiddleCenter="middle_center",i.Left="left",i.Center="center",i.Right="right",i.NextToTrigger="next_to_trigger",i}({}),function(i){return i.Popover="popover",i.API="api",i.Widget="widget",i}({}),function(i){return i.Open="open",i.MultipleChoice="multiple_choice",i.SingleChoice="single_choice",i.Rating="rating",i.Link="link",i}({}),function(i){return i.NextQuestion="next_question",i.End="end",i.ResponseBased="response_based",i.SpecificQuestion="specific_question",i}({}),function(i){return i.Once="once",i.Recurring="recurring",i.Always="always",i}({});var XH=function(i){return i.SHOWN="survey shown",i.DISMISSED="survey dismissed",i.SENT="survey sent",i}({}),Ype=function(i){return i.SURVEY_ID="$survey_id",i.SURVEY_NAME="$survey_name",i.SURVEY_RESPONSE="$survey_response",i.SURVEY_ITERATION="$survey_iteration",i.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",i.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",i.SURVEY_SUBMISSION_ID="$survey_submission_id",i.SURVEY_QUESTIONS="$survey_questions",i.SURVEY_COMPLETED="$survey_completed",i}({}),Vpe=L_("[RateLimiter]");class HZe{constructor(e){var t,n;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=r=>{var a=r.text;if(a&&a.length)try{(JSON.parse(a).quota_limited||[]).forEach(o=>{Vpe.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4})}catch(o){return void Vpe.warn('could not rate limit - continuing. Error: "'+(o==null?void 0:o.message)+'"',{text:a})}},this.instance=e,this.captureEventsPerSecond=((t=e.config.rate_limiting)==null?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((n=e.config.rate_limiting)==null?void 0:n.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,n,r;e===void 0&&(e=!1);var a=new Date().getTime(),o=(t=(n=this.instance.persistence)==null?void 0:n.get_property(uH))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:a};o.tokens+=(a-o.last)/1e3*this.captureEventsPerSecond,o.last=a,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var s=o.tokens<1;return s||e||(o.tokens=Math.max(0,o.tokens-1)),!s||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=s,(r=this.instance.persistence)==null||r.set_property(uH,o),{isRateLimited:s,remainingTokens:o.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var H9=L_("[RemoteConfig]");class YZe{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=E0._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}_r(e){var t,n;(t=E0.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=E0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(H9.error("PostHog Extensions not found. Cannot load remote config."),e())}mr(e){this._instance.Ee({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return H9.info("Using preloaded remote config",this.remoteConfig),void this.Ie(this.remoteConfig);if(this._instance.I())return void H9.warn("Remote config is disabled. Falling back to local config.");this._r(e=>{if(!e)return H9.info("No config found after loading remote JS config. Falling back to JSON."),void this.mr(t=>{this.Ie(t)});this.Ie(e)})}catch(e){H9.error("Error loading remote config",e)}}Ie(e){e?this._instance.config.__preview_remote_config?(this._instance.Ie(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):H9.info("__preview_remote_config is disabled. Logging config instead",e):H9.error("Failed to fetch remote config from PostHog.")}}var $H=3e3;class VZe{constructor(e,t){this.br=!0,this.yr=[],this.wr=GB((t==null?void 0:t.flush_interval_ms)||$H,250,5e3,"flush interval",$H),this.Sr=e}enqueue(e){this.yr.push(e),this.$r||this.kr()}unload(){this.Er();var e=this.yr.length>0?this.Ir():{},t=Object.values(e);[...t.filter(n=>n.url.indexOf("/e")===0),...t.filter(n=>n.url.indexOf("/e")!==0)].map(n=>{this.Sr(vA({},n,{transport:"sendBeacon"}))})}enable(){this.br=!1,this.kr()}kr(){var e=this;this.br||(this.$r=setTimeout(()=>{if(this.Er(),this.yr.length>0){var t=this.Ir(),n=function(){var a=t[r],o=new Date().getTime();a.data&&qI(a.data)&&zC(a.data,s=>{s.offset=Math.abs(s.timestamp-o),delete s.timestamp}),e.Sr(a)};for(var r in t)n()}},this.wr))}Er(){clearTimeout(this.$r),this.$r=void 0}Ir(){var e={};return zC(this.yr,t=>{var n,r=t,a=(r?r.batchKey:null)||r.url;wu(e[a])&&(e[a]=vA({},r,{data:[]})),(n=e[a].data)==null||n.push(r.data)}),this.yr=[],e}}var KZe=["retriesPerformedSoFar"];class jZe{constructor(e){this.Pr=!1,this.Rr=3e3,this.yr=[],this._instance=e,this.yr=[],this.Tr=!0,!wu(Ka)&&"onLine"in Ka.navigator&&(this.Tr=Ka.navigator.onLine,d1(Ka,"online",()=>{this.Tr=!0,this.se()}),d1(Ka,"offline",()=>{this.Tr=!1}))}get length(){return this.yr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=Jfe(e,KZe);gx(t)&&t>0&&(n.url=aU(n.url,{retry_count:t})),this._instance.Ee(vA({},n,{callback:r=>{r.statusCode!==200&&(r.statusCode<400||r.statusCode>=500)&&(t??0)<10?this.Mr(vA({retriesPerformedSoFar:t},n)):n.callback==null||n.callback(r)}}))}Mr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(o){var s=3e3*Math.pow(2,o),l=s/2,c=Math.min(18e5,s),u=(Math.random()-.5)*(c-l);return Math.ceil(c+u)}(t),r=Date.now()+n;this.yr.push({retryAt:r,requestOptions:e});var a="Enqueued failed request for retry in "+n;navigator.onLine||(a+=" (Browser is offline)"),yd.warn(a),this.Pr||(this.Pr=!0,this.Cr())}Cr(){this.Fr&&clearTimeout(this.Fr),this.Fr=setTimeout(()=>{this.Tr&&this.yr.length>0&&this.se(),this.Cr()},this.Rr)}se(){var e=Date.now(),t=[],n=this.yr.filter(a=>a.retryAt<e||(t.push(a),!1));if(this.yr=t,n.length>0)for(var{requestOptions:r}of n)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Fr&&(clearTimeout(this.Fr),this.Fr=void 0),this.yr))try{this._instance.Ee(vA({},e,{transport:"sendBeacon"}))}catch(t){yd.error(t)}this.yr=[]}}class JZe{constructor(e){this.Or=()=>{var t,n,r,a;this.Ar||(this.Ar={});var o=this.scrollElement(),s=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=s+((o==null?void 0:o.clientHeight)||0),u=(o==null?void 0:o.scrollHeight)||0;this.Ar.lastScrollY=Math.ceil(s),this.Ar.maxScrollY=Math.max(s,(t=this.Ar.maxScrollY)!==null&&t!==void 0?t:0),this.Ar.maxScrollHeight=Math.max(l,(n=this.Ar.maxScrollHeight)!==null&&n!==void 0?n:0),this.Ar.lastContentY=c,this.Ar.maxContentY=Math.max(c,(r=this.Ar.maxContentY)!==null&&r!==void 0?r:0),this.Ar.maxContentHeight=Math.max(u,(a=this.Ar.maxContentHeight)!==null&&a!==void 0?a:0)},this._instance=e}getContext(){return this.Ar}resetContext(){var e=this.Ar;return setTimeout(this.Or,0),e}startMeasuringScrollPosition(){d1(Ka,"scroll",this.Or,{capture:!0}),d1(Ka,"scrollend",this.Or,{capture:!0}),d1(Ka,"resize",this.Or)}scrollElement(){if(!this._instance.config.scroll_root_selector)return Ka==null?void 0:Ka.document.documentElement;var e=qI(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var n=Ka==null?void 0:Ka.document.querySelector(t);if(n)return n}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return Ka&&(Ka.scrollY||Ka.pageYOffset||Ka.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return Ka&&(Ka.scrollX||Ka.pageXOffset||Ka.document.documentElement.scrollLeft)||0}}var qZe=i=>Ppe(i==null?void 0:i.config.mask_personal_data_properties,i==null?void 0:i.config.custom_personal_data_properties);class ZZe{constructor(e,t,n,r){this.Dr=a=>{var o=this.Lr();if(!o||o.sessionId!==a){var s={sessionId:a,props:this.jr(this._instance)};this.Nr.register({[cH]:s})}},this._instance=e,this.zr=t,this.Nr=n,this.jr=r||qZe,this.zr.onSessionId(this.Dr)}Lr(){return this.Nr.props[cH]}getSetOnceProps(){var e,t=(e=this.Lr())==null?void 0:e.props;return t?"r"in t?Gpe(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return zC(tH(this.getSetOnceProps()),(t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+$z(n)]=t}),e}}var Kpe=L_("[SessionId]");class WZe{constructor(e,t,n){var r;if(this.Ur=[],!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.S=e.config,this.Nr=e.persistence,this.fi=void 0,this.Ct=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.qr=t||xw,this.Br=n||xw;var a=this.S.persistence_name||this.S.token,o=this.S.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*GB(o,60,36e3,"session_idle_timeout_seconds",1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hr(),this.Wr="ph_"+a+"_window_id",this.Gr="ph_"+a+"_primary_window_exists",this.Jr()){var s=O_.L(this.Wr),l=O_.L(this.Gr);s&&!l?this.fi=s:O_.N(this.Wr),O_.j(this.Gr,!0)}if((r=this.S.bootstrap)!=null&&r.sessionID)try{var c=(u=>{var A=u.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)})(this.S.bootstrap.sessionID);this.Vr(this.S.bootstrap.sessionID,new Date().getTime(),c)}catch(u){Kpe.error("Invalid sessionID in bootstrap",u)}this.Kr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return wu(this.Ur)&&(this.Ur=[]),this.Ur.push(e),this.Ct&&e(this.Ct,this.fi),()=>{this.Ur=this.Ur.filter(t=>t!==e)}}Jr(){return this.S.persistence!=="memory"&&!this.Nr.Fe&&O_.O()}Yr(e){e!==this.fi&&(this.fi=e,this.Jr()&&O_.j(this.Wr,e))}Xr(){return this.fi?this.fi:this.Jr()?O_.L(this.Wr):null}Vr(e,t,n){e===this.Ct&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.Ct=e,this.Nr.register({[U8]:[t,e,n]}))}Qr(){if(this.Ct&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ct,this._sessionStartTimestamp];var e=this.Nr.props[U8];return qI(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Vr(null,null,null)}Kr(){d1(Ka,"beforeunload",()=>{this.Jr()&&O_.N(this.Gr)},{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.S.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var n=t||new Date().getTime(),[r,a,o]=this.Qr(),s=this.Xr(),l=gx(o)&&o>0&&Math.abs(n-o)>864e5,c=!1,u=!a,A=!e&&Math.abs(n-r)>this.sessionTimeoutMs;u||A||l?(a=this.qr(),s=this.Br(),Kpe.info("new session ID generated",{sessionId:a,windowId:s,changeReason:{noSessionId:u,activityTimeout:A,sessionPastMaximumLength:l}}),o=n,c=!0):s||(s=this.Br(),c=!0);var f=r===0||!e||l?n:r,p=o===0?new Date().getTime():o;return this.Yr(s),this.Vr(a,f,p),e||this.Hr(),c&&this.Ur.forEach(v=>v(a,s,c?{noSessionId:u,activityTimeout:A,sessionPastMaximumLength:l}:void 0)),{sessionId:a,windowId:s,sessionStartTimestamp:p,changeReason:c?{noSessionId:u,activityTimeout:A,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}Hr(){clearTimeout(this.Zr),this.Zr=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}}var XZe=["$set_once","$set"],Qw=L_("[SiteApps]");class $Ze{constructor(e){this._instance=e,this.ts=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}es(e,t){if(t){var n=this.globalsForEvent(t);this.ts.push(n),this.ts.length>1e3&&(this.ts=this.ts.slice(10))}}get siteAppLoaders(){var e;return(e=E0._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ge(this.es.bind(this));this.rs=()=>{e(),this.ts=[],this.rs=void 0}}}globalsForEvent(e){var t,n,r,a,o,s,l;if(!e)throw new Error("Event payload is required");var c={},u=this._instance.get_property("$groups")||[],A=this._instance.get_property("$stored_group_properties")||{};for(var[f,p]of Object.entries(A))c[f]={id:u[f],type:f,properties:p};var{$set_once:v,$set:B}=e;return{event:vA({},Jfe(e,XZe),{properties:vA({},e.properties,B?{$set:vA({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},B)}:{},v?{$set_once:vA({},(r=(a=e.properties)==null?void 0:a.$set_once)!==null&&r!==void 0?r:{},v)}:{}),elements_chain:(o=(s=e.properties)==null?void 0:s.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var s;!t.errored&&this.ts.length&&(Qw.info("Processing "+this.ts.length+" events for site app with id "+e.id),this.ts.forEach(l=>t.processEvent==null?void 0:t.processEvent(l)),t.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((s=this.rs)==null||s.call(this))},r=!1,a=s=>{t.errored=!s,t.loaded=!0,Qw.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&n()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:s=>{a(s)}});o&&(t.processEvent=o),r=!0}catch(s){Qw.error("Error while initializing PostHog app with config id "+e.id,s),a(!1)}if(r&&t.loaded)try{n()}catch(s){Qw.error("Error while processing buffered events PostHog app with config id "+e.id,s),t.errored=!0}}ss(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}ns(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(r){Qw.error("Error while processing event "+e.event+" for site app "+n.id,r)}}}onRemoteConfig(e){var t,n,r,a=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.ss(),void this._instance.on("eventCaptured",c=>this.ns(c))):void Qw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.rs)==null||n.call(this),(r=e.siteApps)!=null&&r.length)if(this.isEnabled){var o=function(c){var u;E0["__$$ph_site_app_"+c]=a._instance,(u=E0.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(a._instance,l,A=>{if(A)return Qw.error("Error while initializing PostHog app with config id "+c,A)})};for(var{id:s,url:l}of e.siteApps)o(s)}else Qw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var eWe=["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","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","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"],jpe=function(i,e){if(!i)return!1;var t=i.toLowerCase();return eWe.concat(e||[]).some(n=>{var r=n.toLowerCase();return t.indexOf(r)!==-1})},Jpe=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&jpe(t,e))return!0;try{var n=i==null?void 0:i.userAgentData;if(n!=null&&n.brands&&n.brands.some(r=>jpe(r==null?void 0:r.brand,e)))return!0}catch{}return!!i.webdriver},i5=function(i){return i.US="us",i.EU="eu",i.CUSTOM="custom",i}({}),qpe="i.posthog.com";class tWe{constructor(e){this.os={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+qpe,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.os[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.os[this.apiHost]=i5.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.os[this.apiHost]=i5.EU:this.os[this.apiHost]=i5.CUSTOM),this.os[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(this.region===i5.CUSTOM)return this.apiHost+t;var n=qpe+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}}var nWe={icontains:(i,e)=>!!Ka&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!Ka&&e.href.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>!!Ka&&KM(e.href,i),not_regex:(i,e)=>!!Ka&&!KM(e.href,i),exact:(i,e)=>e.href===i,is_not:(i,e)=>e.href!==i};class vx{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),t.getWebExperiments(r=>{vx.ls("retrieved web experiments from the server"),t.us=new Map,r.forEach(a=>{if(a.feature_flag_key){var o;t.us&&(vx.ls("setting flag key ",a.feature_flag_key," to web experiment ",a),(o=t.us)==null||o.set(a.feature_flag_key,a));var s=t._instance.getFeatureFlag(a.feature_flag_key);U1(s)&&a.variants[s]&&t.hs(a.name,s,a.variants[s].transforms)}else if(a.variants)for(var l in a.variants){var c=a.variants[l];vx.ds(c)&&t.hs(a.name,l,c.transforms)}})},n)},this._instance=e,this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}onFeatureFlags(e){if(this._is_bot())vx.ls("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(yv(this.us))return this.us=new Map,this.loadIfEnabled(),void this.previewWebExperiment();vx.ls("applying feature flags",e),e.forEach(t=>{var n;if(this.us&&(n=this.us)!=null&&n.has(t)){var r,a=this._instance.getFeatureFlag(t),o=(r=this.us)==null?void 0:r.get(t);a&&o!=null&&o.variants[a]&&this.hs(o.name,a,o.variants[a].transforms)}})}}previewWebExperiment(){var e=vx.getWindowLocation();if(e!=null&&e.search){var t=V8(e==null?void 0:e.search,"__experiment_id"),n=V8(e==null?void 0:e.search,"__experiment_variant");t&&n&&(vx.ls("previewing web experiments "+t+" && "+n),this.getWebExperiments(r=>{this.vs(parseInt(t),n,r)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this._instance.config.disable_web_experiments&&!n)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance.Ee({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:a=>{if(a.statusCode!==200||!a.json)return e([]);var o=a.json.experiments||[];return e(o)}})}vs(e,t,n){var r=n.filter(a=>a.id===e);r&&r.length>0&&(vx.ls("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.hs(r[0].name,t,r[0].variants[t].transforms))}static ds(e){return!yv(e.conditions)&&vx.cs(e)&&vx.fs(e)}static cs(e){var t;if(yv(e.conditions)||yv((t=e.conditions)==null?void 0:t.url))return!0;var n,r,a,o=vx.getWindowLocation();return!!o&&((n=e.conditions)==null||!n.url||nWe[(r=(a=e.conditions)==null?void 0:a.urlMatchType)!==null&&r!==void 0?r:"icontains"](e.conditions.url,o))}static getWindowLocation(){return Ka==null?void 0:Ka.location}static fs(e){var t;if(yv(e.conditions)||yv((t=e.conditions)==null?void 0:t.utm))return!0;var n=Dpe();if(n.utm_source){var r,a,o,s,l,c,u,A,f=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_campaign)==n.utm_campaign,p=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_source)==n.utm_source,v=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==n.utm_medium,B=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((A=e.conditions)==null||(A=A.utm)==null?void 0:A.utm_term)==n.utm_term;return f&&v&&B&&p}return!1}static ls(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];yd.info("[WebExperiments] "+e,n)}hs(e,t,n){this._is_bot()?vx.ls("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?n.forEach(r=>{if(r.selector){var a;vx.ls("applying transform of variant "+t+" for experiment "+e+" ",r);var o=(a=document)==null?void 0:a.querySelectorAll(r.selector);o==null||o.forEach(s=>{var l=s;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)})}}):vx.ls("Control variants leave the page unmodified.")}_is_bot(){return PB&&this._instance?Jpe(PB,this._instance.config.custom_blocked_useragents):void 0}}var r5={},eY=()=>{},WM="posthog",Zpe=!vZe&&(lB==null?void 0:lB.indexOf("MSIE"))===-1&&(lB==null?void 0:lB.indexOf("Mozilla"))===-1,Wpe=i=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:WJe(YA==null?void 0:YA.location),persistence:"localStorage+cookie",persistence_name:"",loaded:eY,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:i!=="2025-05-24"||"history_change",capture_pageleave:"if_capture_pageview",defaults:i??"unset",debug:sB&&U1(sB==null?void 0:sB.search)&&sB.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_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(Ka==null||(e=Ka.location)==null?void 0:e.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",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,session_recording:{},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_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var n="Bad HTTP status: "+t.statusCode+" "+t.text;yd.error(n)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:$H},error_tracking:{},_onCapture:eY}},Xpe=i=>{var e={};wu(i.process_person)||(e.person_profiles=i.process_person),wu(i.xhr_headers)||(e.request_headers=i.xhr_headers),wu(i.cookie_name)||(e.persistence_name=i.cookie_name),wu(i.disable_cookie)||(e.disable_persistence=i.disable_cookie),wu(i.store_google)||(e.save_campaign_params=i.store_google),wu(i.verbose)||(e.debug=i.verbose);var t=bE({},e,i);return qI(i.property_blacklist)&&(wu(i.property_denylist)?t.property_denylist=i.property_blacklist:qI(i.property_denylist)?t.property_denylist=[...i.property_blacklist,...i.property_denylist]:yd.error("Invalid value for property_denylist config: "+i.property_denylist)),t};class iWe{constructor(){this.__forceAllowLocalhost=!1}get ps(){return this.__forceAllowLocalhost}set ps(e){yd.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class uU{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new iWe,this.gs=!1,this.version=AQ.LIB_VERSION,this._s=new Hpe,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Wpe(),this.SentryIntegration=cZe,this.sentryIntegration=e=>function(t,n){var r=ape(t,n);return{name:rpe,processEvent:a=>r(a)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.bs=!1,this.ys=null,this.ws=null,this.Ss=null,this.featureFlags=new FZe(this),this.toolbar=new AZe(this),this.scrollManager=new JZe(this),this.pageViewManager=new mZe(this),this.surveys=new zZe(this),this.experiments=new vx(this),this.exceptions=new EZe(this),this.rateLimiter=new HZe(this),this.requestRouter=new tWe(this),this.consent=new vqe(this),this.people={set:(e,t,n)=>{var r=U1(e)?{[e]:t}:e;this.setPersonProperties(r),n==null||n({})},set_once:(e,t,n)=>{var r=U1(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n==null||n({})}},this.on("eventCaptured",e=>yd.info('send "'+(e==null?void 0:e.event)+'"',e))}init(e,t,n){if(n&&n!==WM){var r,a=(r=r5[n])!==null&&r!==void 0?r:new uU;return a._init(e,t,n),r5[n]=a,r5[WM][n]=a,a}return this._init(e,t,n)}_init(e,t,n){var r,a;if(t===void 0&&(t={}),wu(e)||eH(e))return yd.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return yd.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.$s=t,this.ks=[],t.person_profiles&&(this.ws=t.person_profiles),this.set_config(bE({},Wpe(t.defaults),Xpe(t),{name:n,token:e})),this.config.on_xhr_error&&yd.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:dQ.GZipJS,this.persistence=new ZH(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ZH(vA({},this.config,{persistence:"sessionStorage"}));var o=vA({},this.persistence.props),s=vA({},this.sessionPersistence.props);if(this.register({$initialization_time:new Date().toISOString()}),this.xs=new VZe(b=>this.Es(b),this.config.request_queue_config),this.Is=new jZe(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new WZe(this),this.sessionPropsManager=new ZZe(this,this.sessionManager,this.persistence)),new fZe(this).startIfEnabledOrStop(),this.siteApps=new $Ze(this),(r=this.siteApps)==null||r.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new sZe(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new Aqe(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new gZe(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new hZe(this),this.exceptionObserver=new Eqe(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new whe(this,Iqe),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new Pqe(this),this.historyAutocapture.startIfEnabled(),AQ.DEBUG=AQ.DEBUG||this.config.debug,AQ.DEBUG&&yd.info("Starting in debug mode",{this:this,config:t,thisC:vA({},this.config),p:o,s}),this.Ps(),((a=t.bootstrap)==null?void 0:a.distinctID)!==void 0){var l,c,u=this.config.get_device_id(xw()),A=(l=t.bootstrap)!=null&&l.isIdentifiedID?u:t.bootstrap.distinctID;this.persistence.set_property(fQ,(c=t.bootstrap)!=null&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:A})}if(this.Rs()){var f,p,v=Object.keys(((f=t.bootstrap)==null?void 0:f.featureFlags)||{}).filter(b=>{var Q;return!((Q=t.bootstrap)==null||(Q=Q.featureFlags)==null||!Q[b])}).reduce((b,Q)=>{var R;return b[Q]=((R=t.bootstrap)==null||(R=R.featureFlags)==null?void 0:R[Q])||!1,b},{}),B=Object.keys(((p=t.bootstrap)==null?void 0:p.featureFlagPayloads)||{}).filter(b=>v[b]).reduce((b,Q)=>{var R,k;return(R=t.bootstrap)!=null&&(R=R.featureFlagPayloads)!=null&&R[Q]&&(b[Q]=(k=t.bootstrap)==null||(k=k.featureFlagPayloads)==null?void 0:k[Q]),b},{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:B})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:O8,$device_id:null},"");else if(!this.get_distinct_id()){var x=this.config.get_device_id(xw());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(fQ,"anonymous")}return d1(Ka,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?lZe(this,()=>this.Ts()):this.Ts(),ob(this.config._onCapture)&&this.config._onCapture!==eY&&(yd.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",b=>this.config._onCapture(b.event,b))),this}Ie(e){var t,n,r,a,o,s,l,c;if(!YA||!YA.body)return yd.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Ie(e)},500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=xm(e.supportedCompression,dQ.GZipJS)?dQ.GZipJS:xm(e.supportedCompression,dQ.Base64)?dQ.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.ws?this.ws:"identified_only"}),(n=this.siteApps)==null||n.onRemoteConfig(e),(r=this.sessionRecording)==null||r.onRemoteConfig(e),(a=this.autocapture)==null||a.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(s=this.webVitalsAutocapture)==null||s.onRemoteConfig(e),(l=this.exceptionObserver)==null||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(c=this.deadClicksAutocapture)==null||c.onRemoteConfig(e)}Ts(){try{this.config.loaded(this)}catch(e){yd.critical("`loaded` function failed",e)}this.Ms(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this.Cs()},1),new YZe(this).load(),this.featureFlags.flags()}Ms(){var e;this.has_opted_out_capturing()||this.config.request_batching&&((e=this.xs)==null||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||Ew(this.__request_queue,e=>this.Es(e)),this.__request_queue=[],this.Ms()}_handle_unload(){var e,t;this.config.request_batching?(this.Fs()&&this.capture("$pageleave"),(e=this.xs)==null||e.unload(),(t=this.Is)==null||t.unload()):this.Fs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Ee(e){this.__loaded&&(Zpe?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=aU(e.url,{ip:this.config.ip?1:0}),e.headers=vA({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var n,r,a,o=vA({},t);o.timeout=o.timeout||6e4,o.url=aU(o.url,{_:new Date().getTime().toString(),ver:AQ.LIB_VERSION,compression:o.compression});var s=(n=o.transport)!==null&&n!==void 0?n:"fetch",l=(r=(a=Zfe(ZR,c=>c.transport===s))==null?void 0:a.method)!==null&&r!==void 0?r:ZR[0].method;if(!l)throw new Error("No available transport method");l(o)})(vA({},e,{callback:t=>{var n,r;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((n=(r=this.config).on_request_error)==null||n.call(r,t)),e.callback==null||e.callback(t)}}))))}Es(e){this.Is?this.Is.retriableRequest(e):this.Ee(e)}_execute_array(e){var t,n=[],r=[],a=[];Ew(e,s=>{s&&(t=s[0],qI(t)?a.push(s):ob(s)?s.call(this):qI(s)&&t==="alias"?n.push(s):qI(s)&&t.indexOf("capture")!==-1&&ob(this[t])?a.push(s):r.push(s))});var o=function(s,l){Ew(s,function(c){if(qI(c[0])){var u=l;zC(c,function(A){u=u[A[0]].apply(u,A.slice(1))})}else this[c[0]].apply(this,c.slice(1))},l)};o(n,this),o(r,this),o(a,this)}Rs(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,n){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.xs){if(!this.consent.isOptedOut())if(!wu(e)&&U1(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var a=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a==null||!a.isRateLimited){t!=null&&t.$current_url&&!U1(t==null?void 0:t.$current_url)&&(yd.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&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();var o=new Date,s=(n==null?void 0:n.timestamp)||o,l=xw(),c={uuid:l,event:e,properties:this.calculateEventProperties(e,t||{},s,l)};a&&(c.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens),n!=null&&n.$set&&(c.$set=n==null?void 0:n.$set);var u,A,f=this.Os(n==null?void 0:n.$set_once);if(f&&(c.$set_once=f),(c=qJe(c,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=s,wu(n==null?void 0:n.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=o),e===XH.DISMISSED||e===XH.SENT){var p=t==null?void 0:t[Ype.SURVEY_ID],v=t==null?void 0:t[Ype.SURVEY_ITERATION];localStorage.setItem((A=""+WH+(u={id:p,current_iteration:v}).id,u.current_iteration&&u.current_iteration>0&&(A=""+WH+u.id+"_"+u.current_iteration),A),"true"),c.$set=vA({},c.$set,{[LZe({id:p,current_iteration:v},e===XH.SENT?"responded":"dismissed")]:!0})}var B=vA({},c.properties.$set,c.$set);if(kM(B)||this.setPersonPropertiesForFlags(B),!yv(this.config.before_send)){var x=this.As(c);if(!x)return;c=x}this._s.emit("eventCaptured",c);var b={method:"POST",url:(r=n==null?void 0:n._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:n==null?void 0:n._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.Es(b):this.xs.enqueue(b),c}yd.critical("This capture call is ignored due to client rate limiting.")}}else yd.error("No event name provided to posthog.capture")}else yd.uninitializedWarning("posthog.capture")}Ge(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,n,r,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var o=a?void 0:this.persistence.remove_event_timer(e),s=vA({},t);if(s.token=this.config.token,s.$config_defaults=this.config.defaults,this.config.__preview_experimental_cookieless_mode&&(s.$cookieless_mode=!0),e==="$snapshot"){var l=vA({},this.persistence.properties(),this.sessionPersistence.properties());return s.distinct_id=l.distinct_id,(!U1(s.distinct_id)&&!gx(s.distinct_id)||eH(s.distinct_id))&&yd.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),s}var c,u=UZe(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:A,windowId:f}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime());s.$session_id=A,s.$window_id=f}this.sessionPropsManager&&bE(s,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&bE(s,this.sessionRecording.sdkDebugProperties),s.$sdk_debug_retry_queue_size=(p=this.Is)==null?void 0:p.length}catch(b){s.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===i5.CUSTOM&&(s.$lib_custom_api_host=this.config.api_host),c=e!=="$pageview"||a?e!=="$pageleave"||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),s=bE(s,c),e==="$pageview"&&YA&&(s.title=YA.title),!wu(o)){var v=n.getTime()-o;s.$duration=parseFloat((v/1e3).toFixed(3))}lB&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?"bot":"browser"),(s=bE({},u,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),qI(this.config.property_denylist)?zC(this.config.property_denylist,function(b){delete s[b]}):yd.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var B=this.config.sanitize_properties;B&&(yd.error("sanitize_properties is deprecated. Use before_send instead"),s=B(s,e));var x=this.Ds();return s.$process_person_profile=x,x&&!a&&this.Ls("_calculate_event_properties"),s}Os(e){var t;if(!this.persistence||!this.Ds()||this.gs)return e;var n=this.persistence.get_initial_props(),r=(t=this.sessionPropsManager)==null?void 0:t.getSetOnceProps(),a=bE({},n,r||{},e||{}),o=this.config.sanitize_properties;return o&&(yd.error("sanitize_properties is deprecated. Use before_send instead"),a=o(a,"$set_once")),this.gs=!0,kM(a)?void 0:a}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var r;(r=this.persistence)==null||r.register_once(e,t,n)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}js(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch{return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,n)}on(e,t){return this._s.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,n){if(!this.__loaded||!this.persistence)return yd.uninitializedWarning("posthog.identify");if(gx(e)&&(e=e.toString(),yd.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))yd.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.');else if(e!==O8){if(this.Ls("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var a=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:a},"")}e!==r&&e!==this.get_property(LR)&&(this.unregister(LR),this.register({distinct_id:e}));var o=(this.persistence.get_property(fQ)||"anonymous")==="anonymous";e!==r&&o?(this.persistence.set_property(fQ,"identified"),this.setPersonPropertiesForFlags(vA({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.Ss=Ape(e,t,n),this.featureFlags.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(F8))}}else yd.critical('The string "'+O8+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else yd.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.Ls("posthog.setPersonProperties")){var n=Ape(this.get_distinct_id(),e,t);this.Ss!==n?(this.setPersonPropertiesForFlags(vA({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Ss=n):yd.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,n){if(e&&t){if(this.Ls("posthog.group")){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:vA({},r,{[e]:t})}),n&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags({[e]:n})),r[e]===t||n||this.reloadFeatureFlags()}}else yd.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.Ls("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,n,r,a;if(yd.info("reset"),!this.__loaded)return yd.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),(r=this.persistence)==null||r.set_property(fQ,"anonymous"),(a=this.sessionManager)==null||a.resetSessionId(),this.Ss=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:O8,$device_id:null},"");else{var s=this.config.get_device_id(xw());this.register_once({distinct_id:s,$device_id:e?s:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&n){var a,o=(a=e.timestampLookBack)!==null&&a!==void 0?a:10;if(!n)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-o,0)}return r}alias(e,t){return e===this.get_property(Wfe)?(yd.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ls("posthog.alias")?(wu(t)&&(t=this.get_distinct_id()),e!==t?(this.js(LR,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(yd.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t,n,r,a,o=vA({},this.config);T1(e)&&(bE(this.config,Xpe(e)),(t=this.persistence)==null||t.update_config(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ZH(vA({},this.config,{persistence:"sessionStorage"})),VE.O()&&VE.D("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(AQ.DEBUG=!0,yd.info("set_config",{config:e,oldConfig:o,newConfig:vA({},this.config)})),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),(r=this.autocapture)==null||r.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),this.surveys.loadIfEnabled(),this.Ps())}startSessionRecording(e){var t=e===!0,n={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(n).some(Boolean)){var r,a,o,s,l;(r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),n.sampling&&((a=this.sessionRecording)==null||a.overrideSampling()),n.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),n.url_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger("url")),n.event_trigger&&((l=this.sessionRecording)==null||l.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.started)}captureException(e,t){var n=new Error("PostHog syntheticException");this.exceptions.sendExceptionEvent(vA({},Uqe((r=>r instanceof Error)(e)?{error:e,event:e.message}:{event:e},{syntheticException:n}),t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:WM;return t!==WM&&(t=WM+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(fQ))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(fQ))==="identified"}Ds(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&kM(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[LR])&&((t=this.persistence)==null||(t=t.props)==null||!t[L8]))}Fs(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Ds()||this.Ls("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Ls(e){return this.config.person_profiles==="never"?(yd.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.js(L8,!0),!0)}Ps(){var e,t,n,r,a=this.consent.isOptedOut(),o=this.config.opt_out_persistence_by_default,s=this.config.disable_persistence||a&&!!o;((e=this.persistence)==null?void 0:e.Fe)!==s&&((n=this.persistence)==null||n.set_disabled(s)),((t=this.sessionPersistence)==null?void 0:t.Fe)!==s&&((r=this.sessionPersistence)==null||r.set_disabled(s))}opt_in_capturing(e){var t;this.consent.optInOut(!0),this.Ps(),(wu(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((t=e==null?void 0:e.captureEventName)!==null&&t!==void 0?t:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Cs()}opt_out_capturing(){this.consent.optInOut(!1),this.Ps()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this.Ps()}_is_bot(){return PB?Jpe(PB,this.config.custom_blocked_useragents):void 0}Cs(){YA&&(YA.visibilityState==="visible"?this.bs||(this.bs=!0,this.capture("$pageview",{title:YA.title},{send_instantly:!0}),this.ys&&(YA.removeEventListener("visibilitychange",this.ys),this.ys=null)):this.ys||(this.ys=this.Cs.bind(this),d1(YA,"visibilitychange",this.ys)))}debug(e){e===!1?(Ka==null||Ka.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(Ka==null||Ka.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)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}I(){var e,t,n,r,a,o,s,l=this.$s||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(yd.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):(n="advanced_disable_decide",r=!1,a=yd,o=(t="advanced_disable_flags")in(e=l)&&!wu(e[t]),s=n in e&&!wu(e[n]),o?e[t]:s?(a&&a.warn("Config field '"+n+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[n]):r)}As(e){if(yv(this.config.before_send))return e;var t=qI(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var r of t){if(n=r(n),yv(n)){var a="Event '"+e.event+"' was rejected in beforeSend function";return KJe(e.event)?yd.warn(a+". This can cause unexpected behavior."):yd.info(a),null}n.properties&&!kM(n.properties)||yd.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return n}getPageViewId(){var e;return(e=this.pageViewManager.ce)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}}(function(i,e){for(var t=0;t<e.length;t++)i.prototype[e[t]]=JJe(i.prototype[e[t]])})(uU,["identify"]);var $pe,AU=($pe=r5[WM]=new uU,function(){function i(){i.done||(i.done=!0,Zpe=!1,zC(r5,function(e){e._dom_loaded()}))}YA!=null&&YA.addEventListener?YA.readyState==="complete"?i():d1(YA,"DOMContentLoaded",i,{capture:!1}):Ka&&yd.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),$pe);!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1")&&(AU.__loaded||AU.init("phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo",{api_host:"https://postpig.tscircuit.com",person_profiles:"always"}));function gI(...i){return OJe(dS(i))}const ege=i=>i.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),rWe=uJe,tge=It.forwardRef(({className:i,...e},t)=>ht.jsx(wfe,{ref:t,className:gI("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",i),...e}));tge.displayName=wfe.displayName;const XM=It.forwardRef(({className:i,...e},t)=>ht.jsx(Mfe,{ref:t,className:gI("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",i),...e}));XM.displayName=Mfe.displayName;const yS=It.forwardRef(({className:i,...e},t)=>ht.jsx(Dfe,{ref:t,className:gI("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",i),...e}));yS.displayName=Dfe.displayName;var Py;(function(i){i.assertEqual=r=>{};function e(r){}i.assertIs=e;function t(r){throw new Error}i.assertNever=t,i.arrayToEnum=r=>{const a={};for(const o of r)a[o]=o;return a},i.getValidEnumValues=r=>{const a=i.objectKeys(r).filter(s=>typeof r[r[s]]!="number"),o={};for(const s of a)o[s]=r[s];return i.objectValues(o)},i.objectValues=r=>i.objectKeys(r).map(function(a){return r[a]}),i.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const a=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&a.push(o);return a},i.find=(r,a)=>{for(const o of r)if(a(o))return o},i.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function n(r,a=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}i.joinValues=n,i.jsonStringifyReplacer=(r,a)=>typeof a=="bigint"?a.toString():a})(Py||(Py={}));var nge;(function(i){i.mergeShapes=(e,t)=>({...e,...t})})(nge||(nge={}));const VA=Py.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ww=i=>{switch(typeof i){case"undefined":return VA.undefined;case"string":return VA.string;case"number":return Number.isNaN(i)?VA.nan:VA.number;case"boolean":return VA.boolean;case"function":return VA.function;case"bigint":return VA.bigint;case"symbol":return VA.symbol;case"object":return Array.isArray(i)?VA.array:i===null?VA.null:i.then&&typeof i.then=="function"&&i.catch&&typeof i.catch=="function"?VA.promise:typeof Map<"u"&&i instanceof Map?VA.map:typeof Set<"u"&&i instanceof Set?VA.set:typeof Date<"u"&&i instanceof Date?VA.date:VA.object;default:return VA.unknown}},pl=Py.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"]);let vS=class hKe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},r=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let s=n,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return r(this),n}static assert(e){if(!(e instanceof hKe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Py.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};vS.create=i=>new vS(i);const a5=(i,e)=>{let t;switch(i.code){case pl.invalid_type:i.received===VA.undefined?t="Required":t=`Expected ${i.expected}, received ${i.received}`;break;case pl.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(i.expected,Py.jsonStringifyReplacer)}`;break;case pl.unrecognized_keys:t=`Unrecognized key(s) in object: ${Py.joinValues(i.keys,", ")}`;break;case pl.invalid_union:t="Invalid input";break;case pl.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Py.joinValues(i.options)}`;break;case pl.invalid_enum_value:t=`Invalid enum value. Expected ${Py.joinValues(i.options)}, received '${i.received}'`;break;case pl.invalid_arguments:t="Invalid function arguments";break;case pl.invalid_return_type:t="Invalid function return type";break;case pl.invalid_date:t="Invalid date";break;case pl.invalid_string:typeof i.validation=="object"?"includes"in i.validation?(t=`Invalid input: must include "${i.validation.includes}"`,typeof i.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${i.validation.position}`)):"startsWith"in i.validation?t=`Invalid input: must start with "${i.validation.startsWith}"`:"endsWith"in i.validation?t=`Invalid input: must end with "${i.validation.endsWith}"`:Py.assertNever(i.validation):i.validation!=="regex"?t=`Invalid ${i.validation}`:t="Invalid";break;case pl.too_small:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at least":"more than"} ${i.minimum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at least":"over"} ${i.minimum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${i.minimum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(i.minimum))}`:t="Invalid input";break;case pl.too_big:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at most":"less than"} ${i.maximum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at most":"under"} ${i.maximum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="bigint"?t=`BigInt must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly":i.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(i.maximum))}`:t="Invalid input";break;case pl.custom:t="Invalid input";break;case pl.invalid_intersection_types:t="Intersection results could not be merged";break;case pl.not_multiple_of:t=`Number must be a multiple of ${i.multipleOf}`;break;case pl.not_finite:t="Number must be finite";break;default:t=e.defaultError,Py.assertNever(i)}return{message:t}};let aWe=a5;function tY(){return aWe}const nY=i=>{const{data:e,path:t,errorMaps:n,issueData:r}=i,a=[...t,...r.path||[]],o={...r,path:a};if(r.message!==void 0)return{...r,path:a,message:r.message};let s="";const l=n.filter(c=>!!c).slice().reverse();for(const c of l)s=c(o,{data:e,defaultError:s}).message;return{...r,path:a,message:s}};function Ou(i,e){const t=tY(),n=nY({issueData:e,data:i.data,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,t,t===a5?void 0:a5].filter(r=>!!r)});i.common.issues.push(n)}let FB=class pKe{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if(r.status==="aborted")return Kp;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const a=await r.key,o=await r.value;n.push({key:a,value:o})}return pKe.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:a,value:o}=r;if(a.status==="aborted"||o.status==="aborted")return Kp;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}};const Kp=Object.freeze({status:"aborted"}),o5=i=>({status:"dirty",value:i}),uB=i=>({status:"valid",value:i}),ige=i=>i.status==="aborted",rge=i=>i.status==="dirty",$M=i=>i.status==="valid",dU=i=>typeof Promise<"u"&&i instanceof Promise;var uf;(function(i){i.errToObj=e=>typeof e=="string"?{message:e}:e||{},i.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(uf||(uf={}));var fU=function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},age=function(i,e,t,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(i,t):r?r.value=t:e.set(i,t),t},s5,l5;let CS=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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 oge=(i,e)=>{if($M(e))return{success:!0,data:e.value};if(!i.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new vS(i.common.issues);return this._error=t,this._error}}};function i0(i){if(!i)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:r}=i;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,s)=>{const{message:l}=i;return o.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:l??t??s.defaultError}},description:r}}let Bm=class{get description(){return this._def.description}_getType(e){return ww(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ww(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new FB,ctx:{common:e.parent.common,data:e.data,parsedType:ww(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(dU(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ww(e)},r=this._parseSync({data:e,path:n.path,parent:n});return oge(n,r)}"~validate"(e){var n,r;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ww(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return $M(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(r=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>$M(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ww(e)},r=this._parse({data:e,path:n.path,parent:n}),a=await(dU(r)?r:Promise.resolve(r));return oge(n,a)}refine(e,t){const n=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,a)=>{const o=e(r),s=()=>a.addIssue({code:pl.custom,...n(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new V9({schema:this,typeName:bp.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:t=>this["~validate"](t)}}optional(){return vQ.create(this,this._def)}nullable(){return K9.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return t3.create(this)}promise(){return u5.create(this,this._def)}or(e){return gU.create([this,e],this._def)}and(e){return mU.create(this,e,this._def)}transform(e){return new V9({...i0(this._def),schema:this,typeName:bp.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new CU({...i0(this._def),innerType:this,defaultValue:t,typeName:bp.ZodDefault})}brand(){return new mge({typeName:bp.ZodBranded,type:this,...i0(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new IU({...i0(this._def),innerType:this,catchValue:t,typeName:bp.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return DWe.create(this,e)}readonly(){return EU.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const oWe=/^c[^\s-]{8,}$/i,sWe=/^[0-9a-z]+$/,lWe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,cWe=/^[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,uWe=/^[a-z0-9_-]{21}$/i,AWe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,dWe=/^[-+]?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)?)??$/,fWe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,hWe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let iY;const pWe=/^(?:(?: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])$/,gWe=/^(?:(?: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])$/,mWe=/^(([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]))$/,yWe=/^(([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])$/,vWe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,CWe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,sge="((\\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])))",IWe=new RegExp(`^${sge}$`);function lge(i){let e="[0-5]\\d";i.precision?e=`${e}\\.\\d{${i.precision}}`:i.precision==null&&(e=`${e}(\\.\\d+)?`);const t=i.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function EWe(i){return new RegExp(`^${lge(i)}$`)}function _We(i){let e=`${sge}T${lge(i)}`;const t=[];return t.push(i.local?"Z?":"Z"),i.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function xWe(i,e){return!!((e==="v4"||!e)&&pWe.test(i)||(e==="v6"||!e)&&mWe.test(i))}function BWe(i,e){if(!AWe.test(i))return!1;try{const[t]=i.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(n));return!(typeof r!="object"||r===null||"typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function bWe(i,e){return!!((e==="v4"||!e)&&gWe.test(i)||(e==="v6"||!e)&&yWe.test(i))}let hU=class y8 extends Bm{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==VA.string){const a=this._getOrReturnCtx(e);return Ou(a,{code:pl.invalid_type,expected:VA.string,received:a.parsedType}),Kp}const n=new FB;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(r=this._getOrReturnCtx(e,r),o?Ou(r,{code:pl.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&Ou(r,{code:pl.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")fWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"email",code:pl.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")iY||(iY=new RegExp(hWe,"u")),iY.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"emoji",code:pl.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")cWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"uuid",code:pl.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")uWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"nanoid",code:pl.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")oWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"cuid",code:pl.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")sWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"cuid2",code:pl.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")lWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"ulid",code:pl.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),Ou(r,{validation:"url",code:pl.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"regex",code:pl.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?_We(a).test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?IWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?EWe(a).test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?dWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"duration",code:pl.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?xWe(e.data,a.version)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"ip",code:pl.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?BWe(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"jwt",code:pl.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?bWe(e.data,a.version)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"cidr",code:pl.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?vWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"base64",code:pl.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?CWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"base64url",code:pl.invalid_string,message:a.message}),n.dirty()):Py.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(r=>e.test(r),{validation:t,code:pl.invalid_string,...uf.errToObj(n)})}_addCheck(e){return new y8({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...uf.errToObj(e)})}url(e){return this._addCheck({kind:"url",...uf.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...uf.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...uf.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...uf.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...uf.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...uf.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...uf.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...uf.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...uf.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...uf.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...uf.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...uf.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==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...uf.errToObj(e==null?void 0: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==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...uf.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...uf.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...uf.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...uf.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...uf.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...uf.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...uf.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...uf.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...uf.errToObj(t)})}nonempty(e){return this.min(1,uf.errToObj(e))}trim(){return new y8({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new y8({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new y8({...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 t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};hU.create=i=>new hU({checks:[],typeName:bp.ZodString,coerce:(i==null?void 0:i.coerce)??!1,...i0(i)});function SWe(i,e){const t=(i.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=t>n?t:n,a=Number.parseInt(i.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return a%o/10**r}let rY=class Sde extends Bm{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)!==VA.number){const a=this._getOrReturnCtx(e);return Ou(a,{code:pl.invalid_type,expected:VA.number,received:a.parsedType}),Kp}let n;const r=new FB;for(const a of this._def.checks)a.kind==="int"?Py.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?SWe(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.not_finite,message:a.message}),r.dirty()):Py.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,uf.toString(t))}gt(e,t){return this.setLimit("min",e,!1,uf.toString(t))}lte(e,t){return this.setLimit("max",e,!0,uf.toString(t))}lt(e,t){return this.setLimit("max",e,!1,uf.toString(t))}setLimit(e,t,n,r){return new Sde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:uf.toString(r)}]})}_addCheck(e){return new Sde({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:uf.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:uf.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:uf.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:uf.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:uf.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:uf.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:uf.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:uf.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:uf.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Py.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};rY.create=i=>new rY({checks:[],typeName:bp.ZodNumber,coerce:(i==null?void 0:i.coerce)||!1,...i0(i)});let cge=class Qde extends Bm{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)!==VA.bigint)return this._getInvalidInput(e);let n;const r=new FB;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):Py.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ou(t,{code:pl.invalid_type,expected:VA.bigint,received:t.parsedType}),Kp}gte(e,t){return this.setLimit("min",e,!0,uf.toString(t))}gt(e,t){return this.setLimit("min",e,!1,uf.toString(t))}lte(e,t){return this.setLimit("max",e,!0,uf.toString(t))}lt(e,t){return this.setLimit("max",e,!1,uf.toString(t))}setLimit(e,t,n,r){return new Qde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:uf.toString(r)}]})}_addCheck(e){return new Qde({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:uf.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:uf.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:uf.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:uf.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:uf.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};cge.create=i=>new cge({checks:[],typeName:bp.ZodBigInt,coerce:(i==null?void 0:i.coerce)??!1,...i0(i)});let aY=class extends Bm{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==VA.boolean){const n=this._getOrReturnCtx(e);return Ou(n,{code:pl.invalid_type,expected:VA.boolean,received:n.parsedType}),Kp}return uB(e.data)}};aY.create=i=>new aY({typeName:bp.ZodBoolean,coerce:(i==null?void 0:i.coerce)||!1,...i0(i)});let uge=class gKe extends Bm{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==VA.date){const a=this._getOrReturnCtx(e);return Ou(a,{code:pl.invalid_type,expected:VA.date,received:a.parsedType}),Kp}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return Ou(a,{code:pl.invalid_date}),Kp}const n=new FB;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Py.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new gKe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:uf.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:uf.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};uge.create=i=>new uge({checks:[],coerce:(i==null?void 0:i.coerce)||!1,typeName:bp.ZodDate,...i0(i)});let Age=class extends Bm{_parse(e){if(this._getType(e)!==VA.symbol){const n=this._getOrReturnCtx(e);return Ou(n,{code:pl.invalid_type,expected:VA.symbol,received:n.parsedType}),Kp}return uB(e.data)}};Age.create=i=>new Age({typeName:bp.ZodSymbol,...i0(i)});let oY=class extends Bm{_parse(e){if(this._getType(e)!==VA.undefined){const n=this._getOrReturnCtx(e);return Ou(n,{code:pl.invalid_type,expected:VA.undefined,received:n.parsedType}),Kp}return uB(e.data)}};oY.create=i=>new oY({typeName:bp.ZodUndefined,...i0(i)});let pU=class extends Bm{_parse(e){if(this._getType(e)!==VA.null){const n=this._getOrReturnCtx(e);return Ou(n,{code:pl.invalid_type,expected:VA.null,received:n.parsedType}),Kp}return uB(e.data)}};pU.create=i=>new pU({typeName:bp.ZodNull,...i0(i)});let c5=class extends Bm{constructor(){super(...arguments),this._any=!0}_parse(e){return uB(e.data)}};c5.create=i=>new c5({typeName:bp.ZodAny,...i0(i)});let e3=class extends Bm{constructor(){super(...arguments),this._unknown=!0}_parse(e){return uB(e.data)}};e3.create=i=>new e3({typeName:bp.ZodUnknown,...i0(i)});let Mw=class extends Bm{_parse(e){const t=this._getOrReturnCtx(e);return Ou(t,{code:pl.invalid_type,expected:VA.never,received:t.parsedType}),Kp}};Mw.create=i=>new Mw({typeName:bp.ZodNever,...i0(i)});let dge=class extends Bm{_parse(e){if(this._getType(e)!==VA.undefined){const n=this._getOrReturnCtx(e);return Ou(n,{code:pl.invalid_type,expected:VA.void,received:n.parsedType}),Kp}return uB(e.data)}};dge.create=i=>new dge({typeName:bp.ZodVoid,...i0(i)});let t3=class Qz extends Bm{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==VA.array)return Ou(t,{code:pl.invalid_type,expected:VA.array,received:t.parsedType}),Kp;if(r.exactLength!==null){const o=t.data.length>r.exactLength.value,s=t.data.length<r.exactLength.value;(o||s)&&(Ou(t,{code:o?pl.too_big:pl.too_small,minimum:s?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(Ou(t,{code:pl.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(Ou(t,{code:pl.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,s)=>r.type._parseAsync(new CS(t,o,t.path,s)))).then(o=>FB.mergeArray(n,o));const a=[...t.data].map((o,s)=>r.type._parseSync(new CS(t,o,t.path,s)));return FB.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Qz({...this._def,minLength:{value:e,message:uf.toString(t)}})}max(e,t){return new Qz({...this._def,maxLength:{value:e,message:uf.toString(t)}})}length(e,t){return new Qz({...this._def,exactLength:{value:e,message:uf.toString(t)}})}nonempty(e){return this.min(1,e)}};t3.create=(i,e)=>new t3({type:i,minLength:null,maxLength:null,exactLength:null,typeName:bp.ZodArray,...i0(e)});function n3(i){if(i instanceof mQ){const e={};for(const t in i.shape){const n=i.shape[t];e[t]=vQ.create(n3(n))}return new mQ({...i._def,shape:()=>e})}else return i instanceof t3?new t3({...i._def,type:n3(i.element)}):i instanceof vQ?vQ.create(n3(i.unwrap())):i instanceof K9?K9.create(n3(i.unwrap())):i instanceof Y9?Y9.create(i.items.map(e=>n3(e))):i}let mQ=class lS extends Bm{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(),t=Py.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==VA.object){const c=this._getOrReturnCtx(e);return Ou(c,{code:pl.invalid_type,expected:VA.object,received:c.parsedType}),Kp}const{status:n,ctx:r}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof Mw&&this._def.unknownKeys==="strip"))for(const c in r.data)o.includes(c)||s.push(c);const l=[];for(const c of o){const u=a[c],A=r.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new CS(r,A,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof Mw){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(c==="strict")s.length>0&&(Ou(r,{code:pl.unrecognized_keys,keys:s}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of s){const A=r.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new CS(r,A,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const A=await u.key,f=await u.value;c.push({key:A,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>FB.mergeObjectSync(n,c)):FB.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return uf.errToObj,new lS({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var a,o;const r=((o=(a=this._def).errorMap)==null?void 0:o.call(a,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:uf.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new lS({...this._def,unknownKeys:"strip"})}passthrough(){return new lS({...this._def,unknownKeys:"passthrough"})}extend(e){return new lS({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new lS({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:bp.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new lS({...this._def,catchall:e})}pick(e){const t={};for(const n of Py.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new lS({...this._def,shape:()=>t})}omit(e){const t={};for(const n of Py.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new lS({...this._def,shape:()=>t})}deepPartial(){return n3(this)}partial(e){const t={};for(const n of Py.objectKeys(this.shape)){const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new lS({...this._def,shape:()=>t})}required(e){const t={};for(const n of Py.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof vQ;)a=a._def.innerType;t[n]=a}return new lS({...this._def,shape:()=>t})}keyof(){return pge(Py.objectKeys(this.shape))}};mQ.create=(i,e)=>new mQ({shape:()=>i,unknownKeys:"strip",catchall:Mw.create(),typeName:bp.ZodObject,...i0(e)}),mQ.strictCreate=(i,e)=>new mQ({shape:()=>i,unknownKeys:"strict",catchall:Mw.create(),typeName:bp.ZodObject,...i0(e)}),mQ.lazycreate=(i,e)=>new mQ({shape:i,unknownKeys:"strip",catchall:Mw.create(),typeName:bp.ZodObject,...i0(e)});let gU=class extends Bm{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function r(a){for(const s of a)if(s.result.status==="valid")return s.result;for(const s of a)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;const o=a.map(s=>new vS(s.ctx.common.issues));return Ou(t,{code:pl.invalid_union,unionErrors:o}),Kp}if(t.common.async)return Promise.all(n.map(async a=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(r);{let a;const o=[];for(const l of n){const c={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const s=o.map(l=>new vS(l));return Ou(t,{code:pl.invalid_union,unionErrors:s}),Kp}}get options(){return this._def.options}};gU.create=(i,e)=>new gU({options:i,typeName:bp.ZodUnion,...i0(e)});const yQ=i=>i instanceof lY?yQ(i.schema):i instanceof V9?yQ(i.innerType()):i instanceof yU?[i.value]:i instanceof vU?i.options:i instanceof cY?Py.objectValues(i.enum):i instanceof CU?yQ(i._def.innerType):i instanceof oY?[void 0]:i instanceof pU?[null]:i instanceof vQ?[void 0,...yQ(i.unwrap())]:i instanceof K9?[null,...yQ(i.unwrap())]:i instanceof mge||i instanceof EU?yQ(i.unwrap()):i instanceof IU?yQ(i._def.innerType):[];let QWe=class mKe extends Bm{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==VA.object)return Ou(t,{code:pl.invalid_type,expected:VA.object,received:t.parsedType}),Kp;const n=this.discriminator,r=t.data[n],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(Ou(t,{code:pl.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Kp)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const a of t){const o=yQ(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of o){if(r.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);r.set(s,a)}}return new mKe({typeName:bp.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...i0(n)})}};function sY(i,e){const t=ww(i),n=ww(e);if(i===e)return{valid:!0,data:i};if(t===VA.object&&n===VA.object){const r=Py.objectKeys(e),a=Py.objectKeys(i).filter(s=>r.indexOf(s)!==-1),o={...i,...e};for(const s of a){const l=sY(i[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(t===VA.array&&n===VA.array){if(i.length!==e.length)return{valid:!1};const r=[];for(let a=0;a<i.length;a++){const o=i[a],s=e[a],l=sY(o,s);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return t===VA.date&&n===VA.date&&+i==+e?{valid:!0,data:i}:{valid:!1}}let mU=class extends Bm{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(a,o)=>{if(ige(a)||ige(o))return Kp;const s=sY(a.value,o.value);return s.valid?((rge(a)||rge(o))&&t.dirty(),{status:t.value,value:s.data}):(Ou(n,{code:pl.invalid_intersection_types}),Kp)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>r(a,o)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};mU.create=(i,e,t)=>new mU({left:i,right:e,typeName:bp.ZodIntersection,...i0(t)});let Y9=class yKe extends Bm{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==VA.array)return Ou(n,{code:pl.invalid_type,expected:VA.array,received:n.parsedType}),Kp;if(n.data.length<this._def.items.length)return Ou(n,{code:pl.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Kp;!this._def.rest&&n.data.length>this._def.items.length&&(Ou(n,{code:pl.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((o,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new CS(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>FB.mergeArray(t,o)):FB.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new yKe({...this._def,rest:e})}};Y9.create=(i,e)=>{if(!Array.isArray(i))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Y9({items:i,typeName:bp.ZodTuple,rest:null,...i0(e)})};let wWe=class wde extends Bm{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==VA.object)return Ou(n,{code:pl.invalid_type,expected:VA.object,received:n.parsedType}),Kp;const r=[],a=this._def.keyType,o=this._def.valueType;for(const s in n.data)r.push({key:a._parse(new CS(n,s,n.path,s)),value:o._parse(new CS(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?FB.mergeObjectAsync(t,r):FB.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof Bm?new wde({keyType:e,valueType:t,typeName:bp.ZodRecord,...i0(n)}):new wde({keyType:hU.create(),valueType:e,typeName:bp.ZodRecord,...i0(t)})}},fge=class extends Bm{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==VA.map)return Ou(n,{code:pl.invalid_type,expected:VA.map,received:n.parsedType}),Kp;const r=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,l],c)=>({key:r._parse(new CS(n,s,n.path,[c,"key"])),value:a._parse(new CS(n,l,n.path,[c,"value"]))}));if(n.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Kp;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),s.set(c.value,u.value)}return{status:t.value,value:s}})}else{const s=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Kp;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),s.set(c.value,u.value)}return{status:t.value,value:s}}}};fge.create=(i,e,t)=>new fge({valueType:e,keyType:i,typeName:bp.ZodMap,...i0(t)});let hge=class Mde extends Bm{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==VA.set)return Ou(n,{code:pl.invalid_type,expected:VA.set,received:n.parsedType}),Kp;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(Ou(n,{code:pl.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(Ou(n,{code:pl.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Kp;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}const s=[...n.data.values()].map((l,c)=>a._parse(new CS(n,l,n.path,c)));return n.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,t){return new Mde({...this._def,minSize:{value:e,message:uf.toString(t)}})}max(e,t){return new Mde({...this._def,maxSize:{value:e,message:uf.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};hge.create=(i,e)=>new hge({valueType:i,minSize:null,maxSize:null,typeName:bp.ZodSet,...i0(e)});let MWe=class wz extends Bm{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==VA.function)return Ou(t,{code:pl.invalid_type,expected:VA.function,received:t.parsedType}),Kp;function n(s,l){return nY({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,tY(),a5].filter(c=>!!c),issueData:{code:pl.invalid_arguments,argumentsError:l}})}function r(s,l){return nY({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,tY(),a5].filter(c=>!!c),issueData:{code:pl.invalid_return_type,returnTypeError:l}})}const a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof u5){const s=this;return uB(async function(...l){const c=new vS([]),u=await s._def.args.parseAsync(l,a).catch(p=>{throw c.addIssue(n(l,p)),c}),A=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(A,a).catch(p=>{throw c.addIssue(r(A,p)),c})})}else{const s=this;return uB(function(...l){const c=s._def.args.safeParse(l,a);if(!c.success)throw new vS([n(l,c.error)]);const u=Reflect.apply(o,this,c.data),A=s._def.returns.safeParse(u,a);if(!A.success)throw new vS([r(u,A.error)]);return A.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new wz({...this._def,args:Y9.create(e).rest(e3.create())})}returns(e){return new wz({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new wz({args:e||Y9.create([]).rest(e3.create()),returns:t||e3.create(),typeName:bp.ZodFunction,...i0(n)})}},lY=class extends Bm{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};lY.create=(i,e)=>new lY({getter:i,typeName:bp.ZodLazy,...i0(e)});let yU=class extends Bm{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ou(t,{received:t.data,code:pl.invalid_literal,expected:this._def.value}),Kp}return{status:"valid",value:e.data}}get value(){return this._def.value}};yU.create=(i,e)=>new yU({value:i,typeName:bp.ZodLiteral,...i0(e)});function pge(i,e){return new vU({values:i,typeName:bp.ZodEnum,...i0(e)})}let vU=class Dde extends Bm{constructor(){super(...arguments),s5.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return Ou(t,{expected:Py.joinValues(n),received:t.parsedType,code:pl.invalid_type}),Kp}if(fU(this,s5,"f")||age(this,s5,new Set(this._def.values),"f"),!fU(this,s5,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return Ou(t,{received:t.data,code:pl.invalid_enum_value,options:n}),Kp}return uB(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Dde.create(e,{...this._def,...t})}exclude(e,t=this._def){return Dde.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};s5=new WeakMap,vU.create=pge;let cY=class extends Bm{constructor(){super(...arguments),l5.set(this,void 0)}_parse(e){const t=Py.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==VA.string&&n.parsedType!==VA.number){const r=Py.objectValues(t);return Ou(n,{expected:Py.joinValues(r),received:n.parsedType,code:pl.invalid_type}),Kp}if(fU(this,l5,"f")||age(this,l5,new Set(Py.getValidEnumValues(this._def.values)),"f"),!fU(this,l5,"f").has(e.data)){const r=Py.objectValues(t);return Ou(n,{received:n.data,code:pl.invalid_enum_value,options:r}),Kp}return uB(e.data)}get enum(){return this._def.values}};l5=new WeakMap,cY.create=(i,e)=>new cY({values:i,typeName:bp.ZodNativeEnum,...i0(e)});let u5=class extends Bm{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==VA.promise&&t.common.async===!1)return Ou(t,{code:pl.invalid_type,expected:VA.promise,received:t.parsedType}),Kp;const n=t.parsedType===VA.promise?t.data:Promise.resolve(t.data);return uB(n.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};u5.create=(i,e)=>new u5({type:i,typeName:bp.ZodPromise,...i0(e)});let V9=class extends Bm{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===bp.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:o=>{Ou(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const o=r.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(t.value==="aborted")return Kp;const l=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?Kp:l.status==="dirty"||t.value==="dirty"?o5(l.value):l});{if(t.value==="aborted")return Kp;const s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?Kp:s.status==="dirty"||t.value==="dirty"?o5(s.value):s}}if(r.type==="refinement"){const o=s=>{const l=r.refinement(s,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Kp:(s.status==="dirty"&&t.dirty(),o(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Kp:(s.status==="dirty"&&t.dirty(),o(s.value).then(()=>({status:t.value,value:s.value}))))}if(r.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!$M(o))return o;const s=r.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>$M(o)?Promise.resolve(r.transform(o.value,a)).then(s=>({status:t.value,value:s})):o);Py.assertNever(r)}};V9.create=(i,e,t)=>new V9({schema:i,typeName:bp.ZodEffects,effect:e,...i0(t)}),V9.createWithPreprocess=(i,e,t)=>new V9({schema:e,effect:{type:"preprocess",transform:i},typeName:bp.ZodEffects,...i0(t)});let vQ=class extends Bm{_parse(e){return this._getType(e)===VA.undefined?uB(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};vQ.create=(i,e)=>new vQ({innerType:i,typeName:bp.ZodOptional,...i0(e)});let K9=class extends Bm{_parse(e){return this._getType(e)===VA.null?uB(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};K9.create=(i,e)=>new K9({innerType:i,typeName:bp.ZodNullable,...i0(e)});let CU=class extends Bm{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===VA.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};CU.create=(i,e)=>new CU({innerType:i,typeName:bp.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...i0(e)});let IU=class extends Bm{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return dU(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new vS(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new vS(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};IU.create=(i,e)=>new IU({innerType:i,typeName:bp.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...i0(e)});let gge=class extends Bm{_parse(e){if(this._getType(e)!==VA.nan){const n=this._getOrReturnCtx(e);return Ou(n,{code:pl.invalid_type,expected:VA.nan,received:n.parsedType}),Kp}return{status:"valid",value:e.data}}};gge.create=i=>new gge({typeName:bp.ZodNaN,...i0(i)});let mge=class extends Bm{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},DWe=class vKe extends Bm{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Kp:a.status==="dirty"?(t.dirty(),o5(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?Kp:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new vKe({in:e,out:t,typeName:bp.ZodPipeline})}},EU=class extends Bm{_parse(e){const t=this._def.innerType._parse(e),n=r=>($M(r)&&(r.value=Object.freeze(r.value)),r);return dU(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}};EU.create=(i,e)=>new EU({innerType:i,typeName:bp.ZodReadonly,...i0(e)});function yge(i,e){const t=typeof i=="function"?i(e):typeof i=="string"?{message:i}:i;return typeof t=="string"?{message:t}:t}function IS(i,e={},t){return i?c5.create().superRefine((n,r)=>{const a=i(n);if(a instanceof Promise)return a.then(o=>{if(!o){const s=yge(e,n),l=s.fatal??t??!0;r.addIssue({code:"custom",...s,fatal:l})}});if(!a){const o=yge(e,n),s=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:s})}}):c5.create()}var bp;(function(i){i.ZodString="ZodString",i.ZodNumber="ZodNumber",i.ZodNaN="ZodNaN",i.ZodBigInt="ZodBigInt",i.ZodBoolean="ZodBoolean",i.ZodDate="ZodDate",i.ZodSymbol="ZodSymbol",i.ZodUndefined="ZodUndefined",i.ZodNull="ZodNull",i.ZodAny="ZodAny",i.ZodUnknown="ZodUnknown",i.ZodNever="ZodNever",i.ZodVoid="ZodVoid",i.ZodArray="ZodArray",i.ZodObject="ZodObject",i.ZodUnion="ZodUnion",i.ZodDiscriminatedUnion="ZodDiscriminatedUnion",i.ZodIntersection="ZodIntersection",i.ZodTuple="ZodTuple",i.ZodRecord="ZodRecord",i.ZodMap="ZodMap",i.ZodSet="ZodSet",i.ZodFunction="ZodFunction",i.ZodLazy="ZodLazy",i.ZodLiteral="ZodLiteral",i.ZodEnum="ZodEnum",i.ZodEffects="ZodEffects",i.ZodNativeEnum="ZodNativeEnum",i.ZodOptional="ZodOptional",i.ZodNullable="ZodNullable",i.ZodDefault="ZodDefault",i.ZodCatch="ZodCatch",i.ZodPromise="ZodPromise",i.ZodBranded="ZodBranded",i.ZodPipeline="ZodPipeline",i.ZodReadonly="ZodReadonly"})(bp||(bp={}));const nt=hU.create,mr=rY.create,Jl=aY.create,RWe=pU.create,cb=c5.create;e3.create,Mw.create;const ao=t3.create,Si=mQ.create,_0=gU.create,Dw=QWe.create;mU.create,Y9.create;const SE=wWe.create,NWe=MWe.create,di=yU.create,Ec=vU.create,TWe=u5.create;vQ.create,K9.create;const UWe="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let uY=(i=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(i|=0));for(;i--;)e+=UWe[t[i]&63];return e};var vge={Hz:{baseUnit:"Hz",variants:{MHz:1e6,kHz:1e3,Hz:1}},g:{baseUnit:"g",variants:{kg:1e3,g:1}},Ω:{baseUnit:"Ω",variants:{mΩ:.001,Ω:1,kΩ:1e3,KΩ:1e3,kohm:1e3,MΩ:1e6,GΩ:1e9,TΩ: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,mA:.001,ma:.001,A:1,kA:1e3,MA:1e6}},F:{baseUnit:"F",variants:{pF:1e-12,nF:1e-9,µF:1e-6,uF:1e-6,mF:.001,F:1}},ml:{baseUnit:"ml",variants:{ml:1,mL:1,l:1e3,L:1e3}},deg:{baseUnit:"deg",variants:{rad:180/Math.PI}},ms:{baseUnit:"ms",variants:{s:1e3}},mm:{baseUnit:"mm",variants:{nm:1e-6,µ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}}},AY=new Set;for(const[i,e]of Object.entries(vge)){AY.add(i);for(const t of Object.keys(e.variants))AY.add(t)}function PWe(i){for(const[e,t]of Object.entries(vge))if(i in t.variants)return{baseUnit:t.baseUnit,conversionFactor:t.variants[i]};return{baseUnit:i,conversionFactor:1}}var Cge={tera:1e12,T:1e12,giga:1e9,G:1e9,mega:1e6,M:1e6,kilo:1e3,k:1e3,deci:.1,d:.1,centi:.01,c:.01,milli:.001,m:.001,micro:1e-6,u:1e-6,µ:1e-6,nano:1e-9,n:1e-9,pico:1e-12,p:1e-12},Gb=i=>{var s;if(typeof i>"u")return{parsedUnit:null,unitOfValue:null,value:null};if(typeof i=="string"&&i.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(i),parsedUnit:null,unitOfValue:null};if(typeof i=="number")return{value:i,parsedUnit:null,unitOfValue:null};if(typeof i=="object"&&"x"in i&&"y"in i){const{parsedUnit:l,unitOfValue:c}=Gb(i.x);return{parsedUnit:l,unitOfValue:c,value:{x:Gb(i.x).value,y:Gb(i.y).value}}}const t=(s=i.toString().split("").reverse().join("").match(/[^\d\s]+/))==null?void 0:s[0];if(!t)throw new Error(`Could not determine unit: "${i}"`);const n=t.split("").reverse().join(""),r=i.slice(0,-n.length);if(n in Cge&&!AY.has(n)){const l=Cge[n];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(r)*l}}const{baseUnit:a,conversionFactor:o}=PWe(n);return{parsedUnit:n,unitOfValue:a,value:o*Number.parseFloat(r)}},i3=nt().or(mr()).transform(i=>Gb(i).value),r3=nt().or(mr()).transform(i=>Gb(i).value).transform(i=>Number.parseFloat(i.toPrecision(12))),dY=nt().or(mr()).transform(i=>Gb(i).value),a3=nt().or(mr()).transform(i=>Gb(i).value),gn=nt().or(mr()).transform(i=>Gb(i).value),_U=nt().or(mr()).transform(i=>Gb(i).value),sr=gn,GWe=nt().or(mr()).transform(i=>Gb(i).value),FWe=nt().or(mr()).transform(i=>Gb(i).value),Cx=nt().or(mr()).transform(i=>typeof i=="number"?i:i.endsWith("deg")?Number.parseFloat(i.split("deg")[0]):i.endsWith("rad")?Number.parseFloat(i.split("rad")[0])*180/Math.PI:Number.parseFloat(i)),Ige=mr().or(nt().endsWith("mAh")).transform(i=>{if(typeof i=="string"){const e=i.replace("mAh",""),t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error("Invalid capacity");return t}return i}).describe("Battery capacity in mAh"),Hm=Si({x:sr,y:sr}),kWe=Hm,j9=Si({x:sr,y:sr,z:sr}),LWe=j9,fY=Si({width:mr(),height:mr()}),ap=i=>nt().optional().default(()=>`${i}_${uY(10)}`),hY=Ec(["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"]),xU=Ec(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),jE=Si({type:di("source_component"),ftype:nt().optional(),source_component_id:nt(),name:nt(),manufacturer_part_number:nt().optional(),supplier_part_numbers:SE(xU,ao(nt())).optional(),display_value:nt().optional(),are_pins_interchangeable:Jl().optional(),internally_connected_source_port_ids:ao(ao(nt())).optional(),source_group_id:nt().optional(),subcircuit_id:nt().optional()}),pY=jE.extend({ftype:di("simple_capacitor"),capacitance:r3,max_voltage_rating:a3.optional(),display_capacitance:nt().optional(),max_decoupling_trace_length:sr.optional()}),gY=jE.extend({ftype:di("simple_resistor"),resistance:i3,display_resistance:nt().optional()}),BU=jE.extend({ftype:di("simple_diode")}),mY=BU.extend({ftype:di("simple_led"),color:nt().optional(),wavelength:nt().optional()}),Ege=jE.extend({ftype:di("simple_ground")}),yY=jE.extend({ftype:di("simple_chip")}),vY=jE.extend({ftype:di("simple_power_source"),voltage:a3}),OWe=jE.extend({ftype:di("simple_fuse"),current_rating_amps:mr().describe("Nominal current in amps the fuse is rated for"),voltage_rating_volts:mr().describe("Voltage rating in volts, e.g. ±5V would be 5")}),CY=jE.extend({ftype:di("simple_battery"),capacity:Ige}),IY=jE.extend({ftype:di("simple_inductor"),inductance:dY,max_current_rating:mr().optional()}),EY=jE.extend({ftype:di("simple_push_button")}),_Y=jE.extend({ftype:di("simple_potentiometer"),max_resistance:i3}),_ge=jE.extend({ftype:di("simple_crystal"),frequency:mr().describe("Frequency in Hz"),load_capacitance:mr().optional().describe("Load capacitance in pF")}),xY=jE.extend({ftype:di("simple_pin_header"),pin_count:mr(),gender:Ec(["male","female"]).optional().default("male")}),BY=jE.extend({ftype:di("simple_resonator"),load_capacitance:r3,equivalent_series_resistance:i3.optional(),frequency:_U}),bY=jE.extend({ftype:di("simple_transistor"),transistor_type:Ec(["npn","pnp"])}),SY=jE.extend({ftype:di("simple_test_point"),footprint_variant:Ec(["pad","through_hole"]).optional(),pad_shape:Ec(["rect","circle"]).optional(),pad_diameter:_0([mr(),nt()]).optional(),hole_diameter:_0([mr(),nt()]).optional(),width:_0([mr(),nt()]).optional(),height:_0([mr(),nt()]).optional()}),QY=jE.extend({ftype:di("simple_mosfet"),channel_type:Ec(["n","p"]),mosfet_mode:Ec(["enhancement","depletion"])}),wY=jE.extend({ftype:di("simple_switch")}),MY=Si({type:di("source_project_metadata"),name:nt().optional(),software_used_string:nt().optional(),project_url:nt().optional(),created_at:nt().datetime().optional()}),xge=Si({type:di("source_missing_property_error"),source_missing_property_error_id:ap("source_missing_property_error"),source_component_id:nt(),property_name:nt(),subcircuit_id:nt().optional(),error_type:di("source_missing_property_error").default("source_missing_property_error"),message:nt()}).describe("The source code is missing a property"),Bge=Si({type:di("source_failed_to_create_component_error"),source_failed_to_create_component_error_id:ap("source_failed_to_create_component_error"),error_type:di("source_failed_to_create_component_error").default("source_failed_to_create_component_error"),component_name:nt().optional(),subcircuit_id:nt().optional(),parent_source_component_id:nt().optional(),message:nt(),pcb_center:Si({x:mr().optional(),y:mr().optional()}).optional(),schematic_center:Si({x:mr().optional(),y:mr().optional()}).optional()}).describe("Error emitted when a component fails to be constructed"),bge=_0([gY,pY,BU,mY,Ege,yY,vY,CY,IY,EY,_Y,_ge,xY,BY,wY,bY,SY,QY,OWe,MY,xge,Bge]),Sge=Si({type:di("source_port"),pin_number:mr().optional(),port_hints:ao(nt()).optional(),name:nt(),source_port_id:nt(),source_component_id:nt(),subcircuit_id:nt().optional(),subcircuit_connectivity_map_key:nt().optional()}),Qge=Si({type:di("source_trace"),source_trace_id:nt(),connected_source_port_ids:ao(nt()),connected_source_net_ids:ao(nt()),subcircuit_id:nt().optional(),subcircuit_connectivity_map_key:nt().optional(),max_length:mr().optional(),min_trace_thickness:mr().optional(),display_name:nt().optional()}),wge=Si({type:di("source_group"),source_group_id:nt(),subcircuit_id:nt().optional(),parent_subcircuit_id:nt().optional(),is_subcircuit:Jl().optional(),name:nt().optional()}),Mge=Si({type:di("source_net"),source_net_id:nt(),name:nt(),member_source_group_ids:ao(nt()),is_power:Jl().optional(),is_ground:Jl().optional(),is_digital_signal:Jl().optional(),is_analog_signal:Jl().optional(),trace_width:mr().optional(),subcircuit_id:nt().optional(),subcircuit_connectivity_map_key:nt().optional()}),Dge=Si({type:di("source_pcb_ground_plane"),source_pcb_ground_plane_id:nt(),source_group_id:nt(),source_net_id:nt(),subcircuit_id:nt().optional()}).describe("Defines a ground plane in the source domain"),Rge=Si({type:di("schematic_box"),schematic_component_id:nt().optional(),width:sr,height:sr,is_dashed:Jl().default(!1),x:sr,y:sr,subcircuit_id:nt().optional()}).describe("Draws a box on the schematic"),Nge=Si({type:di("schematic_path"),schematic_component_id:nt(),fill_color:Ec(["red","blue"]).optional(),is_filled:Jl().optional(),points:ao(Hm),subcircuit_id:nt().optional()}),Tge=SE(Si({left_margin:gn.optional(),right_margin:gn.optional(),top_margin:gn.optional(),bottom_margin:gn.optional()})),Uge=Si({left_size:mr(),right_size:mr(),top_size:mr().optional(),bottom_size:mr().optional()}),Pge=Si({left_side:Si({pins:ao(mr()),direction:Ec(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:Si({pins:ao(mr()),direction:Ec(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:Si({pins:ao(mr()),direction:Ec(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:Si({pins:ao(mr()),direction:Ec(["left-to-right","right-to-left"]).optional()}).optional()}),Gge=_0([Uge,Pge]),Fge=Si({type:di("schematic_component"),size:fY,center:Hm,source_component_id:nt(),schematic_component_id:nt(),pin_spacing:gn.optional(),pin_styles:Tge.optional(),box_width:gn.optional(),symbol_name:nt().optional(),port_arrangement:Gge.optional(),port_labels:SE(nt()).optional(),symbol_display_value:nt().optional(),subcircuit_id:nt().optional(),schematic_group_id:nt().optional()}),kge=Si({type:di("schematic_line"),schematic_component_id:nt(),x1:sr,x2:sr,y1:sr,y2:sr,subcircuit_id:nt().optional()}),Lge=Si({type:di("schematic_trace"),schematic_trace_id:nt(),source_trace_id:nt(),junctions:ao(Si({x:mr(),y:mr()})),edges:ao(Si({from:Si({x:mr(),y:mr()}),to:Si({x:mr(),y:mr()}),is_crossing:Jl().optional(),from_schematic_port_id:nt().optional(),to_schematic_port_id:nt().optional()})),subcircuit_id:nt().optional()}),zWe=Ec(["center","left","right","top","bottom"]),Oge=Si({type:di("schematic_text"),schematic_component_id:nt().optional(),schematic_text_id:nt(),text:nt(),font_size:mr().default(.18),position:Si({x:sr,y:sr}),rotation:mr().default(0),anchor:_0([zWe.describe("legacy"),hY]).default("center"),color:nt().default("#000000"),subcircuit_id:nt().optional()}),zge=Si({type:di("schematic_port"),schematic_port_id:nt(),source_port_id:nt(),schematic_component_id:nt().optional(),center:Hm,facing_direction:Ec(["up","down","left","right"]).optional(),distance_from_component_edge:mr().optional(),side_of_component:Ec(["top","bottom","left","right"]).optional(),true_ccw_index:mr().optional(),pin_number:mr().optional(),display_pin_label:nt().optional(),subcircuit_id:nt().optional()}).describe("Defines a port on a schematic component"),Hge=Si({type:di("schematic_net_label"),schematic_net_label_id:ap("schematic_net_label"),schematic_trace_id:nt().optional(),source_trace_id:nt().optional(),source_net_id:nt(),center:Hm,anchor_position:Hm.optional(),anchor_side:Ec(["top","bottom","left","right"]),text:nt(),symbol_name:nt().optional(),is_movable:Jl().optional(),subcircuit_id:nt().optional()}),Yge=Si({type:di("schematic_error"),schematic_error_id:nt(),error_type:di("schematic_port_not_found").default("schematic_port_not_found"),message:nt(),subcircuit_id:nt().optional()}).describe("Defines a schematic error on the schematic"),Vge=Si({type:di("schematic_layout_error"),schematic_layout_error_id:ap("schematic_layout_error"),error_type:di("schematic_layout_error").default("schematic_layout_error"),message:nt(),source_group_id:nt(),schematic_group_id:nt(),subcircuit_id:nt().optional()}).describe("Error emitted when schematic layout fails for a group"),bU=Si({type:di("schematic_debug_object"),label:nt().optional(),subcircuit_id:nt().optional()}),Kge=bU.extend({shape:di("rect"),center:Hm,size:fY}),jge=bU.extend({shape:di("line"),start:Hm,end:Hm}),Jge=bU.extend({shape:di("point"),center:Hm}),qge=Dw("shape",[Kge,jge,Jge]),Zge=Si({type:di("schematic_voltage_probe"),schematic_voltage_probe_id:nt(),position:Hm,schematic_trace_id:nt(),voltage:a3.optional(),subcircuit_id:nt().optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),SU=Si({type:di("schematic_manual_edit_conflict_warning"),schematic_manual_edit_conflict_warning_id:ap("schematic_manual_edit_conflict_warning"),warning_type:di("schematic_manual_edit_conflict_warning").default("schematic_manual_edit_conflict_warning"),message:nt(),schematic_component_id:nt(),schematic_group_id:nt().optional(),subcircuit_id:nt().optional(),source_component_id:nt()}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates"),Wge=Si({type:di("schematic_group"),schematic_group_id:ap("schematic_group"),source_group_id:nt(),is_subcircuit:Jl().optional(),subcircuit_id:nt().optional(),width:gn,height:gn,center:Hm,schematic_component_ids:ao(nt()),name:nt().optional(),description:nt().optional()}).describe("Defines a group of components on the schematic"),A5=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],DY=Ec(A5),Xm=DY.or(Si({name:DY})).transform(i=>typeof i=="string"?i:i.name),o3=Ec(["top","bottom"]),Xge=Si({x:sr,y:sr,via:Jl().optional(),via_to_layer:Xm.optional()}),HWe=ao(Xge),CQ=Si({x:sr,y:sr,via:Jl().optional(),to_layer:Xm.optional(),trace_width:sr.optional()}),$ge=Si({type:di("pcb_component"),pcb_component_id:ap("pcb_component"),source_component_id:nt(),center:Hm,layer:Xm,rotation:Cx,width:gn,height:gn,subcircuit_id:nt().optional(),pcb_group_id:nt().optional()}).describe("Defines a component on the PCB"),e0e=Si({type:di("pcb_hole"),pcb_hole_id:ap("pcb_hole"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),hole_shape:Ec(["circle","square"]),hole_diameter:mr(),x:sr,y:sr}),YWe=e0e.describe("Defines a circular or square hole on the PCB"),t0e=Si({type:di("pcb_hole"),pcb_hole_id:ap("pcb_hole"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),hole_shape:di("oval"),hole_width:mr(),hole_height:mr(),x:sr,y:sr}),VWe=t0e.describe("Defines an oval hole on the PCB"),n0e=e0e.or(t0e),KWe=Si({type:di("pcb_plated_hole"),shape:di("circle"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),outer_diameter:mr(),hole_diameter:mr(),x:sr,y:sr,layers:ao(Xm),port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional(),pcb_plated_hole_id:ap("pcb_plated_hole")}),jWe=Si({type:di("pcb_plated_hole"),shape:Ec(["oval","pill"]),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),outer_width:mr(),outer_height:mr(),hole_width:mr(),hole_height:mr(),x:sr,y:sr,layers:ao(Xm),port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional(),pcb_plated_hole_id:ap("pcb_plated_hole")}),JWe=Si({type:di("pcb_plated_hole"),shape:di("circular_hole_with_rect_pad"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),hole_shape:di("circle"),pad_shape:di("rect"),hole_diameter:mr(),rect_pad_width:mr(),rect_pad_height:mr(),x:sr,y:sr,layers:ao(Xm),port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional(),pcb_plated_hole_id:ap("pcb_plated_hole")}),qWe=Si({type:di("pcb_plated_hole"),shape:di("pill_hole_with_rect_pad"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),hole_shape:di("pill"),pad_shape:di("rect"),hole_width:mr(),hole_height:mr(),rect_pad_width:mr(),rect_pad_height:mr(),x:sr,y:sr,layers:ao(Xm),port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional(),pcb_plated_hole_id:ap("pcb_plated_hole")}),i0e=_0([KWe,jWe,JWe,qWe]),r0e=Si({type:di("pcb_port"),pcb_port_id:ap("pcb_port"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),source_port_id:nt(),pcb_component_id:nt(),x:sr,y:sr,layers:ao(Xm)}).describe("Defines a port on the PCB"),ZWe=Si({type:di("pcb_smtpad"),shape:di("circle"),pcb_smtpad_id:ap("pcb_smtpad"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,radius:mr(),layer:Xm,port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional()}),WWe=Si({type:di("pcb_smtpad"),shape:di("rect"),pcb_smtpad_id:ap("pcb_smtpad"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,width:mr(),height:mr(),layer:Xm,port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional()}),XWe=Si({type:di("pcb_smtpad"),shape:di("rotated_rect"),pcb_smtpad_id:ap("pcb_smtpad"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,width:mr(),height:mr(),ccw_rotation:Cx,layer:Xm,port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional()}),a0e=Si({type:di("pcb_smtpad"),shape:di("pill"),pcb_smtpad_id:ap("pcb_smtpad"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,width:mr(),height:mr(),radius:mr(),layer:Xm,port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional()}),$We=Si({type:di("pcb_smtpad"),shape:di("polygon"),pcb_smtpad_id:ap("pcb_smtpad"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),points:ao(Hm),layer:Xm,port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional()}),o0e=Dw("shape",[ZWe,WWe,XWe,a0e,$We]).describe("Defines an SMT pad on the PCB"),eXe=Si({type:di("pcb_solder_paste"),shape:di("circle"),pcb_solder_paste_id:ap("pcb_solder_paste"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,radius:mr(),layer:Xm,pcb_component_id:nt().optional(),pcb_smtpad_id:nt().optional()}),tXe=Si({type:di("pcb_solder_paste"),shape:di("rect"),pcb_solder_paste_id:ap("pcb_solder_paste"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,width:mr(),height:mr(),layer:Xm,pcb_component_id:nt().optional(),pcb_smtpad_id:nt().optional()}),nXe=Si({type:di("pcb_solder_paste"),shape:di("pill"),pcb_solder_paste_id:ap("pcb_solder_paste"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,width:mr(),height:mr(),radius:mr(),layer:Xm,pcb_component_id:nt().optional(),pcb_smtpad_id:nt().optional()}),iXe=Si({type:di("pcb_solder_paste"),shape:di("rotated_rect"),pcb_solder_paste_id:ap("pcb_solder_paste"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,width:mr(),height:mr(),ccw_rotation:sr,layer:Xm,pcb_component_id:nt().optional(),pcb_smtpad_id:nt().optional()}),rXe=Si({type:di("pcb_solder_paste"),shape:di("oval"),pcb_solder_paste_id:ap("pcb_solder_paste"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,width:mr(),height:mr(),layer:Xm,pcb_component_id:nt().optional(),pcb_smtpad_id:nt().optional()}),s0e=_0([eXe,tXe,nXe,iXe,rXe]).describe("Defines solderpaste on the PCB"),l0e=Si({type:di("pcb_text"),pcb_text_id:ap("pcb_text"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),text:nt(),center:Hm,layer:Xm,width:gn,height:gn,lines:mr(),align:Ec(["bottom-left"])}).describe("Defines text on the PCB"),c0e=Si({route_type:di("wire"),x:sr,y:sr,width:sr,start_pcb_port_id:nt().optional(),end_pcb_port_id:nt().optional(),layer:Xm}),u0e=Si({route_type:di("via"),x:sr,y:sr,hole_diameter:sr.optional(),outer_diameter:sr.optional(),from_layer:nt(),to_layer:nt()}),QU=_0([c0e,u0e]),A0e=Si({type:di("pcb_trace"),source_trace_id:nt().optional(),pcb_component_id:nt().optional(),pcb_trace_id:ap("pcb_trace"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),route_thickness_mode:Ec(["constant","interpolated"]).default("constant").optional(),route_order_index:mr().optional(),should_round_corners:Jl().optional(),trace_length:mr().optional(),route:ao(QU)}).describe("Defines a trace on the PCB"),d0e=Si({type:di("pcb_trace_error"),pcb_trace_error_id:ap("pcb_trace_error"),error_type:di("pcb_trace_error").default("pcb_trace_error"),message:nt(),center:Hm.optional(),pcb_trace_id:nt(),source_trace_id:nt(),pcb_component_ids:ao(nt()),pcb_port_ids:ao(nt()),subcircuit_id:nt().optional()}).describe("Defines a trace error on the PCB"),f0e=Si({type:di("pcb_port_not_matched_error"),pcb_error_id:ap("pcb_error"),error_type:di("pcb_port_not_matched_error").default("pcb_port_not_matched_error"),message:nt(),pcb_component_ids:ao(nt()),subcircuit_id:nt().optional()}).describe("Defines a trace error on the PCB where a port is not matched"),h0e=Si({type:di("pcb_via"),pcb_via_id:ap("pcb_via"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,outer_diameter:sr.default("0.6mm"),hole_diameter:sr.default("0.25mm"),from_layer:Xm.optional(),to_layer:Xm.optional(),layers:ao(Xm),pcb_trace_id:nt().optional()}).describe("Defines a via on the PCB"),p0e=Si({type:di("pcb_board"),pcb_board_id:ap("pcb_board"),is_subcircuit:Jl().optional(),subcircuit_id:nt().optional(),width:gn,height:gn,center:Hm,thickness:gn.optional().default(1.4),num_layers:mr().optional().default(4),outline:ao(Hm).optional(),material:Ec(["fr4","fr1"]).default("fr4")}).describe("Defines the board outline of the PCB"),g0e=Si({type:di("pcb_placement_error"),pcb_placement_error_id:ap("pcb_placement_error"),error_type:di("pcb_placement_error").default("pcb_placement_error"),message:nt(),subcircuit_id:nt().optional()}).describe("Defines a placement error on the PCB"),m0e=Si({type:di("pcb_trace_hint"),pcb_trace_hint_id:ap("pcb_trace_hint"),pcb_port_id:nt(),pcb_component_id:nt(),route:ao(CQ),subcircuit_id:nt().optional()}).describe("A hint that can be used during generation of a PCB trace"),y0e=Si({type:di("pcb_silkscreen_line"),pcb_silkscreen_line_id:ap("pcb_silkscreen_line"),pcb_component_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),stroke_width:sr.default("0.1mm"),x1:sr,y1:sr,x2:sr,y2:sr,layer:o3}).describe("Defines a silkscreen line on the PCB"),v0e=Si({type:di("pcb_silkscreen_path"),pcb_silkscreen_path_id:ap("pcb_silkscreen_path"),pcb_component_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),layer:o3,route:ao(Hm),stroke_width:gn}).describe("Defines a silkscreen path on the PCB"),C0e=Si({type:di("pcb_silkscreen_text"),pcb_silkscreen_text_id:ap("pcb_silkscreen_text"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),font:di("tscircuit2024").default("tscircuit2024"),font_size:sr.default("0.2mm"),pcb_component_id:nt(),text:nt(),ccw_rotation:mr().optional(),layer:Xm,is_mirrored:Jl().default(!1).optional(),anchor_position:Hm.default({x:0,y:0}),anchor_alignment:hY.default("center")}).describe("Defines silkscreen text on the PCB"),I0e=Si({type:di("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:ap("pcb_silkscreen_rect"),pcb_component_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),center:Hm,width:gn,height:gn,layer:Xm,stroke_width:gn.default("1mm"),is_filled:Jl().default(!0).optional(),has_stroke:Jl().optional(),is_stroke_dashed:Jl().optional()}).describe("Defines a silkscreen rect on the PCB"),E0e=Si({type:di("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:ap("pcb_silkscreen_circle"),pcb_component_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),center:Hm,radius:gn,layer:o3,stroke_width:gn.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),_0e=Si({type:di("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:ap("pcb_silkscreen_oval"),pcb_component_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),center:Hm,radius_x:sr,radius_y:sr,layer:o3}).describe("Defines a silkscreen oval on the PCB"),x0e=Si({type:di("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:ap("pcb_fabrication_note_text"),subcircuit_id:nt().optional(),pcb_group_id:nt().optional(),font:di("tscircuit2024").default("tscircuit2024"),font_size:sr.default("1mm"),pcb_component_id:nt(),text:nt(),layer:o3,anchor_position:Hm.default({x:0,y:0}),anchor_alignment:Ec(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:nt().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),B0e=Si({type:di("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:ap("pcb_fabrication_note_path"),pcb_component_id:nt(),subcircuit_id:nt().optional(),layer:Xm,route:ao(Hm),stroke_width:gn,color:nt().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),b0e=Si({type:di("pcb_keepout"),shape:di("rect"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),center:Hm,width:sr,height:sr,pcb_keepout_id:nt(),layers:ao(nt()),description:nt().optional()}).or(Si({type:di("pcb_keepout"),shape:di("circle"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),center:Hm,radius:sr,pcb_keepout_id:nt(),layers:ao(nt()),description:nt().optional()})),RY=Si({type:di("pcb_cutout"),pcb_cutout_id:ap("pcb_cutout"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional()}),S0e=RY.extend({shape:di("rect"),center:Hm,width:gn,height:gn,rotation:Cx.optional()}),Q0e=RY.extend({shape:di("circle"),center:Hm,radius:gn}),w0e=RY.extend({shape:di("polygon"),points:ao(Hm)}),M0e=Dw("shape",[S0e,Q0e,w0e]).describe("Defines a cutout on the PCB, removing board material."),D0e=Si({type:di("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:ap("pcb_missing_footprint_error"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),error_type:di("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),source_component_id:nt(),message:nt()}).describe("Defines a missing footprint error on the PCB"),R0e=Si({type:di("pcb_group"),pcb_group_id:ap("pcb_group"),source_group_id:nt(),is_subcircuit:Jl().optional(),subcircuit_id:nt().optional(),width:gn,height:gn,center:Hm,pcb_component_ids:ao(nt()),name:nt().optional(),description:nt().optional()}).describe("Defines a group of components on the PCB"),N0e=Si({type:di("pcb_autorouting_error"),pcb_error_id:ap("pcb_autorouting_error"),error_type:di("pcb_autorouting_error").default("pcb_autorouting_error"),message:nt(),subcircuit_id:nt().optional()}).describe("The autorouting has failed to route a portion of the board"),wU=Si({type:di("pcb_manual_edit_conflict_warning"),pcb_manual_edit_conflict_warning_id:ap("pcb_manual_edit_conflict_warning"),warning_type:di("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),message:nt(),pcb_component_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),source_component_id:nt()}).describe("Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),T0e=Si({type:di("pcb_breakout_point"),pcb_breakout_point_id:ap("pcb_breakout_point"),pcb_group_id:nt(),subcircuit_id:nt().optional(),source_trace_id:nt().optional(),source_port_id:nt().optional(),source_net_id:nt().optional(),x:sr,y:sr}).describe("Defines a routing target within a pcb_group for a source_trace or source_net"),U0e=Si({type:di("pcb_ground_plane"),pcb_ground_plane_id:ap("pcb_ground_plane"),source_pcb_ground_plane_id:nt(),source_net_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional()}).describe("Defines a ground plane on the PCB"),P0e=Si({type:di("pcb_ground_plane_region"),pcb_ground_plane_region_id:ap("pcb_ground_plane_region"),pcb_ground_plane_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),layer:Xm,points:ao(Hm)}).describe("Defines a polygon region of a ground plane"),G0e=Si({type:di("pcb_thermal_spoke"),pcb_thermal_spoke_id:ap("pcb_thermal_spoke"),pcb_ground_plane_id:nt(),shape:nt(),spoke_count:mr(),spoke_thickness:sr,spoke_inner_diameter:sr,spoke_outer_diameter:sr,pcb_plated_hole_id:nt().optional(),subcircuit_id:nt().optional()}).describe("Pattern for connecting a ground plane to a plated hole"),F0e=Si({type:di("cad_component"),cad_component_id:nt(),pcb_component_id:nt(),source_component_id:nt(),position:j9,rotation:j9.optional(),size:j9.optional(),layer:Xm.optional(),subcircuit_id:nt().optional(),footprinter_string:nt().optional(),model_obj_url:nt().optional(),model_stl_url:nt().optional(),model_3mf_url:nt().optional(),model_jscad:cb().optional()}).describe("Defines a component on the PCB"),k0e=_0([Qge,Sge,bge,Mge,wge,yY,pY,BU,mY,gY,vY,CY,IY,xY,BY,wY,bY,SY,QY,_Y,EY,Dge,MY,$ge,n0e,D0e,wU,i0e,b0e,r0e,l0e,A0e,h0e,o0e,s0e,p0e,R0e,m0e,y0e,v0e,C0e,I0e,E0e,_0e,d0e,g0e,f0e,B0e,x0e,N0e,T0e,M0e,U0e,P0e,G0e,Rge,Oge,kge,Fge,zge,Lge,Nge,Yge,Vge,Hge,qge,Zge,SU,Wge,F0e]),d5=k0e;const MU=Object.freeze(Object.defineProperty({__proto__:null,all_layers:A5,any_circuit_element:k0e,any_soup_element:d5,any_source_component:bge,battery_capacity:Ige,cad_component:F0e,capacitance:r3,current:GWe,distance:sr,frequency:_U,getZodPrefixedIdWithDefault:ap,inductance:dY,layer_ref:Xm,layer_string:DY,length:gn,ninePointAnchor:hY,pcb_autorouting_error:N0e,pcb_board:p0e,pcb_breakout_point:T0e,pcb_component:$ge,pcb_cutout:M0e,pcb_cutout_circle:Q0e,pcb_cutout_polygon:w0e,pcb_cutout_rect:S0e,pcb_fabrication_note_path:B0e,pcb_fabrication_note_text:x0e,pcb_ground_plane:U0e,pcb_ground_plane_region:P0e,pcb_group:R0e,pcb_hole:n0e,pcb_hole_circle_or_square_shape:YWe,pcb_hole_oval_shape:VWe,pcb_keepout:b0e,pcb_manual_edit_conflict_warning:wU,pcb_missing_footprint_error:D0e,pcb_placement_error:g0e,pcb_plated_hole:i0e,pcb_port:r0e,pcb_port_not_matched_error:f0e,pcb_route_hint:Xge,pcb_route_hints:HWe,pcb_silkscreen_circle:E0e,pcb_silkscreen_line:y0e,pcb_silkscreen_oval:_0e,pcb_silkscreen_path:v0e,pcb_silkscreen_rect:I0e,pcb_silkscreen_text:C0e,pcb_smtpad:o0e,pcb_smtpad_pill:a0e,pcb_solder_paste:s0e,pcb_text:l0e,pcb_thermal_spoke:G0e,pcb_trace:A0e,pcb_trace_error:d0e,pcb_trace_hint:m0e,pcb_trace_route_point:QU,pcb_trace_route_point_via:u0e,pcb_trace_route_point_wire:c0e,pcb_via:h0e,point:Hm,point3:j9,port_arrangement:Gge,position:kWe,position3:LWe,resistance:i3,rotation:Cx,route_hint_point:CQ,schematic_box:Rge,schematic_component:Fge,schematic_component_port_arrangement_by_sides:Pge,schematic_component_port_arrangement_by_size:Uge,schematic_debug_line:jge,schematic_debug_object:qge,schematic_debug_object_base:bU,schematic_debug_point:Jge,schematic_debug_rect:Kge,schematic_error:Yge,schematic_group:Wge,schematic_layout_error:Vge,schematic_line:kge,schematic_manual_edit_conflict_warning:SU,schematic_net_label:Hge,schematic_path:Nge,schematic_pin_styles:Tge,schematic_port:zge,schematic_text:Oge,schematic_trace:Lge,schematic_voltage_probe:Zge,size:fY,source_component_base:jE,source_failed_to_create_component_error:Bge,source_group:wge,source_missing_property_error:xge,source_net:Mge,source_pcb_ground_plane:Dge,source_port:Sge,source_project_metadata:MY,source_simple_battery:CY,source_simple_capacitor:pY,source_simple_chip:yY,source_simple_crystal:_ge,source_simple_diode:BU,source_simple_ground:Ege,source_simple_inductor:IY,source_simple_led:mY,source_simple_mosfet:QY,source_simple_pin_header:xY,source_simple_potentiometer:_Y,source_simple_power_source:vY,source_simple_push_button:EY,source_simple_resistor:gY,source_simple_resonator:BY,source_simple_switch:wY,source_simple_test_point:SY,source_simple_transistor:bY,source_trace:Qge,supplier_name:xU,time:FWe,visible_layer:o3,voltage:a3},Symbol.toStringTag,{value:"Module"}));function Rr(i,e){return Array.isArray(e)?[i.a*e[0]+i.c*e[1]+i.e,i.b*e[0]+i.d*e[1]+i.f]:{x:i.a*e.x+i.c*e.y+i.e,y:i.b*e.x+i.d*e.y+i.f}}function aXe(i,e){return e.map(t=>Rr(i,t))}function L0e(i){return{a:parseFloat(i.a),b:parseFloat(i.b),c:parseFloat(i.c),d:parseFloat(i.d),e:parseFloat(i.e),f:parseFloat(i.f)}}const oXe=/^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 NY(i){const e=i.match(oXe);if(e===null||e.length<7)throw new Error(`'${i}' 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 Hv(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function ES(i){const{a:e,b:t,c:n,d:r,e:a,f:o}=i,s=e*r-t*n;return{a:r/s,b:t/-s,c:n/-s,d:e/s,e:(r*a-n*o)/-s,f:(t*a-e*o)/s}}function f5(i){return typeof i>"u"}function s3(i){return typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i)}function sXe(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function lXe(i){return sXe(i)&&"a"in i&&s3(i.a)&&"b"in i&&s3(i.b)&&"c"in i&&s3(i.c)&&"d"in i&&s3(i.d)&&"e"in i&&s3(i.e)&&"f"in i&&s3(i.f)}function Dh(i,e=0){return{a:1,c:0,e:i,b:0,d:1,f:e}}function Rw(...i){i=Array.isArray(i[0])?i[0]:i;const e=(t,n)=>({a:t.a*n.a+t.c*n.b,c:t.a*n.c+t.c*n.d,e:t.a*n.e+t.c*n.f+t.e,b:t.b*n.a+t.d*n.b,d:t.b*n.c+t.d*n.d,f:t.b*n.e+t.d*n.f+t.f});switch(i.length){case 0:throw new Error("no matrices provided");case 1:return i[0];case 2:return e(i[0],i[1]);default:{const[t,n,...r]=i,a=e(t,n);return Rw(a,...r)}}}function Fd(...i){return Rw(...i)}const{cos:cXe,sin:uXe,PI:AXe}=Math;function AB(i,e,t){const n=cXe(i),r=uXe(i),a={a:n,c:-r,e:0,b:r,d:n,f:0};return f5(e)||f5(t)?a:Rw([Dh(e,t),a,Dh(-e,-t)])}function TY(i,e=void 0,t=void 0){return AB(i*AXe/180,e,t)}function JE(i,e=void 0,t=void 0,n=void 0){f5(e)&&(e=i);const r={a:i,c:0,e:0,b:0,d:e,f:0};return f5(t)||f5(n)?r:Rw([Dh(t,n),r,Dh(-t,-n)])}function O0e(i,e){return{a:1,c:i,e:0,b:e,d:1,f:0}}const{tan:z0e}=Math;function H0e(i,e){return{a:1,c:z0e(i),e:0,b:z0e(e),d:1,f:0}}function UY(i,e){return H0e(i*Math.PI/180,e*Math.PI/180)}function dXe(i){return Nw(i)}function Y0e(i){return Nw(i)}function Nw(i){return`matrix(${i.a},${i.b},${i.c},${i.d},${i.e},${i.f})`}function V0e(i,e=1e10){return{a:Math.round(i.a*e)/e,b:Math.round(i.b*e)/e,c:Math.round(i.c*e)/e,d:Math.round(i.d*e)/e,e:Math.round(i.e*e)/e,f:Math.round(i.f*e)/e}}function K0e(i,e){const t=i[0].x!=null?i[0].x:i[0][0],n=i[0].y!=null?i[0].y:i[0][1],r=e[0].x!=null?e[0].x:e[0][0],a=e[0].y!=null?e[0].y:e[0][1],o=i[1].x!=null?i[1].x:i[1][0],s=i[1].y!=null?i[1].y:i[1][1],l=e[1].x!=null?e[1].x:e[1][0],c=e[1].y!=null?e[1].y:e[1][1],u=i[2].x!=null?i[2].x:i[2][0],A=i[2].y!=null?i[2].y:i[2][1],f=e[2].x!=null?e[2].x:e[2][0],p=e[2].y!=null?e[2].y:e[2][1],v={a:t-u,b:n-A,c:o-u,d:s-A,e:u,f:A},B={a:r-f,b:a-p,c:l-f,d:c-p,e:f,f:p},x=ES(v),b=Rw([B,x]);return V0e(b)}function fXe(i){return Array.isArray(i)?i.map(e):e(i);function e(t){switch(t.type){case"matrix":if("a"in t&&"b"in t&&"c"in t&&"d"in t&&"e"in t&&"f"in t)return L0e(t);throw new Error("MISSING_MANDATORY_PARAM");case"translate":if(!("tx"in t))throw new Error("MISSING_MANDATORY_PARAM");return"ty"in t?Dh(t.tx,t.ty):Dh(t.tx);case"scale":if(!("sx"in t))throw new Error("MISSING_MANDATORY_PARAM");return"sy"in t?JE(t.sx,t.sy):JE(t.sx);case"rotate":if(!("angle"in t))throw new Error("MISSING_MANDATORY_PARAM");return"cx"in t&&"cy"in t?TY(t.angle,t.cx,t.cy):TY(t.angle);case"skewX":if(!("angle"in t))throw new Error("MISSING_MANDATORY_PARAM");return UY(t.angle,0);case"skewY":if(!("angle"in t))throw new Error("MISSING_MANDATORY_PARAM");return UY(0,t.angle);case"shear":if(!("shx"in t&&"shy"in t))throw new Error("MISSING_MANDATORY_PARAM");return O0e(t.shx,t.shy);default:throw new Error("UNSUPPORTED_DESCRIPTOR")}}}function hXe(i,e){function t(){this.constructor=i}t.prototype=e.prototype,i.prototype=new t}function l3(i,e,t,n){var r=Error.call(this,i);return Object.setPrototypeOf&&Object.setPrototypeOf(r,l3.prototype),r.expected=e,r.found=t,r.location=n,r.name="SyntaxError",r}hXe(l3,Error);function PY(i,e,t){return t=t||" ",i.length>e?i:(e-=i.length,t+=t.repeat(e),i+t.slice(0,e))}l3.prototype.format=function(i){var e="Error: "+this.message;if(this.location){var t=null,n;for(n=0;n<i.length;n++)if(i[n].source===this.location.source){t=i[n].text.split(/\r\n|\n|\r/g);break}var r=this.location.start,a=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(r):r,o=this.location.source+":"+a.line+":"+a.column;if(t){var s=this.location.end,l=PY("",a.line.toString().length," "),c=t[r.line-1],u=r.line===s.line?s.column:c.length+1,A=u-r.column||1;e+=`
|
|
244
|
+
`)).length,r=0;r<n;r++){var o=i.charCodeAt(r),s=null;o<128?t++:s=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),Iw(s)||(t>e&&(a+=i.substring(e,t)),a+=s,e=t=r+1)}return t>e&&(a+=i.substring(e,i.length)),a},vZe=!!Wz||!!Zz,upe="text/plain",aU=(i,e)=>{var[t,n]=i.split("?"),r=vA({},e);n==null||n.split("&").forEach(o=>{var[s]=o.split("=");delete r[s]});var a=sqe(r);return t+"?"+(a=a?(n?n+"&":"")+a:n)},qR=(i,e)=>JSON.stringify(i,(t,n)=>typeof n=="bigint"?n.toString():n,e),kH=i=>{var{data:e,compression:t}=i;if(e){if(t===dQ.GZipJS){var n=Whe(Xhe(qR(e)),{mtime:0}),r=new Blob([n],{type:upe});return{contentType:upe,body:r,estimatedSize:r.size}}if(t===dQ.Base64){var a=function(l){var c,u,A,f,p,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",B=0,x=0,b="",Q=[];if(!l)return l;l=yZe(l);do c=(p=l.charCodeAt(B++)<<16|l.charCodeAt(B++)<<8|l.charCodeAt(B++))>>18&63,u=p>>12&63,A=p>>6&63,f=63&p,Q[x++]=v.charAt(c)+v.charAt(u)+v.charAt(A)+v.charAt(f);while(B<l.length);switch(b=Q.join(""),l.length%3){case 1:b=b.slice(0,-2)+"==";break;case 2:b=b.slice(0,-1)+"="}return b}(qR(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:qR(l)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var s=qR(e);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}}},ZR=[];Zz&&ZR.push({transport:"fetch",method:i=>{var e,t,{contentType:n,body:r,estimatedSize:a}=(e=kH(i))!==null&&e!==void 0?e:{},o=new Headers;zC(i.headers,function(u,A){o.append(A,u)}),n&&o.append("Content-Type",n);var s=i.url,l=null;if(Hfe){var c=new Hfe;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),i.timeout)}}Zz(s,vA({method:(i==null?void 0:i.method)||"GET",headers:o,keepalive:i.method==="POST"&&(a||0)<52428.8,body:r,signal:(t=l)==null?void 0:t.signal},i.fetchOptions)).then(u=>u.text().then(A=>{var f={statusCode:u.status,text:A};if(u.status===200)try{f.json=JSON.parse(A)}catch(p){yd.error(p)}i.callback==null||i.callback(f)})).catch(u=>{yd.error(u),i.callback==null||i.callback({statusCode:0,text:u})}).finally(()=>l?clearTimeout(l.timeout):null)}}),Wz&&ZR.push({transport:"XHR",method:i=>{var e,t=new Wz;t.open(i.method||"GET",i.url,!0);var{contentType:n,body:r}=(e=kH(i))!==null&&e!==void 0?e:{};zC(i.headers,function(a,o){t.setRequestHeader(o,a)}),n&&t.setRequestHeader("Content-Type",n),i.timeout&&(t.timeout=i.timeout),t.withCredentials=!0,t.onreadystatechange=()=>{if(t.readyState===4){var a={statusCode:t.status,text:t.responseText};if(t.status===200)try{a.json=JSON.parse(t.responseText)}catch{}i.callback==null||i.callback(a)}},t.send(r)}}),PB!=null&&PB.sendBeacon&&ZR.push({transport:"sendBeacon",method:i=>{var e=aU(i.url,{beacon:"1"});try{var t,{contentType:n,body:r}=(t=kH(i))!==null&&t!==void 0?t:{},a=typeof r=="string"?new Blob([r],{type:n}):r;PB.sendBeacon(e,a)}catch{}}});var KM=function(i,e){if(!function(t){try{new RegExp(t)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(i)}catch{return!1}};function Ape(i,e,t){return qR({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var CZe={exact:(i,e)=>e.some(t=>i.some(n=>t===n)),is_not:(i,e)=>e.every(t=>i.every(n=>t!==n)),regex:(i,e)=>e.some(t=>i.some(n=>KM(t,n))),not_regex:(i,e)=>e.every(t=>i.every(n=>!KM(t,n))),icontains:(i,e)=>e.map(oU).some(t=>i.map(oU).some(n=>t.includes(n))),not_icontains:(i,e)=>e.map(oU).every(t=>i.map(oU).every(n=>!t.includes(n)))},oU=i=>i.toLowerCase(),IZe=L_("[Error tracking]");class EZe{constructor(e){var t,n;this.fe=[],this._instance=e,this.fe=(t=(n=this._instance.persistence)==null?void 0:n.get_property(iH))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,n,r=(t=(n=e.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[];this.fe=r,this._instance.persistence&&this._instance.persistence.register({[iH]:this.fe})}sendExceptionEvent(e){this.pe(e)?IZe.info("Skipping exception capture because a suppression rule matched"):this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}pe(e){var t=e.$exception_list;if(!t||!qI(t)||t.length===0)return!1;var n=t.reduce((r,a)=>{var{type:o,value:s}=a;return U1(o)&&o.length>0&&r.$exception_types.push(o),U1(s)&&s.length>0&&r.$exception_values.push(s),r},{$exception_types:[],$exception_values:[]});return this.fe.some(r=>{var a=r.values.map(o=>{var s,l=CZe[o.operator],c=qI(o.value)?o.value:[o.value],u=(s=n[o.key])!==null&&s!==void 0?s:[];return c.length>0&&l(c,u)});return r.type==="OR"?a.some(Boolean):a.every(Boolean)})}}var lb="Mobile",sU="iOS",gS="Android",WR="Tablet",dpe=gS+" "+WR,fpe="iPad",hpe="Apple",ppe=hpe+" Watch",XR="Safari",jM="BlackBerry",gpe="Samsung",mpe=gpe+"Browser",ype=gpe+" Internet",O9="Chrome",_Ze=O9+" OS",vpe=O9+" "+sU,LH="Internet Explorer",Cpe=LH+" "+lb,OH="Opera",xZe=OH+" Mini",zH="Edge",Ipe="Microsoft "+zH,JM="Firefox",Epe=JM+" "+sU,$R="Nintendo",e5="PlayStation",qM="Xbox",_pe=gS+" "+lb,xpe=lb+" "+XR,t5="Windows",HH=t5+" Phone",Bpe="Nokia",YH="Ouya",bpe="Generic",BZe=bpe+" "+lb.toLowerCase(),Spe=bpe+" "+WR.toLowerCase(),VH="Konqueror",Lx="(\\d+(\\.\\d+)?)",KH=new RegExp("Version/"+Lx),bZe=new RegExp(qM,"i"),SZe=new RegExp(e5+" \\w+","i"),QZe=new RegExp($R+" \\w+","i"),jH=new RegExp(jM+"|PlayBook|BB10","i"),wZe={"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"},MZe=(i,e)=>e&&xm(e,hpe)||function(t){return xm(t,XR)&&!xm(t,O9)&&!xm(t,gS)}(i),Qpe=function(i,e){return e=e||"",xm(i," OPR/")&&xm(i,"Mini")?xZe:xm(i," OPR/")?OH:jH.test(i)?jM:xm(i,"IE"+lb)||xm(i,"WPDesktop")?Cpe:xm(i,mpe)?ype:xm(i,zH)||xm(i,"Edg/")?Ipe:xm(i,"FBIOS")?"Facebook "+lb:xm(i,"UCWEB")||xm(i,"UCBrowser")?"UC Browser":xm(i,"CriOS")?vpe:xm(i,"CrMo")||xm(i,O9)?O9:xm(i,gS)&&xm(i,XR)?_pe:xm(i,"FxiOS")?Epe:xm(i.toLowerCase(),VH.toLowerCase())?VH:MZe(i,e)?xm(i,lb)?xpe:XR:xm(i,JM)?JM:xm(i,"MSIE")||xm(i,"Trident/")?LH:xm(i,"Gecko")?JM:""},DZe={[Cpe]:[new RegExp("rv:"+Lx)],[Ipe]:[new RegExp(zH+"?\\/"+Lx)],[O9]:[new RegExp("("+O9+"|CrMo)\\/"+Lx)],[vpe]:[new RegExp("CriOS\\/"+Lx)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Lx)],[XR]:[KH],[xpe]:[KH],[OH]:[new RegExp("(Opera|OPR)\\/"+Lx)],[JM]:[new RegExp(JM+"\\/"+Lx)],[Epe]:[new RegExp("FxiOS\\/"+Lx)],[VH]:[new RegExp("Konqueror[:/]?"+Lx,"i")],[jM]:[new RegExp(jM+" "+Lx),KH],[_pe]:[new RegExp("android\\s"+Lx,"i")],[ype]:[new RegExp(mpe+"\\/"+Lx)],[LH]:[new RegExp("(rv:|MSIE )"+Lx)],Mozilla:[new RegExp("rv:"+Lx)]},RZe=function(i,e){var t=Qpe(i,e),n=DZe[t];if(wu(n))return null;for(var r=0;r<n.length;r++){var a=n[r],o=i.match(a);if(o)return parseFloat(o[o.length-2])}return null},wpe=[[new RegExp(qM+"; "+qM+" (.*?)[);]","i"),i=>[qM,i&&i[1]||""]],[new RegExp($R,"i"),[$R,""]],[new RegExp(e5,"i"),[e5,""]],[jH,[jM,""]],[new RegExp(t5,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[HH,""];if(new RegExp(lb).test(e)&&!/IEMobile\b/.test(e))return[t5+" "+lb,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var n=t[1],r=wZe[n]||"";return/arm/i.test(e)&&(r="RT"),[t5,r]}return[t5,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>{if(i&&i[3]){var e=[i[3],i[4],i[5]||"0"];return[sU,e.join(".")]}return[sU,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=wu(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+gS+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+gS+")","i"),i=>{if(i&&i[2]){var e=[i[2],i[3],i[4]||"0"];return[gS,e.join(".")]}return[gS,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];if(i&&i[1]){var t=[i[1],i[2],i[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[_Ze,""]],[/Linux|debian/i,["Linux",""]]],Mpe=function(i){return QZe.test(i)?$R:SZe.test(i)?e5:bZe.test(i)?qM:new RegExp(YH,"i").test(i)?YH:new RegExp("("+HH+"|WPDesktop)","i").test(i)?HH:/iPad/.test(i)?fpe:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?ppe:jH.test(i)?jM:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(Bpe,"i").test(i)?Bpe:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?!new RegExp(lb).test(i)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)?/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?gS:dpe:gS:new RegExp("(pda|"+lb+")","i").test(i)?BZe:new RegExp(WR,"i").test(i)&&!new RegExp(WR+" pc","i").test(i)?Spe:""},lU="https?://(.*)",cU=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],NZe=N8(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],cU),JH="<masked>";function Dpe(i,e,t){if(!YA)return{};var n=e?N8([],cU,t||[]):[];return Rpe(gH(YA.URL,n,JH),i)}function Rpe(i,e){var t=NZe.concat(e||[]),n={};return zC(t,function(r){var a=V8(i,r);n[r]=a||null}),n}function Npe(i){var e=function(a){return a?a.search(lU+"google.([^/?]*)")===0?"google":a.search(lU+"bing.com")===0?"bing":a.search(lU+"yahoo.com")===0?"yahoo":a.search(lU+"duckduckgo.com")===0?"duckduckgo":null:null}(i),t=e!="yahoo"?"q":"p",n={};if(!Iw(e)){n.$search_engine=e;var r=YA?V8(YA.referrer,t):"";r.length&&(n.ph_keyword=r)}return n}function Tpe(){return navigator.language||navigator.userLanguage}function Upe(){return(YA==null?void 0:YA.referrer)||"$direct"}function Ppe(i,e){var t=i?N8([],cU,e||[]):[],n=sB==null?void 0:sB.href.substring(0,1e3);return{r:Upe().substring(0,1e3),u:n?gH(n,t,JH):void 0}}function Gpe(i){var e,{r:t,u:n}=i,r={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=zM(t))==null?void 0:e.host};if(n){r.$current_url=n;var a=zM(n);r.$host=a==null?void 0:a.host,r.$pathname=a==null?void 0:a.pathname;var o=Rpe(n);bE(r,o)}if(t){var s=Npe(t);bE(r,s)}return r}function Fpe(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function TZe(){try{return new Date().getTimezoneOffset()}catch{return}}function UZe(i,e){if(!lB)return{};var t,n,r,a=i?N8([],cU,e||[]):[],[o,s]=function(l){for(var c=0;c<wpe.length;c++){var[u,A]=wpe[c],f=u.exec(l),p=f&&(ob(A)?A(f,l):A);if(p)return p}return["",""]}(lB);return bE(tH({$os:o,$os_version:s,$browser:Qpe(lB,navigator.vendor),$device:Mpe(lB),$device_type:(n=lB,r=Mpe(n),r===fpe||r===dpe||r==="Kobo"||r==="Kindle Fire"||r===Spe?WR:r===$R||r===qM||r===e5||r===YH?"Console":r===ppe?"Wearable":r?lb:"Desktop"),$timezone:Fpe(),$timezone_offset:TZe()}),{$current_url:gH(sB==null?void 0:sB.href,a,JH),$host:sB==null?void 0:sB.host,$pathname:sB==null?void 0:sB.pathname,$raw_user_agent:lB.length>1e3?lB.substring(0,997)+"...":lB,$browser_version:RZe(lB,navigator.vendor),$browser_language:Tpe(),$browser_language_prefix:(t=Tpe(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:Ka==null?void 0:Ka.screen.height,$screen_width:Ka==null?void 0:Ka.screen.width,$viewport_height:Ka==null?void 0:Ka.innerHeight,$viewport_width:Ka==null?void 0:Ka.innerWidth,$lib:"web",$lib_version:AQ.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var mS=L_("[FeatureFlags]"),qH="$active_feature_flags",ZM="$override_feature_flags",kpe="$feature_flag_payloads",n5="$override_feature_flag_payloads",Lpe="$feature_flag_request_id",Ope=i=>{var e={};for(var[t,n]of T8(i||{}))n&&(e[t]=n);return e},PZe=i=>{var e=i.flags;return e?(i.featureFlags=Object.fromEntries(Object.keys(e).map(t=>{var n;return[t,(n=e[t].variant)!==null&&n!==void 0?n:e[t].enabled]})),i.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var n;return(n=e[t].metadata)==null?void 0:n.payload}).map(t=>{var n;return[t,(n=e[t].metadata)==null?void 0:n.payload]}))):mS.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),i},GZe=function(i){return i.FeatureFlags="feature_flags",i.Recordings="recordings",i}({}),zpe=new Set(["7c6f7b45","66c1f69c","2727f65a","f3287528","8cc9a311","eb9f671b","c0e1c6f9","057989ec","723f4019","7b102104","563359d3","bad973ea","f6f2c4f4","59454a61","89ad1076","4edd0da1","26c52e72","a970bd2e","89cf4454","16e2b4e7","fba0e7b6","301c8488","bc65d69e","fe66a3c5","37926ca6","52a196df","d32a7577","42c4c9ef","6883bd5a","04809ff7","e59430a8","61be3dd8","7fa5500b","bf027177","8cfdba9b","96f6df5f","569798e9","0ebc61a5","1b5d7b92","17ebb0a4","f97ea965","85cc817b","3044dfc1","0c3fe5c3","b1f95fa3","8a6342e8","72365c68","12d34ad9","733853ec","3beeb69a","0645bb64","32de7f98","5dcbee21","3fe85053","ad960278","9466e5dd","7ca97b2d","2ee2a65c","28fde5f2","85c52f49","0ad823f4","f11b6cc9","aacf8af9","ab3e62b3","3a85ff15","8a67d3c4","f5e91ef1","4b873698","c5dae949","5b643d76","9599c892","34377448","2189e408","3be9ad53","1a14ce7c","2a164ded","8d53ea86","53bdb37d","bfc3f590","8df38ede","bdb81e49","38fde5c0","8d707e6d","73cbc496","f9d8a5ef","d3a9f8c4","a980d8cd","5bcfe086","e4818f68","4f11fb39","a13c6ae3","150c7fbb","98f3d658","f84f7377","1924dd9c","1f6b63b3","24748755","7c0f717c","8a87f11b","49f57f22","3c9e9234","3772f65b","dff631b6","cd609d40","f853c7f7","952db5ee","c5aa8a79","2d21b6fd","79b7164c","4110e26c","a7d3b43f","84e1b8f6","75cc0998","07f78e33","10ca9b1a","ce441b18","01eb8256","c0ac4b67","8e8e5216","db7943dd","fa133a95","498a4508","21bbda67","7dbfed69","be3ec24c","fc80b8e2"]);class FZe{constructor(e){this.ge=!1,this._e=!1,this.me=!1,this.be=!1,this.ye=!1,this.we=!1,this.Se=!1,this._instance=e,this.featureFlagEventHandlers=[]}flags(){if(this._instance.config.__preview_remote_config)this.we=!0;else{var e=!this.$e&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.ke({disableFlags:e})}}get hasLoadedFlags(){return this._e}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(sH),t=this._instance.get_property(ZM),n=this._instance.get_property(n5);if(!n&&!t)return e||{};var r=bE({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of a){var s,l,c=r[o],u=t==null?void 0:t[o],A=wu(u)?(s=c==null?void 0:c.enabled)!==null&&s!==void 0&&s:!!u,f=wu(u)?c.variant:typeof u=="string"?u:void 0,p=n==null?void 0:n[o],v=vA({},c,{enabled:A,variant:A?f??(c==null?void 0:c.variant):void 0});A!==(c==null?void 0:c.enabled)&&(v.original_enabled=c==null?void 0:c.enabled),f!==(c==null?void 0:c.variant)&&(v.original_variant=c==null?void 0:c.variant),p&&(v.metadata=vA({},c==null?void 0:c.metadata,{payload:p,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),r[o]=v}return this.ge||(mS.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.ge=!0),r}getFlagVariants(){var e=this._instance.get_property(LM),t=this._instance.get_property(ZM);if(!t)return e||{};for(var n=bE({},e),r=Object.keys(t),a=0;a<r.length;a++)n[r[a]]=t[r[a]];return this.ge||(mS.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ge=!0),n}getFlagPayloads(){var e=this._instance.get_property(kpe),t=this._instance.get_property(n5);if(!t)return e||{};for(var n=bE({},e||{}),r=Object.keys(t),a=0;a<r.length;a++)n[r[a]]=t[r[a]];return this.ge||(mS.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ge=!0),n}reloadFeatureFlags(){this.be||this._instance.config.advanced_disable_feature_flags||this.$e||(this.$e=setTimeout(()=>{this.ke()},5))}xe(){clearTimeout(this.$e),this.$e=void 0}ensureFlagsLoaded(){this._e||this.me||this.$e||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.be=e}ke(e){var t;if(this.xe(),!this._instance.I())if(this.me)this.ye=!0;else{var n={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:vA({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(HR)||{}),group_properties:this._instance.get_property(U9)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0);var r=this._instance.config.__preview_flags_v2&&this._instance.config.__preview_remote_config,a=function(l){var c=function(u){for(var A=2166136261,f=0;f<u.length;f++)A^=u.charCodeAt(f),A+=(A<<1)+(A<<4)+(A<<7)+(A<<8)+(A<<24);return("00000000"+(A>>>0).toString(16)).slice(-8)}(l);return zpe==null?void 0:zpe.has(c)}(this._instance.config.token)?"/decide?v=4":r?"/flags/?v=2":"/flags/?v=2&config=true",o=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",s=this._instance.requestRouter.endpointFor("api",a+o);r&&(n.timezone=Fpe()),this.me=!0,this._instance.Ee({method:"POST",url:s,data:n,compression:this._instance.config.disable_compression?void 0:dQ.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var c,u,A=!0;if(l.statusCode===200&&(this.ye||(this.$anon_distinct_id=void 0),A=!1),this.me=!1,this.we||(this.we=!0,this._instance.Ie((u=l.json)!==null&&u!==void 0?u:{})),!n.disable_flags||this.ye)if(this.Se=!A,l.json&&(c=l.json.quotaLimited)!=null&&c.includes(GZe.FeatureFlags))mS.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.");else{var f;n.disable_flags||this.receivedFeatureFlags((f=l.json)!==null&&f!==void 0?f:{},A),this.ye&&(this.ye=!1,this.ke())}}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),this._e||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants()[e],r=""+n,a=this._instance.get_property(Lpe)||void 0,o=this._instance.get_property(F8)||{};if((t.send_event||!("send_event"in t))&&(!(e in o)||!o[e].includes(r))){var s,l,c,u,A,f,p,v,B;qI(o[e])?o[e].push(r):o[e]=[r],(s=this._instance.persistence)==null||s.register({[F8]:o});var x=this.getFeatureFlagDetails(e),b={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:a,$feature_flag_bootstrapped_response:((l=this._instance.config.bootstrap)==null||(l=l.featureFlags)==null?void 0:l[e])||null,$feature_flag_bootstrapped_payload:((c=this._instance.config.bootstrap)==null||(c=c.featureFlagPayloads)==null?void 0:c[e])||null,$used_bootstrap_value:!this.Se};wu(x==null||(u=x.metadata)==null?void 0:u.version)||(b.$feature_flag_version=x.metadata.version);var Q,R=(A=x==null||(f=x.reason)==null?void 0:f.description)!==null&&A!==void 0?A:x==null||(p=x.reason)==null?void 0:p.code;R&&(b.$feature_flag_reason=R),x!=null&&(v=x.metadata)!=null&&v.id&&(b.$feature_flag_id=x.metadata.id),wu(x==null?void 0:x.original_variant)&&wu(x==null?void 0:x.original_enabled)||(b.$feature_flag_original_response=wu(x.original_variant)?x.original_enabled:x.original_variant),x!=null&&(B=x.metadata)!=null&&B.original_payload&&(b.$feature_flag_original_payload=x==null||(Q=x.metadata)==null?void 0:Q.original_payload),this._instance.capture("$feature_flag_called",b)}return n}mS.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var n=this._instance.config.token;this._instance.Ee({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:{distinct_id:this._instance.get_distinct_id(),token:n},compression:this._instance.config.disable_compression?void 0:dQ.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:r=>{var a,o=(a=r.json)==null?void 0:a.featureFlagPayloads;t((o==null?void 0:o[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this._e||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);mS.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this._instance.persistence){this._e=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads(),a=this.getFlagsWithDetails();(function(o,s,l,c,u){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var A=PZe(o),f=A.flags,p=A.featureFlags,v=A.featureFlagPayloads;if(p){var B=o.requestId;if(qI(p)){mS.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var x={};if(p)for(var b=0;b<p.length;b++)x[p[b]]=!0;s&&s.register({[qH]:p,[LM]:x})}else{var Q=p,R=v,k=f;o.errorsWhileComputingFlags&&(Q=vA({},l,Q),R=vA({},c,R),k=vA({},u,k)),s&&s.register(vA({[qH]:Object.keys(Ope(Q)),[LM]:Q||{},[kpe]:R||{},[sH]:k||{}},B?{[Lpe]:B}:{}))}}})(e,this._instance.persistence,n,r,a),this.Pe(t)}}override(e,t){t===void 0&&(t=!1),mS.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return mS.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(ZM),this._instance.persistence.unregister(n5),void this.Pe();if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;if(this.ge=!!((t=n.suppressWarning)!==null&&t!==void 0&&t),"flags"in n){if(n.flags===!1)this._instance.persistence.unregister(ZM);else if(n.flags)if(qI(n.flags)){for(var r={},a=0;a<n.flags.length;a++)r[n.flags[a]]=!0;this._instance.persistence.register({[ZM]:r})}else this._instance.persistence.register({[ZM]:n.flags})}return"payloads"in n&&(n.payloads===!1?this._instance.persistence.unregister(n5):n.payloads&&this._instance.persistence.register({[n5]:n.payloads})),void this.Pe()}this.Pe()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._e){var{flags:t,flagVariants:n}=this.Re();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t){var n,r=(this._instance.get_property(P8)||[]).find(l=>l.flagKey===e),a={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};r&&(o.$early_access_feature_name=r.name),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(a,!1);var s=vA({},this.getFlagVariants(),{[e]:t});(n=this._instance.persistence)==null||n.register({[qH]:Object.keys(Ope(s)),[LM]:s}),this.Pe()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this._instance.get_property(P8),a=n?"&"+n.map(o=>"stage="+o).join("&"):"";if(r&&!t)return e(r);this._instance.Ee({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+a),method:"GET",callback:o=>{var s;if(o.json){var l=o.json.earlyAccessFeatures;return(s=this._instance.persistence)==null||s.register({[P8]:l}),e(l)}}})}Re(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(n=>t[n]),flagVariants:Object.keys(t).filter(n=>t[n]).reduce((n,r)=>(n[r]=t[r],n),{})}}Pe(e){var{flags:t,flagVariants:n}=this.Re();this.featureFlagEventHandlers.forEach(r=>r(t,n,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(HR)||{};this._instance.register({[HR]:vA({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(HR)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(U9)||{};Object.keys(n).length!==0&&Object.keys(n).forEach(r=>{n[r]=vA({},n[r],e[r]),delete e[r]}),this._instance.register({[U9]:vA({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(U9)||{};this._instance.register({[U9]:vA({},t,{[e]:{}})})}else this._instance.unregister(U9)}}var kZe=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class ZH{constructor(e){this.S=e,this.props={},this.Te=!1,this.Me=(t=>{var n="";return t.token&&(n=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+n+"_posthog"})(e),this.B=this.Ce(e),this.load(),e.debug&&yd.info("Persistence loaded",e.persistence,vA({},this.props)),this.update_config(e,e),this.save()}Ce(e){kZe.indexOf(e.persistence.toLowerCase())===-1&&(yd.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&VE.O()?VE:t==="localstorage+cookie"&&J8.O()?J8:t==="sessionstorage"&&O_.O()?O_:t==="memory"?yqe:t==="cookie"?hQ:J8.O()?J8:hQ}properties(){var e={};return zC(this.props,function(t,n){if(n===LM&&T1(t))for(var r=Object.keys(t),a=0;a<r.length;a++)e["$feature/"+r[a]]=t[r[a]];else s=n,l=!1,(Iw(o=XJe)?l:zfe&&o.indexOf===zfe?o.indexOf(s)!=-1:(zC(o,function(c){if(l||(l=c===s))return R8}),l))||(e[n]=t);var o,s,l}),e}load(){if(!this.Fe){var e=this.B.L(this.Me);e&&(this.props=bE({},e))}}save(){this.Fe||this.B.j(this.Me,this.props,this.Oe,this.Ae,this.De,this.S.debug)}remove(){this.B.N(this.Me,!1),this.B.N(this.Me,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(T1(e)){wu(t)&&(t="None"),this.Oe=wu(n)?this.Le:n;var r=!1;if(zC(e,(a,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=a,r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(T1(e)){this.Oe=wu(t)?this.Le:t;var n=!1;if(zC(e,(r,a)=>{e.hasOwnProperty(a)&&this.props[a]!==r&&(this.props[a]=r,n=!0)}),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Te){var e=Dpe(this.S.custom_campaign_params,this.S.mask_personal_data_properties,this.S.custom_personal_data_properties);kM(tH(e))||this.register(e),this.Te=!0}}update_search_keyword(){var e;this.register((e=YA==null?void 0:YA.referrer)?Npe(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Upe(),$referring_domain:YA!=null&&YA.referrer&&((e=zM(YA.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[AH]||this.props[dH]||this.register_once({[k8]:Ppe(this.S.mask_personal_data_properties,this.S.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};zC([dH,AH],o=>{var s=this.props[o];s&&zC(s,function(l,c){e["$initial_"+$z(c)]=l})});var t,n,r=this.props[k8];if(r){var a=(t=Gpe(r),n={},zC(t,function(o,s){n["$initial_"+$z(s)]=o}),n);bE(e,a)}return e}safe_merge(e){return zC(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t){if(this.Le=this.Oe=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var n=this.Ce(e),r=this.props;this.clear(),this.B=n,this.props=r,this.save()}}set_disabled(e){this.Fe=e,this.Fe?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ae&&(this.Ae=e,this.remove(),this.save())}set_secure(e){e!==this.De&&(this.De=e,this.remove(),this.save())}set_event_timer(e,t){var n=this.props[OR]||{};n[e]=t,this.props[OR]=n,this.save()}remove_event_timer(e){var t=(this.props[OR]||{})[e];return wu(t)||(delete this.props[OR][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}class Hpe{constructor(){this.je={},this.je={}}on(e,t){return this.je[e]||(this.je[e]=[]),this.je[e].push(t),()=>{this.je[e]=this.je[e].filter(n=>n!==t)}}emit(e,t){for(var n of this.je[e]||[])n(t);for(var r of this.je["*"]||[])r(e,t)}}class z9{constructor(e){this.Ne=new Hpe,this.ze=(t,n)=>this.Ue(t,n)&&this.qe(t,n)&&this.Be(t,n),this.Ue=(t,n)=>n==null||!n.event||(t==null?void 0:t.event)===(n==null?void 0:n.event),this._instance=e,this.He=new Set,this.We=new Set}init(){var e;if(!wu((e=this._instance)==null?void 0:e.Ge)){var t;(t=this._instance)==null||t.Ge((n,r)=>{this.on(n,r)})}}register(e){var t,n;if(!wu((t=this._instance)==null?void 0:t.Ge)&&(e.forEach(o=>{var s,l;(s=this.We)==null||s.add(o),(l=o.steps)==null||l.forEach(c=>{var u;(u=this.He)==null||u.add((c==null?void 0:c.event)||"")})}),(n=this._instance)!=null&&n.autocapture)){var r,a=new Set;e.forEach(o=>{var s;(s=o.steps)==null||s.forEach(l=>{l!=null&&l.selector&&a.add(l==null?void 0:l.selector)})}),(r=this._instance)==null||r.autocapture.setElementSelectors(a)}}on(e,t){var n;t!=null&&e.length!=0&&(this.He.has(e)||this.He.has(t==null?void 0:t.event))&&this.We&&((n=this.We)==null?void 0:n.size)>0&&this.We.forEach(r=>{this.Je(t,r)&&this.Ne.emit("actionCaptured",r.name)})}Ve(e){this.onAction("actionCaptured",t=>e(t))}Je(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var n of t.steps)if(this.ze(e,n))return!0;return!1}onAction(e,t){return this.Ne.on(e,t)}qe(e,t){if(t!=null&&t.url){var n,r=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!r||typeof r!="string"||!z9.Ke(r,t==null?void 0:t.url,(t==null?void 0:t.url_matching)||"contains"))return!1}return!0}static Ke(e,t,n){switch(n){case"regex":return!!Ka&&KM(e,t);case"exact":return t===e;case"contains":var r=z9.Ye(t).replace(/_/g,".").replace(/%/g,".*");return KM(e,r);default:return!1}}static Ye(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Be(e,t){if((t!=null&&t.href||t!=null&&t.tag_name||t!=null&&t.text)&&!this.Xe(e).some(a=>!(t!=null&&t.href&&!z9.Ke(a.href||"",t==null?void 0:t.href,(t==null?void 0:t.href_matching)||"exact"))&&(t==null||!t.tag_name||a.tag_name===(t==null?void 0:t.tag_name))&&!(t!=null&&t.text&&!z9.Ke(a.text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact")&&!z9.Ke(a.$el_text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact"))))return!1;if(t!=null&&t.selector){var n,r=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(!r||!r.includes(t==null?void 0:t.selector))return!1}return!0}Xe(e){return(e==null?void 0:e.properties.$elements)==null?[]:e==null?void 0:e.properties.$elements}}var KE=L_("[Surveys]"),WH="seenSurvey_",LZe=(i,e)=>{var t="$survey_"+e+"/"+i.id;return i.current_iteration&&i.current_iteration>0&&(t="$survey_"+e+"/"+i.id+"/"+i.current_iteration),t};class OZe{constructor(e){this._instance=e,this.Qe=new Map,this.Ze=new Map}register(e){var t;wu((t=this._instance)==null?void 0:t.Ge)||(this.tr(e),this.ir(e))}ir(e){var t=e.filter(n=>{var r,a;return((r=n.conditions)==null?void 0:r.actions)&&((a=n.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0});t.length!==0&&(this.er==null&&(this.er=new z9(this._instance),this.er.init(),this.er.Ve(n=>{this.onAction(n)})),t.forEach(n=>{var r,a,o,s,l;n.conditions&&(r=n.conditions)!=null&&r.actions&&(a=n.conditions)!=null&&(a=a.actions)!=null&&a.values&&((o=n.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((s=this.er)==null||s.register(n.conditions.actions.values),(l=n.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach(c=>{if(c&&c.name){var u=this.Ze.get(c.name);u&&u.push(n.id),this.Ze.set(c.name,u||[n.id])}}))}))}tr(e){var t;e.filter(n=>{var r,a;return((r=n.conditions)==null?void 0:r.events)&&((a=n.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0}).length!==0&&((t=this._instance)==null||t.Ge((n,r)=>{this.onEvent(n,r)}),e.forEach(n=>{var r;(r=n.conditions)==null||(r=r.events)==null||(r=r.values)==null||r.forEach(a=>{if(a&&a.name){var o=this.Qe.get(a.name);o&&o.push(n.id),this.Qe.set(a.name,o||[n.id])}})}))}onEvent(e,t){var n,r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[G8])||[];if(e==="survey shown"&&t&&r.length>0){var a;KE.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:r});var o=t==null||(a=t.properties)==null?void 0:a.$survey_id;if(o){var s=r.indexOf(o);s>=0&&(r.splice(s,1),this.rr(r))}}else this.Qe.has(e)&&(KE.info("survey event matched, updating activated surveys",{event:e,surveys:this.Qe.get(e)}),this.rr(r.concat(this.Qe.get(e)||[])))}onAction(e){var t,n=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[G8])||[];this.Ze.has(e)&&this.rr(n.concat(this.Ze.get(e)||[]))}rr(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[G8]:[...new Set(e)]})}getSurveys(){var e,t=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[G8];return t||[]}getEventToSurveys(){return this.Qe}sr(){return this.er}}class zZe{constructor(e){this.nr=null,this.ar=!1,this.lr=!1,this.ur=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){var t=e.surveys;if(yv(t))return KE.warn("Flags not loaded yet. Not loading surveys.");var n=qI(t);this.hr=n?t.length>0:t,KE.info("flags response received, hasSurveys: "+this.hr),this.hr&&this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(WH)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach(r=>localStorage.removeItem(r))}loadIfEnabled(){if(!this.nr)if(this.lr)KE.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)KE.info("Disabled. Not loading surveys.");else if(this.hr){var e=E0==null?void 0:E0.__PosthogExtensions__;if(e){this.lr=!0;try{var t=e.generateSurveys;if(t)return void this.dr(t);var n=e.loadExternalDependency;if(!n)return void this.vr("PostHog loadExternalDependency extension not found.");n(this._instance,"surveys",r=>{r||!e.generateSurveys?this.vr("Could not load surveys script",r):this.dr(e.generateSurveys)})}catch(r){throw this.vr("Error initializing surveys",r),r}finally{this.lr=!1}}else KE.error("PostHog Extensions not found.")}else KE.info("No surveys to load.")}dr(e){this.nr=e(this._instance),this._surveyEventReceiver=new OZe(this._instance),KE.info("Surveys loaded successfully"),this.cr({isLoaded:!0})}vr(e,t){KE.error(e,t),this.cr({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.ur.push(e),this.nr&&this.cr({isLoaded:!0}),()=>{this.ur=this.ur.filter(t=>t!==e)}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return KE.info("Disabled. Not loading surveys."),e([]);var n=this._instance.get_property(lH);if(n&&!t)return e(n,{isLoaded:!0});if(this.ar)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.ar=!0,this._instance.Ee({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:r=>{var a;this.ar=!1;var o=r.statusCode;if(o!==200||!r.json){var s="Surveys API could not be loaded, status: "+o;return KE.error(s),e([],{isLoaded:!1,error:s})}var l,c=r.json.surveys||[],u=c.filter(A=>function(f){return!(!f.start_date||f.end_date)}(A)&&(function(f){var p;return!((p=f.conditions)==null||(p=p.events)==null||(p=p.values)==null||!p.length)}(A)||function(f){var p;return!((p=f.conditions)==null||(p=p.actions)==null||(p=p.values)==null||!p.length)}(A)));return u.length>0&&((l=this._surveyEventReceiver)==null||l.register(u)),(a=this._instance.persistence)==null||a.register({[lH]:c}),e(c,{isLoaded:!0})}})}catch(r){throw this.ar=!1,r}}cr(e){for(var t of this.ur)try{e.isLoaded?this.getSurveys(t):t([],e)}catch(n){KE.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!yv(this.nr))return this.nr.getActiveMatchingSurveys(e,t);KE.warn("init was not called")}pr(e){var t=null;return this.getSurveys(n=>{var r;t=(r=n.find(a=>a.id===e))!==null&&r!==void 0?r:null}),t}gr(e){if(yv(this.nr))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.pr(e):e;return t?this.nr.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(yv(this.nr))return KE.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.gr(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return yv(this.nr)?(KE.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(n=>{this.getSurveys(r=>{var a,o=(a=r.find(l=>l.id===e))!==null&&a!==void 0?a:null;if(o){var s=this.gr(o);n({visible:s.eligible,disabledReason:s.reason})}else n({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t){if(yv(this.nr))KE.warn("init was not called");else{var n=this.pr(e),r=YA==null?void 0:YA.querySelector(t);n?r?this.nr.renderSurvey(n,r):KE.warn("Survey element not found"):KE.warn("Survey not found")}}}(function(i){return i.Button="button",i.Tab="tab",i.Selector="selector",i})({}),function(i){return i.TopLeft="top_left",i.TopRight="top_right",i.TopCenter="top_center",i.MiddleLeft="middle_left",i.MiddleRight="middle_right",i.MiddleCenter="middle_center",i.Left="left",i.Center="center",i.Right="right",i.NextToTrigger="next_to_trigger",i}({}),function(i){return i.Popover="popover",i.API="api",i.Widget="widget",i}({}),function(i){return i.Open="open",i.MultipleChoice="multiple_choice",i.SingleChoice="single_choice",i.Rating="rating",i.Link="link",i}({}),function(i){return i.NextQuestion="next_question",i.End="end",i.ResponseBased="response_based",i.SpecificQuestion="specific_question",i}({}),function(i){return i.Once="once",i.Recurring="recurring",i.Always="always",i}({});var XH=function(i){return i.SHOWN="survey shown",i.DISMISSED="survey dismissed",i.SENT="survey sent",i}({}),Ype=function(i){return i.SURVEY_ID="$survey_id",i.SURVEY_NAME="$survey_name",i.SURVEY_RESPONSE="$survey_response",i.SURVEY_ITERATION="$survey_iteration",i.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",i.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",i.SURVEY_SUBMISSION_ID="$survey_submission_id",i.SURVEY_QUESTIONS="$survey_questions",i.SURVEY_COMPLETED="$survey_completed",i}({}),Vpe=L_("[RateLimiter]");class HZe{constructor(e){var t,n;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=r=>{var a=r.text;if(a&&a.length)try{(JSON.parse(a).quota_limited||[]).forEach(o=>{Vpe.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4})}catch(o){return void Vpe.warn('could not rate limit - continuing. Error: "'+(o==null?void 0:o.message)+'"',{text:a})}},this.instance=e,this.captureEventsPerSecond=((t=e.config.rate_limiting)==null?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((n=e.config.rate_limiting)==null?void 0:n.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,n,r;e===void 0&&(e=!1);var a=new Date().getTime(),o=(t=(n=this.instance.persistence)==null?void 0:n.get_property(uH))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:a};o.tokens+=(a-o.last)/1e3*this.captureEventsPerSecond,o.last=a,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var s=o.tokens<1;return s||e||(o.tokens=Math.max(0,o.tokens-1)),!s||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=s,(r=this.instance.persistence)==null||r.set_property(uH,o),{isRateLimited:s,remainingTokens:o.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var H9=L_("[RemoteConfig]");class YZe{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=E0._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}_r(e){var t,n;(t=E0.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=E0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(H9.error("PostHog Extensions not found. Cannot load remote config."),e())}mr(e){this._instance.Ee({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return H9.info("Using preloaded remote config",this.remoteConfig),void this.Ie(this.remoteConfig);if(this._instance.I())return void H9.warn("Remote config is disabled. Falling back to local config.");this._r(e=>{if(!e)return H9.info("No config found after loading remote JS config. Falling back to JSON."),void this.mr(t=>{this.Ie(t)});this.Ie(e)})}catch(e){H9.error("Error loading remote config",e)}}Ie(e){e?this._instance.config.__preview_remote_config?(this._instance.Ie(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):H9.info("__preview_remote_config is disabled. Logging config instead",e):H9.error("Failed to fetch remote config from PostHog.")}}var $H=3e3;class VZe{constructor(e,t){this.br=!0,this.yr=[],this.wr=GB((t==null?void 0:t.flush_interval_ms)||$H,250,5e3,"flush interval",$H),this.Sr=e}enqueue(e){this.yr.push(e),this.$r||this.kr()}unload(){this.Er();var e=this.yr.length>0?this.Ir():{},t=Object.values(e);[...t.filter(n=>n.url.indexOf("/e")===0),...t.filter(n=>n.url.indexOf("/e")!==0)].map(n=>{this.Sr(vA({},n,{transport:"sendBeacon"}))})}enable(){this.br=!1,this.kr()}kr(){var e=this;this.br||(this.$r=setTimeout(()=>{if(this.Er(),this.yr.length>0){var t=this.Ir(),n=function(){var a=t[r],o=new Date().getTime();a.data&&qI(a.data)&&zC(a.data,s=>{s.offset=Math.abs(s.timestamp-o),delete s.timestamp}),e.Sr(a)};for(var r in t)n()}},this.wr))}Er(){clearTimeout(this.$r),this.$r=void 0}Ir(){var e={};return zC(this.yr,t=>{var n,r=t,a=(r?r.batchKey:null)||r.url;wu(e[a])&&(e[a]=vA({},r,{data:[]})),(n=e[a].data)==null||n.push(r.data)}),this.yr=[],e}}var KZe=["retriesPerformedSoFar"];class jZe{constructor(e){this.Pr=!1,this.Rr=3e3,this.yr=[],this._instance=e,this.yr=[],this.Tr=!0,!wu(Ka)&&"onLine"in Ka.navigator&&(this.Tr=Ka.navigator.onLine,d1(Ka,"online",()=>{this.Tr=!0,this.se()}),d1(Ka,"offline",()=>{this.Tr=!1}))}get length(){return this.yr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=Jfe(e,KZe);gx(t)&&t>0&&(n.url=aU(n.url,{retry_count:t})),this._instance.Ee(vA({},n,{callback:r=>{r.statusCode!==200&&(r.statusCode<400||r.statusCode>=500)&&(t??0)<10?this.Mr(vA({retriesPerformedSoFar:t},n)):n.callback==null||n.callback(r)}}))}Mr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(o){var s=3e3*Math.pow(2,o),l=s/2,c=Math.min(18e5,s),u=(Math.random()-.5)*(c-l);return Math.ceil(c+u)}(t),r=Date.now()+n;this.yr.push({retryAt:r,requestOptions:e});var a="Enqueued failed request for retry in "+n;navigator.onLine||(a+=" (Browser is offline)"),yd.warn(a),this.Pr||(this.Pr=!0,this.Cr())}Cr(){this.Fr&&clearTimeout(this.Fr),this.Fr=setTimeout(()=>{this.Tr&&this.yr.length>0&&this.se(),this.Cr()},this.Rr)}se(){var e=Date.now(),t=[],n=this.yr.filter(a=>a.retryAt<e||(t.push(a),!1));if(this.yr=t,n.length>0)for(var{requestOptions:r}of n)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Fr&&(clearTimeout(this.Fr),this.Fr=void 0),this.yr))try{this._instance.Ee(vA({},e,{transport:"sendBeacon"}))}catch(t){yd.error(t)}this.yr=[]}}class JZe{constructor(e){this.Or=()=>{var t,n,r,a;this.Ar||(this.Ar={});var o=this.scrollElement(),s=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=s+((o==null?void 0:o.clientHeight)||0),u=(o==null?void 0:o.scrollHeight)||0;this.Ar.lastScrollY=Math.ceil(s),this.Ar.maxScrollY=Math.max(s,(t=this.Ar.maxScrollY)!==null&&t!==void 0?t:0),this.Ar.maxScrollHeight=Math.max(l,(n=this.Ar.maxScrollHeight)!==null&&n!==void 0?n:0),this.Ar.lastContentY=c,this.Ar.maxContentY=Math.max(c,(r=this.Ar.maxContentY)!==null&&r!==void 0?r:0),this.Ar.maxContentHeight=Math.max(u,(a=this.Ar.maxContentHeight)!==null&&a!==void 0?a:0)},this._instance=e}getContext(){return this.Ar}resetContext(){var e=this.Ar;return setTimeout(this.Or,0),e}startMeasuringScrollPosition(){d1(Ka,"scroll",this.Or,{capture:!0}),d1(Ka,"scrollend",this.Or,{capture:!0}),d1(Ka,"resize",this.Or)}scrollElement(){if(!this._instance.config.scroll_root_selector)return Ka==null?void 0:Ka.document.documentElement;var e=qI(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var n=Ka==null?void 0:Ka.document.querySelector(t);if(n)return n}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return Ka&&(Ka.scrollY||Ka.pageYOffset||Ka.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return Ka&&(Ka.scrollX||Ka.pageXOffset||Ka.document.documentElement.scrollLeft)||0}}var qZe=i=>Ppe(i==null?void 0:i.config.mask_personal_data_properties,i==null?void 0:i.config.custom_personal_data_properties);class ZZe{constructor(e,t,n,r){this.Dr=a=>{var o=this.Lr();if(!o||o.sessionId!==a){var s={sessionId:a,props:this.jr(this._instance)};this.Nr.register({[cH]:s})}},this._instance=e,this.zr=t,this.Nr=n,this.jr=r||qZe,this.zr.onSessionId(this.Dr)}Lr(){return this.Nr.props[cH]}getSetOnceProps(){var e,t=(e=this.Lr())==null?void 0:e.props;return t?"r"in t?Gpe(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return zC(tH(this.getSetOnceProps()),(t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+$z(n)]=t}),e}}var Kpe=L_("[SessionId]");class WZe{constructor(e,t,n){var r;if(this.Ur=[],!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.S=e.config,this.Nr=e.persistence,this.fi=void 0,this.Ct=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.qr=t||xw,this.Br=n||xw;var a=this.S.persistence_name||this.S.token,o=this.S.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*GB(o,60,36e3,"session_idle_timeout_seconds",1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hr(),this.Wr="ph_"+a+"_window_id",this.Gr="ph_"+a+"_primary_window_exists",this.Jr()){var s=O_.L(this.Wr),l=O_.L(this.Gr);s&&!l?this.fi=s:O_.N(this.Wr),O_.j(this.Gr,!0)}if((r=this.S.bootstrap)!=null&&r.sessionID)try{var c=(u=>{var A=u.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)})(this.S.bootstrap.sessionID);this.Vr(this.S.bootstrap.sessionID,new Date().getTime(),c)}catch(u){Kpe.error("Invalid sessionID in bootstrap",u)}this.Kr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return wu(this.Ur)&&(this.Ur=[]),this.Ur.push(e),this.Ct&&e(this.Ct,this.fi),()=>{this.Ur=this.Ur.filter(t=>t!==e)}}Jr(){return this.S.persistence!=="memory"&&!this.Nr.Fe&&O_.O()}Yr(e){e!==this.fi&&(this.fi=e,this.Jr()&&O_.j(this.Wr,e))}Xr(){return this.fi?this.fi:this.Jr()?O_.L(this.Wr):null}Vr(e,t,n){e===this.Ct&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.Ct=e,this.Nr.register({[U8]:[t,e,n]}))}Qr(){if(this.Ct&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ct,this._sessionStartTimestamp];var e=this.Nr.props[U8];return qI(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Vr(null,null,null)}Kr(){d1(Ka,"beforeunload",()=>{this.Jr()&&O_.N(this.Gr)},{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.S.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var n=t||new Date().getTime(),[r,a,o]=this.Qr(),s=this.Xr(),l=gx(o)&&o>0&&Math.abs(n-o)>864e5,c=!1,u=!a,A=!e&&Math.abs(n-r)>this.sessionTimeoutMs;u||A||l?(a=this.qr(),s=this.Br(),Kpe.info("new session ID generated",{sessionId:a,windowId:s,changeReason:{noSessionId:u,activityTimeout:A,sessionPastMaximumLength:l}}),o=n,c=!0):s||(s=this.Br(),c=!0);var f=r===0||!e||l?n:r,p=o===0?new Date().getTime():o;return this.Yr(s),this.Vr(a,f,p),e||this.Hr(),c&&this.Ur.forEach(v=>v(a,s,c?{noSessionId:u,activityTimeout:A,sessionPastMaximumLength:l}:void 0)),{sessionId:a,windowId:s,sessionStartTimestamp:p,changeReason:c?{noSessionId:u,activityTimeout:A,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}Hr(){clearTimeout(this.Zr),this.Zr=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}}var XZe=["$set_once","$set"],Qw=L_("[SiteApps]");class $Ze{constructor(e){this._instance=e,this.ts=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}es(e,t){if(t){var n=this.globalsForEvent(t);this.ts.push(n),this.ts.length>1e3&&(this.ts=this.ts.slice(10))}}get siteAppLoaders(){var e;return(e=E0._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ge(this.es.bind(this));this.rs=()=>{e(),this.ts=[],this.rs=void 0}}}globalsForEvent(e){var t,n,r,a,o,s,l;if(!e)throw new Error("Event payload is required");var c={},u=this._instance.get_property("$groups")||[],A=this._instance.get_property("$stored_group_properties")||{};for(var[f,p]of Object.entries(A))c[f]={id:u[f],type:f,properties:p};var{$set_once:v,$set:B}=e;return{event:vA({},Jfe(e,XZe),{properties:vA({},e.properties,B?{$set:vA({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},B)}:{},v?{$set_once:vA({},(r=(a=e.properties)==null?void 0:a.$set_once)!==null&&r!==void 0?r:{},v)}:{}),elements_chain:(o=(s=e.properties)==null?void 0:s.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var s;!t.errored&&this.ts.length&&(Qw.info("Processing "+this.ts.length+" events for site app with id "+e.id),this.ts.forEach(l=>t.processEvent==null?void 0:t.processEvent(l)),t.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((s=this.rs)==null||s.call(this))},r=!1,a=s=>{t.errored=!s,t.loaded=!0,Qw.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&n()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:s=>{a(s)}});o&&(t.processEvent=o),r=!0}catch(s){Qw.error("Error while initializing PostHog app with config id "+e.id,s),a(!1)}if(r&&t.loaded)try{n()}catch(s){Qw.error("Error while processing buffered events PostHog app with config id "+e.id,s),t.errored=!0}}ss(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}ns(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(r){Qw.error("Error while processing event "+e.event+" for site app "+n.id,r)}}}onRemoteConfig(e){var t,n,r,a=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.ss(),void this._instance.on("eventCaptured",c=>this.ns(c))):void Qw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.rs)==null||n.call(this),(r=e.siteApps)!=null&&r.length)if(this.isEnabled){var o=function(c){var u;E0["__$$ph_site_app_"+c]=a._instance,(u=E0.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(a._instance,l,A=>{if(A)return Qw.error("Error while initializing PostHog app with config id "+c,A)})};for(var{id:s,url:l}of e.siteApps)o(s)}else Qw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var eWe=["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","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","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"],jpe=function(i,e){if(!i)return!1;var t=i.toLowerCase();return eWe.concat(e||[]).some(n=>{var r=n.toLowerCase();return t.indexOf(r)!==-1})},Jpe=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&jpe(t,e))return!0;try{var n=i==null?void 0:i.userAgentData;if(n!=null&&n.brands&&n.brands.some(r=>jpe(r==null?void 0:r.brand,e)))return!0}catch{}return!!i.webdriver},i5=function(i){return i.US="us",i.EU="eu",i.CUSTOM="custom",i}({}),qpe="i.posthog.com";class tWe{constructor(e){this.os={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+qpe,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.os[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.os[this.apiHost]=i5.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.os[this.apiHost]=i5.EU:this.os[this.apiHost]=i5.CUSTOM),this.os[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(this.region===i5.CUSTOM)return this.apiHost+t;var n=qpe+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}}var nWe={icontains:(i,e)=>!!Ka&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!Ka&&e.href.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>!!Ka&&KM(e.href,i),not_regex:(i,e)=>!!Ka&&!KM(e.href,i),exact:(i,e)=>e.href===i,is_not:(i,e)=>e.href!==i};class vx{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),t.getWebExperiments(r=>{vx.ls("retrieved web experiments from the server"),t.us=new Map,r.forEach(a=>{if(a.feature_flag_key){var o;t.us&&(vx.ls("setting flag key ",a.feature_flag_key," to web experiment ",a),(o=t.us)==null||o.set(a.feature_flag_key,a));var s=t._instance.getFeatureFlag(a.feature_flag_key);U1(s)&&a.variants[s]&&t.hs(a.name,s,a.variants[s].transforms)}else if(a.variants)for(var l in a.variants){var c=a.variants[l];vx.ds(c)&&t.hs(a.name,l,c.transforms)}})},n)},this._instance=e,this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}onFeatureFlags(e){if(this._is_bot())vx.ls("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(yv(this.us))return this.us=new Map,this.loadIfEnabled(),void this.previewWebExperiment();vx.ls("applying feature flags",e),e.forEach(t=>{var n;if(this.us&&(n=this.us)!=null&&n.has(t)){var r,a=this._instance.getFeatureFlag(t),o=(r=this.us)==null?void 0:r.get(t);a&&o!=null&&o.variants[a]&&this.hs(o.name,a,o.variants[a].transforms)}})}}previewWebExperiment(){var e=vx.getWindowLocation();if(e!=null&&e.search){var t=V8(e==null?void 0:e.search,"__experiment_id"),n=V8(e==null?void 0:e.search,"__experiment_variant");t&&n&&(vx.ls("previewing web experiments "+t+" && "+n),this.getWebExperiments(r=>{this.vs(parseInt(t),n,r)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this._instance.config.disable_web_experiments&&!n)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance.Ee({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:a=>{if(a.statusCode!==200||!a.json)return e([]);var o=a.json.experiments||[];return e(o)}})}vs(e,t,n){var r=n.filter(a=>a.id===e);r&&r.length>0&&(vx.ls("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.hs(r[0].name,t,r[0].variants[t].transforms))}static ds(e){return!yv(e.conditions)&&vx.cs(e)&&vx.fs(e)}static cs(e){var t;if(yv(e.conditions)||yv((t=e.conditions)==null?void 0:t.url))return!0;var n,r,a,o=vx.getWindowLocation();return!!o&&((n=e.conditions)==null||!n.url||nWe[(r=(a=e.conditions)==null?void 0:a.urlMatchType)!==null&&r!==void 0?r:"icontains"](e.conditions.url,o))}static getWindowLocation(){return Ka==null?void 0:Ka.location}static fs(e){var t;if(yv(e.conditions)||yv((t=e.conditions)==null?void 0:t.utm))return!0;var n=Dpe();if(n.utm_source){var r,a,o,s,l,c,u,A,f=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_campaign)==n.utm_campaign,p=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_source)==n.utm_source,v=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==n.utm_medium,B=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((A=e.conditions)==null||(A=A.utm)==null?void 0:A.utm_term)==n.utm_term;return f&&v&&B&&p}return!1}static ls(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];yd.info("[WebExperiments] "+e,n)}hs(e,t,n){this._is_bot()?vx.ls("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?n.forEach(r=>{if(r.selector){var a;vx.ls("applying transform of variant "+t+" for experiment "+e+" ",r);var o=(a=document)==null?void 0:a.querySelectorAll(r.selector);o==null||o.forEach(s=>{var l=s;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)})}}):vx.ls("Control variants leave the page unmodified.")}_is_bot(){return PB&&this._instance?Jpe(PB,this._instance.config.custom_blocked_useragents):void 0}}var r5={},eY=()=>{},WM="posthog",Zpe=!vZe&&(lB==null?void 0:lB.indexOf("MSIE"))===-1&&(lB==null?void 0:lB.indexOf("Mozilla"))===-1,Wpe=i=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:WJe(YA==null?void 0:YA.location),persistence:"localStorage+cookie",persistence_name:"",loaded:eY,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:i!=="2025-05-24"||"history_change",capture_pageleave:"if_capture_pageview",defaults:i??"unset",debug:sB&&U1(sB==null?void 0:sB.search)&&sB.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_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(Ka==null||(e=Ka.location)==null?void 0:e.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",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,session_recording:{},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_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var n="Bad HTTP status: "+t.statusCode+" "+t.text;yd.error(n)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:$H},error_tracking:{},_onCapture:eY}},Xpe=i=>{var e={};wu(i.process_person)||(e.person_profiles=i.process_person),wu(i.xhr_headers)||(e.request_headers=i.xhr_headers),wu(i.cookie_name)||(e.persistence_name=i.cookie_name),wu(i.disable_cookie)||(e.disable_persistence=i.disable_cookie),wu(i.store_google)||(e.save_campaign_params=i.store_google),wu(i.verbose)||(e.debug=i.verbose);var t=bE({},e,i);return qI(i.property_blacklist)&&(wu(i.property_denylist)?t.property_denylist=i.property_blacklist:qI(i.property_denylist)?t.property_denylist=[...i.property_blacklist,...i.property_denylist]:yd.error("Invalid value for property_denylist config: "+i.property_denylist)),t};class iWe{constructor(){this.__forceAllowLocalhost=!1}get ps(){return this.__forceAllowLocalhost}set ps(e){yd.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class uU{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new iWe,this.gs=!1,this.version=AQ.LIB_VERSION,this._s=new Hpe,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Wpe(),this.SentryIntegration=cZe,this.sentryIntegration=e=>function(t,n){var r=ape(t,n);return{name:rpe,processEvent:a=>r(a)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.bs=!1,this.ys=null,this.ws=null,this.Ss=null,this.featureFlags=new FZe(this),this.toolbar=new AZe(this),this.scrollManager=new JZe(this),this.pageViewManager=new mZe(this),this.surveys=new zZe(this),this.experiments=new vx(this),this.exceptions=new EZe(this),this.rateLimiter=new HZe(this),this.requestRouter=new tWe(this),this.consent=new vqe(this),this.people={set:(e,t,n)=>{var r=U1(e)?{[e]:t}:e;this.setPersonProperties(r),n==null||n({})},set_once:(e,t,n)=>{var r=U1(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n==null||n({})}},this.on("eventCaptured",e=>yd.info('send "'+(e==null?void 0:e.event)+'"',e))}init(e,t,n){if(n&&n!==WM){var r,a=(r=r5[n])!==null&&r!==void 0?r:new uU;return a._init(e,t,n),r5[n]=a,r5[WM][n]=a,a}return this._init(e,t,n)}_init(e,t,n){var r,a;if(t===void 0&&(t={}),wu(e)||eH(e))return yd.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return yd.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.$s=t,this.ks=[],t.person_profiles&&(this.ws=t.person_profiles),this.set_config(bE({},Wpe(t.defaults),Xpe(t),{name:n,token:e})),this.config.on_xhr_error&&yd.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:dQ.GZipJS,this.persistence=new ZH(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ZH(vA({},this.config,{persistence:"sessionStorage"}));var o=vA({},this.persistence.props),s=vA({},this.sessionPersistence.props);if(this.register({$initialization_time:new Date().toISOString()}),this.xs=new VZe(b=>this.Es(b),this.config.request_queue_config),this.Is=new jZe(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new WZe(this),this.sessionPropsManager=new ZZe(this,this.sessionManager,this.persistence)),new fZe(this).startIfEnabledOrStop(),this.siteApps=new $Ze(this),(r=this.siteApps)==null||r.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new sZe(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new Aqe(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new gZe(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new hZe(this),this.exceptionObserver=new Eqe(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new whe(this,Iqe),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new Pqe(this),this.historyAutocapture.startIfEnabled(),AQ.DEBUG=AQ.DEBUG||this.config.debug,AQ.DEBUG&&yd.info("Starting in debug mode",{this:this,config:t,thisC:vA({},this.config),p:o,s}),this.Ps(),((a=t.bootstrap)==null?void 0:a.distinctID)!==void 0){var l,c,u=this.config.get_device_id(xw()),A=(l=t.bootstrap)!=null&&l.isIdentifiedID?u:t.bootstrap.distinctID;this.persistence.set_property(fQ,(c=t.bootstrap)!=null&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:A})}if(this.Rs()){var f,p,v=Object.keys(((f=t.bootstrap)==null?void 0:f.featureFlags)||{}).filter(b=>{var Q;return!((Q=t.bootstrap)==null||(Q=Q.featureFlags)==null||!Q[b])}).reduce((b,Q)=>{var R;return b[Q]=((R=t.bootstrap)==null||(R=R.featureFlags)==null?void 0:R[Q])||!1,b},{}),B=Object.keys(((p=t.bootstrap)==null?void 0:p.featureFlagPayloads)||{}).filter(b=>v[b]).reduce((b,Q)=>{var R,k;return(R=t.bootstrap)!=null&&(R=R.featureFlagPayloads)!=null&&R[Q]&&(b[Q]=(k=t.bootstrap)==null||(k=k.featureFlagPayloads)==null?void 0:k[Q]),b},{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:B})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:O8,$device_id:null},"");else if(!this.get_distinct_id()){var x=this.config.get_device_id(xw());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(fQ,"anonymous")}return d1(Ka,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?lZe(this,()=>this.Ts()):this.Ts(),ob(this.config._onCapture)&&this.config._onCapture!==eY&&(yd.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",b=>this.config._onCapture(b.event,b))),this}Ie(e){var t,n,r,a,o,s,l,c;if(!YA||!YA.body)return yd.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Ie(e)},500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=xm(e.supportedCompression,dQ.GZipJS)?dQ.GZipJS:xm(e.supportedCompression,dQ.Base64)?dQ.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.ws?this.ws:"identified_only"}),(n=this.siteApps)==null||n.onRemoteConfig(e),(r=this.sessionRecording)==null||r.onRemoteConfig(e),(a=this.autocapture)==null||a.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(s=this.webVitalsAutocapture)==null||s.onRemoteConfig(e),(l=this.exceptionObserver)==null||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(c=this.deadClicksAutocapture)==null||c.onRemoteConfig(e)}Ts(){try{this.config.loaded(this)}catch(e){yd.critical("`loaded` function failed",e)}this.Ms(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this.Cs()},1),new YZe(this).load(),this.featureFlags.flags()}Ms(){var e;this.has_opted_out_capturing()||this.config.request_batching&&((e=this.xs)==null||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||Ew(this.__request_queue,e=>this.Es(e)),this.__request_queue=[],this.Ms()}_handle_unload(){var e,t;this.config.request_batching?(this.Fs()&&this.capture("$pageleave"),(e=this.xs)==null||e.unload(),(t=this.Is)==null||t.unload()):this.Fs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Ee(e){this.__loaded&&(Zpe?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=aU(e.url,{ip:this.config.ip?1:0}),e.headers=vA({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var n,r,a,o=vA({},t);o.timeout=o.timeout||6e4,o.url=aU(o.url,{_:new Date().getTime().toString(),ver:AQ.LIB_VERSION,compression:o.compression});var s=(n=o.transport)!==null&&n!==void 0?n:"fetch",l=(r=(a=Zfe(ZR,c=>c.transport===s))==null?void 0:a.method)!==null&&r!==void 0?r:ZR[0].method;if(!l)throw new Error("No available transport method");l(o)})(vA({},e,{callback:t=>{var n,r;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((n=(r=this.config).on_request_error)==null||n.call(r,t)),e.callback==null||e.callback(t)}}))))}Es(e){this.Is?this.Is.retriableRequest(e):this.Ee(e)}_execute_array(e){var t,n=[],r=[],a=[];Ew(e,s=>{s&&(t=s[0],qI(t)?a.push(s):ob(s)?s.call(this):qI(s)&&t==="alias"?n.push(s):qI(s)&&t.indexOf("capture")!==-1&&ob(this[t])?a.push(s):r.push(s))});var o=function(s,l){Ew(s,function(c){if(qI(c[0])){var u=l;zC(c,function(A){u=u[A[0]].apply(u,A.slice(1))})}else this[c[0]].apply(this,c.slice(1))},l)};o(n,this),o(r,this),o(a,this)}Rs(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,n){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.xs){if(!this.consent.isOptedOut())if(!wu(e)&&U1(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var a=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a==null||!a.isRateLimited){t!=null&&t.$current_url&&!U1(t==null?void 0:t.$current_url)&&(yd.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&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();var o=new Date,s=(n==null?void 0:n.timestamp)||o,l=xw(),c={uuid:l,event:e,properties:this.calculateEventProperties(e,t||{},s,l)};a&&(c.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens),n!=null&&n.$set&&(c.$set=n==null?void 0:n.$set);var u,A,f=this.Os(n==null?void 0:n.$set_once);if(f&&(c.$set_once=f),(c=qJe(c,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=s,wu(n==null?void 0:n.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=o),e===XH.DISMISSED||e===XH.SENT){var p=t==null?void 0:t[Ype.SURVEY_ID],v=t==null?void 0:t[Ype.SURVEY_ITERATION];localStorage.setItem((A=""+WH+(u={id:p,current_iteration:v}).id,u.current_iteration&&u.current_iteration>0&&(A=""+WH+u.id+"_"+u.current_iteration),A),"true"),c.$set=vA({},c.$set,{[LZe({id:p,current_iteration:v},e===XH.SENT?"responded":"dismissed")]:!0})}var B=vA({},c.properties.$set,c.$set);if(kM(B)||this.setPersonPropertiesForFlags(B),!yv(this.config.before_send)){var x=this.As(c);if(!x)return;c=x}this._s.emit("eventCaptured",c);var b={method:"POST",url:(r=n==null?void 0:n._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:n==null?void 0:n._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.Es(b):this.xs.enqueue(b),c}yd.critical("This capture call is ignored due to client rate limiting.")}}else yd.error("No event name provided to posthog.capture")}else yd.uninitializedWarning("posthog.capture")}Ge(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,n,r,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var o=a?void 0:this.persistence.remove_event_timer(e),s=vA({},t);if(s.token=this.config.token,s.$config_defaults=this.config.defaults,this.config.__preview_experimental_cookieless_mode&&(s.$cookieless_mode=!0),e==="$snapshot"){var l=vA({},this.persistence.properties(),this.sessionPersistence.properties());return s.distinct_id=l.distinct_id,(!U1(s.distinct_id)&&!gx(s.distinct_id)||eH(s.distinct_id))&&yd.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),s}var c,u=UZe(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:A,windowId:f}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime());s.$session_id=A,s.$window_id=f}this.sessionPropsManager&&bE(s,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&bE(s,this.sessionRecording.sdkDebugProperties),s.$sdk_debug_retry_queue_size=(p=this.Is)==null?void 0:p.length}catch(b){s.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===i5.CUSTOM&&(s.$lib_custom_api_host=this.config.api_host),c=e!=="$pageview"||a?e!=="$pageleave"||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),s=bE(s,c),e==="$pageview"&&YA&&(s.title=YA.title),!wu(o)){var v=n.getTime()-o;s.$duration=parseFloat((v/1e3).toFixed(3))}lB&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?"bot":"browser"),(s=bE({},u,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),qI(this.config.property_denylist)?zC(this.config.property_denylist,function(b){delete s[b]}):yd.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var B=this.config.sanitize_properties;B&&(yd.error("sanitize_properties is deprecated. Use before_send instead"),s=B(s,e));var x=this.Ds();return s.$process_person_profile=x,x&&!a&&this.Ls("_calculate_event_properties"),s}Os(e){var t;if(!this.persistence||!this.Ds()||this.gs)return e;var n=this.persistence.get_initial_props(),r=(t=this.sessionPropsManager)==null?void 0:t.getSetOnceProps(),a=bE({},n,r||{},e||{}),o=this.config.sanitize_properties;return o&&(yd.error("sanitize_properties is deprecated. Use before_send instead"),a=o(a,"$set_once")),this.gs=!0,kM(a)?void 0:a}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var r;(r=this.persistence)==null||r.register_once(e,t,n)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}js(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch{return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,n)}on(e,t){return this._s.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,n){if(!this.__loaded||!this.persistence)return yd.uninitializedWarning("posthog.identify");if(gx(e)&&(e=e.toString(),yd.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))yd.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.');else if(e!==O8){if(this.Ls("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var a=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:a},"")}e!==r&&e!==this.get_property(LR)&&(this.unregister(LR),this.register({distinct_id:e}));var o=(this.persistence.get_property(fQ)||"anonymous")==="anonymous";e!==r&&o?(this.persistence.set_property(fQ,"identified"),this.setPersonPropertiesForFlags(vA({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.Ss=Ape(e,t,n),this.featureFlags.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(F8))}}else yd.critical('The string "'+O8+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else yd.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.Ls("posthog.setPersonProperties")){var n=Ape(this.get_distinct_id(),e,t);this.Ss!==n?(this.setPersonPropertiesForFlags(vA({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Ss=n):yd.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,n){if(e&&t){if(this.Ls("posthog.group")){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:vA({},r,{[e]:t})}),n&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags({[e]:n})),r[e]===t||n||this.reloadFeatureFlags()}}else yd.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.Ls("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,n,r,a;if(yd.info("reset"),!this.__loaded)return yd.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),(r=this.persistence)==null||r.set_property(fQ,"anonymous"),(a=this.sessionManager)==null||a.resetSessionId(),this.Ss=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:O8,$device_id:null},"");else{var s=this.config.get_device_id(xw());this.register_once({distinct_id:s,$device_id:e?s:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&n){var a,o=(a=e.timestampLookBack)!==null&&a!==void 0?a:10;if(!n)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-o,0)}return r}alias(e,t){return e===this.get_property(Wfe)?(yd.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ls("posthog.alias")?(wu(t)&&(t=this.get_distinct_id()),e!==t?(this.js(LR,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(yd.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t,n,r,a,o=vA({},this.config);T1(e)&&(bE(this.config,Xpe(e)),(t=this.persistence)==null||t.update_config(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ZH(vA({},this.config,{persistence:"sessionStorage"})),VE.O()&&VE.D("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(AQ.DEBUG=!0,yd.info("set_config",{config:e,oldConfig:o,newConfig:vA({},this.config)})),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),(r=this.autocapture)==null||r.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),this.surveys.loadIfEnabled(),this.Ps())}startSessionRecording(e){var t=e===!0,n={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(n).some(Boolean)){var r,a,o,s,l;(r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),n.sampling&&((a=this.sessionRecording)==null||a.overrideSampling()),n.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),n.url_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger("url")),n.event_trigger&&((l=this.sessionRecording)==null||l.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.started)}captureException(e,t){var n=new Error("PostHog syntheticException");this.exceptions.sendExceptionEvent(vA({},Uqe((r=>r instanceof Error)(e)?{error:e,event:e.message}:{event:e},{syntheticException:n}),t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:WM;return t!==WM&&(t=WM+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(fQ))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(fQ))==="identified"}Ds(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&kM(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[LR])&&((t=this.persistence)==null||(t=t.props)==null||!t[L8]))}Fs(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Ds()||this.Ls("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Ls(e){return this.config.person_profiles==="never"?(yd.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.js(L8,!0),!0)}Ps(){var e,t,n,r,a=this.consent.isOptedOut(),o=this.config.opt_out_persistence_by_default,s=this.config.disable_persistence||a&&!!o;((e=this.persistence)==null?void 0:e.Fe)!==s&&((n=this.persistence)==null||n.set_disabled(s)),((t=this.sessionPersistence)==null?void 0:t.Fe)!==s&&((r=this.sessionPersistence)==null||r.set_disabled(s))}opt_in_capturing(e){var t;this.consent.optInOut(!0),this.Ps(),(wu(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((t=e==null?void 0:e.captureEventName)!==null&&t!==void 0?t:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Cs()}opt_out_capturing(){this.consent.optInOut(!1),this.Ps()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this.Ps()}_is_bot(){return PB?Jpe(PB,this.config.custom_blocked_useragents):void 0}Cs(){YA&&(YA.visibilityState==="visible"?this.bs||(this.bs=!0,this.capture("$pageview",{title:YA.title},{send_instantly:!0}),this.ys&&(YA.removeEventListener("visibilitychange",this.ys),this.ys=null)):this.ys||(this.ys=this.Cs.bind(this),d1(YA,"visibilitychange",this.ys)))}debug(e){e===!1?(Ka==null||Ka.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(Ka==null||Ka.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)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}I(){var e,t,n,r,a,o,s,l=this.$s||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(yd.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):(n="advanced_disable_decide",r=!1,a=yd,o=(t="advanced_disable_flags")in(e=l)&&!wu(e[t]),s=n in e&&!wu(e[n]),o?e[t]:s?(a&&a.warn("Config field '"+n+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[n]):r)}As(e){if(yv(this.config.before_send))return e;var t=qI(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var r of t){if(n=r(n),yv(n)){var a="Event '"+e.event+"' was rejected in beforeSend function";return KJe(e.event)?yd.warn(a+". This can cause unexpected behavior."):yd.info(a),null}n.properties&&!kM(n.properties)||yd.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return n}getPageViewId(){var e;return(e=this.pageViewManager.ce)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}}(function(i,e){for(var t=0;t<e.length;t++)i.prototype[e[t]]=JJe(i.prototype[e[t]])})(uU,["identify"]);var $pe,AU=($pe=r5[WM]=new uU,function(){function i(){i.done||(i.done=!0,Zpe=!1,zC(r5,function(e){e._dom_loaded()}))}YA!=null&&YA.addEventListener?YA.readyState==="complete"?i():d1(YA,"DOMContentLoaded",i,{capture:!1}):Ka&&yd.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),$pe);!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1")&&(AU.__loaded||AU.init("phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo",{api_host:"https://postpig.tscircuit.com",person_profiles:"always"}));function gI(...i){return OJe(dS(i))}const ege=i=>i.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),rWe=uJe,tge=It.forwardRef(({className:i,...e},t)=>ht.jsx(wfe,{ref:t,className:gI("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",i),...e}));tge.displayName=wfe.displayName;const XM=It.forwardRef(({className:i,...e},t)=>ht.jsx(Mfe,{ref:t,className:gI("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",i),...e}));XM.displayName=Mfe.displayName;const yS=It.forwardRef(({className:i,...e},t)=>ht.jsx(Dfe,{ref:t,className:gI("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",i),...e}));yS.displayName=Dfe.displayName;var Py;(function(i){i.assertEqual=r=>{};function e(r){}i.assertIs=e;function t(r){throw new Error}i.assertNever=t,i.arrayToEnum=r=>{const a={};for(const o of r)a[o]=o;return a},i.getValidEnumValues=r=>{const a=i.objectKeys(r).filter(s=>typeof r[r[s]]!="number"),o={};for(const s of a)o[s]=r[s];return i.objectValues(o)},i.objectValues=r=>i.objectKeys(r).map(function(a){return r[a]}),i.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const a=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&a.push(o);return a},i.find=(r,a)=>{for(const o of r)if(a(o))return o},i.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function n(r,a=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}i.joinValues=n,i.jsonStringifyReplacer=(r,a)=>typeof a=="bigint"?a.toString():a})(Py||(Py={}));var nge;(function(i){i.mergeShapes=(e,t)=>({...e,...t})})(nge||(nge={}));const VA=Py.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ww=i=>{switch(typeof i){case"undefined":return VA.undefined;case"string":return VA.string;case"number":return Number.isNaN(i)?VA.nan:VA.number;case"boolean":return VA.boolean;case"function":return VA.function;case"bigint":return VA.bigint;case"symbol":return VA.symbol;case"object":return Array.isArray(i)?VA.array:i===null?VA.null:i.then&&typeof i.then=="function"&&i.catch&&typeof i.catch=="function"?VA.promise:typeof Map<"u"&&i instanceof Map?VA.map:typeof Set<"u"&&i instanceof Set?VA.set:typeof Date<"u"&&i instanceof Date?VA.date:VA.object;default:return VA.unknown}},pl=Py.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"]);let vS=class hKe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},n={_errors:[]},r=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let s=n,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return r(this),n}static assert(e){if(!(e instanceof hKe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Py.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};vS.create=i=>new vS(i);const a5=(i,e)=>{let t;switch(i.code){case pl.invalid_type:i.received===VA.undefined?t="Required":t=`Expected ${i.expected}, received ${i.received}`;break;case pl.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(i.expected,Py.jsonStringifyReplacer)}`;break;case pl.unrecognized_keys:t=`Unrecognized key(s) in object: ${Py.joinValues(i.keys,", ")}`;break;case pl.invalid_union:t="Invalid input";break;case pl.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Py.joinValues(i.options)}`;break;case pl.invalid_enum_value:t=`Invalid enum value. Expected ${Py.joinValues(i.options)}, received '${i.received}'`;break;case pl.invalid_arguments:t="Invalid function arguments";break;case pl.invalid_return_type:t="Invalid function return type";break;case pl.invalid_date:t="Invalid date";break;case pl.invalid_string:typeof i.validation=="object"?"includes"in i.validation?(t=`Invalid input: must include "${i.validation.includes}"`,typeof i.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${i.validation.position}`)):"startsWith"in i.validation?t=`Invalid input: must start with "${i.validation.startsWith}"`:"endsWith"in i.validation?t=`Invalid input: must end with "${i.validation.endsWith}"`:Py.assertNever(i.validation):i.validation!=="regex"?t=`Invalid ${i.validation}`:t="Invalid";break;case pl.too_small:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at least":"more than"} ${i.minimum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at least":"over"} ${i.minimum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${i.minimum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(i.minimum))}`:t="Invalid input";break;case pl.too_big:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at most":"less than"} ${i.maximum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at most":"under"} ${i.maximum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="bigint"?t=`BigInt must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly":i.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(i.maximum))}`:t="Invalid input";break;case pl.custom:t="Invalid input";break;case pl.invalid_intersection_types:t="Intersection results could not be merged";break;case pl.not_multiple_of:t=`Number must be a multiple of ${i.multipleOf}`;break;case pl.not_finite:t="Number must be finite";break;default:t=e.defaultError,Py.assertNever(i)}return{message:t}};let aWe=a5;function tY(){return aWe}const nY=i=>{const{data:e,path:t,errorMaps:n,issueData:r}=i,a=[...t,...r.path||[]],o={...r,path:a};if(r.message!==void 0)return{...r,path:a,message:r.message};let s="";const l=n.filter(c=>!!c).slice().reverse();for(const c of l)s=c(o,{data:e,defaultError:s}).message;return{...r,path:a,message:s}};function Ou(i,e){const t=tY(),n=nY({issueData:e,data:i.data,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,t,t===a5?void 0:a5].filter(r=>!!r)});i.common.issues.push(n)}let FB=class pKe{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if(r.status==="aborted")return Kp;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const a=await r.key,o=await r.value;n.push({key:a,value:o})}return pKe.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:a,value:o}=r;if(a.status==="aborted"||o.status==="aborted")return Kp;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}};const Kp=Object.freeze({status:"aborted"}),o5=i=>({status:"dirty",value:i}),uB=i=>({status:"valid",value:i}),ige=i=>i.status==="aborted",rge=i=>i.status==="dirty",$M=i=>i.status==="valid",dU=i=>typeof Promise<"u"&&i instanceof Promise;var uf;(function(i){i.errToObj=e=>typeof e=="string"?{message:e}:e||{},i.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(uf||(uf={}));var fU=function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},age=function(i,e,t,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(i,t):r?r.value=t:e.set(i,t),t},s5,l5;let CS=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}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 oge=(i,e)=>{if($M(e))return{success:!0,data:e.value};if(!i.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new vS(i.common.issues);return this._error=t,this._error}}};function i0(i){if(!i)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:r}=i;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,s)=>{const{message:l}=i;return o.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:l??t??s.defaultError}},description:r}}let Bm=class{get description(){return this._def.description}_getType(e){return ww(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ww(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new FB,ctx:{common:e.parent.common,data:e.data,parsedType:ww(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(dU(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ww(e)},r=this._parseSync({data:e,path:n.path,parent:n});return oge(n,r)}"~validate"(e){var n,r;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ww(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return $M(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(r=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>$M(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ww(e)},r=this._parse({data:e,path:n.path,parent:n}),a=await(dU(r)?r:Promise.resolve(r));return oge(n,a)}refine(e,t){const n=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,a)=>{const o=e(r),s=()=>a.addIssue({code:pl.custom,...n(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new V9({schema:this,typeName:bp.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:t=>this["~validate"](t)}}optional(){return vQ.create(this,this._def)}nullable(){return K9.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return t3.create(this)}promise(){return u5.create(this,this._def)}or(e){return gU.create([this,e],this._def)}and(e){return mU.create(this,e,this._def)}transform(e){return new V9({...i0(this._def),schema:this,typeName:bp.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new CU({...i0(this._def),innerType:this,defaultValue:t,typeName:bp.ZodDefault})}brand(){return new mge({typeName:bp.ZodBranded,type:this,...i0(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new IU({...i0(this._def),innerType:this,catchValue:t,typeName:bp.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return DWe.create(this,e)}readonly(){return EU.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const oWe=/^c[^\s-]{8,}$/i,sWe=/^[0-9a-z]+$/,lWe=/^[0-9A-HJKMNP-TV-Z]{26}$/i,cWe=/^[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,uWe=/^[a-z0-9_-]{21}$/i,AWe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,dWe=/^[-+]?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)?)??$/,fWe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,hWe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let iY;const pWe=/^(?:(?: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])$/,gWe=/^(?:(?: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])$/,mWe=/^(([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]))$/,yWe=/^(([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])$/,vWe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,CWe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,sge="((\\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])))",IWe=new RegExp(`^${sge}$`);function lge(i){let e="[0-5]\\d";i.precision?e=`${e}\\.\\d{${i.precision}}`:i.precision==null&&(e=`${e}(\\.\\d+)?`);const t=i.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function EWe(i){return new RegExp(`^${lge(i)}$`)}function _We(i){let e=`${sge}T${lge(i)}`;const t=[];return t.push(i.local?"Z?":"Z"),i.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function xWe(i,e){return!!((e==="v4"||!e)&&pWe.test(i)||(e==="v6"||!e)&&mWe.test(i))}function BWe(i,e){if(!AWe.test(i))return!1;try{const[t]=i.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(n));return!(typeof r!="object"||r===null||"typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function bWe(i,e){return!!((e==="v4"||!e)&&gWe.test(i)||(e==="v6"||!e)&&yWe.test(i))}let hU=class y8 extends Bm{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==VA.string){const a=this._getOrReturnCtx(e);return Ou(a,{code:pl.invalid_type,expected:VA.string,received:a.parsedType}),Kp}const n=new FB;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(r=this._getOrReturnCtx(e,r),o?Ou(r,{code:pl.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&Ou(r,{code:pl.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")fWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"email",code:pl.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")iY||(iY=new RegExp(hWe,"u")),iY.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"emoji",code:pl.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")cWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"uuid",code:pl.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")uWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"nanoid",code:pl.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")oWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"cuid",code:pl.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")sWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"cuid2",code:pl.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")lWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"ulid",code:pl.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),Ou(r,{validation:"url",code:pl.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"regex",code:pl.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?_We(a).test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?IWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?EWe(a).test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?dWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"duration",code:pl.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?xWe(e.data,a.version)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"ip",code:pl.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?BWe(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"jwt",code:pl.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?bWe(e.data,a.version)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"cidr",code:pl.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?vWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"base64",code:pl.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?CWe.test(e.data)||(r=this._getOrReturnCtx(e,r),Ou(r,{validation:"base64url",code:pl.invalid_string,message:a.message}),n.dirty()):Py.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(r=>e.test(r),{validation:t,code:pl.invalid_string,...uf.errToObj(n)})}_addCheck(e){return new y8({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...uf.errToObj(e)})}url(e){return this._addCheck({kind:"url",...uf.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...uf.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...uf.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...uf.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...uf.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...uf.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...uf.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...uf.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...uf.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...uf.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...uf.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...uf.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==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...uf.errToObj(e==null?void 0: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==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...uf.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...uf.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...uf.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...uf.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...uf.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...uf.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...uf.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...uf.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...uf.errToObj(t)})}nonempty(e){return this.min(1,uf.errToObj(e))}trim(){return new y8({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new y8({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new y8({...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 t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};hU.create=i=>new hU({checks:[],typeName:bp.ZodString,coerce:(i==null?void 0:i.coerce)??!1,...i0(i)});function SWe(i,e){const t=(i.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=t>n?t:n,a=Number.parseInt(i.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return a%o/10**r}let rY=class Sde extends Bm{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)!==VA.number){const a=this._getOrReturnCtx(e);return Ou(a,{code:pl.invalid_type,expected:VA.number,received:a.parsedType}),Kp}let n;const r=new FB;for(const a of this._def.checks)a.kind==="int"?Py.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?SWe(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.not_finite,message:a.message}),r.dirty()):Py.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,uf.toString(t))}gt(e,t){return this.setLimit("min",e,!1,uf.toString(t))}lte(e,t){return this.setLimit("max",e,!0,uf.toString(t))}lt(e,t){return this.setLimit("max",e,!1,uf.toString(t))}setLimit(e,t,n,r){return new Sde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:uf.toString(r)}]})}_addCheck(e){return new Sde({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:uf.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:uf.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:uf.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:uf.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:uf.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:uf.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:uf.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:uf.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:uf.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Py.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};rY.create=i=>new rY({checks:[],typeName:bp.ZodNumber,coerce:(i==null?void 0:i.coerce)||!1,...i0(i)});let cge=class Qde extends Bm{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)!==VA.bigint)return this._getInvalidInput(e);let n;const r=new FB;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Ou(n,{code:pl.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):Py.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ou(t,{code:pl.invalid_type,expected:VA.bigint,received:t.parsedType}),Kp}gte(e,t){return this.setLimit("min",e,!0,uf.toString(t))}gt(e,t){return this.setLimit("min",e,!1,uf.toString(t))}lte(e,t){return this.setLimit("max",e,!0,uf.toString(t))}lt(e,t){return this.setLimit("max",e,!1,uf.toString(t))}setLimit(e,t,n,r){return new Qde({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:uf.toString(r)}]})}_addCheck(e){return new Qde({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:uf.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:uf.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:uf.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:uf.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:uf.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};cge.create=i=>new cge({checks:[],typeName:bp.ZodBigInt,coerce:(i==null?void 0:i.coerce)??!1,...i0(i)});let aY=class extends Bm{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==VA.boolean){const n=this._getOrReturnCtx(e);return Ou(n,{code:pl.invalid_type,expected:VA.boolean,received:n.parsedType}),Kp}return uB(e.data)}};aY.create=i=>new aY({typeName:bp.ZodBoolean,coerce:(i==null?void 0:i.coerce)||!1,...i0(i)});let uge=class gKe extends Bm{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==VA.date){const a=this._getOrReturnCtx(e);return Ou(a,{code:pl.invalid_type,expected:VA.date,received:a.parsedType}),Kp}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return Ou(a,{code:pl.invalid_date}),Kp}const n=new FB;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),Ou(r,{code:pl.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Py.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new gKe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:uf.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:uf.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};uge.create=i=>new uge({checks:[],coerce:(i==null?void 0:i.coerce)||!1,typeName:bp.ZodDate,...i0(i)});let Age=class extends Bm{_parse(e){if(this._getType(e)!==VA.symbol){const n=this._getOrReturnCtx(e);return Ou(n,{code:pl.invalid_type,expected:VA.symbol,received:n.parsedType}),Kp}return uB(e.data)}};Age.create=i=>new Age({typeName:bp.ZodSymbol,...i0(i)});let oY=class extends Bm{_parse(e){if(this._getType(e)!==VA.undefined){const n=this._getOrReturnCtx(e);return Ou(n,{code:pl.invalid_type,expected:VA.undefined,received:n.parsedType}),Kp}return uB(e.data)}};oY.create=i=>new oY({typeName:bp.ZodUndefined,...i0(i)});let pU=class extends Bm{_parse(e){if(this._getType(e)!==VA.null){const n=this._getOrReturnCtx(e);return Ou(n,{code:pl.invalid_type,expected:VA.null,received:n.parsedType}),Kp}return uB(e.data)}};pU.create=i=>new pU({typeName:bp.ZodNull,...i0(i)});let c5=class extends Bm{constructor(){super(...arguments),this._any=!0}_parse(e){return uB(e.data)}};c5.create=i=>new c5({typeName:bp.ZodAny,...i0(i)});let e3=class extends Bm{constructor(){super(...arguments),this._unknown=!0}_parse(e){return uB(e.data)}};e3.create=i=>new e3({typeName:bp.ZodUnknown,...i0(i)});let Mw=class extends Bm{_parse(e){const t=this._getOrReturnCtx(e);return Ou(t,{code:pl.invalid_type,expected:VA.never,received:t.parsedType}),Kp}};Mw.create=i=>new Mw({typeName:bp.ZodNever,...i0(i)});let dge=class extends Bm{_parse(e){if(this._getType(e)!==VA.undefined){const n=this._getOrReturnCtx(e);return Ou(n,{code:pl.invalid_type,expected:VA.void,received:n.parsedType}),Kp}return uB(e.data)}};dge.create=i=>new dge({typeName:bp.ZodVoid,...i0(i)});let t3=class Qz extends Bm{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==VA.array)return Ou(t,{code:pl.invalid_type,expected:VA.array,received:t.parsedType}),Kp;if(r.exactLength!==null){const o=t.data.length>r.exactLength.value,s=t.data.length<r.exactLength.value;(o||s)&&(Ou(t,{code:o?pl.too_big:pl.too_small,minimum:s?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(Ou(t,{code:pl.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(Ou(t,{code:pl.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,s)=>r.type._parseAsync(new CS(t,o,t.path,s)))).then(o=>FB.mergeArray(n,o));const a=[...t.data].map((o,s)=>r.type._parseSync(new CS(t,o,t.path,s)));return FB.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Qz({...this._def,minLength:{value:e,message:uf.toString(t)}})}max(e,t){return new Qz({...this._def,maxLength:{value:e,message:uf.toString(t)}})}length(e,t){return new Qz({...this._def,exactLength:{value:e,message:uf.toString(t)}})}nonempty(e){return this.min(1,e)}};t3.create=(i,e)=>new t3({type:i,minLength:null,maxLength:null,exactLength:null,typeName:bp.ZodArray,...i0(e)});function n3(i){if(i instanceof mQ){const e={};for(const t in i.shape){const n=i.shape[t];e[t]=vQ.create(n3(n))}return new mQ({...i._def,shape:()=>e})}else return i instanceof t3?new t3({...i._def,type:n3(i.element)}):i instanceof vQ?vQ.create(n3(i.unwrap())):i instanceof K9?K9.create(n3(i.unwrap())):i instanceof Y9?Y9.create(i.items.map(e=>n3(e))):i}let mQ=class lS extends Bm{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(),t=Py.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==VA.object){const c=this._getOrReturnCtx(e);return Ou(c,{code:pl.invalid_type,expected:VA.object,received:c.parsedType}),Kp}const{status:n,ctx:r}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof Mw&&this._def.unknownKeys==="strip"))for(const c in r.data)o.includes(c)||s.push(c);const l=[];for(const c of o){const u=a[c],A=r.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new CS(r,A,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof Mw){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(c==="strict")s.length>0&&(Ou(r,{code:pl.unrecognized_keys,keys:s}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of s){const A=r.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new CS(r,A,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const A=await u.key,f=await u.value;c.push({key:A,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>FB.mergeObjectSync(n,c)):FB.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return uf.errToObj,new lS({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var a,o;const r=((o=(a=this._def).errorMap)==null?void 0:o.call(a,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:uf.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new lS({...this._def,unknownKeys:"strip"})}passthrough(){return new lS({...this._def,unknownKeys:"passthrough"})}extend(e){return new lS({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new lS({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:bp.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new lS({...this._def,catchall:e})}pick(e){const t={};for(const n of Py.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new lS({...this._def,shape:()=>t})}omit(e){const t={};for(const n of Py.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new lS({...this._def,shape:()=>t})}deepPartial(){return n3(this)}partial(e){const t={};for(const n of Py.objectKeys(this.shape)){const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new lS({...this._def,shape:()=>t})}required(e){const t={};for(const n of Py.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof vQ;)a=a._def.innerType;t[n]=a}return new lS({...this._def,shape:()=>t})}keyof(){return pge(Py.objectKeys(this.shape))}};mQ.create=(i,e)=>new mQ({shape:()=>i,unknownKeys:"strip",catchall:Mw.create(),typeName:bp.ZodObject,...i0(e)}),mQ.strictCreate=(i,e)=>new mQ({shape:()=>i,unknownKeys:"strict",catchall:Mw.create(),typeName:bp.ZodObject,...i0(e)}),mQ.lazycreate=(i,e)=>new mQ({shape:i,unknownKeys:"strip",catchall:Mw.create(),typeName:bp.ZodObject,...i0(e)});let gU=class extends Bm{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function r(a){for(const s of a)if(s.result.status==="valid")return s.result;for(const s of a)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;const o=a.map(s=>new vS(s.ctx.common.issues));return Ou(t,{code:pl.invalid_union,unionErrors:o}),Kp}if(t.common.async)return Promise.all(n.map(async a=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(r);{let a;const o=[];for(const l of n){const c={...t,common:{...t.common,issues:[]},parent:null},u=l._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!a&&(a={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const s=o.map(l=>new vS(l));return Ou(t,{code:pl.invalid_union,unionErrors:s}),Kp}}get options(){return this._def.options}};gU.create=(i,e)=>new gU({options:i,typeName:bp.ZodUnion,...i0(e)});const yQ=i=>i instanceof lY?yQ(i.schema):i instanceof V9?yQ(i.innerType()):i instanceof yU?[i.value]:i instanceof vU?i.options:i instanceof cY?Py.objectValues(i.enum):i instanceof CU?yQ(i._def.innerType):i instanceof oY?[void 0]:i instanceof pU?[null]:i instanceof vQ?[void 0,...yQ(i.unwrap())]:i instanceof K9?[null,...yQ(i.unwrap())]:i instanceof mge||i instanceof EU?yQ(i.unwrap()):i instanceof IU?yQ(i._def.innerType):[];let QWe=class mKe extends Bm{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==VA.object)return Ou(t,{code:pl.invalid_type,expected:VA.object,received:t.parsedType}),Kp;const n=this.discriminator,r=t.data[n],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(Ou(t,{code:pl.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Kp)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const a of t){const o=yQ(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of o){if(r.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);r.set(s,a)}}return new mKe({typeName:bp.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...i0(n)})}};function sY(i,e){const t=ww(i),n=ww(e);if(i===e)return{valid:!0,data:i};if(t===VA.object&&n===VA.object){const r=Py.objectKeys(e),a=Py.objectKeys(i).filter(s=>r.indexOf(s)!==-1),o={...i,...e};for(const s of a){const l=sY(i[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(t===VA.array&&n===VA.array){if(i.length!==e.length)return{valid:!1};const r=[];for(let a=0;a<i.length;a++){const o=i[a],s=e[a],l=sY(o,s);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return t===VA.date&&n===VA.date&&+i==+e?{valid:!0,data:i}:{valid:!1}}let mU=class extends Bm{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(a,o)=>{if(ige(a)||ige(o))return Kp;const s=sY(a.value,o.value);return s.valid?((rge(a)||rge(o))&&t.dirty(),{status:t.value,value:s.data}):(Ou(n,{code:pl.invalid_intersection_types}),Kp)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>r(a,o)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};mU.create=(i,e,t)=>new mU({left:i,right:e,typeName:bp.ZodIntersection,...i0(t)});let Y9=class yKe extends Bm{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==VA.array)return Ou(n,{code:pl.invalid_type,expected:VA.array,received:n.parsedType}),Kp;if(n.data.length<this._def.items.length)return Ou(n,{code:pl.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Kp;!this._def.rest&&n.data.length>this._def.items.length&&(Ou(n,{code:pl.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((o,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new CS(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>FB.mergeArray(t,o)):FB.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new yKe({...this._def,rest:e})}};Y9.create=(i,e)=>{if(!Array.isArray(i))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Y9({items:i,typeName:bp.ZodTuple,rest:null,...i0(e)})};let wWe=class wde extends Bm{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==VA.object)return Ou(n,{code:pl.invalid_type,expected:VA.object,received:n.parsedType}),Kp;const r=[],a=this._def.keyType,o=this._def.valueType;for(const s in n.data)r.push({key:a._parse(new CS(n,s,n.path,s)),value:o._parse(new CS(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?FB.mergeObjectAsync(t,r):FB.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof Bm?new wde({keyType:e,valueType:t,typeName:bp.ZodRecord,...i0(n)}):new wde({keyType:hU.create(),valueType:e,typeName:bp.ZodRecord,...i0(t)})}},fge=class extends Bm{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==VA.map)return Ou(n,{code:pl.invalid_type,expected:VA.map,received:n.parsedType}),Kp;const r=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,l],c)=>({key:r._parse(new CS(n,s,n.path,[c,"key"])),value:a._parse(new CS(n,l,n.path,[c,"value"]))}));if(n.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Kp;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),s.set(c.value,u.value)}return{status:t.value,value:s}})}else{const s=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Kp;(c.status==="dirty"||u.status==="dirty")&&t.dirty(),s.set(c.value,u.value)}return{status:t.value,value:s}}}};fge.create=(i,e,t)=>new fge({valueType:e,keyType:i,typeName:bp.ZodMap,...i0(t)});let hge=class Mde extends Bm{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==VA.set)return Ou(n,{code:pl.invalid_type,expected:VA.set,received:n.parsedType}),Kp;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(Ou(n,{code:pl.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(Ou(n,{code:pl.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Kp;u.status==="dirty"&&t.dirty(),c.add(u.value)}return{status:t.value,value:c}}const s=[...n.data.values()].map((l,c)=>a._parse(new CS(n,l,n.path,c)));return n.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,t){return new Mde({...this._def,minSize:{value:e,message:uf.toString(t)}})}max(e,t){return new Mde({...this._def,maxSize:{value:e,message:uf.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};hge.create=(i,e)=>new hge({valueType:i,minSize:null,maxSize:null,typeName:bp.ZodSet,...i0(e)});let MWe=class wz extends Bm{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==VA.function)return Ou(t,{code:pl.invalid_type,expected:VA.function,received:t.parsedType}),Kp;function n(s,l){return nY({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,tY(),a5].filter(c=>!!c),issueData:{code:pl.invalid_arguments,argumentsError:l}})}function r(s,l){return nY({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,tY(),a5].filter(c=>!!c),issueData:{code:pl.invalid_return_type,returnTypeError:l}})}const a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof u5){const s=this;return uB(async function(...l){const c=new vS([]),u=await s._def.args.parseAsync(l,a).catch(p=>{throw c.addIssue(n(l,p)),c}),A=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(A,a).catch(p=>{throw c.addIssue(r(A,p)),c})})}else{const s=this;return uB(function(...l){const c=s._def.args.safeParse(l,a);if(!c.success)throw new vS([n(l,c.error)]);const u=Reflect.apply(o,this,c.data),A=s._def.returns.safeParse(u,a);if(!A.success)throw new vS([r(u,A.error)]);return A.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new wz({...this._def,args:Y9.create(e).rest(e3.create())})}returns(e){return new wz({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new wz({args:e||Y9.create([]).rest(e3.create()),returns:t||e3.create(),typeName:bp.ZodFunction,...i0(n)})}},lY=class extends Bm{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};lY.create=(i,e)=>new lY({getter:i,typeName:bp.ZodLazy,...i0(e)});let yU=class extends Bm{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ou(t,{received:t.data,code:pl.invalid_literal,expected:this._def.value}),Kp}return{status:"valid",value:e.data}}get value(){return this._def.value}};yU.create=(i,e)=>new yU({value:i,typeName:bp.ZodLiteral,...i0(e)});function pge(i,e){return new vU({values:i,typeName:bp.ZodEnum,...i0(e)})}let vU=class Dde extends Bm{constructor(){super(...arguments),s5.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return Ou(t,{expected:Py.joinValues(n),received:t.parsedType,code:pl.invalid_type}),Kp}if(fU(this,s5,"f")||age(this,s5,new Set(this._def.values),"f"),!fU(this,s5,"f").has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return Ou(t,{received:t.data,code:pl.invalid_enum_value,options:n}),Kp}return uB(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Dde.create(e,{...this._def,...t})}exclude(e,t=this._def){return Dde.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};s5=new WeakMap,vU.create=pge;let cY=class extends Bm{constructor(){super(...arguments),l5.set(this,void 0)}_parse(e){const t=Py.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==VA.string&&n.parsedType!==VA.number){const r=Py.objectValues(t);return Ou(n,{expected:Py.joinValues(r),received:n.parsedType,code:pl.invalid_type}),Kp}if(fU(this,l5,"f")||age(this,l5,new Set(Py.getValidEnumValues(this._def.values)),"f"),!fU(this,l5,"f").has(e.data)){const r=Py.objectValues(t);return Ou(n,{received:n.data,code:pl.invalid_enum_value,options:r}),Kp}return uB(e.data)}get enum(){return this._def.values}};l5=new WeakMap,cY.create=(i,e)=>new cY({values:i,typeName:bp.ZodNativeEnum,...i0(e)});let u5=class extends Bm{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==VA.promise&&t.common.async===!1)return Ou(t,{code:pl.invalid_type,expected:VA.promise,received:t.parsedType}),Kp;const n=t.parsedType===VA.promise?t.data:Promise.resolve(t.data);return uB(n.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};u5.create=(i,e)=>new u5({type:i,typeName:bp.ZodPromise,...i0(e)});let V9=class extends Bm{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===bp.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:o=>{Ou(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const o=r.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(t.value==="aborted")return Kp;const l=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?Kp:l.status==="dirty"||t.value==="dirty"?o5(l.value):l});{if(t.value==="aborted")return Kp;const s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?Kp:s.status==="dirty"||t.value==="dirty"?o5(s.value):s}}if(r.type==="refinement"){const o=s=>{const l=r.refinement(s,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Kp:(s.status==="dirty"&&t.dirty(),o(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?Kp:(s.status==="dirty"&&t.dirty(),o(s.value).then(()=>({status:t.value,value:s.value}))))}if(r.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!$M(o))return o;const s=r.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>$M(o)?Promise.resolve(r.transform(o.value,a)).then(s=>({status:t.value,value:s})):o);Py.assertNever(r)}};V9.create=(i,e,t)=>new V9({schema:i,typeName:bp.ZodEffects,effect:e,...i0(t)}),V9.createWithPreprocess=(i,e,t)=>new V9({schema:e,effect:{type:"preprocess",transform:i},typeName:bp.ZodEffects,...i0(t)});let vQ=class extends Bm{_parse(e){return this._getType(e)===VA.undefined?uB(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};vQ.create=(i,e)=>new vQ({innerType:i,typeName:bp.ZodOptional,...i0(e)});let K9=class extends Bm{_parse(e){return this._getType(e)===VA.null?uB(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};K9.create=(i,e)=>new K9({innerType:i,typeName:bp.ZodNullable,...i0(e)});let CU=class extends Bm{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===VA.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};CU.create=(i,e)=>new CU({innerType:i,typeName:bp.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...i0(e)});let IU=class extends Bm{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return dU(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new vS(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new vS(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};IU.create=(i,e)=>new IU({innerType:i,typeName:bp.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...i0(e)});let gge=class extends Bm{_parse(e){if(this._getType(e)!==VA.nan){const n=this._getOrReturnCtx(e);return Ou(n,{code:pl.invalid_type,expected:VA.nan,received:n.parsedType}),Kp}return{status:"valid",value:e.data}}};gge.create=i=>new gge({typeName:bp.ZodNaN,...i0(i)});let mge=class extends Bm{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},DWe=class vKe extends Bm{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Kp:a.status==="dirty"?(t.dirty(),o5(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?Kp:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new vKe({in:e,out:t,typeName:bp.ZodPipeline})}},EU=class extends Bm{_parse(e){const t=this._def.innerType._parse(e),n=r=>($M(r)&&(r.value=Object.freeze(r.value)),r);return dU(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}};EU.create=(i,e)=>new EU({innerType:i,typeName:bp.ZodReadonly,...i0(e)});function yge(i,e){const t=typeof i=="function"?i(e):typeof i=="string"?{message:i}:i;return typeof t=="string"?{message:t}:t}function IS(i,e={},t){return i?c5.create().superRefine((n,r)=>{const a=i(n);if(a instanceof Promise)return a.then(o=>{if(!o){const s=yge(e,n),l=s.fatal??t??!0;r.addIssue({code:"custom",...s,fatal:l})}});if(!a){const o=yge(e,n),s=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:s})}}):c5.create()}var bp;(function(i){i.ZodString="ZodString",i.ZodNumber="ZodNumber",i.ZodNaN="ZodNaN",i.ZodBigInt="ZodBigInt",i.ZodBoolean="ZodBoolean",i.ZodDate="ZodDate",i.ZodSymbol="ZodSymbol",i.ZodUndefined="ZodUndefined",i.ZodNull="ZodNull",i.ZodAny="ZodAny",i.ZodUnknown="ZodUnknown",i.ZodNever="ZodNever",i.ZodVoid="ZodVoid",i.ZodArray="ZodArray",i.ZodObject="ZodObject",i.ZodUnion="ZodUnion",i.ZodDiscriminatedUnion="ZodDiscriminatedUnion",i.ZodIntersection="ZodIntersection",i.ZodTuple="ZodTuple",i.ZodRecord="ZodRecord",i.ZodMap="ZodMap",i.ZodSet="ZodSet",i.ZodFunction="ZodFunction",i.ZodLazy="ZodLazy",i.ZodLiteral="ZodLiteral",i.ZodEnum="ZodEnum",i.ZodEffects="ZodEffects",i.ZodNativeEnum="ZodNativeEnum",i.ZodOptional="ZodOptional",i.ZodNullable="ZodNullable",i.ZodDefault="ZodDefault",i.ZodCatch="ZodCatch",i.ZodPromise="ZodPromise",i.ZodBranded="ZodBranded",i.ZodPipeline="ZodPipeline",i.ZodReadonly="ZodReadonly"})(bp||(bp={}));const nt=hU.create,mr=rY.create,Jl=aY.create,RWe=pU.create,cb=c5.create;e3.create,Mw.create;const ao=t3.create,Si=mQ.create,_0=gU.create,Dw=QWe.create;mU.create,Y9.create;const SE=wWe.create,NWe=MWe.create,di=yU.create,Ec=vU.create,TWe=u5.create;vQ.create,K9.create;const UWe="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let uY=(i=21)=>{let e="",t=crypto.getRandomValues(new Uint8Array(i|=0));for(;i--;)e+=UWe[t[i]&63];return e};var vge={Hz:{baseUnit:"Hz",variants:{MHz:1e6,kHz:1e3,Hz:1}},g:{baseUnit:"g",variants:{kg:1e3,g:1}},Ω:{baseUnit:"Ω",variants:{mΩ:.001,Ω:1,kΩ:1e3,KΩ:1e3,kohm:1e3,MΩ:1e6,GΩ:1e9,TΩ: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,mA:.001,ma:.001,A:1,kA:1e3,MA:1e6}},F:{baseUnit:"F",variants:{pF:1e-12,nF:1e-9,µF:1e-6,uF:1e-6,mF:.001,F:1}},ml:{baseUnit:"ml",variants:{ml:1,mL:1,l:1e3,L:1e3}},deg:{baseUnit:"deg",variants:{rad:180/Math.PI}},ms:{baseUnit:"ms",variants:{s:1e3}},mm:{baseUnit:"mm",variants:{nm:1e-6,µ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}}},AY=new Set;for(const[i,e]of Object.entries(vge)){AY.add(i);for(const t of Object.keys(e.variants))AY.add(t)}function PWe(i){for(const[e,t]of Object.entries(vge))if(i in t.variants)return{baseUnit:t.baseUnit,conversionFactor:t.variants[i]};return{baseUnit:i,conversionFactor:1}}var Cge={tera:1e12,T:1e12,giga:1e9,G:1e9,mega:1e6,M:1e6,kilo:1e3,k:1e3,deci:.1,d:.1,centi:.01,c:.01,milli:.001,m:.001,micro:1e-6,u:1e-6,µ:1e-6,nano:1e-9,n:1e-9,pico:1e-12,p:1e-12},Gb=i=>{var s;if(typeof i>"u")return{parsedUnit:null,unitOfValue:null,value:null};if(typeof i=="string"&&i.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(i),parsedUnit:null,unitOfValue:null};if(typeof i=="number")return{value:i,parsedUnit:null,unitOfValue:null};if(typeof i=="object"&&"x"in i&&"y"in i){const{parsedUnit:l,unitOfValue:c}=Gb(i.x);return{parsedUnit:l,unitOfValue:c,value:{x:Gb(i.x).value,y:Gb(i.y).value}}}const t=(s=i.toString().split("").reverse().join("").match(/[^\d\s]+/))==null?void 0:s[0];if(!t)throw new Error(`Could not determine unit: "${i}"`);const n=t.split("").reverse().join(""),r=i.slice(0,-n.length);if(n in Cge&&!AY.has(n)){const l=Cge[n];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(r)*l}}const{baseUnit:a,conversionFactor:o}=PWe(n);return{parsedUnit:n,unitOfValue:a,value:o*Number.parseFloat(r)}},i3=nt().or(mr()).transform(i=>Gb(i).value),r3=nt().or(mr()).transform(i=>Gb(i).value).transform(i=>Number.parseFloat(i.toPrecision(12))),dY=nt().or(mr()).transform(i=>Gb(i).value),a3=nt().or(mr()).transform(i=>Gb(i).value),gn=nt().or(mr()).transform(i=>Gb(i).value),_U=nt().or(mr()).transform(i=>Gb(i).value),sr=gn,GWe=nt().or(mr()).transform(i=>Gb(i).value),FWe=nt().or(mr()).transform(i=>Gb(i).value),Cx=nt().or(mr()).transform(i=>typeof i=="number"?i:i.endsWith("deg")?Number.parseFloat(i.split("deg")[0]):i.endsWith("rad")?Number.parseFloat(i.split("rad")[0])*180/Math.PI:Number.parseFloat(i)),Ige=mr().or(nt().endsWith("mAh")).transform(i=>{if(typeof i=="string"){const e=i.replace("mAh",""),t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error("Invalid capacity");return t}return i}).describe("Battery capacity in mAh"),Hm=Si({x:sr,y:sr}),kWe=Hm,j9=Si({x:sr,y:sr,z:sr}),LWe=j9,fY=Si({width:mr(),height:mr()}),ap=i=>nt().optional().default(()=>`${i}_${uY(10)}`),hY=Ec(["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"]),xU=Ec(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),jE=Si({type:di("source_component"),ftype:nt().optional(),source_component_id:nt(),name:nt(),manufacturer_part_number:nt().optional(),supplier_part_numbers:SE(xU,ao(nt())).optional(),display_value:nt().optional(),are_pins_interchangeable:Jl().optional(),internally_connected_source_port_ids:ao(ao(nt())).optional(),source_group_id:nt().optional(),subcircuit_id:nt().optional()}),pY=jE.extend({ftype:di("simple_capacitor"),capacitance:r3,max_voltage_rating:a3.optional(),display_capacitance:nt().optional(),max_decoupling_trace_length:sr.optional()}),gY=jE.extend({ftype:di("simple_resistor"),resistance:i3,display_resistance:nt().optional()}),BU=jE.extend({ftype:di("simple_diode")}),mY=BU.extend({ftype:di("simple_led"),color:nt().optional(),wavelength:nt().optional()}),Ege=jE.extend({ftype:di("simple_ground")}),yY=jE.extend({ftype:di("simple_chip")}),vY=jE.extend({ftype:di("simple_power_source"),voltage:a3}),OWe=jE.extend({ftype:di("simple_fuse"),current_rating_amps:mr().describe("Nominal current in amps the fuse is rated for"),voltage_rating_volts:mr().describe("Voltage rating in volts, e.g. ±5V would be 5")}),CY=jE.extend({ftype:di("simple_battery"),capacity:Ige}),IY=jE.extend({ftype:di("simple_inductor"),inductance:dY,max_current_rating:mr().optional()}),EY=jE.extend({ftype:di("simple_push_button")}),_Y=jE.extend({ftype:di("simple_potentiometer"),max_resistance:i3}),_ge=jE.extend({ftype:di("simple_crystal"),frequency:mr().describe("Frequency in Hz"),load_capacitance:mr().optional().describe("Load capacitance in pF")}),xY=jE.extend({ftype:di("simple_pin_header"),pin_count:mr(),gender:Ec(["male","female"]).optional().default("male")}),BY=jE.extend({ftype:di("simple_resonator"),load_capacitance:r3,equivalent_series_resistance:i3.optional(),frequency:_U}),bY=jE.extend({ftype:di("simple_transistor"),transistor_type:Ec(["npn","pnp"])}),SY=jE.extend({ftype:di("simple_test_point"),footprint_variant:Ec(["pad","through_hole"]).optional(),pad_shape:Ec(["rect","circle"]).optional(),pad_diameter:_0([mr(),nt()]).optional(),hole_diameter:_0([mr(),nt()]).optional(),width:_0([mr(),nt()]).optional(),height:_0([mr(),nt()]).optional()}),QY=jE.extend({ftype:di("simple_mosfet"),channel_type:Ec(["n","p"]),mosfet_mode:Ec(["enhancement","depletion"])}),wY=jE.extend({ftype:di("simple_switch")}),MY=Si({type:di("source_project_metadata"),name:nt().optional(),software_used_string:nt().optional(),project_url:nt().optional(),created_at:nt().datetime().optional()}),xge=Si({type:di("source_missing_property_error"),source_missing_property_error_id:ap("source_missing_property_error"),source_component_id:nt(),property_name:nt(),subcircuit_id:nt().optional(),error_type:di("source_missing_property_error").default("source_missing_property_error"),message:nt()}).describe("The source code is missing a property"),Bge=Si({type:di("source_failed_to_create_component_error"),source_failed_to_create_component_error_id:ap("source_failed_to_create_component_error"),error_type:di("source_failed_to_create_component_error").default("source_failed_to_create_component_error"),component_name:nt().optional(),subcircuit_id:nt().optional(),parent_source_component_id:nt().optional(),message:nt(),pcb_center:Si({x:mr().optional(),y:mr().optional()}).optional(),schematic_center:Si({x:mr().optional(),y:mr().optional()}).optional()}).describe("Error emitted when a component fails to be constructed"),bge=_0([gY,pY,BU,mY,Ege,yY,vY,CY,IY,EY,_Y,_ge,xY,BY,wY,bY,SY,QY,OWe,MY,xge,Bge]),Sge=Si({type:di("source_port"),pin_number:mr().optional(),port_hints:ao(nt()).optional(),name:nt(),source_port_id:nt(),source_component_id:nt(),subcircuit_id:nt().optional(),subcircuit_connectivity_map_key:nt().optional()}),Qge=Si({type:di("source_trace"),source_trace_id:nt(),connected_source_port_ids:ao(nt()),connected_source_net_ids:ao(nt()),subcircuit_id:nt().optional(),subcircuit_connectivity_map_key:nt().optional(),max_length:mr().optional(),min_trace_thickness:mr().optional(),display_name:nt().optional()}),wge=Si({type:di("source_group"),source_group_id:nt(),subcircuit_id:nt().optional(),parent_subcircuit_id:nt().optional(),is_subcircuit:Jl().optional(),name:nt().optional()}),Mge=Si({type:di("source_net"),source_net_id:nt(),name:nt(),member_source_group_ids:ao(nt()),is_power:Jl().optional(),is_ground:Jl().optional(),is_digital_signal:Jl().optional(),is_analog_signal:Jl().optional(),trace_width:mr().optional(),subcircuit_id:nt().optional(),subcircuit_connectivity_map_key:nt().optional()}),Dge=Si({type:di("source_pcb_ground_plane"),source_pcb_ground_plane_id:nt(),source_group_id:nt(),source_net_id:nt(),subcircuit_id:nt().optional()}).describe("Defines a ground plane in the source domain"),Rge=Si({type:di("schematic_box"),schematic_component_id:nt().optional(),width:sr,height:sr,is_dashed:Jl().default(!1),x:sr,y:sr,subcircuit_id:nt().optional()}).describe("Draws a box on the schematic"),Nge=Si({type:di("schematic_path"),schematic_component_id:nt(),fill_color:Ec(["red","blue"]).optional(),is_filled:Jl().optional(),points:ao(Hm),subcircuit_id:nt().optional()}),Tge=SE(Si({left_margin:gn.optional(),right_margin:gn.optional(),top_margin:gn.optional(),bottom_margin:gn.optional()})),Uge=Si({left_size:mr(),right_size:mr(),top_size:mr().optional(),bottom_size:mr().optional()}),Pge=Si({left_side:Si({pins:ao(mr()),direction:Ec(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:Si({pins:ao(mr()),direction:Ec(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:Si({pins:ao(mr()),direction:Ec(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:Si({pins:ao(mr()),direction:Ec(["left-to-right","right-to-left"]).optional()}).optional()}),Gge=_0([Uge,Pge]),Fge=Si({type:di("schematic_component"),size:fY,center:Hm,source_component_id:nt(),schematic_component_id:nt(),pin_spacing:gn.optional(),pin_styles:Tge.optional(),box_width:gn.optional(),symbol_name:nt().optional(),port_arrangement:Gge.optional(),port_labels:SE(nt()).optional(),symbol_display_value:nt().optional(),subcircuit_id:nt().optional(),schematic_group_id:nt().optional()}),kge=Si({type:di("schematic_line"),schematic_component_id:nt(),x1:sr,x2:sr,y1:sr,y2:sr,subcircuit_id:nt().optional()}),Lge=Si({type:di("schematic_trace"),schematic_trace_id:nt(),source_trace_id:nt(),junctions:ao(Si({x:mr(),y:mr()})),edges:ao(Si({from:Si({x:mr(),y:mr()}),to:Si({x:mr(),y:mr()}),is_crossing:Jl().optional(),from_schematic_port_id:nt().optional(),to_schematic_port_id:nt().optional()})),subcircuit_id:nt().optional()}),zWe=Ec(["center","left","right","top","bottom"]),Oge=Si({type:di("schematic_text"),schematic_component_id:nt().optional(),schematic_text_id:nt(),text:nt(),font_size:mr().default(.18),position:Si({x:sr,y:sr}),rotation:mr().default(0),anchor:_0([zWe.describe("legacy"),hY]).default("center"),color:nt().default("#000000"),subcircuit_id:nt().optional()}),zge=Si({type:di("schematic_port"),schematic_port_id:nt(),source_port_id:nt(),schematic_component_id:nt().optional(),center:Hm,facing_direction:Ec(["up","down","left","right"]).optional(),distance_from_component_edge:mr().optional(),side_of_component:Ec(["top","bottom","left","right"]).optional(),true_ccw_index:mr().optional(),pin_number:mr().optional(),display_pin_label:nt().optional(),subcircuit_id:nt().optional()}).describe("Defines a port on a schematic component"),Hge=Si({type:di("schematic_net_label"),schematic_net_label_id:ap("schematic_net_label"),schematic_trace_id:nt().optional(),source_trace_id:nt().optional(),source_net_id:nt(),center:Hm,anchor_position:Hm.optional(),anchor_side:Ec(["top","bottom","left","right"]),text:nt(),symbol_name:nt().optional(),is_movable:Jl().optional(),subcircuit_id:nt().optional()}),Yge=Si({type:di("schematic_error"),schematic_error_id:nt(),error_type:di("schematic_port_not_found").default("schematic_port_not_found"),message:nt(),subcircuit_id:nt().optional()}).describe("Defines a schematic error on the schematic"),Vge=Si({type:di("schematic_layout_error"),schematic_layout_error_id:ap("schematic_layout_error"),error_type:di("schematic_layout_error").default("schematic_layout_error"),message:nt(),source_group_id:nt(),schematic_group_id:nt(),subcircuit_id:nt().optional()}).describe("Error emitted when schematic layout fails for a group"),bU=Si({type:di("schematic_debug_object"),label:nt().optional(),subcircuit_id:nt().optional()}),Kge=bU.extend({shape:di("rect"),center:Hm,size:fY}),jge=bU.extend({shape:di("line"),start:Hm,end:Hm}),Jge=bU.extend({shape:di("point"),center:Hm}),qge=Dw("shape",[Kge,jge,Jge]),Zge=Si({type:di("schematic_voltage_probe"),schematic_voltage_probe_id:nt(),position:Hm,schematic_trace_id:nt(),voltage:a3.optional(),subcircuit_id:nt().optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),SU=Si({type:di("schematic_manual_edit_conflict_warning"),schematic_manual_edit_conflict_warning_id:ap("schematic_manual_edit_conflict_warning"),warning_type:di("schematic_manual_edit_conflict_warning").default("schematic_manual_edit_conflict_warning"),message:nt(),schematic_component_id:nt(),schematic_group_id:nt().optional(),subcircuit_id:nt().optional(),source_component_id:nt()}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates"),Wge=Si({type:di("schematic_group"),schematic_group_id:ap("schematic_group"),source_group_id:nt(),is_subcircuit:Jl().optional(),subcircuit_id:nt().optional(),width:gn,height:gn,center:Hm,schematic_component_ids:ao(nt()),name:nt().optional(),description:nt().optional()}).describe("Defines a group of components on the schematic"),A5=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],DY=Ec(A5),Xm=DY.or(Si({name:DY})).transform(i=>typeof i=="string"?i:i.name),o3=Ec(["top","bottom"]),Xge=Si({x:sr,y:sr,via:Jl().optional(),via_to_layer:Xm.optional()}),HWe=ao(Xge),CQ=Si({x:sr,y:sr,via:Jl().optional(),to_layer:Xm.optional(),trace_width:sr.optional()}),$ge=Si({type:di("pcb_component"),pcb_component_id:ap("pcb_component"),source_component_id:nt(),center:Hm,layer:Xm,rotation:Cx,width:gn,height:gn,subcircuit_id:nt().optional(),pcb_group_id:nt().optional()}).describe("Defines a component on the PCB"),e0e=Si({type:di("pcb_hole"),pcb_hole_id:ap("pcb_hole"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),hole_shape:Ec(["circle","square"]),hole_diameter:mr(),x:sr,y:sr}),YWe=e0e.describe("Defines a circular or square hole on the PCB"),t0e=Si({type:di("pcb_hole"),pcb_hole_id:ap("pcb_hole"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),hole_shape:di("oval"),hole_width:mr(),hole_height:mr(),x:sr,y:sr}),VWe=t0e.describe("Defines an oval hole on the PCB"),n0e=e0e.or(t0e),KWe=Si({type:di("pcb_plated_hole"),shape:di("circle"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),outer_diameter:mr(),hole_diameter:mr(),x:sr,y:sr,layers:ao(Xm),port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional(),pcb_plated_hole_id:ap("pcb_plated_hole")}),jWe=Si({type:di("pcb_plated_hole"),shape:Ec(["oval","pill"]),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),outer_width:mr(),outer_height:mr(),hole_width:mr(),hole_height:mr(),x:sr,y:sr,layers:ao(Xm),port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional(),pcb_plated_hole_id:ap("pcb_plated_hole")}),JWe=Si({type:di("pcb_plated_hole"),shape:di("circular_hole_with_rect_pad"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),hole_shape:di("circle"),pad_shape:di("rect"),hole_diameter:mr(),rect_pad_width:mr(),rect_pad_height:mr(),x:sr,y:sr,layers:ao(Xm),port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional(),pcb_plated_hole_id:ap("pcb_plated_hole")}),qWe=Si({type:di("pcb_plated_hole"),shape:di("pill_hole_with_rect_pad"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),hole_shape:di("pill"),pad_shape:di("rect"),hole_width:mr(),hole_height:mr(),rect_pad_width:mr(),rect_pad_height:mr(),x:sr,y:sr,layers:ao(Xm),port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional(),pcb_plated_hole_id:ap("pcb_plated_hole")}),i0e=_0([KWe,jWe,JWe,qWe]),r0e=Si({type:di("pcb_port"),pcb_port_id:ap("pcb_port"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),source_port_id:nt(),pcb_component_id:nt(),x:sr,y:sr,layers:ao(Xm)}).describe("Defines a port on the PCB"),ZWe=Si({type:di("pcb_smtpad"),shape:di("circle"),pcb_smtpad_id:ap("pcb_smtpad"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,radius:mr(),layer:Xm,port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional()}),WWe=Si({type:di("pcb_smtpad"),shape:di("rect"),pcb_smtpad_id:ap("pcb_smtpad"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,width:mr(),height:mr(),layer:Xm,port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional()}),XWe=Si({type:di("pcb_smtpad"),shape:di("rotated_rect"),pcb_smtpad_id:ap("pcb_smtpad"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,width:mr(),height:mr(),ccw_rotation:Cx,layer:Xm,port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional()}),a0e=Si({type:di("pcb_smtpad"),shape:di("pill"),pcb_smtpad_id:ap("pcb_smtpad"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,width:mr(),height:mr(),radius:mr(),layer:Xm,port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional()}),$We=Si({type:di("pcb_smtpad"),shape:di("polygon"),pcb_smtpad_id:ap("pcb_smtpad"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),points:ao(Hm),layer:Xm,port_hints:ao(nt()).optional(),pcb_component_id:nt().optional(),pcb_port_id:nt().optional()}),o0e=Dw("shape",[ZWe,WWe,XWe,a0e,$We]).describe("Defines an SMT pad on the PCB"),eXe=Si({type:di("pcb_solder_paste"),shape:di("circle"),pcb_solder_paste_id:ap("pcb_solder_paste"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,radius:mr(),layer:Xm,pcb_component_id:nt().optional(),pcb_smtpad_id:nt().optional()}),tXe=Si({type:di("pcb_solder_paste"),shape:di("rect"),pcb_solder_paste_id:ap("pcb_solder_paste"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,width:mr(),height:mr(),layer:Xm,pcb_component_id:nt().optional(),pcb_smtpad_id:nt().optional()}),nXe=Si({type:di("pcb_solder_paste"),shape:di("pill"),pcb_solder_paste_id:ap("pcb_solder_paste"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,width:mr(),height:mr(),radius:mr(),layer:Xm,pcb_component_id:nt().optional(),pcb_smtpad_id:nt().optional()}),iXe=Si({type:di("pcb_solder_paste"),shape:di("rotated_rect"),pcb_solder_paste_id:ap("pcb_solder_paste"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,width:mr(),height:mr(),ccw_rotation:sr,layer:Xm,pcb_component_id:nt().optional(),pcb_smtpad_id:nt().optional()}),rXe=Si({type:di("pcb_solder_paste"),shape:di("oval"),pcb_solder_paste_id:ap("pcb_solder_paste"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,width:mr(),height:mr(),layer:Xm,pcb_component_id:nt().optional(),pcb_smtpad_id:nt().optional()}),s0e=_0([eXe,tXe,nXe,iXe,rXe]).describe("Defines solderpaste on the PCB"),l0e=Si({type:di("pcb_text"),pcb_text_id:ap("pcb_text"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),text:nt(),center:Hm,layer:Xm,width:gn,height:gn,lines:mr(),align:Ec(["bottom-left"])}).describe("Defines text on the PCB"),c0e=Si({route_type:di("wire"),x:sr,y:sr,width:sr,start_pcb_port_id:nt().optional(),end_pcb_port_id:nt().optional(),layer:Xm}),u0e=Si({route_type:di("via"),x:sr,y:sr,hole_diameter:sr.optional(),outer_diameter:sr.optional(),from_layer:nt(),to_layer:nt()}),QU=_0([c0e,u0e]),A0e=Si({type:di("pcb_trace"),source_trace_id:nt().optional(),pcb_component_id:nt().optional(),pcb_trace_id:ap("pcb_trace"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),route_thickness_mode:Ec(["constant","interpolated"]).default("constant").optional(),route_order_index:mr().optional(),should_round_corners:Jl().optional(),trace_length:mr().optional(),route:ao(QU)}).describe("Defines a trace on the PCB"),d0e=Si({type:di("pcb_trace_error"),pcb_trace_error_id:ap("pcb_trace_error"),error_type:di("pcb_trace_error").default("pcb_trace_error"),message:nt(),center:Hm.optional(),pcb_trace_id:nt(),source_trace_id:nt(),pcb_component_ids:ao(nt()),pcb_port_ids:ao(nt()),subcircuit_id:nt().optional()}).describe("Defines a trace error on the PCB"),f0e=Si({type:di("pcb_port_not_matched_error"),pcb_error_id:ap("pcb_error"),error_type:di("pcb_port_not_matched_error").default("pcb_port_not_matched_error"),message:nt(),pcb_component_ids:ao(nt()),subcircuit_id:nt().optional()}).describe("Defines a trace error on the PCB where a port is not matched"),h0e=Si({type:di("pcb_via"),pcb_via_id:ap("pcb_via"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),x:sr,y:sr,outer_diameter:sr.default("0.6mm"),hole_diameter:sr.default("0.25mm"),from_layer:Xm.optional(),to_layer:Xm.optional(),layers:ao(Xm),pcb_trace_id:nt().optional()}).describe("Defines a via on the PCB"),p0e=Si({type:di("pcb_board"),pcb_board_id:ap("pcb_board"),is_subcircuit:Jl().optional(),subcircuit_id:nt().optional(),width:gn,height:gn,center:Hm,thickness:gn.optional().default(1.4),num_layers:mr().optional().default(4),outline:ao(Hm).optional(),material:Ec(["fr4","fr1"]).default("fr4")}).describe("Defines the board outline of the PCB"),g0e=Si({type:di("pcb_placement_error"),pcb_placement_error_id:ap("pcb_placement_error"),error_type:di("pcb_placement_error").default("pcb_placement_error"),message:nt(),subcircuit_id:nt().optional()}).describe("Defines a placement error on the PCB"),m0e=Si({type:di("pcb_trace_hint"),pcb_trace_hint_id:ap("pcb_trace_hint"),pcb_port_id:nt(),pcb_component_id:nt(),route:ao(CQ),subcircuit_id:nt().optional()}).describe("A hint that can be used during generation of a PCB trace"),y0e=Si({type:di("pcb_silkscreen_line"),pcb_silkscreen_line_id:ap("pcb_silkscreen_line"),pcb_component_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),stroke_width:sr.default("0.1mm"),x1:sr,y1:sr,x2:sr,y2:sr,layer:o3}).describe("Defines a silkscreen line on the PCB"),v0e=Si({type:di("pcb_silkscreen_path"),pcb_silkscreen_path_id:ap("pcb_silkscreen_path"),pcb_component_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),layer:o3,route:ao(Hm),stroke_width:gn}).describe("Defines a silkscreen path on the PCB"),C0e=Si({type:di("pcb_silkscreen_text"),pcb_silkscreen_text_id:ap("pcb_silkscreen_text"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),font:di("tscircuit2024").default("tscircuit2024"),font_size:sr.default("0.2mm"),pcb_component_id:nt(),text:nt(),ccw_rotation:mr().optional(),layer:Xm,is_mirrored:Jl().default(!1).optional(),anchor_position:Hm.default({x:0,y:0}),anchor_alignment:hY.default("center")}).describe("Defines silkscreen text on the PCB"),I0e=Si({type:di("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:ap("pcb_silkscreen_rect"),pcb_component_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),center:Hm,width:gn,height:gn,layer:Xm,stroke_width:gn.default("1mm"),is_filled:Jl().default(!0).optional(),has_stroke:Jl().optional(),is_stroke_dashed:Jl().optional()}).describe("Defines a silkscreen rect on the PCB"),E0e=Si({type:di("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:ap("pcb_silkscreen_circle"),pcb_component_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),center:Hm,radius:gn,layer:o3,stroke_width:gn.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),_0e=Si({type:di("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:ap("pcb_silkscreen_oval"),pcb_component_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),center:Hm,radius_x:sr,radius_y:sr,layer:o3}).describe("Defines a silkscreen oval on the PCB"),x0e=Si({type:di("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:ap("pcb_fabrication_note_text"),subcircuit_id:nt().optional(),pcb_group_id:nt().optional(),font:di("tscircuit2024").default("tscircuit2024"),font_size:sr.default("1mm"),pcb_component_id:nt(),text:nt(),layer:o3,anchor_position:Hm.default({x:0,y:0}),anchor_alignment:Ec(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:nt().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),B0e=Si({type:di("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:ap("pcb_fabrication_note_path"),pcb_component_id:nt(),subcircuit_id:nt().optional(),layer:Xm,route:ao(Hm),stroke_width:gn,color:nt().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),b0e=Si({type:di("pcb_keepout"),shape:di("rect"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),center:Hm,width:sr,height:sr,pcb_keepout_id:nt(),layers:ao(nt()),description:nt().optional()}).or(Si({type:di("pcb_keepout"),shape:di("circle"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),center:Hm,radius:sr,pcb_keepout_id:nt(),layers:ao(nt()),description:nt().optional()})),RY=Si({type:di("pcb_cutout"),pcb_cutout_id:ap("pcb_cutout"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional()}),S0e=RY.extend({shape:di("rect"),center:Hm,width:gn,height:gn,rotation:Cx.optional()}),Q0e=RY.extend({shape:di("circle"),center:Hm,radius:gn}),w0e=RY.extend({shape:di("polygon"),points:ao(Hm)}),M0e=Dw("shape",[S0e,Q0e,w0e]).describe("Defines a cutout on the PCB, removing board material."),D0e=Si({type:di("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:ap("pcb_missing_footprint_error"),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),error_type:di("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),source_component_id:nt(),message:nt()}).describe("Defines a missing footprint error on the PCB"),R0e=Si({type:di("pcb_group"),pcb_group_id:ap("pcb_group"),source_group_id:nt(),is_subcircuit:Jl().optional(),subcircuit_id:nt().optional(),width:gn,height:gn,center:Hm,pcb_component_ids:ao(nt()),name:nt().optional(),description:nt().optional()}).describe("Defines a group of components on the PCB"),N0e=Si({type:di("pcb_autorouting_error"),pcb_error_id:ap("pcb_autorouting_error"),error_type:di("pcb_autorouting_error").default("pcb_autorouting_error"),message:nt(),subcircuit_id:nt().optional()}).describe("The autorouting has failed to route a portion of the board"),wU=Si({type:di("pcb_manual_edit_conflict_warning"),pcb_manual_edit_conflict_warning_id:ap("pcb_manual_edit_conflict_warning"),warning_type:di("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),message:nt(),pcb_component_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),source_component_id:nt()}).describe("Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),T0e=Si({type:di("pcb_breakout_point"),pcb_breakout_point_id:ap("pcb_breakout_point"),pcb_group_id:nt(),subcircuit_id:nt().optional(),source_trace_id:nt().optional(),source_port_id:nt().optional(),source_net_id:nt().optional(),x:sr,y:sr}).describe("Defines a routing target within a pcb_group for a source_trace or source_net"),U0e=Si({type:di("pcb_ground_plane"),pcb_ground_plane_id:ap("pcb_ground_plane"),source_pcb_ground_plane_id:nt(),source_net_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional()}).describe("Defines a ground plane on the PCB"),P0e=Si({type:di("pcb_ground_plane_region"),pcb_ground_plane_region_id:ap("pcb_ground_plane_region"),pcb_ground_plane_id:nt(),pcb_group_id:nt().optional(),subcircuit_id:nt().optional(),layer:Xm,points:ao(Hm)}).describe("Defines a polygon region of a ground plane"),G0e=Si({type:di("pcb_thermal_spoke"),pcb_thermal_spoke_id:ap("pcb_thermal_spoke"),pcb_ground_plane_id:nt(),shape:nt(),spoke_count:mr(),spoke_thickness:sr,spoke_inner_diameter:sr,spoke_outer_diameter:sr,pcb_plated_hole_id:nt().optional(),subcircuit_id:nt().optional()}).describe("Pattern for connecting a ground plane to a plated hole"),F0e=Si({type:di("cad_component"),cad_component_id:nt(),pcb_component_id:nt(),source_component_id:nt(),position:j9,rotation:j9.optional(),size:j9.optional(),layer:Xm.optional(),subcircuit_id:nt().optional(),footprinter_string:nt().optional(),model_obj_url:nt().optional(),model_stl_url:nt().optional(),model_3mf_url:nt().optional(),model_jscad:cb().optional()}).describe("Defines a component on the PCB"),k0e=_0([Qge,Sge,bge,Mge,wge,yY,pY,BU,mY,gY,vY,CY,IY,xY,BY,wY,bY,SY,QY,_Y,EY,Dge,MY,$ge,n0e,D0e,wU,i0e,b0e,r0e,l0e,A0e,h0e,o0e,s0e,p0e,R0e,m0e,y0e,v0e,C0e,I0e,E0e,_0e,d0e,g0e,f0e,B0e,x0e,N0e,T0e,M0e,U0e,P0e,G0e,Rge,Oge,kge,Fge,zge,Lge,Nge,Yge,Vge,Hge,qge,Zge,SU,Wge,F0e]),d5=k0e;const MU=Object.freeze(Object.defineProperty({__proto__:null,all_layers:A5,any_circuit_element:k0e,any_soup_element:d5,any_source_component:bge,battery_capacity:Ige,cad_component:F0e,capacitance:r3,current:GWe,distance:sr,frequency:_U,getZodPrefixedIdWithDefault:ap,inductance:dY,layer_ref:Xm,layer_string:DY,length:gn,ninePointAnchor:hY,pcb_autorouting_error:N0e,pcb_board:p0e,pcb_breakout_point:T0e,pcb_component:$ge,pcb_cutout:M0e,pcb_cutout_circle:Q0e,pcb_cutout_polygon:w0e,pcb_cutout_rect:S0e,pcb_fabrication_note_path:B0e,pcb_fabrication_note_text:x0e,pcb_ground_plane:U0e,pcb_ground_plane_region:P0e,pcb_group:R0e,pcb_hole:n0e,pcb_hole_circle_or_square_shape:YWe,pcb_hole_oval_shape:VWe,pcb_keepout:b0e,pcb_manual_edit_conflict_warning:wU,pcb_missing_footprint_error:D0e,pcb_placement_error:g0e,pcb_plated_hole:i0e,pcb_port:r0e,pcb_port_not_matched_error:f0e,pcb_route_hint:Xge,pcb_route_hints:HWe,pcb_silkscreen_circle:E0e,pcb_silkscreen_line:y0e,pcb_silkscreen_oval:_0e,pcb_silkscreen_path:v0e,pcb_silkscreen_rect:I0e,pcb_silkscreen_text:C0e,pcb_smtpad:o0e,pcb_smtpad_pill:a0e,pcb_solder_paste:s0e,pcb_text:l0e,pcb_thermal_spoke:G0e,pcb_trace:A0e,pcb_trace_error:d0e,pcb_trace_hint:m0e,pcb_trace_route_point:QU,pcb_trace_route_point_via:u0e,pcb_trace_route_point_wire:c0e,pcb_via:h0e,point:Hm,point3:j9,port_arrangement:Gge,position:kWe,position3:LWe,resistance:i3,rotation:Cx,route_hint_point:CQ,schematic_box:Rge,schematic_component:Fge,schematic_component_port_arrangement_by_sides:Pge,schematic_component_port_arrangement_by_size:Uge,schematic_debug_line:jge,schematic_debug_object:qge,schematic_debug_object_base:bU,schematic_debug_point:Jge,schematic_debug_rect:Kge,schematic_error:Yge,schematic_group:Wge,schematic_layout_error:Vge,schematic_line:kge,schematic_manual_edit_conflict_warning:SU,schematic_net_label:Hge,schematic_path:Nge,schematic_pin_styles:Tge,schematic_port:zge,schematic_text:Oge,schematic_trace:Lge,schematic_voltage_probe:Zge,size:fY,source_component_base:jE,source_failed_to_create_component_error:Bge,source_group:wge,source_missing_property_error:xge,source_net:Mge,source_pcb_ground_plane:Dge,source_port:Sge,source_project_metadata:MY,source_simple_battery:CY,source_simple_capacitor:pY,source_simple_chip:yY,source_simple_crystal:_ge,source_simple_diode:BU,source_simple_ground:Ege,source_simple_inductor:IY,source_simple_led:mY,source_simple_mosfet:QY,source_simple_pin_header:xY,source_simple_potentiometer:_Y,source_simple_power_source:vY,source_simple_push_button:EY,source_simple_resistor:gY,source_simple_resonator:BY,source_simple_switch:wY,source_simple_test_point:SY,source_simple_transistor:bY,source_trace:Qge,supplier_name:xU,time:FWe,visible_layer:o3,voltage:a3},Symbol.toStringTag,{value:"Module"}));function Rr(i,e){return Array.isArray(e)?[i.a*e[0]+i.c*e[1]+i.e,i.b*e[0]+i.d*e[1]+i.f]:{x:i.a*e.x+i.c*e.y+i.e,y:i.b*e.x+i.d*e.y+i.f}}function aXe(i,e){return e.map(t=>Rr(i,t))}function L0e(i){return{a:parseFloat(i.a),b:parseFloat(i.b),c:parseFloat(i.c),d:parseFloat(i.d),e:parseFloat(i.e),f:parseFloat(i.f)}}const oXe=/^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 NY(i){const e=i.match(oXe);if(e===null||e.length<7)throw new Error(`'${i}' 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 Hv(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function ES(i){const{a:e,b:t,c:n,d:r,e:a,f:o}=i,s=e*r-t*n;return{a:r/s,b:t/-s,c:n/-s,d:e/s,e:(r*a-n*o)/-s,f:(t*a-e*o)/s}}function f5(i){return typeof i>"u"}function s3(i){return typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i)}function sXe(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function lXe(i){return sXe(i)&&"a"in i&&s3(i.a)&&"b"in i&&s3(i.b)&&"c"in i&&s3(i.c)&&"d"in i&&s3(i.d)&&"e"in i&&s3(i.e)&&"f"in i&&s3(i.f)}function Dh(i,e=0){return{a:1,c:0,e:i,b:0,d:1,f:e}}function Rw(...i){i=Array.isArray(i[0])?i[0]:i;const e=(t,n)=>({a:t.a*n.a+t.c*n.b,c:t.a*n.c+t.c*n.d,e:t.a*n.e+t.c*n.f+t.e,b:t.b*n.a+t.d*n.b,d:t.b*n.c+t.d*n.d,f:t.b*n.e+t.d*n.f+t.f});switch(i.length){case 0:throw new Error("no matrices provided");case 1:return i[0];case 2:return e(i[0],i[1]);default:{const[t,n,...r]=i,a=e(t,n);return Rw(a,...r)}}}function Fd(...i){return Rw(...i)}const{cos:cXe,sin:uXe,PI:AXe}=Math;function AB(i,e,t){const n=cXe(i),r=uXe(i),a={a:n,c:-r,e:0,b:r,d:n,f:0};return f5(e)||f5(t)?a:Rw([Dh(e,t),a,Dh(-e,-t)])}function TY(i,e=void 0,t=void 0){return AB(i*AXe/180,e,t)}function JE(i,e=void 0,t=void 0,n=void 0){f5(e)&&(e=i);const r={a:i,c:0,e:0,b:0,d:e,f:0};return f5(t)||f5(n)?r:Rw([Dh(t,n),r,Dh(-t,-n)])}function O0e(i,e){return{a:1,c:i,e:0,b:e,d:1,f:0}}const{tan:z0e}=Math;function H0e(i,e){return{a:1,c:z0e(i),e:0,b:z0e(e),d:1,f:0}}function UY(i,e){return H0e(i*Math.PI/180,e*Math.PI/180)}function dXe(i){return Nw(i)}function Y0e(i){return Nw(i)}function Nw(i){return`matrix(${i.a},${i.b},${i.c},${i.d},${i.e},${i.f})`}function V0e(i,e=1e10){return{a:Math.round(i.a*e)/e,b:Math.round(i.b*e)/e,c:Math.round(i.c*e)/e,d:Math.round(i.d*e)/e,e:Math.round(i.e*e)/e,f:Math.round(i.f*e)/e}}function K0e(i,e){const t=i[0].x!=null?i[0].x:i[0][0],n=i[0].y!=null?i[0].y:i[0][1],r=e[0].x!=null?e[0].x:e[0][0],a=e[0].y!=null?e[0].y:e[0][1],o=i[1].x!=null?i[1].x:i[1][0],s=i[1].y!=null?i[1].y:i[1][1],l=e[1].x!=null?e[1].x:e[1][0],c=e[1].y!=null?e[1].y:e[1][1],u=i[2].x!=null?i[2].x:i[2][0],A=i[2].y!=null?i[2].y:i[2][1],f=e[2].x!=null?e[2].x:e[2][0],p=e[2].y!=null?e[2].y:e[2][1],v={a:t-u,b:n-A,c:o-u,d:s-A,e:u,f:A},B={a:r-f,b:a-p,c:l-f,d:c-p,e:f,f:p},x=ES(v),b=Rw([B,x]);return V0e(b)}function fXe(i){return Array.isArray(i)?i.map(e):e(i);function e(t){switch(t.type){case"matrix":if("a"in t&&"b"in t&&"c"in t&&"d"in t&&"e"in t&&"f"in t)return L0e(t);throw new Error("MISSING_MANDATORY_PARAM");case"translate":if(!("tx"in t))throw new Error("MISSING_MANDATORY_PARAM");return"ty"in t?Dh(t.tx,t.ty):Dh(t.tx);case"scale":if(!("sx"in t))throw new Error("MISSING_MANDATORY_PARAM");return"sy"in t?JE(t.sx,t.sy):JE(t.sx);case"rotate":if(!("angle"in t))throw new Error("MISSING_MANDATORY_PARAM");return"cx"in t&&"cy"in t?TY(t.angle,t.cx,t.cy):TY(t.angle);case"skewX":if(!("angle"in t))throw new Error("MISSING_MANDATORY_PARAM");return UY(t.angle,0);case"skewY":if(!("angle"in t))throw new Error("MISSING_MANDATORY_PARAM");return UY(0,t.angle);case"shear":if(!("shx"in t&&"shy"in t))throw new Error("MISSING_MANDATORY_PARAM");return O0e(t.shx,t.shy);default:throw new Error("UNSUPPORTED_DESCRIPTOR")}}}function hXe(i,e){function t(){this.constructor=i}t.prototype=e.prototype,i.prototype=new t}function l3(i,e,t,n){var r=Error.call(this,i);return Object.setPrototypeOf&&Object.setPrototypeOf(r,l3.prototype),r.expected=e,r.found=t,r.location=n,r.name="SyntaxError",r}hXe(l3,Error);function PY(i,e,t){return t=t||" ",i.length>e?i:(e-=i.length,t+=t.repeat(e),i+t.slice(0,e))}l3.prototype.format=function(i){var e="Error: "+this.message;if(this.location){var t=null,n;for(n=0;n<i.length;n++)if(i[n].source===this.location.source){t=i[n].text.split(/\r\n|\n|\r/g);break}var r=this.location.start,a=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(r):r,o=this.location.source+":"+a.line+":"+a.column;if(t){var s=this.location.end,l=PY("",a.line.toString().length," "),c=t[r.line-1],u=r.line===s.line?s.column:c.length+1,A=u-r.column||1;e+=`
|
|
245
245
|
--> `+o+`
|
|
246
246
|
`+l+` |
|
|
247
247
|
`+a.line+" | "+c+`
|
|
@@ -13075,7 +13075,7 @@ ${l.join(`
|
|
|
13075
13075
|
`)),i.indexOf(`\\
|
|
13076
13076
|
`)!==-1&&(i=i.replace(/\\\n/g,""));const t=i.split(`
|
|
13077
13077
|
`);let n="",r="",a=0,o=[];const s=typeof"".trimLeft=="function";for(let u=0,A=t.length;u<A;u++)if(n=t[u],n=s?n.trimLeft():n.trim(),a=n.length,a!==0&&(r=n.charAt(0),r!=="#"))if(r==="v"){const f=n.split(/\s+/);switch(f[0]){case"v":e.vertices.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3])),f.length>=7?e.colors.push(parseFloat(f[4]),parseFloat(f[5]),parseFloat(f[6])):e.colors.push(void 0,void 0,void 0);break;case"vn":e.normals.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3]));break;case"vt":e.uvs.push(parseFloat(f[1]),parseFloat(f[2]));break}}else if(r==="f"){const p=n.substr(1).trim().split(/\s+/),v=[];for(let x=0,b=p.length;x<b;x++){const Q=p[x];if(Q.length>0){const R=Q.split("/");v.push(R)}}const B=v[0];for(let x=1,b=v.length-1;x<b;x++){const Q=v[x],R=v[x+1];e.addFace(B[0],Q[0],R[0],B[1],Q[1],R[1],B[2],Q[2],R[2])}}else if(r==="l"){const f=n.substring(1).trim().split(" ");let p=[];const v=[];if(n.indexOf("/")===-1)p=f;else for(let B=0,x=f.length;B<x;B++){const b=f[B].split("/");b[0]!==""&&p.push(b[0]),b[1]!==""&&v.push(b[1])}e.addLineGeometry(p,v)}else if(r==="p"){const p=n.substr(1).trim().split(" ");e.addPointGeometry(p)}else if((o=q7t.exec(n))!==null){const f=(" "+o[0].substr(1).trim()).substr(1);e.startObject(f)}else if(W7t.test(n))e.object.startMaterial(n.substring(7).trim(),e.materialLibraries);else if(Z7t.test(n))e.materialLibraries.push(n.substring(7).trim());else if(X7t.test(n))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(r==="s"){if(o=n.split(" "),o.length>1){const p=o[1].trim().toLowerCase();e.object.smooth=p!=="0"&&p!=="off"}else e.object.smooth=!0;const f=e.object.currentMaterial();f&&(f.smooth=e.object.smooth)}else{if(n==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+n+'"')}e.finalize();const l=new g2;if(l.materialLibraries=[].concat(e.materialLibraries),!(e.objects.length===1&&e.objects[0].geometry.vertices.length===0)===!0)for(let u=0,A=e.objects.length;u<A;u++){const f=e.objects[u],p=f.geometry,v=f.materials,B=p.type==="Line",x=p.type==="Points";let b=!1;if(p.vertices.length===0)continue;const Q=new mp;Q.setAttribute("position",new CA(p.vertices,3)),p.normals.length>0&&Q.setAttribute("normal",new CA(p.normals,3)),p.colors.length>0&&(b=!0,Q.setAttribute("color",new CA(p.colors,3))),p.hasUVIndices===!0&&Q.setAttribute("uv",new CA(p.uvs,2));const R=[];for(let K=0,Y=v.length;K<Y;K++){const J=v[K],W=J.name+"_"+J.smooth+"_"+b;let $=e.materials[W];if(this.materials!==null){if($=this.materials.create(J.name),B&&$&&!($ instanceof XE)){const X=new XE;S_.prototype.copy.call(X,$),X.color.copy($.color),$=X}else if(x&&$&&!($ instanceof E2)){const X=new E2({size:10,sizeAttenuation:!1});S_.prototype.copy.call(X,$),X.color.copy($.color),X.map=$.map,$=X}}$===void 0&&(B?$=new XE:x?$=new E2({size:1,sizeAttenuation:!1}):$=new PG,$.name=J.name,$.flatShading=!J.smooth,$.vertexColors=b,e.materials[W]=$),R.push($)}let k;if(R.length>1){for(let K=0,Y=v.length;K<Y;K++){const J=v[K];Q.addGroup(J.groupStart,J.groupCount,K)}B?k=new hb(Q,R):x?k=new X5(Q,R):k=new yC(Q,R)}else B?k=new hb(Q,R[0]):x?k=new X5(Q,R[0]):k=new yC(Q,R[0]);k.name=f.name,l.add(k)}else if(e.vertices.length>0){const u=new E2({size:1,sizeAttenuation:!1}),A=new mp;A.setAttribute("position",new CA(e.vertices,3)),e.colors.length>0&&e.colors[0]!==void 0&&(A.setAttribute("color",new CA(e.colors,3)),u.vertexColors=!0);const f=new X5(A,u);l.add(f)}return l}};typeof window<"u"&&!window.TSCIRCUIT_OBJ_LOADER_CACHE&&(window.TSCIRCUIT_OBJ_LOADER_CACHE=new Map);function tOt(i){const[e,t]=It.useState(null);return It.useEffect(()=>{if(!i)return;const n=window.TSCIRCUIT_OBJ_LOADER_CACHE;let r=!1;async function a(){var s;try{const c=await(await fetch(i)).text(),u=(s=c.match(/newmtl[\s\S]*?endmtl/g))==null?void 0:s.join(`
|
|
13078
|
-
`).replace(/d 0\./g,"d 1."),A=c.replace(/newmtl[\s\S]*?endmtl/g,""),f=new j7t;f.setMaterialOptions({invertTrProperty:!0});const p=f.parse(u.replace(/Kd\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/g,"Kd $2 $2 $2"),"test.mtl"),v=new eOt;return v.setMaterials(p),v.parse(A)}catch(l){return l}}function o(){if(n.has(i)){const l=n.get(i);return l.result?Promise.resolve(l.result.clone()):l.promise.then(c=>c.clone())}const s=a().then(l=>(l instanceof Error||n.set(i,{...n.get(i),result:l}),l));return n.set(i,{promise:s,result:null}),s}return o().then(s=>{r||t(s)}).catch(s=>{console.error(s)}),()=>{r=!0}},[i]),e}function nOt({url:i,position:e,rotation:t,onHover:n,onUnhover:r,isHovered:a}){const o=tOt(i);return o?o instanceof Error?ht.jsx(o4,{isHovered:a,onHover:n,onUnhover:r,children:ht.jsxs("mesh",{position:e,children:[ht.jsx("boxGeometry",{args:[.5,.5,.5]}),ht.jsx("meshStandardMaterial",{transparent:!0,color:"red",opacity:.5}),ht.jsx("meshBasicMaterial",{color:"red"})]})}):ht.jsx(o4,{isHovered:a,onHover:n,onUnhover:r,children:ht.jsx("primitive",{rotation:t,position:e,object:o})}):ht.jsx(o4,{isHovered:a,onHover:n,onUnhover:r,children:ht.jsxs("mesh",{position:e,children:[ht.jsx("boxGeometry",{args:[.5,.5,.5]}),ht.jsx("meshStandardMaterial",{transparent:!0,color:"red",opacity:.25})]})})}var iOt=ZI(N6e()),G6e=({jscadPlan:i,positionOffset:e,rotationOffset:t,onHover:n,onUnhover:r,isHovered:a})=>{const{threeGeom:o,material:s}=It.useMemo(()=>{const l=xCe.executeJscadOperations(iOt.default,i),c=vAt(l),u=new O3({vertexColors:!0,side:Ex});return{threeGeom:c,material:u}},[i]);return It.useMemo(()=>{if(a){const l=new Dc(s.color.getHex());s.emissive.copy(l),s.emissive.setRGB(0,0,1),s.emissiveIntensity=.2}else s.emissiveIntensity=0},[a,s]),o?ht.jsx(o4,{isHovered:a,onHover:n,onUnhover:r,position:e,children:ht.jsx("mesh",{geometry:o,material:s,position:e,rotation:t})}):null},{createJSCADRoot:rOt}=Qot(xCe.jscadPlanner),aOt=({positionOffset:i,footprint:e,rotationOffset:t,onHover:n,onUnhover:r,isHovered:a})=>{const o=It.useMemo(()=>{if(!e)return null;const s=[];return rOt(s).render(ht.jsx(VCt,{footprint:e})),s},[e]);return o?ht.jsx(ht.Fragment,{children:o.map((s,l)=>ht.jsx(G6e,{positionOffset:i,rotationOffset:t,jscadPlan:s,onHover:n,onUnhover:r,isHovered:a},l))}):null},oOt=(...i)=>i,F6e=({cad_component:i,circuitJson:e})=>{const[t,n]=It.useState(!1),[r,a]=It.useState(null),o=It.useCallback(f=>{f!=null&&f.mousePosition?(n(!0),a(f.mousePosition)):(n(!1),a(null))},[]),s=It.useCallback(()=>{n(!1),a(null)},[]),l=It.useMemo(()=>{var f;return(f=Gy(e).source_component.getUsing({source_component_id:i.source_component_id}))==null?void 0:f.name},[e,i.source_component_id]),c=i.model_obj_url??i.model_stl_url,u=i.rotation?oOt(i.rotation.x*Math.PI/180,i.rotation.y*Math.PI/180,i.rotation.z*Math.PI/180):void 0;let A=null;return c?A=ht.jsx(nOt,{url:c,position:i.position?[i.position.x,i.position.y,i.position.z]:void 0,rotation:u,onHover:o,onUnhover:s,isHovered:t},i.cad_component_id):i.model_jscad?A=ht.jsx(G6e,{jscadPlan:i.model_jscad,rotationOffset:u,onHover:o,onUnhover:s,isHovered:t},i.cad_component_id):i.footprinter_string&&(A=ht.jsx(aOt,{positionOffset:i.position?[i.position.x,i.position.y,i.position.z]:void 0,rotationOffset:u,footprint:i.footprinter_string,onHover:o,onUnhover:s,isHovered:t})),ht.jsxs(ht.Fragment,{children:[A,t&&r?ht.jsx(xRe,{position:r,style:{fontFamily:"sans-serif",transform:"translate3d(50%, 50%, 0)",backgroundColor:"white",padding:"5px",borderRadius:"3px",pointerEvents:"none",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},children:l??"<unknown>"}):null]})},sOt={version:"0.0.287"};typeof window<"u"&&(window.TSCI_MAIN_CAMERA_ROTATION=new hB(0,0,0));function lOt(i,e){const t=new H_().setFromEuler(new hB(i.x,i.y,i.z)),n=new ei(0,0,1);return n.applyQuaternion(t),n.multiplyScalar(e)}var cOt=({})=>{const i=It.useRef();return It.useRef({lastRotation:new hB}),gT((e,t)=>{if(!i.current)return;const n=window.TSCI_MAIN_CAMERA_ROTATION,r=lOt(n,2);e.camera.position.copy(r),e.camera.lookAt(0,0,0)}),ht.jsxs("mesh",{ref:i,rotation:[Math.PI/2,0,0],children:[ht.jsx("boxGeometry",{args:[1,1,1]}),ht.jsx("meshStandardMaterial",{color:"white"}),ht.jsx(Z2,{position:[0,0,.51],fontSize:.25,color:"black",children:"Front"}),ht.jsx(Z2,{position:[0,0,-.51],fontSize:.25,color:"black",rotation:[0,Math.PI,0],children:"Back"}),ht.jsx(Z2,{position:[.51,0,0],fontSize:.25,color:"black",rotation:[0,Math.PI/2,0],children:"Right"}),ht.jsx(Z2,{position:[-.51,0,0],fontSize:.25,color:"black",rotation:[0,-Math.PI/2,0],children:"Left"}),ht.jsx(Z2,{position:[0,.51,0],fontSize:.25,color:"black",rotation:[-Math.PI/2,0,0],children:"Top"}),ht.jsx(Z2,{position:[0,-.51,0],fontSize:.25,color:"black",rotation:[Math.PI/2,0,0],children:"Bottom"}),ht.jsx("lineSegments",{args:[new lK(new zw(1,1,1))],material:new XE({color:0,linewidth:2})})]})},uOt=()=>(gT(({camera:i})=>{window.TSCI_MAIN_CAMERA_ROTATION=i.rotation}),ht.jsx(ht.Fragment,{})),k6e=It.forwardRef(({children:i,initialCameraPosition:e=[5,5,5],autoRotateDisabled:t,clickToInteractEnabled:n=!1,boardDimensions:r},a)=>{const[o,s]=It.useState(!n),l=It.useMemo(()=>{if(!r)return 10;const c=r.width??0,u=r.height??0,f=Math.max(c,u)*1.5;return f>10?f:10},[r]);return ht.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[ht.jsx("div",{style:{position:"absolute",top:0,left:0,width:120,height:120},children:ht.jsxs(IRe,{camera:{up:[0,0,1],position:[1,1,1]},style:{zIndex:10},children:[ht.jsx("ambientLight",{intensity:Math.PI/2}),ht.jsx(cOt,{})]})}),ht.jsxs(IRe,{scene:{up:[0,0,1]},camera:{up:[0,0,1],position:e},children:[ht.jsx(uOt,{}),o&&ht.jsx(nEt,{autoRotate:!t,autoRotateSpeed:1}),ht.jsx("ambientLight",{intensity:Math.PI/2}),ht.jsx("pointLight",{position:[-10,-10,10],decay:0,intensity:Math.PI/4}),ht.jsx(rEt,{rotation:[Math.PI/2,0,0],infiniteGrid:!0,cellSize:1,sectionSize:l,args:[l,l]}),ht.jsx("object3D",{ref:a,children:i})]}),ht.jsxs("div",{style:{position:"absolute",right:24,bottom:24,fontFamily:"sans-serif",color:"white",WebkitTextStroke:"0.5px rgba(0, 0, 0, 0.5)",fontSize:11},children:["@",sOt.version]}),n&&!o&&ht.jsx("button",{type:"button",onClick:()=>s(!0),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&s(!0)},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center"},children:ht.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",fontFamily:"sans-serif",pointerEvents:"none"},children:"Click to Interact"})})]})}),AOt=i=>It.useMemo(()=>{if(!i)return;const e=new FGt;return e.add(i),e.render(),e.getCircuitJson()},[i]);function dOt(i){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>{e(n.result)},n.onerror=t,n.readAsDataURL(i)})}var fOt=i=>{const[e,t]=It.useState([]),[n,r]=It.useState(!0);return It.useEffect(()=>{if(!i)return;(async()=>{r(!0);const s=(Array.isArray(i)?i:[i]).map(async l=>{const c=WGt.serialize({binary:!0},[l]),u=new Blob(c);return{stlUrl:await dOt(u),color:l.color}});try{const l=await Promise.all(s);t(l)}catch(l){console.error("Error generating STLs:",l),t([])}finally{r(!1)}})()},[i]),{stls:e,loading:n}},hOt=ZI(KD()),pOt=ZI($T()),nv=.01,l_={copper:[.9,.6,.2],fr4Green:[5/255,163/255,46/255],fr4GreenSolderWithMask:[0/255,152/255,19/255],fr1Copper:[.8,.4,.2],fr1CopperSolderWithMask:[.9,.6,.2]},$Q=.001,ZS=32,gOt=.035,P7=50,Yle={fr1:l_.fr1Copper,fr4:l_.fr4Green},L6e={fr1:l_.fr1CopperSolderWithMask,fr4:l_.fr4GreenSolderWithMask},mOt=ZI(R7()),yOt=ZI(KD()),vOt=ZI(U7()),O6e=i=>{let e=0;for(let n=0;n<i.length;n++){const r=(n+1)%i.length;e+=i[n][0]*i[r][1],e-=i[r][0]*i[n][1]}return e/2<=0},z6e=(i,e=1.2)=>{const{outline:t}=i;let n=t.map(o=>[o.x,o.y]);O6e(n)&&(n=n.reverse());const r=(0,yOt.polygon)({points:n});let a=(0,mOt.extrudeLinear)({height:e},r);return a=(0,vOt.translate)([0,0,-e/2],a),a},COt=i=>{const e=Gy(i).pcb_board.list()[0];if(!e)return console.warn("No pcb_board found for simplified geometry"),[];let t;const n=1.2;e.outline&&e.outline.length>0?t=z6e({outline:e.outline},n):t=(0,hOt.cuboid)({size:[e.width,e.height,n],center:[e.center.x,e.center.y,0]});const r=Yle[e.material]??l_.fr4Green;return[(0,pOt.colorize)(r,t)]},AM=ZI(U7()),Dx=ZI(KD()),jD=ZI($T()),dM=ZI(Fle()),_C=ZI(KD()),G7=ZI($T()),KB=ZI(Fle()),k1=.05,H6e=(i,e)=>{if(i.shape||(i.shape="circle"),i.shape==="circle")return(0,G7.colorize)(l_.copper,(0,KB.subtract)((0,KB.union)((0,_C.cylinder)({center:[i.x,i.y,0],radius:i.hole_diameter/2,height:e.pcbThickness}),(0,_C.cylinder)({center:[i.x,i.y,e.pcbThickness/2+k1/2+nv],radius:i.outer_diameter/2,height:k1}),(0,_C.cylinder)({center:[i.x,i.y,-e.pcbThickness/2-k1/2-nv],radius:i.outer_diameter/2,height:k1})),(0,_C.cylinder)({center:[i.x,i.y,0],radius:i.hole_diameter/2-nv,height:1.5})));if(i.shape==="circular_hole_with_rect_pad"){const t=i.rect_pad_width||i.hole_diameter,n=i.rect_pad_height||i.hole_diameter;return(0,G7.colorize)(l_.copper,(0,KB.subtract)((0,KB.union)((0,_C.cuboid)({center:[i.x,i.y,1.2/2],size:[t,n,k1]}),(0,_C.cuboid)({center:[i.x,i.y,-1.2/2],size:[t,n,k1]}),(0,_C.cylinder)({center:[i.x,i.y,0],radius:i.hole_diameter/2,height:1.2})),(0,_C.cylinder)({center:[i.x,i.y,0],radius:Math.max(i.hole_diameter/2-nv,.01),height:1.5})))}if(i.shape==="pill"){const t=i.hole_height>i.hole_width,n=t?i.hole_height:i.hole_width,r=t?i.hole_width:i.hole_height,a=t?i.outer_height||r+.2:i.outer_width||n+.2,o=t?i.outer_width||n+.2:i.outer_height||r+.2,s=r/2,l=o/2,c=Math.abs(n-r),u=Math.abs(a-o),A=(0,_C.cuboid)({center:[i.x,i.y,0],size:t?[r,c,e.pcbThickness]:[c,r,e.pcbThickness]}),f=(0,_C.cylinder)({center:t?[i.x,i.y-c/2,0]:[i.x-c/2,i.y,0],radius:s,height:e.pcbThickness}),p=(0,_C.cylinder)({center:t?[i.x,i.y+c/2,0]:[i.x+c/2,i.y,0],radius:s,height:e.pcbThickness}),v=(0,KB.union)(A,f,p),B=e.pcbThickness/2+k1/2+nv,x=(0,_C.cuboid)({center:[i.x,i.y,B],size:t?[o,u,k1]:[u,o,k1]}),b=(0,_C.cylinder)({center:t?[i.x,i.y-u/2,B]:[i.x-u/2,i.y,B],radius:l,height:k1}),Q=(0,_C.cylinder)({center:t?[i.x,i.y+u/2,B]:[i.x+u/2,i.y,B],radius:l,height:k1}),R=(0,KB.union)(x,b,Q),k=-e.pcbThickness/2-k1/2-nv,K=(0,_C.cuboid)({center:[i.x,i.y,k],size:t?[o,u,k1]:[u,o,k1]}),Y=(0,_C.cylinder)({center:t?[i.x,i.y-u/2,k]:[i.x-u/2,i.y,k],radius:l,height:k1}),J=(0,_C.cylinder)({center:t?[i.x,i.y+u/2,k]:[i.x+u/2,i.y,k],radius:l,height:k1}),W=(0,KB.union)(K,Y,J),$=(0,_C.cuboid)({center:[i.x,i.y,0],size:t?[r-2*nv,c,e.pcbThickness+2*nv]:[c,r-2*nv,e.pcbThickness+2*nv]}),X=(0,_C.cylinder)({center:t?[i.x,i.y-c/2,0]:[i.x-c/2,i.y,0],radius:s-nv,height:e.pcbThickness+2*nv}),de=(0,_C.cylinder)({center:t?[i.x,i.y+c/2,0]:[i.x+c/2,i.y,0],radius:s-nv,height:e.pcbThickness+2*nv}),ue=(0,KB.union)($,X,de);return(0,G7.colorize)(l_.copper,(0,KB.subtract)((0,KB.union)(v,R,W),ue))}if(i.shape==="pill_hole_with_rect_pad"){const t=i.hole_height>i.hole_width,n=t?i.hole_height:i.hole_width,r=t?i.hole_width:i.hole_height,a=r/2,o=Math.abs(n-r),s=i.rect_pad_width||n+.2,l=i.rect_pad_height||r+.2,c=(0,_C.cuboid)({center:[i.x,i.y,0],size:t?[r,o,1.2]:[o,r,1.2]}),u=(0,_C.cylinder)({center:t?[i.x,i.y-o/2,0]:[i.x-o/2,i.y,0],radius:a,height:1.2}),A=(0,_C.cylinder)({center:t?[i.x,i.y+o/2,0]:[i.x+o/2,i.y,0],radius:a,height:1.2}),f=(0,_C.cuboid)({center:[i.x,i.y,1.2/2],size:[s,l,k1]}),p=(0,_C.cuboid)({center:[i.x,i.y,-1.2/2],size:[s,l,k1]}),v=(0,KB.union)((0,_C.cuboid)({center:[i.x,i.y,0],size:t?[r-k1,o,1.5]:[o,r-k1,1.5]}),(0,_C.cylinder)({center:t?[i.x,i.y-o/2,0]:[i.x-o/2,i.y,0],radius:a-k1,height:1.5}),(0,_C.cylinder)({center:t?[i.x,i.y+o/2,0]:[i.x+o/2,i.y,0],radius:a-k1,height:1.5}));return(0,G7.colorize)(l_.copper,(0,KB.subtract)((0,KB.union)(c,u,A,f,p),v))}else throw new Error(`Unsupported plated hole shape: ${i.shape}`)},F7=ZI(R7()),Y6e=ZI(Lle()),IOt=ZI(Rle());function V6e(i,e){return Array.isArray(e)?[i.a*e[0]+i.c*e[1]+i.e,i.b*e[0]+i.d*e[1]+i.f]:{x:i.a*e.x+i.c*e.y+i.e,y:i.b*e.x+i.d*e.y+i.f}}function g9(i,e=0){return{a:1,c:0,e:i,b:0,d:1,f:e}}function K6e(...i){i=Array.isArray(i[0])?i[0]:i;const e=(t,n)=>({a:t.a*n.a+t.c*n.b,c:t.a*n.c+t.c*n.d,e:t.a*n.e+t.c*n.f+t.e,b:t.b*n.a+t.d*n.b,d:t.b*n.c+t.d*n.d,f:t.b*n.e+t.d*n.f+t.f});switch(i.length){case 0:throw new Error("no matrices provided");case 1:return i[0];case 2:return e(i[0],i[1]);default:{const[t,n,...r]=i,a=e(t,n);return K6e(a,...r)}}}function j6e(...i){return K6e(...i)}var{cos:EOt,sin:_Ot}=Math;function J6e(i,e,t){const n=EOt(i),r=_Ot(i);return{a:n,c:-r,e:0,b:r,d:n,f:0}}function xOt(i,e){function t(){this.constructor=i}t.prototype=e.prototype,i.prototype=new t}function k7(i,e,t,n){var r=Error.call(this,i);return Object.setPrototypeOf&&Object.setPrototypeOf(r,k7.prototype),r.expected=e,r.found=t,r.location=n,r.name="SyntaxError",r}xOt(k7,Error);function Vle(i,e,t){return t=t||" ",i.length>e?i:(e-=i.length,t+=t.repeat(e),i+t.slice(0,e))}k7.prototype.format=function(i){var e="Error: "+this.message;if(this.location){var t=null,n;for(n=0;n<i.length;n++)if(i[n].source===this.location.source){t=i[n].text.split(/\r\n|\n|\r/g);break}var r=this.location.start,a=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(r):r,o=this.location.source+":"+a.line+":"+a.column;if(t){var s=this.location.end,l=Vle("",a.line.toString().length," "),c=t[r.line-1],u=r.line===s.line?s.column:c.length+1,A=u-r.column||1;e+=`
|
|
13078
|
+
`).replace(/d 0\./g,"d 1."),A=c.replace(/newmtl[\s\S]*?endmtl/g,""),f=new j7t;f.setMaterialOptions({invertTrProperty:!0});const p=f.parse(u.replace(/Kd\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/g,"Kd $2 $2 $2"),"test.mtl"),v=new eOt;return v.setMaterials(p),v.parse(A)}catch(l){return l}}function o(){if(n.has(i)){const l=n.get(i);return l.result?Promise.resolve(l.result.clone()):l.promise.then(c=>c.clone())}const s=a().then(l=>(l instanceof Error||n.set(i,{...n.get(i),result:l}),l));return n.set(i,{promise:s,result:null}),s}return o().then(s=>{r||t(s)}).catch(s=>{console.error(s)}),()=>{r=!0}},[i]),e}function nOt({url:i,position:e,rotation:t,onHover:n,onUnhover:r,isHovered:a}){const o=tOt(i);return o?o instanceof Error?ht.jsx(o4,{isHovered:a,onHover:n,onUnhover:r,children:ht.jsxs("mesh",{position:e,children:[ht.jsx("boxGeometry",{args:[.5,.5,.5]}),ht.jsx("meshStandardMaterial",{transparent:!0,color:"red",opacity:.5}),ht.jsx("meshBasicMaterial",{color:"red"})]})}):ht.jsx(o4,{isHovered:a,onHover:n,onUnhover:r,children:ht.jsx("primitive",{rotation:t,position:e,object:o})}):ht.jsx(o4,{isHovered:a,onHover:n,onUnhover:r,children:ht.jsxs("mesh",{position:e,children:[ht.jsx("boxGeometry",{args:[.5,.5,.5]}),ht.jsx("meshStandardMaterial",{transparent:!0,color:"red",opacity:.25})]})})}var iOt=ZI(N6e()),G6e=({jscadPlan:i,positionOffset:e,rotationOffset:t,onHover:n,onUnhover:r,isHovered:a})=>{const{threeGeom:o,material:s}=It.useMemo(()=>{const l=xCe.executeJscadOperations(iOt.default,i),c=vAt(l),u=new O3({vertexColors:!0,side:Ex});return{threeGeom:c,material:u}},[i]);return It.useMemo(()=>{if(a){const l=new Dc(s.color.getHex());s.emissive.copy(l),s.emissive.setRGB(0,0,1),s.emissiveIntensity=.2}else s.emissiveIntensity=0},[a,s]),o?ht.jsx(o4,{isHovered:a,onHover:n,onUnhover:r,position:e,children:ht.jsx("mesh",{geometry:o,material:s,position:e,rotation:t})}):null},{createJSCADRoot:rOt}=Qot(xCe.jscadPlanner),aOt=({positionOffset:i,footprint:e,rotationOffset:t,onHover:n,onUnhover:r,isHovered:a})=>{const o=It.useMemo(()=>{if(!e)return null;const s=[];return rOt(s).render(ht.jsx(VCt,{footprint:e})),s},[e]);return o?ht.jsx(ht.Fragment,{children:o.map((s,l)=>ht.jsx(G6e,{positionOffset:i,rotationOffset:t,jscadPlan:s,onHover:n,onUnhover:r,isHovered:a},l))}):null},oOt=(...i)=>i,F6e=({cad_component:i,circuitJson:e})=>{const[t,n]=It.useState(!1),[r,a]=It.useState(null),o=It.useCallback(f=>{f!=null&&f.mousePosition?(n(!0),a(f.mousePosition)):(n(!1),a(null))},[]),s=It.useCallback(()=>{n(!1),a(null)},[]),l=It.useMemo(()=>{var f;return(f=Gy(e).source_component.getUsing({source_component_id:i.source_component_id}))==null?void 0:f.name},[e,i.source_component_id]),c=i.model_obj_url??i.model_stl_url,u=i.rotation?oOt(i.rotation.x*Math.PI/180,i.rotation.y*Math.PI/180,i.rotation.z*Math.PI/180):void 0;let A=null;return c?A=ht.jsx(nOt,{url:c,position:i.position?[i.position.x,i.position.y,i.position.z]:void 0,rotation:u,onHover:o,onUnhover:s,isHovered:t},i.cad_component_id):i.model_jscad?A=ht.jsx(G6e,{jscadPlan:i.model_jscad,rotationOffset:u,onHover:o,onUnhover:s,isHovered:t},i.cad_component_id):i.footprinter_string&&(A=ht.jsx(aOt,{positionOffset:i.position?[i.position.x,i.position.y,i.position.z]:void 0,rotationOffset:u,footprint:i.footprinter_string,onHover:o,onUnhover:s,isHovered:t})),ht.jsxs(ht.Fragment,{children:[A,t&&r?ht.jsx(xRe,{position:r,style:{fontFamily:"sans-serif",transform:"translate3d(50%, 50%, 0)",backgroundColor:"white",padding:"5px",borderRadius:"3px",pointerEvents:"none",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},children:l??"<unknown>"}):null]})},sOt={version:"0.0.288"};typeof window<"u"&&(window.TSCI_MAIN_CAMERA_ROTATION=new hB(0,0,0));function lOt(i,e){const t=new H_().setFromEuler(new hB(i.x,i.y,i.z)),n=new ei(0,0,1);return n.applyQuaternion(t),n.multiplyScalar(e)}var cOt=({})=>{const i=It.useRef();return It.useRef({lastRotation:new hB}),gT((e,t)=>{if(!i.current)return;const n=window.TSCI_MAIN_CAMERA_ROTATION,r=lOt(n,2);e.camera.position.copy(r),e.camera.lookAt(0,0,0)}),ht.jsxs("mesh",{ref:i,rotation:[Math.PI/2,0,0],children:[ht.jsx("boxGeometry",{args:[1,1,1]}),ht.jsx("meshStandardMaterial",{color:"white"}),ht.jsx(Z2,{position:[0,0,.51],fontSize:.25,color:"black",children:"Front"}),ht.jsx(Z2,{position:[0,0,-.51],fontSize:.25,color:"black",rotation:[0,Math.PI,0],children:"Back"}),ht.jsx(Z2,{position:[.51,0,0],fontSize:.25,color:"black",rotation:[0,Math.PI/2,0],children:"Right"}),ht.jsx(Z2,{position:[-.51,0,0],fontSize:.25,color:"black",rotation:[0,-Math.PI/2,0],children:"Left"}),ht.jsx(Z2,{position:[0,.51,0],fontSize:.25,color:"black",rotation:[-Math.PI/2,0,0],children:"Top"}),ht.jsx(Z2,{position:[0,-.51,0],fontSize:.25,color:"black",rotation:[Math.PI/2,0,0],children:"Bottom"}),ht.jsx("lineSegments",{args:[new lK(new zw(1,1,1))],material:new XE({color:0,linewidth:2})})]})},uOt=()=>(gT(({camera:i})=>{window.TSCI_MAIN_CAMERA_ROTATION=i.rotation}),ht.jsx(ht.Fragment,{})),k6e=It.forwardRef(({children:i,initialCameraPosition:e=[5,5,5],autoRotateDisabled:t,clickToInteractEnabled:n=!1,boardDimensions:r},a)=>{const[o,s]=It.useState(!n),l=It.useMemo(()=>{if(!r)return 10;const c=r.width??0,u=r.height??0,f=Math.max(c,u)*1.5;return f>10?f:10},[r]);return ht.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[ht.jsx("div",{style:{position:"absolute",top:0,left:0,width:120,height:120},children:ht.jsxs(IRe,{camera:{up:[0,0,1],position:[1,1,1]},style:{zIndex:10},children:[ht.jsx("ambientLight",{intensity:Math.PI/2}),ht.jsx(cOt,{})]})}),ht.jsxs(IRe,{scene:{up:[0,0,1]},camera:{up:[0,0,1],position:e},children:[ht.jsx(uOt,{}),o&&ht.jsx(nEt,{autoRotate:!t,autoRotateSpeed:1}),ht.jsx("ambientLight",{intensity:Math.PI/2}),ht.jsx("pointLight",{position:[-10,-10,10],decay:0,intensity:Math.PI/4}),ht.jsx(rEt,{rotation:[Math.PI/2,0,0],infiniteGrid:!0,cellSize:1,sectionSize:l,args:[l,l]}),ht.jsx("object3D",{ref:a,children:i})]}),ht.jsxs("div",{style:{position:"absolute",right:24,bottom:24,fontFamily:"sans-serif",color:"white",WebkitTextStroke:"0.5px rgba(0, 0, 0, 0.5)",fontSize:11},children:["@",sOt.version]}),n&&!o&&ht.jsx("button",{type:"button",onClick:()=>s(!0),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&s(!0)},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center"},children:ht.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",fontFamily:"sans-serif",pointerEvents:"none"},children:"Click to Interact"})})]})}),AOt=i=>It.useMemo(()=>{if(!i)return;const e=new FGt;return e.add(i),e.render(),e.getCircuitJson()},[i]);function dOt(i){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>{e(n.result)},n.onerror=t,n.readAsDataURL(i)})}var fOt=i=>{const[e,t]=It.useState([]),[n,r]=It.useState(!0);return It.useEffect(()=>{if(!i)return;(async()=>{r(!0);const s=(Array.isArray(i)?i:[i]).map(async l=>{const c=WGt.serialize({binary:!0},[l]),u=new Blob(c);return{stlUrl:await dOt(u),color:l.color}});try{const l=await Promise.all(s);t(l)}catch(l){console.error("Error generating STLs:",l),t([])}finally{r(!1)}})()},[i]),{stls:e,loading:n}},hOt=ZI(KD()),pOt=ZI($T()),nv=.01,l_={copper:[.9,.6,.2],fr4Green:[5/255,163/255,46/255],fr4GreenSolderWithMask:[0/255,152/255,19/255],fr1Copper:[.8,.4,.2],fr1CopperSolderWithMask:[.9,.6,.2]},$Q=.001,ZS=32,gOt=.035,P7=50,Yle={fr1:l_.fr1Copper,fr4:l_.fr4Green},L6e={fr1:l_.fr1CopperSolderWithMask,fr4:l_.fr4GreenSolderWithMask},mOt=ZI(R7()),yOt=ZI(KD()),vOt=ZI(U7()),O6e=i=>{let e=0;for(let n=0;n<i.length;n++){const r=(n+1)%i.length;e+=i[n][0]*i[r][1],e-=i[r][0]*i[n][1]}return e/2<=0},z6e=(i,e=1.2)=>{const{outline:t}=i;let n=t.map(o=>[o.x,o.y]);O6e(n)&&(n=n.reverse());const r=(0,yOt.polygon)({points:n});let a=(0,mOt.extrudeLinear)({height:e},r);return a=(0,vOt.translate)([0,0,-e/2],a),a},COt=i=>{const e=Gy(i).pcb_board.list()[0];if(!e)return console.warn("No pcb_board found for simplified geometry"),[];let t;const n=1.2;e.outline&&e.outline.length>0?t=z6e({outline:e.outline},n):t=(0,hOt.cuboid)({size:[e.width,e.height,n],center:[e.center.x,e.center.y,0]});const r=Yle[e.material]??l_.fr4Green;return[(0,pOt.colorize)(r,t)]},AM=ZI(U7()),Dx=ZI(KD()),jD=ZI($T()),dM=ZI(Fle()),_C=ZI(KD()),G7=ZI($T()),KB=ZI(Fle()),k1=.05,H6e=(i,e)=>{if(i.shape||(i.shape="circle"),i.shape==="circle")return(0,G7.colorize)(l_.copper,(0,KB.subtract)((0,KB.union)((0,_C.cylinder)({center:[i.x,i.y,0],radius:i.hole_diameter/2,height:e.pcbThickness}),(0,_C.cylinder)({center:[i.x,i.y,e.pcbThickness/2+k1/2+nv],radius:i.outer_diameter/2,height:k1}),(0,_C.cylinder)({center:[i.x,i.y,-e.pcbThickness/2-k1/2-nv],radius:i.outer_diameter/2,height:k1})),(0,_C.cylinder)({center:[i.x,i.y,0],radius:i.hole_diameter/2-nv,height:1.5})));if(i.shape==="circular_hole_with_rect_pad"){const t=i.rect_pad_width||i.hole_diameter,n=i.rect_pad_height||i.hole_diameter;return(0,G7.colorize)(l_.copper,(0,KB.subtract)((0,KB.union)((0,_C.cuboid)({center:[i.x,i.y,1.2/2],size:[t,n,k1]}),(0,_C.cuboid)({center:[i.x,i.y,-1.2/2],size:[t,n,k1]}),(0,_C.cylinder)({center:[i.x,i.y,0],radius:i.hole_diameter/2,height:1.2})),(0,_C.cylinder)({center:[i.x,i.y,0],radius:Math.max(i.hole_diameter/2-nv,.01),height:1.5})))}if(i.shape==="pill"){const t=i.hole_height>i.hole_width,n=t?i.hole_height:i.hole_width,r=t?i.hole_width:i.hole_height,a=t?i.outer_height||r+.2:i.outer_width||n+.2,o=t?i.outer_width||n+.2:i.outer_height||r+.2,s=r/2,l=o/2,c=Math.abs(n-r),u=Math.abs(a-o),A=(0,_C.cuboid)({center:[i.x,i.y,0],size:t?[r,c,e.pcbThickness]:[c,r,e.pcbThickness]}),f=(0,_C.cylinder)({center:t?[i.x,i.y-c/2,0]:[i.x-c/2,i.y,0],radius:s,height:e.pcbThickness}),p=(0,_C.cylinder)({center:t?[i.x,i.y+c/2,0]:[i.x+c/2,i.y,0],radius:s,height:e.pcbThickness}),v=(0,KB.union)(A,f,p),B=e.pcbThickness/2+k1/2+nv,x=(0,_C.cuboid)({center:[i.x,i.y,B],size:t?[o,u,k1]:[u,o,k1]}),b=(0,_C.cylinder)({center:t?[i.x,i.y-u/2,B]:[i.x-u/2,i.y,B],radius:l,height:k1}),Q=(0,_C.cylinder)({center:t?[i.x,i.y+u/2,B]:[i.x+u/2,i.y,B],radius:l,height:k1}),R=(0,KB.union)(x,b,Q),k=-e.pcbThickness/2-k1/2-nv,K=(0,_C.cuboid)({center:[i.x,i.y,k],size:t?[o,u,k1]:[u,o,k1]}),Y=(0,_C.cylinder)({center:t?[i.x,i.y-u/2,k]:[i.x-u/2,i.y,k],radius:l,height:k1}),J=(0,_C.cylinder)({center:t?[i.x,i.y+u/2,k]:[i.x+u/2,i.y,k],radius:l,height:k1}),W=(0,KB.union)(K,Y,J),$=(0,_C.cuboid)({center:[i.x,i.y,0],size:t?[r-2*nv,c,e.pcbThickness+2*nv]:[c,r-2*nv,e.pcbThickness+2*nv]}),X=(0,_C.cylinder)({center:t?[i.x,i.y-c/2,0]:[i.x-c/2,i.y,0],radius:s-nv,height:e.pcbThickness+2*nv}),de=(0,_C.cylinder)({center:t?[i.x,i.y+c/2,0]:[i.x+c/2,i.y,0],radius:s-nv,height:e.pcbThickness+2*nv}),ue=(0,KB.union)($,X,de);return(0,G7.colorize)(l_.copper,(0,KB.subtract)((0,KB.union)(v,R,W),ue))}if(i.shape==="pill_hole_with_rect_pad"){const t=i.hole_height>i.hole_width,n=t?i.hole_height:i.hole_width,r=t?i.hole_width:i.hole_height,a=r/2,o=Math.abs(n-r),s=i.rect_pad_width||n+.2,l=i.rect_pad_height||r+.2,c=(0,_C.cuboid)({center:[i.x,i.y,0],size:t?[r,o,1.2]:[o,r,1.2]}),u=(0,_C.cylinder)({center:t?[i.x,i.y-o/2,0]:[i.x-o/2,i.y,0],radius:a,height:1.2}),A=(0,_C.cylinder)({center:t?[i.x,i.y+o/2,0]:[i.x+o/2,i.y,0],radius:a,height:1.2}),f=(0,_C.cuboid)({center:[i.x,i.y,1.2/2],size:[s,l,k1]}),p=(0,_C.cuboid)({center:[i.x,i.y,-1.2/2],size:[s,l,k1]}),v=(0,KB.union)((0,_C.cuboid)({center:[i.x,i.y,0],size:t?[r-k1,o,1.5]:[o,r-k1,1.5]}),(0,_C.cylinder)({center:t?[i.x,i.y-o/2,0]:[i.x-o/2,i.y,0],radius:a-k1,height:1.5}),(0,_C.cylinder)({center:t?[i.x,i.y+o/2,0]:[i.x+o/2,i.y,0],radius:a-k1,height:1.5}));return(0,G7.colorize)(l_.copper,(0,KB.subtract)((0,KB.union)(c,u,A,f,p),v))}else throw new Error(`Unsupported plated hole shape: ${i.shape}`)},F7=ZI(R7()),Y6e=ZI(Lle()),IOt=ZI(Rle());function V6e(i,e){return Array.isArray(e)?[i.a*e[0]+i.c*e[1]+i.e,i.b*e[0]+i.d*e[1]+i.f]:{x:i.a*e.x+i.c*e.y+i.e,y:i.b*e.x+i.d*e.y+i.f}}function g9(i,e=0){return{a:1,c:0,e:i,b:0,d:1,f:e}}function K6e(...i){i=Array.isArray(i[0])?i[0]:i;const e=(t,n)=>({a:t.a*n.a+t.c*n.b,c:t.a*n.c+t.c*n.d,e:t.a*n.e+t.c*n.f+t.e,b:t.b*n.a+t.d*n.b,d:t.b*n.c+t.d*n.d,f:t.b*n.e+t.d*n.f+t.f});switch(i.length){case 0:throw new Error("no matrices provided");case 1:return i[0];case 2:return e(i[0],i[1]);default:{const[t,n,...r]=i,a=e(t,n);return K6e(a,...r)}}}function j6e(...i){return K6e(...i)}var{cos:EOt,sin:_Ot}=Math;function J6e(i,e,t){const n=EOt(i),r=_Ot(i);return{a:n,c:-r,e:0,b:r,d:n,f:0}}function xOt(i,e){function t(){this.constructor=i}t.prototype=e.prototype,i.prototype=new t}function k7(i,e,t,n){var r=Error.call(this,i);return Object.setPrototypeOf&&Object.setPrototypeOf(r,k7.prototype),r.expected=e,r.found=t,r.location=n,r.name="SyntaxError",r}xOt(k7,Error);function Vle(i,e,t){return t=t||" ",i.length>e?i:(e-=i.length,t+=t.repeat(e),i+t.slice(0,e))}k7.prototype.format=function(i){var e="Error: "+this.message;if(this.location){var t=null,n;for(n=0;n<i.length;n++)if(i[n].source===this.location.source){t=i[n].text.split(/\r\n|\n|\r/g);break}var r=this.location.start,a=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(r):r,o=this.location.source+":"+a.line+":"+a.column;if(t){var s=this.location.end,l=Vle("",a.line.toString().length," "),c=t[r.line-1],u=r.line===s.line?s.column:c.length+1,A=u-r.column||1;e+=`
|
|
13079
13079
|
--> `+o+`
|
|
13080
13080
|
`+l+` |
|
|
13081
13081
|
`+a.line+" | "+c+`
|
|
@@ -13717,8 +13717,8 @@ $1`).replace(/>(\s*)(?=<!--\s*\/)/g,"> ")}return Lue}vZt();function hze(i,e,t,n=
|
|
|
13717
13717
|
&:hover {
|
|
13718
13718
|
background-color: rgba(255, 255, 255, 0.1);
|
|
13719
13719
|
}
|
|
13720
|
-
`,onClick:n=>{n.stopPropagation(),t()},children:[ht.jsx("input",{type:"checkbox",checked:e}),ht.jsx("span",{style:{color:"#eee"},children:i})]}),K$t=({children:i,elements:e})=>{const[t,n]=UE(W=>[W.is_mouse_over_container,W.setIsMouseOverContainer]),[r,a]=It.useState(!1),[o,s]=It.useState(!1),[l,c]=It.useState(!1),[u,A]=UE(W=>[W.selected_layer,W.selectLayer]),[f,p,v,B,x,b]=UE(W=>[W.in_move_footprint_mode,W.in_draw_trace_mode,W.is_showing_rats_nest,W.is_showing_multiple_traces_length,W.is_showing_autorouting,W.is_showing_drc_errors]),Q=UE(W=>W.setEditMode),R=UE(W=>W.setIsShowingRatsNest),k=UE(W=>W.setIsShowingMultipleTracesLength),K=UE(W=>W.setIsShowingAutorouting),Y=UE(W=>W.setIsShowingDrcErrors);Q9("1",()=>A("top")),Q9("2",()=>A("bottom")),Q9("3",()=>A("inner1")),Q9("4",()=>A("inner2")),Q9("5",()=>A("inner3")),Q9("6",()=>A("inner4")),Q9("7",()=>A("inner5")),Q9("8",()=>A("inner6"));const J=(e==null?void 0:e.filter(W=>W.type.includes("error")).length)??0;return ht.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>{n(!0)},onMouseLeave:W=>{n(!1),s(!1)},children:[i,ht.jsxs("div",{style:{position:"absolute",bottom:4,right:8,pointerEvents:"none",color:"white",fontSize:11,opacity:t?.5:0,transition:"opacity 1s",transitionDelay:"2s",fontFamily:"sans-serif"},children:["@tscircuit/pcb-viewer@",Y$t.version]}),ht.jsxs("div",{style:{position:"absolute",opacity:t?1:0,top:16,left:16,transition:t?"opacity 100ms linear":"opacity 1s linear",zIndex:Nx.toolbarOverlay,color:"red",display:"flex",fontSize:12,height:100,fontFamily:"sans-serif"},children:[ht.jsxs(yR,{onClick:()=>{s(!o)},onMouseLeave:()=>{o&&s(!1)},children:[ht.jsxs("div",{children:["layer:"," ",ht.jsx("span",{style:{marginLeft:2,fontWeight:500,color:mR[u]},children:u})]}),o&&ht.jsx("div",{style:{marginTop:4,minWidth:120},children:IAe.map(W=>W.replace(/-/g,"")).map(W=>ht.jsx(V$t,{name:W,selected:W===u,onClick:()=>{A(W.replace(/-/,""))}},W))})]}),ht.jsxs(yR,{style:J>0?{color:"red"}:{},onClick:()=>c(!l),onMouseLeave:()=>c(!1),children:[ht.jsxs("div",{children:[J," errors"]}),l&&ht.jsx("div",{style:{display:"grid",gridTemplateColumns:"100px 300px"},children:e==null?void 0:e.filter(W=>W.type.includes("error")).map((W,$)=>ht.jsxs(It.Fragment,{children:[ht.jsx("div",{children:W.error_type}),ht.jsx("div",{children:W.message})]},$))})]}),ht.jsx(yR,{style:{},onClick:()=>{Q(p?"off":"draw_trace")},children:ht.jsxs("div",{children:[p?"✖ ":"","Edit Traces"]})}),ht.jsx(yR,{style:{},onClick:()=>{Q(f?"off":"move_footprint")},children:ht.jsxs("div",{children:[f?"✖ ":"","Move Components"]})}),ht.jsx(yR,{style:{},onClick:()=>{R(!v)},children:ht.jsxs("div",{children:[v?"✖ ":"","Rats Nest"]})}),ht.jsx(yR,{onClick:()=>{a(!r)},children:ht.jsxs("div",{children:[ht.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:["View"," ",ht.jsx("span",{style:{fontSize:"8px",transform:r?"rotate(180deg)":"rotate(0)",transition:"transform 0.1s ease",display:"inline-block"},children:"▼"})]}),r&&ht.jsxs("div",{style:{marginTop:4,minWidth:120},children:[ht.jsx(SAe,{label:"Show All Trace Lengths",checked:B,onClick:()=>{k(!B)}}),ht.jsx(SAe,{label:"Show Autorouting Animation",checked:x,onClick:()=>{K(!x)}}),ht.jsx(SAe,{label:"Show DRC Errors",checked:b,onClick:()=>{Y(!b)}})]})]})})]})]})},j$t=i=>{const{transform:e,elements:t}=i,[n,r]=It.useMemo(()=>{const c=i.elements.flatMap(A=>r$t(A,i.elements)),u=qQ(i.elements);return[c,u]},[i.elements]),[a,o]=It.useState({drawingObjectIdsWithMouseOver:new Set,primitiveIdsInMousedOverNet:[]}),s=It.useMemo(()=>n$t({primitivesWithoutInteractionMetadata:n,drawingObjectIdsWithMouseOver:a.drawingObjectIdsWithMouseOver,primitiveIdsInMousedOverNet:a.primitiveIdsInMousedOverNet}),[n,a]),l=It.useCallback(c=>{var f,p;const u=[];for(const v of c)if(v._element){const B=r.getNetConnectedToId("pcb_port_id"in v._element?(f=v._element)==null?void 0:f.pcb_port_id:"pcb_trace_id"in v._element?(p=v._element)==null?void 0:p.pcb_trace_id:"");u.push(...r.getIdsConnectedToNet(B))}const A=new Set(c.map(v=>v._pcb_drawing_object_id));o({drawingObjectIdsWithMouseOver:A,primitiveIdsInMousedOverNet:u})},[r]);return ht.jsx(z$t,{elements:t,transform:e,primitives:n,onMouseHoverOverPrimitives:l,children:ht.jsx(B$t,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:ht.jsx(w$t,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:ht.jsx(_$t,{transform:e,focusOnHover:i.focusOnHover,children:ht.jsx(K$t,{elements:t,children:ht.jsx(R$t,{transform:e,elements:t,children:ht.jsx(H$t,{transform:e,soup:t,children:ht.jsx(I$t,{transform:e,debugGraphics:i.debugGraphics,children:ht.jsx(E$t,{transform:e,elements:t,children:ht.jsx(C$t,{transform:e,primitives:s,width:i.width,height:i.height,grid:i.grid})})})})})})})})})})},J$t=Fd(Dh(400,300),JE(40,-40)),q$t=({circuitJson:i,debugGraphics:e,height:t=600,initialState:n,allowEditing:r=!0,editEvents:a,onEditEventsChanged:o,focusOnHover:s=!1,clickToInteractEnabled:l=!1})=>{const[c,u]=It.useState(!l),[A,f]=BAe(),[p,v]=It.useState(J$t),{ref:B,setTransform:x,cancelDrag:b}=t$t({transform:p,onSetTransform:v,enabled:c});let[Q,R]=It.useState([]);Q=a??Q;const k=It.useRef(!1),K=It.useRef(null),Y=`${(i==null?void 0:i.length)||0}_${(i==null?void 0:i.editCount)||0}`,J=()=>{const ue=(f==null?void 0:f.width)>0?f:{width:500,height:500},{center:ge,width:be,height:Qe}=$.some(Ie=>Ie.type.startsWith("pcb_"))?VXt($.filter(Ie=>Ie.type.startsWith("pcb_"))):{center:{x:0,y:0},width:.001,height:.001},ve=Math.min((ue.width??0)/be,(ue.height??0)/Qe,100)*.75,Be=Fd(Dh((ue.width??0)/2,(ue.height??0)/2),JE(ve,-ve,0,0),Dh(-ge.x,-ge.y));x(Be)};It.useEffect(()=>{f!=null&&f.width&&i&&i.length!==0&&(k.current||(J(),k.current=!0))},[i,f]);const W=It.useMemo(()=>(i==null?void 0:i.filter(ue=>ue.type.startsWith("pcb_")||ue.type.startsWith("source_")))??[],[Y]),$=It.useMemo(()=>rqt({circuitJson:W,editEvents:Q}),[W,Q]),X=ue=>{R([...Q,ue]),o==null||o([...Q,ue])},de=ue=>{const ge=Q.map(be=>be.edit_event_id===ue.edit_event_id?{...be,...ue}:be);R(ge),o==null||o(ge)};return ht.jsxs("div",{ref:B,style:{position:"relative"},children:[ht.jsx("div",{ref:A,children:ht.jsxs(jXt,{initialState:n,children:[ht.jsx(j$t,{transform:p,height:t,width:f.width,allowEditing:r,focusOnHover:s,cancelPanDrag:b,onCreateEditEvent:X,onModifyEditEvent:de,grid:{spacing:1,view_window:{left:0,right:f.width||500,top:t,bottom:0}},elements:$,debugGraphics:e},f.width),ht.jsx(qXt,{})]})}),l&&!c&&ht.jsx("div",{onClick:()=>{u(!0),J()},onTouchStart:ue=>{const ge=ue.touches[0];K.current={x:ge.clientX,y:ge.clientY}},onTouchEnd:ue=>{const ge=ue.changedTouches[0],be=K.current;if(!be)return;const Qe=Math.abs(ge.clientX-be.x),ve=Math.abs(ge.clientY-be.y);Qe<10&&ve<10&&(ue.preventDefault(),u(!0),J()),K.current=null},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:Nx.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",touchAction:"pan-x pan-y pinch-zoom"},children:ht.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",pointerEvents:"none"},children:typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)?"Touch to Interact":"Click to Interact"})})]})};const Z$t=({containerClassName:i,...e})=>{const t=It.useRef(null),[n,r]=It.useState(620);return It.useLayoutEffect(()=>{const a=()=>{if(t.current){const s=t.current.clientHeight,l=window.innerHeight;r(Math.min(Math.max(s,620),l))}};a();const o=new ResizeObserver(a);return t.current&&o.observe(t.current),window.addEventListener("resize",a),()=>{o.disconnect(),window.removeEventListener("resize",a)}},[]),ht.jsx("div",{ref:t,className:i||"rf-w-full rf-h-full",children:ht.jsx(q$t,{...e,height:n})})},W$t='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-2\\.5{top:.625rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.\\!rf-z-\\[101\\]{z-index:101!important}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.-rf-mx-1,.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-mx-auto{margin-left:auto;margin-right:auto}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-12{margin-bottom:3rem;margin-top:3rem}.rf-my-4{margin-bottom:1rem;margin-top:1rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-1{margin-bottom:.25rem}.rf-mb-12{margin-bottom:3rem}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-mb-6{margin-bottom:1.5rem}.rf-mb-8{margin-bottom:2rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mt-0{margin-top:0}.rf-mt-0\\.5{margin-top:.125rem}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-3{margin-top:.75rem}.rf-mt-4{margin-top:1rem}.rf-mt-5{margin-top:1.25rem}.rf-mt-auto{margin-top:auto}.rf-block{display:block}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-hidden{display:none}.rf-aspect-square{aspect-ratio:1/1}.rf-aspect-video{aspect-ratio:16/9}.rf-size-14{height:3.5rem;width:3.5rem}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-12{height:3rem}.rf-h-2{height:.5rem}.rf-h-2\\.5{height:.625rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-5{height:1.25rem}.rf-h-6{height:1.5rem}.rf-h-60{height:15rem}.rf-h-64{height:16rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[400px\\]{height:400px}.rf-h-\\[620px\\]{height:620px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[calc\\(100vh-96px\\)\\]{height:calc(100vh - 96px)}.rf-h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.\\!rf-max-h-\\[40vh\\]{max-height:40vh!important}.rf-max-h-32{max-height:8rem}.rf-max-h-96{max-height:24rem}.rf-max-h-\\[500px\\]{max-height:500px}.rf-max-h-\\[90vh\\]{max-height:90vh}.rf-max-h-full{max-height:100%}.rf-min-h-0{min-height:0}.rf-min-h-\\[200px\\]{min-height:200px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.rf-w-1{width:.25rem}.rf-w-1\\/2{width:50%}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-12{width:3rem}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-2\\.5{width:.625rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-48{width:12rem}.rf-w-5{width:1.25rem}.rf-w-6{width:1.5rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-\\[95\\%\\]{width:95%}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-min-w-0{min-width:0}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-\\[148px\\]{min-width:148px}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.\\!rf-max-w-\\[660px\\]{max-width:660px!important}.rf-max-w-2xl{max-width:42rem}.rf-max-w-3xl{max-width:48rem}.rf-max-w-4xl{max-width:56rem}.rf-max-w-5xl{max-width:64rem}.rf-max-w-full{max-width:100%}.rf-max-w-lg{max-width:32rem}.rf-max-w-md{max-width:28rem}.rf-max-w-none{max-width:none}.rf-max-w-xl{max-width:36rem}.rf-flex-1{flex:1 1 0%}.rf-flex-shrink-0,.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.rf-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes rf-pulse{50%{opacity:.5}}.rf-animate-pulse{animation:rf-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-not-allowed{cursor:not-allowed}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-flex-row{flex-direction:row}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-flex-wrap{flex-wrap:wrap}.rf-place-items-center{place-items:center}.rf-items-start{align-items:flex-start}.rf-items-end{align-items:flex-end}.rf-items-center{align-items:center}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-gap-8{gap:2rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.rf-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.rf-overflow-auto{overflow:auto}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.\\!rf-overflow-y-auto{overflow-y:auto!important}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-overflow-x-clip{overflow-x:clip}.rf-truncate{overflow:hidden;text-overflow:ellipsis}.rf-truncate,.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-break-words{overflow-wrap:break-word}.rf-rounded{border-radius:.25rem}.rf-rounded-2xl{border-radius:1rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-rounded-xl{border-radius:.75rem}.rf-border{border-width:1px}.rf-border-b{border-bottom-width:1px}.rf-border-t{border-top-width:1px}.rf-border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.rf-border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.rf-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-input{border-color:hsl(var(--input))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-orange-200{--tw-border-opacity:1;border-color:rgb(254 215 170/var(--tw-border-opacity,1))}.rf-border-primary{border-color:hsl(var(--primary))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-bg-background{background-color:hsl(var(--background))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.rf-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.rf-bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity,1))}.rf-bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.rf-bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-muted{background-color:hsl(var(--muted))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-orange-50{--tw-bg-opacity:1;background-color:rgb(255 247 237/var(--tw-bg-opacity,1))}.rf-bg-popover{background-color:hsl(var(--popover))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-fill-current{fill:currentColor}.rf-object-contain{-o-object-fit:contain;object-fit:contain}.rf-object-cover{-o-object-fit:cover;object-fit:cover}.\\!rf-p-0{padding:0!important}.rf-p-0{padding:0}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-p-8{padding:2rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-12{padding-bottom:3rem;padding-top:3rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-py-3{padding-bottom:.75rem;padding-top:.75rem}.rf-py-4{padding-bottom:1rem;padding-top:1rem}.rf-py-8{padding-bottom:2rem;padding-top:2rem}.rf-pb-0{padding-bottom:0}.rf-pb-2{padding-bottom:.5rem}.rf-pb-3{padding-bottom:.75rem}.rf-pb-4{padding-bottom:1rem}.rf-pl-2{padding-left:.5rem}.rf-pl-4{padding-left:1rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-pt-2{padding-top:.5rem}.rf-pt-4{padding-top:1rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-text-right{text-align:right}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-3xl{font-size:1.875rem;line-height:2.25rem}.rf-text-\\[8px\\]{font-size:8px}.rf-text-base{font-size:1rem;line-height:1.5rem}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xl{font-size:1.25rem;line-height:1.75rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-uppercase{text-transform:uppercase}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-leading-none{line-height:1}.rf-leading-relaxed{line-height:1.625}.rf-leading-tight{line-height:1.25}.rf-tracking-wide{letter-spacing:.025em}.rf-tracking-widest{letter-spacing:.1em}.rf-text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.rf-text-blue-800{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.rf-text-blue-900{--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.rf-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-green-900{--tw-text-opacity:1;color:rgb(20 83 45/var(--tw-text-opacity,1))}.rf-text-muted-foreground{color:hsl(var(--muted-foreground))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.rf-text-orange-600{--tw-text-opacity:1;color:rgb(234 88 12/var(--tw-text-opacity,1))}.rf-text-orange-800{--tw-text-opacity:1;color:rgb(154 52 18/var(--tw-text-opacity,1))}.rf-text-popover-foreground{color:hsl(var(--popover-foreground))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.rf-text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.rf-text-yellow-900{--tw-text-opacity:1;color:rgb(113 63 18/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-line-through{text-decoration-line:line-through}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-opacity-75{opacity:.75}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.rf-ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.rf-ring-primary{--tw-ring-color:hsl(var(--primary))}.rf-ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-200{transition-duration:.2s}.rf-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-200{animation-duration:.2s}.rf-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.file\\:rf-border-0::file-selector-button{border-width:0}.file\\:rf-bg-transparent::file-selector-button{background-color:transparent}.file\\:rf-text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:rf-font-medium::file-selector-button{font-weight:500}.placeholder\\:rf-text-zinc-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.placeholder\\:rf-text-zinc-500::placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.hover\\:rf-border-blue-300:hover{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-gray-100:focus{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-gray-900:focus{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus\\:rf-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:rf-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:rf-ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\\:rf-ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom]{--tw-translate-y:0.25rem}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom],.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{--tw-translate-x:-0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right]{--tw-translate-x:0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right],.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{--tw-translate-y:-0.25rem}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-text-left{text-align:left}}@media (min-width:768px){.md\\:rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\\[\\&\\>span\\]\\:rf-line-clamp-1>span{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',X$t=()=>{It.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=W$t,document.head.appendChild(e)},[])},$$t=i=>{It.useEffect(()=>(i?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[i])},wYe=i=>`hsl(${Bb.indexOf(i)*137.5%360}, 70%, 50%)`,een=({phaseTimings:i})=>{if(!i)return null;const e=Object.values(i).reduce((t,n)=>t+n,0);return ht.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[ht.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:Bb.map(t=>{const n=i[t]||0,r=n/e*100;return ht.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${r}%`,backgroundColor:wYe(t)},children:ht.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[t,": ",n.toFixed(1),"ms"]})},t)})}),ht.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},ten=({renderLog:i})=>{const[e,t]=It.useState("chronological");if(!i)return ht.jsx("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:"No render log, make sure this tab is open when you render (TODO add a rerender button here)"});const n=Object.entries((i==null?void 0:i.phaseTimings)??{});e==="chronological"?n.sort((a,o)=>Bb.indexOf(a[0])-Bb.indexOf(o[0])):n.sort((a,o)=>o[1]-a[1]);const r=n.reduce((a,[o,s])=>a+s,0);return ht.jsxs("div",{className:"rf-bg-white",children:[ht.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[ht.jsx("div",{children:"Render Logs"}),ht.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[ht.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),ht.jsxs("select",{value:e,onChange:a=>t(a.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[ht.jsx("option",{value:"chronological",children:"Phase Order"}),ht.jsx("option",{value:"longest",children:"Duration"})]})]})]}),ht.jsx(een,{phaseTimings:i.phaseTimings}),ht.jsxs("table",{className:"rf-w-full rf-text-xs",children:[ht.jsx("thead",{children:ht.jsxs("tr",{children:[ht.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),ht.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),ht.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),ht.jsx("tbody",{children:n.map(([a,o])=>ht.jsxs("tr",{children:[ht.jsx("td",{className:"rf-p-2",children:Bb.indexOf(a)}),ht.jsx("td",{className:"rf-p-2",children:a}),ht.jsx("td",{className:"rf-p-2",children:ht.jsx("div",{className:"rf-w-8",children:ht.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:wYe(a),width:`${o/r*100}%`}})})}),ht.jsx("td",{className:"rf-p-2",children:ht.jsxs("div",{className:"rf-flex w-full",children:[ht.jsxs("span",{className:"rf-flex-grow",children:[o,"ms"]}),ht.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(o/r*100).toFixed(1),"%"]})]})})]},a))})]})]})},nen=({errorMessage:i,errorStack:e,circuitJsonErrors:t})=>{It.useEffect(()=>{if(i){const n=new Error(i);e&&(n.stack=e);try{AU.captureException(n)}catch{}}},[i,e]),It.useEffect(()=>{if(t&&t.length>0)for(const n of t){const r=new Error(n.message||"Circuit JSON Error");n.stack&&(r.stack=n.stack);try{AU.captureException(r,{error_type:n.type})}catch{}}},[t])},ien="0.0.639",QAe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},wAe=new Map,oz=i=>{const e=wAe.get(i);return e?Object.fromEntries(Object.entries(e.stores).map(([t,n])=>[t,n.getState()])):{}},ren=(i,e,t)=>{if(i===void 0)return{type:"untracked",connection:e.connect(t)};const n=wAe.get(t.name);if(n)return{type:"tracked",store:i,...n};const r={connection:e.connect(t),stores:{}};return wAe.set(t.name,r),{type:"tracked",store:i,...r}},aen=(i,e={})=>(t,n,r)=>{const{enabled:a,anonymousActionType:o,store:s,...l}=e;let c;try{c=(a??(QAe?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(QAe?"production":void 0)!=="production"&&a&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),i(t,n,r);const{connection:u,...A}=ren(s,c,l);let f=!0;r.setState=(B,x,b)=>{const Q=t(B,x);if(!f)return Q;const R=b===void 0?{type:o||"anonymous"}:typeof b=="string"?{type:b}:b;return s===void 0?(u==null||u.send(R,n()),Q):(u==null||u.send({...R,type:`${s}/${R.type}`},{...oz(l.name),[s]:r.getState()}),Q)};const p=(...B)=>{const x=f;f=!1,t(...B),f=x},v=i(r.setState,n,r);if(A.type==="untracked"?u==null||u.init(v):(A.stores[A.store]=r,u==null||u.init(Object.fromEntries(Object.entries(A.stores).map(([B,x])=>[B,B===A.store?v:x.getState()])))),r.dispatchFromDevtools&&typeof r.dispatch=="function"){let B=!1;const x=r.dispatch;r.dispatch=(...b)=>{(QAe?"production":void 0)!=="production"&&b[0].type==="__setState"&&!B&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),B=!0),x(...b)}}return u.subscribe(B=>{var x;switch(B.type){case"ACTION":if(typeof B.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return MAe(B.payload,b=>{if(b.type==="__setState"){if(s===void 0){p(b.state);return}Object.keys(b.state).length!==1&&console.error(`
|
|
13720
|
+
`,onClick:n=>{n.stopPropagation(),t()},children:[ht.jsx("input",{type:"checkbox",checked:e}),ht.jsx("span",{style:{color:"#eee"},children:i})]}),K$t=({children:i,elements:e})=>{const[t,n]=UE(W=>[W.is_mouse_over_container,W.setIsMouseOverContainer]),[r,a]=It.useState(!1),[o,s]=It.useState(!1),[l,c]=It.useState(!1),[u,A]=UE(W=>[W.selected_layer,W.selectLayer]),[f,p,v,B,x,b]=UE(W=>[W.in_move_footprint_mode,W.in_draw_trace_mode,W.is_showing_rats_nest,W.is_showing_multiple_traces_length,W.is_showing_autorouting,W.is_showing_drc_errors]),Q=UE(W=>W.setEditMode),R=UE(W=>W.setIsShowingRatsNest),k=UE(W=>W.setIsShowingMultipleTracesLength),K=UE(W=>W.setIsShowingAutorouting),Y=UE(W=>W.setIsShowingDrcErrors);Q9("1",()=>A("top")),Q9("2",()=>A("bottom")),Q9("3",()=>A("inner1")),Q9("4",()=>A("inner2")),Q9("5",()=>A("inner3")),Q9("6",()=>A("inner4")),Q9("7",()=>A("inner5")),Q9("8",()=>A("inner6"));const J=(e==null?void 0:e.filter(W=>W.type.includes("error")).length)??0;return ht.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>{n(!0)},onMouseLeave:W=>{n(!1),s(!1)},children:[i,ht.jsxs("div",{style:{position:"absolute",bottom:4,right:8,pointerEvents:"none",color:"white",fontSize:11,opacity:t?.5:0,transition:"opacity 1s",transitionDelay:"2s",fontFamily:"sans-serif"},children:["@tscircuit/pcb-viewer@",Y$t.version]}),ht.jsxs("div",{style:{position:"absolute",opacity:t?1:0,top:16,left:16,transition:t?"opacity 100ms linear":"opacity 1s linear",zIndex:Nx.toolbarOverlay,color:"red",display:"flex",fontSize:12,height:100,fontFamily:"sans-serif"},children:[ht.jsxs(yR,{onClick:()=>{s(!o)},onMouseLeave:()=>{o&&s(!1)},children:[ht.jsxs("div",{children:["layer:"," ",ht.jsx("span",{style:{marginLeft:2,fontWeight:500,color:mR[u]},children:u})]}),o&&ht.jsx("div",{style:{marginTop:4,minWidth:120},children:IAe.map(W=>W.replace(/-/g,"")).map(W=>ht.jsx(V$t,{name:W,selected:W===u,onClick:()=>{A(W.replace(/-/,""))}},W))})]}),ht.jsxs(yR,{style:J>0?{color:"red"}:{},onClick:()=>c(!l),onMouseLeave:()=>c(!1),children:[ht.jsxs("div",{children:[J," errors"]}),l&&ht.jsx("div",{style:{display:"grid",gridTemplateColumns:"100px 300px"},children:e==null?void 0:e.filter(W=>W.type.includes("error")).map((W,$)=>ht.jsxs(It.Fragment,{children:[ht.jsx("div",{children:W.error_type}),ht.jsx("div",{children:W.message})]},$))})]}),ht.jsx(yR,{style:{},onClick:()=>{Q(p?"off":"draw_trace")},children:ht.jsxs("div",{children:[p?"✖ ":"","Edit Traces"]})}),ht.jsx(yR,{style:{},onClick:()=>{Q(f?"off":"move_footprint")},children:ht.jsxs("div",{children:[f?"✖ ":"","Move Components"]})}),ht.jsx(yR,{style:{},onClick:()=>{R(!v)},children:ht.jsxs("div",{children:[v?"✖ ":"","Rats Nest"]})}),ht.jsx(yR,{onClick:()=>{a(!r)},children:ht.jsxs("div",{children:[ht.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:["View"," ",ht.jsx("span",{style:{fontSize:"8px",transform:r?"rotate(180deg)":"rotate(0)",transition:"transform 0.1s ease",display:"inline-block"},children:"▼"})]}),r&&ht.jsxs("div",{style:{marginTop:4,minWidth:120},children:[ht.jsx(SAe,{label:"Show All Trace Lengths",checked:B,onClick:()=>{k(!B)}}),ht.jsx(SAe,{label:"Show Autorouting Animation",checked:x,onClick:()=>{K(!x)}}),ht.jsx(SAe,{label:"Show DRC Errors",checked:b,onClick:()=>{Y(!b)}})]})]})})]})]})},j$t=i=>{const{transform:e,elements:t}=i,[n,r]=It.useMemo(()=>{const c=i.elements.flatMap(A=>r$t(A,i.elements)),u=qQ(i.elements);return[c,u]},[i.elements]),[a,o]=It.useState({drawingObjectIdsWithMouseOver:new Set,primitiveIdsInMousedOverNet:[]}),s=It.useMemo(()=>n$t({primitivesWithoutInteractionMetadata:n,drawingObjectIdsWithMouseOver:a.drawingObjectIdsWithMouseOver,primitiveIdsInMousedOverNet:a.primitiveIdsInMousedOverNet}),[n,a]),l=It.useCallback(c=>{var f,p;const u=[];for(const v of c)if(v._element){const B=r.getNetConnectedToId("pcb_port_id"in v._element?(f=v._element)==null?void 0:f.pcb_port_id:"pcb_trace_id"in v._element?(p=v._element)==null?void 0:p.pcb_trace_id:"");u.push(...r.getIdsConnectedToNet(B))}const A=new Set(c.map(v=>v._pcb_drawing_object_id));o({drawingObjectIdsWithMouseOver:A,primitiveIdsInMousedOverNet:u})},[r]);return ht.jsx(z$t,{elements:t,transform:e,primitives:n,onMouseHoverOverPrimitives:l,children:ht.jsx(B$t,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:ht.jsx(w$t,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:ht.jsx(_$t,{transform:e,focusOnHover:i.focusOnHover,children:ht.jsx(K$t,{elements:t,children:ht.jsx(R$t,{transform:e,elements:t,children:ht.jsx(H$t,{transform:e,soup:t,children:ht.jsx(I$t,{transform:e,debugGraphics:i.debugGraphics,children:ht.jsx(E$t,{transform:e,elements:t,children:ht.jsx(C$t,{transform:e,primitives:s,width:i.width,height:i.height,grid:i.grid})})})})})})})})})})},J$t=Fd(Dh(400,300),JE(40,-40)),q$t=({circuitJson:i,debugGraphics:e,height:t=600,initialState:n,allowEditing:r=!0,editEvents:a,onEditEventsChanged:o,focusOnHover:s=!1,clickToInteractEnabled:l=!1})=>{const[c,u]=It.useState(!l),[A,f]=BAe(),[p,v]=It.useState(J$t),{ref:B,setTransform:x,cancelDrag:b}=t$t({transform:p,onSetTransform:v,enabled:c});let[Q,R]=It.useState([]);Q=a??Q;const k=It.useRef(!1),K=It.useRef(null),Y=`${(i==null?void 0:i.length)||0}_${(i==null?void 0:i.editCount)||0}`,J=()=>{const ue=(f==null?void 0:f.width)>0?f:{width:500,height:500},{center:ge,width:be,height:Qe}=$.some(Ie=>Ie.type.startsWith("pcb_"))?VXt($.filter(Ie=>Ie.type.startsWith("pcb_"))):{center:{x:0,y:0},width:.001,height:.001},ve=Math.min((ue.width??0)/be,(ue.height??0)/Qe,100)*.75,Be=Fd(Dh((ue.width??0)/2,(ue.height??0)/2),JE(ve,-ve,0,0),Dh(-ge.x,-ge.y));x(Be)};It.useEffect(()=>{f!=null&&f.width&&i&&i.length!==0&&(k.current||(J(),k.current=!0))},[i,f]);const W=It.useMemo(()=>(i==null?void 0:i.filter(ue=>ue.type.startsWith("pcb_")||ue.type.startsWith("source_")))??[],[Y]),$=It.useMemo(()=>rqt({circuitJson:W,editEvents:Q}),[W,Q]),X=ue=>{R([...Q,ue]),o==null||o([...Q,ue])},de=ue=>{const ge=Q.map(be=>be.edit_event_id===ue.edit_event_id?{...be,...ue}:be);R(ge),o==null||o(ge)};return ht.jsxs("div",{ref:B,style:{position:"relative"},children:[ht.jsx("div",{ref:A,children:ht.jsxs(jXt,{initialState:n,children:[ht.jsx(j$t,{transform:p,height:t,width:f.width,allowEditing:r,focusOnHover:s,cancelPanDrag:b,onCreateEditEvent:X,onModifyEditEvent:de,grid:{spacing:1,view_window:{left:0,right:f.width||500,top:t,bottom:0}},elements:$,debugGraphics:e},f.width),ht.jsx(qXt,{})]})}),l&&!c&&ht.jsx("div",{onClick:()=>{u(!0),J()},onTouchStart:ue=>{const ge=ue.touches[0];K.current={x:ge.clientX,y:ge.clientY}},onTouchEnd:ue=>{const ge=ue.changedTouches[0],be=K.current;if(!be)return;const Qe=Math.abs(ge.clientX-be.x),ve=Math.abs(ge.clientY-be.y);Qe<10&&ve<10&&(ue.preventDefault(),u(!0),J()),K.current=null},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:Nx.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",touchAction:"pan-x pan-y pinch-zoom"},children:ht.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",pointerEvents:"none"},children:typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)?"Touch to Interact":"Click to Interact"})})]})};const Z$t=({containerClassName:i,...e})=>{const t=It.useRef(null),[n,r]=It.useState(620);return It.useLayoutEffect(()=>{const a=()=>{if(t.current){const s=t.current.clientHeight,l=window.innerHeight;r(Math.min(Math.max(s,620),l))}};a();const o=new ResizeObserver(a);return t.current&&o.observe(t.current),window.addEventListener("resize",a),()=>{o.disconnect(),window.removeEventListener("resize",a)}},[]),ht.jsx("div",{ref:t,className:i||"rf-w-full rf-h-full",children:ht.jsx(q$t,{...e,height:n})})},W$t='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-2\\.5{top:.625rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.\\!rf-z-\\[101\\]{z-index:101!important}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.-rf-mx-1,.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-mx-auto{margin-left:auto;margin-right:auto}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-12{margin-bottom:3rem;margin-top:3rem}.rf-my-4{margin-bottom:1rem;margin-top:1rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-1{margin-bottom:.25rem}.rf-mb-12{margin-bottom:3rem}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-mb-6{margin-bottom:1.5rem}.rf-mb-8{margin-bottom:2rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mt-0{margin-top:0}.rf-mt-0\\.5{margin-top:.125rem}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-3{margin-top:.75rem}.rf-mt-4{margin-top:1rem}.rf-mt-5{margin-top:1.25rem}.rf-mt-auto{margin-top:auto}.rf-block{display:block}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-hidden{display:none}.rf-aspect-square{aspect-ratio:1/1}.rf-aspect-video{aspect-ratio:16/9}.rf-size-14{height:3.5rem;width:3.5rem}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-12{height:3rem}.rf-h-2{height:.5rem}.rf-h-2\\.5{height:.625rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-5{height:1.25rem}.rf-h-6{height:1.5rem}.rf-h-60{height:15rem}.rf-h-64{height:16rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[400px\\]{height:400px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[calc\\(100vh-96px\\)\\]{height:calc(100vh - 96px)}.rf-h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.\\!rf-max-h-\\[40vh\\]{max-height:40vh!important}.rf-max-h-32{max-height:8rem}.rf-max-h-96{max-height:24rem}.rf-max-h-\\[500px\\]{max-height:500px}.rf-max-h-\\[90vh\\]{max-height:90vh}.rf-max-h-full{max-height:100%}.rf-min-h-0{min-height:0}.rf-min-h-\\[200px\\]{min-height:200px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.rf-w-1{width:.25rem}.rf-w-1\\/2{width:50%}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-12{width:3rem}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-2\\.5{width:.625rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-48{width:12rem}.rf-w-5{width:1.25rem}.rf-w-6{width:1.5rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-\\[95\\%\\]{width:95%}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-min-w-0{min-width:0}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-\\[148px\\]{min-width:148px}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.\\!rf-max-w-\\[660px\\]{max-width:660px!important}.rf-max-w-2xl{max-width:42rem}.rf-max-w-3xl{max-width:48rem}.rf-max-w-4xl{max-width:56rem}.rf-max-w-5xl{max-width:64rem}.rf-max-w-full{max-width:100%}.rf-max-w-lg{max-width:32rem}.rf-max-w-md{max-width:28rem}.rf-max-w-none{max-width:none}.rf-max-w-xl{max-width:36rem}.rf-flex-1{flex:1 1 0%}.rf-flex-shrink-0,.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.rf-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes rf-pulse{50%{opacity:.5}}.rf-animate-pulse{animation:rf-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-not-allowed{cursor:not-allowed}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-flex-row{flex-direction:row}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-flex-wrap{flex-wrap:wrap}.rf-place-items-center{place-items:center}.rf-items-start{align-items:flex-start}.rf-items-end{align-items:flex-end}.rf-items-center{align-items:center}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-gap-8{gap:2rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.rf-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.rf-overflow-auto{overflow:auto}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.\\!rf-overflow-y-auto{overflow-y:auto!important}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-overflow-x-clip{overflow-x:clip}.rf-truncate{overflow:hidden;text-overflow:ellipsis}.rf-truncate,.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-break-words{overflow-wrap:break-word}.rf-rounded{border-radius:.25rem}.rf-rounded-2xl{border-radius:1rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-rounded-xl{border-radius:.75rem}.rf-border{border-width:1px}.rf-border-b{border-bottom-width:1px}.rf-border-t{border-top-width:1px}.rf-border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.rf-border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.rf-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-input{border-color:hsl(var(--input))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-orange-200{--tw-border-opacity:1;border-color:rgb(254 215 170/var(--tw-border-opacity,1))}.rf-border-primary{border-color:hsl(var(--primary))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-bg-background{background-color:hsl(var(--background))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.rf-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.rf-bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity,1))}.rf-bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.rf-bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-muted{background-color:hsl(var(--muted))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-orange-50{--tw-bg-opacity:1;background-color:rgb(255 247 237/var(--tw-bg-opacity,1))}.rf-bg-popover{background-color:hsl(var(--popover))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-fill-current{fill:currentColor}.rf-object-contain{-o-object-fit:contain;object-fit:contain}.rf-object-cover{-o-object-fit:cover;object-fit:cover}.\\!rf-p-0{padding:0!important}.rf-p-0{padding:0}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-p-8{padding:2rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-12{padding-bottom:3rem;padding-top:3rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-py-3{padding-bottom:.75rem;padding-top:.75rem}.rf-py-4{padding-bottom:1rem;padding-top:1rem}.rf-py-8{padding-bottom:2rem;padding-top:2rem}.rf-pb-0{padding-bottom:0}.rf-pb-2{padding-bottom:.5rem}.rf-pb-3{padding-bottom:.75rem}.rf-pb-4{padding-bottom:1rem}.rf-pl-2{padding-left:.5rem}.rf-pl-4{padding-left:1rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-pt-2{padding-top:.5rem}.rf-pt-4{padding-top:1rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-text-right{text-align:right}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-3xl{font-size:1.875rem;line-height:2.25rem}.rf-text-\\[8px\\]{font-size:8px}.rf-text-base{font-size:1rem;line-height:1.5rem}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xl{font-size:1.25rem;line-height:1.75rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-uppercase{text-transform:uppercase}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-leading-none{line-height:1}.rf-leading-relaxed{line-height:1.625}.rf-leading-tight{line-height:1.25}.rf-tracking-wide{letter-spacing:.025em}.rf-tracking-widest{letter-spacing:.1em}.rf-text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.rf-text-blue-800{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.rf-text-blue-900{--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.rf-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-green-900{--tw-text-opacity:1;color:rgb(20 83 45/var(--tw-text-opacity,1))}.rf-text-muted-foreground{color:hsl(var(--muted-foreground))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.rf-text-orange-600{--tw-text-opacity:1;color:rgb(234 88 12/var(--tw-text-opacity,1))}.rf-text-orange-800{--tw-text-opacity:1;color:rgb(154 52 18/var(--tw-text-opacity,1))}.rf-text-popover-foreground{color:hsl(var(--popover-foreground))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.rf-text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.rf-text-yellow-900{--tw-text-opacity:1;color:rgb(113 63 18/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-line-through{text-decoration-line:line-through}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-opacity-75{opacity:.75}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.rf-ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.rf-ring-primary{--tw-ring-color:hsl(var(--primary))}.rf-ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-200{transition-duration:.2s}.rf-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-200{animation-duration:.2s}.rf-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.file\\:rf-border-0::file-selector-button{border-width:0}.file\\:rf-bg-transparent::file-selector-button{background-color:transparent}.file\\:rf-text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:rf-font-medium::file-selector-button{font-weight:500}.placeholder\\:rf-text-zinc-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.placeholder\\:rf-text-zinc-500::placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.hover\\:rf-border-blue-300:hover{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-gray-100:focus{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-gray-900:focus{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus\\:rf-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:rf-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:rf-ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\\:rf-ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom]{--tw-translate-y:0.25rem}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom],.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{--tw-translate-x:-0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right]{--tw-translate-x:0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right],.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{--tw-translate-y:-0.25rem}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-text-left{text-align:left}}@media (min-width:768px){.md\\:rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\\[\\&\\>span\\]\\:rf-line-clamp-1>span{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',X$t=()=>{It.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=W$t,document.head.appendChild(e)},[])},$$t=i=>{It.useEffect(()=>(i?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[i])},wYe=i=>`hsl(${Bb.indexOf(i)*137.5%360}, 70%, 50%)`,een=({phaseTimings:i})=>{if(!i)return null;const e=Object.values(i).reduce((t,n)=>t+n,0);return ht.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[ht.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:Bb.map(t=>{const n=i[t]||0,r=n/e*100;return ht.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${r}%`,backgroundColor:wYe(t)},children:ht.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[t,": ",n.toFixed(1),"ms"]})},t)})}),ht.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},ten=({renderLog:i})=>{const[e,t]=It.useState("chronological");if(!i)return ht.jsx("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:"No render log, make sure this tab is open when you render (TODO add a rerender button here)"});const n=Object.entries((i==null?void 0:i.phaseTimings)??{});e==="chronological"?n.sort((a,o)=>Bb.indexOf(a[0])-Bb.indexOf(o[0])):n.sort((a,o)=>o[1]-a[1]);const r=n.reduce((a,[o,s])=>a+s,0);return ht.jsxs("div",{className:"rf-bg-white",children:[ht.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[ht.jsx("div",{children:"Render Logs"}),ht.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[ht.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),ht.jsxs("select",{value:e,onChange:a=>t(a.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[ht.jsx("option",{value:"chronological",children:"Phase Order"}),ht.jsx("option",{value:"longest",children:"Duration"})]})]})]}),ht.jsx(een,{phaseTimings:i.phaseTimings}),ht.jsxs("table",{className:"rf-w-full rf-text-xs",children:[ht.jsx("thead",{children:ht.jsxs("tr",{children:[ht.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),ht.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),ht.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),ht.jsx("tbody",{children:n.map(([a,o])=>ht.jsxs("tr",{children:[ht.jsx("td",{className:"rf-p-2",children:Bb.indexOf(a)}),ht.jsx("td",{className:"rf-p-2",children:a}),ht.jsx("td",{className:"rf-p-2",children:ht.jsx("div",{className:"rf-w-8",children:ht.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:wYe(a),width:`${o/r*100}%`}})})}),ht.jsx("td",{className:"rf-p-2",children:ht.jsxs("div",{className:"rf-flex w-full",children:[ht.jsxs("span",{className:"rf-flex-grow",children:[o,"ms"]}),ht.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(o/r*100).toFixed(1),"%"]})]})})]},a))})]})]})},nen=({errorMessage:i,errorStack:e,circuitJsonErrors:t})=>{It.useEffect(()=>{if(i){const n=new Error(i);e&&(n.stack=e);try{AU.captureException(n)}catch{}}},[i,e]),It.useEffect(()=>{if(t&&t.length>0)for(const n of t){const r=new Error(n.message||"Circuit JSON Error");n.stack&&(r.stack=n.stack);try{AU.captureException(r,{error_type:n.type})}catch{}}},[t])},ien="0.0.641",QAe={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},wAe=new Map,oz=i=>{const e=wAe.get(i);return e?Object.fromEntries(Object.entries(e.stores).map(([t,n])=>[t,n.getState()])):{}},ren=(i,e,t)=>{if(i===void 0)return{type:"untracked",connection:e.connect(t)};const n=wAe.get(t.name);if(n)return{type:"tracked",store:i,...n};const r={connection:e.connect(t),stores:{}};return wAe.set(t.name,r),{type:"tracked",store:i,...r}},aen=(i,e={})=>(t,n,r)=>{const{enabled:a,anonymousActionType:o,store:s,...l}=e;let c;try{c=(a??(QAe?"production":void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!c)return(QAe?"production":void 0)!=="production"&&a&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),i(t,n,r);const{connection:u,...A}=ren(s,c,l);let f=!0;r.setState=(B,x,b)=>{const Q=t(B,x);if(!f)return Q;const R=b===void 0?{type:o||"anonymous"}:typeof b=="string"?{type:b}:b;return s===void 0?(u==null||u.send(R,n()),Q):(u==null||u.send({...R,type:`${s}/${R.type}`},{...oz(l.name),[s]:r.getState()}),Q)};const p=(...B)=>{const x=f;f=!1,t(...B),f=x},v=i(r.setState,n,r);if(A.type==="untracked"?u==null||u.init(v):(A.stores[A.store]=r,u==null||u.init(Object.fromEntries(Object.entries(A.stores).map(([B,x])=>[B,B===A.store?v:x.getState()])))),r.dispatchFromDevtools&&typeof r.dispatch=="function"){let B=!1;const x=r.dispatch;r.dispatch=(...b)=>{(QAe?"production":void 0)!=="production"&&b[0].type==="__setState"&&!B&&(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),B=!0),x(...b)}}return u.subscribe(B=>{var x;switch(B.type){case"ACTION":if(typeof B.payload!="string"){console.error("[zustand devtools middleware] Unsupported action format");return}return MAe(B.payload,b=>{if(b.type==="__setState"){if(s===void 0){p(b.state);return}Object.keys(b.state).length!==1&&console.error(`
|
|
13721
13721
|
[zustand devtools middleware] Unsupported __setState action format.
|
|
13722
13722
|
When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),
|
|
13723
13723
|
and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }
|
|
13724
|
-
`);const Q=b.state[s];if(Q==null)return;JSON.stringify(r.getState())!==JSON.stringify(Q)&&p(Q);return}r.dispatchFromDevtools&&typeof r.dispatch=="function"&&r.dispatch(b)});case"DISPATCH":switch(B.payload.type){case"RESET":return p(v),s===void 0?u==null?void 0:u.init(r.getState()):u==null?void 0:u.init(oz(l.name));case"COMMIT":if(s===void 0){u==null||u.init(r.getState());return}return u==null?void 0:u.init(oz(l.name));case"ROLLBACK":return MAe(B.state,b=>{if(s===void 0){p(b),u==null||u.init(r.getState());return}p(b[s]),u==null||u.init(oz(l.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return MAe(B.state,b=>{if(s===void 0){p(b);return}JSON.stringify(r.getState())!==JSON.stringify(b[s])&&p(b[s])});case"IMPORT_STATE":{const{nextLiftedState:b}=B.payload,Q=(x=b.computedStates.slice(-1)[0])==null?void 0:x.state;if(!Q)return;p(s===void 0?Q:Q[s]),u==null||u.send(null,b);return}case"PAUSE_RECORDING":return f=!f}return}}),v},MAe=(i,e)=>{let t;try{t=JSON.parse(i)}catch(n){console.error("[zustand devtools middleware] Could not parse the received json",n)}t!==void 0&&e(t)},oen=mEt()(aen(i=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:e=>{i({lastRunEvalVersion:e})}}),{name:"runframe-runner-store"})),sen=["assembly","bom","circuit_json","errors","render_log"],len=({code:i,onRunClicked:e=void 0,errorMessage:t,errorStack:n,circuitJson:r,autoroutingGraphics:a,showRightHeaderContent:o=!0,showCodeTab:s=!1,codeTabContent:l,showJsonTab:c=!0,showRenderLogTab:u=!0,onActiveTabChange:A,renderLog:f,showImportAndFormatButtons:p=!0,className:v,headerClassName:B,leftHeaderContent:x,readOnly:b,isStreaming:Q,autoroutingLog:R,onReportAutoroutingLog:k,isRunningCode:K,hasCodeChangedSinceLastRun:Y,onEditEvent:J,editEvents:W,defaultActiveTab:$,autoRotate3dViewerDisabled:X,showSchematicDebugGrid:de=!1,showToggleFullScreen:ue=!0,defaultToFullScreen:ge=!1,activeEffectName:be})=>{var pt;X$t();const Qe=oen(Ct=>Ct.lastRunEvalVersion),ve=It.useMemo(()=>r?r.filter(Ct=>Ct&&"error_type"in Ct||Ct.type.includes("error")):null,[r]),Be=It.useMemo(()=>r?r.filter(Ct=>Ct&&"warning_type"in Ct||Ct.type.includes("warning")):null,[r]);nen({errorMessage:t,errorStack:n,circuitJsonErrors:ve});const[Ie,Te]=It.useState($??"pcb"),[Ne,Le]=It.useState(ge);$$t(Ne);const Pe=It.useCallback(Ct=>{Te(Ct),A==null||A(Ct)},[A]),rt=()=>{Le(!Ne)};It.useEffect(()=>{t&&Pe("errors")},[t]),It.useEffect(()=>{(Ie==="code"||Ie==="errors")&&r&&!t&&Pe($??"pcb")},[r]);const $e=It.useCallback(Ct=>{window.TSCIRCUIT_3D_OBJECT_REF=Ct===null?void 0:Ct},[]);return ht.jsx("div",{className:gI("flex flex-col relative rf-overflow-x-hidden",v),children:ht.jsx("div",{className:gI("rf-md:sticky rf-md:top-2",Ne&&"rf-fixed rf-top-0 rf-left-0 rf-w-full rf-h-full rf-bg-white rf-overflow-hidden"),children:ht.jsxs(rWe,{value:Ie,onValueChange:Pe,className:"rf-flex-grow rf-flex rf-flex-col",children:[ht.jsxs("div",{className:gI("rf-flex rf-items-center rf-gap-2 rf-p-2 rf-pb-0",B),children:[x,x&&ht.jsx("div",{className:"rf-flex-grow"}),!x&&K&&ht.jsx(lke,{className:"rf-w-4 rf-h-4 rf-animate-spin"}),!x&&ht.jsx("div",{className:"rf-flex-grow"}),f&&f.progress!==1&&!t&&ht.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[be?ht.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:be}):f.lastRenderEvent&&ht.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:((pt=f.lastRenderEvent)==null?void 0:pt.phase)??""}),ht.jsx("div",{className:"rf-w-4 rf-h-4 rf-bg-blue-500 rf-opacity-50 rf-rounded-full rf-text-white",children:ht.jsx(lke,{className:"rf-w-4 rf-h-4 rf-animate-spin"})}),ht.jsxs("div",{className:"rf-text-xs rf-font-bold rf-text-gray-700 rf-tabular-nums",children:[((f.progress??0)*100).toFixed(1),"%"]})]}),o&&ht.jsxs(tge,{children:[s&&ht.jsx(XM,{value:"code",children:"Code"}),ht.jsxs(XM,{value:"pcb",className:"rf-whitespace-nowrap",children:[r&&ht.jsx("span",{className:gI("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",Y?"rf-bg-gray-500":"rf-bg-blue-500")}),"PCB"]}),ht.jsxs(XM,{value:"schematic",className:"rf-whitespace-nowrap",children:[r&&ht.jsx("span",{className:gI("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",Y?"rf-bg-gray-500":"rf-bg-blue-500")}),"Schematic"]}),ht.jsxs(XM,{value:"cad",children:[r&&ht.jsx("span",{className:gI("inline-flex items-center justify-center w-2 h-2 mr-1 text-xs font-bold text-white rounded-full",Y?"rf-bg-gray-500":"rf-bg-blue-500")}),"3D"]}),!["pcb","cad","schematic"].includes(Ie)&&ht.jsx(XM,{value:Ie,children:ege(Ie)}),ht.jsxs(y7e,{children:[ht.jsx(v7e,{asChild:!0,children:ht.jsxs("div",{className:"rf-whitespace-nowrap rf-p-2 rf-mr-1 rf-cursor-pointer rf-relative",children:[ht.jsx(vzt,{className:"rf-w-4 rf-h-4"}),(ve&&ve.length>0||t)&&ht.jsx("span",{className:"rf-inline-flex rf-absolute rf-top-[6px] rf-right-[4px] rf-items-center rf-justify-center rf-w-1 rf-h-1 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full"})]})}),ht.jsxs(Nce,{className:"rf-*:text-xs",children:[sen.map(Ct=>ht.jsxs(v4,{onSelect:()=>Pe(Ct),children:[Ie!==Ct&&ht.jsx(ske,{className:"rf-w-3 rf-h-3 rf-opacity-30"}),Ie===Ct&&ht.jsx(ake,{className:"rf-w-3 rf-h-3"}),ht.jsx("div",{className:"rf-pr-2",children:ege(Ct)}),Ct==="errors"&&(ve&&ve.length>0||t)&&ht.jsx("span",{className:"rf-inline-flex rf-items-center rf-justify-center rf-w-3 rf-h-3 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full",children:t?1:ve==null?void 0:ve.length})]},Ct)),ht.jsx(v4,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:ht.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/runframe@",ien.split(".").map((Ct,kt)=>kt===2?parseInt(Ct)+1:Ct).join(".")]})}),Qe&&ht.jsx(v4,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:ht.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/eval@",Qe]})})]})]})]}),ue&&ht.jsx(m9,{onClick:rt,variant:"ghost",children:Ne?ht.jsx(Ezt,{size:16}):ht.jsx(Czt,{size:16})})]}),s&&ht.jsx(yS,{value:"code",className:"rf-flex-grow rf-overflow-hidden",children:ht.jsx("div",{className:"rf-h-full",children:l})}),ht.jsx(yS,{value:"pcb",children:ht.jsx("div",{className:gI("rf-overflow-hidden",Ne?"rf-h-[calc(100vh-52px)]":"rf-h-[620px]"),children:ht.jsx(JD,{fallbackRender:({error:Ct})=>ht.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:ht.jsxs("div",{className:"rf-p-4",children:[ht.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading PCB viewer"}),ht.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ct==null?void 0:Ct.message)||"An unknown error occurred"})]})}),children:r?ht.jsx(Z$t,{focusOnHover:!1,circuitJson:r,debugGraphics:a,containerClassName:gI("rf-h-full rf-w-full",Ne?"rf-min-h-[calc(100vh-240px)]":"rf-min-h-[620px]"),onEditEventsChanged:Ct=>{J&&Ct.forEach(kt=>J(kt))}}):ht.jsx(yM,{onRunClicked:e})})})}),ht.jsx(yS,{value:"assembly",children:ht.jsx("div",{className:gI("rf-overflow-auto",Ne?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:ht.jsx(JD,{fallback:ht.jsx("div",{children:"Error loading Assembly"}),children:r?ht.jsx(Wjt,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,debugGrid:!0}):ht.jsx(yM,{onRunClicked:e})})})}),ht.jsx(yS,{value:"schematic",children:ht.jsx("div",{className:gI("rf-overflow-auto rf-bg-white",Ne?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:ht.jsx(JD,{fallbackRender:({error:Ct})=>ht.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:ht.jsxs("div",{className:"rf-p-4",children:[ht.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Schematic"}),ht.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ct==null?void 0:Ct.message)||"An unknown error occurred"})]})}),children:r?ht.jsx(Jjt,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,onEditEvent:Ct=>{J==null||J(Ct)},debugGrid:de}):ht.jsx(yM,{onRunClicked:e})})})}),ht.jsx(yS,{value:"cad",children:ht.jsx("div",{className:gI("rf-overflow-auto",Ne?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:ht.jsx(JD,{FallbackComponent:ozt,children:r?ht.jsx(rzt,{ref:$e,circuitJson:r,autoRotateDisabled:X}):ht.jsx(yM,{onRunClicked:e})})})}),ht.jsx(yS,{value:"bom",children:ht.jsx("div",{className:gI("rf-overflow-auto",Ne?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:ht.jsx(JD,{fallbackRender:({error:Ct})=>ht.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:ht.jsxs("div",{className:"rf-p-4",children:[ht.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Bill of Materials"}),ht.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ct==null?void 0:Ct.message)||"An unknown error occurred"})]})}),children:r?ht.jsx(nJt,{circuitJson:r}):ht.jsx(yM,{onRunClicked:e})})})}),ht.jsx(yS,{value:"circuit_json",children:ht.jsx("div",{className:gI("rf-overflow-auto",Ne?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:ht.jsx(JD,{fallback:ht.jsx("div",{children:"Error loading JSON viewer"}),children:r?ht.jsx(eJt,{elements:r}):ht.jsx(yM,{onRunClicked:e})})})}),ht.jsx(yS,{value:"errors",children:ht.jsx("div",{className:gI("rf-overflow-auto",Ne?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:t||ve&&ve.length>0||r?ht.jsx(vKt,{code:i,circuitJsonErrors:ve,circuitJsonWarnings:Be,errorMessage:t,errorStack:n,circuitJson:r,evalVersion:Qe,autoroutingLog:R,onReportAutoroutingLog:k}):ht.jsx(yM,{onRunClicked:e})})}),u&&ht.jsx(yS,{value:"render_log",children:ht.jsx(ten,{renderLog:f})})]})})})};sfe.createRoot(document.getElementById("root")).render(ht.jsx(len,{defaultActiveTab:"cad",autoRotate3dViewerDisabled:!0,showRightHeaderContent:!1,circuitJson:window.CIRCUIT_JSON||{},...window.CIRCUIT_JSON_PREVIEW_PROPS||{}}));const cen=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}))});
|
|
13724
|
+
`);const Q=b.state[s];if(Q==null)return;JSON.stringify(r.getState())!==JSON.stringify(Q)&&p(Q);return}r.dispatchFromDevtools&&typeof r.dispatch=="function"&&r.dispatch(b)});case"DISPATCH":switch(B.payload.type){case"RESET":return p(v),s===void 0?u==null?void 0:u.init(r.getState()):u==null?void 0:u.init(oz(l.name));case"COMMIT":if(s===void 0){u==null||u.init(r.getState());return}return u==null?void 0:u.init(oz(l.name));case"ROLLBACK":return MAe(B.state,b=>{if(s===void 0){p(b),u==null||u.init(r.getState());return}p(b[s]),u==null||u.init(oz(l.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return MAe(B.state,b=>{if(s===void 0){p(b);return}JSON.stringify(r.getState())!==JSON.stringify(b[s])&&p(b[s])});case"IMPORT_STATE":{const{nextLiftedState:b}=B.payload,Q=(x=b.computedStates.slice(-1)[0])==null?void 0:x.state;if(!Q)return;p(s===void 0?Q:Q[s]),u==null||u.send(null,b);return}case"PAUSE_RECORDING":return f=!f}return}}),v},MAe=(i,e)=>{let t;try{t=JSON.parse(i)}catch(n){console.error("[zustand devtools middleware] Could not parse the received json",n)}t!==void 0&&e(t)},oen=mEt()(aen(i=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:e=>{i({lastRunEvalVersion:e})}}),{name:"runframe-runner-store"})),sen=["assembly","bom","circuit_json","errors","render_log"],len=({code:i,onRunClicked:e=void 0,errorMessage:t,errorStack:n,circuitJson:r,autoroutingGraphics:a,showRightHeaderContent:o=!0,showCodeTab:s=!1,codeTabContent:l,showJsonTab:c=!0,showRenderLogTab:u=!0,onActiveTabChange:A,renderLog:f,showImportAndFormatButtons:p=!0,className:v,headerClassName:B,leftHeaderContent:x,readOnly:b,isStreaming:Q,autoroutingLog:R,onReportAutoroutingLog:k,isRunningCode:K,hasCodeChangedSinceLastRun:Y,onEditEvent:J,editEvents:W,defaultActiveTab:$,autoRotate3dViewerDisabled:X,showSchematicDebugGrid:de=!1,showToggleFullScreen:ue=!0,defaultToFullScreen:ge=!1,activeEffectName:be})=>{var pt;X$t();const Qe=oen(Ct=>Ct.lastRunEvalVersion),ve=It.useMemo(()=>r?r.filter(Ct=>Ct&&"error_type"in Ct||Ct.type.includes("error")):null,[r]),Be=It.useMemo(()=>r?r.filter(Ct=>Ct&&"warning_type"in Ct||Ct.type.includes("warning")):null,[r]);nen({errorMessage:t,errorStack:n,circuitJsonErrors:ve});const[Ie,Te]=It.useState($??"pcb"),[Ne,Le]=It.useState(ge);$$t(Ne);const Pe=It.useCallback(Ct=>{Te(Ct),A==null||A(Ct)},[A]),rt=()=>{Le(!Ne)};It.useEffect(()=>{t&&Pe("errors")},[t]),It.useEffect(()=>{(Ie==="code"||Ie==="errors")&&r&&!t&&Pe($??"pcb")},[r]);const $e=It.useCallback(Ct=>{window.TSCIRCUIT_3D_OBJECT_REF=Ct===null?void 0:Ct},[]);return ht.jsx("div",{className:gI("flex flex-col relative rf-overflow-x-hidden rf-h-full",v),children:ht.jsx("div",{className:gI("rf-md:sticky rf-md:top-2 rf-h-full",Ne&&"rf-fixed rf-top-0 rf-left-0 rf-w-full rf-h-full rf-bg-white rf-overflow-hidden"),children:ht.jsxs(rWe,{value:Ie,onValueChange:Pe,className:"rf-flex-grow rf-flex rf-flex-col rf-h-full",children:[ht.jsxs("div",{className:gI("rf-flex rf-items-center rf-gap-2 rf-p-2 rf-pb-0",B),children:[x,x&&ht.jsx("div",{className:"rf-flex-grow"}),!x&&K&&ht.jsx(lke,{className:"rf-w-4 rf-h-4 rf-animate-spin"}),!x&&ht.jsx("div",{className:"rf-flex-grow"}),f&&f.progress!==1&&!t&&ht.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[be?ht.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:be}):f.lastRenderEvent&&ht.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:((pt=f.lastRenderEvent)==null?void 0:pt.phase)??""}),ht.jsx("div",{className:"rf-w-4 rf-h-4 rf-bg-blue-500 rf-opacity-50 rf-rounded-full rf-text-white",children:ht.jsx(lke,{className:"rf-w-4 rf-h-4 rf-animate-spin"})}),ht.jsxs("div",{className:"rf-text-xs rf-font-bold rf-text-gray-700 rf-tabular-nums",children:[((f.progress??0)*100).toFixed(1),"%"]})]}),o&&ht.jsxs(tge,{children:[s&&ht.jsx(XM,{value:"code",children:"Code"}),ht.jsxs(XM,{value:"pcb",className:"rf-whitespace-nowrap",children:[r&&ht.jsx("span",{className:gI("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",Y?"rf-bg-gray-500":"rf-bg-blue-500")}),"PCB"]}),ht.jsxs(XM,{value:"schematic",className:"rf-whitespace-nowrap",children:[r&&ht.jsx("span",{className:gI("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",Y?"rf-bg-gray-500":"rf-bg-blue-500")}),"Schematic"]}),ht.jsxs(XM,{value:"cad",children:[r&&ht.jsx("span",{className:gI("inline-flex items-center justify-center w-2 h-2 mr-1 text-xs font-bold text-white rounded-full",Y?"rf-bg-gray-500":"rf-bg-blue-500")}),"3D"]}),!["pcb","cad","schematic"].includes(Ie)&&ht.jsx(XM,{value:Ie,children:ege(Ie)}),ht.jsxs(y7e,{children:[ht.jsx(v7e,{asChild:!0,children:ht.jsxs("div",{className:"rf-whitespace-nowrap rf-p-2 rf-mr-1 rf-cursor-pointer rf-relative",children:[ht.jsx(vzt,{className:"rf-w-4 rf-h-4"}),(ve&&ve.length>0||t)&&ht.jsx("span",{className:"rf-inline-flex rf-absolute rf-top-[6px] rf-right-[4px] rf-items-center rf-justify-center rf-w-1 rf-h-1 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full"})]})}),ht.jsxs(Nce,{className:"rf-*:text-xs",children:[sen.map(Ct=>ht.jsxs(v4,{onSelect:()=>Pe(Ct),children:[Ie!==Ct&&ht.jsx(ske,{className:"rf-w-3 rf-h-3 rf-opacity-30"}),Ie===Ct&&ht.jsx(ake,{className:"rf-w-3 rf-h-3"}),ht.jsx("div",{className:"rf-pr-2",children:ege(Ct)}),Ct==="errors"&&(ve&&ve.length>0||t)&&ht.jsx("span",{className:"rf-inline-flex rf-items-center rf-justify-center rf-w-3 rf-h-3 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full",children:t?1:ve==null?void 0:ve.length})]},Ct)),ht.jsx(v4,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:ht.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/runframe@",ien.split(".").map((Ct,kt)=>kt===2?parseInt(Ct)+1:Ct).join(".")]})}),Qe&&ht.jsx(v4,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:ht.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/eval@",Qe]})})]})]})]}),ue&&ht.jsx(m9,{onClick:rt,variant:"ghost",children:Ne?ht.jsx(Ezt,{size:16}):ht.jsx(Czt,{size:16})})]}),s&&ht.jsx(yS,{value:"code",className:"rf-flex-grow rf-overflow-hidden",children:ht.jsx("div",{className:"rf-h-full",children:l})}),ht.jsx(yS,{value:"pcb",children:ht.jsx("div",{className:gI("rf-overflow-hidden",Ne?"rf-h-[calc(100vh-52px)]":"rf-h-full"),children:ht.jsx(JD,{fallbackRender:({error:Ct})=>ht.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:ht.jsxs("div",{className:"rf-p-4",children:[ht.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading PCB viewer"}),ht.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ct==null?void 0:Ct.message)||"An unknown error occurred"})]})}),children:r?ht.jsx(Z$t,{focusOnHover:!1,circuitJson:r,debugGraphics:a,containerClassName:gI("rf-h-full rf-w-full",Ne?"rf-min-h-[calc(100vh-240px)]":"rf-min-h-[620px]"),onEditEventsChanged:Ct=>{J&&Ct.forEach(kt=>J(kt))}}):ht.jsx(yM,{onRunClicked:e})})})}),ht.jsx(yS,{value:"assembly",children:ht.jsx("div",{className:gI("rf-overflow-auto",Ne?"rf-h-[calc(100vh-96px)]":"rf-h-full"),children:ht.jsx(JD,{fallback:ht.jsx("div",{children:"Error loading Assembly"}),children:r?ht.jsx(Wjt,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,debugGrid:!0}):ht.jsx(yM,{onRunClicked:e})})})}),ht.jsx(yS,{value:"schematic",children:ht.jsx("div",{className:gI("rf-overflow-auto rf-bg-white",Ne?"rf-h-[calc(100vh-96px)]":"rf-h-full"),children:ht.jsx(JD,{fallbackRender:({error:Ct})=>ht.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:ht.jsxs("div",{className:"rf-p-4",children:[ht.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Schematic"}),ht.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ct==null?void 0:Ct.message)||"An unknown error occurred"})]})}),children:r?ht.jsx(Jjt,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,onEditEvent:Ct=>{J==null||J(Ct)},debugGrid:de}):ht.jsx(yM,{onRunClicked:e})})})}),ht.jsx(yS,{value:"cad",children:ht.jsx("div",{className:gI("rf-overflow-auto",Ne?"rf-h-[calc(100vh-96px)]":"rf-h-full"),children:ht.jsx(JD,{FallbackComponent:ozt,children:r?ht.jsx(rzt,{ref:$e,circuitJson:r,autoRotateDisabled:X}):ht.jsx(yM,{onRunClicked:e})})})}),ht.jsx(yS,{value:"bom",children:ht.jsx("div",{className:gI("rf-overflow-auto",Ne?"rf-h-[calc(100vh-96px)]":"rf-h-full"),children:ht.jsx(JD,{fallbackRender:({error:Ct})=>ht.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:ht.jsxs("div",{className:"rf-p-4",children:[ht.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Bill of Materials"}),ht.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(Ct==null?void 0:Ct.message)||"An unknown error occurred"})]})}),children:r?ht.jsx(nJt,{circuitJson:r}):ht.jsx(yM,{onRunClicked:e})})})}),ht.jsx(yS,{value:"circuit_json",children:ht.jsx("div",{className:gI("rf-overflow-auto",Ne?"rf-h-[calc(100vh-96px)]":"rf-h-full"),children:ht.jsx(JD,{fallback:ht.jsx("div",{children:"Error loading JSON viewer"}),children:r?ht.jsx(eJt,{elements:r}):ht.jsx(yM,{onRunClicked:e})})})}),ht.jsx(yS,{value:"errors",children:ht.jsx("div",{className:gI("rf-overflow-auto",Ne?"rf-h-[calc(100vh-96px)]":"rf-h-full"),children:t||ve&&ve.length>0||r?ht.jsx(vKt,{code:i,circuitJsonErrors:ve,circuitJsonWarnings:Be,errorMessage:t,errorStack:n,circuitJson:r,evalVersion:Qe,autoroutingLog:R,onReportAutoroutingLog:k}):ht.jsx(yM,{onRunClicked:e})})}),u&&ht.jsx(yS,{value:"render_log",children:ht.jsx(ten,{renderLog:f})})]})})})};sfe.createRoot(document.getElementById("root")).render(ht.jsx(len,{defaultActiveTab:"cad",autoRotate3dViewerDisabled:!0,showRightHeaderContent:!1,circuitJson:window.CIRCUIT_JSON||{},...window.CIRCUIT_JSON_PREVIEW_PROPS||{}}));const cen=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}))});
|