@tscircuit/runframe 0.0.724 → 0.0.725

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.
@@ -893,7 +893,7 @@ searched component ${u.getString()}, which has ports: ${u.children.filter(d=>d.c
893
893
  `);const x=_.state[s];if(x==null)return;JSON.stringify(r.getState())!==JSON.stringify(x)&&h(x);return}r.dispatchFromDevtools&&typeof r.dispatch=="function"&&r.dispatch(_)});case"DISPATCH":switch(y.payload.type){case"RESET":return h(g),s===void 0?u==null?void 0:u.init(r.getState()):u==null?void 0:u.init(PU(l.name));case"COMMIT":if(s===void 0){u==null||u.init(r.getState());return}return u==null?void 0:u.init(PU(l.name));case"ROLLBACK":return Xte(y.state,_=>{if(s===void 0){h(_),u==null||u.init(r.getState());return}h(_[s]),u==null||u.init(PU(l.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return Xte(y.state,_=>{if(s===void 0){h(_);return}JSON.stringify(r.getState())!==JSON.stringify(_[s])&&h(_[s])});case"IMPORT_STATE":{const{nextLiftedState:_}=y.payload,x=(v=_.computedStates.slice(-1)[0])==null?void 0:v.state;if(!x)return;h(s===void 0?x:x[s]),u==null||u.send(null,_);return}case"PAUSE_RECORDING":return f=!f}return}}),g},Xte=(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)},VS=window.TSCIRCUIT_FILESERVER_API_BASE_URL??"/api",Zte=KMe.extend("store");async function lQe(i,e){return(await(await fetch(`${VS}/files/upsert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:i,text_content:e})})).json()).file}async function $te(i){return(await(await fetch(`${VS}/files/get?file_path=${encodeURIComponent(i)}`)).json()).file}async function hTt(i){const e=i?`${VS}/events/list?since=${encodeURIComponent(i)}`:`${VS}/events/list`;return(await(await fetch(e)).json()).event_list}async function pTt(){const i=await fetch(`${VS}/files/list`),{file_list:e}=await i.json(),t=new Map;for(const n of e){const r=await $te(n.file_path);t.set(n.file_path,r.text_content)}return t}const Yb=aQe()(sQe((i,e)=>({fsMap:new Map,lastEventTime:new Date().toISOString(),isPolling:!1,error:null,circuitJson:null,lastManualEditsChangeSentAt:0,recentEvents:[],simulateScenarioOrder:void 0,loadInitialFiles:async()=>{const t=await pTt();Zte("loaded initial files",{fsMap:t}),i({fsMap:t})},upsertFile:async(t,n)=>{try{const r=await lQe(t,n);i(o=>({fsMap:new Map(o.fsMap).set(r.file_path,r.text_content)}))}catch(r){i({error:r})}},getFile:async t=>{try{const n=await $te(t);i(r=>({fsMap:new Map(r.fsMap).set(n.file_path,n.text_content)}))}catch(n){i({error:n})}},setCircuitJson:t=>{t!==e().circuitJson&&i({circuitJson:t})},startPolling:()=>{const t=async()=>{const n=e();if(n.isPolling){try{const r=await hTt(n.lastEventTime);if(r.length>0){i(s=>({recentEvents:[...s.recentEvents,...r].slice(0,100)}));const o=r[r.length-1].created_at,a=new Map(n.fsMap);for(const s of r)if(s.event_type==="FILE_UPDATED"){const l=await $te(s.file_path);if(s.file_path==="manual_edits.json"&&Date.now()-n.lastManualEditsChangeSentAt<1e3)continue;a.set(l.file_path,l.text_content)}i({fsMap:a,lastEventTime:o})}}catch(r){i({error:r})}setTimeout(t,1e3)}};i({isPolling:!0}),t()},stopPolling:()=>{i({isPolling:!1})},pushEvent:async t=>{await fetch(`${window.TSCIRCUIT_FILESERVER_API_BASE_URL??""}/api/events/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},applyEditEventsAndUpdateManualEditsJson:async t=>{Zte("applyEditEventsAndUpdateManualEditsJson",{editEvents:t});const n=e();if(!n.circuitJson)return;const r=n.fsMap.get("manual-edits.json"),o=r?JSON.parse(r):{},a=YMe({circuitJson:n.circuitJson,editEvents:t,manualEditsFile:o});Zte("updatedManualEditsFileContent",a),i(s=>({lastManualEditsChangeSentAt:Date.now(),fsMap:new Map(s.fsMap).set("manual-edits.json",JSON.stringify(a))})),await lQe("manual-edits.json",JSON.stringify(a,null,2))},setSimulateScenarioOrder:t=>i({simulateScenarioOrder:t})}),{name:"run-frame-store"})),gTt=KMe.extend("useEditEventController"),mTt=()=>{const i=Yb(h=>h.applyEditEventsAndUpdateManualEditsJson),[e,t]=rt.useState([]),[n,r]=rt.useState(!1),o=e.filter(h=>!h._applied),a=e.filter(h=>h._applied),s=n?e:o,l=rt.useCallback(h=>{t(g=>[...g,{...h,_applied:!1}])},[]),c=rt.useCallback(h=>{t(g=>g.map(y=>y===h?{...y,_applied:!0}:y))},[]),u=rt.useCallback(()=>{t(h=>h.map(g=>({...g,_applied:!0})))},[]),d=rt.useCallback(()=>{r(!0),e.length!==0&&(gTt("removing edit events that are applied"),t(h=>h.filter(g=>!g._applied)))},[e]),f=rt.useCallback(()=>{r(!1)},[]);return rt.useEffect(()=>{if(e.filter(g=>!g._applied).length===0)return;const h=setTimeout(()=>{u(),i(e)},1e3);return()=>clearTimeout(h)},[e]),{unappliedEditEvents:o,appliedEditEvents:a,editEventsForRender:s,pushEditEvent:l,markEditEventApplied:c,markRenderStarted:d,markRenderComplete:f,markAllEditEventsApplied:u}};function Fp(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 yTt(i,e){const t=rt.createContext(e),n=o=>{const{children:a,...s}=o,l=rt.useMemo(()=>s,Object.values(s));return je.jsx(t.Provider,{value:l,children:a})};n.displayName=i+"Provider";function r(o){const a=rt.useContext(t);if(a)return a;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${i}\``)}return[n,r]}function NB(i,e=[]){let t=[];function n(o,a){const s=rt.createContext(a),l=t.length;t=[...t,a];const c=d=>{var _;const{scope:f,children:h,...g}=d,y=((_=f==null?void 0:f[i])==null?void 0:_[l])||s,v=rt.useMemo(()=>g,Object.values(g));return je.jsx(y.Provider,{value:v,children:h})};c.displayName=o+"Provider";function u(d,f){var y;const h=((y=f==null?void 0:f[i])==null?void 0:y[l])||s,g=rt.useContext(h);if(g)return g;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[c,u]}const r=()=>{const o=t.map(a=>rt.createContext(a));return function(s){const l=(s==null?void 0:s[i])||o;return rt.useMemo(()=>({[`__scope${i}`]:{...s,[i]:l}}),[s,l])}};return r.scopeName=i,[n,vTt(r,...e)]}function vTt(...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(o){const a=n.reduce((s,{useScope:l,scopeName:c})=>{const d=l(o)[`__scope${c}`];return{...s,...d}},{});return rt.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return t.scopeName=e.scopeName,t}function cQe(i,e){if(typeof i=="function")return i(e);i!=null&&(i.current=e)}function jS(...i){return e=>{let t=!1;const n=i.map(r=>{const o=cQe(r,e);return!t&&typeof o=="function"&&(t=!0),o});if(t)return()=>{for(let r=0;r<n.length;r++){const o=n[r];typeof o=="function"?o():cQe(i[r],null)}}}}function _C(...i){return rt.useCallback(jS(...i),i)}function e4(i){const e=ITt(i),t=rt.forwardRef((n,r)=>{const{children:o,...a}=n,s=rt.Children.toArray(o),l=s.find(xTt);if(l){const c=l.props.children,u=s.map(d=>d===l?rt.Children.count(c)>1?rt.Children.only(null):rt.isValidElement(c)?c.props.children:null:d);return je.jsx(e,{...a,ref:r,children:rt.isValidElement(c)?rt.cloneElement(c,void 0,u):null})}return je.jsx(e,{...a,ref:r,children:o})});return t.displayName=`${i}.Slot`,t}var _Tt=e4("Slot");function ITt(i){const e=rt.forwardRef((t,n)=>{const{children:r,...o}=t;if(rt.isValidElement(r)){const a=bTt(r),s=ETt(o,r.props);return r.type!==rt.Fragment&&(s.ref=n?jS(n,a):a),rt.cloneElement(r,s)}return rt.Children.count(r)>1?rt.Children.only(null):null});return e.displayName=`${i}.SlotClone`,e}var uQe=Symbol("radix.slottable");function CTt(i){const e=({children:t})=>je.jsx(je.Fragment,{children:t});return e.displayName=`${i}.Slottable`,e.__radixId=uQe,e}function xTt(i){return rt.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===uQe}function ETt(i,e){const t={...e};for(const n in e){const r=i[n],o=e[n];/^on[A-Z]/.test(n)?r&&o?t[n]=(...s)=>{const l=o(...s);return r(...s),l}:r&&(t[n]=r):n==="style"?t[n]={...r,...o}:n==="className"&&(t[n]=[r,o].filter(Boolean).join(" "))}return{...i,...t}}function bTt(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 dQe(i){const e=i+"CollectionProvider",[t,n]=NB(e),[r,o]=t(e,{collectionRef:{current:null},itemMap:new Map}),a=y=>{const{scope:v,children:_}=y,x=kA.useRef(null),S=kA.useRef(new Map).current;return je.jsx(r,{scope:v,itemMap:S,collectionRef:x,children:_})};a.displayName=e;const s=i+"CollectionSlot",l=e4(s),c=kA.forwardRef((y,v)=>{const{scope:_,children:x}=y,S=o(s,_),M=_C(v,S.collectionRef);return je.jsx(l,{ref:M,children:x})});c.displayName=s;const u=i+"CollectionItemSlot",d="data-radix-collection-item",f=e4(u),h=kA.forwardRef((y,v)=>{const{scope:_,children:x,...S}=y,M=kA.useRef(null),z=_C(v,M),U=o(u,_);return kA.useEffect(()=>(U.itemMap.set(M,{ref:M,...S}),()=>void U.itemMap.delete(M))),je.jsx(f,{[d]:"",ref:z,children:x})});h.displayName=u;function g(y){const v=o(i+"CollectionConsumer",y);return kA.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const S=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((U,H)=>S.indexOf(U.ref.current)-S.indexOf(H.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:a,Slot:c,ItemSlot:h},g,n]}var gw=globalThis!=null&&globalThis.document?rt.useLayoutEffect:()=>{},BTt=hEe[" useId ".trim().toString()]||(()=>{}),STt=0;function dE(i){const[e,t]=rt.useState(BTt());return gw(()=>{t(n=>n??String(STt++))},[i]),e?`radix-${e}`:""}var ene=lEe();const AQe=e9(ene);var wTt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_y=wTt.reduce((i,e)=>{const t=e4(`Primitive.${e}`),n=rt.forwardRef((r,o)=>{const{asChild:a,...s}=r,l=a?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),je.jsx(l,{...s,ref:o})});return n.displayName=`Primitive.${e}`,{...i,[e]:n}},{});function fQe(i,e){i&&ene.flushSync(()=>i.dispatchEvent(e))}function TB(i){const e=rt.useRef(i);return rt.useEffect(()=>{e.current=i}),rt.useMemo(()=>(...t)=>{var n;return(n=e.current)==null?void 0:n.call(e,...t)},[])}var MTt=hEe[" useInsertionEffect ".trim().toString()]||gw;function t4({prop:i,defaultProp:e,onChange:t=()=>{},caller:n}){const[r,o,a]=QTt({defaultProp:e,onChange:t}),s=i!==void 0,l=s?i:r;{const u=rt.useRef(i!==void 0);rt.useEffect(()=>{const d=u.current;d!==s&&console.warn(`${n} is changing from ${d?"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=rt.useCallback(u=>{var d;if(s){const f=RTt(u)?u(i):u;f!==i&&((d=a.current)==null||d.call(a,f))}else o(u)},[s,i,o,a]);return[l,c]}function QTt({defaultProp:i,onChange:e}){const[t,n]=rt.useState(i),r=rt.useRef(t),o=rt.useRef(e);return MTt(()=>{o.current=e},[e]),rt.useEffect(()=>{var a;r.current!==t&&((a=o.current)==null||a.call(o,t),r.current=t)},[t,r]),[t,n,o]}function RTt(i){return typeof i=="function"}var DTt=rt.createContext(void 0);function tne(i){const e=rt.useContext(DTt);return i||e||"ltr"}var nne="rovingFocusGroup.onEntryFocus",NTt={bubbles:!1,cancelable:!0},f8="RovingFocusGroup",[ine,hQe,TTt]=dQe(f8),[PTt,kU]=NB(f8,[TTt]),[kTt,LTt]=PTt(f8),pQe=rt.forwardRef((i,e)=>je.jsx(ine.Provider,{scope:i.__scopeRovingFocusGroup,children:je.jsx(ine.Slot,{scope:i.__scopeRovingFocusGroup,children:je.jsx(FTt,{...i,ref:e})})}));pQe.displayName=f8;var FTt=rt.forwardRef((i,e)=>{const{__scopeRovingFocusGroup:t,orientation:n,loop:r=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=i,f=rt.useRef(null),h=_C(e,f),g=tne(o),[y,v]=t4({prop:a,defaultProp:s??null,onChange:l,caller:f8}),[_,x]=rt.useState(!1),S=TB(c),M=hQe(t),z=rt.useRef(!1),[U,H]=rt.useState(0);return rt.useEffect(()=>{const k=f.current;if(k)return k.addEventListener(nne,S),()=>k.removeEventListener(nne,S)},[S]),je.jsx(kTt,{scope:t,orientation:n,dir:g,loop:r,currentTabStopId:y,onItemFocus:rt.useCallback(k=>v(k),[v]),onItemShiftTab:rt.useCallback(()=>x(!0),[]),onFocusableItemAdd:rt.useCallback(()=>H(k=>k+1),[]),onFocusableItemRemove:rt.useCallback(()=>H(k=>k-1),[]),children:je.jsx(_y.div,{tabIndex:_||U===0?-1:0,"data-orientation":n,...d,ref:h,style:{outline:"none",...i.style},onMouseDown:Fp(i.onMouseDown,()=>{z.current=!0}),onFocus:Fp(i.onFocus,k=>{const j=!z.current;if(k.target===k.currentTarget&&j&&!_){const G=new CustomEvent(nne,NTt);if(k.currentTarget.dispatchEvent(G),!G.defaultPrevented){const ee=M().filter(le=>le.focusable),K=ee.find(le=>le.active),ie=ee.find(le=>le.id===y),ue=[K,ie,...ee].filter(Boolean).map(le=>le.ref.current);yQe(ue,u)}}z.current=!1}),onBlur:Fp(i.onBlur,()=>x(!1))})})}),gQe="RovingFocusGroupItem",mQe=rt.forwardRef((i,e)=>{const{__scopeRovingFocusGroup:t,focusable:n=!0,active:r=!1,tabStopId:o,children:a,...s}=i,l=dE(),c=o||l,u=LTt(gQe,t),d=u.currentTabStopId===c,f=hQe(t),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:y}=u;return rt.useEffect(()=>{if(n)return h(),()=>g()},[n,h,g]),je.jsx(ine.ItemSlot,{scope:t,id:c,focusable:n,active:r,children:je.jsx(_y.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:e,onMouseDown:Fp(i.onMouseDown,v=>{n?u.onItemFocus(c):v.preventDefault()}),onFocus:Fp(i.onFocus,()=>u.onItemFocus(c)),onKeyDown:Fp(i.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const _=OTt(v,u.orientation,u.dir);if(_!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let S=f().filter(M=>M.focusable).map(M=>M.ref.current);if(_==="last")S.reverse();else if(_==="prev"||_==="next"){_==="prev"&&S.reverse();const M=S.indexOf(v.currentTarget);S=u.loop?zTt(S,M+1):S.slice(M+1)}setTimeout(()=>yQe(S))}}),children:typeof a=="function"?a({isCurrentTabStop:d,hasTabStop:y!=null}):a})})});mQe.displayName=gQe;var UTt={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function GTt(i,e){return e!=="rtl"?i:i==="ArrowLeft"?"ArrowRight":i==="ArrowRight"?"ArrowLeft":i}function OTt(i,e,t){const n=GTt(i.key,t);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return UTt[n]}function yQe(i,e=!1){const t=document.activeElement;for(const n of i)if(n===t||(n.focus({preventScroll:e}),document.activeElement!==t))return}function zTt(i,e){return i.map((t,n)=>i[(e+n)%i.length])}var vQe=pQe,_Qe=mQe;function HTt(i,e){return rt.useReducer((t,n)=>e[t][n]??t,i)}var y2=i=>{const{present:e,children:t}=i,n=YTt(e),r=typeof t=="function"?t({present:n.isPresent}):rt.Children.only(t),o=_C(n.ref,VTt(r));return typeof t=="function"||n.isPresent?rt.cloneElement(r,{ref:o}):null};y2.displayName="Presence";function YTt(i){const[e,t]=rt.useState(),n=rt.useRef(null),r=rt.useRef(i),o=rt.useRef("none"),a=i?"mounted":"unmounted",[s,l]=HTt(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return rt.useEffect(()=>{const c=LU(n.current);o.current=s==="mounted"?c:"none"},[s]),gw(()=>{const c=n.current,u=r.current;if(u!==i){const f=o.current,h=LU(c);i?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&f!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=i}},[i,l]),gw(()=>{if(e){let c;const u=e.ownerDocument.defaultView??window,d=h=>{const y=LU(n.current).includes(h.animationName);if(h.target===e&&y&&(l("ANIMATION_END"),!r.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",c=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},f=h=>{h.target===e&&(o.current=LU(n.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(c),e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:rt.useCallback(c=>{n.current=c?getComputedStyle(c):null,t(c)},[])}}function LU(i){return(i==null?void 0:i.animationName)||"none"}function VTt(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 FU="Tabs",[jTt,WWn]=NB(FU,[kU]),IQe=kU(),[KTt,rne]=jTt(FU),CQe=rt.forwardRef((i,e)=>{const{__scopeTabs:t,value:n,onValueChange:r,defaultValue:o,orientation:a="horizontal",dir:s,activationMode:l="automatic",...c}=i,u=tne(s),[d,f]=t4({prop:n,onChange:r,defaultProp:o??"",caller:FU});return je.jsx(KTt,{scope:t,baseId:dE(),value:d,onValueChange:f,orientation:a,dir:u,activationMode:l,children:je.jsx(_y.div,{dir:u,"data-orientation":a,...c,ref:e})})});CQe.displayName=FU;var xQe="TabsList",EQe=rt.forwardRef((i,e)=>{const{__scopeTabs:t,loop:n=!0,...r}=i,o=rne(xQe,t),a=IQe(t);return je.jsx(vQe,{asChild:!0,...a,orientation:o.orientation,dir:o.dir,loop:n,children:je.jsx(_y.div,{role:"tablist","aria-orientation":o.orientation,...r,ref:e})})});EQe.displayName=xQe;var bQe="TabsTrigger",BQe=rt.forwardRef((i,e)=>{const{__scopeTabs:t,value:n,disabled:r=!1,...o}=i,a=rne(bQe,t),s=IQe(t),l=MQe(a.baseId,n),c=QQe(a.baseId,n),u=n===a.value;return je.jsx(_Qe,{asChild:!0,...s,focusable:!r,active:u,children:je.jsx(_y.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,...o,ref:e,onMouseDown:Fp(i.onMouseDown,d=>{!r&&d.button===0&&d.ctrlKey===!1?a.onValueChange(n):d.preventDefault()}),onKeyDown:Fp(i.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&a.onValueChange(n)}),onFocus:Fp(i.onFocus,()=>{const d=a.activationMode!=="manual";!u&&!r&&d&&a.onValueChange(n)})})})});BQe.displayName=bQe;var SQe="TabsContent",wQe=rt.forwardRef((i,e)=>{const{__scopeTabs:t,value:n,forceMount:r,children:o,...a}=i,s=rne(SQe,t),l=MQe(s.baseId,n),c=QQe(s.baseId,n),u=n===s.value,d=rt.useRef(u);return rt.useEffect(()=>{const f=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(f)},[]),je.jsx(y2,{present:r||u,children:({present:f})=>je.jsx(_y.div,{"data-state":u?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":l,hidden:!f,id:c,tabIndex:0,...a,ref:e,style:{...i.style,animationDuration:d.current?"0s":void 0},children:f&&o})})});wQe.displayName=SQe;function MQe(i,e){return`${i}-trigger-${e}`}function QQe(i,e){return`${i}-content-${e}`}var JTt=CQe,RQe=EQe,DQe=BQe,NQe=wQe;function TQe(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=TQe(i[e]))&&(n&&(n+=" "),n+=t)}else for(t in i)i[t]&&(n&&(n+=" "),n+=t);return n}function PB(){for(var i,e,t=0,n="",r=arguments.length;t<r;t++)(i=arguments[t])&&(e=TQe(i))&&(n&&(n+=" "),n+=e);return n}const one="-",WTt=i=>{const e=XTt(i),{conflictingClassGroups:t,conflictingClassGroupModifiers:n}=i;return{getClassGroupId:a=>{const s=a.split(one);return s[0]===""&&s.length!==1&&s.shift(),PQe(s,e)||qTt(a)},getConflictingClassGroupIds:(a,s)=>{const l=t[a]||[];return s&&n[a]?[...l,...n[a]]:l}}},PQe=(i,e)=>{var a;if(i.length===0)return e.classGroupId;const t=i[0],n=e.nextPart.get(t),r=n?PQe(i.slice(1),n):void 0;if(r)return r;if(e.validators.length===0)return;const o=i.join(one);return(a=e.validators.find(({validator:s})=>s(o)))==null?void 0:a.classGroupId},kQe=/^\[(.+)\]$/,qTt=i=>{if(kQe.test(i)){const e=kQe.exec(i)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},XTt=i=>{const{theme:e,prefix:t}=i,n={nextPart:new Map,validators:[]};return $Tt(Object.entries(i.classGroups),t).forEach(([o,a])=>{ane(a,n,o,e)}),n},ane=(i,e,t,n)=>{i.forEach(r=>{if(typeof r=="string"){const o=r===""?e:LQe(e,r);o.classGroupId=t;return}if(typeof r=="function"){if(ZTt(r)){ane(r(n),e,t,n);return}e.validators.push({validator:r,classGroupId:t});return}Object.entries(r).forEach(([o,a])=>{ane(a,LQe(e,o),t,n)})})},LQe=(i,e)=>{let t=i;return e.split(one).forEach(n=>{t.nextPart.has(n)||t.nextPart.set(n,{nextPart:new Map,validators:[]}),t=t.nextPart.get(n)}),t},ZTt=i=>i.isThemeGetter,$Tt=(i,e)=>e?i.map(([t,n])=>{const r=n.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([a,s])=>[e+a,s])):o);return[t,r]}):i,e6t=i=>{if(i<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,n=new Map;const r=(o,a)=>{t.set(o,a),e++,e>i&&(e=0,n=t,t=new Map)};return{get(o){let a=t.get(o);if(a!==void 0)return a;if((a=n.get(o))!==void 0)return r(o,a),a},set(o,a){t.has(o)?t.set(o,a):r(o,a)}}},FQe="!",t6t=i=>{const{separator:e,experimentalParseClassName:t}=i,n=e.length===1,r=e[0],o=e.length,a=s=>{const l=[];let c=0,u=0,d;for(let v=0;v<s.length;v++){let _=s[v];if(c===0){if(_===r&&(n||s.slice(v,v+o)===e)){l.push(s.slice(u,v)),u=v+o;continue}if(_==="/"){d=v;continue}}_==="["?c++:_==="]"&&c--}const f=l.length===0?s:s.substring(u),h=f.startsWith(FQe),g=h?f.substring(1):f,y=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:y}};return t?s=>t({className:s,parseClassName:a}):a},n6t=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},i6t=i=>({cache:e6t(i.cacheSize),parseClassName:t6t(i),...WTt(i)}),r6t=/\s+/,o6t=(i,e)=>{const{parseClassName:t,getClassGroupId:n,getConflictingClassGroupIds:r}=e,o=[],a=i.trim().split(r6t);let s="";for(let l=a.length-1;l>=0;l-=1){const c=a[l],{modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:h}=t(c);let g=!!h,y=n(g?f.substring(0,h):f);if(!y){if(!g){s=c+(s.length>0?" "+s:s);continue}if(y=n(f),!y){s=c+(s.length>0?" "+s:s);continue}g=!1}const v=n6t(u).join(":"),_=d?v+FQe:v,x=_+y;if(o.includes(x))continue;o.push(x);const S=r(y,g);for(let M=0;M<S.length;++M){const z=S[M];o.push(_+z)}s=c+(s.length>0?" "+s:s)}return s};function a6t(){let i=0,e,t,n="";for(;i<arguments.length;)(e=arguments[i++])&&(t=UQe(e))&&(n&&(n+=" "),n+=t);return n}const UQe=i=>{if(typeof i=="string")return i;let e,t="";for(let n=0;n<i.length;n++)i[n]&&(e=UQe(i[n]))&&(t&&(t+=" "),t+=e);return t};function s6t(i,...e){let t,n,r,o=a;function a(l){const c=e.reduce((u,d)=>d(u),i());return t=i6t(c),n=t.cache.get,r=t.cache.set,o=s,s(l)}function s(l){const c=n(l);if(c)return c;const u=o6t(l,t);return r(l,u),u}return function(){return o(a6t.apply(null,arguments))}}const VI=i=>{const e=t=>t[i]||[];return e.isThemeGetter=!0,e},GQe=/^\[(?:([a-z-]+):)?(.+)\]$/i,l6t=/^\d+\/\d+$/,c6t=new Set(["px","full","screen"]),u6t=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,d6t=/\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$/,A6t=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,f6t=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,h6t=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,KS=i=>TQ(i)||c6t.has(i)||l6t.test(i),mw=i=>PQ(i,"length",C6t),TQ=i=>!!i&&!Number.isNaN(Number(i)),sne=i=>PQ(i,"number",TQ),h8=i=>!!i&&Number.isInteger(Number(i)),p6t=i=>i.endsWith("%")&&TQ(i.slice(0,-1)),om=i=>GQe.test(i),yw=i=>u6t.test(i),g6t=new Set(["length","size","percentage"]),m6t=i=>PQ(i,g6t,OQe),y6t=i=>PQ(i,"position",OQe),v6t=new Set(["image","url"]),_6t=i=>PQ(i,v6t,E6t),I6t=i=>PQ(i,"",x6t),p8=()=>!0,PQ=(i,e,t)=>{const n=GQe.exec(i);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):t(n[2]):!1},C6t=i=>d6t.test(i)&&!A6t.test(i),OQe=()=>!1,x6t=i=>f6t.test(i),E6t=i=>h6t.test(i),b6t=s6t(()=>{const i=VI("colors"),e=VI("spacing"),t=VI("blur"),n=VI("brightness"),r=VI("borderColor"),o=VI("borderRadius"),a=VI("borderSpacing"),s=VI("borderWidth"),l=VI("contrast"),c=VI("grayscale"),u=VI("hueRotate"),d=VI("invert"),f=VI("gap"),h=VI("gradientColorStops"),g=VI("gradientColorStopPositions"),y=VI("inset"),v=VI("margin"),_=VI("opacity"),x=VI("padding"),S=VI("saturate"),M=VI("scale"),z=VI("sepia"),U=VI("skew"),H=VI("space"),k=VI("translate"),j=()=>["auto","contain","none"],G=()=>["auto","hidden","clip","visible","scroll"],ee=()=>["auto",om,e],K=()=>[om,e],ie=()=>["",KS,mw],ce=()=>["auto",TQ,om],ue=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],le=()=>["solid","dashed","dotted","double","none"],_e=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ye=()=>["start","end","center","between","around","evenly","stretch"],Qe=()=>["","0",om],Me=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Te=()=>[TQ,om];return{cacheSize:500,separator:":",theme:{colors:[p8],spacing:[KS,mw],blur:["none","",yw,om],brightness:Te(),borderColor:[i],borderRadius:["none","","full",yw,om],borderSpacing:K(),borderWidth:ie(),contrast:Te(),grayscale:Qe(),hueRotate:Te(),invert:Qe(),gap:K(),gradientColorStops:[i],gradientColorStopPositions:[p6t,mw],inset:ee(),margin:ee(),opacity:Te(),padding:K(),saturate:Te(),scale:Te(),sepia:Qe(),skew:Te(),space:K(),translate:K()},classGroups:{aspect:[{aspect:["auto","square","video",om]}],container:["container"],columns:[{columns:[yw]}],"break-after":[{"break-after":Me()}],"break-before":[{"break-before":Me()}],"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:[...ue(),om]}],overflow:[{overflow:G()}],"overflow-x":[{"overflow-x":G()}],"overflow-y":[{"overflow-y":G()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",h8,om]}],basis:[{basis:ee()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",om]}],grow:[{grow:Qe()}],shrink:[{shrink:Qe()}],order:[{order:["first","last","none",h8,om]}],"grid-cols":[{"grid-cols":[p8]}],"col-start-end":[{col:["auto",{span:["full",h8,om]},om]}],"col-start":[{"col-start":ce()}],"col-end":[{"col-end":ce()}],"grid-rows":[{"grid-rows":[p8]}],"row-start-end":[{row:["auto",{span:[h8,om]},om]}],"row-start":[{"row-start":ce()}],"row-end":[{"row-end":ce()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",om]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",om]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...ye()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ye(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ye(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",om,e]}],"min-w":[{"min-w":[om,e,"min","max","fit"]}],"max-w":[{"max-w":[om,e,"none","full","min","max","fit","prose",{screen:[yw]},yw]}],h:[{h:[om,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[om,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[om,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[om,e,"auto","min","max","fit"]}],"font-size":[{text:["base",yw,mw]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",sne]}],"font-family":[{font:[p8]}],"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",om]}],"line-clamp":[{"line-clamp":["none",TQ,sne]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",KS,om]}],"list-image":[{"list-image":["none",om]}],"list-style-type":[{list:["none","disc","decimal",om]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[i]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[i]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",KS,mw]}],"underline-offset":[{"underline-offset":["auto",KS,om]}],"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:K()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",om]}],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",om]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ue(),y6t]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",m6t]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},_6t]}],"bg-color":[{bg:[i]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[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":[_]}],"border-style":[{border:[...le(),"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":[_]}],"divide-style":[{divide:le()}],"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:["",...le()]}],"outline-offset":[{"outline-offset":[KS,om]}],"outline-w":[{outline:[KS,mw]}],"outline-color":[{outline:[i]}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[i]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[KS,mw]}],"ring-offset-color":[{"ring-offset":[i]}],shadow:[{shadow:["","inner","none",yw,I6t]}],"shadow-color":[{shadow:[p8]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[..._e(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":_e()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[n]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",yw,om]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[S]}],sepia:[{sepia:[z]}],"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":[d]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[z]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",om]}],duration:[{duration:Te()}],ease:[{ease:["linear","in","out","in-out",om]}],delay:[{delay:Te()}],animate:[{animate:["none","spin","ping","pulse","bounce",om]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[M]}],"scale-x":[{"scale-x":[M]}],"scale-y":[{"scale-y":[M]}],rotate:[{rotate:[h8,om]}],"translate-x":[{"translate-x":[k]}],"translate-y":[{"translate-y":[k]}],"skew-x":[{"skew-x":[U]}],"skew-y":[{"skew-y":[U]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",om]}],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",om]}],"caret-color":[{caret:[i]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":K()}],"scroll-mx":[{"scroll-mx":K()}],"scroll-my":[{"scroll-my":K()}],"scroll-ms":[{"scroll-ms":K()}],"scroll-me":[{"scroll-me":K()}],"scroll-mt":[{"scroll-mt":K()}],"scroll-mr":[{"scroll-mr":K()}],"scroll-mb":[{"scroll-mb":K()}],"scroll-ml":[{"scroll-ml":K()}],"scroll-p":[{"scroll-p":K()}],"scroll-px":[{"scroll-px":K()}],"scroll-py":[{"scroll-py":K()}],"scroll-ps":[{"scroll-ps":K()}],"scroll-pe":[{"scroll-pe":K()}],"scroll-pt":[{"scroll-pt":K()}],"scroll-pr":[{"scroll-pr":K()}],"scroll-pb":[{"scroll-pb":K()}],"scroll-pl":[{"scroll-pl":K()}],"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",om]}],fill:[{fill:[i,"none"]}],"stroke-w":[{stroke:[KS,mw,sne]}],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 Aa=typeof window<"u"?window:void 0,fb=typeof globalThis<"u"?globalThis:Aa,zQe=Array.prototype,HQe=zQe.forEach,YQe=zQe.indexOf,Vb=fb==null?void 0:fb.navigator,Xd=fb==null?void 0:fb.document,hb=fb==null?void 0:fb.location,lne=fb==null?void 0:fb.fetch,cne=fb!=null&&fb.XMLHttpRequest&&"withCredentials"in new fb.XMLHttpRequest?fb.XMLHttpRequest:void 0,VQe=fb==null?void 0:fb.AbortController,pb=Vb==null?void 0:Vb.userAgent,F0=Aa??{},JS={DEBUG:!1,LIB_VERSION:"1.257.2"},une="$copy_autocapture",B6t=["$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"],WS=function(i){return i.GZipJS="gzip-js",i.Base64="base64",i}({}),S6t=["fatal","error","warning","log","info","debug"];function Iy(i,e){return i.indexOf(e)!==-1}var UU=function(i){return i.trim()},dne=function(i){return i.replace(/^\$/,"")},w6t=Array.isArray,jQe=Object.prototype,KQe=jQe.hasOwnProperty,GU=jQe.toString,aC=w6t||function(i){return GU.call(i)==="[object Array]"},v2=i=>typeof i=="function",GC=i=>i===Object(i)&&!aC(i),kQ=i=>{if(GC(i)){for(var e in i)if(KQe.call(i,e))return!1;return!0}return!1},Tu=i=>i===void 0,OC=i=>GU.call(i)=="[object String]",Ane=i=>OC(i)&&i.trim().length===0,vw=i=>i===null,T_=i=>Tu(i)||vw(i),AE=i=>GU.call(i)=="[object Number]",kB=i=>GU.call(i)==="[object Boolean]",M6t=i=>i instanceof FormData,Q6t=i=>Iy(B6t,i),JQe=i=>{var e={t:function(t){if(Aa&&(JS.DEBUG||F0.POSTHOG_DEBUG)&&!Tu(Aa.console)&&Aa.console){for(var n=("__rrweb_original__"in Aa.console[t])?Aa.console[t].__rrweb_original__:Aa.console[t],r=arguments.length,o=new Array(r>1?r-1:0),a=1;a<r;a++)o[a-1]=arguments[a];n(i,...o)}},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=>JQe(i+" "+t)};return e},vA=JQe("[PostHog.js]"),bx=vA.createLogger,R6t=bx("[ExternalScriptsLoader]"),WQe=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return R6t.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var n=Xd==null?void 0:Xd.querySelectorAll("script");if(n){for(var r=0;r<n.length;r++)if(n[r].src===e)return t()}var o=()=>{if(!Xd)return t("document not found");var a=Xd.createElement("script");if(a.type="text/javascript",a.crossOrigin="anonymous",a.src=e,a.onload=c=>t(void 0,c),a.onerror=c=>t(c),i.config.prepare_external_dependency_script&&(a=i.config.prepare_external_dependency_script(a)),!a)return t("prepare_external_dependency_script returned null");var s,l=Xd.querySelectorAll("body > script");l.length>0?(s=l[0].parentNode)==null||s.insertBefore(a,l[0]):Xd.body.appendChild(a)};Xd!=null&&Xd.body?o():Xd==null||Xd.addEventListener("DOMContentLoaded",o)};function Dd(){return Dd=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},Dd.apply(null,arguments)}function qQe(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}F0.__PosthogExtensions__=F0.__PosthogExtensions__||{},F0.__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 o=i.requestRouter.endpointFor("assets",n);WQe(i,o,t)},F0.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var n=i.requestRouter.endpointFor("api",e);WQe(i,n,t)};var OU={};function _w(i,e,t){if(aC(i)){if(HQe&&i.forEach===HQe)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)===OU)return}}}function O1(i,e,t){if(!T_(i)){if(aC(i))return _w(i,e,t);if(M6t(i)){for(var n of i.entries())if(e.call(t,n[1],n[0])===OU)return}else for(var r in i)if(KQe.call(i,r)&&e.call(t,i[r],r)===OU)return}}var i9=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 _w(t,function(r){for(var o in r)r[o]!==void 0&&(i[o]=r[o])}),i},zU=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 _w(t,function(r){_w(r,function(o){i.push(o)})}),i};function HU(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 XQe=function(i){try{return i()}catch{return}},D6t=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){vA.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),vA.critical(r)}}},fne=function(i){var e={};return O1(i,function(t,n){(OC(t)&&t.length>0||AE(t))&&(e[n]=t)}),e};function N6t(i,e){return t=i,n=o=>OC(o)&&!vw(e)?o.slice(0,e):o,r=new Set,function o(a,s){return a!==Object(a)?n?n(a,s):a:r.has(a)?void 0:(r.add(a),aC(a)?(l=[],_w(a,c=>{l.push(o(c))})):(l={},O1(a,(c,u)=>{r.has(c)||(l[u]=o(c,u))})),l);var l}(t);var t,n,r}var T6t=["herokuapp.com","vercel.app","netlify.app"];function P6t(i){var e=i==null?void 0:i.hostname;if(!OC(e))return!1;var t=e.split(".").slice(-2).join(".");for(var n of T6t)if(t===n)return!1;return!0}function ZQe(i,e){for(var t=0;t<i.length;t++)if(e(i[t]))return i[t]}function IC(i,e,t,n){var{capture:r=!1,passive:o=!0}=n??{};i==null||i.addEventListener(e,t,{capture:r,passive:o})}var $Qe="$people_distinct_id",g8="__alias",m8="__timers",eRe="$autocapture_disabled_server_side",hne="$heatmaps_enabled_server_side",tRe="$exception_capture_enabled_server_side",pne="$error_tracking_suppression_rules",nRe="$web_vitals_enabled_server_side",iRe="$dead_clicks_enabled_server_side",rRe="$web_vitals_allowed_metrics",gne="$session_recording_enabled_server_side",oRe="$console_log_recording_enabled_server_side",aRe="$session_recording_network_payload_capture",sRe="$session_recording_masking",lRe="$session_recording_canvas_recording",cRe="$replay_sample_rate",uRe="$replay_minimum_duration",dRe="$replay_script_config",YU="$sesid",y8="$session_is_sampled",mne="$session_recording_url_trigger_activated_session",yne="$session_recording_event_trigger_activated_session",LQ="$enabled_feature_flags",VU="$early_access_features",vne="$feature_flag_details",v8="$stored_person_properties",n4="$stored_group_properties",_ne="$surveys",jU="$surveys_activated",KU="$flag_call_reported",qS="$user_state",Ine="$client_session_props",Cne="$capture_rate_limit",xne="$initial_campaign_params",Ene="$initial_referrer_info",JU="$initial_person_info",WU="$epp",ARe="__POSTHOG_TOOLBAR__",qU="$posthog_cookieless",k6t=[$Qe,g8,"__cmpns",m8,gne,hne,YU,LQ,pne,qS,VU,vne,n4,v8,_ne,KU,Ine,Cne,xne,Ene,WU,JU];function fRe(i){return i instanceof Element&&(i.id===ARe||!(i.closest==null||!i.closest(".toolbar-global-fade-container")))}function XU(i){return!!i&&i.nodeType===1}function Iw(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function hRe(i){return!!i&&i.nodeType===3}function pRe(i){return!!i&&i.nodeType===11}function bne(i){return i?UU(i).split(/\s+/):[]}function gRe(i){var e=Aa==null?void 0:Aa.location.href;return!!(e&&i&&i.some(t=>e.match(t)))}function ZU(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 bne(e)}function mRe(i){return T_(i)?null:UU(i).split(/(\s+)/).filter(e=>FQ(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function $U(i){var e="";return Sne(i)&&!_Re(i)&&i.childNodes&&i.childNodes.length&&O1(i.childNodes,function(t){var n;hRe(t)&&t.textContent&&(e+=(n=mRe(t.textContent))!==null&&n!==void 0?n:"")}),UU(e)}function yRe(i){return Tu(i.target)?i.srcElement||null:(e=i.target)!=null&&e.shadowRoot?i.composedPath()[0]||null:i.target||null;var e}var Bne=["a","button","form","input","select","textarea","label"];function vRe(i){var e=i.parentNode;return!(!e||!XU(e))&&e}function L6t(i,e,t,n,r){var o,a,s;if(t===void 0&&(t=void 0),!Aa||!i||Iw(i,"html")||!XU(i)||(o=t)!=null&&o.url_allowlist&&!gRe(t.url_allowlist)||(a=t)!=null&&a.url_ignorelist&&gRe(t.url_ignorelist))return!1;if((s=t)!=null&&s.dom_event_allowlist){var l=t.dom_event_allowlist;if(l&&!l.some(v=>e.type===v))return!1}for(var c=!1,u=[i],d=!0,f=i;f.parentNode&&!Iw(f,"body");)if(pRe(f.parentNode))u.push(f.parentNode.host),f=f.parentNode.host;else{if(!(d=vRe(f)))break;if(n||Bne.indexOf(d.tagName.toLowerCase())>-1)c=!0;else{var h=Aa.getComputedStyle(d);h&&h.getPropertyValue("cursor")==="pointer"&&(c=!0)}u.push(d),f=d}if(!function(v,_){var x=_==null?void 0:_.element_allowlist;if(Tu(x))return!0;var S,M=function(U){if(x.some(H=>U.tagName.toLowerCase()===H))return{v:!0}};for(var z of v)if(S=M(z))return S.v;return!1}(u,t)||!function(v,_){var x=_==null?void 0:_.css_selector_allowlist;if(Tu(x))return!0;var S,M=function(U){if(x.some(H=>U.matches(H)))return{v:!0}};for(var z of v)if(S=M(z))return S.v;return!1}(u,t))return!1;var g=Aa.getComputedStyle(i);if(g&&g.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var y=i.tagName.toLowerCase();switch(y){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&&(Bne.indexOf(y)>-1||i.getAttribute("contenteditable")==="true")}}function Sne(i){for(var e=i;e.parentNode&&!Iw(e,"body");e=e.parentNode){var t=ZU(e);if(Iy(t,"ph-sensitive")||Iy(t,"ph-no-capture"))return!1}if(Iy(ZU(i),"ph-include"))return!0;var n=i.type||"";if(OC(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var r=i.name||i.id||"";return!(OC(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 _Re(i){return!!(Iw(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||Iw(i,"select")||Iw(i,"textarea")||i.getAttribute("contenteditable")==="true")}var IRe="(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})",F6t=new RegExp("^(?:"+IRe+")$"),U6t=new RegExp(IRe),CRe="\\d{3}-?\\d{2}-?\\d{4}",G6t=new RegExp("^("+CRe+")$"),O6t=new RegExp("("+CRe+")");function FQ(i,e){return e===void 0&&(e=!0),!(T_(i)||OC(i)&&(i=UU(i),(e?F6t:U6t).test((i||"").replace(/[- ]/g,""))||(e?G6t:O6t).test(i)))}function xRe(i){var e=$U(i);return FQ(e=(e+" "+ERe(i)).trim())?e:""}function ERe(i){var e="";return i&&i.childNodes&&i.childNodes.length&&O1(i.childNodes,function(t){var n;if(t&&((n=t.tagName)==null?void 0:n.toLowerCase())==="span")try{var r=$U(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+ERe(t)).trim())}catch(o){vA.error("[AutoCapture]",o)}}),e}function z6t(i){return function(e){var t=e.map(n=>{var r,o,a="";if(n.tag_name&&(a+=n.tag_name),n.attr_class)for(var s of(n.attr_class.sort(),n.attr_class))a+="."+s.replace(/"/g,"");var l=Dd({},n.text?{text:n.text}:{},{"nth-child":(r=n.nth_child)!==null&&r!==void 0?r:0,"nth-of-type":(o=n.nth_of_type)!==null&&o!==void 0?o:0},n.href?{href:n.href}:{},n.attr_id?{attr_id:n.attr_id}:{},n.attributes),c={};return HU(l).sort((u,d)=>{var[f]=u,[h]=d;return f.localeCompare(h)}).forEach(u=>{var[d,f]=u;return c[bRe(d.toString())]=bRe(f.toString())}),a+=":",a+=HU(c).map(u=>{var[d,f]=u;return d+'="'+f+'"'}).join("")});return t.join(";")}(function(e){return e.map(t=>{var n,r,o={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:H6t(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return HU(t).filter(a=>{var[s]=a;return s.indexOf("attr__")===0}).forEach(a=>{var[s,l]=a;return o.attributes[s]=l}),o})}(i))}function bRe(i){return i.replace(/"|\\"/g,'\\"')}function H6t(i){var e=i.attr__class;return e?aC(e)?e:bne(e):void 0}class BRe{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 Y6t=["localhost","127.0.0.1"],UQ=i=>{var e=Xd==null?void 0:Xd.createElement("a");return Tu(e)?null:(e.href=i,e)},V6t=function(i,e){var t,n;e===void 0&&(e="&");var r=[];return O1(i,function(o,a){Tu(o)||Tu(a)||a==="undefined"||(t=encodeURIComponent((s=>s instanceof File)(o)?o.name:o.toString()),n=encodeURIComponent(a),r[r.length]=n+"="+t)}),r.join(e)},eG=function(i,e){for(var t,n=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<n.length;r++){var o=n[r].split("=");if(o[0]===e){t=o;break}}if(!aC(t)||t.length<2)return"";var a=t[1];try{a=decodeURIComponent(a)}catch{vA.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},wne=function(i,e,t){if(!i||!e||!e.length)return i;for(var n=i.split("#"),r=n[0]||"",o=n[1],a=r.split("?"),s=a[1],l=a[0],c=(s||"").split("&"),u=[],d=0;d<c.length;d++){var f=c[d].split("=");aC(f)&&(e.includes(f[0])?u.push(f[0]+"="+t):u.push(c[d]))}var h=l;return s!=null&&(h+="?"+u.join("&")),o!=null&&(h+="#"+o),h},tG=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},SRe=bx("[AutoCapture]");function Mne(i,e){return e.length>i?e.slice(0,i)+"...":e}function j6t(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!XU(e));return e}function K6t(i,e,t,n){var r=i.tagName.toLowerCase(),o={tag_name:r};Bne.indexOf(r)>-1&&!t&&(r.toLowerCase()==="a"||r.toLowerCase()==="button"?o.$el_text=Mne(1024,xRe(i)):o.$el_text=Mne(1024,$U(i)));var a=ZU(i);a.length>0&&(o.classes=a.filter(function(u){return u!==""})),O1(i.attributes,function(u){var d;if((!_Re(i)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(n==null||!n.includes(u.name))&&!e&&FQ(u.value)&&(d=u.name,!OC(d)||d.substring(0,10)!=="_ngcontent"&&d.substring(0,7)!=="_nghost")){var f=u.value;u.name==="class"&&(f=bne(f).join(" ")),o["attr__"+u.name]=Mne(1024,f)}});for(var s=1,l=1,c=i;c=j6t(c);)s++,c.tagName===i.tagName&&l++;return o.nth_child=s,o.nth_of_type=l,o}function J6t(i,e){for(var t,n,{e:r,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:s,elementsChainAsString:l}=e,c=[i],u=i;u.parentNode&&!Iw(u,"body");)pRe(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var d,f=[],h={},g=!1,y=!1;if(O1(c,M=>{var z=Sne(M);M.tagName.toLowerCase()==="a"&&(g=M.getAttribute("href"),g=z&&g&&FQ(g)&&g),Iy(ZU(M),"ph-no-capture")&&(y=!0),f.push(K6t(M,o,a,s));var U=function(H){if(!Sne(H))return{};var k={};return O1(H.attributes,function(j){if(j.name&&j.name.indexOf("data-ph-capture-attribute")===0){var G=j.name.replace("data-ph-capture-attribute-",""),ee=j.value;G&&ee&&FQ(ee)&&(k[G]=ee)}}),k}(M);i9(h,U)}),y)return{props:{},explicitNoCapture:y};if(a||(i.tagName.toLowerCase()==="a"||i.tagName.toLowerCase()==="button"?f[0].$el_text=xRe(i):f[0].$el_text=$U(i)),g){var v,_;f[0].attr__href=g;var x=(v=UQ(g))==null?void 0:v.host,S=Aa==null||(_=Aa.location)==null?void 0:_.host;x&&S&&x!==S&&(d=g)}return{props:i9({$event_type:r.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:z6t(f)},(t=f[0])!=null&&t.$el_text?{$el_text:(n=f[0])==null?void 0:n.$el_text}:{},d&&r.type==="click"?{$external_click_url:d}:{},h)}}class W6t{constructor(e){this.i=!1,this.o=null,this.rageclicks=new BRe,this.h=!1,this.instance=e,this.m=null}get S(){var e,t,n=GC(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(Aa&&Xd){var e=n=>{n=n||(Aa==null?void 0:Aa.event);try{this.k(n)}catch(r){SRe.error("Failed to capture event",r)}};if(IC(Xd,"submit",e,{capture:!0}),IC(Xd,"change",e,{capture:!0}),IC(Xd,"click",e,{capture:!0}),this.S.capture_copied_text){var t=n=>{n=n||(Aa==null?void 0:Aa.event),this.k(n,une)};IC(Xd,"copy",t,{capture:!0}),IC(Xd,"cut",t,{capture:!0})}}}else SRe.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({[eRe]:!!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 o=Xd==null?void 0:Xd.querySelectorAll(r);o==null||o.forEach(a=>{e===a&&n.push(r)})}),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[eRe],r=this.o;if(vw(r)&&!kB(n)&&!this.instance.I())return!1;var o=(t=this.o)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!o}k(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,r=yRe(e);hRe(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 o=t===une;if(r&&L6t(r,e,this.S,o,o?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:s}=J6t(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&&(a.$element_selectors=l),t===une){var c,u=mRe(Aa==null||(c=Aa.getSelection())==null?void 0:c.toString()),d=e.type||"clipboard";if(!u)return!1;a.$selected_content=u,a.$copy_type=d}return this.instance.capture(t,a),!0}}}isBrowserSupported(){return v2(Xd==null?void 0:Xd.querySelectorAll)}}Math.trunc||(Math.trunc=function(i){return i<0?Math.ceil(i):Math.floor(i)}),Number.isInteger||(Number.isInteger=function(i){return AE(i)&&isFinite(i)&&Math.floor(i)===i});var wRe="0123456789abcdef";class nG{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 o=new Uint8Array(16);return o[0]=e/Math.pow(2,40),o[1]=e/Math.pow(2,32),o[2]=e/Math.pow(2,24),o[3]=e/Math.pow(2,16),o[4]=e/Math.pow(2,8),o[5]=e,o[6]=112|t>>>8,o[7]=t,o[8]=128|n>>>24,o[9]=n>>>16,o[10]=n>>>8,o[11]=n,o[12]=r>>>24,o[13]=r>>>16,o[14]=r>>>8,o[15]=r,new nG(o)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+wRe.charAt(this.bytes[t]>>>4)+wRe.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 nG(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 q6t{constructor(){this.P=0,this.R=0,this.T=new X6t}generate(){var e=this.generateOrAbort();if(Tu(e)){this.P=0;var t=this.generateOrAbort();if(Tu(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 nG.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 MRe,QRe=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};Aa&&!Tu(Aa.crypto)&&crypto.getRandomValues&&(QRe=i=>crypto.getRandomValues(i));class X6t{constructor(){this.C=new Uint32Array(8),this.F=1/0}nextUint32(){return this.F>=this.C.length&&(QRe(this.C),this.F=0),this.C[this.F++]}}var Cw=()=>Z6t().toString(),Z6t=()=>(MRe||(MRe=new q6t)).generate(),_8="",$6t=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function e7t(i,e){if(e){var t=function(r,o){if(o===void 0&&(o=Xd),_8)return _8;if(!o||["localhost","127.0.0.1"].includes(r))return"";for(var a=r.split("."),s=Math.min(a.length,8),l="dmn_chk_"+Cw();!_8&&s--;){var c=a.slice(s).join("."),u=l+"=1;domain=."+c+";path=/";o.cookie=u+";max-age=3",o.cookie.includes(l)&&(o.cookie=u+";max-age=0",_8=c)}return _8}(i);if(!t){var n=(r=>{var o=r.match($6t);return o?o[0]:""})(i);n!==t&&vA.info("Warning: cookie subdomain discovery mismatch",n,t),t=n}return t?"; domain=."+t:""}return""}var LB={O:()=>!!Xd,A:function(i){vA.error("cookieStore error: "+i)},D:function(i){if(Xd){try{for(var e=i+"=",t=Xd.cookie.split(";").filter(o=>o.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(LB.D(i))||{}}catch{}return e},j:function(i,e,t,n,r){if(Xd)try{var o="",a="",s=e7t(Xd.location.hostname,n);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),o="; expires="+l.toUTCString()}r&&(a="; secure");var c=i+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+s+a;return c.length>3686.4&&vA.warn("cookieStore warning: large cookie, len="+c.length),Xd.cookie=c,c}catch{return}},N:function(i,e){try{LB.j(i,"",-1,e)}catch{return}}},Qne=null,J9={O:function(){if(!vw(Qne))return Qne;var i=!0;if(Tu(Aa))i=!1;else try{var e="__mplssupport__";J9.j(e,"xyz"),J9.D(e)!=='"xyz"'&&(i=!1),J9.N(e)}catch{i=!1}return i||vA.error("localStorage unsupported; falling back to cookie store"),Qne=i,i},A:function(i){vA.error("localStorage error: "+i)},D:function(i){try{return Aa==null?void 0:Aa.localStorage.getItem(i)}catch(e){J9.A(e)}return null},L:function(i){try{return JSON.parse(J9.D(i))||{}}catch{}return null},j:function(i,e){try{Aa==null||Aa.localStorage.setItem(i,JSON.stringify(e))}catch(t){J9.A(t)}},N:function(i){try{Aa==null||Aa.localStorage.removeItem(i)}catch(e){J9.A(e)}}},t7t=["distinct_id",YU,y8,WU,JU],iG=Dd({},J9,{L:function(i){try{var e={};try{e=LB.L(i)||{}}catch{}var t=i9(e,JSON.parse(J9.D(i)||"{}"));return J9.j(i,t),t}catch{}return null},j:function(i,e,t,n,r,o){try{J9.j(i,e,void 0,void 0,o);var a={};t7t.forEach(s=>{e[s]&&(a[s]=e[s])}),Object.keys(a).length&&LB.j(i,a,t,n,r,o)}catch(s){J9.A(s)}},N:function(i,e){try{Aa==null||Aa.localStorage.removeItem(i),LB.N(i,e)}catch(t){J9.A(t)}}}),rG={},n7t={O:function(){return!0},A:function(i){vA.error("memoryStorage error: "+i)},D:function(i){return rG[i]||null},L:function(i){return rG[i]||null},j:function(i,e){rG[i]=e},N:function(i){delete rG[i]}},i4=null,kx={O:function(){if(!vw(i4))return i4;if(i4=!0,Tu(Aa))i4=!1;else try{var i="__support__";kx.j(i,"xyz"),kx.D(i)!=='"xyz"'&&(i4=!1),kx.N(i)}catch{i4=!1}return i4},A:function(i){vA.error("sessionStorage error: ",i)},D:function(i){try{return Aa==null?void 0:Aa.sessionStorage.getItem(i)}catch(e){kx.A(e)}return null},L:function(i){try{return JSON.parse(kx.D(i))||null}catch{}return null},j:function(i,e){try{Aa==null||Aa.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){kx.A(t)}},N:function(i){try{Aa==null||Aa.sessionStorage.removeItem(i)}catch(e){kx.A(e)}}},GQ=function(i){return i[i.PENDING=-1]="PENDING",i[i.DENIED=0]="DENIED",i[i.GRANTED=1]="GRANTED",i}({});class i7t{constructor(e){this._instance=e}get S(){return this._instance.config}get consent(){return this.U()?GQ.DENIED:this.q}isOptedOut(){return this.consent===GQ.DENIED||this.consent===GQ.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"?GQ.GRANTED:e==="0"?GQ.DENIED:GQ.PENDING}get B(){if(!this.W){var e=this.S.opt_out_capturing_persistence_type;this.W=e==="localStorage"?J9:LB;var t=e==="localStorage"?LB:J9;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&&!!ZQe([Vb==null?void 0:Vb.doNotTrack,Vb==null?void 0:Vb.msDoNotTrack,F0.doNotTrack],e=>Iy([!0,1,"1","yes"],e))}}var oG=bx("[Dead Clicks]"),r7t=()=>!0,o7t=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(iRe)),n=i.instance.config.capture_dead_clicks;return kB(n)?n:t};let RRe=class{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({[iRe]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.J(()=>{this.V()})}J(e){var t,n;(t=F0.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=F0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",r=>{r?oG.error("failed to load script",r):e()})}V(){var e;if(Xd){if(!this.G&&(e=F0.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=GC(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.G=F0.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.G.start(Xd),oG.info("starting...")}}else oG.error("`document` not found. Cannot start.")}stop(){this.G&&(this.G.stop(),this.G=void 0,oG.info("stopping..."))}};function jb(i,e,t,n,r){return e>t&&(vA.warn("min cannot be greater than max."),e=t),AE(i)?i>t?(n&&vA.warn(n+" cannot be greater than max: "+t+". Using max value instead."),t):i<e?(n&&vA.warn(n+" cannot be less than min: "+e+". Using min value instead."),e):i:(n&&vA.warn(n+" must be a number. using max or fallback. max: "+t+", fallback: "+r),jb(r||t,e,t,n))}let DRe=class{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 o,a=r===0;return a&&((o=this.et)==null||o.call(this,t)),a},this.rt=e,this.et=this.rt.et,this.tt=jb(this.rt.bucketSize,0,100,"rate limiter bucket size"),this.Z=jb(this.rt.refillRate,0,this.tt,"rate limiter refill rate"),this.st=jb(this.rt.refillInterval,0,864e5,"rate limiter refill interval"),setInterval(()=>{this.Y()},this.st)}};var aG=bx("[ExceptionAutocapture]");class a7t{constructor(e){var t,n,r;this.nt=()=>{var o;if(Aa&&this.isEnabled&&(o=F0.__PosthogExtensions__)!=null&&o.errorWrappingFunctions){var a=F0.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=F0.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=F0.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ot&&this.S.capture_unhandled_errors&&(this.ot=a(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){aG.error("failed to start",c),this.ht()}}},this._instance=e,this.dt=!((t=this._instance.persistence)==null||!t.props[tRe]),this.S=this.vt(),this.ct=new DRe({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 GC(e)?t=Dd({},t,e):(Tu(e)?this.dt:e)&&(t=Dd({},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&&(aG.info("enabled"),this.J(this.nt))}J(e){var t,n;(t=F0.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=F0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",r=>{if(r)return aG.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({[tRe]: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)?aG.info("Skipping exception capture because of client rate limiting.",{exception:e.$exception_list[0].type}):this._instance.exceptions.sendExceptionEvent(e)}}function NRe(i){return!Tu(Event)&&TRe(i,Event)}function TRe(i,e){try{return i instanceof e}catch{return!1}}function PRe(i){switch(Object.prototype.toString.call(i)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return TRe(i,Error)}}function sG(i,e){return Object.prototype.toString.call(i)==="[object "+e+"]"}function Rne(i){return sG(i,"DOMError")}var kRe=/\(error: (.*)\)/,LRe=50,OQ="?";function Dne(i,e,t,n){var r={platform:"web:javascript",filename:i,function:e==="<anonymous>"?OQ:e,in_app:!0};return Tu(t)||(r.lineno=t),Tu(n)||(r.colno=n),r}var s7t=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,l7t=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,c7t=/\((\S*)(?::(\d+))(?::(\d+))\)/,u7t=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,d7t=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,A7t=function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];var n=e.sort((r,o)=>r[0]-o[0]).map(r=>r[1]);return function(r,o){o===void 0&&(o=0);for(var a=[],s=r.split(`
894
894
  `),l=o;l<s.length;l++){var c=s[l];if(!(c.length>1024)){var u=kRe.test(c)?c.replace(kRe,"$1"):c;if(!u.match(/\S*Error: /)){for(var d of n){var f=d(u);if(f){a.push(f);break}}if(a.length>=LRe)break}}}return function(h){if(!h.length)return[];var g=Array.from(h);return g.reverse(),g.slice(0,LRe).map(y=>Dd({},y,{filename:y.filename||f7t(g).filename,function:y.function||OQ}))}(a)}}([30,i=>{var e=s7t.exec(i);if(e){var[,t,n,r]=e;return Dne(t,OQ,+n,+r)}var o=l7t.exec(i);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=c7t.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[s,l]=URe(o[1]||OQ,o[2]);return Dne(l,s,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}}],[50,i=>{var e=u7t.exec(i);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var t=d7t.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]||OQ;return[r,n]=URe(r,n),Dne(n,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]);function f7t(i){return i[i.length-1]||{}}var lG,FRe,Nne,URe=(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]:OQ,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},h7t=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function Tne(i,e){e===void 0&&(e=0);var t=i.stacktrace||i.stack||"",n=function(a){return a&&p7t.test(a.message)?1:0}(i);try{var r=A7t,o=function(a,s){var l=function(c){var u=globalThis._posthogChunkIds;if(!u)return{};var d=Object.keys(u);return Nne&&d.length===FRe||(FRe=d.length,Nne=d.reduce((f,h)=>{lG||(lG={});var g=lG[h];if(g)f[g[0]]=g[1];else for(var y=c(h),v=y.length-1;v>=0;v--){var _=y[v],x=_==null?void 0:_.filename,S=u[h];if(x&&S){f[x]=S,lG[h]=[x,S];break}}return f},{})),Nne}(s);return a.forEach(c=>{c.filename&&(c.chunk_id=l[c.filename])}),a}(r(t,n),r);return o.slice(0,o.length-e)}catch{}return[]}var p7t=/Minified React error #\d+;/i;function g7t(i,e){var t,n,r=Tne(i),o=(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;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:o,synthetic:a}}}function GRe(i,e){var t=g7t(i,e);return i.cause&&PRe(i.cause)&&i.cause!==i?[t,...GRe(i.cause,{handled:e==null?void 0:e.handled,synthetic:e==null?void 0:e.synthetic})]:[t]}function Pne(i,e){return{$exception_list:GRe(i,e),$exception_level:"error"}}function kne(i,e){var t,n,r,o=(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,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:o,synthetic:a}};if(e!=null&&e.syntheticException){var l=Tne(e.syntheticException,1);l.length&&(s.stacktrace={frames:l,type:"raw"})}return{$exception_list:[s],$exception_level:"error"}}function m7t(i){return OC(i)&&!Ane(i)&&S6t.indexOf(i)>=0}function y7t(i,e){var t,n,r=(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,a=e!=null&&e.overrideExceptionType?e.overrideExceptionType:NRe(i)?i.constructor.name:"Error",s="Non-Error 'exception' captured with keys: "+function(u,d){d===void 0&&(d=40);var f=Object.keys(u);if(f.sort(),!f.length)return"[object has no keys]";for(var h=f.length;h>0;h--){var g=f.slice(0,h).join(", ");if(!(g.length>d))return h===f.length||g.length<=d?g:g.slice(0,d)+"..."}return""}(i),l={type:a,value:s,mechanism:{handled:r,synthetic:o}};if(e!=null&&e.syntheticException){var c=Tne(e==null?void 0:e.syntheticException,1);c.length&&(l.stacktrace={frames:c,type:"raw"})}return{$exception_list:[l],$exception_level:m7t(i.level)?i.level:"error"}}function v7t(i,e){var{error:t,event:n}=i,r={$exception_list:[]},o=t||n;if(Rne(o)||function(f){return sG(f,"DOMException")}(o)){var a=o;if(function(f){return"stack"in f}(o))r=Pne(o,e);else{var s=a.name||(Rne(a)?"DOMError":"DOMException"),l=a.message?s+": "+a.message:s;r=kne(l,Dd({},e,{overrideExceptionType:Rne(a)?"DOMError":"DOMException",defaultExceptionMessage:l}))}return"code"in a&&(r.$exception_DOMException_code=""+a.code),r}if(function(f){return sG(f,"ErrorEvent")}(o)&&o.error)return Pne(o.error,e);if(PRe(o))return Pne(o,e);if(function(f){return sG(f,"Object")}(o)||NRe(o))return y7t(o,e);if(Tu(t)&&OC(n)){var c="Error",u=n,d=n.match(h7t);return d&&(c=d[1],u=d[2]),kne(u,Dd({},e,{overrideExceptionType:c,defaultExceptionMessage:u}))}return kne(o,e)}function ORe(i,e,t){try{if(!(e in i))return()=>{};var n=i[e],r=t(n);return v2(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),i[e]=r,()=>{i[e]=n}}catch{return()=>{}}}class _7t{constructor(e){var t;this._instance=e,this.ft=(Aa==null||(t=Aa.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(vA.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.gt&&this.gt(),this.gt=void 0,vA.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(Aa&&Aa.history){var n=this;(e=Aa.history.pushState)!=null&&e.__posthog_wrapped__||ORe(Aa.history,"pushState",r=>function(o,a,s){r.call(this,o,a,s),n._t("pushState")}),(t=Aa.history.replaceState)!=null&&t.__posthog_wrapped__||ORe(Aa.history,"replaceState",r=>function(o,a,s){r.call(this,o,a,s),n._t("replaceState")}),this.bt()}}_t(e){try{var t,n=Aa==null||(t=Aa.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){vA.error("Error capturing "+e+" pageview",r)}}bt(){if(!this.gt){var e=()=>{this._t("popstate")};IC(Aa,"popstate",e),this.gt=()=>{Aa&&Aa.removeEventListener("popstate",e)}}}}function cG(i){var e,t;return((e=JSON.stringify(i,(t=[],function(n,r){if(GC(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 Lne(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[Lne({size:cG(n),data:n,sessionId:i.sessionId,windowId:i.windowId}),Lne({size:cG(r),data:r,sessionId:i.sessionId,windowId:i.windowId})].flatMap(o=>o)}return[i]}var XS=(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))(XS||{}),K2=(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))(K2||{}),Fne="[SessionRecording]",Une="redacted",uG={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"]},I7t=["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"],C7t=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],x7t=["/s/","/e/","/i/"];function zRe(i,e,t,n){if(T_(i))return i;var r=(e==null?void 0:e["content-length"])||function(o){return new Blob([o]).size}(i);return OC(r)&&(r=parseInt(r)),r>t?Fne+" "+n+" body too large to record ("+r+" bytes)":i}function HRe(i,e){if(T_(i))return i;var t=i;return FQ(t,!1)||(t=Fne+" "+e+" body "+Une),O1(C7t,n=>{var r,o;(r=t)!=null&&r.length&&((o=t)==null?void 0:o.indexOf(n))!==-1&&(t=Fne+" "+e+" body "+Une+" as might contain: "+n)}),t}var E7t=(i,e)=>{var t,n,r,o={payloadSizeLimitBytes:uG.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...uG.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...uG.payloadHostDenyList]},a=i.session_recording.recordHeaders!==!1&&e.recordHeaders,s=i.session_recording.recordBody!==!1&&e.recordBody,l=i.capture_performance!==!1&&e.recordPerformance,c=(t=o,r=Math.min(1e6,(n=t.payloadSizeLimitBytes)!==null&&n!==void 0?n:1e6),f=>(f!=null&&f.requestBody&&(f.requestBody=zRe(f.requestBody,f.requestHeaders,r,"Request")),f!=null&&f.responseBody&&(f.responseBody=zRe(f.responseBody,f.responseHeaders,r,"Response")),f)),u=f=>{return c(((y,v)=>{var _,x=UQ(y.name),S=v.indexOf("http")===0?(_=UQ(v))==null?void 0:_.pathname:v;S==="/"&&(S="");var M=x==null?void 0:x.pathname.replace(S||"","");if(!(x&&M&&x7t.some(z=>M.indexOf(z)===0)))return y})((g=(h=f).requestHeaders,T_(g)||O1(Object.keys(g??{}),y=>{I7t.includes(y.toLowerCase())&&(g[y]=Une)}),h),i.api_host));var h,g},d=v2(i.session_recording.maskNetworkRequestFn);return d&&v2(i.session_recording.maskCapturedNetworkRequestFn)&&vA.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),d&&(i.session_recording.maskCapturedNetworkRequestFn=f=>{var h=i.session_recording.maskNetworkRequestFn({url:f.name});return Dd({},f,{name:h==null?void 0:h.url})}),o.maskRequestFn=v2(i.session_recording.maskCapturedNetworkRequestFn)?f=>{var h,g=u(f);return g&&(h=i.session_recording.maskCapturedNetworkRequestFn==null?void 0:i.session_recording.maskCapturedNetworkRequestFn(g))!==null&&h!==void 0?h:void 0}:f=>function(h){if(!Tu(h))return h.requestBody=HRe(h.requestBody,"Request"),h.responseBody=HRe(h.responseBody,"Response"),h}(u(f)),Dd({},uG,o,{recordHeaders:a,recordBody:s,recordPerformance:l,recordInitialRequests:l})};class b7t{constructor(e,t){var n,r;t===void 0&&(t={}),this.yt={},this.wt=o=>{if(!this.yt[o]){var a,s;this.yt[o]=!0;var l=this.St(o);(a=(s=this.rt).onBlockedNode)==null||a.call(s,o,l)}},this.$t=o=>{var a=this.St(o);if((a==null?void 0:a.nodeName)!=="svg"&&a instanceof Element){var s=a.closest("svg");if(s)return[this._rrweb.mirror.getId(s),s]}return[o,a]},this.St=o=>this._rrweb.mirror.getNode(o),this.kt=o=>{var a,s,l,c,u,d,f,h;return((a=(s=o.removes)==null?void 0:s.length)!==null&&a!==void 0?a:0)+((l=(c=o.attributes)==null?void 0:c.length)!==null&&l!==void 0?l:0)+((u=(d=o.texts)==null?void 0:d.length)!==null&&u!==void 0?u:0)+((f=(h=o.adds)==null?void 0:h.length)!==null&&f!==void 0?f:0)},this.throttleMutations=o=>{if(o.type!==3||o.data.source!==0)return o;var a=o.data,s=this.kt(a);a.attributes&&(a.attributes=a.attributes.filter(c=>{var[u]=this.$t(c.id);return!this.ct.consumeRateLimit(u)&&c}));var l=this.kt(a);return l!==0||s===l?o:void 0},this._rrweb=e,this.rt=t,this.ct=new DRe({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 _2=Uint8Array,gb=Uint16Array,zQ=Uint32Array,Gne=new _2([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]),One=new _2([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]),YRe=new _2([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),VRe=function(i,e){for(var t=new gb(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];var r=new zQ(t[30]);for(n=1;n<30;++n)for(var o=t[n];o<t[n+1];++o)r[o]=o-t[n]<<5|n;return[t,r]},jRe=VRe(Gne,2),B7t=jRe[0],zne=jRe[1];B7t[28]=258,zne[258]=28;for(var KRe=VRe(One,0)[1],JRe=new gb(32768),jI=0;jI<32768;++jI){var r4=(43690&jI)>>>1|(21845&jI)<<1;r4=(61680&(r4=(52428&r4)>>>2|(13107&r4)<<2))>>>4|(3855&r4)<<4,JRe[jI]=((65280&r4)>>>8|(255&r4)<<8)>>>1}var I8=function(i,e,t){for(var n=i.length,r=0,o=new gb(e);r<n;++r)++o[i[r]-1];var a,s=new gb(e);for(r=0;r<e;++r)s[r]=s[r-1]+o[r-1]<<1;for(a=new gb(n),r=0;r<n;++r)a[r]=JRe[s[i[r]-1]++]>>>15-i[r];return a},o4=new _2(288);for(jI=0;jI<144;++jI)o4[jI]=8;for(jI=144;jI<256;++jI)o4[jI]=9;for(jI=256;jI<280;++jI)o4[jI]=7;for(jI=280;jI<288;++jI)o4[jI]=8;var dG=new _2(32);for(jI=0;jI<32;++jI)dG[jI]=5;var S7t=I8(o4,9),w7t=I8(dG,5),WRe=function(i){return(i/8>>0)+(7&i&&1)},qRe=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var n=new(i instanceof gb?gb:i instanceof zQ?zQ:_2)(t-e);return n.set(i.subarray(e,t)),n},ZS=function(i,e,t){t<<=7&e;var n=e/8>>0;i[n]|=t,i[n+1]|=t>>>8},C8=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},Hne=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,o=t.slice();if(!r)return[new _2(0),0];if(r==1){var a=new _2(t[0].s+1);return a[t[0].s]=1,[a,1]}t.sort(function(z,U){return z.f-U.f}),t.push({s:-1,f:25001});var s=t[0],l=t[1],c=0,u=1,d=2;for(t[0]={s:-1,f:s.f+l.f,l:s,r:l};u!=r-1;)s=t[t[c].f<t[d].f?c++:d++],l=t[c!=u&&t[c].f<t[d].f?c++:d++],t[u++]={s:-1,f:s.f+l.f,l:s,r:l};var f=o[0].s;for(n=1;n<r;++n)o[n].s>f&&(f=o[n].s);var h=new gb(f+1),g=Yne(t[u-1],h,0);if(g>e){n=0;var y=0,v=g-e,_=1<<v;for(o.sort(function(z,U){return h[U.s]-h[z.s]||z.f-U.f});n<r;++n){var x=o[n].s;if(!(h[x]>e))break;y+=_-(1<<g-h[x]),h[x]=e}for(y>>>=v;y>0;){var S=o[n].s;h[S]<e?y-=1<<e-h[S]++-1:++n}for(;n>=0&&y;--n){var M=o[n].s;h[M]==e&&(--h[M],++y)}g=e}return[new _2(h),g]},Yne=function(i,e,t){return i.s==-1?Math.max(Yne(i.l,e,t+1),Yne(i.r,e,t+1)):e[i.s]=t},XRe=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new gb(++e),n=0,r=i[0],o=1,a=function(l){t[n++]=l},s=1;s<=e;++s)if(i[s]==r&&s!=e)++o;else{if(!r&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(r),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(r);o=1,r=i[s]}return[t.subarray(0,n),e]},x8=function(i,e){for(var t=0,n=0;n<e.length;++n)t+=i[n]*e[n];return t},Vne=function(i,e,t){var n=t.length,r=WRe(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 o=0;o<n;++o)i[r+o+4]=t[o];return 8*(r+4+n)},ZRe=function(i,e,t,n,r,o,a,s,l,c,u){ZS(e,u++,t),++r[256];for(var d=Hne(r,15),f=d[0],h=d[1],g=Hne(o,15),y=g[0],v=g[1],_=XRe(f),x=_[0],S=_[1],M=XRe(y),z=M[0],U=M[1],H=new gb(19),k=0;k<x.length;++k)H[31&x[k]]++;for(k=0;k<z.length;++k)H[31&z[k]]++;for(var j=Hne(H,7),G=j[0],ee=j[1],K=19;K>4&&!G[YRe[K-1]];--K);var ie,ce,ue,le,_e=c+5<<3,ye=x8(r,o4)+x8(o,dG)+a,Qe=x8(r,f)+x8(o,y)+a+14+3*K+x8(H,G)+(2*H[16]+3*H[17]+7*H[18]);if(_e<=ye&&_e<=Qe)return Vne(e,u,i.subarray(l,l+c));if(ZS(e,u,1+(Qe<ye)),u+=2,Qe<ye){ie=I8(f,h),ce=f,ue=I8(y,v),le=y;var Me=I8(G,ee);for(ZS(e,u,S-257),ZS(e,u+5,U-1),ZS(e,u+10,K-4),u+=14,k=0;k<K;++k)ZS(e,u+3*k,G[YRe[k]]);u+=3*K;for(var Te=[x,z],Ee=0;Ee<2;++Ee){var Ge=Te[Ee];for(k=0;k<Ge.length;++k){var Ke=31&Ge[k];ZS(e,u,Me[Ke]),u+=G[Ke],Ke>15&&(ZS(e,u,Ge[k]>>>5&127),u+=Ge[k]>>>12)}}}else ie=S7t,ce=o4,ue=w7t,le=dG;for(k=0;k<s;++k)if(n[k]>255){Ke=n[k]>>>18&31,C8(e,u,ie[Ke+257]),u+=ce[Ke+257],Ke>7&&(ZS(e,u,n[k]>>>23&31),u+=Gne[Ke]);var nt=31&n[k];C8(e,u,ue[nt]),u+=le[nt],nt>3&&(C8(e,u,n[k]>>>5&8191),u+=One[nt])}else C8(e,u,ie[n[k]]),u+=ce[n[k]];return C8(e,u,ie[256]),u+ce[256]},M7t=new zQ([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Q7t=function(){for(var i=new zQ(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i}(),R7t=function(){var i=4294967295;return{p:function(e){for(var t=i,n=0;n<e.length;++n)t=Q7t[255&t^e[n]]^t>>>8;i=t},d:function(){return 4294967295^i}}},D7t=function(i,e,t,n,r){return function(o,a,s,l,c,u){var d=o.length,f=new _2(l+d+5*(1+Math.floor(d/7e3))+c),h=f.subarray(l,f.length-c),g=0;if(!a||d<8)for(var y=0;y<=d;y+=65535){var v=y+65535;v<d?g=Vne(h,g,o.subarray(y,v)):(h[y]=u,g=Vne(h,g,o.subarray(y,d)))}else{for(var _=M7t[a-1],x=_>>>13,S=8191&_,M=(1<<s)-1,z=new gb(32768),U=new gb(M+1),H=Math.ceil(s/3),k=2*H,j=function(Et){return(o[Et]^o[Et+1]<<H^o[Et+2]<<k)&M},G=new zQ(25e3),ee=new gb(288),K=new gb(32),ie=0,ce=0,ue=(y=0,0),le=0,_e=0;y<d;++y){var ye=j(y),Qe=32767&y,Me=U[ye];if(z[Qe]=Me,U[ye]=Qe,le<=y){var Te=d-y;if((ie>7e3||ue>24576)&&Te>423){g=ZRe(o,h,0,G,ee,K,ce,ue,_e,y-_e,g),ue=ie=ce=0,_e=y;for(var Ee=0;Ee<286;++Ee)ee[Ee]=0;for(Ee=0;Ee<30;++Ee)K[Ee]=0}var Ge=2,Ke=0,nt=S,lt=Qe-Me&32767;if(Te>2&&ye==j(y-lt))for(var Rt=Math.min(x,Te)-1,pt=Math.min(32767,y),Fe=Math.min(258,Te);lt<=pt&&--nt&&Qe!=Me;){if(o[y+Ge]==o[y+Ge-lt]){for(var We=0;We<Fe&&o[y+We]==o[y+We-lt];++We);if(We>Ge){if(Ge=We,Ke=lt,We>Rt)break;var $e=Math.min(lt,We-2),_t=0;for(Ee=0;Ee<$e;++Ee){var Tt=y-lt+Ee+32768&32767,yt=Tt-z[Tt]+32768&32767;yt>_t&&(_t=yt,Me=Tt)}}}lt+=(Qe=Me)-(Me=z[Qe])+32768&32767}if(Ke){G[ue++]=268435456|zne[Ge]<<18|KRe[Ke];var tt=31&zne[Ge],Pt=31&KRe[Ke];ce+=Gne[tt]+One[Pt],++ee[257+tt],++K[Pt],le=y+Ge,++ie}else G[ue++]=o[y],++ee[o[y]]}}g=ZRe(o,h,u,G,ee,K,ce,ue,_e,y-_e,g)}return qRe(f,0,l+WRe(g)+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)},jne=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8},N7t=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&&jne(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)}},T7t=function(i){return 10+(i.filename&&i.filename.length+1||0)};function $Re(i,e){e===void 0&&(e={});var t=R7t(),n=i.length;t.p(i);var r=D7t(i,e,T7t(e),8),o=r.length;return N7t(r,e),jne(r,o-8,t.d()),jne(r,o-4,n),r}function eDe(i,e){var t=i.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(i);for(var n=new _2(i.length+(i.length>>>1)),r=0,o=function(c){n[r++]=c},a=0;a<t;++a){if(r+5>n.length){var s=new _2(r+8+(t-a<<1));s.set(n),n=s}var l=i.charCodeAt(a);l<128||e?o(l):l<2048?(o(192|l>>>6),o(128|63&l)):l>55295&&l<57344?(o(240|(l=65536+(1047552&l)|1023&i.charCodeAt(++a))>>>18),o(128|l>>>12&63),o(128|l>>>6&63),o(128|63&l)):(o(224|l>>>12),o(128|l>>>6&63),o(128|63&l))}return qRe(n,0,r)}function P7t(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<jb(100*e,0,100)}var xw="disabled",Kne="sampled",AG="active",a4="buffering",Jne="paused",Wne="trigger",FB=Wne+"_activated",fE=Wne+"_pending",UB=Wne+"_"+xw;function tDe(i,e){return e.some(t=>t.matching==="regex"&&new RegExp(t.url).test(i))}class nDe{constructor(e){this.xt=e}triggerStatus(e){var t=this.xt.map(n=>n.triggerStatus(e));return t.includes(FB)?FB:t.includes(fE)?fE:UB}stop(){this.xt.forEach(e=>e.stop())}}class iDe{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(UB),t.size){case 0:return UB;case 1:return Array.from(t)[0];default:return fE}}stop(){this.xt.forEach(e=>e.stop())}}class k7t{triggerStatus(){return fE}stop(){}}class L7t{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?UB:((t=this._instance)==null?void 0:t.get_property(mne))===e?FB:fE}triggerStatus(e){var t=this.Pt(e),n=t===FB?FB:t===fE?fE:UB;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:n}),n}checkUrlTriggerConditions(e,t,n){if(Aa!==void 0&&Aa.location.href){var r=Aa.location.href,o=this.urlBlocked,a=tDe(r,this.It);o&&a||(a&&!o?e():!a&&o&&t(),tDe(r,this.Et)&&n("url"))}}stop(){}}class F7t{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this.Rt=()=>{},this._instance=e}triggerStatus(){var e=fE;return T_(this.linkedFlag)&&(e=UB),this.linkedFlagSeen&&(e=FB),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,!T_(this.linkedFlag)&&!this.linkedFlagSeen){var r=OC(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,o=OC(this.linkedFlag)?null:this.linkedFlag.variant;this.Rt=this._instance.onFeatureFlags((a,s)=>{var l=!1;if(GC(s)&&r in s){var c=s[r];l=kB(c)?c===!0:o?c===o:!!c}this.linkedFlagSeen=l,l&&t(r,o)})}}stop(){this.Rt()}}class U7t{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?UB:((t=this._instance)==null?void 0:t.get_property(yne))===e?FB:fE}triggerStatus(e){var t=this.Mt(e),n=t===FB?FB:t===fE?fE:UB;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:n}),n}stop(){}}function G7t(i){return i.isRecordingEnabled?a4:xw}function O7t(i){if(!i.receivedFlags)return a4;if(!i.isRecordingEnabled)return xw;if(i.urlTriggerMatching.urlBlocked)return Jne;var e=i.isSampled===!0,t=new nDe([i.eventTriggerMatching,i.urlTriggerMatching,i.linkedFlagMatching]).triggerStatus(i.sessionId);return e?Kne:t===FB?AG:t===fE?a4:i.isSampled===!1?xw:AG}function z7t(i){if(!i.receivedFlags)return a4;if(!i.isRecordingEnabled)return xw;if(i.urlTriggerMatching.urlBlocked)return Jne;var e=new iDe([i.eventTriggerMatching,i.urlTriggerMatching,i.linkedFlagMatching]).triggerStatus(i.sessionId),t=e!==UB,n=kB(i.isSampled);return t&&e===fE?a4:t&&e===UB||n&&!i.isSampled?xw:i.isSampled===!0?Kne:AG}var E8="[SessionRecording]",hE=bx(E8);function fG(){var i;return F0==null||(i=F0.__PosthogExtensions__)==null||(i=i.rrweb)==null?void 0:i.record}var H7t=3e5,Y7t=[K2.MouseMove,K2.MouseInteraction,K2.Scroll,K2.ViewportResize,K2.Input,K2.TouchMove,K2.MediaInteraction,K2.Drag],rDe=i=>({rrwebMethod:i,enqueuedAt:Date.now(),attempt:1});function s4(i){return function(e,t){for(var n="",r=0;r<e.length;){var o=e[r++];n+=String.fromCharCode(o)}return n}($Re(eDe(JSON.stringify(i))))}function oDe(i){return i.type===XS.Custom&&i.data.tag==="sessionIdle"}class V7t{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(E8+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Dt(){var e,t;return this.Lt.triggerStatus(this.sessionId)===fE?6e4:(e=(t=this._instance.config.session_recording)==null?void 0:t.full_snapshot_interval_millis)!==null&&e!==void 0?e:H7t}get jt(){var e=this._instance.get_property(y8);return kB(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(gne),t=!this._instance.config.disable_session_recording;return Aa&&e&&t}get Ut(){var e=!!this._instance.get_property(oRe),t=this._instance.config.enable_recording_console_log;return t??e}get qt(){var e,t,n,r,o,a,s=this._instance.config.session_recording.captureCanvas,l=this._instance.get_property(lRe),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,d=(o=(a=s==null?void 0:s.canvasQuality)!==null&&a!==void 0?a:l==null?void 0:l.quality)!==null&&o!==void 0?o:.4;if(typeof d=="string"){var f=parseFloat(d);d=isNaN(f)?.4:f}return{enabled:c,fps:jb(u,0,12,"canvas recording fps",4),quality:jb(d,0,1,"canvas recording quality",.4)}}get Bt(){var e,t,n=this._instance.get_property(aRe),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},o=(r==null?void 0:r.recordHeaders)||(n==null?void 0:n.recordHeaders),a=(r==null?void 0:r.recordBody)||(n==null?void 0:n.recordBody),s=GC(this._instance.config.capture_performance)?this._instance.config.capture_performance.network_timing:this._instance.config.capture_performance,l=!!(kB(s)?s:n!=null&&n.capturePerformance);return o||a||l?{recordHeaders:o,recordBody:a,recordPerformance:l}:void 0}get Ht(){var e,t,n,r,o,a,s=this._instance.get_property(sRe),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=(o=l==null?void 0:l.maskTextSelector)!==null&&o!==void 0?o:s==null?void 0:s.maskTextSelector,d=(a=l==null?void 0:l.blockSelector)!==null&&a!==void 0?a:s==null?void 0:s.blockSelector;return Tu(c)&&Tu(u)&&Tu(d)?void 0:{maskAllInputs:c==null||c,maskTextSelector:u,blockSelector:d}}get Wt(){var e=this._instance.get_property(cRe);return AE(e)?e:null}get Gt(){var e=this._instance.get_property(uRe);return AE(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}):a4}constructor(e){if(this.Vt=G7t,this.Jt=!1,this.Qt=[],this.Zt="unknown",this.ti=Date.now(),this.Lt=new k7t,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(Xd!=null&&Xd.visibilityState){var r="window "+Xd.visibilityState;this.ui(r,{})}},this._instance=e,this.Ot=!1,this.vi="/s/",this.ci=void 0,this.Jt=!1,!this._instance.sessionManager)throw hE.error("started without valid sessionManager"),new Error(E8+" started without valid sessionManager. This is a bug.");if(this._instance.config.__preview_experimental_cookieless_mode)throw new Error(E8+" cannot be used with __preview_experimental_cookieless_mode.");this.Xt=new F7t(this._instance),this.Kt=new L7t(this._instance),this.Yt=new U7t(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&&hE.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),IC(Aa,"beforeunload",this.oi),IC(Aa,"offline",this.li),IC(Aa,"online",this.hi),IC(Aa,"visibilitychange",this.di),this.mi(),this.bi(),T_(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){hE.error("Could not add $pageview to rrweb session",r)}})),this.ei||(this.ei=this.At.onSessionId((t,n,r)=>{var o,a;r&&(this.ui("$session_id_change",{sessionId:t,windowId:n,changeReason:r}),(o=this._instance)==null||(o=o.persistence)==null||o.unregister(yne),(a=this._instance)==null||(a=a.persistence)==null||a.unregister(mne))}))):this.stopRecording()}stopRecording(){var e,t,n,r;this.Ot&&this.ci&&(this.ci(),this.ci=void 0,this.Ot=!1,Aa==null||Aa.removeEventListener("beforeunload",this.oi),Aa==null||Aa.removeEventListener("offline",this.li),Aa==null||Aa.removeEventListener("online",this.hi),Aa==null||Aa.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(),hE.info("stopped"))}Si(){var e;(e=this._instance.persistence)==null||e.unregister(y8)}$i(e){var t,n=this.Ct!==e,r=this.Wt;if(AE(r)){var o=this.jt,a=n||!kB(o),s=a?P7t(e,r):o;a&&(s?this.ki(Kne):hE.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({[y8]:s})}else this.Si()}onRemoteConfig(e){var t,n,r,o;this.ui("$remote_config_received",e),this.xi(e),(t=e.sessionRecording)!=null&&t.endpoint&&(this.vi=(o=e.sessionRecording)==null?void 0:o.endpoint),this.mi(),((n=e.sessionRecording)==null?void 0:n.triggerMatchType)==="any"?(this.Vt=O7t,this.Lt=new nDe([this.Yt,this.Kt])):(this.Vt=z7t,this.Lt=new iDe([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,(a,s)=>{this.ki("linked_flag_matched",{flag:a,variant:s})}),this.Jt=!0,this.startIfEnabledOrStop()}mi(){AE(this.Wt)&&T_(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 o,a,s,l,c,u,d,f,h,g=(o=e.sessionRecording)==null?void 0:o.sampleRate,y=T_(g)?null:parseFloat(g);T_(y)&&this.Si();var v=(a=e.sessionRecording)==null?void 0:a.minimumDurationMilliseconds;n.register({[gne]:!!e.sessionRecording,[oRe]:(s=e.sessionRecording)==null?void 0:s.consoleLogRecordingEnabled,[aRe]:Dd({capturePerformance:e.capturePerformance},(l=e.sessionRecording)==null?void 0:l.networkPayloadCapture),[sRe]:(c=e.sessionRecording)==null?void 0:c.masking,[lRe]:{enabled:(u=e.sessionRecording)==null?void 0:u.recordCanvas,fps:(d=e.sessionRecording)==null?void 0:d.canvasFps,quality:(f=e.sessionRecording)==null?void 0:f.canvasQuality},[cRe]:y,[uRe]:Tu(v)?null:v,[dRe]:(h=e.sessionRecording)==null?void 0:h.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(!Tu(Object.assign)&&!Tu(Array.from)&&!(this.Ot||this._instance.config.disable_session_recording||this._instance.consent.isOptedOut())){var t;this.Ot=!0,this.At.checkAndGetSessionAndWindowId(),fG()?this.Ei():(t=F0.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,this.Ii,n=>{if(n)return hE.error("could not load recorder",n);this.Ei()}),hE.info("starting"),this.status===AG&&this.ki(e||"recording_initialized")}}get Ii(){var e;return((e=this._instance)==null||(e=e.persistence)==null||(e=e.get_property(dRe))==null?void 0:e.script)||"recorder"}Pi(e){var t;return e.type===3&&Y7t.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:o,sessionId:a}=this.At.checkAndGetSessionAndWindowId(!t,e.timestamp),s=this.Ct!==a,l=this.fi!==o;this.fi=o,this.Ct=a,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}):hE.warn("could not emit queued rrweb event.",t,e),!1}}ui(e,t){return this.Mi(rDe(()=>fG().addCustomEvent(e,t)))}Ci(){return this.Mi(rDe(()=>fG().takeFullSnapshot()))}Ei(){var e,t,n,r,o={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},a=this._instance.config.session_recording;for(var[s,l]of Object.entries(a||{}))s in o&&(s==="maskInputOptions"?o.maskInputOptions=Dd({password:!0},l):o[s]=l);this.qt&&this.qt.enabled&&(o.recordCanvas=!0,o.sampling={canvas:this.qt.fps},o.dataURLOptions={type:"image/webp",quality:this.qt.quality}),this.Ht&&(o.maskAllInputs=(t=this.Ht.maskAllInputs)===null||t===void 0||t,o.maskTextSelector=(n=this.Ht.maskTextSelector)!==null&&n!==void 0?n:void 0,o.blockSelector=(r=this.Ht.blockSelector)!==null&&r!==void 0?r:void 0);var c=fG();if(c){this.Fi=(e=this.Fi)!==null&&e!==void 0?e:new b7t(c,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(d,f)=>{var h="Too many mutations on node '"+d+"'. Rate limiting. This could be due to SVG animations or something similar";hE.info(h,{node:f}),this.log(E8+" "+h,"warn")}});var u=this.Oi();this.ci=c(Dd({emit:d=>{this.onRRwebEmit(d)},plugins:u},o)),this.ti=Date.now(),this.Zt=kB(this.Zt)?this.Zt:"unknown",this.ui("$session_options",{sessionRecordingOptions:o,activePlugins:u.map(d=>d==null?void 0:d.name)}),this.ui("$posthog_config",{config:this._instance.config})}else hE.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=F0.__PosthogExtensions__)==null||(e=e.rrwebPlugins)==null?void 0:e.getRecordConsolePlugin;r&&this.Ut&&n.push(r());var o=(t=F0.__PosthogExtensions__)==null||(t=t.rrwebPlugins)==null?void 0:t.getRecordNetworkPlugin;return this.Bt&&v2(o)&&(!Y6t.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?n.push(o(E7t(this._instance.config,this.Bt))):hE.info("NetworkCapture not started because we are on localhost.")),n}onRRwebEmit(e){var t;if(this.Ai(),e&&GC(e)){if(e.type===XS.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===XS.Custom&&r.data.tag==="recording paused"){var r;e.type===XS.FullSnapshot&&this.Ti(),e.type===XS.FullSnapshot&&this.Jt&&this.Lt.triggerStatus(this.sessionId)===fE&&this.pi();var o=this.Fi?this.Fi.throttleMutations(e):e;if(o){var a=function(f){var h=f;if(h&&GC(h)&&h.type===6&&GC(h.data)&&h.data.plugin==="rrweb/console@1"){h.data.payload.payload.length>10&&(h.data.payload.payload=h.data.payload.payload.slice(0,10),h.data.payload.payload.push("...[truncated]"));for(var g=[],y=0;y<h.data.payload.payload.length;y++)h.data.payload.payload[y]&&h.data.payload.payload[y].length>2e3?g.push(h.data.payload.payload[y].slice(0,2e3)+"...[truncated]"):g.push(h.data.payload.payload[y]);return h.data.payload.payload=g,f}return f}(o);if(this.Ri(a),this.Zt!==!0||oDe(a)){if(oDe(a)){var s=a.data.payload;if(s){var l=s.lastActivityTimestamp,c=s.threshold;a.timestamp=l+c}}var u=(t=this._instance.config.session_recording.compress_events)===null||t===void 0||t?function(f){if(cG(f)<1024)return f;try{if(f.type===XS.FullSnapshot)return Dd({},f,{data:s4(f.data),cv:"2024-10"});if(f.type===XS.IncrementalSnapshot&&f.data.source===K2.Mutation)return Dd({},f,{cv:"2024-10",data:Dd({},f.data,{texts:s4(f.data.texts),attributes:s4(f.data.attributes),removes:s4(f.data.removes),adds:s4(f.data.adds)})});if(f.type===XS.IncrementalSnapshot&&f.data.source===K2.StyleSheetRule)return Dd({},f,{cv:"2024-10",data:Dd({},f.data,{adds:f.data.adds?s4(f.data.adds):void 0,removes:f.data.removes?s4(f.data.removes):void 0})})}catch(h){hE.error("could not compress event - will use uncompressed event",h)}return f}(a):a,d={$snapshot_bytes:cG(u),$snapshot_data:u,$session_id:this.Ct,$window_id:this.fi};this.status!==xw?this.Ui(d):this.pi()}}}}}Li(){if(!this._instance.config.capture_pageview&&Aa){var e=this.yi(Aa.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=AE(t)&&t>=0,r=AE(e)&&n&&t<e;return this.status===a4||this.status===Jne||this.status===xw||r?(this.qi=setTimeout(()=>{this.ai()},2e3),this.C):(this.C.data.length>0&&Lne(this.C).forEach(o=>{this.Bi({$snapshot_bytes:o.size,$snapshot_data:o.data,$session_id:o.sessionId,$window_id:o.windowId,$lib:"web",$lib_version:JS.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)===fE&&((t=this._instance)==null||(t=t.persistence)==null||t.register({[e==="url"?mne:yne]:this.Ct}),this.ai(),this.ki(e+"_trigger_matched"))}ji(){this.Kt.urlBlocked||(this.Kt.urlBlocked=!0,clearInterval(this.wi),hE.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"}),hE.info("recording resumed"))}bi(){this.Yt.Tt.length!==0&&T_(this.ni)&&(this.ni=this._instance.on("eventCaptured",e=>{try{this.Yt.Tt.includes(e.event)&&this.zi("event")}catch(t){hE.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({[y8]:!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}),hE.info(e.replace("_"," "),t),Iy(["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 qne=bx("[SegmentIntegration]");function j7t(i,e){var t=i.config.segment;if(!t)return e();(function(n,r){var o=n.config.segment;if(!o)return r();var a=l=>{var c=()=>l.anonymousId()||Cw();n.config.get_device_id=c,l.id()&&(n.register({distinct_id:l.id(),$device_id:c()}),n.persistence.set_property(qS,"identified")),r()},s=o.user();"then"in s&&v2(s.then)?s.then(l=>a(l)):a(s)})(i,()=>{t.register((n=>{Promise&&Promise.resolve||qne.warn("This browser does not have Promise support, and can not use the segment integration");var r=(o,a)=>{if(!a)return o;o.event.userId||o.event.anonymousId===n.get_distinct_id()||(qne.info("No userId set, resetting PostHog"),n.reset()),o.event.userId&&o.event.userId!==n.get_distinct_id()&&(qne.info("UserId set, identifying with PostHog"),n.identify(o.event.userId));var s=n.calculateEventProperties(a,o.event.properties);return o.event.properties=Object.assign({},s,o.event.properties),o};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:o=>r(o,o.event.event),page:o=>r(o,"$pageview"),identify:o=>r(o,"$identify"),screen:o=>r(o,"$screen")}})(i)).then(()=>{e()})})}var aDe="posthog-js";function sDe(i,e){var{organization:t,projectId:n,prefix:r,severityAllowList:o=["error"]}=e===void 0?{}:e;return a=>{var s,l,c,u,d;if(!(o==="*"||o.includes(a.level))||!i.__loaded)return a;a.tags||(a.tags={});var f=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/person/"+i.get_distinct_id());a.tags["PostHog Person URL"]=f,i.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var h=((s=a.exception)==null?void 0:s.values)||[],g=h.map(v=>Dd({},v,{stacktrace:v.stacktrace?Dd({},v.stacktrace,{type:"raw",frames:(v.stacktrace.frames||[]).map(_=>Dd({},_,{platform:"web:javascript"}))}):void 0})),y={$exception_message:((l=h[0])==null?void 0:l.value)||a.message,$exception_type:(c=h[0])==null?void 0:c.type,$exception_personURL:f,$exception_level:a.level,$exception_list:g,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((u=h[0])==null?void 0:u.value)||a.message,$sentry_exception_type:(d=h[0])==null?void 0:d.type,$sentry_tags:a.tags};return t&&n&&(y.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+a.event_id),i.exceptions.sendExceptionEvent(y),a}}class K7t{constructor(e,t,n,r,o){this.name=aDe,this.setupOnce=function(a){a(sDe(e,{organization:t,projectId:n,prefix:r,severityAllowList:o}))}}}var J7t=Aa!=null&&Aa.location?tG(Aa.location.hash,"__posthog")||tG(location.hash,"state"):null,lDe="_postHogToolbarParams",cDe=bx("[Toolbar]"),Ew=function(i){return i[i.UNINITIALIZED=0]="UNINITIALIZED",i[i.LOADING=1]="LOADING",i[i.LOADED=2]="LOADED",i}(Ew||{});class W7t{constructor(e){this.instance=e}Hi(e){F0.ph_toolbar_state=e}Wi(){var e;return(e=F0.ph_toolbar_state)!==null&&e!==void 0?e:Ew.UNINITIALIZED}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),!Aa||!Xd)return!1;e=e??Aa.location,n=n??Aa.history;try{if(!t){try{Aa.localStorage.setItem("test","test"),Aa.localStorage.removeItem("test")}catch{return!1}t=Aa==null?void 0:Aa.localStorage}var r,o=J7t||tG(e.hash,"__posthog")||tG(e.hash,"state"),a=o?XQe(()=>JSON.parse(atob(decodeURIComponent(o))))||XQe(()=>JSON.parse(decodeURIComponent(o))):null;return a&&a.action==="ph_authorize"?((r=a).source="url",r&&Object.keys(r).length>0&&(a.desiredHash?e.hash=a.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(lDe)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token)&&(this.loadToolbar(r),!0)}catch{return!1}}Gi(e){var t=F0.ph_load_toolbar||F0.ph_load_editor;!T_(t)&&v2(t)?t(e,this.instance):cDe.warn("No toolbar load function found")}loadToolbar(e){var t=!(Xd==null||!Xd.getElementById(ARe));if(!Aa||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=Dd({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(Aa.localStorage.setItem(lDe,JSON.stringify(Dd({},r,{source:void 0}))),this.Wi()===Ew.LOADED)this.Gi(r);else if(this.Wi()===Ew.UNINITIALIZED){var o;this.Hi(Ew.LOADING),(o=F0.__PosthogExtensions__)==null||o.loadExternalDependency==null||o.loadExternalDependency(this.instance,"toolbar",a=>{if(a)return cDe.error("[Toolbar] Failed to load",a),void this.Hi(Ew.UNINITIALIZED);this.Hi(Ew.LOADED),this.Gi(r)}),IC(Aa,"turbolinks:load",()=>{this.Hi(Ew.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 q7t=bx("[TracingHeaders]");class X7t{constructor(e){this.Vi=void 0,this.Ki=void 0,this.nt=()=>{var t,n;Tu(this.Vi)&&((t=F0.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),Tu(this.Ki)&&((n=F0.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}J(e){var t,n;(t=F0.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=F0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",r=>{if(r)return q7t.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 bw=bx("[Web Vitals]"),uDe=9e5;class Z7t{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)=>Dd({},n,{["$web_vitals_"+r.name+"_event"]:Dd({},r),["$web_vitals_"+r.name+"_value"]:r.value}),{})),this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Zi=n=>{var r,o=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(Tu(o))bw.error("Could not read session ID. Dropping metrics!");else{this.C=this.C||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this.te();Tu(a)||(T_(n==null?void 0:n.name)||T_(n==null?void 0:n.value)?bw.error("Invalid metric received",n):this.ie&&n.value>=this.ie?bw.error("Ignoring metric with value >= "+this.ie,n):(this.C.url!==a&&(this.Xi(),this.Qi=setTimeout(this.Xi,this.flushToCaptureTimeoutMs)),Tu(this.C.url)&&(this.C.url=a),this.C.firstMetricTimestamp=Tu(this.C.firstMetricTimestamp)?Date.now():this.C.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.C.metrics.push(Dd({},n,{$current_url:a,$session_id:o.sessionId,$window_id:o.windowId,timestamp:Date.now()})),this.C.metrics.length===this.allowedMetrics.length&&this.Xi()))}},this.nt=()=>{var n,r,o,a,s=F0.__PosthogExtensions__;Tu(s)||Tu(s.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:r,onFCP:o,onINP:a}=s.postHogWebVitalsCallbacks),n&&r&&o&&a?(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&&o(this.Zi.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&a(this.Zi.bind(this)),this.i=!0):bw.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.Yi=!((t=this._instance.persistence)==null||!t.props[nRe]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=GC(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return Tu(n)?((t=this._instance.persistence)==null?void 0:t.props[rRe])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(GC(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get ie(){var e=GC(this._instance.config.capture_performance)&&AE(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:uDe;return 0<e&&e<=6e4?uDe:e}get isEnabled(){var e=hb==null?void 0:hb.protocol;if(e!=="http:"&&e!=="https:")return bw.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=GC(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:kB(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return kB(t)?t:this.Yi}startIfEnabled(){this.isEnabled&&!this.i&&(bw.info("enabled, starting..."),this.J(this.nt))}onRemoteConfig(e){var t=GC(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=GC(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[nRe]:t}),this._instance.persistence.register({[rRe]:n})),this.Yi=t,this.startIfEnabled()}J(e){var t,n;(t=F0.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks&&e(),(n=F0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"web-vitals",r=>{r?bw.error("failed to load script",r):e()})}te(){var e=Aa?Aa.location.href:void 0;return e||bw.error("Could not determine current URL"),e}}var $7t=bx("[Heatmaps]");function dDe(i){return GC(i)&&"clientX"in i&&"clientY"in i&&AE(i.clientX)&&AE(i.clientY)}class ePt{constructor(e){var t;this.rageclicks=new BRe,this.Yi=!1,this.i=!1,this.ee=null,this.instance=e,this.Yi=!((t=this.instance.persistence)==null||!t.props[hne])}get flushIntervalMilliseconds(){var e=5e3;return GC(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 Tu(this.instance.config.capture_heatmaps)?Tu(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;$7t.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({[hne]: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(){Aa&&Xd&&(IC(Aa,"beforeunload",this.se.bind(this)),IC(Xd,"click",e=>this.ae(e||(Aa==null?void 0:Aa.event)),{capture:!0}),IC(Xd,"mousemove",e=>this.le(e||(Aa==null?void 0:Aa.event)),{capture:!0}),this.ne=new RRe(this.instance,r7t,this.oe.bind(this)),this.ne.startIfEnabled(),this.i=!0)}ue(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),o=this.instance.scrollManager.scrollElement(),a=function(s,l,c){for(var u=s;u&&XU(u)&&!Iw(u,"body");){if(u===c)return!1;if(Iy(l,Aa==null?void 0:Aa.getComputedStyle(u).position))return!0;u=vRe(u)}return!1}(yRe(e),["fixed","sticky"],o);return{x:e.clientX+(a?0:r),y:e.clientY+(a?0:n),target_fixed:a,type:t}}ae(e,t){var n;if(t===void 0&&(t="click"),!fRe(e.target)&&dDe(e)){var r=this.ue(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.he(Dd({},r,{type:"rageclick"})),this.he(r)}}le(e){!fRe(e.target)&&dDe(e)&&(clearTimeout(this.de),this.de=setTimeout(()=>{this.he(this.ue(e,"mousemove"))},500))}he(e){if(Aa){var t=Aa.location.href;this.C=this.C||{},this.C[t]||(this.C[t]=[]),this.C[t].push(e)}}se(){this.C&&!kQ(this.C)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class tPt{constructor(e){this._instance=e}doPageView(e,t){var n,r=this.ve(e,t);return this.ce={pathname:(n=Aa==null?void 0:Aa.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},o=this._instance.scrollManager.getContext();if(o&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:s,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:d}=o;if(!(Tu(a)||Tu(s)||Tu(l)||Tu(c)||Tu(u)||Tu(d))){a=Math.ceil(a),s=Math.ceil(s),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),d=Math.ceil(d);var f=a<=1?1:jb(s/a,0,1),h=a<=1?1:jb(l/a,0,1),g=c<=1?1:jb(u/c,0,1),y=c<=1?1:jb(d/c,0,1);r=i9(r,{$prev_pageview_last_scroll:s,$prev_pageview_last_scroll_percentage:f,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:y})}}return n.pathname&&(r.$prev_pageview_pathname=n.pathname),n.timestamp&&(r.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),r}}var nPt=function(i){var e,t,n,r,o="";for(e=t=0,n=(i=(i+"").replace(/\r\n/g,`
895
895
  `).replace(/\r/g,`
896
- `)).length,r=0;r<n;r++){var a=i.charCodeAt(r),s=null;a<128?t++:s=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),vw(s)||(t>e&&(o+=i.substring(e,t)),o+=s,e=t=r+1)}return t>e&&(o+=i.substring(e,i.length)),o},iPt=!!cne||!!lne,ADe="text/plain",hG=(i,e)=>{var[t,n]=i.split("?"),r=Dd({},e);n==null||n.split("&").forEach(a=>{var[s]=a.split("=");delete r[s]});var o=V6t(r);return t+"?"+(o=o?(n?n+"&":"")+o:n)},b8=(i,e)=>JSON.stringify(i,(t,n)=>typeof n=="bigint"?n.toString():n,e),Xne=i=>{var{data:e,compression:t}=i;if(e){if(t===WS.GZipJS){var n=$Re(eDe(b8(e)),{mtime:0}),r=new Blob([n],{type:ADe});return{contentType:ADe,body:r,estimatedSize:r.size}}if(t===WS.Base64){var o=function(l){var c,u,d,f,h,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",y=0,v=0,_="",x=[];if(!l)return l;l=nPt(l);do c=(h=l.charCodeAt(y++)<<16|l.charCodeAt(y++)<<8|l.charCodeAt(y++))>>18&63,u=h>>12&63,d=h>>6&63,f=63&h,x[v++]=g.charAt(c)+g.charAt(u)+g.charAt(d)+g.charAt(f);while(y<l.length);switch(_=x.join(""),l.length%3){case 1:_=_.slice(0,-2)+"==";break;case 2:_=_.slice(0,-1)+"="}return _}(b8(e)),a=(l=>"data="+encodeURIComponent(typeof l=="string"?l:b8(l)))(o);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var s=b8(e);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}}},B8=[];lne&&B8.push({transport:"fetch",method:i=>{var e,t,{contentType:n,body:r,estimatedSize:o}=(e=Xne(i))!==null&&e!==void 0?e:{},a=new Headers;O1(i.headers,function(u,d){a.append(d,u)}),n&&a.append("Content-Type",n);var s=i.url,l=null;if(VQe){var c=new VQe;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),i.timeout)}}lne(s,Dd({method:(i==null?void 0:i.method)||"GET",headers:a,keepalive:i.method==="POST"&&(o||0)<52428.8,body:r,signal:(t=l)==null?void 0:t.signal},i.fetchOptions)).then(u=>u.text().then(d=>{var f={statusCode:u.status,text:d};if(u.status===200)try{f.json=JSON.parse(d)}catch(h){vA.error(h)}i.callback==null||i.callback(f)})).catch(u=>{vA.error(u),i.callback==null||i.callback({statusCode:0,text:u})}).finally(()=>l?clearTimeout(l.timeout):null)}}),cne&&B8.push({transport:"XHR",method:i=>{var e,t=new cne;t.open(i.method||"GET",i.url,!0);var{contentType:n,body:r}=(e=Xne(i))!==null&&e!==void 0?e:{};O1(i.headers,function(o,a){t.setRequestHeader(a,o)}),n&&t.setRequestHeader("Content-Type",n),i.timeout&&(t.timeout=i.timeout),t.withCredentials=!0,t.onreadystatechange=()=>{if(t.readyState===4){var o={statusCode:t.status,text:t.responseText};if(t.status===200)try{o.json=JSON.parse(t.responseText)}catch{}i.callback==null||i.callback(o)}},t.send(r)}}),Vb!=null&&Vb.sendBeacon&&B8.push({transport:"sendBeacon",method:i=>{var e=hG(i.url,{beacon:"1"});try{var t,{contentType:n,body:r}=(t=Xne(i))!==null&&t!==void 0?t:{},o=typeof r=="string"?new Blob([r],{type:n}):r;Vb.sendBeacon(e,o)}catch{}}});var HQ=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 fDe(i,e,t){return b8({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var rPt={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=>HQ(t,n))),not_regex:(i,e)=>e.every(t=>i.every(n=>!HQ(t,n))),icontains:(i,e)=>e.map(pG).some(t=>i.map(pG).some(n=>t.includes(n))),not_icontains:(i,e)=>e.map(pG).every(t=>i.map(pG).every(n=>!t.includes(n)))},pG=i=>i.toLowerCase(),oPt=bx("[Error tracking]");class aPt{constructor(e){var t,n;this.fe=[],this._instance=e,this.fe=(t=(n=this._instance.persistence)==null?void 0:n.get_property(pne))!==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({[pne]:this.fe})}sendExceptionEvent(e){if(!this.pe(e))return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"});oPt.info("Skipping exception capture because a suppression rule matched")}pe(e){var t=e.$exception_list;if(!t||!aC(t)||t.length===0)return!1;var n=t.reduce((r,o)=>{var{type:a,value:s}=o;return OC(a)&&a.length>0&&r.$exception_types.push(a),OC(s)&&s.length>0&&r.$exception_values.push(s),r},{$exception_types:[],$exception_values:[]});return this.fe.some(r=>{var o=r.values.map(a=>{var s,l=rPt[a.operator],c=aC(a.value)?a.value:[a.value],u=(s=n[a.key])!==null&&s!==void 0?s:[];return c.length>0&&l(c,u)});return r.type==="OR"?o.some(Boolean):o.every(Boolean)})}}var I2="Mobile",gG="iOS",GB="Android",S8="Tablet",hDe=GB+" "+S8,pDe="iPad",gDe="Apple",mDe=gDe+" Watch",w8="Safari",YQ="BlackBerry",yDe="Samsung",vDe=yDe+"Browser",_De=yDe+" Internet",l4="Chrome",sPt=l4+" OS",IDe=l4+" "+gG,Zne="Internet Explorer",CDe=Zne+" "+I2,$ne="Opera",lPt=$ne+" Mini",eie="Edge",xDe="Microsoft "+eie,VQ="Firefox",EDe=VQ+" "+gG,M8="Nintendo",Q8="PlayStation",jQ="Xbox",bDe=GB+" "+I2,BDe=I2+" "+w8,R8="Windows",tie=R8+" Phone",SDe="Nokia",nie="Ouya",wDe="Generic",cPt=wDe+" "+I2.toLowerCase(),MDe=wDe+" "+S8.toLowerCase(),iie="Konqueror",UE="(\\d+(\\.\\d+)?)",rie=new RegExp("Version/"+UE),uPt=new RegExp(jQ,"i"),dPt=new RegExp(Q8+" \\w+","i"),APt=new RegExp(M8+" \\w+","i"),oie=new RegExp(YQ+"|PlayBook|BB10","i"),fPt={"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"},hPt=(i,e)=>e&&Iy(e,gDe)||function(t){return Iy(t,w8)&&!Iy(t,l4)&&!Iy(t,GB)}(i),QDe=function(i,e){return e=e||"",Iy(i," OPR/")&&Iy(i,"Mini")?lPt:Iy(i," OPR/")?$ne:oie.test(i)?YQ:Iy(i,"IE"+I2)||Iy(i,"WPDesktop")?CDe:Iy(i,vDe)?_De:Iy(i,eie)||Iy(i,"Edg/")?xDe:Iy(i,"FBIOS")?"Facebook "+I2:Iy(i,"UCWEB")||Iy(i,"UCBrowser")?"UC Browser":Iy(i,"CriOS")?IDe:Iy(i,"CrMo")||Iy(i,l4)?l4:Iy(i,GB)&&Iy(i,w8)?bDe:Iy(i,"FxiOS")?EDe:Iy(i.toLowerCase(),iie.toLowerCase())?iie:hPt(i,e)?Iy(i,I2)?BDe:w8:Iy(i,VQ)?VQ:Iy(i,"MSIE")||Iy(i,"Trident/")?Zne:Iy(i,"Gecko")?VQ:""},pPt={[CDe]:[new RegExp("rv:"+UE)],[xDe]:[new RegExp(eie+"?\\/"+UE)],[l4]:[new RegExp("("+l4+"|CrMo)\\/"+UE)],[IDe]:[new RegExp("CriOS\\/"+UE)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+UE)],[w8]:[rie],[BDe]:[rie],[$ne]:[new RegExp("(Opera|OPR)\\/"+UE)],[VQ]:[new RegExp(VQ+"\\/"+UE)],[EDe]:[new RegExp("FxiOS\\/"+UE)],[iie]:[new RegExp("Konqueror[:/]?"+UE,"i")],[YQ]:[new RegExp(YQ+" "+UE),rie],[bDe]:[new RegExp("android\\s"+UE,"i")],[_De]:[new RegExp(vDe+"\\/"+UE)],[Zne]:[new RegExp("(rv:|MSIE )"+UE)],Mozilla:[new RegExp("rv:"+UE)]},gPt=function(i,e){var t=QDe(i,e),n=pPt[t];if(Tu(n))return null;for(var r=0;r<n.length;r++){var o=n[r],a=i.match(o);if(a)return parseFloat(a[a.length-2])}return null},RDe=[[new RegExp(jQ+"; "+jQ+" (.*?)[);]","i"),i=>[jQ,i&&i[1]||""]],[new RegExp(M8,"i"),[M8,""]],[new RegExp(Q8,"i"),[Q8,""]],[oie,[YQ,""]],[new RegExp(R8,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[tie,""];if(new RegExp(I2).test(e)&&!/IEMobile\b/.test(e))return[R8+" "+I2,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var n=t[1],r=fPt[n]||"";return/arm/i.test(e)&&(r="RT"),[R8,r]}return[R8,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>{if(i&&i[3]){var e=[i[3],i[4],i[5]||"0"];return[gG,e.join(".")]}return[gG,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=Tu(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+GB+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+GB+")","i"),i=>{if(i&&i[2]){var e=[i[2],i[3],i[4]||"0"];return[GB,e.join(".")]}return[GB,""]}],[/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/,[sPt,""]],[/Linux|debian/i,["Linux",""]]],DDe=function(i){return APt.test(i)?M8:dPt.test(i)?Q8:uPt.test(i)?jQ:new RegExp(nie,"i").test(i)?nie:new RegExp("("+tie+"|WPDesktop)","i").test(i)?tie:/iPad/.test(i)?pDe:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?mDe:oie.test(i)?YQ:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(SDe,"i").test(i)?SDe:/(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(I2).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)?GB:hDe:GB:new RegExp("(pda|"+I2+")","i").test(i)?cPt:new RegExp(S8,"i").test(i)&&!new RegExp(S8+" pc","i").test(i)?MDe:""},mG="https?://(.*)",yG=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],mPt=zU(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],yG),aie="<masked>",yPt=["li_fat_id"];function NDe(i,e,t){if(!Xd)return{};var n,r=e?zU([],yG,t||[]):[],o=TDe(wne(Xd.URL,r,aie),i),a=(n={},O1(yPt,function(s){var l=LB.D(s);n[s]=l||null}),n);return i9(a,o)}function TDe(i,e){var t=mPt.concat(e||[]),n={};return O1(t,function(r){var o=eG(i,r);n[r]=o||null}),n}function PDe(i){var e=function(o){return o?o.search(mG+"google.([^/?]*)")===0?"google":o.search(mG+"bing.com")===0?"bing":o.search(mG+"yahoo.com")===0?"yahoo":o.search(mG+"duckduckgo.com")===0?"duckduckgo":null:null}(i),t=e!="yahoo"?"q":"p",n={};if(!vw(e)){n.$search_engine=e;var r=Xd?eG(Xd.referrer,t):"";r.length&&(n.ph_keyword=r)}return n}function kDe(){return navigator.language||navigator.userLanguage}function LDe(){return(Xd==null?void 0:Xd.referrer)||"$direct"}function FDe(i,e){var t=i?zU([],yG,e||[]):[],n=hb==null?void 0:hb.href.substring(0,1e3);return{r:LDe().substring(0,1e3),u:n?wne(n,t,aie):void 0}}function UDe(i){var e,{r:t,u:n}=i,r={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=UQ(t))==null?void 0:e.host};if(n){r.$current_url=n;var o=UQ(n);r.$host=o==null?void 0:o.host,r.$pathname=o==null?void 0:o.pathname;var a=TDe(n);i9(r,a)}if(t){var s=PDe(t);i9(r,s)}return r}function GDe(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function vPt(){try{return new Date().getTimezoneOffset()}catch{return}}function _Pt(i,e){if(!pb)return{};var t,n,r,o=i?zU([],yG,e||[]):[],[a,s]=function(l){for(var c=0;c<RDe.length;c++){var[u,d]=RDe[c],f=u.exec(l),h=f&&(v2(d)?d(f,l):d);if(h)return h}return["",""]}(pb);return i9(fne({$os:a,$os_version:s,$browser:QDe(pb,navigator.vendor),$device:DDe(pb),$device_type:(n=pb,r=DDe(n),r===pDe||r===hDe||r==="Kobo"||r==="Kindle Fire"||r===MDe?S8:r===M8||r===jQ||r===Q8||r===nie?"Console":r===mDe?"Wearable":r?I2:"Desktop"),$timezone:GDe(),$timezone_offset:vPt()}),{$current_url:wne(hb==null?void 0:hb.href,o,aie),$host:hb==null?void 0:hb.host,$pathname:hb==null?void 0:hb.pathname,$raw_user_agent:pb.length>1e3?pb.substring(0,997)+"...":pb,$browser_version:gPt(pb,navigator.vendor),$browser_language:kDe(),$browser_language_prefix:(t=kDe(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:Aa==null?void 0:Aa.screen.height,$screen_width:Aa==null?void 0:Aa.screen.width,$viewport_height:Aa==null?void 0:Aa.innerHeight,$viewport_width:Aa==null?void 0:Aa.innerWidth,$lib:"web",$lib_version:JS.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var OB=bx("[FeatureFlags]"),sie="$active_feature_flags",KQ="$override_feature_flags",ODe="$feature_flag_payloads",D8="$override_feature_flag_payloads",zDe="$feature_flag_request_id",HDe=i=>{var e={};for(var[t,n]of HU(i||{}))n&&(e[t]=n);return e},IPt=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]}))):OB.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),i},CPt=function(i){return i.FeatureFlags="feature_flags",i.Recordings="recordings",i}({});class xPt{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(vne),t=this._instance.get_property(KQ),n=this._instance.get_property(D8);if(!n&&!t)return e||{};var r=i9({},e||{}),o=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var a of o){var s,l,c=r[a],u=t==null?void 0:t[a],d=Tu(u)?(s=c==null?void 0:c.enabled)!==null&&s!==void 0&&s:!!u,f=Tu(u)?c.variant:typeof u=="string"?u:void 0,h=n==null?void 0:n[a],g=Dd({},c,{enabled:d,variant:d?f??(c==null?void 0:c.variant):void 0});d!==(c==null?void 0:c.enabled)&&(g.original_enabled=c==null?void 0:c.enabled),f!==(c==null?void 0:c.variant)&&(g.original_variant=c==null?void 0:c.variant),h&&(g.metadata=Dd({},c==null?void 0:c.metadata,{payload:h,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),r[a]=g}return this.ge||(OB.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.ge=!0),r}getFlagVariants(){var e=this._instance.get_property(LQ),t=this._instance.get_property(KQ);if(!t)return e||{};for(var n=i9({},e),r=Object.keys(t),o=0;o<r.length;o++)n[r[o]]=t[r[o]];return this.ge||(OB.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ge=!0),n}getFlagPayloads(){var e=this._instance.get_property(ODe),t=this._instance.get_property(D8);if(!t)return e||{};for(var n=i9({},e||{}),r=Object.keys(t),o=0;o<r.length;o++)n[r[o]]=t[r[o]];return this.ge||(OB.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:Dd({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(v8)||{}),group_properties:this._instance.get_property(n4)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0);var r=this._instance.config.__preview_remote_config,o=r?"/flags/?v=2":"/flags/?v=2&config=true",a=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",s=this._instance.requestRouter.endpointFor("api",o+a);r&&(n.timezone=GDe()),this.me=!0,this._instance.Ee({method:"POST",url:s,data:n,compression:this._instance.config.disable_compression?void 0:WS.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var c,u,d=!0;if(l.statusCode===200&&(this.ye||(this.$anon_distinct_id=void 0),d=!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=!d,l.json&&(c=l.json.quotaLimited)!=null&&c.includes(CPt.FeatureFlags))OB.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:{},d),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,o=this._instance.get_property(zDe)||void 0,a=this._instance.get_property(KU)||{};if((t.send_event||!("send_event"in t))&&(!(e in a)||!a[e].includes(r))){var s,l,c,u,d,f,h,g,y;aC(a[e])?a[e].push(r):a[e]=[r],(s=this._instance.persistence)==null||s.register({[KU]:a});var v=this.getFeatureFlagDetails(e),_={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:o,$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};Tu(v==null||(u=v.metadata)==null?void 0:u.version)||(_.$feature_flag_version=v.metadata.version);var x,S=(d=v==null||(f=v.reason)==null?void 0:f.description)!==null&&d!==void 0?d:v==null||(h=v.reason)==null?void 0:h.code;S&&(_.$feature_flag_reason=S),v!=null&&(g=v.metadata)!=null&&g.id&&(_.$feature_flag_id=v.metadata.id),Tu(v==null?void 0:v.original_variant)&&Tu(v==null?void 0:v.original_enabled)||(_.$feature_flag_original_response=Tu(v.original_variant)?v.original_enabled:v.original_variant),v!=null&&(y=v.metadata)!=null&&y.original_payload&&(_.$feature_flag_original_payload=v==null||(x=v.metadata)==null?void 0:x.original_payload),this._instance.capture("$feature_flag_called",_)}return n}OB.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:WS.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:r=>{var o,a=(o=r.json)==null?void 0:o.featureFlagPayloads;t((a==null?void 0:a[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this._e||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);OB.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(),o=this.getFlagsWithDetails();(function(a,s,l,c,u){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var d=IPt(a),f=d.flags,h=d.featureFlags,g=d.featureFlagPayloads;if(h){var y=a.requestId;if(aC(h)){OB.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(h)for(var _=0;_<h.length;_++)v[h[_]]=!0;s&&s.register({[sie]:h,[LQ]:v})}else{var x=h,S=g,M=f;a.errorsWhileComputingFlags&&(x=Dd({},l,x),S=Dd({},c,S),M=Dd({},u,M)),s&&s.register(Dd({[sie]:Object.keys(HDe(x)),[LQ]:x||{},[ODe]:S||{},[vne]:M||{}},y?{[zDe]:y}:{}))}}})(e,this._instance.persistence,n,r,o),this.Pe(t)}}override(e,t){t===void 0&&(t=!1),OB.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return OB.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(KQ),this._instance.persistence.unregister(D8),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(KQ);else if(n.flags)if(aC(n.flags)){for(var r={},o=0;o<n.flags.length;o++)r[n.flags[o]]=!0;this._instance.persistence.register({[KQ]:r})}else this._instance.persistence.register({[KQ]:n.flags})}return"payloads"in n&&(n.payloads===!1?this._instance.persistence.unregister(D8):n.payloads&&this._instance.persistence.register({[D8]: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(VU)||[]).find(l=>l.flagKey===e),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};r&&(a.$early_access_feature_name=r.name),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var s=Dd({},this.getFlagVariants(),{[e]:t});(n=this._instance.persistence)==null||n.register({[sie]:Object.keys(HDe(s)),[LQ]:s}),this.Pe()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this._instance.get_property(VU),o=n?"&"+n.map(a=>"stage="+a).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+o),method:"GET",callback:a=>{var s;if(a.json){var l=a.json.earlyAccessFeatures;return(s=this._instance.persistence)==null||s.register({[VU]: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(v8)||{};this._instance.register({[v8]:Dd({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(v8)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(n4)||{};Object.keys(n).length!==0&&Object.keys(n).forEach(r=>{n[r]=Dd({},n[r],e[r]),delete e[r]}),this._instance.register({[n4]:Dd({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(n4)||{};this._instance.register({[n4]:Dd({},t,{[e]:{}})})}else this._instance.unregister(n4)}reset(){this._e=!1,this.me=!1,this.be=!1,this.ye=!1,this.we=!1,this.Se=!1,this.$anon_distinct_id=void 0,this.xe(),this.ge=!1}}var EPt=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class lie{constructor(e,t){this.S=e,this.props={},this.Te=!1,this.Me=(n=>{var r="";return n.token&&(r=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+r+"_posthog"})(e),this.B=this.Ce(e),this.load(),e.debug&&vA.info("Persistence loaded",e.persistence,Dd({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.Fe}Ce(e){EPt.indexOf(e.persistence.toLowerCase())===-1&&(vA.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&J9.O()?J9:t==="localstorage+cookie"&&iG.O()?iG:t==="sessionstorage"&&kx.O()?kx:t==="memory"?n7t:t==="cookie"?LB:iG.O()?iG:LB}properties(){var e={};return O1(this.props,function(t,n){if(n===LQ&&GC(t))for(var r=Object.keys(t),o=0;o<r.length;o++)e["$feature/"+r[o]]=t[r[o]];else s=n,l=!1,(vw(a=k6t)?l:YQe&&a.indexOf===YQe?a.indexOf(s)!=-1:(O1(a,function(c){if(l||(l=c===s))return OU}),l))||(e[n]=t);var a,s,l}),e}load(){if(!this.Fe){var e=this.B.L(this.Me);e&&(this.props=i9({},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(GC(e)){Tu(t)&&(t="None"),this.Oe=Tu(n)?this.Le:n;var r=!1;if(O1(e,(o,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.props[a]=o,r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(GC(e)){this.Oe=Tu(t)?this.Le:t;var n=!1;if(O1(e,(r,o)=>{e.hasOwnProperty(o)&&this.props[o]!==r&&(this.props[o]=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=NDe(this.S.custom_campaign_params,this.S.mask_personal_data_properties,this.S.custom_personal_data_properties);kQ(fne(e))||this.register(e),this.Te=!0}}update_search_keyword(){var e;this.register((e=Xd==null?void 0:Xd.referrer)?PDe(e):{})}update_referrer_info(){var e;this.register_once({$referrer:LDe(),$referring_domain:Xd!=null&&Xd.referrer&&((e=UQ(Xd.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[xne]||this.props[Ene]||this.register_once({[JU]:FDe(this.S.mask_personal_data_properties,this.S.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};O1([Ene,xne],a=>{var s=this.props[a];s&&O1(s,function(l,c){e["$initial_"+dne(c)]=l})});var t,n,r=this.props[JU];if(r){var o=(t=UDe(r),n={},O1(t,function(a,s){n["$initial_"+dne(s)]=a}),n);i9(e,o)}return e}safe_merge(e){return O1(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t,n){if(this.Le=this.Oe=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var r=this.Ce(e),o=this.props;this.clear(),this.B=r,this.props=o,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[m8]||{};n[e]=t,this.props[m8]=n,this.save()}remove_event_timer(e){var t=(this.props[m8]||{})[e];return Tu(t)||(delete this.props[m8][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}class YDe{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 c4{constructor(e){this.Ne=new YDe,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(!Tu((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(!Tu((t=this._instance)==null?void 0:t.Ge)&&(e.forEach(a=>{var s,l;(s=this.We)==null||s.add(a),(l=a.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,o=new Set;e.forEach(a=>{var s;(s=a.steps)==null||s.forEach(l=>{l!=null&&l.selector&&o.add(l==null?void 0:l.selector)})}),(r=this._instance)==null||r.autocapture.setElementSelectors(o)}}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"||!c4.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!!Aa&&HQ(e,t);case"exact":return t===e;case"contains":var r=c4.Ye(t).replace(/_/g,".").replace(/%/g,".*");return HQ(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(o=>!(t!=null&&t.href&&!c4.Ke(o.href||"",t==null?void 0:t.href,(t==null?void 0:t.href_matching)||"exact"))&&(t==null||!t.tag_name||o.tag_name===(t==null?void 0:t.tag_name))&&!(t!=null&&t.text&&!c4.Ke(o.text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact")&&!c4.Ke(o.$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 Bx=bx("[Surveys]"),cie="seenSurvey_",bPt=(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 BPt{constructor(e){this._instance=e,this.Qe=new Map,this.Ze=new Map}register(e){var t;Tu((t=this._instance)==null?void 0:t.Ge)||(this.tr(e),this.ir(e))}ir(e){var t=e.filter(n=>{var r,o;return((r=n.conditions)==null?void 0:r.actions)&&((o=n.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0});t.length!==0&&(this.er==null&&(this.er=new c4(this._instance),this.er.init(),this.er.Ve(n=>{this.onAction(n)})),t.forEach(n=>{var r,o,a,s,l;n.conditions&&(r=n.conditions)!=null&&r.actions&&(o=n.conditions)!=null&&(o=o.actions)!=null&&o.values&&((a=n.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.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,o;return((r=n.conditions)==null?void 0:r.events)&&((o=n.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.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(o=>{if(o&&o.name){var a=this.Qe.get(o.name);a&&a.push(n.id),this.Qe.set(o.name,a||[n.id])}})}))}onEvent(e,t){var n,r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[jU])||[];if(e==="survey shown"&&t&&r.length>0){var o;Bx.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:r});var a=t==null||(o=t.properties)==null?void 0:o.$survey_id;if(a){var s=r.indexOf(a);s>=0&&(r.splice(s,1),this.rr(r))}}else this.Qe.has(e)&&(Bx.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[jU])||[];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({[jU]:[...new Set(e)]})}getSurveys(){var e,t=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[jU];return t||[]}getEventToSurveys(){return this.Qe}sr(){return this.er}}class SPt{constructor(e){this.nr=void 0,this.ar=null,this.lr=!1,this.ur=!1,this.hr=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){var t=e.surveys;if(T_(t))return Bx.warn("Flags not loaded yet. Not loading surveys.");var n=aC(t);this.nr=n?t.length>0:t,Bx.info("flags response received, isSurveysEnabled: "+this.nr),this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(cie)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach(r=>localStorage.removeItem(r))}loadIfEnabled(){if(!this.ar)if(this.ur)Bx.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Bx.info("Disabled. Not loading surveys.");else{var e=F0==null?void 0:F0.__PosthogExtensions__;if(e){var t=this.nr;if(!Tu(t)){this.ur=!0;try{var n=e.generateSurveys;if(n)return void this.dr(n,t);var r=e.loadExternalDependency;if(!r)return void this.vr("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",o=>{o||!e.generateSurveys?this.vr("Could not load surveys script",o):this.dr(e.generateSurveys,t)})}catch(o){throw this.vr("Error initializing surveys",o),o}finally{this.ur=!1}}}else Bx.error("PostHog Extensions not found.")}}dr(e,t){this.ar=e(this._instance,t),this._surveyEventReceiver=new BPt(this._instance),Bx.info("Surveys loaded successfully"),this.cr({isLoaded:!0})}vr(e,t){Bx.error(e,t),this.cr({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.hr.push(e),this.ar&&this.cr({isLoaded:!0}),()=>{this.hr=this.hr.filter(t=>t!==e)}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return Bx.info("Disabled. Not loading surveys."),e([]);var n=this._instance.get_property(_ne);if(n&&!t)return e(n,{isLoaded:!0});if(this.lr)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.lr=!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 o;this.lr=!1;var a=r.statusCode;if(a!==200||!r.json){var s="Surveys API could not be loaded, status: "+a;return Bx.error(s),e([],{isLoaded:!1,error:s})}var l,c=r.json.surveys||[],u=c.filter(d=>function(f){return!(!f.start_date||f.end_date)}(d)&&(function(f){var h;return!((h=f.conditions)==null||(h=h.events)==null||(h=h.values)==null||!h.length)}(d)||function(f){var h;return!((h=f.conditions)==null||(h=h.actions)==null||(h=h.values)==null||!h.length)}(d)));return u.length>0&&((l=this._surveyEventReceiver)==null||l.register(u)),(o=this._instance.persistence)==null||o.register({[_ne]:c}),e(c,{isLoaded:!0})}})}catch(r){throw this.lr=!1,r}}cr(e){for(var t of this.hr)try{e.isLoaded?this.getSurveys(t):t([],e)}catch(n){Bx.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!T_(this.ar))return this.ar.getActiveMatchingSurveys(e,t);Bx.warn("init was not called")}pr(e){var t=null;return this.getSurveys(n=>{var r;t=(r=n.find(o=>o.id===e))!==null&&r!==void 0?r:null}),t}gr(e){if(T_(this.ar))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.ar.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(T_(this.ar))return Bx.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 T_(this.ar)?(Bx.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 o,a=(o=r.find(l=>l.id===e))!==null&&o!==void 0?o:null;if(a){var s=this.gr(a);n({visible:s.eligible,disabledReason:s.reason})}else n({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t){if(T_(this.ar))Bx.warn("init was not called");else{var n=this.pr(e),r=Xd==null?void 0:Xd.querySelector(t);n?r?this.ar.renderSurvey(n,r):Bx.warn("Survey element not found"):Bx.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 uie=function(i){return i.SHOWN="survey shown",i.DISMISSED="survey dismissed",i.SENT="survey sent",i}({}),VDe=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}({}),jDe=bx("[RateLimiter]");class wPt{constructor(e){var t,n;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=r=>{var o=r.text;if(o&&o.length)try{(JSON.parse(o).quota_limited||[]).forEach(a=>{jDe.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4})}catch(a){return void jDe.warn('could not rate limit - continuing. Error: "'+(a==null?void 0:a.message)+'"',{text:o})}},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 o=new Date().getTime(),a=(t=(n=this.instance.persistence)==null?void 0:n.get_property(Cne))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:o};a.tokens+=(o-a.last)/1e3*this.captureEventsPerSecond,a.last=o,a.tokens>this.captureEventsBurstLimit&&(a.tokens=this.captureEventsBurstLimit);var s=a.tokens<1;return s||e||(a.tokens=Math.max(0,a.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(Cne,a),{isRateLimited:s,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var u4=bx("[RemoteConfig]");class MPt{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=F0._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}_r(e){var t,n;(t=F0.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=F0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(u4.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 u4.info("Using preloaded remote config",this.remoteConfig),void this.Ie(this.remoteConfig);if(this._instance.I())return void u4.warn("Remote config is disabled. Falling back to local config.");this._r(e=>{if(!e)return u4.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){u4.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()):u4.info("__preview_remote_config is disabled. Logging config instead",e):u4.error("Failed to fetch remote config from PostHog.")}}var die=3e3;class QPt{constructor(e,t){this.br=!0,this.yr=[],this.wr=jb((t==null?void 0:t.flush_interval_ms)||die,250,5e3,"flush interval",die),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(Dd({},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 o=t[r],a=new Date().getTime();o.data&&aC(o.data)&&O1(o.data,s=>{s.offset=Math.abs(s.timestamp-a),delete s.timestamp}),e.Sr(o)};for(var r in t)n()}},this.wr))}Er(){clearTimeout(this.$r),this.$r=void 0}Ir(){var e={};return O1(this.yr,t=>{var n,r=t,o=(r?r.batchKey:null)||r.url;Tu(e[o])&&(e[o]=Dd({},r,{data:[]})),(n=e[o].data)==null||n.push(r.data)}),this.yr=[],e}}var RPt=["retriesPerformedSoFar"];class DPt{constructor(e){this.Pr=!1,this.Rr=3e3,this.yr=[],this._instance=e,this.yr=[],this.Tr=!0,!Tu(Aa)&&"onLine"in Aa.navigator&&(this.Tr=Aa.navigator.onLine,IC(Aa,"online",()=>{this.Tr=!0,this.se()}),IC(Aa,"offline",()=>{this.Tr=!1}))}get length(){return this.yr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=qQe(e,RPt);AE(t)&&t>0&&(n.url=hG(n.url,{retry_count:t})),this._instance.Ee(Dd({},n,{callback:r=>{r.statusCode!==200&&(r.statusCode<400||r.statusCode>=500)&&(t??0)<10?this.Mr(Dd({retriesPerformedSoFar:t},n)):n.callback==null||n.callback(r)}}))}Mr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(a){var s=3e3*Math.pow(2,a),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 o="Enqueued failed request for retry in "+n;navigator.onLine||(o+=" (Browser is offline)"),vA.warn(o),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(o=>o.retryAt<e||(t.push(o),!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(Dd({},e,{transport:"sendBeacon"}))}catch(t){vA.error(t)}this.yr=[]}}class NPt{constructor(e){this.Or=()=>{var t,n,r,o;this.Ar||(this.Ar={});var a=this.scrollElement(),s=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,c=s+((a==null?void 0:a.clientHeight)||0),u=(a==null?void 0:a.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,(o=this.Ar.maxContentHeight)!==null&&o!==void 0?o:0)},this._instance=e}getContext(){return this.Ar}resetContext(){var e=this.Ar;return setTimeout(this.Or,0),e}startMeasuringScrollPosition(){IC(Aa,"scroll",this.Or,{capture:!0}),IC(Aa,"scrollend",this.Or,{capture:!0}),IC(Aa,"resize",this.Or)}scrollElement(){if(!this._instance.config.scroll_root_selector)return Aa==null?void 0:Aa.document.documentElement;var e=aC(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=Aa==null?void 0:Aa.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 Aa&&(Aa.scrollY||Aa.pageYOffset||Aa.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return Aa&&(Aa.scrollX||Aa.pageXOffset||Aa.document.documentElement.scrollLeft)||0}}var TPt=i=>FDe(i==null?void 0:i.config.mask_personal_data_properties,i==null?void 0:i.config.custom_personal_data_properties);class PPt{constructor(e,t,n,r){this.Dr=o=>{var a=this.Lr();if(!a||a.sessionId!==o){var s={sessionId:o,props:this.jr(this._instance)};this.Nr.register({[Ine]:s})}},this._instance=e,this.zr=t,this.Nr=n,this.jr=r||TPt,this.zr.onSessionId(this.Dr)}Lr(){return this.Nr.props[Ine]}getSetOnceProps(){var e,t=(e=this.Lr())==null?void 0:e.props;return t?"r"in t?UDe(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 O1(fne(this.getSetOnceProps()),(t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+dne(n)]=t}),e}}var KDe=bx("[SessionId]");class kPt{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||Cw,this.Br=n||Cw;var o=this.S.persistence_name||this.S.token,a=this.S.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*jb(a,60,36e3,"session_idle_timeout_seconds",1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hr(),this.Wr="ph_"+o+"_window_id",this.Gr="ph_"+o+"_primary_window_exists",this.Jr()){var s=kx.L(this.Wr),l=kx.L(this.Gr);s&&!l?this.fi=s:kx.N(this.Wr),kx.j(this.Gr,!0)}if((r=this.S.bootstrap)!=null&&r.sessionID)try{var c=(u=>{var d=u.replace(/-/g,"");if(d.length!==32)throw new Error("Not a valid UUID");if(d[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(d.substring(0,12),16)})(this.S.bootstrap.sessionID);this.Vr(this.S.bootstrap.sessionID,new Date().getTime(),c)}catch(u){KDe.error("Invalid sessionID in bootstrap",u)}this.Kr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Tu(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&&kx.O()}Yr(e){e!==this.fi&&(this.fi=e,this.Jr()&&kx.j(this.Wr,e))}Xr(){return this.fi?this.fi:this.Jr()?kx.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({[YU]:[t,e,n]}))}Qr(){if(this.Ct&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ct,this._sessionStartTimestamp];var e=this.Nr.props[YU];return aC(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Vr(null,null,null)}Kr(){IC(Aa,"beforeunload",()=>{this.Jr()&&kx.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,o,a]=this.Qr(),s=this.Xr(),l=AE(a)&&a>0&&Math.abs(n-a)>864e5,c=!1,u=!o,d=!e&&Math.abs(n-r)>this.sessionTimeoutMs;u||d||l?(o=this.qr(),s=this.Br(),KDe.info("new session ID generated",{sessionId:o,windowId:s,changeReason:{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}}),a=n,c=!0):s||(s=this.Br(),c=!0);var f=r===0||!e||l?n:r,h=a===0?new Date().getTime():a;return this.Yr(s),this.Vr(o,f,h),e||this.Hr(),c&&this.Ur.forEach(g=>g(o,s,c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0)),{sessionId:o,windowId:s,sessionStartTimestamp:h,changeReason:c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}Hr(){clearTimeout(this.Zr),this.Zr=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}}var LPt=["$set_once","$set"],Bw=bx("[SiteApps]");class FPt{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=F0._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,o,a,s,l;if(!e)throw new Error("Event payload is required");var c={},u=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(var[f,h]of Object.entries(d))c[f]={id:u[f],type:f,properties:h};var{$set_once:g,$set:y}=e;return{event:Dd({},qQe(e,LPt),{properties:Dd({},e.properties,y?{$set:Dd({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},y)}:{},g?{$set_once:Dd({},(r=(o=e.properties)==null?void 0:o.$set_once)!==null&&r!==void 0?r:{},g)}:{}),elements_chain:(a=(s=e.properties)==null?void 0:s.$elements_chain)!==null&&a!==void 0?a:"",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&&(Bw.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,o=s=>{t.errored=!s,t.loaded=!0,Bw.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&n()};try{var{processEvent:a}=e.init({posthog:this._instance,callback:s=>{o(s)}});a&&(t.processEvent=a),r=!0}catch(s){Bw.error("Error while initializing PostHog app with config id "+e.id,s),o(!1)}if(r&&t.loaded)try{n()}catch(s){Bw.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){Bw.error("Error while processing event "+e.event+" for site app "+n.id,r)}}}onRemoteConfig(e){var t,n,r,o=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.ss(),void this._instance.on("eventCaptured",c=>this.ns(c))):void Bw.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 a=function(c){var u;F0["__$$ph_site_app_"+c]=o._instance,(u=F0.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(o._instance,l,d=>{if(d)return Bw.error("Error while initializing PostHog app with config id "+c,d)})};for(var{id:s,url:l}of e.siteApps)a(s)}else Bw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var UPt=["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"],JDe=function(i,e){if(!i)return!1;var t=i.toLowerCase();return UPt.concat(e||[]).some(n=>{var r=n.toLowerCase();return t.indexOf(r)!==-1})},WDe=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&JDe(t,e))return!0;try{var n=i==null?void 0:i.userAgentData;if(n!=null&&n.brands&&n.brands.some(r=>JDe(r==null?void 0:r.brand,e)))return!0}catch{}return!!i.webdriver},N8=function(i){return i.US="us",i.EU="eu",i.CUSTOM="custom",i}({}),qDe="i.posthog.com";class GPt{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("."+qDe,".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]=N8.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.os[this.apiHost]=N8.EU:this.os[this.apiHost]=N8.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===N8.CUSTOM)return this.apiHost+t;var n=qDe+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}}var OPt={icontains:(i,e)=>!!Aa&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!Aa&&e.href.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>!!Aa&&HQ(e.href,i),not_regex:(i,e)=>!!Aa&&!HQ(e.href,i),exact:(i,e)=>e.href===i,is_not:(i,e)=>e.href!==i};class pE{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),t.getWebExperiments(r=>{pE.ls("retrieved web experiments from the server"),t.us=new Map,r.forEach(o=>{if(o.feature_flag_key){var a;t.us&&(pE.ls("setting flag key ",o.feature_flag_key," to web experiment ",o),(a=t.us)==null||a.set(o.feature_flag_key,o));var s=t._instance.getFeatureFlag(o.feature_flag_key);OC(s)&&o.variants[s]&&t.hs(o.name,s,o.variants[s].transforms)}else if(o.variants)for(var l in o.variants){var c=o.variants[l];pE.ds(c)&&t.hs(o.name,l,c.transforms)}})},n)},this._instance=e,this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}onFeatureFlags(e){if(this._is_bot())pE.ls("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(T_(this.us))return this.us=new Map,this.loadIfEnabled(),void this.previewWebExperiment();pE.ls("applying feature flags",e),e.forEach(t=>{var n;if(this.us&&(n=this.us)!=null&&n.has(t)){var r,o=this._instance.getFeatureFlag(t),a=(r=this.us)==null?void 0:r.get(t);o&&a!=null&&a.variants[o]&&this.hs(a.name,o,a.variants[o].transforms)}})}}previewWebExperiment(){var e=pE.getWindowLocation();if(e!=null&&e.search){var t=eG(e==null?void 0:e.search,"__experiment_id"),n=eG(e==null?void 0:e.search,"__experiment_variant");t&&n&&(pE.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:o=>{if(o.statusCode!==200||!o.json)return e([]);var a=o.json.experiments||[];return e(a)}})}vs(e,t,n){var r=n.filter(o=>o.id===e);r&&r.length>0&&(pE.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!T_(e.conditions)&&pE.cs(e)&&pE.fs(e)}static cs(e){var t;if(T_(e.conditions)||T_((t=e.conditions)==null?void 0:t.url))return!0;var n,r,o,a=pE.getWindowLocation();return!!a&&((n=e.conditions)==null||!n.url||OPt[(r=(o=e.conditions)==null?void 0:o.urlMatchType)!==null&&r!==void 0?r:"icontains"](e.conditions.url,a))}static getWindowLocation(){return Aa==null?void 0:Aa.location}static fs(e){var t;if(T_(e.conditions)||T_((t=e.conditions)==null?void 0:t.utm))return!0;var n=NDe();if(n.utm_source){var r,o,a,s,l,c,u,d,f=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_campaign)==n.utm_campaign,h=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_source)==n.utm_source,g=(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,y=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==n.utm_term;return f&&g&&y&&h}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];vA.info("[WebExperiments] "+e,n)}hs(e,t,n){this._is_bot()?pE.ls("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?n.forEach(r=>{if(r.selector){var o;pE.ls("applying transform of variant "+t+" for experiment "+e+" ",r);var a=(o=document)==null?void 0:o.querySelectorAll(r.selector);a==null||a.forEach(s=>{var l=s;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)})}}):pE.ls("Control variants leave the page unmodified.")}_is_bot(){return Vb&&this._instance?WDe(Vb,this._instance.config.custom_blocked_useragents):void 0}}var zPt=bx("[PostHog ExternalIntegrations]"),HPt={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class YPt{constructor(e){this._instance=e}J(e,t){var n;(n=F0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,r=>{if(r)return zPt.error("failed to load script",r);t()})}startIfEnabledOrStop(){var e=this,t=function(a){var s,l,c;!r||(s=F0.__PosthogExtensions__)!=null&&(s=s.integrations)!=null&&s[a]||e.J(HPt[a],()=>{var u;(u=F0.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[a])==null||u.start(e._instance)}),!r&&(l=F0.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[a]&&((c=F0.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[a])==null||c.stop())};for(var[n,r]of Object.entries((o=this._instance.config.integrations)!==null&&o!==void 0?o:{})){var o;t(n)}}}var T8={},Aie=()=>{},JQ="posthog",XDe=!iPt&&(pb==null?void 0:pb.indexOf("MSIE"))===-1&&(pb==null?void 0:pb.indexOf("Mozilla"))===-1,ZDe=i=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:P6t(Xd==null?void 0:Xd.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Aie,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:hb&&OC(hb==null?void 0:hb.search)&&hb.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(Aa==null||(e=Aa.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",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;vA.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:die},error_tracking:{},_onCapture:Aie}},$De=i=>{var e={};Tu(i.process_person)||(e.person_profiles=i.process_person),Tu(i.xhr_headers)||(e.request_headers=i.xhr_headers),Tu(i.cookie_name)||(e.persistence_name=i.cookie_name),Tu(i.disable_cookie)||(e.disable_persistence=i.disable_cookie),Tu(i.store_google)||(e.save_campaign_params=i.store_google),Tu(i.verbose)||(e.debug=i.verbose);var t=i9({},e,i);return aC(i.property_blacklist)&&(Tu(i.property_denylist)?t.property_denylist=i.property_blacklist:aC(i.property_denylist)?t.property_denylist=[...i.property_blacklist,...i.property_denylist]:vA.error("Invalid value for property_denylist config: "+i.property_denylist)),t};class VPt{constructor(){this.__forceAllowLocalhost=!1}get ps(){return this.__forceAllowLocalhost}set ps(e){vA.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class vG{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 VPt,this.gs=!1,this.version=JS.LIB_VERSION,this._s=new YDe,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ZDe(),this.SentryIntegration=K7t,this.sentryIntegration=e=>function(t,n){var r=sDe(t,n);return{name:aDe,processEvent:o=>r(o)}}(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 xPt(this),this.toolbar=new W7t(this),this.scrollManager=new NPt(this),this.pageViewManager=new tPt(this),this.surveys=new SPt(this),this.experiments=new pE(this),this.exceptions=new aPt(this),this.rateLimiter=new wPt(this),this.requestRouter=new GPt(this),this.consent=new i7t(this),this.externalIntegrations=new YPt(this),this.people={set:(e,t,n)=>{var r=OC(e)?{[e]:t}:e;this.setPersonProperties(r),n==null||n({})},set_once:(e,t,n)=>{var r=OC(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n==null||n({})}},this.on("eventCaptured",e=>vA.info('send "'+(e==null?void 0:e.event)+'"',e))}init(e,t,n){if(n&&n!==JQ){var r,o=(r=T8[n])!==null&&r!==void 0?r:new vG;return o._init(e,t,n),T8[n]=o,T8[JQ][n]=o,o}return this._init(e,t,n)}_init(e,t,n){var r,o;if(t===void 0&&(t={}),Tu(e)||Ane(e))return vA.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 vA.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(i9({},ZDe(t.defaults),$De(t),{name:n,token:e})),this.config.on_xhr_error&&vA.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:WS.GZipJS;var a=this.xs();this.persistence=new lie(this.config,a),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new lie(Dd({},this.config,{persistence:"sessionStorage"}),a);var s=Dd({},this.persistence.props),l=Dd({},this.sessionPersistence.props);if(this.register({$initialization_time:new Date().toISOString()}),this.Es=new QPt(x=>this.Is(x),this.config.request_queue_config),this.Ps=new DPt(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new kPt(this),this.sessionPropsManager=new PPt(this,this.sessionManager,this.persistence)),new X7t(this).startIfEnabledOrStop(),this.siteApps=new FPt(this),(r=this.siteApps)==null||r.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new V7t(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new W6t(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new ePt(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Z7t(this),this.exceptionObserver=new a7t(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new RRe(this,o7t),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new _7t(this),this.historyAutocapture.startIfEnabled(),JS.DEBUG=JS.DEBUG||this.config.debug,JS.DEBUG&&vA.info("Starting in debug mode",{this:this,config:t,thisC:Dd({},this.config),p:s,s:l}),((o=t.bootstrap)==null?void 0:o.distinctID)!==void 0){var c,u,d=this.config.get_device_id(Cw()),f=(c=t.bootstrap)!=null&&c.isIdentifiedID?d:t.bootstrap.distinctID;this.persistence.set_property(qS,(u=t.bootstrap)!=null&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:f})}if(this.Rs()){var h,g,y=Object.keys(((h=t.bootstrap)==null?void 0:h.featureFlags)||{}).filter(x=>{var S;return!((S=t.bootstrap)==null||(S=S.featureFlags)==null||!S[x])}).reduce((x,S)=>{var M;return x[S]=((M=t.bootstrap)==null||(M=M.featureFlags)==null?void 0:M[S])||!1,x},{}),v=Object.keys(((g=t.bootstrap)==null?void 0:g.featureFlagPayloads)||{}).filter(x=>y[x]).reduce((x,S)=>{var M,z;return(M=t.bootstrap)!=null&&(M=M.featureFlagPayloads)!=null&&M[S]&&(x[S]=(z=t.bootstrap)==null||(z=z.featureFlagPayloads)==null?void 0:z[S]),x},{});this.featureFlags.receivedFeatureFlags({featureFlags:y,featureFlagPayloads:v})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:qU,$device_id:null},"");else if(!this.get_distinct_id()){var _=this.config.get_device_id(Cw());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(qS,"anonymous")}return IC(Aa,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?j7t(this,()=>this.Ts()):this.Ts(),v2(this.config._onCapture)&&this.config._onCapture!==Aie&&(vA.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",x=>this.config._onCapture(x.event,x))),this.config.ip&&vA.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Ie(e){var t,n,r,o,a,s,l,c;if(!Xd||!Xd.body)return vA.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=Iy(e.supportedCompression,WS.GZipJS)?WS.GZipJS:Iy(e.supportedCompression,WS.Base64)?WS.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),(o=this.autocapture)==null||o.onRemoteConfig(e),(a=this.heatmaps)==null||a.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){vA.critical("`loaded` function failed",e)}this.Ms(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this.Cs()},1),new MPt(this).load(),this.featureFlags.flags()}Ms(){var e;this.has_opted_out_capturing()||this.config.request_batching&&((e=this.Es)==null||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||_w(this.__request_queue,e=>this.Is(e)),this.__request_queue=[],this.Ms()}_handle_unload(){var e,t;this.config.request_batching?(this.Fs()&&this.capture("$pageleave"),(e=this.Es)==null||e.unload(),(t=this.Ps)==null||t.unload()):this.Fs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Ee(e){this.__loaded&&(XDe?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=hG(e.url,{ip:this.config.ip?1:0}),e.headers=Dd({},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,o,a=Dd({},t);a.timeout=a.timeout||6e4,a.url=hG(a.url,{_:new Date().getTime().toString(),ver:JS.LIB_VERSION,compression:a.compression});var s=(n=a.transport)!==null&&n!==void 0?n:"fetch",l=(r=(o=ZQe(B8,c=>c.transport===s))==null?void 0:o.method)!==null&&r!==void 0?r:B8[0].method;if(!l)throw new Error("No available transport method");l(a)})(Dd({},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)}}))))}Is(e){this.Ps?this.Ps.retriableRequest(e):this.Ee(e)}_execute_array(e){var t,n=[],r=[],o=[];_w(e,s=>{s&&(t=s[0],aC(t)?o.push(s):v2(s)?s.call(this):aC(s)&&t==="alias"?n.push(s):aC(s)&&t.indexOf("capture")!==-1&&v2(this[t])?o.push(s):r.push(s))});var a=function(s,l){_w(s,function(c){if(aC(c[0])){var u=l;O1(c,function(d){u=u[d[0]].apply(u,d.slice(1))})}else this[c[0]].apply(this,c.slice(1))},l)};a(n,this),a(r,this),a(o,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.Es){if(!this.consent.isOptedOut())if(!Tu(e)&&OC(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var o=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){t!=null&&t.$current_url&&!OC(t==null?void 0:t.$current_url)&&(vA.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 a=new Date,s=(n==null?void 0:n.timestamp)||a,l=Cw(),c={uuid:l,event:e,properties:this.calculateEventProperties(e,t||{},s,l)};o&&(c.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),n!=null&&n.$set&&(c.$set=n==null?void 0:n.$set);var u,d,f=this.Os(n==null?void 0:n.$set_once);if(f&&(c.$set_once=f),(c=N6t(c,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=s,Tu(n==null?void 0:n.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=a),e===uie.DISMISSED||e===uie.SENT){var h=t==null?void 0:t[VDe.SURVEY_ID],g=t==null?void 0:t[VDe.SURVEY_ITERATION];localStorage.setItem((d=""+cie+(u={id:h,current_iteration:g}).id,u.current_iteration&&u.current_iteration>0&&(d=""+cie+u.id+"_"+u.current_iteration),d),"true"),c.$set=Dd({},c.$set,{[bPt({id:h,current_iteration:g},e===uie.SENT?"responded":"dismissed")]:!0})}var y=Dd({},c.properties.$set,c.$set);if(kQ(y)||this.setPersonPropertiesForFlags(y),!T_(this.config.before_send)){var v=this.As(c);if(!v)return;c=v}this._s.emit("eventCaptured",c);var _={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.Is(_):this.Es.enqueue(_),c}vA.critical("This capture call is ignored due to client rate limiting.")}}else vA.error("No event name provided to posthog.capture")}else vA.uninitializedWarning("posthog.capture")}Ge(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,n,r,o){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var a=o?void 0:this.persistence.remove_event_timer(e),s=Dd({},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=Dd({},this.persistence.properties(),this.sessionPersistence.properties());return s.distinct_id=l.distinct_id,(!OC(s.distinct_id)&&!AE(s.distinct_id)||Ane(s.distinct_id))&&vA.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),s}var c,u=_Pt(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:f}=this.sessionManager.checkAndGetSessionAndWindowId(o,n.getTime());s.$session_id=d,s.$window_id=f}this.sessionPropsManager&&i9(s,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&i9(s,this.sessionRecording.sdkDebugProperties),s.$sdk_debug_retry_queue_size=(h=this.Ps)==null?void 0:h.length}catch(_){s.$sdk_debug_error_capturing_properties=String(_)}if(this.requestRouter.region===N8.CUSTOM&&(s.$lib_custom_api_host=this.config.api_host),c=e!=="$pageview"||o?e!=="$pageleave"||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),s=i9(s,c),e==="$pageview"&&Xd&&(s.title=Xd.title),!Tu(a)){var g=n.getTime()-a;s.$duration=parseFloat((g/1e3).toFixed(3))}pb&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?"bot":"browser"),(s=i9({},u,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),aC(this.config.property_denylist)?O1(this.config.property_denylist,function(_){delete s[_]}):vA.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var y=this.config.sanitize_properties;y&&(vA.error("sanitize_properties is deprecated. Use before_send instead"),s=y(s,e));var v=this.Ds();return s.$process_person_profile=v,v&&!o&&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(),o=i9({},n,r||{},e||{}),a=this.config.sanitize_properties;return a&&(vA.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),this.gs=!0,kQ(o)?void 0:o}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 vA.uninitializedWarning("posthog.identify");if(AE(e)&&(e=e.toString(),vA.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()))vA.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!==qU){if(this.Ls("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var o=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:o},"")}e!==r&&e!==this.get_property(g8)&&(this.unregister(g8),this.register({distinct_id:e}));var a=(this.persistence.get_property(qS)||"anonymous")==="anonymous";e!==r&&a?(this.persistence.set_property(qS,"identified"),this.setPersonPropertiesForFlags(Dd({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.Ss=fDe(e,t,n),this.featureFlags.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(KU))}}else vA.critical('The string "'+qU+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else vA.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.Ls("posthog.setPersonProperties")){var n=fDe(this.get_distinct_id(),e,t);this.Ss!==n?(this.setPersonPropertiesForFlags(Dd({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Ss=n):vA.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:Dd({},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 vA.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,o;if(vA.info("reset"),!this.__loaded)return vA.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),this.featureFlags.reset(),(r=this.persistence)==null||r.set_property(qS,"anonymous"),(o=this.sessionManager)==null||o.resetSessionId(),this.Ss=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:qU,$device_id:null},"");else{var s=this.config.get_device_id(Cw());this.register_once({distinct_id:s,$device_id:e?s:a},"")}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 o,a=(o=e.timestampLookBack)!==null&&o!==void 0?o:10;if(!n)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-a,0)}return r}alias(e,t){return e===this.get_property($Qe)?(vA.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ls("posthog.alias")?(Tu(t)&&(t=this.get_distinct_id()),e!==t?(this.js(g8,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(vA.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=Dd({},this.config);if(GC(e)){var n,r,o,a,s;i9(this.config,$De(e));var l=this.xs();(n=this.persistence)==null||n.update_config(this.config,t,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new lie(Dd({},this.config,{persistence:"sessionStorage"}),l),J9.O()&&J9.D("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(JS.DEBUG=!0,vA.info("set_config",{config:e,oldConfig:t,newConfig:Dd({},this.config)})),(r=this.sessionRecording)==null||r.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),this.surveys.loadIfEnabled(),this.Ns(),(s=this.externalIntegrations)==null||s.startIfEnabledOrStop()}}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,o,a,s,l;(r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),n.sampling&&((o=this.sessionRecording)==null||o.overrideSampling()),n.linked_flag&&((a=this.sessionRecording)==null||a.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");return this.exceptions.sendExceptionEvent(Dd({},v7t((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:JQ;return t!==JQ&&(t=JQ+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(qS))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(qS))==="identified"}Ds(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&kQ(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[g8])&&((t=this.persistence)==null||(t=t.props)==null||!t[WU]))}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"?(vA.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.js(WU,!0),!0)}xs(){var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default;return this.config.disable_persistence||e&&!!t}Ns(){var e,t,n,r,o=this.xs();return((e=this.persistence)==null?void 0:e.Fe)!==o&&((n=this.persistence)==null||n.set_disabled(o)),((t=this.sessionPersistence)==null?void 0:t.Fe)!==o&&((r=this.sessionPersistence)==null||r.set_disabled(o)),o}opt_in_capturing(e){var t;this.consent.optInOut(!0),this.Ns(),(Tu(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.Ns()}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.Ns()}_is_bot(){return Vb?WDe(Vb,this.config.custom_blocked_useragents):void 0}Cs(){Xd&&(Xd.visibilityState==="visible"?this.bs||(this.bs=!0,this.capture("$pageview",{title:Xd.title},{send_instantly:!0}),this.ys&&(Xd.removeEventListener("visibilitychange",this.ys),this.ys=null)):this.ys||(this.ys=this.Cs.bind(this),IC(Xd,"visibilitychange",this.ys)))}debug(e){e===!1?(Aa==null||Aa.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(Aa==null||Aa.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,o,a,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?(vA.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,o=vA,a=(t="advanced_disable_flags")in(e=l)&&!Tu(e[t]),s=n in e&&!Tu(e[n]),a?e[t]:s?(o&&o.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(T_(this.config.before_send))return e;var t=aC(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var r of t){if(n=r(n),T_(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Q6t(e.event)?vA.warn(o+". This can cause unexpected behavior."):vA.info(o),null}n.properties&&!kQ(n.properties)||vA.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]]=D6t(i.prototype[e[t]])})(vG,["identify"]);var eNe,_G=(eNe=T8[JQ]=new vG,function(){function i(){i.done||(i.done=!0,XDe=!1,O1(T8,function(e){e._dom_loaded()}))}Xd!=null&&Xd.addEventListener?Xd.readyState==="complete"?i():IC(Xd,"DOMContentLoaded",i,{capture:!1}):Aa&&vA.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),eNe);!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1")&&(_G.__loaded||_G.init("phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo",{api_host:"https://postpig.tscircuit.com",person_profiles:"always"}));function jPt(i){let e="";const t=i.byteLength;for(let n=0;n<t;n++)e+=String.fromCharCode(i[n]);return btoa(e)}var Kb=Uint8Array,Jb=Uint16Array,fie=Int32Array,hie=new Kb([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]),pie=new Kb([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]),tNe=new Kb([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nNe=function(i,e){for(var t=new Jb(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];for(var r=new fie(t[30]),n=1;n<30;++n)for(var o=t[n];o<t[n+1];++o)r[o]=o-t[n]<<5|n;return{b:t,r}},iNe=nNe(hie,2),KPt=iNe.b,gie=iNe.r;KPt[28]=258,gie[258]=28;for(var JPt=nNe(pie,0),rNe=JPt.r,mie=new Jb(32768),KI=0;KI<32768;++KI){var Sw=(KI&43690)>>1|(KI&21845)<<1;Sw=(Sw&52428)>>2|(Sw&13107)<<2,Sw=(Sw&61680)>>4|(Sw&3855)<<4,mie[KI]=((Sw&65280)>>8|(Sw&255)<<8)>>1}for(var P8=function(i,e,t){for(var n=i.length,r=0,o=new Jb(e);r<n;++r)i[r]&&++o[i[r]-1];var a=new Jb(e);for(r=1;r<e;++r)a[r]=a[r-1]+o[r-1]<<1;var s;if(t){s=new Jb(1<<e);var l=15-e;for(r=0;r<n;++r)if(i[r])for(var c=r<<4|i[r],u=e-i[r],d=a[i[r]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[mie[d]>>l]=c}else for(s=new Jb(n),r=0;r<n;++r)i[r]&&(s[r]=mie[a[i[r]-1]++]>>15-i[r]);return s},d4=new Kb(288),KI=0;KI<144;++KI)d4[KI]=8;for(var KI=144;KI<256;++KI)d4[KI]=9;for(var KI=256;KI<280;++KI)d4[KI]=7;for(var KI=280;KI<288;++KI)d4[KI]=8;for(var IG=new Kb(32),KI=0;KI<32;++KI)IG[KI]=5;var WPt=P8(d4,9,0),qPt=P8(IG,5,0),oNe=function(i){return(i+7)/8|0},aNe=function(i,e,t){return(t==null||t>i.length)&&(t=i.length),new Kb(i.subarray(e,t))},$S=function(i,e,t){t<<=e&7;var n=e/8|0;i[n]|=t,i[n+1]|=t>>8},k8=function(i,e,t){t<<=e&7;var n=e/8|0;i[n]|=t,i[n+1]|=t>>8,i[n+2]|=t>>16},yie=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,o=t.slice();if(!r)return{t:uNe,l:0};if(r==1){var a=new Kb(t[0].s+1);return a[t[0].s]=1,{t:a,l:1}}t.sort(function(z,U){return z.f-U.f}),t.push({s:-1,f:25001});var s=t[0],l=t[1],c=0,u=1,d=2;for(t[0]={s:-1,f:s.f+l.f,l:s,r:l};u!=r-1;)s=t[t[c].f<t[d].f?c++:d++],l=t[c!=u&&t[c].f<t[d].f?c++:d++],t[u++]={s:-1,f:s.f+l.f,l:s,r:l};for(var f=o[0].s,n=1;n<r;++n)o[n].s>f&&(f=o[n].s);var h=new Jb(f+1),g=vie(t[u-1],h,0);if(g>e){var n=0,y=0,v=g-e,_=1<<v;for(o.sort(function(U,H){return h[H.s]-h[U.s]||U.f-H.f});n<r;++n){var x=o[n].s;if(h[x]>e)y+=_-(1<<g-h[x]),h[x]=e;else break}for(y>>=v;y>0;){var S=o[n].s;h[S]<e?y-=1<<e-h[S]++-1:++n}for(;n>=0&&y;--n){var M=o[n].s;h[M]==e&&(--h[M],++y)}g=e}return{t:new Kb(h),l:g}},vie=function(i,e,t){return i.s==-1?Math.max(vie(i.l,e,t+1),vie(i.r,e,t+1)):e[i.s]=t},sNe=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new Jb(++e),n=0,r=i[0],o=1,a=function(l){t[n++]=l},s=1;s<=e;++s)if(i[s]==r&&s!=e)++o;else{if(!r&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(r),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(r);o=1,r=i[s]}return{c:t.subarray(0,n),n:e}},L8=function(i,e){for(var t=0,n=0;n<e.length;++n)t+=i[n]*e[n];return t},lNe=function(i,e,t){var n=t.length,r=oNe(e+2);i[r]=n&255,i[r+1]=n>>8,i[r+2]=i[r]^255,i[r+3]=i[r+1]^255;for(var o=0;o<n;++o)i[r+o+4]=t[o];return(r+4+n)*8},cNe=function(i,e,t,n,r,o,a,s,l,c,u){$S(e,u++,t),++r[256];for(var d=yie(r,15),f=d.t,h=d.l,g=yie(o,15),y=g.t,v=g.l,_=sNe(f),x=_.c,S=_.n,M=sNe(y),z=M.c,U=M.n,H=new Jb(19),k=0;k<x.length;++k)++H[x[k]&31];for(var k=0;k<z.length;++k)++H[z[k]&31];for(var j=yie(H,7),G=j.t,ee=j.l,K=19;K>4&&!G[tNe[K-1]];--K);var ie=c+5<<3,ce=L8(r,d4)+L8(o,IG)+a,ue=L8(r,f)+L8(o,y)+a+14+3*K+L8(H,G)+2*H[16]+3*H[17]+7*H[18];if(l>=0&&ie<=ce&&ie<=ue)return lNe(e,u,i.subarray(l,l+c));var le,_e,ye,Qe;if($S(e,u,1+(ue<ce)),u+=2,ue<ce){le=P8(f,h,0),_e=f,ye=P8(y,v,0),Qe=y;var Me=P8(G,ee,0);$S(e,u,S-257),$S(e,u+5,U-1),$S(e,u+10,K-4),u+=14;for(var k=0;k<K;++k)$S(e,u+3*k,G[tNe[k]]);u+=3*K;for(var Te=[x,z],Ee=0;Ee<2;++Ee)for(var Ge=Te[Ee],k=0;k<Ge.length;++k){var Ke=Ge[k]&31;$S(e,u,Me[Ke]),u+=G[Ke],Ke>15&&($S(e,u,Ge[k]>>5&127),u+=Ge[k]>>12)}}else le=WPt,_e=d4,ye=qPt,Qe=IG;for(var k=0;k<s;++k){var nt=n[k];if(nt>255){var Ke=nt>>18&31;k8(e,u,le[Ke+257]),u+=_e[Ke+257],Ke>7&&($S(e,u,nt>>23&31),u+=hie[Ke]);var lt=nt&31;k8(e,u,ye[lt]),u+=Qe[lt],lt>3&&(k8(e,u,nt>>5&8191),u+=pie[lt])}else k8(e,u,le[nt]),u+=_e[nt]}return k8(e,u,le[256]),u+_e[256]},XPt=new fie([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),uNe=new Kb(0),ZPt=function(i,e,t,n,r,o){var a=o.z||i.length,s=new Kb(n+a+5*(1+Math.ceil(a/7e3))+r),l=s.subarray(n,s.length-r),c=o.l,u=(o.r||0)&7;if(e){u&&(l[0]=o.r>>3);for(var d=XPt[e-1],f=d>>13,h=d&8191,g=(1<<t)-1,y=o.p||new Jb(32768),v=o.h||new Jb(g+1),_=Math.ceil(t/3),x=2*_,S=function(yt){return(i[yt]^i[yt+1]<<_^i[yt+2]<<x)&g},M=new fie(25e3),z=new Jb(288),U=new Jb(32),H=0,k=0,j=o.i||0,G=0,ee=o.w||0,K=0;j+2<a;++j){var ie=S(j),ce=j&32767,ue=v[ie];if(y[ce]=ue,v[ie]=ce,ee<=j){var le=a-j;if((H>7e3||G>24576)&&(le>423||!c)){u=cNe(i,l,0,M,z,U,k,G,K,j-K,u),G=H=k=0,K=j;for(var _e=0;_e<286;++_e)z[_e]=0;for(var _e=0;_e<30;++_e)U[_e]=0}var ye=2,Qe=0,Me=h,Te=ce-ue&32767;if(le>2&&ie==S(j-Te))for(var Ee=Math.min(f,le)-1,Ge=Math.min(32767,j),Ke=Math.min(258,le);Te<=Ge&&--Me&&ce!=ue;){if(i[j+ye]==i[j+ye-Te]){for(var nt=0;nt<Ke&&i[j+nt]==i[j+nt-Te];++nt);if(nt>ye){if(ye=nt,Qe=Te,nt>Ee)break;for(var lt=Math.min(Te,nt-2),Rt=0,_e=0;_e<lt;++_e){var pt=j-Te+_e&32767,Fe=y[pt],We=pt-Fe&32767;We>Rt&&(Rt=We,ue=pt)}}}ce=ue,ue=y[ce],Te+=ce-ue&32767}if(Qe){M[G++]=268435456|gie[ye]<<18|rNe[Qe];var $e=gie[ye]&31,_t=rNe[Qe]&31;k+=hie[$e]+pie[_t],++z[257+$e],++U[_t],ee=j+ye,++H}else M[G++]=i[j],++z[i[j]]}}for(j=Math.max(j,ee);j<a;++j)M[G++]=i[j],++z[i[j]];u=cNe(i,l,c,M,z,U,k,G,K,j-K,u),c||(o.r=u&7|l[u/8|0]<<3,u-=7,o.h=v,o.p=y,o.i=j,o.w=ee)}else{for(var j=o.w||0;j<a+c;j+=65535){var Tt=j+65535;Tt>=a&&(l[u/8|0]=c,Tt=a),u=lNe(l,u+1,i.subarray(j,Tt))}o.i=a}return aNe(s,0,n+oNe(u)+r)},$Pt=function(){for(var i=new Int32Array(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(t&1&&-306674912)^t>>>1;i[e]=t}return i}(),ekt=function(){var i=-1;return{p:function(e){for(var t=i,n=0;n<e.length;++n)t=$Pt[t&255^e[n]]^t>>>8;i=t},d:function(){return~i}}},tkt=function(i,e,t,n,r){if(!r&&(r={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),a=new Kb(o.length+i.length);a.set(o),a.set(i,o.length),i=a,r.w=o.length}return ZPt(i,e.level==null?6:e.level,e.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+e.mem,t,n,r)},_ie=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8},nkt=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&&_ie(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)}},ikt=function(i){return 10+(i.filename?i.filename.length+1:0)};function dNe(i,e){e||(e={});var t=ekt(),n=i.length;t.p(i);var r=tkt(i,e,ikt(e),8),o=r.length;return nkt(r,e),_ie(r,o-8,t.d()),_ie(r,o-4,n),r}var ANe=typeof TextEncoder<"u"&&new TextEncoder,rkt=typeof TextDecoder<"u"&&new TextDecoder,okt=0;try{rkt.decode(uNe,{stream:!0}),okt=1}catch{}function fNe(i,e){var t;if(ANe)return ANe.encode(i);for(var n=i.length,r=new Kb(i.length+(i.length>>1)),o=0,a=function(c){r[o++]=c},t=0;t<n;++t){if(o+5>r.length){var s=new Kb(o+8+(n-t<<1));s.set(r),r=s}var l=i.charCodeAt(t);l<128||e?a(l):l<2048?(a(192|l>>6),a(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|i.charCodeAt(++t)&1023,a(240|l>>18),a(128|l>>12&63),a(128|l>>6&63),a(128|l&63)):(a(224|l>>12),a(128|l>>6&63),a(128|l&63))}return aNe(r,0,o)}function akt(i,e){const t=JSON.stringify(i),n=dNe(fNe(t)),r=jPt(n);return`${window.location.origin}/editor?#data:application/gzip;base64,${r}`}function ip(...i){return b6t(PB(i))}const hNe=i=>i.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),Iie=JTt,CG=rt.forwardRef(({className:i,...e},t)=>je.jsx(RQe,{ref:t,className:ip("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}));CG.displayName=RQe.displayName;const zB=rt.forwardRef(({className:i,...e},t)=>je.jsx(DQe,{ref:t,className:ip("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}));zB.displayName=DQe.displayName;const C2=rt.forwardRef(({className:i,...e},t)=>je.jsx(NQe,{ref:t,className:ip("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}));C2.displayName=NQe.displayName;/**
896
+ `)).length,r=0;r<n;r++){var a=i.charCodeAt(r),s=null;a<128?t++:s=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),vw(s)||(t>e&&(o+=i.substring(e,t)),o+=s,e=t=r+1)}return t>e&&(o+=i.substring(e,i.length)),o},iPt=!!cne||!!lne,ADe="text/plain",hG=(i,e)=>{var[t,n]=i.split("?"),r=Dd({},e);n==null||n.split("&").forEach(a=>{var[s]=a.split("=");delete r[s]});var o=V6t(r);return t+"?"+(o=o?(n?n+"&":"")+o:n)},b8=(i,e)=>JSON.stringify(i,(t,n)=>typeof n=="bigint"?n.toString():n,e),Xne=i=>{var{data:e,compression:t}=i;if(e){if(t===WS.GZipJS){var n=$Re(eDe(b8(e)),{mtime:0}),r=new Blob([n],{type:ADe});return{contentType:ADe,body:r,estimatedSize:r.size}}if(t===WS.Base64){var o=function(l){var c,u,d,f,h,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",y=0,v=0,_="",x=[];if(!l)return l;l=nPt(l);do c=(h=l.charCodeAt(y++)<<16|l.charCodeAt(y++)<<8|l.charCodeAt(y++))>>18&63,u=h>>12&63,d=h>>6&63,f=63&h,x[v++]=g.charAt(c)+g.charAt(u)+g.charAt(d)+g.charAt(f);while(y<l.length);switch(_=x.join(""),l.length%3){case 1:_=_.slice(0,-2)+"==";break;case 2:_=_.slice(0,-1)+"="}return _}(b8(e)),a=(l=>"data="+encodeURIComponent(typeof l=="string"?l:b8(l)))(o);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var s=b8(e);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}}},B8=[];lne&&B8.push({transport:"fetch",method:i=>{var e,t,{contentType:n,body:r,estimatedSize:o}=(e=Xne(i))!==null&&e!==void 0?e:{},a=new Headers;O1(i.headers,function(u,d){a.append(d,u)}),n&&a.append("Content-Type",n);var s=i.url,l=null;if(VQe){var c=new VQe;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),i.timeout)}}lne(s,Dd({method:(i==null?void 0:i.method)||"GET",headers:a,keepalive:i.method==="POST"&&(o||0)<52428.8,body:r,signal:(t=l)==null?void 0:t.signal},i.fetchOptions)).then(u=>u.text().then(d=>{var f={statusCode:u.status,text:d};if(u.status===200)try{f.json=JSON.parse(d)}catch(h){vA.error(h)}i.callback==null||i.callback(f)})).catch(u=>{vA.error(u),i.callback==null||i.callback({statusCode:0,text:u})}).finally(()=>l?clearTimeout(l.timeout):null)}}),cne&&B8.push({transport:"XHR",method:i=>{var e,t=new cne;t.open(i.method||"GET",i.url,!0);var{contentType:n,body:r}=(e=Xne(i))!==null&&e!==void 0?e:{};O1(i.headers,function(o,a){t.setRequestHeader(a,o)}),n&&t.setRequestHeader("Content-Type",n),i.timeout&&(t.timeout=i.timeout),t.withCredentials=!0,t.onreadystatechange=()=>{if(t.readyState===4){var o={statusCode:t.status,text:t.responseText};if(t.status===200)try{o.json=JSON.parse(t.responseText)}catch{}i.callback==null||i.callback(o)}},t.send(r)}}),Vb!=null&&Vb.sendBeacon&&B8.push({transport:"sendBeacon",method:i=>{var e=hG(i.url,{beacon:"1"});try{var t,{contentType:n,body:r}=(t=Xne(i))!==null&&t!==void 0?t:{},o=typeof r=="string"?new Blob([r],{type:n}):r;Vb.sendBeacon(e,o)}catch{}}});var HQ=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 fDe(i,e,t){return b8({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var rPt={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=>HQ(t,n))),not_regex:(i,e)=>e.every(t=>i.every(n=>!HQ(t,n))),icontains:(i,e)=>e.map(pG).some(t=>i.map(pG).some(n=>t.includes(n))),not_icontains:(i,e)=>e.map(pG).every(t=>i.map(pG).every(n=>!t.includes(n)))},pG=i=>i.toLowerCase(),oPt=bx("[Error tracking]");class aPt{constructor(e){var t,n;this.fe=[],this._instance=e,this.fe=(t=(n=this._instance.persistence)==null?void 0:n.get_property(pne))!==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({[pne]:this.fe})}sendExceptionEvent(e){if(!this.pe(e))return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"});oPt.info("Skipping exception capture because a suppression rule matched")}pe(e){var t=e.$exception_list;if(!t||!aC(t)||t.length===0)return!1;var n=t.reduce((r,o)=>{var{type:a,value:s}=o;return OC(a)&&a.length>0&&r.$exception_types.push(a),OC(s)&&s.length>0&&r.$exception_values.push(s),r},{$exception_types:[],$exception_values:[]});return this.fe.some(r=>{var o=r.values.map(a=>{var s,l=rPt[a.operator],c=aC(a.value)?a.value:[a.value],u=(s=n[a.key])!==null&&s!==void 0?s:[];return c.length>0&&l(c,u)});return r.type==="OR"?o.some(Boolean):o.every(Boolean)})}}var I2="Mobile",gG="iOS",GB="Android",S8="Tablet",hDe=GB+" "+S8,pDe="iPad",gDe="Apple",mDe=gDe+" Watch",w8="Safari",YQ="BlackBerry",yDe="Samsung",vDe=yDe+"Browser",_De=yDe+" Internet",l4="Chrome",sPt=l4+" OS",IDe=l4+" "+gG,Zne="Internet Explorer",CDe=Zne+" "+I2,$ne="Opera",lPt=$ne+" Mini",eie="Edge",xDe="Microsoft "+eie,VQ="Firefox",EDe=VQ+" "+gG,M8="Nintendo",Q8="PlayStation",jQ="Xbox",bDe=GB+" "+I2,BDe=I2+" "+w8,R8="Windows",tie=R8+" Phone",SDe="Nokia",nie="Ouya",wDe="Generic",cPt=wDe+" "+I2.toLowerCase(),MDe=wDe+" "+S8.toLowerCase(),iie="Konqueror",UE="(\\d+(\\.\\d+)?)",rie=new RegExp("Version/"+UE),uPt=new RegExp(jQ,"i"),dPt=new RegExp(Q8+" \\w+","i"),APt=new RegExp(M8+" \\w+","i"),oie=new RegExp(YQ+"|PlayBook|BB10","i"),fPt={"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"},hPt=(i,e)=>e&&Iy(e,gDe)||function(t){return Iy(t,w8)&&!Iy(t,l4)&&!Iy(t,GB)}(i),QDe=function(i,e){return e=e||"",Iy(i," OPR/")&&Iy(i,"Mini")?lPt:Iy(i," OPR/")?$ne:oie.test(i)?YQ:Iy(i,"IE"+I2)||Iy(i,"WPDesktop")?CDe:Iy(i,vDe)?_De:Iy(i,eie)||Iy(i,"Edg/")?xDe:Iy(i,"FBIOS")?"Facebook "+I2:Iy(i,"UCWEB")||Iy(i,"UCBrowser")?"UC Browser":Iy(i,"CriOS")?IDe:Iy(i,"CrMo")||Iy(i,l4)?l4:Iy(i,GB)&&Iy(i,w8)?bDe:Iy(i,"FxiOS")?EDe:Iy(i.toLowerCase(),iie.toLowerCase())?iie:hPt(i,e)?Iy(i,I2)?BDe:w8:Iy(i,VQ)?VQ:Iy(i,"MSIE")||Iy(i,"Trident/")?Zne:Iy(i,"Gecko")?VQ:""},pPt={[CDe]:[new RegExp("rv:"+UE)],[xDe]:[new RegExp(eie+"?\\/"+UE)],[l4]:[new RegExp("("+l4+"|CrMo)\\/"+UE)],[IDe]:[new RegExp("CriOS\\/"+UE)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+UE)],[w8]:[rie],[BDe]:[rie],[$ne]:[new RegExp("(Opera|OPR)\\/"+UE)],[VQ]:[new RegExp(VQ+"\\/"+UE)],[EDe]:[new RegExp("FxiOS\\/"+UE)],[iie]:[new RegExp("Konqueror[:/]?"+UE,"i")],[YQ]:[new RegExp(YQ+" "+UE),rie],[bDe]:[new RegExp("android\\s"+UE,"i")],[_De]:[new RegExp(vDe+"\\/"+UE)],[Zne]:[new RegExp("(rv:|MSIE )"+UE)],Mozilla:[new RegExp("rv:"+UE)]},gPt=function(i,e){var t=QDe(i,e),n=pPt[t];if(Tu(n))return null;for(var r=0;r<n.length;r++){var o=n[r],a=i.match(o);if(a)return parseFloat(a[a.length-2])}return null},RDe=[[new RegExp(jQ+"; "+jQ+" (.*?)[);]","i"),i=>[jQ,i&&i[1]||""]],[new RegExp(M8,"i"),[M8,""]],[new RegExp(Q8,"i"),[Q8,""]],[oie,[YQ,""]],[new RegExp(R8,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[tie,""];if(new RegExp(I2).test(e)&&!/IEMobile\b/.test(e))return[R8+" "+I2,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var n=t[1],r=fPt[n]||"";return/arm/i.test(e)&&(r="RT"),[R8,r]}return[R8,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>{if(i&&i[3]){var e=[i[3],i[4],i[5]||"0"];return[gG,e.join(".")]}return[gG,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=Tu(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+GB+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+GB+")","i"),i=>{if(i&&i[2]){var e=[i[2],i[3],i[4]||"0"];return[GB,e.join(".")]}return[GB,""]}],[/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/,[sPt,""]],[/Linux|debian/i,["Linux",""]]],DDe=function(i){return APt.test(i)?M8:dPt.test(i)?Q8:uPt.test(i)?jQ:new RegExp(nie,"i").test(i)?nie:new RegExp("("+tie+"|WPDesktop)","i").test(i)?tie:/iPad/.test(i)?pDe:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?mDe:oie.test(i)?YQ:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(SDe,"i").test(i)?SDe:/(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(I2).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)?GB:hDe:GB:new RegExp("(pda|"+I2+")","i").test(i)?cPt:new RegExp(S8,"i").test(i)&&!new RegExp(S8+" pc","i").test(i)?MDe:""},mG="https?://(.*)",yG=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],mPt=zU(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],yG),aie="<masked>",yPt=["li_fat_id"];function NDe(i,e,t){if(!Xd)return{};var n,r=e?zU([],yG,t||[]):[],o=TDe(wne(Xd.URL,r,aie),i),a=(n={},O1(yPt,function(s){var l=LB.D(s);n[s]=l||null}),n);return i9(a,o)}function TDe(i,e){var t=mPt.concat(e||[]),n={};return O1(t,function(r){var o=eG(i,r);n[r]=o||null}),n}function PDe(i){var e=function(o){return o?o.search(mG+"google.([^/?]*)")===0?"google":o.search(mG+"bing.com")===0?"bing":o.search(mG+"yahoo.com")===0?"yahoo":o.search(mG+"duckduckgo.com")===0?"duckduckgo":null:null}(i),t=e!="yahoo"?"q":"p",n={};if(!vw(e)){n.$search_engine=e;var r=Xd?eG(Xd.referrer,t):"";r.length&&(n.ph_keyword=r)}return n}function kDe(){return navigator.language||navigator.userLanguage}function LDe(){return(Xd==null?void 0:Xd.referrer)||"$direct"}function FDe(i,e){var t=i?zU([],yG,e||[]):[],n=hb==null?void 0:hb.href.substring(0,1e3);return{r:LDe().substring(0,1e3),u:n?wne(n,t,aie):void 0}}function UDe(i){var e,{r:t,u:n}=i,r={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=UQ(t))==null?void 0:e.host};if(n){r.$current_url=n;var o=UQ(n);r.$host=o==null?void 0:o.host,r.$pathname=o==null?void 0:o.pathname;var a=TDe(n);i9(r,a)}if(t){var s=PDe(t);i9(r,s)}return r}function GDe(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function vPt(){try{return new Date().getTimezoneOffset()}catch{return}}function _Pt(i,e){if(!pb)return{};var t,n,r,o=i?zU([],yG,e||[]):[],[a,s]=function(l){for(var c=0;c<RDe.length;c++){var[u,d]=RDe[c],f=u.exec(l),h=f&&(v2(d)?d(f,l):d);if(h)return h}return["",""]}(pb);return i9(fne({$os:a,$os_version:s,$browser:QDe(pb,navigator.vendor),$device:DDe(pb),$device_type:(n=pb,r=DDe(n),r===pDe||r===hDe||r==="Kobo"||r==="Kindle Fire"||r===MDe?S8:r===M8||r===jQ||r===Q8||r===nie?"Console":r===mDe?"Wearable":r?I2:"Desktop"),$timezone:GDe(),$timezone_offset:vPt()}),{$current_url:wne(hb==null?void 0:hb.href,o,aie),$host:hb==null?void 0:hb.host,$pathname:hb==null?void 0:hb.pathname,$raw_user_agent:pb.length>1e3?pb.substring(0,997)+"...":pb,$browser_version:gPt(pb,navigator.vendor),$browser_language:kDe(),$browser_language_prefix:(t=kDe(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:Aa==null?void 0:Aa.screen.height,$screen_width:Aa==null?void 0:Aa.screen.width,$viewport_height:Aa==null?void 0:Aa.innerHeight,$viewport_width:Aa==null?void 0:Aa.innerWidth,$lib:"web",$lib_version:JS.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var OB=bx("[FeatureFlags]"),sie="$active_feature_flags",KQ="$override_feature_flags",ODe="$feature_flag_payloads",D8="$override_feature_flag_payloads",zDe="$feature_flag_request_id",HDe=i=>{var e={};for(var[t,n]of HU(i||{}))n&&(e[t]=n);return e},IPt=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]}))):OB.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),i},CPt=function(i){return i.FeatureFlags="feature_flags",i.Recordings="recordings",i}({});class xPt{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(vne),t=this._instance.get_property(KQ),n=this._instance.get_property(D8);if(!n&&!t)return e||{};var r=i9({},e||{}),o=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var a of o){var s,l,c=r[a],u=t==null?void 0:t[a],d=Tu(u)?(s=c==null?void 0:c.enabled)!==null&&s!==void 0&&s:!!u,f=Tu(u)?c.variant:typeof u=="string"?u:void 0,h=n==null?void 0:n[a],g=Dd({},c,{enabled:d,variant:d?f??(c==null?void 0:c.variant):void 0});d!==(c==null?void 0:c.enabled)&&(g.original_enabled=c==null?void 0:c.enabled),f!==(c==null?void 0:c.variant)&&(g.original_variant=c==null?void 0:c.variant),h&&(g.metadata=Dd({},c==null?void 0:c.metadata,{payload:h,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),r[a]=g}return this.ge||(OB.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.ge=!0),r}getFlagVariants(){var e=this._instance.get_property(LQ),t=this._instance.get_property(KQ);if(!t)return e||{};for(var n=i9({},e),r=Object.keys(t),o=0;o<r.length;o++)n[r[o]]=t[r[o]];return this.ge||(OB.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ge=!0),n}getFlagPayloads(){var e=this._instance.get_property(ODe),t=this._instance.get_property(D8);if(!t)return e||{};for(var n=i9({},e||{}),r=Object.keys(t),o=0;o<r.length;o++)n[r[o]]=t[r[o]];return this.ge||(OB.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:Dd({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(v8)||{}),group_properties:this._instance.get_property(n4)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0);var r=this._instance.config.__preview_remote_config,o=r?"/flags/?v=2":"/flags/?v=2&config=true",a=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",s=this._instance.requestRouter.endpointFor("api",o+a);r&&(n.timezone=GDe()),this.me=!0,this._instance.Ee({method:"POST",url:s,data:n,compression:this._instance.config.disable_compression?void 0:WS.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var c,u,d=!0;if(l.statusCode===200&&(this.ye||(this.$anon_distinct_id=void 0),d=!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=!d,l.json&&(c=l.json.quotaLimited)!=null&&c.includes(CPt.FeatureFlags))OB.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:{},d),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,o=this._instance.get_property(zDe)||void 0,a=this._instance.get_property(KU)||{};if((t.send_event||!("send_event"in t))&&(!(e in a)||!a[e].includes(r))){var s,l,c,u,d,f,h,g,y;aC(a[e])?a[e].push(r):a[e]=[r],(s=this._instance.persistence)==null||s.register({[KU]:a});var v=this.getFeatureFlagDetails(e),_={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:o,$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};Tu(v==null||(u=v.metadata)==null?void 0:u.version)||(_.$feature_flag_version=v.metadata.version);var x,S=(d=v==null||(f=v.reason)==null?void 0:f.description)!==null&&d!==void 0?d:v==null||(h=v.reason)==null?void 0:h.code;S&&(_.$feature_flag_reason=S),v!=null&&(g=v.metadata)!=null&&g.id&&(_.$feature_flag_id=v.metadata.id),Tu(v==null?void 0:v.original_variant)&&Tu(v==null?void 0:v.original_enabled)||(_.$feature_flag_original_response=Tu(v.original_variant)?v.original_enabled:v.original_variant),v!=null&&(y=v.metadata)!=null&&y.original_payload&&(_.$feature_flag_original_payload=v==null||(x=v.metadata)==null?void 0:x.original_payload),this._instance.capture("$feature_flag_called",_)}return n}OB.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:WS.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:r=>{var o,a=(o=r.json)==null?void 0:o.featureFlagPayloads;t((a==null?void 0:a[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this._e||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);OB.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(),o=this.getFlagsWithDetails();(function(a,s,l,c,u){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var d=IPt(a),f=d.flags,h=d.featureFlags,g=d.featureFlagPayloads;if(h){var y=a.requestId;if(aC(h)){OB.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(h)for(var _=0;_<h.length;_++)v[h[_]]=!0;s&&s.register({[sie]:h,[LQ]:v})}else{var x=h,S=g,M=f;a.errorsWhileComputingFlags&&(x=Dd({},l,x),S=Dd({},c,S),M=Dd({},u,M)),s&&s.register(Dd({[sie]:Object.keys(HDe(x)),[LQ]:x||{},[ODe]:S||{},[vne]:M||{}},y?{[zDe]:y}:{}))}}})(e,this._instance.persistence,n,r,o),this.Pe(t)}}override(e,t){t===void 0&&(t=!1),OB.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return OB.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(KQ),this._instance.persistence.unregister(D8),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(KQ);else if(n.flags)if(aC(n.flags)){for(var r={},o=0;o<n.flags.length;o++)r[n.flags[o]]=!0;this._instance.persistence.register({[KQ]:r})}else this._instance.persistence.register({[KQ]:n.flags})}return"payloads"in n&&(n.payloads===!1?this._instance.persistence.unregister(D8):n.payloads&&this._instance.persistence.register({[D8]: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(VU)||[]).find(l=>l.flagKey===e),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};r&&(a.$early_access_feature_name=r.name),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var s=Dd({},this.getFlagVariants(),{[e]:t});(n=this._instance.persistence)==null||n.register({[sie]:Object.keys(HDe(s)),[LQ]:s}),this.Pe()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this._instance.get_property(VU),o=n?"&"+n.map(a=>"stage="+a).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+o),method:"GET",callback:a=>{var s;if(a.json){var l=a.json.earlyAccessFeatures;return(s=this._instance.persistence)==null||s.register({[VU]: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(v8)||{};this._instance.register({[v8]:Dd({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(v8)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(n4)||{};Object.keys(n).length!==0&&Object.keys(n).forEach(r=>{n[r]=Dd({},n[r],e[r]),delete e[r]}),this._instance.register({[n4]:Dd({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(n4)||{};this._instance.register({[n4]:Dd({},t,{[e]:{}})})}else this._instance.unregister(n4)}reset(){this._e=!1,this.me=!1,this.be=!1,this.ye=!1,this.we=!1,this.Se=!1,this.$anon_distinct_id=void 0,this.xe(),this.ge=!1}}var EPt=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class lie{constructor(e,t){this.S=e,this.props={},this.Te=!1,this.Me=(n=>{var r="";return n.token&&(r=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+r+"_posthog"})(e),this.B=this.Ce(e),this.load(),e.debug&&vA.info("Persistence loaded",e.persistence,Dd({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.Fe}Ce(e){EPt.indexOf(e.persistence.toLowerCase())===-1&&(vA.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&J9.O()?J9:t==="localstorage+cookie"&&iG.O()?iG:t==="sessionstorage"&&kx.O()?kx:t==="memory"?n7t:t==="cookie"?LB:iG.O()?iG:LB}properties(){var e={};return O1(this.props,function(t,n){if(n===LQ&&GC(t))for(var r=Object.keys(t),o=0;o<r.length;o++)e["$feature/"+r[o]]=t[r[o]];else s=n,l=!1,(vw(a=k6t)?l:YQe&&a.indexOf===YQe?a.indexOf(s)!=-1:(O1(a,function(c){if(l||(l=c===s))return OU}),l))||(e[n]=t);var a,s,l}),e}load(){if(!this.Fe){var e=this.B.L(this.Me);e&&(this.props=i9({},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(GC(e)){Tu(t)&&(t="None"),this.Oe=Tu(n)?this.Le:n;var r=!1;if(O1(e,(o,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.props[a]=o,r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(GC(e)){this.Oe=Tu(t)?this.Le:t;var n=!1;if(O1(e,(r,o)=>{e.hasOwnProperty(o)&&this.props[o]!==r&&(this.props[o]=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=NDe(this.S.custom_campaign_params,this.S.mask_personal_data_properties,this.S.custom_personal_data_properties);kQ(fne(e))||this.register(e),this.Te=!0}}update_search_keyword(){var e;this.register((e=Xd==null?void 0:Xd.referrer)?PDe(e):{})}update_referrer_info(){var e;this.register_once({$referrer:LDe(),$referring_domain:Xd!=null&&Xd.referrer&&((e=UQ(Xd.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[xne]||this.props[Ene]||this.register_once({[JU]:FDe(this.S.mask_personal_data_properties,this.S.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};O1([Ene,xne],a=>{var s=this.props[a];s&&O1(s,function(l,c){e["$initial_"+dne(c)]=l})});var t,n,r=this.props[JU];if(r){var o=(t=UDe(r),n={},O1(t,function(a,s){n["$initial_"+dne(s)]=a}),n);i9(e,o)}return e}safe_merge(e){return O1(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t,n){if(this.Le=this.Oe=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!n),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var r=this.Ce(e),o=this.props;this.clear(),this.B=r,this.props=o,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[m8]||{};n[e]=t,this.props[m8]=n,this.save()}remove_event_timer(e){var t=(this.props[m8]||{})[e];return Tu(t)||(delete this.props[m8][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}class YDe{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 c4{constructor(e){this.Ne=new YDe,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(!Tu((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(!Tu((t=this._instance)==null?void 0:t.Ge)&&(e.forEach(a=>{var s,l;(s=this.We)==null||s.add(a),(l=a.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,o=new Set;e.forEach(a=>{var s;(s=a.steps)==null||s.forEach(l=>{l!=null&&l.selector&&o.add(l==null?void 0:l.selector)})}),(r=this._instance)==null||r.autocapture.setElementSelectors(o)}}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"||!c4.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!!Aa&&HQ(e,t);case"exact":return t===e;case"contains":var r=c4.Ye(t).replace(/_/g,".").replace(/%/g,".*");return HQ(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(o=>!(t!=null&&t.href&&!c4.Ke(o.href||"",t==null?void 0:t.href,(t==null?void 0:t.href_matching)||"exact"))&&(t==null||!t.tag_name||o.tag_name===(t==null?void 0:t.tag_name))&&!(t!=null&&t.text&&!c4.Ke(o.text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact")&&!c4.Ke(o.$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 Bx=bx("[Surveys]"),cie="seenSurvey_",bPt=(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 BPt{constructor(e){this._instance=e,this.Qe=new Map,this.Ze=new Map}register(e){var t;Tu((t=this._instance)==null?void 0:t.Ge)||(this.tr(e),this.ir(e))}ir(e){var t=e.filter(n=>{var r,o;return((r=n.conditions)==null?void 0:r.actions)&&((o=n.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0});t.length!==0&&(this.er==null&&(this.er=new c4(this._instance),this.er.init(),this.er.Ve(n=>{this.onAction(n)})),t.forEach(n=>{var r,o,a,s,l;n.conditions&&(r=n.conditions)!=null&&r.actions&&(o=n.conditions)!=null&&(o=o.actions)!=null&&o.values&&((a=n.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.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,o;return((r=n.conditions)==null?void 0:r.events)&&((o=n.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.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(o=>{if(o&&o.name){var a=this.Qe.get(o.name);a&&a.push(n.id),this.Qe.set(o.name,a||[n.id])}})}))}onEvent(e,t){var n,r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[jU])||[];if(e==="survey shown"&&t&&r.length>0){var o;Bx.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:r});var a=t==null||(o=t.properties)==null?void 0:o.$survey_id;if(a){var s=r.indexOf(a);s>=0&&(r.splice(s,1),this.rr(r))}}else this.Qe.has(e)&&(Bx.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[jU])||[];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({[jU]:[...new Set(e)]})}getSurveys(){var e,t=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[jU];return t||[]}getEventToSurveys(){return this.Qe}sr(){return this.er}}class SPt{constructor(e){this.nr=void 0,this.ar=null,this.lr=!1,this.ur=!1,this.hr=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){var t=e.surveys;if(T_(t))return Bx.warn("Flags not loaded yet. Not loading surveys.");var n=aC(t);this.nr=n?t.length>0:t,Bx.info("flags response received, isSurveysEnabled: "+this.nr),this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(cie)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach(r=>localStorage.removeItem(r))}loadIfEnabled(){if(!this.ar)if(this.ur)Bx.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Bx.info("Disabled. Not loading surveys.");else{var e=F0==null?void 0:F0.__PosthogExtensions__;if(e){var t=this.nr;if(!Tu(t)){this.ur=!0;try{var n=e.generateSurveys;if(n)return void this.dr(n,t);var r=e.loadExternalDependency;if(!r)return void this.vr("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",o=>{o||!e.generateSurveys?this.vr("Could not load surveys script",o):this.dr(e.generateSurveys,t)})}catch(o){throw this.vr("Error initializing surveys",o),o}finally{this.ur=!1}}}else Bx.error("PostHog Extensions not found.")}}dr(e,t){this.ar=e(this._instance,t),this._surveyEventReceiver=new BPt(this._instance),Bx.info("Surveys loaded successfully"),this.cr({isLoaded:!0})}vr(e,t){Bx.error(e,t),this.cr({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.hr.push(e),this.ar&&this.cr({isLoaded:!0}),()=>{this.hr=this.hr.filter(t=>t!==e)}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return Bx.info("Disabled. Not loading surveys."),e([]);var n=this._instance.get_property(_ne);if(n&&!t)return e(n,{isLoaded:!0});if(this.lr)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.lr=!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 o;this.lr=!1;var a=r.statusCode;if(a!==200||!r.json){var s="Surveys API could not be loaded, status: "+a;return Bx.error(s),e([],{isLoaded:!1,error:s})}var l,c=r.json.surveys||[],u=c.filter(d=>function(f){return!(!f.start_date||f.end_date)}(d)&&(function(f){var h;return!((h=f.conditions)==null||(h=h.events)==null||(h=h.values)==null||!h.length)}(d)||function(f){var h;return!((h=f.conditions)==null||(h=h.actions)==null||(h=h.values)==null||!h.length)}(d)));return u.length>0&&((l=this._surveyEventReceiver)==null||l.register(u)),(o=this._instance.persistence)==null||o.register({[_ne]:c}),e(c,{isLoaded:!0})}})}catch(r){throw this.lr=!1,r}}cr(e){for(var t of this.hr)try{e.isLoaded?this.getSurveys(t):t([],e)}catch(n){Bx.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!T_(this.ar))return this.ar.getActiveMatchingSurveys(e,t);Bx.warn("init was not called")}pr(e){var t=null;return this.getSurveys(n=>{var r;t=(r=n.find(o=>o.id===e))!==null&&r!==void 0?r:null}),t}gr(e){if(T_(this.ar))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.ar.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(T_(this.ar))return Bx.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 T_(this.ar)?(Bx.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 o,a=(o=r.find(l=>l.id===e))!==null&&o!==void 0?o:null;if(a){var s=this.gr(a);n({visible:s.eligible,disabledReason:s.reason})}else n({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t){if(T_(this.ar))Bx.warn("init was not called");else{var n=this.pr(e),r=Xd==null?void 0:Xd.querySelector(t);n?r?this.ar.renderSurvey(n,r):Bx.warn("Survey element not found"):Bx.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 uie=function(i){return i.SHOWN="survey shown",i.DISMISSED="survey dismissed",i.SENT="survey sent",i}({}),VDe=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}({}),jDe=bx("[RateLimiter]");class wPt{constructor(e){var t,n;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=r=>{var o=r.text;if(o&&o.length)try{(JSON.parse(o).quota_limited||[]).forEach(a=>{jDe.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4})}catch(a){return void jDe.warn('could not rate limit - continuing. Error: "'+(a==null?void 0:a.message)+'"',{text:o})}},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 o=new Date().getTime(),a=(t=(n=this.instance.persistence)==null?void 0:n.get_property(Cne))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:o};a.tokens+=(o-a.last)/1e3*this.captureEventsPerSecond,a.last=o,a.tokens>this.captureEventsBurstLimit&&(a.tokens=this.captureEventsBurstLimit);var s=a.tokens<1;return s||e||(a.tokens=Math.max(0,a.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(Cne,a),{isRateLimited:s,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var u4=bx("[RemoteConfig]");class MPt{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=F0._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}_r(e){var t,n;(t=F0.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=F0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(u4.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 u4.info("Using preloaded remote config",this.remoteConfig),void this.Ie(this.remoteConfig);if(this._instance.I())return void u4.warn("Remote config is disabled. Falling back to local config.");this._r(e=>{if(!e)return u4.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){u4.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()):u4.info("__preview_remote_config is disabled. Logging config instead",e):u4.error("Failed to fetch remote config from PostHog.")}}var die=3e3;class QPt{constructor(e,t){this.br=!0,this.yr=[],this.wr=jb((t==null?void 0:t.flush_interval_ms)||die,250,5e3,"flush interval",die),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(Dd({},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 o=t[r],a=new Date().getTime();o.data&&aC(o.data)&&O1(o.data,s=>{s.offset=Math.abs(s.timestamp-a),delete s.timestamp}),e.Sr(o)};for(var r in t)n()}},this.wr))}Er(){clearTimeout(this.$r),this.$r=void 0}Ir(){var e={};return O1(this.yr,t=>{var n,r=t,o=(r?r.batchKey:null)||r.url;Tu(e[o])&&(e[o]=Dd({},r,{data:[]})),(n=e[o].data)==null||n.push(r.data)}),this.yr=[],e}}var RPt=["retriesPerformedSoFar"];class DPt{constructor(e){this.Pr=!1,this.Rr=3e3,this.yr=[],this._instance=e,this.yr=[],this.Tr=!0,!Tu(Aa)&&"onLine"in Aa.navigator&&(this.Tr=Aa.navigator.onLine,IC(Aa,"online",()=>{this.Tr=!0,this.se()}),IC(Aa,"offline",()=>{this.Tr=!1}))}get length(){return this.yr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=qQe(e,RPt);AE(t)&&t>0&&(n.url=hG(n.url,{retry_count:t})),this._instance.Ee(Dd({},n,{callback:r=>{r.statusCode!==200&&(r.statusCode<400||r.statusCode>=500)&&(t??0)<10?this.Mr(Dd({retriesPerformedSoFar:t},n)):n.callback==null||n.callback(r)}}))}Mr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(a){var s=3e3*Math.pow(2,a),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 o="Enqueued failed request for retry in "+n;navigator.onLine||(o+=" (Browser is offline)"),vA.warn(o),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(o=>o.retryAt<e||(t.push(o),!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(Dd({},e,{transport:"sendBeacon"}))}catch(t){vA.error(t)}this.yr=[]}}class NPt{constructor(e){this.Or=()=>{var t,n,r,o;this.Ar||(this.Ar={});var a=this.scrollElement(),s=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,c=s+((a==null?void 0:a.clientHeight)||0),u=(a==null?void 0:a.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,(o=this.Ar.maxContentHeight)!==null&&o!==void 0?o:0)},this._instance=e}getContext(){return this.Ar}resetContext(){var e=this.Ar;return setTimeout(this.Or,0),e}startMeasuringScrollPosition(){IC(Aa,"scroll",this.Or,{capture:!0}),IC(Aa,"scrollend",this.Or,{capture:!0}),IC(Aa,"resize",this.Or)}scrollElement(){if(!this._instance.config.scroll_root_selector)return Aa==null?void 0:Aa.document.documentElement;var e=aC(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=Aa==null?void 0:Aa.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 Aa&&(Aa.scrollY||Aa.pageYOffset||Aa.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return Aa&&(Aa.scrollX||Aa.pageXOffset||Aa.document.documentElement.scrollLeft)||0}}var TPt=i=>FDe(i==null?void 0:i.config.mask_personal_data_properties,i==null?void 0:i.config.custom_personal_data_properties);class PPt{constructor(e,t,n,r){this.Dr=o=>{var a=this.Lr();if(!a||a.sessionId!==o){var s={sessionId:o,props:this.jr(this._instance)};this.Nr.register({[Ine]:s})}},this._instance=e,this.zr=t,this.Nr=n,this.jr=r||TPt,this.zr.onSessionId(this.Dr)}Lr(){return this.Nr.props[Ine]}getSetOnceProps(){var e,t=(e=this.Lr())==null?void 0:e.props;return t?"r"in t?UDe(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 O1(fne(this.getSetOnceProps()),(t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+dne(n)]=t}),e}}var KDe=bx("[SessionId]");class kPt{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||Cw,this.Br=n||Cw;var o=this.S.persistence_name||this.S.token,a=this.S.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*jb(a,60,36e3,"session_idle_timeout_seconds",1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hr(),this.Wr="ph_"+o+"_window_id",this.Gr="ph_"+o+"_primary_window_exists",this.Jr()){var s=kx.L(this.Wr),l=kx.L(this.Gr);s&&!l?this.fi=s:kx.N(this.Wr),kx.j(this.Gr,!0)}if((r=this.S.bootstrap)!=null&&r.sessionID)try{var c=(u=>{var d=u.replace(/-/g,"");if(d.length!==32)throw new Error("Not a valid UUID");if(d[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(d.substring(0,12),16)})(this.S.bootstrap.sessionID);this.Vr(this.S.bootstrap.sessionID,new Date().getTime(),c)}catch(u){KDe.error("Invalid sessionID in bootstrap",u)}this.Kr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Tu(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&&kx.O()}Yr(e){e!==this.fi&&(this.fi=e,this.Jr()&&kx.j(this.Wr,e))}Xr(){return this.fi?this.fi:this.Jr()?kx.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({[YU]:[t,e,n]}))}Qr(){if(this.Ct&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ct,this._sessionStartTimestamp];var e=this.Nr.props[YU];return aC(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Vr(null,null,null)}Kr(){IC(Aa,"beforeunload",()=>{this.Jr()&&kx.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,o,a]=this.Qr(),s=this.Xr(),l=AE(a)&&a>0&&Math.abs(n-a)>864e5,c=!1,u=!o,d=!e&&Math.abs(n-r)>this.sessionTimeoutMs;u||d||l?(o=this.qr(),s=this.Br(),KDe.info("new session ID generated",{sessionId:o,windowId:s,changeReason:{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}}),a=n,c=!0):s||(s=this.Br(),c=!0);var f=r===0||!e||l?n:r,h=a===0?new Date().getTime():a;return this.Yr(s),this.Vr(o,f,h),e||this.Hr(),c&&this.Ur.forEach(g=>g(o,s,c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0)),{sessionId:o,windowId:s,sessionStartTimestamp:h,changeReason:c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}Hr(){clearTimeout(this.Zr),this.Zr=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}}var LPt=["$set_once","$set"],Bw=bx("[SiteApps]");class FPt{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=F0._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,o,a,s,l;if(!e)throw new Error("Event payload is required");var c={},u=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(var[f,h]of Object.entries(d))c[f]={id:u[f],type:f,properties:h};var{$set_once:g,$set:y}=e;return{event:Dd({},qQe(e,LPt),{properties:Dd({},e.properties,y?{$set:Dd({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},y)}:{},g?{$set_once:Dd({},(r=(o=e.properties)==null?void 0:o.$set_once)!==null&&r!==void 0?r:{},g)}:{}),elements_chain:(a=(s=e.properties)==null?void 0:s.$elements_chain)!==null&&a!==void 0?a:"",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&&(Bw.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,o=s=>{t.errored=!s,t.loaded=!0,Bw.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&n()};try{var{processEvent:a}=e.init({posthog:this._instance,callback:s=>{o(s)}});a&&(t.processEvent=a),r=!0}catch(s){Bw.error("Error while initializing PostHog app with config id "+e.id,s),o(!1)}if(r&&t.loaded)try{n()}catch(s){Bw.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){Bw.error("Error while processing event "+e.event+" for site app "+n.id,r)}}}onRemoteConfig(e){var t,n,r,o=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.ss(),void this._instance.on("eventCaptured",c=>this.ns(c))):void Bw.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 a=function(c){var u;F0["__$$ph_site_app_"+c]=o._instance,(u=F0.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(o._instance,l,d=>{if(d)return Bw.error("Error while initializing PostHog app with config id "+c,d)})};for(var{id:s,url:l}of e.siteApps)a(s)}else Bw.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var UPt=["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"],JDe=function(i,e){if(!i)return!1;var t=i.toLowerCase();return UPt.concat(e||[]).some(n=>{var r=n.toLowerCase();return t.indexOf(r)!==-1})},WDe=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&JDe(t,e))return!0;try{var n=i==null?void 0:i.userAgentData;if(n!=null&&n.brands&&n.brands.some(r=>JDe(r==null?void 0:r.brand,e)))return!0}catch{}return!!i.webdriver},N8=function(i){return i.US="us",i.EU="eu",i.CUSTOM="custom",i}({}),qDe="i.posthog.com";class GPt{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("."+qDe,".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]=N8.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.os[this.apiHost]=N8.EU:this.os[this.apiHost]=N8.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===N8.CUSTOM)return this.apiHost+t;var n=qDe+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}}var OPt={icontains:(i,e)=>!!Aa&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!Aa&&e.href.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>!!Aa&&HQ(e.href,i),not_regex:(i,e)=>!!Aa&&!HQ(e.href,i),exact:(i,e)=>e.href===i,is_not:(i,e)=>e.href!==i};class pE{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),t.getWebExperiments(r=>{pE.ls("retrieved web experiments from the server"),t.us=new Map,r.forEach(o=>{if(o.feature_flag_key){var a;t.us&&(pE.ls("setting flag key ",o.feature_flag_key," to web experiment ",o),(a=t.us)==null||a.set(o.feature_flag_key,o));var s=t._instance.getFeatureFlag(o.feature_flag_key);OC(s)&&o.variants[s]&&t.hs(o.name,s,o.variants[s].transforms)}else if(o.variants)for(var l in o.variants){var c=o.variants[l];pE.ds(c)&&t.hs(o.name,l,c.transforms)}})},n)},this._instance=e,this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}onFeatureFlags(e){if(this._is_bot())pE.ls("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(T_(this.us))return this.us=new Map,this.loadIfEnabled(),void this.previewWebExperiment();pE.ls("applying feature flags",e),e.forEach(t=>{var n;if(this.us&&(n=this.us)!=null&&n.has(t)){var r,o=this._instance.getFeatureFlag(t),a=(r=this.us)==null?void 0:r.get(t);o&&a!=null&&a.variants[o]&&this.hs(a.name,o,a.variants[o].transforms)}})}}previewWebExperiment(){var e=pE.getWindowLocation();if(e!=null&&e.search){var t=eG(e==null?void 0:e.search,"__experiment_id"),n=eG(e==null?void 0:e.search,"__experiment_variant");t&&n&&(pE.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:o=>{if(o.statusCode!==200||!o.json)return e([]);var a=o.json.experiments||[];return e(a)}})}vs(e,t,n){var r=n.filter(o=>o.id===e);r&&r.length>0&&(pE.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!T_(e.conditions)&&pE.cs(e)&&pE.fs(e)}static cs(e){var t;if(T_(e.conditions)||T_((t=e.conditions)==null?void 0:t.url))return!0;var n,r,o,a=pE.getWindowLocation();return!!a&&((n=e.conditions)==null||!n.url||OPt[(r=(o=e.conditions)==null?void 0:o.urlMatchType)!==null&&r!==void 0?r:"icontains"](e.conditions.url,a))}static getWindowLocation(){return Aa==null?void 0:Aa.location}static fs(e){var t;if(T_(e.conditions)||T_((t=e.conditions)==null?void 0:t.utm))return!0;var n=NDe();if(n.utm_source){var r,o,a,s,l,c,u,d,f=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_campaign)==n.utm_campaign,h=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_source)==n.utm_source,g=(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,y=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==n.utm_term;return f&&g&&y&&h}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];vA.info("[WebExperiments] "+e,n)}hs(e,t,n){this._is_bot()?pE.ls("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?n.forEach(r=>{if(r.selector){var o;pE.ls("applying transform of variant "+t+" for experiment "+e+" ",r);var a=(o=document)==null?void 0:o.querySelectorAll(r.selector);a==null||a.forEach(s=>{var l=s;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)})}}):pE.ls("Control variants leave the page unmodified.")}_is_bot(){return Vb&&this._instance?WDe(Vb,this._instance.config.custom_blocked_useragents):void 0}}var zPt=bx("[PostHog ExternalIntegrations]"),HPt={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class YPt{constructor(e){this._instance=e}J(e,t){var n;(n=F0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,e,r=>{if(r)return zPt.error("failed to load script",r);t()})}startIfEnabledOrStop(){var e=this,t=function(a){var s,l,c;!r||(s=F0.__PosthogExtensions__)!=null&&(s=s.integrations)!=null&&s[a]||e.J(HPt[a],()=>{var u;(u=F0.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[a])==null||u.start(e._instance)}),!r&&(l=F0.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[a]&&((c=F0.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[a])==null||c.stop())};for(var[n,r]of Object.entries((o=this._instance.config.integrations)!==null&&o!==void 0?o:{})){var o;t(n)}}}var T8={},Aie=()=>{},JQ="posthog",XDe=!iPt&&(pb==null?void 0:pb.indexOf("MSIE"))===-1&&(pb==null?void 0:pb.indexOf("Mozilla"))===-1,ZDe=i=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:P6t(Xd==null?void 0:Xd.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Aie,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:hb&&OC(hb==null?void 0:hb.search)&&hb.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(Aa==null||(e=Aa.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",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;vA.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:die},error_tracking:{},_onCapture:Aie}},$De=i=>{var e={};Tu(i.process_person)||(e.person_profiles=i.process_person),Tu(i.xhr_headers)||(e.request_headers=i.xhr_headers),Tu(i.cookie_name)||(e.persistence_name=i.cookie_name),Tu(i.disable_cookie)||(e.disable_persistence=i.disable_cookie),Tu(i.store_google)||(e.save_campaign_params=i.store_google),Tu(i.verbose)||(e.debug=i.verbose);var t=i9({},e,i);return aC(i.property_blacklist)&&(Tu(i.property_denylist)?t.property_denylist=i.property_blacklist:aC(i.property_denylist)?t.property_denylist=[...i.property_blacklist,...i.property_denylist]:vA.error("Invalid value for property_denylist config: "+i.property_denylist)),t};class VPt{constructor(){this.__forceAllowLocalhost=!1}get ps(){return this.__forceAllowLocalhost}set ps(e){vA.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class vG{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 VPt,this.gs=!1,this.version=JS.LIB_VERSION,this._s=new YDe,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ZDe(),this.SentryIntegration=K7t,this.sentryIntegration=e=>function(t,n){var r=sDe(t,n);return{name:aDe,processEvent:o=>r(o)}}(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 xPt(this),this.toolbar=new W7t(this),this.scrollManager=new NPt(this),this.pageViewManager=new tPt(this),this.surveys=new SPt(this),this.experiments=new pE(this),this.exceptions=new aPt(this),this.rateLimiter=new wPt(this),this.requestRouter=new GPt(this),this.consent=new i7t(this),this.externalIntegrations=new YPt(this),this.people={set:(e,t,n)=>{var r=OC(e)?{[e]:t}:e;this.setPersonProperties(r),n==null||n({})},set_once:(e,t,n)=>{var r=OC(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n==null||n({})}},this.on("eventCaptured",e=>vA.info('send "'+(e==null?void 0:e.event)+'"',e))}init(e,t,n){if(n&&n!==JQ){var r,o=(r=T8[n])!==null&&r!==void 0?r:new vG;return o._init(e,t,n),T8[n]=o,T8[JQ][n]=o,o}return this._init(e,t,n)}_init(e,t,n){var r,o;if(t===void 0&&(t={}),Tu(e)||Ane(e))return vA.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 vA.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(i9({},ZDe(t.defaults),$De(t),{name:n,token:e})),this.config.on_xhr_error&&vA.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:WS.GZipJS;var a=this.xs();this.persistence=new lie(this.config,a),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new lie(Dd({},this.config,{persistence:"sessionStorage"}),a);var s=Dd({},this.persistence.props),l=Dd({},this.sessionPersistence.props);if(this.register({$initialization_time:new Date().toISOString()}),this.Es=new QPt(x=>this.Is(x),this.config.request_queue_config),this.Ps=new DPt(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new kPt(this),this.sessionPropsManager=new PPt(this,this.sessionManager,this.persistence)),new X7t(this).startIfEnabledOrStop(),this.siteApps=new FPt(this),(r=this.siteApps)==null||r.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new V7t(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new W6t(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new ePt(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Z7t(this),this.exceptionObserver=new a7t(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new RRe(this,o7t),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new _7t(this),this.historyAutocapture.startIfEnabled(),JS.DEBUG=JS.DEBUG||this.config.debug,JS.DEBUG&&vA.info("Starting in debug mode",{this:this,config:t,thisC:Dd({},this.config),p:s,s:l}),((o=t.bootstrap)==null?void 0:o.distinctID)!==void 0){var c,u,d=this.config.get_device_id(Cw()),f=(c=t.bootstrap)!=null&&c.isIdentifiedID?d:t.bootstrap.distinctID;this.persistence.set_property(qS,(u=t.bootstrap)!=null&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:f})}if(this.Rs()){var h,g,y=Object.keys(((h=t.bootstrap)==null?void 0:h.featureFlags)||{}).filter(x=>{var S;return!((S=t.bootstrap)==null||(S=S.featureFlags)==null||!S[x])}).reduce((x,S)=>{var M;return x[S]=((M=t.bootstrap)==null||(M=M.featureFlags)==null?void 0:M[S])||!1,x},{}),v=Object.keys(((g=t.bootstrap)==null?void 0:g.featureFlagPayloads)||{}).filter(x=>y[x]).reduce((x,S)=>{var M,z;return(M=t.bootstrap)!=null&&(M=M.featureFlagPayloads)!=null&&M[S]&&(x[S]=(z=t.bootstrap)==null||(z=z.featureFlagPayloads)==null?void 0:z[S]),x},{});this.featureFlags.receivedFeatureFlags({featureFlags:y,featureFlagPayloads:v})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:qU,$device_id:null},"");else if(!this.get_distinct_id()){var _=this.config.get_device_id(Cw());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(qS,"anonymous")}return IC(Aa,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?j7t(this,()=>this.Ts()):this.Ts(),v2(this.config._onCapture)&&this.config._onCapture!==Aie&&(vA.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",x=>this.config._onCapture(x.event,x))),this.config.ip&&vA.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Ie(e){var t,n,r,o,a,s,l,c;if(!Xd||!Xd.body)return vA.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=Iy(e.supportedCompression,WS.GZipJS)?WS.GZipJS:Iy(e.supportedCompression,WS.Base64)?WS.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),(o=this.autocapture)==null||o.onRemoteConfig(e),(a=this.heatmaps)==null||a.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){vA.critical("`loaded` function failed",e)}this.Ms(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this.Cs()},1),new MPt(this).load(),this.featureFlags.flags()}Ms(){var e;this.has_opted_out_capturing()||this.config.request_batching&&((e=this.Es)==null||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||_w(this.__request_queue,e=>this.Is(e)),this.__request_queue=[],this.Ms()}_handle_unload(){var e,t;this.config.request_batching?(this.Fs()&&this.capture("$pageleave"),(e=this.Es)==null||e.unload(),(t=this.Ps)==null||t.unload()):this.Fs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Ee(e){this.__loaded&&(XDe?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=hG(e.url,{ip:this.config.ip?1:0}),e.headers=Dd({},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,o,a=Dd({},t);a.timeout=a.timeout||6e4,a.url=hG(a.url,{_:new Date().getTime().toString(),ver:JS.LIB_VERSION,compression:a.compression});var s=(n=a.transport)!==null&&n!==void 0?n:"fetch",l=(r=(o=ZQe(B8,c=>c.transport===s))==null?void 0:o.method)!==null&&r!==void 0?r:B8[0].method;if(!l)throw new Error("No available transport method");l(a)})(Dd({},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)}}))))}Is(e){this.Ps?this.Ps.retriableRequest(e):this.Ee(e)}_execute_array(e){var t,n=[],r=[],o=[];_w(e,s=>{s&&(t=s[0],aC(t)?o.push(s):v2(s)?s.call(this):aC(s)&&t==="alias"?n.push(s):aC(s)&&t.indexOf("capture")!==-1&&v2(this[t])?o.push(s):r.push(s))});var a=function(s,l){_w(s,function(c){if(aC(c[0])){var u=l;O1(c,function(d){u=u[d[0]].apply(u,d.slice(1))})}else this[c[0]].apply(this,c.slice(1))},l)};a(n,this),a(r,this),a(o,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.Es){if(!this.consent.isOptedOut())if(!Tu(e)&&OC(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var o=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){t!=null&&t.$current_url&&!OC(t==null?void 0:t.$current_url)&&(vA.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 a=new Date,s=(n==null?void 0:n.timestamp)||a,l=Cw(),c={uuid:l,event:e,properties:this.calculateEventProperties(e,t||{},s,l)};o&&(c.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),n!=null&&n.$set&&(c.$set=n==null?void 0:n.$set);var u,d,f=this.Os(n==null?void 0:n.$set_once);if(f&&(c.$set_once=f),(c=N6t(c,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=s,Tu(n==null?void 0:n.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=a),e===uie.DISMISSED||e===uie.SENT){var h=t==null?void 0:t[VDe.SURVEY_ID],g=t==null?void 0:t[VDe.SURVEY_ITERATION];localStorage.setItem((d=""+cie+(u={id:h,current_iteration:g}).id,u.current_iteration&&u.current_iteration>0&&(d=""+cie+u.id+"_"+u.current_iteration),d),"true"),c.$set=Dd({},c.$set,{[bPt({id:h,current_iteration:g},e===uie.SENT?"responded":"dismissed")]:!0})}var y=Dd({},c.properties.$set,c.$set);if(kQ(y)||this.setPersonPropertiesForFlags(y),!T_(this.config.before_send)){var v=this.As(c);if(!v)return;c=v}this._s.emit("eventCaptured",c);var _={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.Is(_):this.Es.enqueue(_),c}vA.critical("This capture call is ignored due to client rate limiting.")}}else vA.error("No event name provided to posthog.capture")}else vA.uninitializedWarning("posthog.capture")}Ge(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,n,r,o){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var a=o?void 0:this.persistence.remove_event_timer(e),s=Dd({},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=Dd({},this.persistence.properties(),this.sessionPersistence.properties());return s.distinct_id=l.distinct_id,(!OC(s.distinct_id)&&!AE(s.distinct_id)||Ane(s.distinct_id))&&vA.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),s}var c,u=_Pt(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:f}=this.sessionManager.checkAndGetSessionAndWindowId(o,n.getTime());s.$session_id=d,s.$window_id=f}this.sessionPropsManager&&i9(s,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&i9(s,this.sessionRecording.sdkDebugProperties),s.$sdk_debug_retry_queue_size=(h=this.Ps)==null?void 0:h.length}catch(_){s.$sdk_debug_error_capturing_properties=String(_)}if(this.requestRouter.region===N8.CUSTOM&&(s.$lib_custom_api_host=this.config.api_host),c=e!=="$pageview"||o?e!=="$pageleave"||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),s=i9(s,c),e==="$pageview"&&Xd&&(s.title=Xd.title),!Tu(a)){var g=n.getTime()-a;s.$duration=parseFloat((g/1e3).toFixed(3))}pb&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?"bot":"browser"),(s=i9({},u,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),aC(this.config.property_denylist)?O1(this.config.property_denylist,function(_){delete s[_]}):vA.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var y=this.config.sanitize_properties;y&&(vA.error("sanitize_properties is deprecated. Use before_send instead"),s=y(s,e));var v=this.Ds();return s.$process_person_profile=v,v&&!o&&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(),o=i9({},n,r||{},e||{}),a=this.config.sanitize_properties;return a&&(vA.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),this.gs=!0,kQ(o)?void 0:o}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 vA.uninitializedWarning("posthog.identify");if(AE(e)&&(e=e.toString(),vA.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()))vA.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!==qU){if(this.Ls("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var o=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:o},"")}e!==r&&e!==this.get_property(g8)&&(this.unregister(g8),this.register({distinct_id:e}));var a=(this.persistence.get_property(qS)||"anonymous")==="anonymous";e!==r&&a?(this.persistence.set_property(qS,"identified"),this.setPersonPropertiesForFlags(Dd({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.Ss=fDe(e,t,n),this.featureFlags.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(KU))}}else vA.critical('The string "'+qU+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else vA.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.Ls("posthog.setPersonProperties")){var n=fDe(this.get_distinct_id(),e,t);this.Ss!==n?(this.setPersonPropertiesForFlags(Dd({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Ss=n):vA.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:Dd({},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 vA.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,o;if(vA.info("reset"),!this.__loaded)return vA.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),this.featureFlags.reset(),(r=this.persistence)==null||r.set_property(qS,"anonymous"),(o=this.sessionManager)==null||o.resetSessionId(),this.Ss=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:qU,$device_id:null},"");else{var s=this.config.get_device_id(Cw());this.register_once({distinct_id:s,$device_id:e?s:a},"")}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 o,a=(o=e.timestampLookBack)!==null&&o!==void 0?o:10;if(!n)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-a,0)}return r}alias(e,t){return e===this.get_property($Qe)?(vA.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ls("posthog.alias")?(Tu(t)&&(t=this.get_distinct_id()),e!==t?(this.js(g8,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(vA.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=Dd({},this.config);if(GC(e)){var n,r,o,a,s;i9(this.config,$De(e));var l=this.xs();(n=this.persistence)==null||n.update_config(this.config,t,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new lie(Dd({},this.config,{persistence:"sessionStorage"}),l),J9.O()&&J9.D("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(JS.DEBUG=!0,vA.info("set_config",{config:e,oldConfig:t,newConfig:Dd({},this.config)})),(r=this.sessionRecording)==null||r.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),this.surveys.loadIfEnabled(),this.Ns(),(s=this.externalIntegrations)==null||s.startIfEnabledOrStop()}}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,o,a,s,l;(r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),n.sampling&&((o=this.sessionRecording)==null||o.overrideSampling()),n.linked_flag&&((a=this.sessionRecording)==null||a.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");return this.exceptions.sendExceptionEvent(Dd({},v7t((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:JQ;return t!==JQ&&(t=JQ+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(qS))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(qS))==="identified"}Ds(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&kQ(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[g8])&&((t=this.persistence)==null||(t=t.props)==null||!t[WU]))}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"?(vA.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.js(WU,!0),!0)}xs(){var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default;return this.config.disable_persistence||e&&!!t}Ns(){var e,t,n,r,o=this.xs();return((e=this.persistence)==null?void 0:e.Fe)!==o&&((n=this.persistence)==null||n.set_disabled(o)),((t=this.sessionPersistence)==null?void 0:t.Fe)!==o&&((r=this.sessionPersistence)==null||r.set_disabled(o)),o}opt_in_capturing(e){var t;this.consent.optInOut(!0),this.Ns(),(Tu(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.Ns()}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.Ns()}_is_bot(){return Vb?WDe(Vb,this.config.custom_blocked_useragents):void 0}Cs(){Xd&&(Xd.visibilityState==="visible"?this.bs||(this.bs=!0,this.capture("$pageview",{title:Xd.title},{send_instantly:!0}),this.ys&&(Xd.removeEventListener("visibilitychange",this.ys),this.ys=null)):this.ys||(this.ys=this.Cs.bind(this),IC(Xd,"visibilitychange",this.ys)))}debug(e){e===!1?(Aa==null||Aa.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(Aa==null||Aa.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,o,a,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?(vA.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,o=vA,a=(t="advanced_disable_flags")in(e=l)&&!Tu(e[t]),s=n in e&&!Tu(e[n]),a?e[t]:s?(o&&o.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(T_(this.config.before_send))return e;var t=aC(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var r of t){if(n=r(n),T_(n)){var o="Event '"+e.event+"' was rejected in beforeSend function";return Q6t(e.event)?vA.warn(o+". This can cause unexpected behavior."):vA.info(o),null}n.properties&&!kQ(n.properties)||vA.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]]=D6t(i.prototype[e[t]])})(vG,["identify"]);var eNe,_G=(eNe=T8[JQ]=new vG,function(){function i(){i.done||(i.done=!0,XDe=!1,O1(T8,function(e){e._dom_loaded()}))}Xd!=null&&Xd.addEventListener?Xd.readyState==="complete"?i():IC(Xd,"DOMContentLoaded",i,{capture:!1}):Aa&&vA.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),eNe);!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1")&&(_G.__loaded||_G.init("phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo",{api_host:"https://postpig.tscircuit.com",person_profiles:"always"}));function jPt(i){const e=String.fromCodePoint(...i);return btoa(e)}var Kb=Uint8Array,Jb=Uint16Array,fie=Int32Array,hie=new Kb([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]),pie=new Kb([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]),tNe=new Kb([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nNe=function(i,e){for(var t=new Jb(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];for(var r=new fie(t[30]),n=1;n<30;++n)for(var o=t[n];o<t[n+1];++o)r[o]=o-t[n]<<5|n;return{b:t,r}},iNe=nNe(hie,2),KPt=iNe.b,gie=iNe.r;KPt[28]=258,gie[258]=28;for(var JPt=nNe(pie,0),rNe=JPt.r,mie=new Jb(32768),KI=0;KI<32768;++KI){var Sw=(KI&43690)>>1|(KI&21845)<<1;Sw=(Sw&52428)>>2|(Sw&13107)<<2,Sw=(Sw&61680)>>4|(Sw&3855)<<4,mie[KI]=((Sw&65280)>>8|(Sw&255)<<8)>>1}for(var P8=function(i,e,t){for(var n=i.length,r=0,o=new Jb(e);r<n;++r)i[r]&&++o[i[r]-1];var a=new Jb(e);for(r=1;r<e;++r)a[r]=a[r-1]+o[r-1]<<1;var s;if(t){s=new Jb(1<<e);var l=15-e;for(r=0;r<n;++r)if(i[r])for(var c=r<<4|i[r],u=e-i[r],d=a[i[r]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[mie[d]>>l]=c}else for(s=new Jb(n),r=0;r<n;++r)i[r]&&(s[r]=mie[a[i[r]-1]++]>>15-i[r]);return s},d4=new Kb(288),KI=0;KI<144;++KI)d4[KI]=8;for(var KI=144;KI<256;++KI)d4[KI]=9;for(var KI=256;KI<280;++KI)d4[KI]=7;for(var KI=280;KI<288;++KI)d4[KI]=8;for(var IG=new Kb(32),KI=0;KI<32;++KI)IG[KI]=5;var WPt=P8(d4,9,0),qPt=P8(IG,5,0),oNe=function(i){return(i+7)/8|0},aNe=function(i,e,t){return(t==null||t>i.length)&&(t=i.length),new Kb(i.subarray(e,t))},$S=function(i,e,t){t<<=e&7;var n=e/8|0;i[n]|=t,i[n+1]|=t>>8},k8=function(i,e,t){t<<=e&7;var n=e/8|0;i[n]|=t,i[n+1]|=t>>8,i[n+2]|=t>>16},yie=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,o=t.slice();if(!r)return{t:uNe,l:0};if(r==1){var a=new Kb(t[0].s+1);return a[t[0].s]=1,{t:a,l:1}}t.sort(function(z,U){return z.f-U.f}),t.push({s:-1,f:25001});var s=t[0],l=t[1],c=0,u=1,d=2;for(t[0]={s:-1,f:s.f+l.f,l:s,r:l};u!=r-1;)s=t[t[c].f<t[d].f?c++:d++],l=t[c!=u&&t[c].f<t[d].f?c++:d++],t[u++]={s:-1,f:s.f+l.f,l:s,r:l};for(var f=o[0].s,n=1;n<r;++n)o[n].s>f&&(f=o[n].s);var h=new Jb(f+1),g=vie(t[u-1],h,0);if(g>e){var n=0,y=0,v=g-e,_=1<<v;for(o.sort(function(U,H){return h[H.s]-h[U.s]||U.f-H.f});n<r;++n){var x=o[n].s;if(h[x]>e)y+=_-(1<<g-h[x]),h[x]=e;else break}for(y>>=v;y>0;){var S=o[n].s;h[S]<e?y-=1<<e-h[S]++-1:++n}for(;n>=0&&y;--n){var M=o[n].s;h[M]==e&&(--h[M],++y)}g=e}return{t:new Kb(h),l:g}},vie=function(i,e,t){return i.s==-1?Math.max(vie(i.l,e,t+1),vie(i.r,e,t+1)):e[i.s]=t},sNe=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new Jb(++e),n=0,r=i[0],o=1,a=function(l){t[n++]=l},s=1;s<=e;++s)if(i[s]==r&&s!=e)++o;else{if(!r&&o>2){for(;o>138;o-=138)a(32754);o>2&&(a(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(a(r),--o;o>6;o-=6)a(8304);o>2&&(a(o-3<<5|8208),o=0)}for(;o--;)a(r);o=1,r=i[s]}return{c:t.subarray(0,n),n:e}},L8=function(i,e){for(var t=0,n=0;n<e.length;++n)t+=i[n]*e[n];return t},lNe=function(i,e,t){var n=t.length,r=oNe(e+2);i[r]=n&255,i[r+1]=n>>8,i[r+2]=i[r]^255,i[r+3]=i[r+1]^255;for(var o=0;o<n;++o)i[r+o+4]=t[o];return(r+4+n)*8},cNe=function(i,e,t,n,r,o,a,s,l,c,u){$S(e,u++,t),++r[256];for(var d=yie(r,15),f=d.t,h=d.l,g=yie(o,15),y=g.t,v=g.l,_=sNe(f),x=_.c,S=_.n,M=sNe(y),z=M.c,U=M.n,H=new Jb(19),k=0;k<x.length;++k)++H[x[k]&31];for(var k=0;k<z.length;++k)++H[z[k]&31];for(var j=yie(H,7),G=j.t,ee=j.l,K=19;K>4&&!G[tNe[K-1]];--K);var ie=c+5<<3,ce=L8(r,d4)+L8(o,IG)+a,ue=L8(r,f)+L8(o,y)+a+14+3*K+L8(H,G)+2*H[16]+3*H[17]+7*H[18];if(l>=0&&ie<=ce&&ie<=ue)return lNe(e,u,i.subarray(l,l+c));var le,_e,ye,Qe;if($S(e,u,1+(ue<ce)),u+=2,ue<ce){le=P8(f,h,0),_e=f,ye=P8(y,v,0),Qe=y;var Me=P8(G,ee,0);$S(e,u,S-257),$S(e,u+5,U-1),$S(e,u+10,K-4),u+=14;for(var k=0;k<K;++k)$S(e,u+3*k,G[tNe[k]]);u+=3*K;for(var Te=[x,z],Ee=0;Ee<2;++Ee)for(var Ge=Te[Ee],k=0;k<Ge.length;++k){var Ke=Ge[k]&31;$S(e,u,Me[Ke]),u+=G[Ke],Ke>15&&($S(e,u,Ge[k]>>5&127),u+=Ge[k]>>12)}}else le=WPt,_e=d4,ye=qPt,Qe=IG;for(var k=0;k<s;++k){var nt=n[k];if(nt>255){var Ke=nt>>18&31;k8(e,u,le[Ke+257]),u+=_e[Ke+257],Ke>7&&($S(e,u,nt>>23&31),u+=hie[Ke]);var lt=nt&31;k8(e,u,ye[lt]),u+=Qe[lt],lt>3&&(k8(e,u,nt>>5&8191),u+=pie[lt])}else k8(e,u,le[nt]),u+=_e[nt]}return k8(e,u,le[256]),u+_e[256]},XPt=new fie([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),uNe=new Kb(0),ZPt=function(i,e,t,n,r,o){var a=o.z||i.length,s=new Kb(n+a+5*(1+Math.ceil(a/7e3))+r),l=s.subarray(n,s.length-r),c=o.l,u=(o.r||0)&7;if(e){u&&(l[0]=o.r>>3);for(var d=XPt[e-1],f=d>>13,h=d&8191,g=(1<<t)-1,y=o.p||new Jb(32768),v=o.h||new Jb(g+1),_=Math.ceil(t/3),x=2*_,S=function(yt){return(i[yt]^i[yt+1]<<_^i[yt+2]<<x)&g},M=new fie(25e3),z=new Jb(288),U=new Jb(32),H=0,k=0,j=o.i||0,G=0,ee=o.w||0,K=0;j+2<a;++j){var ie=S(j),ce=j&32767,ue=v[ie];if(y[ce]=ue,v[ie]=ce,ee<=j){var le=a-j;if((H>7e3||G>24576)&&(le>423||!c)){u=cNe(i,l,0,M,z,U,k,G,K,j-K,u),G=H=k=0,K=j;for(var _e=0;_e<286;++_e)z[_e]=0;for(var _e=0;_e<30;++_e)U[_e]=0}var ye=2,Qe=0,Me=h,Te=ce-ue&32767;if(le>2&&ie==S(j-Te))for(var Ee=Math.min(f,le)-1,Ge=Math.min(32767,j),Ke=Math.min(258,le);Te<=Ge&&--Me&&ce!=ue;){if(i[j+ye]==i[j+ye-Te]){for(var nt=0;nt<Ke&&i[j+nt]==i[j+nt-Te];++nt);if(nt>ye){if(ye=nt,Qe=Te,nt>Ee)break;for(var lt=Math.min(Te,nt-2),Rt=0,_e=0;_e<lt;++_e){var pt=j-Te+_e&32767,Fe=y[pt],We=pt-Fe&32767;We>Rt&&(Rt=We,ue=pt)}}}ce=ue,ue=y[ce],Te+=ce-ue&32767}if(Qe){M[G++]=268435456|gie[ye]<<18|rNe[Qe];var $e=gie[ye]&31,_t=rNe[Qe]&31;k+=hie[$e]+pie[_t],++z[257+$e],++U[_t],ee=j+ye,++H}else M[G++]=i[j],++z[i[j]]}}for(j=Math.max(j,ee);j<a;++j)M[G++]=i[j],++z[i[j]];u=cNe(i,l,c,M,z,U,k,G,K,j-K,u),c||(o.r=u&7|l[u/8|0]<<3,u-=7,o.h=v,o.p=y,o.i=j,o.w=ee)}else{for(var j=o.w||0;j<a+c;j+=65535){var Tt=j+65535;Tt>=a&&(l[u/8|0]=c,Tt=a),u=lNe(l,u+1,i.subarray(j,Tt))}o.i=a}return aNe(s,0,n+oNe(u)+r)},$Pt=function(){for(var i=new Int32Array(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(t&1&&-306674912)^t>>>1;i[e]=t}return i}(),ekt=function(){var i=-1;return{p:function(e){for(var t=i,n=0;n<e.length;++n)t=$Pt[t&255^e[n]]^t>>>8;i=t},d:function(){return~i}}},tkt=function(i,e,t,n,r){if(!r&&(r={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),a=new Kb(o.length+i.length);a.set(o),a.set(i,o.length),i=a,r.w=o.length}return ZPt(i,e.level==null?6:e.level,e.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(i.length)))*1.5):20:12+e.mem,t,n,r)},_ie=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8},nkt=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&&_ie(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)}},ikt=function(i){return 10+(i.filename?i.filename.length+1:0)};function dNe(i,e){e||(e={});var t=ekt(),n=i.length;t.p(i);var r=tkt(i,e,ikt(e),8),o=r.length;return nkt(r,e),_ie(r,o-8,t.d()),_ie(r,o-4,n),r}var ANe=typeof TextEncoder<"u"&&new TextEncoder,rkt=typeof TextDecoder<"u"&&new TextDecoder,okt=0;try{rkt.decode(uNe,{stream:!0}),okt=1}catch{}function fNe(i,e){var t;if(ANe)return ANe.encode(i);for(var n=i.length,r=new Kb(i.length+(i.length>>1)),o=0,a=function(c){r[o++]=c},t=0;t<n;++t){if(o+5>r.length){var s=new Kb(o+8+(n-t<<1));s.set(r),r=s}var l=i.charCodeAt(t);l<128||e?a(l):l<2048?(a(192|l>>6),a(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|i.charCodeAt(++t)&1023,a(240|l>>18),a(128|l>>12&63),a(128|l>>6&63),a(128|l&63)):(a(224|l>>12),a(128|l>>6&63),a(128|l&63))}return aNe(r,0,o)}function akt(i,e){const t=JSON.stringify(i),n=dNe(fNe(t)),r=jPt(n);return`${window.location.origin}/editor?#data:application/gzip;base64,${r}`}function ip(...i){return b6t(PB(i))}const hNe=i=>i.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),Iie=JTt,CG=rt.forwardRef(({className:i,...e},t)=>je.jsx(RQe,{ref:t,className:ip("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}));CG.displayName=RQe.displayName;const zB=rt.forwardRef(({className:i,...e},t)=>je.jsx(DQe,{ref:t,className:ip("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}));zB.displayName=DQe.displayName;const C2=rt.forwardRef(({className:i,...e},t)=>je.jsx(NQe,{ref:t,className:ip("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}));C2.displayName=NQe.displayName;/**
897
897
  * @license
898
898
  * Copyright 2010-2024 Three.js Authors
899
899
  * SPDX-License-Identifier: MIT
@@ -13245,12 +13245,12 @@ ${l.join(`
13245
13245
  `)},_$e=function(){var i=parseInt(document.body.getAttribute(gD)||"0",10);return isFinite(i)?i:0},U0n=function(){rt.useEffect(function(){return document.body.setAttribute(gD,(_$e()+1).toString()),function(){var i=_$e()-1;i<=0?document.body.removeAttribute(gD):document.body.setAttribute(gD,i.toString())}},[])},G0n=function(i){var e=i.noRelative,t=i.noImportant,n=i.gapMode,r=n===void 0?"margin":n;U0n();var o=rt.useMemo(function(){return k0n(r)},[r]);return rt.createElement(L0n,{styles:F0n(o,!e,r,t?"":"!important")})},sge=!1;if(typeof window<"u")try{var qY=Object.defineProperty({},"passive",{get:function(){return sge=!0,!0}});window.addEventListener("test",qY,qY),window.removeEventListener("test",qY,qY)}catch{sge=!1}var mD=sge?{passive:!1}:!1,O0n=function(i){return i.tagName==="TEXTAREA"},I$e=function(i,e){if(!(i instanceof Element))return!1;var t=window.getComputedStyle(i);return t[e]!=="hidden"&&!(t.overflowY===t.overflowX&&!O0n(i)&&t[e]==="visible")},z0n=function(i){return I$e(i,"overflowY")},H0n=function(i){return I$e(i,"overflowX")},C$e=function(i,e){var t=e.ownerDocument,n=e;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=x$e(i,n);if(r){var o=E$e(i,n),a=o[1],s=o[2];if(a>s)return!0}n=n.parentNode}while(n&&n!==t.body);return!1},Y0n=function(i){var e=i.scrollTop,t=i.scrollHeight,n=i.clientHeight;return[e,t,n]},V0n=function(i){var e=i.scrollLeft,t=i.scrollWidth,n=i.clientWidth;return[e,t,n]},x$e=function(i,e){return i==="v"?z0n(e):H0n(e)},E$e=function(i,e){return i==="v"?Y0n(e):V0n(e)},j0n=function(i,e){return i==="h"&&e==="rtl"?-1:1},K0n=function(i,e,t,n,r){var o=j0n(i,window.getComputedStyle(e).direction),a=o*n,s=t.target,l=e.contains(s),c=!1,u=a>0,d=0,f=0;do{if(!s)break;var h=E$e(i,s),g=h[0],y=h[1],v=h[2],_=y-v-o*g;(g||_)&&x$e(i,s)&&(d+=_,f+=g);var x=s.parentNode;s=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!l&&s!==document.body||l&&(e.contains(s)||e===s));return(u&&Math.abs(d)<1||!u&&Math.abs(f)<1)&&(c=!0),c},XY=function(i){return"changedTouches"in i?[i.changedTouches[0].clientX,i.changedTouches[0].clientY]:[0,0]},b$e=function(i){return[i.deltaX,i.deltaY]},B$e=function(i){return i&&"current"in i?i.current:i},J0n=function(i,e){return i[0]===e[0]&&i[1]===e[1]},W0n=function(i){return`
13246
13246
  .block-interactivity-`.concat(i,` {pointer-events: none;}
13247
13247
  .allow-interactivity-`).concat(i,` {pointer-events: all;}
13248
- `)},q0n=0,yD=[];function X0n(i){var e=rt.useRef([]),t=rt.useRef([0,0]),n=rt.useRef(),r=rt.useState(q0n++)[0],o=rt.useState(v$e)[0],a=rt.useRef(i);rt.useEffect(function(){a.current=i},[i]),rt.useEffect(function(){if(i.inert){document.body.classList.add("block-interactivity-".concat(r));var y=y0n([i.lockRef.current],(i.shards||[]).map(B$e),!0).filter(Boolean);return y.forEach(function(v){return v.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),y.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(r))})}}},[i.inert,i.lockRef.current,i.shards]);var s=rt.useCallback(function(y,v){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!a.current.allowPinchZoom;var _=XY(y),x=t.current,S="deltaX"in y?y.deltaX:x[0]-_[0],M="deltaY"in y?y.deltaY:x[1]-_[1],z,U=y.target,H=Math.abs(S)>Math.abs(M)?"h":"v";if("touches"in y&&H==="h"&&U.type==="range")return!1;var k=C$e(H,U);if(!k)return!0;if(k?z=H:(z=H==="v"?"h":"v",k=C$e(H,U)),!k)return!1;if(!n.current&&"changedTouches"in y&&(S||M)&&(n.current=z),!z)return!0;var j=n.current||z;return K0n(j,v,y,j==="h"?S:M)},[]),l=rt.useCallback(function(y){var v=y;if(!(!yD.length||yD[yD.length-1]!==o)){var _="deltaY"in v?b$e(v):XY(v),x=e.current.filter(function(z){return z.name===v.type&&(z.target===v.target||v.target===z.shadowParent)&&J0n(z.delta,_)})[0];if(x&&x.should){v.cancelable&&v.preventDefault();return}if(!x){var S=(a.current.shards||[]).map(B$e).filter(Boolean).filter(function(z){return z.contains(v.target)}),M=S.length>0?s(v,S[0]):!a.current.noIsolation;M&&v.cancelable&&v.preventDefault()}}},[]),c=rt.useCallback(function(y,v,_,x){var S={name:y,delta:v,target:_,should:x,shadowParent:Z0n(_)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(M){return M!==S})},1)},[]),u=rt.useCallback(function(y){t.current=XY(y),n.current=void 0},[]),d=rt.useCallback(function(y){c(y.type,b$e(y),y.target,s(y,i.lockRef.current))},[]),f=rt.useCallback(function(y){c(y.type,XY(y),y.target,s(y,i.lockRef.current))},[]);rt.useEffect(function(){return yD.push(o),i.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,mD),document.addEventListener("touchmove",l,mD),document.addEventListener("touchstart",u,mD),function(){yD=yD.filter(function(y){return y!==o}),document.removeEventListener("wheel",l,mD),document.removeEventListener("touchmove",l,mD),document.removeEventListener("touchstart",u,mD)}},[]);var h=i.removeScrollBar,g=i.inert;return rt.createElement(rt.Fragment,null,g?rt.createElement(o,{styles:W0n(r)}):null,h?rt.createElement(G0n,{noRelative:i.noRelative,gapMode:i.gapMode}):null)}function Z0n(i){for(var e=null;i!==null;)i instanceof ShadowRoot&&(e=i.host,i=i.host),i=i.parentNode;return e}const $0n=S0n(y$e,X0n);var ZY=rt.forwardRef(function(i,e){return rt.createElement(WY,hS({},i,{ref:e,sideCar:$0n}))});ZY.classNames=WY.classNames;var lge=["Enter"," "],egn=["ArrowDown","PageUp","Home"],S$e=["ArrowUp","PageDown","End"],tgn=[...egn,...S$e],ngn={ltr:[...lge,"ArrowRight"],rtl:[...lge,"ArrowLeft"]},ign={ltr:["ArrowLeft"],rtl:["ArrowRight"]},o7="Menu",[a7,rgn,ogn]=dQe(o7),[IM,w$e]=NB(o7,[ogn,HY,kU]),s7=HY(),M$e=kU(),[Q$e,t3]=IM(o7),[agn,l7]=IM(o7),R$e=i=>{const{__scopeMenu:e,open:t=!1,children:n,dir:r,onOpenChange:o,modal:a=!0}=i,s=s7(e),[l,c]=rt.useState(null),u=rt.useRef(!1),d=TB(o),f=tne(r);return rt.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),je.jsx(ege,{...s,children:je.jsx(Q$e,{scope:e,open:t,onOpenChange:d,content:l,onContentChange:c,children:je.jsx(agn,{scope:e,onClose:rt.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:a,children:n})})})};R$e.displayName=o7;var sgn="MenuAnchor",cge=rt.forwardRef((i,e)=>{const{__scopeMenu:t,...n}=i,r=s7(t);return je.jsx(tge,{...r,...n,ref:e})});cge.displayName=sgn;var uge="MenuPortal",[lgn,D$e]=IM(uge,{forceMount:void 0}),N$e=i=>{const{__scopeMenu:e,forceMount:t,children:n,container:r}=i,o=t3(uge,e);return je.jsx(lgn,{scope:e,forceMount:t,children:je.jsx(y2,{present:t||o.open,children:je.jsx(YY,{asChild:!0,container:r,children:n})})})};N$e.displayName=uge;var T2="MenuContent",[cgn,dge]=IM(T2),T$e=rt.forwardRef((i,e)=>{const t=D$e(T2,i.__scopeMenu),{forceMount:n=t.forceMount,...r}=i,o=t3(T2,i.__scopeMenu),a=l7(T2,i.__scopeMenu);return je.jsx(a7.Provider,{scope:i.__scopeMenu,children:je.jsx(y2,{present:n||o.open,children:je.jsx(a7.Slot,{scope:i.__scopeMenu,children:a.modal?je.jsx(ugn,{...r,ref:e}):je.jsx(dgn,{...r,ref:e})})})})}),ugn=rt.forwardRef((i,e)=>{const t=t3(T2,i.__scopeMenu),n=rt.useRef(null),r=_C(e,n);return rt.useEffect(()=>{const o=n.current;if(o)return ige(o)},[]),je.jsx(Age,{...i,ref:r,trapFocus:t.open,disableOutsidePointerEvents:t.open,disableOutsideScroll:!0,onFocusOutside:Fp(i.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>t.onOpenChange(!1)})}),dgn=rt.forwardRef((i,e)=>{const t=t3(T2,i.__scopeMenu);return je.jsx(Age,{...i,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>t.onOpenChange(!1)})}),Agn=e4("MenuContent.ScrollLock"),Age=rt.forwardRef((i,e)=>{const{__scopeMenu:t,loop:n=!1,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,disableOutsideScroll:g,...y}=i,v=t3(T2,t),_=l7(T2,t),x=s7(t),S=M$e(t),M=rgn(t),[z,U]=rt.useState(null),H=rt.useRef(null),k=_C(e,H,v.onContentChange),j=rt.useRef(0),G=rt.useRef(""),ee=rt.useRef(0),K=rt.useRef(null),ie=rt.useRef("right"),ce=rt.useRef(0),ue=g?ZY:rt.Fragment,le=g?{as:Agn,allowPinchZoom:!0}:void 0,_e=Qe=>{var Rt,pt;const Me=G.current+Qe,Te=M().filter(Fe=>!Fe.disabled),Ee=document.activeElement,Ge=(Rt=Te.find(Fe=>Fe.ref.current===Ee))==null?void 0:Rt.textValue,Ke=Te.map(Fe=>Fe.textValue),nt=Egn(Ke,Me,Ge),lt=(pt=Te.find(Fe=>Fe.textValue===nt))==null?void 0:pt.ref.current;(function Fe(We){G.current=We,window.clearTimeout(j.current),We!==""&&(j.current=window.setTimeout(()=>Fe(""),1e3))})(Me),lt&&setTimeout(()=>lt.focus())};rt.useEffect(()=>()=>window.clearTimeout(j.current),[]),L0e();const ye=rt.useCallback(Qe=>{var Te,Ee;return ie.current===((Te=K.current)==null?void 0:Te.side)&&Bgn(Qe,(Ee=K.current)==null?void 0:Ee.area)},[]);return je.jsx(cgn,{scope:t,searchRef:G,onItemEnter:rt.useCallback(Qe=>{ye(Qe)&&Qe.preventDefault()},[ye]),onItemLeave:rt.useCallback(Qe=>{var Me;ye(Qe)||((Me=H.current)==null||Me.focus(),U(null))},[ye]),onTriggerLeave:rt.useCallback(Qe=>{ye(Qe)&&Qe.preventDefault()},[ye]),pointerGraceTimerRef:ee,onPointerGraceIntentChange:rt.useCallback(Qe=>{K.current=Qe},[]),children:je.jsx(ue,{...le,children:je.jsx(NY,{asChild:!0,trapped:r,onMountAutoFocus:Fp(o,Qe=>{var Me;Qe.preventDefault(),(Me=H.current)==null||Me.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:je.jsx(DY,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,children:je.jsx(vQe,{asChild:!0,...S,dir:_.dir,orientation:"vertical",loop:n,currentTabStopId:z,onCurrentTabStopIdChange:U,onEntryFocus:Fp(l,Qe=>{_.isUsingKeyboardRef.current||Qe.preventDefault()}),preventScrollOnEntryFocus:!0,children:je.jsx(A$e,{role:"menu","aria-orientation":"vertical","data-state":Z$e(v.open),"data-radix-menu-content":"",dir:_.dir,...x,...y,ref:k,style:{outline:"none",...y.style},onKeyDown:Fp(y.onKeyDown,Qe=>{const Te=Qe.target.closest("[data-radix-menu-content]")===Qe.currentTarget,Ee=Qe.ctrlKey||Qe.altKey||Qe.metaKey,Ge=Qe.key.length===1;Te&&(Qe.key==="Tab"&&Qe.preventDefault(),!Ee&&Ge&&_e(Qe.key));const Ke=H.current;if(Qe.target!==Ke||!tgn.includes(Qe.key))return;Qe.preventDefault();const lt=M().filter(Rt=>!Rt.disabled).map(Rt=>Rt.ref.current);S$e.includes(Qe.key)&&lt.reverse(),Cgn(lt)}),onBlur:Fp(i.onBlur,Qe=>{Qe.currentTarget.contains(Qe.target)||(window.clearTimeout(j.current),G.current="")}),onPointerMove:Fp(i.onPointerMove,u7(Qe=>{const Me=Qe.target,Te=ce.current!==Qe.clientX;if(Qe.currentTarget.contains(Me)&&Te){const Ee=Qe.clientX>ce.current?"right":"left";ie.current=Ee,ce.current=Qe.clientX}}))})})})})})})});T$e.displayName=T2;var fgn="MenuGroup",fge=rt.forwardRef((i,e)=>{const{__scopeMenu:t,...n}=i;return je.jsx(_y.div,{role:"group",...n,ref:e})});fge.displayName=fgn;var hgn="MenuLabel",P$e=rt.forwardRef((i,e)=>{const{__scopeMenu:t,...n}=i;return je.jsx(_y.div,{...n,ref:e})});P$e.displayName=hgn;var $Y="MenuItem",k$e="menu.itemSelect",eV=rt.forwardRef((i,e)=>{const{disabled:t=!1,onSelect:n,...r}=i,o=rt.useRef(null),a=l7($Y,i.__scopeMenu),s=dge($Y,i.__scopeMenu),l=_C(e,o),c=rt.useRef(!1),u=()=>{const d=o.current;if(!t&&d){const f=new CustomEvent(k$e,{bubbles:!0,cancelable:!0});d.addEventListener(k$e,h=>n==null?void 0:n(h),{once:!0}),fQe(d,f),f.defaultPrevented?c.current=!1:a.onClose()}};return je.jsx(L$e,{...r,ref:l,disabled:t,onClick:Fp(i.onClick,u),onPointerDown:d=>{var f;(f=i.onPointerDown)==null||f.call(i,d),c.current=!0},onPointerUp:Fp(i.onPointerUp,d=>{var f;c.current||(f=d.currentTarget)==null||f.click()}),onKeyDown:Fp(i.onKeyDown,d=>{const f=s.searchRef.current!=="";t||f&&d.key===" "||lge.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});eV.displayName=$Y;var L$e=rt.forwardRef((i,e)=>{const{__scopeMenu:t,disabled:n=!1,textValue:r,...o}=i,a=dge($Y,t),s=M$e(t),l=rt.useRef(null),c=_C(e,l),[u,d]=rt.useState(!1),[f,h]=rt.useState("");return rt.useEffect(()=>{const g=l.current;g&&h((g.textContent??"").trim())},[o.children]),je.jsx(a7.ItemSlot,{scope:t,disabled:n,textValue:r??f,children:je.jsx(_Qe,{asChild:!0,...s,focusable:!n,children:je.jsx(_y.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:c,onPointerMove:Fp(i.onPointerMove,u7(g=>{n?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Fp(i.onPointerLeave,u7(g=>a.onItemLeave(g))),onFocus:Fp(i.onFocus,()=>d(!0)),onBlur:Fp(i.onBlur,()=>d(!1))})})})}),pgn="MenuCheckboxItem",F$e=rt.forwardRef((i,e)=>{const{checked:t=!1,onCheckedChange:n,...r}=i;return je.jsx(H$e,{scope:i.__scopeMenu,checked:t,children:je.jsx(eV,{role:"menuitemcheckbox","aria-checked":tV(t)?"mixed":t,...r,ref:e,"data-state":gge(t),onSelect:Fp(r.onSelect,()=>n==null?void 0:n(tV(t)?!0:!t),{checkForDefaultPrevented:!1})})})});F$e.displayName=pgn;var U$e="MenuRadioGroup",[ggn,mgn]=IM(U$e,{value:void 0,onValueChange:()=>{}}),G$e=rt.forwardRef((i,e)=>{const{value:t,onValueChange:n,...r}=i,o=TB(n);return je.jsx(ggn,{scope:i.__scopeMenu,value:t,onValueChange:o,children:je.jsx(fge,{...r,ref:e})})});G$e.displayName=U$e;var O$e="MenuRadioItem",z$e=rt.forwardRef((i,e)=>{const{value:t,...n}=i,r=mgn(O$e,i.__scopeMenu),o=t===r.value;return je.jsx(H$e,{scope:i.__scopeMenu,checked:o,children:je.jsx(eV,{role:"menuitemradio","aria-checked":o,...n,ref:e,"data-state":gge(o),onSelect:Fp(n.onSelect,()=>{var a;return(a=r.onValueChange)==null?void 0:a.call(r,t)},{checkForDefaultPrevented:!1})})})});z$e.displayName=O$e;var hge="MenuItemIndicator",[H$e,ygn]=IM(hge,{checked:!1}),Y$e=rt.forwardRef((i,e)=>{const{__scopeMenu:t,forceMount:n,...r}=i,o=ygn(hge,t);return je.jsx(y2,{present:n||tV(o.checked)||o.checked===!0,children:je.jsx(_y.span,{...r,ref:e,"data-state":gge(o.checked)})})});Y$e.displayName=hge;var vgn="MenuSeparator",V$e=rt.forwardRef((i,e)=>{const{__scopeMenu:t,...n}=i;return je.jsx(_y.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});V$e.displayName=vgn;var _gn="MenuArrow",j$e=rt.forwardRef((i,e)=>{const{__scopeMenu:t,...n}=i,r=s7(t);return je.jsx(f$e,{...r,...n,ref:e})});j$e.displayName=_gn;var pge="MenuSub",[Ign,K$e]=IM(pge),J$e=i=>{const{__scopeMenu:e,children:t,open:n=!1,onOpenChange:r}=i,o=t3(pge,e),a=s7(e),[s,l]=rt.useState(null),[c,u]=rt.useState(null),d=TB(r);return rt.useEffect(()=>(o.open===!1&&d(!1),()=>d(!1)),[o.open,d]),je.jsx(ege,{...a,children:je.jsx(Q$e,{scope:e,open:n,onOpenChange:d,content:c,onContentChange:u,children:je.jsx(Ign,{scope:e,contentId:dE(),triggerId:dE(),trigger:s,onTriggerChange:l,children:t})})})};J$e.displayName=pge;var c7="MenuSubTrigger",W$e=rt.forwardRef((i,e)=>{const t=t3(c7,i.__scopeMenu),n=l7(c7,i.__scopeMenu),r=K$e(c7,i.__scopeMenu),o=dge(c7,i.__scopeMenu),a=rt.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=o,c={__scopeMenu:i.__scopeMenu},u=rt.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return rt.useEffect(()=>u,[u]),rt.useEffect(()=>{const d=s.current;return()=>{window.clearTimeout(d),l(null)}},[s,l]),je.jsx(cge,{asChild:!0,...c,children:je.jsx(L$e,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":t.open,"aria-controls":r.contentId,"data-state":Z$e(t.open),...i,ref:jS(e,r.onTriggerChange),onClick:d=>{var f;(f=i.onClick)==null||f.call(i,d),!(i.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),t.open||t.onOpenChange(!0))},onPointerMove:Fp(i.onPointerMove,u7(d=>{o.onItemEnter(d),!d.defaultPrevented&&!i.disabled&&!t.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{t.onOpenChange(!0),u()},100))})),onPointerLeave:Fp(i.onPointerLeave,u7(d=>{var h,g;u();const f=(h=t.content)==null?void 0:h.getBoundingClientRect();if(f){const y=(g=t.content)==null?void 0:g.dataset.side,v=y==="right",_=v?-5:5,x=f[v?"left":"right"],S=f[v?"right":"left"];o.onPointerGraceIntentChange({area:[{x:d.clientX+_,y:d.clientY},{x,y:f.top},{x:S,y:f.top},{x:S,y:f.bottom},{x,y:f.bottom}],side:y}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(d),d.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Fp(i.onKeyDown,d=>{var h;const f=o.searchRef.current!=="";i.disabled||f&&d.key===" "||ngn[n.dir].includes(d.key)&&(t.onOpenChange(!0),(h=t.content)==null||h.focus(),d.preventDefault())})})})});W$e.displayName=c7;var q$e="MenuSubContent",X$e=rt.forwardRef((i,e)=>{const t=D$e(T2,i.__scopeMenu),{forceMount:n=t.forceMount,...r}=i,o=t3(T2,i.__scopeMenu),a=l7(T2,i.__scopeMenu),s=K$e(q$e,i.__scopeMenu),l=rt.useRef(null),c=_C(e,l);return je.jsx(a7.Provider,{scope:i.__scopeMenu,children:je.jsx(y2,{present:n||o.open,children:je.jsx(a7.Slot,{scope:i.__scopeMenu,children:je.jsx(Age,{id:s.contentId,"aria-labelledby":s.triggerId,...r,ref:c,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;a.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Fp(i.onFocusOutside,u=>{u.target!==s.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Fp(i.onEscapeKeyDown,u=>{a.onClose(),u.preventDefault()}),onKeyDown:Fp(i.onKeyDown,u=>{var h;const d=u.currentTarget.contains(u.target),f=ign[a.dir].includes(u.key);d&&f&&(o.onOpenChange(!1),(h=s.trigger)==null||h.focus(),u.preventDefault())})})})})})});X$e.displayName=q$e;function Z$e(i){return i?"open":"closed"}function tV(i){return i==="indeterminate"}function gge(i){return tV(i)?"indeterminate":i?"checked":"unchecked"}function Cgn(i){const e=document.activeElement;for(const t of i)if(t===e||(t.focus(),document.activeElement!==e))return}function xgn(i,e){return i.map((t,n)=>i[(e+n)%i.length])}function Egn(i,e,t){const r=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,o=t?i.indexOf(t):-1;let a=xgn(i,Math.max(o,0));r.length===1&&(a=a.filter(c=>c!==t));const l=a.find(c=>c.toLowerCase().startsWith(r.toLowerCase()));return l!==t?l:void 0}function bgn(i,e){const{x:t,y:n}=i;let r=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){const s=e[o],l=e[a],c=s.x,u=s.y,d=l.x,f=l.y;u>n!=f>n&&t<(d-c)*(n-u)/(f-u)+c&&(r=!r)}return r}function Bgn(i,e){if(!e)return!1;const t={x:i.clientX,y:i.clientY};return bgn(t,e)}function u7(i){return e=>e.pointerType==="mouse"?i(e):void 0}var Sgn=R$e,wgn=cge,Mgn=N$e,Qgn=T$e,Rgn=fge,Dgn=P$e,Ngn=eV,Tgn=F$e,Pgn=G$e,kgn=z$e,Lgn=Y$e,Fgn=V$e,Ugn=j$e,Ggn=J$e,Ogn=W$e,zgn=X$e,nV="DropdownMenu",[Hgn,nXn]=NB(nV,[w$e]),bE=w$e(),[Ygn,$$e]=Hgn(nV),eet=i=>{const{__scopeDropdownMenu:e,children:t,dir:n,open:r,defaultOpen:o,onOpenChange:a,modal:s=!0}=i,l=bE(e),c=rt.useRef(null),[u,d]=t4({prop:r,defaultProp:o??!1,onChange:a,caller:nV});return je.jsx(Ygn,{scope:e,triggerId:dE(),triggerRef:c,contentId:dE(),open:u,onOpenChange:d,onOpenToggle:rt.useCallback(()=>d(f=>!f),[d]),modal:s,children:je.jsx(Sgn,{...l,open:u,onOpenChange:d,dir:n,modal:s,children:t})})};eet.displayName=nV;var tet="DropdownMenuTrigger",net=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,disabled:n=!1,...r}=i,o=$$e(tet,t),a=bE(t);return je.jsx(wgn,{asChild:!0,...a,children:je.jsx(_y.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...r,ref:jS(e,o.triggerRef),onPointerDown:Fp(i.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(o.onOpenToggle(),o.open||s.preventDefault())}),onKeyDown:Fp(i.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&o.onOpenToggle(),s.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});net.displayName=tet;var Vgn="DropdownMenuPortal",iet=i=>{const{__scopeDropdownMenu:e,...t}=i,n=bE(e);return je.jsx(Mgn,{...n,...t})};iet.displayName=Vgn;var ret="DropdownMenuContent",oet=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=$$e(ret,t),o=bE(t),a=rt.useRef(!1);return je.jsx(Qgn,{id:r.contentId,"aria-labelledby":r.triggerId,...o,...n,ref:e,onCloseAutoFocus:Fp(i.onCloseAutoFocus,s=>{var l;a.current||(l=r.triggerRef.current)==null||l.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:Fp(i.onInteractOutside,s=>{const l=s.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!r.modal||u)&&(a.current=!0)}),style:{...i.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});oet.displayName=ret;var jgn="DropdownMenuGroup",Kgn=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Rgn,{...r,...n,ref:e})});Kgn.displayName=jgn;var Jgn="DropdownMenuLabel",aet=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Dgn,{...r,...n,ref:e})});aet.displayName=Jgn;var Wgn="DropdownMenuItem",set=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Ngn,{...r,...n,ref:e})});set.displayName=Wgn;var qgn="DropdownMenuCheckboxItem",cet=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Tgn,{...r,...n,ref:e})});cet.displayName=qgn;var Xgn="DropdownMenuRadioGroup",Zgn=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Pgn,{...r,...n,ref:e})});Zgn.displayName=Xgn;var $gn="DropdownMenuRadioItem",uet=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(kgn,{...r,...n,ref:e})});uet.displayName=$gn;var emn="DropdownMenuItemIndicator",det=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Lgn,{...r,...n,ref:e})});det.displayName=emn;var tmn="DropdownMenuSeparator",Aet=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Fgn,{...r,...n,ref:e})});Aet.displayName=tmn;var nmn="DropdownMenuArrow",imn=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Ugn,{...r,...n,ref:e})});imn.displayName=nmn;var rmn=i=>{const{__scopeDropdownMenu:e,children:t,open:n,onOpenChange:r,defaultOpen:o}=i,a=bE(e),[s,l]=t4({prop:n,defaultProp:o??!1,onChange:r,caller:"DropdownMenuSub"});return je.jsx(Ggn,{...a,open:s,onOpenChange:l,children:t})},omn="DropdownMenuSubTrigger",fet=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Ogn,{...r,...n,ref:e})});fet.displayName=omn;var amn="DropdownMenuSubContent",het=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(zgn,{...r,...n,ref:e,style:{...i.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});het.displayName=amn;var smn=eet,lmn=net,pet=iet,get=oet,met=aet,yet=set,vet=cet,_et=uet,Iet=det,Cet=Aet,cmn=rmn,xet=fet,Eet=het;const mge=smn,yge=lmn,bet=pet,Bet=cmn,vge=rt.forwardRef(({className:i,inset:e,children:t,...n},r)=>je.jsxs(xet,{ref:r,className:ip("rf-flex rf-cursor-default rf-gap-2 rf-select-none rf-items-center rf-rounded-sm rf-px-2 rf-py-1.5 rf-text-sm rf-outline-none focus:rf-bg-zinc-100 data-[state=open]:rf-bg-zinc-100 [&_svg]:rf-pointer-events-none [&_svg]:rf-size-4 [&_svg]:rf-shrink-0 dark:focus:rf-bg-zinc-800 dark:data-[state=open]:rf-bg-zinc-800",e&&"rf-pl-8",i),...n,children:[t,je.jsx(D0e,{className:"rf-ml-auto"})]}));vge.displayName=xet.displayName;const _ge=rt.forwardRef(({className:i,...e},t)=>je.jsx(Eet,{ref:t,className:ip("rf-z-50 rf-min-w-[8rem] rf-overflow-hidden rf-rounded-md rf-border rf-border-zinc-200 rf-bg-white rf-p-1 rf-text-zinc-950 rf-shadow-lg data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[side=bottom]:rf-slide-in-from-top-2 data-[side=left]:rf-slide-in-from-right-2 data-[side=right]:rf-slide-in-from-left-2 data-[side=top]:rf-slide-in-from-bottom-2 dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:rf-text-zinc-50",i),...e}));_ge.displayName=Eet.displayName;const iV=rt.forwardRef(({className:i,sideOffset:e=4,...t},n)=>je.jsx(pet,{children:je.jsx(get,{ref:n,sideOffset:e,className:ip("rf-z-50 rf-min-w-[8rem] rf-overflow-hidden rf-rounded-md rf-border rf-border-zinc-200 rf-bg-white rf-p-1 rf-text-zinc-950 rf-shadow-md dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:rf-text-zinc-50","data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[side=bottom]:rf-slide-in-from-top-2 data-[side=left]:rf-slide-in-from-right-2 data-[side=right]:rf-slide-in-from-left-2 data-[side=top]:rf-slide-in-from-bottom-2",i),...t})}));iV.displayName=get.displayName;const i2=rt.forwardRef(({className:i,inset:e,...t},n)=>je.jsx(yet,{ref:n,className:ip("rf-relative rf-flex rf-cursor-default rf-select-none rf-items-center rf-gap-2 rf-rounded-sm rf-px-2 rf-py-1.5 rf-text-sm rf-outline-none rf-transition-colors focus:rf-bg-zinc-100 focus:rf-text-zinc-900 data-[disabled]:rf-pointer-events-none data-[disabled]:rf-opacity-50 [&>svg]:rf-size-4 [&>svg]:rf-shrink-0 dark:focus:rf-bg-zinc-800 dark:focus:rf-text-zinc-50",e&&"rf-pl-8",i),...t}));i2.displayName=yet.displayName;const umn=rt.forwardRef(({className:i,children:e,checked:t,...n},r)=>je.jsxs(vet,{ref:r,className:ip("rf-relative rf-flex rf-cursor-default rf-select-none rf-items-center rf-rounded-sm rf-py-1.5 rf-pl-8 rf-pr-2 rf-text-sm rf-outline-none rf-transition-colors focus:rf-bg-zinc-100 focus:rf-text-zinc-900 data-[disabled]:rf-pointer-events-none data-[disabled]:rf-opacity-50 dark:focus:rf-bg-zinc-800 dark:focus:rf-text-zinc-50",i),checked:t,...n,children:[je.jsx("span",{className:"rf-absolute rf-left-2 rf-flex rf-h-3.5 rf-w-3.5 rf-items-center rf-justify-center",children:je.jsx(Iet,{children:je.jsx(RY,{className:"rf-h-4 rf-w-4"})})}),e]}));umn.displayName=vet.displayName;const dmn=rt.forwardRef(({className:i,children:e,...t},n)=>je.jsxs(_et,{ref:n,className:ip("rf-relative rf-flex rf-cursor-default rf-select-none rf-items-center rf-rounded-sm rf-py-1.5 rf-pl-8 rf-pr-2 rf-text-sm rf-outline-none rf-transition-colors focus:rf-bg-zinc-100 focus:rf-text-zinc-900 data-[disabled]:rf-pointer-events-none data-[disabled]:rf-opacity-50 dark:focus:rf-bg-zinc-800 dark:focus:rf-text-zinc-50",i),...t,children:[je.jsx("span",{className:"rf-absolute rf-left-2 rf-flex rf-h-3.5 rf-w-3.5 rf-items-center rf-justify-center",children:je.jsx(Iet,{children:je.jsx(_Ze,{className:"rf-h-2 rf-w-2 rf-fill-current"})})}),e]}));dmn.displayName=_et.displayName;const Amn=rt.forwardRef(({className:i,inset:e,...t},n)=>je.jsx(met,{ref:n,className:ip("rf-px-2 rf-py-1.5 rf-text-sm rf-font-semibold",e&&"rf-pl-8",i),...t}));Amn.displayName=met.displayName;const fmn=rt.forwardRef(({className:i,...e},t)=>je.jsx(Cet,{ref:t,className:ip("rf--mx-1 rf-my-1 rf-h-px rf-bg-zinc-100 dark:rf-bg-zinc-800",i),...e}));fmn.displayName=Cet.displayName;const wet=({autoroutingLog:i,onReportAutoroutingLog:e})=>je.jsx(je.Fragment,{children:Object.keys(i??{}).length>0&&je.jsxs(mge,{children:[je.jsx(yge,{asChild:!0,children:je.jsxs(jC,{variant:"outline",children:[je.jsx(vhn,{className:"rf-w-4 rf-h-4 rf-mr-2"}),"Open Autorouting Log"]})}),je.jsx(iV,{className:"rf-w-96",children:Object.entries(i??{}).map(([t,{simpleRouteJson:n}])=>je.jsxs(i2,{className:"rf-flex rf-justify-between rf-items-center",children:[je.jsx("span",{className:"rf-truncate rf-text-xs rf-mr-2",children:t}),je.jsxs("div",{className:"rf-flex rf-gap-2",children:[je.jsxs(jC,{variant:"outline",size:"sm",onClick:r=>{r.stopPropagation();const o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),a=URL.createObjectURL(o),s=document.createElement("a");s.href=a,s.download=`${t}-autorouting.json`,s.click(),URL.revokeObjectURL(a)},children:[je.jsx(Ihn,{className:"rf-w-3 rf-h-3"}),"Download"]}),e&&je.jsxs(jC,{variant:"outline",size:"sm",onClick:r=>{r.stopPropagation(),e&&e(t,{simpleRouteJson:n})},children:[je.jsx(Qhn,{className:"rf-w-3 rf-h-3"}),"Report Bug"]})]})]},t))})]})}),hmn=({code:i,autoroutingLog:e,circuitJsonErrors:t,circuitJsonWarnings:n,fsMap:r,onReportAutoroutingLog:o,errorMessage:a,errorStack:s,circuitJson:l,evalVersion:c})=>{const u=rt.useMemo(()=>{const H=[];if(a&&H.push({type:"Execution Error",message:a,stack:s||void 0,source:"execution"}),t&&t.length>0)for(const k of t)H.push({type:k.type||"Circuit JSON Error",message:k.message||"No error message available",stack:k.stack||"",source:"circuitJson"});return H},[a,s,t]),d=rt.useMemo(()=>{if(!l||!Array.isArray(l))return;const H=l.find(k=>k.type==="source_project_metadata");return H==null?void 0:H.software_used_string},[l]),f=rt.useMemo(()=>{const H=[];if(n&&n.length>0)for(const k of n)H.push({type:k.type||"Circuit JSON Warning",message:k.message||"No warning message available",stack:k.stack||"",source:"circuitJson"});return H},[n]),[h,g]=rt.useState(0),[y,v]=rt.useState(0);if(u.length===0&&f.length===0)return je.jsxs("div",{className:"px-2",children:[je.jsx("div",{className:"rf-mt-4 rf-bg-green-50 rf-rounded-md rf-border rf-border-green-200",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-green-800 rf-mb-3",children:"No errors or warnings!"}),je.jsx("p",{className:"rf-text-sm rf-text-green-700",children:"Your code is running without any errors or warnings."})]})}),je.jsx("div",{className:"rf-mt-4",children:je.jsx(wet,{autoroutingLog:e,onReportAutoroutingLog:o})})]});const _=()=>{g(H=>Math.max(H-1,0))},x=()=>{g(H=>Math.min(H+1,u.length-1))},S=()=>{v(H=>Math.max(H-1,0))},M=()=>{v(H=>Math.min(H+1,f.length-1))},z=u[h],U=f[y];return je.jsxs(je.Fragment,{children:[je.jsxs("div",{className:"rf-w-[95%] rf-mx-auto",children:[u.length>1&&je.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2 rf-mb-2",children:[je.jsx("button",{type:"button",className:"rf-p-1 rf-rounded-sm rf-transition-colors",onClick:_,disabled:h===0,children:je.jsx(vZe,{className:"rf-h-4 rf-w-4 rf-text-red-500"})}),je.jsx("button",{type:"button",className:"rf-p-1 rf-rounded-sm rf-transition-colors",onClick:x,disabled:h===u.length-1,children:je.jsx(D0e,{className:"rf-h-4 rf-w-4 rf-text-red-500"})}),je.jsxs("span",{className:"rf-text-sm rf-text-red-600",children:[h+1," of ",u.length," errors"]})]}),z&&je.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-max-h-[500px] rf-overflow-y-auto rf-px-2",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-1",children:z.type}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600",children:z.message}),(z.stack||c||d)&&je.jsxs("details",{style:{whiteSpace:"pre-wrap"},className:"rf-text-xs rf-font-mono rf-text-red-600 rf-mt-2",children:[c&&`@tscircuit/eval@${c}
13248
+ `)},q0n=0,yD=[];function X0n(i){var e=rt.useRef([]),t=rt.useRef([0,0]),n=rt.useRef(),r=rt.useState(q0n++)[0],o=rt.useState(v$e)[0],a=rt.useRef(i);rt.useEffect(function(){a.current=i},[i]),rt.useEffect(function(){if(i.inert){document.body.classList.add("block-interactivity-".concat(r));var y=y0n([i.lockRef.current],(i.shards||[]).map(B$e),!0).filter(Boolean);return y.forEach(function(v){return v.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),y.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(r))})}}},[i.inert,i.lockRef.current,i.shards]);var s=rt.useCallback(function(y,v){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!a.current.allowPinchZoom;var _=XY(y),x=t.current,S="deltaX"in y?y.deltaX:x[0]-_[0],M="deltaY"in y?y.deltaY:x[1]-_[1],z,U=y.target,H=Math.abs(S)>Math.abs(M)?"h":"v";if("touches"in y&&H==="h"&&U.type==="range")return!1;var k=C$e(H,U);if(!k)return!0;if(k?z=H:(z=H==="v"?"h":"v",k=C$e(H,U)),!k)return!1;if(!n.current&&"changedTouches"in y&&(S||M)&&(n.current=z),!z)return!0;var j=n.current||z;return K0n(j,v,y,j==="h"?S:M)},[]),l=rt.useCallback(function(y){var v=y;if(!(!yD.length||yD[yD.length-1]!==o)){var _="deltaY"in v?b$e(v):XY(v),x=e.current.filter(function(z){return z.name===v.type&&(z.target===v.target||v.target===z.shadowParent)&&J0n(z.delta,_)})[0];if(x&&x.should){v.cancelable&&v.preventDefault();return}if(!x){var S=(a.current.shards||[]).map(B$e).filter(Boolean).filter(function(z){return z.contains(v.target)}),M=S.length>0?s(v,S[0]):!a.current.noIsolation;M&&v.cancelable&&v.preventDefault()}}},[]),c=rt.useCallback(function(y,v,_,x){var S={name:y,delta:v,target:_,should:x,shadowParent:Z0n(_)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(M){return M!==S})},1)},[]),u=rt.useCallback(function(y){t.current=XY(y),n.current=void 0},[]),d=rt.useCallback(function(y){c(y.type,b$e(y),y.target,s(y,i.lockRef.current))},[]),f=rt.useCallback(function(y){c(y.type,XY(y),y.target,s(y,i.lockRef.current))},[]);rt.useEffect(function(){return yD.push(o),i.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",l,mD),document.addEventListener("touchmove",l,mD),document.addEventListener("touchstart",u,mD),function(){yD=yD.filter(function(y){return y!==o}),document.removeEventListener("wheel",l,mD),document.removeEventListener("touchmove",l,mD),document.removeEventListener("touchstart",u,mD)}},[]);var h=i.removeScrollBar,g=i.inert;return rt.createElement(rt.Fragment,null,g?rt.createElement(o,{styles:W0n(r)}):null,h?rt.createElement(G0n,{noRelative:i.noRelative,gapMode:i.gapMode}):null)}function Z0n(i){for(var e=null;i!==null;)i instanceof ShadowRoot&&(e=i.host,i=i.host),i=i.parentNode;return e}const $0n=S0n(y$e,X0n);var ZY=rt.forwardRef(function(i,e){return rt.createElement(WY,hS({},i,{ref:e,sideCar:$0n}))});ZY.classNames=WY.classNames;var lge=["Enter"," "],egn=["ArrowDown","PageUp","Home"],S$e=["ArrowUp","PageDown","End"],tgn=[...egn,...S$e],ngn={ltr:[...lge,"ArrowRight"],rtl:[...lge,"ArrowLeft"]},ign={ltr:["ArrowLeft"],rtl:["ArrowRight"]},o7="Menu",[a7,rgn,ogn]=dQe(o7),[IM,w$e]=NB(o7,[ogn,HY,kU]),s7=HY(),M$e=kU(),[Q$e,t3]=IM(o7),[agn,l7]=IM(o7),R$e=i=>{const{__scopeMenu:e,open:t=!1,children:n,dir:r,onOpenChange:o,modal:a=!0}=i,s=s7(e),[l,c]=rt.useState(null),u=rt.useRef(!1),d=TB(o),f=tne(r);return rt.useEffect(()=>{const h=()=>{u.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>u.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),je.jsx(ege,{...s,children:je.jsx(Q$e,{scope:e,open:t,onOpenChange:d,content:l,onContentChange:c,children:je.jsx(agn,{scope:e,onClose:rt.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:a,children:n})})})};R$e.displayName=o7;var sgn="MenuAnchor",cge=rt.forwardRef((i,e)=>{const{__scopeMenu:t,...n}=i,r=s7(t);return je.jsx(tge,{...r,...n,ref:e})});cge.displayName=sgn;var uge="MenuPortal",[lgn,D$e]=IM(uge,{forceMount:void 0}),N$e=i=>{const{__scopeMenu:e,forceMount:t,children:n,container:r}=i,o=t3(uge,e);return je.jsx(lgn,{scope:e,forceMount:t,children:je.jsx(y2,{present:t||o.open,children:je.jsx(YY,{asChild:!0,container:r,children:n})})})};N$e.displayName=uge;var T2="MenuContent",[cgn,dge]=IM(T2),T$e=rt.forwardRef((i,e)=>{const t=D$e(T2,i.__scopeMenu),{forceMount:n=t.forceMount,...r}=i,o=t3(T2,i.__scopeMenu),a=l7(T2,i.__scopeMenu);return je.jsx(a7.Provider,{scope:i.__scopeMenu,children:je.jsx(y2,{present:n||o.open,children:je.jsx(a7.Slot,{scope:i.__scopeMenu,children:a.modal?je.jsx(ugn,{...r,ref:e}):je.jsx(dgn,{...r,ref:e})})})})}),ugn=rt.forwardRef((i,e)=>{const t=t3(T2,i.__scopeMenu),n=rt.useRef(null),r=_C(e,n);return rt.useEffect(()=>{const o=n.current;if(o)return ige(o)},[]),je.jsx(Age,{...i,ref:r,trapFocus:t.open,disableOutsidePointerEvents:t.open,disableOutsideScroll:!0,onFocusOutside:Fp(i.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>t.onOpenChange(!1)})}),dgn=rt.forwardRef((i,e)=>{const t=t3(T2,i.__scopeMenu);return je.jsx(Age,{...i,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>t.onOpenChange(!1)})}),Agn=e4("MenuContent.ScrollLock"),Age=rt.forwardRef((i,e)=>{const{__scopeMenu:t,loop:n=!1,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,disableOutsideScroll:g,...y}=i,v=t3(T2,t),_=l7(T2,t),x=s7(t),S=M$e(t),M=rgn(t),[z,U]=rt.useState(null),H=rt.useRef(null),k=_C(e,H,v.onContentChange),j=rt.useRef(0),G=rt.useRef(""),ee=rt.useRef(0),K=rt.useRef(null),ie=rt.useRef("right"),ce=rt.useRef(0),ue=g?ZY:rt.Fragment,le=g?{as:Agn,allowPinchZoom:!0}:void 0,_e=Qe=>{var Rt,pt;const Me=G.current+Qe,Te=M().filter(Fe=>!Fe.disabled),Ee=document.activeElement,Ge=(Rt=Te.find(Fe=>Fe.ref.current===Ee))==null?void 0:Rt.textValue,Ke=Te.map(Fe=>Fe.textValue),nt=Egn(Ke,Me,Ge),lt=(pt=Te.find(Fe=>Fe.textValue===nt))==null?void 0:pt.ref.current;(function Fe(We){G.current=We,window.clearTimeout(j.current),We!==""&&(j.current=window.setTimeout(()=>Fe(""),1e3))})(Me),lt&&setTimeout(()=>lt.focus())};rt.useEffect(()=>()=>window.clearTimeout(j.current),[]),L0e();const ye=rt.useCallback(Qe=>{var Te,Ee;return ie.current===((Te=K.current)==null?void 0:Te.side)&&Bgn(Qe,(Ee=K.current)==null?void 0:Ee.area)},[]);return je.jsx(cgn,{scope:t,searchRef:G,onItemEnter:rt.useCallback(Qe=>{ye(Qe)&&Qe.preventDefault()},[ye]),onItemLeave:rt.useCallback(Qe=>{var Me;ye(Qe)||((Me=H.current)==null||Me.focus(),U(null))},[ye]),onTriggerLeave:rt.useCallback(Qe=>{ye(Qe)&&Qe.preventDefault()},[ye]),pointerGraceTimerRef:ee,onPointerGraceIntentChange:rt.useCallback(Qe=>{K.current=Qe},[]),children:je.jsx(ue,{...le,children:je.jsx(NY,{asChild:!0,trapped:r,onMountAutoFocus:Fp(o,Qe=>{var Me;Qe.preventDefault(),(Me=H.current)==null||Me.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:je.jsx(DY,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:h,children:je.jsx(vQe,{asChild:!0,...S,dir:_.dir,orientation:"vertical",loop:n,currentTabStopId:z,onCurrentTabStopIdChange:U,onEntryFocus:Fp(l,Qe=>{_.isUsingKeyboardRef.current||Qe.preventDefault()}),preventScrollOnEntryFocus:!0,children:je.jsx(A$e,{role:"menu","aria-orientation":"vertical","data-state":Z$e(v.open),"data-radix-menu-content":"",dir:_.dir,...x,...y,ref:k,style:{outline:"none",...y.style},onKeyDown:Fp(y.onKeyDown,Qe=>{const Te=Qe.target.closest("[data-radix-menu-content]")===Qe.currentTarget,Ee=Qe.ctrlKey||Qe.altKey||Qe.metaKey,Ge=Qe.key.length===1;Te&&(Qe.key==="Tab"&&Qe.preventDefault(),!Ee&&Ge&&_e(Qe.key));const Ke=H.current;if(Qe.target!==Ke||!tgn.includes(Qe.key))return;Qe.preventDefault();const lt=M().filter(Rt=>!Rt.disabled).map(Rt=>Rt.ref.current);S$e.includes(Qe.key)&&lt.reverse(),Cgn(lt)}),onBlur:Fp(i.onBlur,Qe=>{Qe.currentTarget.contains(Qe.target)||(window.clearTimeout(j.current),G.current="")}),onPointerMove:Fp(i.onPointerMove,u7(Qe=>{const Me=Qe.target,Te=ce.current!==Qe.clientX;if(Qe.currentTarget.contains(Me)&&Te){const Ee=Qe.clientX>ce.current?"right":"left";ie.current=Ee,ce.current=Qe.clientX}}))})})})})})})});T$e.displayName=T2;var fgn="MenuGroup",fge=rt.forwardRef((i,e)=>{const{__scopeMenu:t,...n}=i;return je.jsx(_y.div,{role:"group",...n,ref:e})});fge.displayName=fgn;var hgn="MenuLabel",P$e=rt.forwardRef((i,e)=>{const{__scopeMenu:t,...n}=i;return je.jsx(_y.div,{...n,ref:e})});P$e.displayName=hgn;var $Y="MenuItem",k$e="menu.itemSelect",eV=rt.forwardRef((i,e)=>{const{disabled:t=!1,onSelect:n,...r}=i,o=rt.useRef(null),a=l7($Y,i.__scopeMenu),s=dge($Y,i.__scopeMenu),l=_C(e,o),c=rt.useRef(!1),u=()=>{const d=o.current;if(!t&&d){const f=new CustomEvent(k$e,{bubbles:!0,cancelable:!0});d.addEventListener(k$e,h=>n==null?void 0:n(h),{once:!0}),fQe(d,f),f.defaultPrevented?c.current=!1:a.onClose()}};return je.jsx(L$e,{...r,ref:l,disabled:t,onClick:Fp(i.onClick,u),onPointerDown:d=>{var f;(f=i.onPointerDown)==null||f.call(i,d),c.current=!0},onPointerUp:Fp(i.onPointerUp,d=>{var f;c.current||(f=d.currentTarget)==null||f.click()}),onKeyDown:Fp(i.onKeyDown,d=>{const f=s.searchRef.current!=="";t||f&&d.key===" "||lge.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});eV.displayName=$Y;var L$e=rt.forwardRef((i,e)=>{const{__scopeMenu:t,disabled:n=!1,textValue:r,...o}=i,a=dge($Y,t),s=M$e(t),l=rt.useRef(null),c=_C(e,l),[u,d]=rt.useState(!1),[f,h]=rt.useState("");return rt.useEffect(()=>{const g=l.current;g&&h((g.textContent??"").trim())},[o.children]),je.jsx(a7.ItemSlot,{scope:t,disabled:n,textValue:r??f,children:je.jsx(_Qe,{asChild:!0,...s,focusable:!n,children:je.jsx(_y.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:c,onPointerMove:Fp(i.onPointerMove,u7(g=>{n?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Fp(i.onPointerLeave,u7(g=>a.onItemLeave(g))),onFocus:Fp(i.onFocus,()=>d(!0)),onBlur:Fp(i.onBlur,()=>d(!1))})})})}),pgn="MenuCheckboxItem",F$e=rt.forwardRef((i,e)=>{const{checked:t=!1,onCheckedChange:n,...r}=i;return je.jsx(H$e,{scope:i.__scopeMenu,checked:t,children:je.jsx(eV,{role:"menuitemcheckbox","aria-checked":tV(t)?"mixed":t,...r,ref:e,"data-state":gge(t),onSelect:Fp(r.onSelect,()=>n==null?void 0:n(tV(t)?!0:!t),{checkForDefaultPrevented:!1})})})});F$e.displayName=pgn;var U$e="MenuRadioGroup",[ggn,mgn]=IM(U$e,{value:void 0,onValueChange:()=>{}}),G$e=rt.forwardRef((i,e)=>{const{value:t,onValueChange:n,...r}=i,o=TB(n);return je.jsx(ggn,{scope:i.__scopeMenu,value:t,onValueChange:o,children:je.jsx(fge,{...r,ref:e})})});G$e.displayName=U$e;var O$e="MenuRadioItem",z$e=rt.forwardRef((i,e)=>{const{value:t,...n}=i,r=mgn(O$e,i.__scopeMenu),o=t===r.value;return je.jsx(H$e,{scope:i.__scopeMenu,checked:o,children:je.jsx(eV,{role:"menuitemradio","aria-checked":o,...n,ref:e,"data-state":gge(o),onSelect:Fp(n.onSelect,()=>{var a;return(a=r.onValueChange)==null?void 0:a.call(r,t)},{checkForDefaultPrevented:!1})})})});z$e.displayName=O$e;var hge="MenuItemIndicator",[H$e,ygn]=IM(hge,{checked:!1}),Y$e=rt.forwardRef((i,e)=>{const{__scopeMenu:t,forceMount:n,...r}=i,o=ygn(hge,t);return je.jsx(y2,{present:n||tV(o.checked)||o.checked===!0,children:je.jsx(_y.span,{...r,ref:e,"data-state":gge(o.checked)})})});Y$e.displayName=hge;var vgn="MenuSeparator",V$e=rt.forwardRef((i,e)=>{const{__scopeMenu:t,...n}=i;return je.jsx(_y.div,{role:"separator","aria-orientation":"horizontal",...n,ref:e})});V$e.displayName=vgn;var _gn="MenuArrow",j$e=rt.forwardRef((i,e)=>{const{__scopeMenu:t,...n}=i,r=s7(t);return je.jsx(f$e,{...r,...n,ref:e})});j$e.displayName=_gn;var pge="MenuSub",[Ign,K$e]=IM(pge),J$e=i=>{const{__scopeMenu:e,children:t,open:n=!1,onOpenChange:r}=i,o=t3(pge,e),a=s7(e),[s,l]=rt.useState(null),[c,u]=rt.useState(null),d=TB(r);return rt.useEffect(()=>(o.open===!1&&d(!1),()=>d(!1)),[o.open,d]),je.jsx(ege,{...a,children:je.jsx(Q$e,{scope:e,open:n,onOpenChange:d,content:c,onContentChange:u,children:je.jsx(Ign,{scope:e,contentId:dE(),triggerId:dE(),trigger:s,onTriggerChange:l,children:t})})})};J$e.displayName=pge;var c7="MenuSubTrigger",W$e=rt.forwardRef((i,e)=>{const t=t3(c7,i.__scopeMenu),n=l7(c7,i.__scopeMenu),r=K$e(c7,i.__scopeMenu),o=dge(c7,i.__scopeMenu),a=rt.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=o,c={__scopeMenu:i.__scopeMenu},u=rt.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return rt.useEffect(()=>u,[u]),rt.useEffect(()=>{const d=s.current;return()=>{window.clearTimeout(d),l(null)}},[s,l]),je.jsx(cge,{asChild:!0,...c,children:je.jsx(L$e,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":t.open,"aria-controls":r.contentId,"data-state":Z$e(t.open),...i,ref:jS(e,r.onTriggerChange),onClick:d=>{var f;(f=i.onClick)==null||f.call(i,d),!(i.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),t.open||t.onOpenChange(!0))},onPointerMove:Fp(i.onPointerMove,u7(d=>{o.onItemEnter(d),!d.defaultPrevented&&!i.disabled&&!t.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{t.onOpenChange(!0),u()},100))})),onPointerLeave:Fp(i.onPointerLeave,u7(d=>{var h,g;u();const f=(h=t.content)==null?void 0:h.getBoundingClientRect();if(f){const y=(g=t.content)==null?void 0:g.dataset.side,v=y==="right",_=v?-5:5,x=f[v?"left":"right"],S=f[v?"right":"left"];o.onPointerGraceIntentChange({area:[{x:d.clientX+_,y:d.clientY},{x,y:f.top},{x:S,y:f.top},{x:S,y:f.bottom},{x,y:f.bottom}],side:y}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(d),d.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Fp(i.onKeyDown,d=>{var h;const f=o.searchRef.current!=="";i.disabled||f&&d.key===" "||ngn[n.dir].includes(d.key)&&(t.onOpenChange(!0),(h=t.content)==null||h.focus(),d.preventDefault())})})})});W$e.displayName=c7;var q$e="MenuSubContent",X$e=rt.forwardRef((i,e)=>{const t=D$e(T2,i.__scopeMenu),{forceMount:n=t.forceMount,...r}=i,o=t3(T2,i.__scopeMenu),a=l7(T2,i.__scopeMenu),s=K$e(q$e,i.__scopeMenu),l=rt.useRef(null),c=_C(e,l);return je.jsx(a7.Provider,{scope:i.__scopeMenu,children:je.jsx(y2,{present:n||o.open,children:je.jsx(a7.Slot,{scope:i.__scopeMenu,children:je.jsx(Age,{id:s.contentId,"aria-labelledby":s.triggerId,...r,ref:c,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;a.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Fp(i.onFocusOutside,u=>{u.target!==s.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Fp(i.onEscapeKeyDown,u=>{a.onClose(),u.preventDefault()}),onKeyDown:Fp(i.onKeyDown,u=>{var h;const d=u.currentTarget.contains(u.target),f=ign[a.dir].includes(u.key);d&&f&&(o.onOpenChange(!1),(h=s.trigger)==null||h.focus(),u.preventDefault())})})})})})});X$e.displayName=q$e;function Z$e(i){return i?"open":"closed"}function tV(i){return i==="indeterminate"}function gge(i){return tV(i)?"indeterminate":i?"checked":"unchecked"}function Cgn(i){const e=document.activeElement;for(const t of i)if(t===e||(t.focus(),document.activeElement!==e))return}function xgn(i,e){return i.map((t,n)=>i[(e+n)%i.length])}function Egn(i,e,t){const r=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,o=t?i.indexOf(t):-1;let a=xgn(i,Math.max(o,0));r.length===1&&(a=a.filter(c=>c!==t));const l=a.find(c=>c.toLowerCase().startsWith(r.toLowerCase()));return l!==t?l:void 0}function bgn(i,e){const{x:t,y:n}=i;let r=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){const s=e[o],l=e[a],c=s.x,u=s.y,d=l.x,f=l.y;u>n!=f>n&&t<(d-c)*(n-u)/(f-u)+c&&(r=!r)}return r}function Bgn(i,e){if(!e)return!1;const t={x:i.clientX,y:i.clientY};return bgn(t,e)}function u7(i){return e=>e.pointerType==="mouse"?i(e):void 0}var Sgn=R$e,wgn=cge,Mgn=N$e,Qgn=T$e,Rgn=fge,Dgn=P$e,Ngn=eV,Tgn=F$e,Pgn=G$e,kgn=z$e,Lgn=Y$e,Fgn=V$e,Ugn=j$e,Ggn=J$e,Ogn=W$e,zgn=X$e,nV="DropdownMenu",[Hgn,nXn]=NB(nV,[w$e]),bE=w$e(),[Ygn,$$e]=Hgn(nV),eet=i=>{const{__scopeDropdownMenu:e,children:t,dir:n,open:r,defaultOpen:o,onOpenChange:a,modal:s=!0}=i,l=bE(e),c=rt.useRef(null),[u,d]=t4({prop:r,defaultProp:o??!1,onChange:a,caller:nV});return je.jsx(Ygn,{scope:e,triggerId:dE(),triggerRef:c,contentId:dE(),open:u,onOpenChange:d,onOpenToggle:rt.useCallback(()=>d(f=>!f),[d]),modal:s,children:je.jsx(Sgn,{...l,open:u,onOpenChange:d,dir:n,modal:s,children:t})})};eet.displayName=nV;var tet="DropdownMenuTrigger",net=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,disabled:n=!1,...r}=i,o=$$e(tet,t),a=bE(t);return je.jsx(wgn,{asChild:!0,...a,children:je.jsx(_y.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...r,ref:jS(e,o.triggerRef),onPointerDown:Fp(i.onPointerDown,s=>{!n&&s.button===0&&s.ctrlKey===!1&&(o.onOpenToggle(),o.open||s.preventDefault())}),onKeyDown:Fp(i.onKeyDown,s=>{n||(["Enter"," "].includes(s.key)&&o.onOpenToggle(),s.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(s.key)&&s.preventDefault())})})})});net.displayName=tet;var Vgn="DropdownMenuPortal",iet=i=>{const{__scopeDropdownMenu:e,...t}=i,n=bE(e);return je.jsx(Mgn,{...n,...t})};iet.displayName=Vgn;var ret="DropdownMenuContent",oet=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=$$e(ret,t),o=bE(t),a=rt.useRef(!1);return je.jsx(Qgn,{id:r.contentId,"aria-labelledby":r.triggerId,...o,...n,ref:e,onCloseAutoFocus:Fp(i.onCloseAutoFocus,s=>{var l;a.current||(l=r.triggerRef.current)==null||l.focus(),a.current=!1,s.preventDefault()}),onInteractOutside:Fp(i.onInteractOutside,s=>{const l=s.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!r.modal||u)&&(a.current=!0)}),style:{...i.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});oet.displayName=ret;var jgn="DropdownMenuGroup",Kgn=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Rgn,{...r,...n,ref:e})});Kgn.displayName=jgn;var Jgn="DropdownMenuLabel",aet=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Dgn,{...r,...n,ref:e})});aet.displayName=Jgn;var Wgn="DropdownMenuItem",set=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Ngn,{...r,...n,ref:e})});set.displayName=Wgn;var qgn="DropdownMenuCheckboxItem",cet=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Tgn,{...r,...n,ref:e})});cet.displayName=qgn;var Xgn="DropdownMenuRadioGroup",Zgn=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Pgn,{...r,...n,ref:e})});Zgn.displayName=Xgn;var $gn="DropdownMenuRadioItem",uet=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(kgn,{...r,...n,ref:e})});uet.displayName=$gn;var emn="DropdownMenuItemIndicator",det=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Lgn,{...r,...n,ref:e})});det.displayName=emn;var tmn="DropdownMenuSeparator",Aet=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Fgn,{...r,...n,ref:e})});Aet.displayName=tmn;var nmn="DropdownMenuArrow",imn=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Ugn,{...r,...n,ref:e})});imn.displayName=nmn;var rmn=i=>{const{__scopeDropdownMenu:e,children:t,open:n,onOpenChange:r,defaultOpen:o}=i,a=bE(e),[s,l]=t4({prop:n,defaultProp:o??!1,onChange:r,caller:"DropdownMenuSub"});return je.jsx(Ggn,{...a,open:s,onOpenChange:l,children:t})},omn="DropdownMenuSubTrigger",fet=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(Ogn,{...r,...n,ref:e})});fet.displayName=omn;var amn="DropdownMenuSubContent",het=rt.forwardRef((i,e)=>{const{__scopeDropdownMenu:t,...n}=i,r=bE(t);return je.jsx(zgn,{...r,...n,ref:e,style:{...i.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});het.displayName=amn;var smn=eet,lmn=net,pet=iet,get=oet,met=aet,yet=set,vet=cet,_et=uet,Iet=det,Cet=Aet,cmn=rmn,xet=fet,Eet=het;const mge=smn,yge=lmn,bet=pet,Bet=cmn,vge=rt.forwardRef(({className:i,inset:e,children:t,...n},r)=>je.jsxs(xet,{ref:r,className:ip("rf-flex rf-cursor-default rf-gap-2 rf-select-none rf-items-center rf-rounded-sm rf-px-2 rf-py-1.5 rf-text-sm rf-outline-none focus:rf-bg-zinc-100 data-[state=open]:rf-bg-zinc-100 [&_svg]:rf-pointer-events-none [&_svg]:rf-size-4 [&_svg]:rf-shrink-0 dark:focus:rf-bg-zinc-800 dark:data-[state=open]:rf-bg-zinc-800",e&&"rf-pl-8",i),...n,children:[t,je.jsx(D0e,{className:"rf-ml-auto"})]}));vge.displayName=xet.displayName;const _ge=rt.forwardRef(({className:i,...e},t)=>je.jsx(Eet,{ref:t,className:ip("rf-z-50 rf-min-w-[8rem] rf-overflow-hidden rf-rounded-md rf-border rf-border-zinc-200 rf-bg-white rf-p-1 rf-text-zinc-950 rf-shadow-lg data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[side=bottom]:rf-slide-in-from-top-2 data-[side=left]:rf-slide-in-from-right-2 data-[side=right]:rf-slide-in-from-left-2 data-[side=top]:rf-slide-in-from-bottom-2 dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:rf-text-zinc-50",i),...e}));_ge.displayName=Eet.displayName;const iV=rt.forwardRef(({className:i,sideOffset:e=4,...t},n)=>je.jsx(pet,{children:je.jsx(get,{ref:n,sideOffset:e,className:ip("rf-z-50 rf-min-w-[8rem] rf-overflow-hidden rf-rounded-md rf-border rf-border-zinc-200 rf-bg-white rf-p-1 rf-text-zinc-950 rf-shadow-md dark:rf-border-zinc-800 dark:rf-bg-zinc-950 dark:rf-text-zinc-50","data-[state=open]:rf-animate-in data-[state=closed]:rf-animate-out data-[state=closed]:rf-fade-out-0 data-[state=open]:rf-fade-in-0 data-[state=closed]:rf-zoom-out-95 data-[state=open]:rf-zoom-in-95 data-[side=bottom]:rf-slide-in-from-top-2 data-[side=left]:rf-slide-in-from-right-2 data-[side=right]:rf-slide-in-from-left-2 data-[side=top]:rf-slide-in-from-bottom-2",i),...t})}));iV.displayName=get.displayName;const i2=rt.forwardRef(({className:i,inset:e,...t},n)=>je.jsx(yet,{ref:n,className:ip("rf-relative rf-flex rf-cursor-default rf-select-none rf-items-center rf-gap-2 rf-rounded-sm rf-px-2 rf-py-1.5 rf-text-sm rf-outline-none rf-transition-colors focus:rf-bg-zinc-100 focus:rf-text-zinc-900 data-[disabled]:rf-pointer-events-none data-[disabled]:rf-opacity-50 [&>svg]:rf-size-4 [&>svg]:rf-shrink-0 dark:focus:rf-bg-zinc-800 dark:focus:rf-text-zinc-50",e&&"rf-pl-8",i),...t}));i2.displayName=yet.displayName;const umn=rt.forwardRef(({className:i,children:e,checked:t,...n},r)=>je.jsxs(vet,{ref:r,className:ip("rf-relative rf-flex rf-cursor-default rf-select-none rf-items-center rf-rounded-sm rf-py-1.5 rf-pl-8 rf-pr-2 rf-text-sm rf-outline-none rf-transition-colors focus:rf-bg-zinc-100 focus:rf-text-zinc-900 data-[disabled]:rf-pointer-events-none data-[disabled]:rf-opacity-50 dark:focus:rf-bg-zinc-800 dark:focus:rf-text-zinc-50",i),checked:t,...n,children:[je.jsx("span",{className:"rf-absolute rf-left-2 rf-flex rf-h-3.5 rf-w-3.5 rf-items-center rf-justify-center",children:je.jsx(Iet,{children:je.jsx(RY,{className:"rf-h-4 rf-w-4"})})}),e]}));umn.displayName=vet.displayName;const dmn=rt.forwardRef(({className:i,children:e,...t},n)=>je.jsxs(_et,{ref:n,className:ip("rf-relative rf-flex rf-cursor-default rf-select-none rf-items-center rf-rounded-sm rf-py-1.5 rf-pl-8 rf-pr-2 rf-text-sm rf-outline-none rf-transition-colors focus:rf-bg-zinc-100 focus:rf-text-zinc-900 data-[disabled]:rf-pointer-events-none data-[disabled]:rf-opacity-50 dark:focus:rf-bg-zinc-800 dark:focus:rf-text-zinc-50",i),...t,children:[je.jsx("span",{className:"rf-absolute rf-left-2 rf-flex rf-h-3.5 rf-w-3.5 rf-items-center rf-justify-center",children:je.jsx(Iet,{children:je.jsx(_Ze,{className:"rf-h-2 rf-w-2 rf-fill-current"})})}),e]}));dmn.displayName=_et.displayName;const Amn=rt.forwardRef(({className:i,inset:e,...t},n)=>je.jsx(met,{ref:n,className:ip("rf-px-2 rf-py-1.5 rf-text-sm rf-font-semibold",e&&"rf-pl-8",i),...t}));Amn.displayName=met.displayName;const fmn=rt.forwardRef(({className:i,...e},t)=>je.jsx(Cet,{ref:t,className:ip("rf--mx-1 rf-my-1 rf-h-px rf-bg-zinc-100 dark:rf-bg-zinc-800",i),...e}));fmn.displayName=Cet.displayName;const wet=({autoroutingLog:i,onReportAutoroutingLog:e})=>je.jsx(je.Fragment,{children:Object.keys(i??{}).length>0&&je.jsxs(mge,{children:[je.jsx(yge,{asChild:!0,children:je.jsxs(jC,{variant:"outline",children:[je.jsx(vhn,{className:"rf-w-4 rf-h-4 rf-mr-2"}),"Open Autorouting Log"]})}),je.jsx(iV,{className:"rf-w-96",children:Object.entries(i??{}).map(([t,{simpleRouteJson:n}])=>je.jsxs(i2,{className:"rf-flex rf-justify-between rf-items-center",children:[je.jsx("span",{className:"rf-truncate rf-text-xs rf-mr-2",children:t}),je.jsxs("div",{className:"rf-flex rf-gap-2",children:[je.jsxs(jC,{variant:"outline",size:"sm",onClick:r=>{r.stopPropagation();const o=new Blob([JSON.stringify(n,null,2)],{type:"application/json"}),a=URL.createObjectURL(o),s=document.createElement("a");s.href=a,s.download=`${t}-autorouting.json`,s.click(),URL.revokeObjectURL(a)},children:[je.jsx(Ihn,{className:"rf-w-3 rf-h-3"}),"Download"]}),e&&je.jsxs(jC,{variant:"outline",size:"sm",onClick:r=>{r.stopPropagation(),e&&e(t,{simpleRouteJson:n})},children:[je.jsx(Qhn,{className:"rf-w-3 rf-h-3"}),"Report Bug"]})]})]},t))})]})}),hmn=({code:i,fsMap:e,autoroutingLog:t,circuitJsonErrors:n,circuitJsonWarnings:r,onReportAutoroutingLog:o,errorMessage:a,errorStack:s,circuitJson:l,evalVersion:c})=>{const u=rt.useMemo(()=>{const H=[];if(a&&H.push({type:"Execution Error",message:a,stack:s||void 0,source:"execution"}),n&&n.length>0)for(const k of n)H.push({type:k.type||"Circuit JSON Error",message:k.message||"No error message available",stack:k.stack||"",source:"circuitJson"});return H},[a,s,n]),d=rt.useMemo(()=>{if(!l||!Array.isArray(l))return;const H=l.find(k=>k.type==="source_project_metadata");return H==null?void 0:H.software_used_string},[l]),f=rt.useMemo(()=>{const H=[];if(r&&r.length>0)for(const k of r)H.push({type:k.type||"Circuit JSON Warning",message:k.message||"No warning message available",stack:k.stack||"",source:"circuitJson"});return H},[r]),[h,g]=rt.useState(0),[y,v]=rt.useState(0);if(u.length===0&&f.length===0)return je.jsxs("div",{className:"px-2",children:[je.jsx("div",{className:"rf-mt-4 rf-bg-green-50 rf-rounded-md rf-border rf-border-green-200",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-green-800 rf-mb-3",children:"No errors or warnings!"}),je.jsx("p",{className:"rf-text-sm rf-text-green-700",children:"Your code is running without any errors or warnings."})]})}),je.jsx("div",{className:"rf-mt-4",children:je.jsx(wet,{autoroutingLog:t,onReportAutoroutingLog:o})})]});const _=()=>{g(H=>Math.max(H-1,0))},x=()=>{g(H=>Math.min(H+1,u.length-1))},S=()=>{v(H=>Math.max(H-1,0))},M=()=>{v(H=>Math.min(H+1,f.length-1))},z=u[h],U=f[y];return je.jsxs(je.Fragment,{children:[je.jsxs("div",{className:"rf-w-[95%] rf-mx-auto",children:[u.length>1&&je.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2 rf-mb-2",children:[je.jsx("button",{type:"button",className:"rf-p-1 rf-rounded-sm rf-transition-colors",onClick:_,disabled:h===0,children:je.jsx(vZe,{className:"rf-h-4 rf-w-4 rf-text-red-500"})}),je.jsx("button",{type:"button",className:"rf-p-1 rf-rounded-sm rf-transition-colors",onClick:x,disabled:h===u.length-1,children:je.jsx(D0e,{className:"rf-h-4 rf-w-4 rf-text-red-500"})}),je.jsxs("span",{className:"rf-text-sm rf-text-red-600",children:[h+1," of ",u.length," errors"]})]}),z&&je.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200 rf-max-h-[500px] rf-overflow-y-auto rf-px-2",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-1",children:z.type}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600",children:z.message}),(z.stack||c||d)&&je.jsxs("details",{style:{whiteSpace:"pre-wrap"},className:"rf-text-xs rf-font-mono rf-text-red-600 rf-mt-2",children:[c&&`@tscircuit/eval@${c}
13249
13249
  `,d&&`${d}
13250
- `,z.stack]})]})}),f.length>0&&je.jsxs(je.Fragment,{children:[f.length>1&&je.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2 rf-mb-2 rf-mt-4",children:[je.jsx("button",{type:"button",className:"rf-p-1 rf-rounded-sm rf-transition-colors",onClick:S,disabled:y===0,children:je.jsx(vZe,{className:"rf-h-4 rf-w-4 rf-text-orange-500"})}),je.jsx("button",{type:"button",className:"rf-p-1 rf-rounded-sm rf-transition-colors",onClick:M,disabled:y===f.length-1,children:je.jsx(D0e,{className:"rf-h-4 rf-w-4 rf-text-orange-500"})}),je.jsxs("span",{className:"rf-text-sm rf-text-orange-600",children:[y+1," of ",f.length," warnings"]})]}),U&&je.jsx("div",{className:"rf-mt-4 rf-bg-orange-50 rf-rounded-md rf-border rf-border-orange-200 rf-max-h-[500px] rf-overflow-y-auto rf-px-2",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-orange-800 rf-mb-1",children:U.type}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-orange-600",children:U.message}),U.stack&&je.jsx("details",{style:{whiteSpace:"pre-wrap"},className:"rf-text-xs rf-font-mono rf-text-orange-600 rf-mt-2",children:U.stack})]})})]})]}),je.jsxs("div",{className:"rf-flex rf-gap-2 rf-mt-4 rf-justify-end",children:[je.jsx(wet,{autoroutingLog:e,onReportAutoroutingLog:o}),je.jsxs(jC,{variant:"outline",className:"rf-p-1",onClick:()=>{let H=`${z.type}: ${z.message}`;c&&(H+=`
13250
+ `,z.stack]})]})}),f.length>0&&je.jsxs(je.Fragment,{children:[f.length>1&&je.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2 rf-mb-2 rf-mt-4",children:[je.jsx("button",{type:"button",className:"rf-p-1 rf-rounded-sm rf-transition-colors",onClick:S,disabled:y===0,children:je.jsx(vZe,{className:"rf-h-4 rf-w-4 rf-text-orange-500"})}),je.jsx("button",{type:"button",className:"rf-p-1 rf-rounded-sm rf-transition-colors",onClick:M,disabled:y===f.length-1,children:je.jsx(D0e,{className:"rf-h-4 rf-w-4 rf-text-orange-500"})}),je.jsxs("span",{className:"rf-text-sm rf-text-orange-600",children:[y+1," of ",f.length," warnings"]})]}),U&&je.jsx("div",{className:"rf-mt-4 rf-bg-orange-50 rf-rounded-md rf-border rf-border-orange-200 rf-max-h-[500px] rf-overflow-y-auto rf-px-2",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-orange-800 rf-mb-1",children:U.type}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-orange-600",children:U.message}),U.stack&&je.jsx("details",{style:{whiteSpace:"pre-wrap"},className:"rf-text-xs rf-font-mono rf-text-orange-600 rf-mt-2",children:U.stack})]})})]})]}),je.jsxs("div",{className:"rf-flex rf-gap-2 rf-mt-4 rf-justify-end",children:[je.jsx(wet,{autoroutingLog:t,onReportAutoroutingLog:o}),je.jsxs(jC,{variant:"outline",className:"rf-p-1",onClick:()=>{let H=`${z.type}: ${z.message}`;c&&(H+=`
13251
13251
  @tscircuit/eval@${c}`),d&&(H+=`
13252
13252
  ${d}`),z.stack&&(H+=`
13253
- ${z.stack}`),navigator.clipboard.writeText(H),alert("Error copied to clipboard!")},children:[je.jsx(_hn,{className:"rf-w-4 rf-h-4"}),"Copy Error"]}),je.jsxs(jC,{variant:"outline",className:"rf-p-1",onClick:()=>{const H=`Error ${z.type}`.replace(/[^a-zA-Z0-9 ]/g," ").replace(/\s+/g," ").slice(0,100),k=r?akt(Object.fromEntries(r)):Thn(i??"");let j=`${z.type}: ${z.message}`;c&&(j+=`
13253
+ ${z.stack}`),navigator.clipboard.writeText(H),alert("Error copied to clipboard!")},children:[je.jsx(_hn,{className:"rf-w-4 rf-h-4"}),"Copy Error"]}),je.jsxs(jC,{variant:"outline",className:"rf-p-1",onClick:()=>{const H=`Error ${z.type}`.replace(/[^a-zA-Z0-9 ]/g," ").replace(/\s+/g," ").slice(0,100),k=e?akt(e instanceof Map?Object.fromEntries(e.entries()):e):Thn(i??"");let j=`${z.type}: ${z.message}`;c&&(j+=`
13254
13254
  @tscircuit/eval@${c}`),d&&(j+=`
13255
13255
  ${d}`),z.stack&&(j+=`
13256
13256
  ${z.stack}`);let G=`[Package code to reproduce](${k})
@@ -13512,7 +13512,7 @@ $1`).replace(/>(\s*)(?=<!--\s*\/)/g,"> ")}return xme}m1n();function gnt(i,e,t,n=
13512
13512
  &:hover {
13513
13513
  background-color: rgba(255, 255, 255, 0.1);
13514
13514
  }
13515
- `,onClick:n=>{n.stopPropagation(),t()},children:[je.jsx("input",{type:"checkbox",checked:e}),je.jsx("span",{style:{color:"#eee"},children:i})]}),Y9n=({children:i,elements:e})=>{const[t,n]=M9(k=>[k.is_mouse_over_container,k.setIsMouseOverContainer]),[r,o]=rt.useState(!1),[a,s]=rt.useState(!1),[l,c]=rt.useState(!1),[u,d]=M9(k=>[k.selected_layer,k.selectLayer]),[f,h,g,y,v,_]=M9(k=>[k.in_move_footprint_mode,k.in_draw_trace_mode,k.is_showing_rats_nest,k.is_showing_multiple_traces_length,k.is_showing_autorouting,k.is_showing_drc_errors]),x=M9(k=>k.setEditMode),S=M9(k=>k.setIsShowingRatsNest),M=M9(k=>k.setIsShowingMultipleTracesLength),z=M9(k=>k.setIsShowingAutorouting),U=M9(k=>k.setIsShowingDrcErrors);l3("1",()=>d("top")),l3("2",()=>d("bottom")),l3("3",()=>d("inner1")),l3("4",()=>d("inner2")),l3("5",()=>d("inner3")),l3("6",()=>d("inner4")),l3("7",()=>d("inner5")),l3("8",()=>d("inner6"));const H=(e==null?void 0:e.filter(k=>k.type.includes("error")).length)??0;return je.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>{n(!0)},onMouseLeave:k=>{n(!1),s(!1)},children:[i,je.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@",z9n.version]}),je.jsxs("div",{style:{position:"absolute",opacity:t?1:0,top:16,left:16,transition:t?"opacity 100ms linear":"opacity 1s linear",zIndex:wE.toolbarOverlay,color:"red",display:"flex",fontSize:12,height:100,fontFamily:"sans-serif"},children:[je.jsxs(LD,{onClick:()=>{s(!a)},onMouseLeave:()=>{a&&s(!1)},children:[je.jsxs("div",{children:["layer:"," ",je.jsx("span",{style:{marginLeft:2,fontWeight:500,color:kD[u]},children:u})]}),a&&je.jsx("div",{style:{marginTop:4,minWidth:120},children:rye.map(k=>k.replace(/-/g,"")).map(k=>je.jsx(H9n,{name:k,selected:k===u,onClick:()=>{d(k.replace(/-/,""))}},k))})]}),je.jsxs(LD,{style:H>0?{color:"red"}:{},onClick:()=>c(!l),onMouseLeave:()=>c(!1),children:[je.jsxs("div",{children:[H," errors"]}),l&&je.jsx("div",{style:{display:"grid",gridTemplateColumns:"100px 300px"},children:e==null?void 0:e.filter(k=>k.type.includes("error")).map((k,j)=>je.jsxs(rt.Fragment,{children:[je.jsx("div",{children:k.error_type}),je.jsx("div",{children:k.message})]},j))})]}),je.jsx(LD,{style:{},onClick:()=>{x(h?"off":"draw_trace")},children:je.jsxs("div",{children:[h?"✖ ":"","Edit Traces"]})}),je.jsx(LD,{style:{},onClick:()=>{x(f?"off":"move_footprint")},children:je.jsxs("div",{children:[f?"✖ ":"","Move Components"]})}),je.jsx(LD,{style:{},onClick:()=>{S(!g)},children:je.jsxs("div",{children:[g?"✖ ":"","Rats Nest"]})}),je.jsx(LD,{onClick:()=>{o(!r)},children:je.jsxs("div",{children:[je.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:["View"," ",je.jsx("span",{style:{fontSize:"8px",transform:r?"rotate(180deg)":"rotate(0)",transition:"transform 0.1s ease",display:"inline-block"},children:"▼"})]}),r&&je.jsxs("div",{style:{marginTop:4,minWidth:120},children:[je.jsx(uye,{label:"Show All Trace Lengths",checked:y,onClick:()=>{M(!y)}}),je.jsx(uye,{label:"Show Autorouting Animation",checked:v,onClick:()=>{z(!v)}}),je.jsx(uye,{label:"Show DRC Errors",checked:_,onClick:()=>{U(!_)}})]})]})})]})]})},V9n=i=>{const{transform:e,elements:t}=i,[n,r]=rt.useMemo(()=>{const c=i.elements.flatMap(d=>n9n(d,i.elements)),u=OS(i.elements);return[c,u]},[i.elements]),[o,a]=rt.useState({drawingObjectIdsWithMouseOver:new Set,primitiveIdsInMousedOverNet:[]}),s=rt.useMemo(()=>e9n({primitivesWithoutInteractionMetadata:n,drawingObjectIdsWithMouseOver:o.drawingObjectIdsWithMouseOver,primitiveIdsInMousedOverNet:o.primitiveIdsInMousedOverNet}),[n,o]),l=rt.useCallback(c=>{var f,h;const u=[];for(const g of c)if(g._element){const y=r.getNetConnectedToId("pcb_port_id"in g._element?(f=g._element)==null?void 0:f.pcb_port_id:"pcb_trace_id"in g._element?(h=g._element)==null?void 0:h.pcb_trace_id:"");u.push(...r.getIdsConnectedToNet(y))}const d=new Set(c.map(g=>g._pcb_drawing_object_id));a({drawingObjectIdsWithMouseOver:d,primitiveIdsInMousedOverNet:u})},[r]);return je.jsx(G9n,{elements:t,transform:e,primitives:n,onMouseHoverOverPrimitives:l,children:je.jsx(x9n,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:je.jsx(S9n,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:je.jsx(I9n,{transform:e,focusOnHover:i.focusOnHover,children:je.jsx(Y9n,{elements:t,children:je.jsx(Q9n,{transform:e,elements:t,children:je.jsx(O9n,{transform:e,soup:t,children:je.jsx(v9n,{transform:e,debugGraphics:i.debugGraphics,children:je.jsx(_9n,{transform:e,elements:t,children:je.jsx(y9n,{transform:e,primitives:s,width:i.width,height:i.height,grid:i.grid})})})})})})})})})})},j9n=XA(hp(400,300),H9(40,-40)),K9n=({circuitJson:i,debugGraphics:e,height:t=600,initialState:n,allowEditing:r=!0,editEvents:o,onEditEventsChanged:a,focusOnHover:s=!1,clickToInteractEnabled:l=!1})=>{const[c,u]=rt.useState(!l),[d,f]=lye(),[h,g]=rt.useState(j9n),{ref:y,setTransform:v,cancelDrag:_}=$Cn({transform:h,onSetTransform:g,enabled:c});let[x,S]=rt.useState([]);x=o??x;const M=rt.useRef(!1),z=rt.useRef(null),U=`${(i==null?void 0:i.length)||0}_${(i==null?void 0:i.editCount)||0}`,H=()=>{const K=(f==null?void 0:f.width)>0?f:{width:500,height:500},{center:ie,width:ce,height:ue}=j.some(ye=>ye.type.startsWith("pcb_"))?HCn(j.filter(ye=>ye.type.startsWith("pcb_"))):{center:{x:0,y:0},width:.001,height:.001},le=Math.min((K.width??0)/ce,(K.height??0)/ue,100)*.75,_e=XA(hp((K.width??0)/2,(K.height??0)/2),H9(le,-le,0,0),hp(-ie.x,-ie.y));v(_e)};rt.useEffect(()=>{f!=null&&f.width&&i&&i.length!==0&&(M.current||(H(),M.current=!0))},[i,f]);const k=rt.useMemo(()=>(i==null?void 0:i.filter(K=>K.type.startsWith("pcb_")||K.type.startsWith("source_")))??[],[U]),j=rt.useMemo(()=>n_n({circuitJson:k,editEvents:x}),[k,x]),G=K=>{S([...x,K]),a==null||a([...x,K])},ee=K=>{const ie=x.map(ce=>ce.edit_event_id===K.edit_event_id?{...ce,...K}:ce);S(ie),a==null||a(ie)};return je.jsxs("div",{ref:y,style:{position:"relative"},children:[je.jsx("div",{ref:d,children:je.jsxs(VCn,{initialState:n,children:[je.jsx(V9n,{transform:h,height:t,width:f.width,allowEditing:r,focusOnHover:s,cancelPanDrag:_,onCreateEditEvent:G,onModifyEditEvent:ee,grid:{spacing:1,view_window:{left:0,right:f.width||500,top:t,bottom:0}},elements:j,debugGraphics:e},f.width),je.jsx(KCn,{})]})}),l&&!c&&je.jsx("div",{onClick:()=>{u(!0),H()},onTouchStart:K=>{const ie=K.touches[0];z.current={x:ie.clientX,y:ie.clientY}},onTouchEnd:K=>{const ie=K.changedTouches[0],ce=z.current;if(!ce)return;const ue=Math.abs(ie.clientX-ce.x),le=Math.abs(ie.clientY-ce.y);ue<10&&le<10&&(K.preventDefault(),u(!0),H()),z.current=null},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:wE.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",touchAction:"pan-x pan-y pinch-zoom"},children:je.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 J9n=({containerClassName:i,...e})=>{const t=rt.useRef(null),[n,r]=rt.useState(620);return rt.useLayoutEffect(()=>{const o=()=>{if(t.current){const s=t.current.clientHeight,l=window.innerHeight;r(Math.min(Math.max(s,620),l))}};o();const a=new ResizeObserver(o);return t.current&&a.observe(t.current),window.addEventListener("resize",o),()=>{a.disconnect(),window.removeEventListener("resize",o)}},[]),je.jsx("div",{ref:t,className:i||"rf-w-full rf-h-full",children:je.jsx(K9n,{...e,height:n})})},W9n='*,: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-1{right:.25rem}.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-10{z-index:10}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.rf-order-1{order:1}.rf-order-2{order:2}.rf-order-3{order:3}.rf-m-1{margin:.25rem}.rf-m-6{margin:1.5rem}.-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-4{margin-left:1rem;margin-right:1rem}.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-block{display:inline-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-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-auto{height:auto}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.rf-h-screen{height:100vh}.\\!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-\\[300px\\]{max-height:300px}.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-\\[300px\\]{min-height:300px}.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-20{width:5rem}.rf-w-28{width:7rem}.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-w-screen{width:100vw}.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-origin-\\[--radix-popover-content-transform-origin\\]{transform-origin:var(--radix-popover-content-transform-origin)}.-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-1\\/2{--tw-translate-x:-50%}.rf--translate-x-1\\/2,.rf--translate-y-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-y-1{--tw-translate-y:-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-items-stretch{align-items:stretch}.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-2{border-width:2px}.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-400{--tw-border-opacity:1;border-color:rgb(96 165 250/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-400{--tw-border-opacity:1;border-color:rgb(248 113 113/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-transparent{background-color:transparent}.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-6{padding-bottom:1.5rem;padding-top:1.5rem}.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-0{padding-top:0}.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-normal{font-weight:400!important}.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-100{opacity:1}.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\\=true\\]\\:rf-pointer-events-none[data-disabled=true],.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-\\[selected\\=true\\]\\:rf-bg-zinc-100[data-selected=true]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.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-\\[selected\\=true\\]\\:rf-text-zinc-900[data-selected=true]{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-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\\=true\\]\\:rf-opacity-50[data-disabled=true],.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\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.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-\\[selected\\=true\\]\\:rf-bg-zinc-800[data-selected=true]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-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-\\[selected\\=true\\]\\:rf-text-zinc-50[data-selected=true]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-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-order-1{order:1}.sm\\:rf-order-2{order:2}.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-inline{display:inline}.sm\\:rf-hidden{display:none}.sm\\:rf-w-auto{width:auto}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-items-center{align-items:center}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-gap-3{gap:.75rem}.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-px-4{padding-left:1rem;padding-right:1rem}.sm\\:rf-text-left{text-align:left}.sm\\:rf-text-sm{font-size:.875rem;line-height:1.25rem}.sm\\:rf-text-xl{font-size:1.25rem;line-height:1.75rem}}@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))}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-py-1\\.5 [cmdk-group-heading]{padding-bottom:.375rem;padding-top:.375rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-font-medium [cmdk-group-heading]{font-weight:500}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-500 [cmdk-group-heading]{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.dark\\:\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-400 [cmdk-group-heading]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.\\[\\&_\\[cmdk-group\\]\\:not\\(\\[hidden\\]\\)_\\~\\[cmdk-group\\]\\]\\:rf-pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\\[\\&_\\[cmdk-group\\]\\]\\:rf-px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\\[\\&_\\[cmdk-input\\]\\]\\:rf-h-12 [cmdk-input]{height:3rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-py-3 [cmdk-item]{padding-bottom:.75rem;padding-top:.75rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-h-5 [cmdk-item] svg{height:1.25rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-w-5 [cmdk-item] svg{width:1.25rem}.\\[\\&_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}',q9n=()=>{rt.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=W9n,document.head.appendChild(e)},[])},X9n=i=>{rt.useEffect(()=>(i?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[i])},Rrt=i=>`hsl(${Ab.indexOf(i)*137.5%360}, 70%, 50%)`,Z9n=({phaseTimings:i})=>{if(!i)return null;const e=Object.values(i).reduce((t,n)=>t+n,0);return je.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[je.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:Ab.map(t=>{const n=i[t]||0,r=n/e*100;return je.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${r}%`,backgroundColor:Rrt(t)},children:je.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)})}),je.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},$9n=({renderLog:i})=>{const[e,t]=rt.useState("chronological");if(!i)return je.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((o,a)=>Ab.indexOf(o[0])-Ab.indexOf(a[0])):n.sort((o,a)=>a[1]-o[1]);const r=n.reduce((o,[a,s])=>o+s,0);return je.jsxs("div",{className:"rf-bg-white",children:[je.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[je.jsx("div",{children:"Render Logs"}),je.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[je.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),je.jsxs("select",{value:e,onChange:o=>t(o.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[je.jsx("option",{value:"chronological",children:"Phase Order"}),je.jsx("option",{value:"longest",children:"Duration"})]})]})]}),je.jsx(Z9n,{phaseTimings:i.phaseTimings}),je.jsxs("table",{className:"rf-w-full rf-text-xs",children:[je.jsx("thead",{children:je.jsxs("tr",{children:[je.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),je.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),je.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),je.jsx("tbody",{children:n.map(([o,a])=>je.jsxs("tr",{children:[je.jsx("td",{className:"rf-p-2",children:Ab.indexOf(o)}),je.jsx("td",{className:"rf-p-2",children:o}),je.jsx("td",{className:"rf-p-2",children:je.jsx("div",{className:"rf-w-8",children:je.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:Rrt(o),width:`${a/r*100}%`}})})}),je.jsx("td",{className:"rf-p-2",children:je.jsxs("div",{className:"rf-flex w-full",children:[je.jsxs("span",{className:"rf-flex-grow",children:[a,"ms"]}),je.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(a/r*100).toFixed(1),"%"]})]})})]},o))})]})]})},Drt=({errorMessage:i,errorStack:e,circuitJsonErrors:t})=>{rt.useEffect(()=>{if(i){const n=new Error(i);e&&(n.stack=e);try{_G.captureException(n)}catch{}}},[i,e]),rt.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{_G.captureException(r,{error_type:n.type})}catch{}}},[t])},exn="0.0.723",dye=aQe()(sQe(i=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:e=>{i({lastRunEvalVersion:e})}}),{name:"runframe-runner-store"})),txn=["assembly","bom","circuit_json","errors","render_log"],nxn=({code:i,fsMap:e,onRunClicked:t=void 0,errorMessage:n,errorStack:r,circuitJson:o,autoroutingGraphics:a,showRightHeaderContent:s=!0,showCodeTab:l=!1,codeTabContent:c,showJsonTab:u=!0,showRenderLogTab:d=!0,onActiveTabChange:f,renderLog:h,showImportAndFormatButtons:g=!0,className:y,headerClassName:v,leftHeaderContent:_,readOnly:x,isStreaming:S,autoroutingLog:M,onReportAutoroutingLog:z,isRunningCode:U,hasCodeChangedSinceLastRun:H,onEditEvent:k,editEvents:j,defaultActiveTab:G,defaultTab:ee,availableTabs:K,autoRotate3dViewerDisabled:ie,showSchematicDebugGrid:ce=!1,showToggleFullScreen:ue=!0,defaultToFullScreen:le=!1,activeEffectName:_e})=>{var We;q9n();const ye=dye($e=>$e.lastRunEvalVersion),Qe=rt.useMemo(()=>o?o.filter($e=>$e&&"error_type"in $e||$e.type.includes("error")):null,[o]),Me=rt.useMemo(()=>o?o.filter($e=>$e&&"warning_type"in $e||$e.type.includes("warning")):null,[o]);Drt({errorMessage:n,errorStack:r,circuitJsonErrors:Qe});const[Te,Ee]=rt.useState(G??ee??(K==null?void 0:K[0])??"pcb"),[Ge,Ke]=rt.useState(null),[nt,lt]=rt.useState(le);X9n(nt);const Rt=rt.useCallback($e=>{Ee($e),f==null||f($e)},[f]),pt=()=>{lt(!nt)};rt.useEffect(()=>{n&&(Te!=="errors"&&Ke(Te),Rt("errors"))},[n]),rt.useEffect(()=>{(Te==="code"||Te==="errors")&&o&&!n&&Rt(Ge??G??ee??(K==null?void 0:K[0])??"pcb")},[o]);const Fe=rt.useCallback($e=>{window.TSCIRCUIT_3D_OBJECT_REF=$e===null?void 0:$e},[]);return je.jsx("div",{className:ip("flex flex-col relative rf-overflow-x-hidden rf-h-full",y),children:je.jsx("div",{className:ip("rf-md:sticky rf-md:top-2 rf-h-full",nt&&"rf-fixed rf-top-0 rf-left-0 rf-w-full rf-h-full rf-bg-white rf-overflow-hidden"),children:je.jsxs(Iie,{value:Te,onValueChange:Rt,className:"rf-flex-grow rf-flex rf-flex-col rf-h-full",children:[je.jsxs("div",{className:ip("rf-flex rf-items-center rf-gap-2 rf-p-2 rf-pb-0",v),children:[_,_&&je.jsx("div",{className:"rf-flex-grow"}),!_&&U&&je.jsx(vM,{className:"rf-w-4 rf-h-4 rf-animate-spin"}),!_&&je.jsx("div",{className:"rf-flex-grow"}),h&&h.progress!==1&&!n&&je.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[_e?je.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:_e}):h.lastRenderEvent&&je.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:((We=h.lastRenderEvent)==null?void 0:We.phase)??""}),je.jsx("div",{className:"rf-w-4 rf-h-4 rf-bg-blue-500 rf-opacity-50 rf-rounded-full rf-text-white",children:je.jsx(vM,{className:"rf-w-4 rf-h-4 rf-animate-spin"})}),je.jsxs("div",{className:"rf-text-xs rf-font-bold rf-text-gray-700 rf-tabular-nums",children:[((h.progress??0)*100).toFixed(1),"%"]})]}),s&&je.jsxs(CG,{children:[l&&je.jsx(zB,{value:"code",children:"Code"}),!K||K.includes("pcb")?je.jsxs(zB,{value:"pcb",className:"rf-whitespace-nowrap",children:[o&&je.jsx("span",{className:ip("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",H?"rf-bg-gray-500":"rf-bg-blue-500")}),"PCB"]}):null,!K||K.includes("schematic")?je.jsxs(zB,{value:"schematic",className:"rf-whitespace-nowrap",children:[o&&je.jsx("span",{className:ip("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",H?"rf-bg-gray-500":"rf-bg-blue-500")}),"Schematic"]}):null,!K||K.includes("cad")?je.jsxs(zB,{value:"cad",children:[o&&je.jsx("span",{className:ip("inline-flex items-center justify-center w-2 h-2 mr-1 text-xs font-bold text-white rounded-full",H?"rf-bg-gray-500":"rf-bg-blue-500")}),"3D"]}):null,!["pcb","cad","schematic"].includes(Te)&&je.jsx(zB,{value:Te,children:hNe(Te)}),je.jsxs(mge,{children:[je.jsx(yge,{asChild:!0,children:je.jsxs("div",{className:"rf-whitespace-nowrap rf-p-2 rf-mr-1 rf-cursor-pointer rf-relative",children:[je.jsx(Chn,{className:"rf-w-4 rf-h-4"}),(Qe&&Qe.length>0||n)&&je.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"})]})}),je.jsxs(iV,{className:"rf-*:text-xs",children:[txn.filter($e=>!K||K.includes($e)).map($e=>je.jsxs(i2,{onSelect:()=>Rt($e),children:[Te!==$e&&je.jsx(_Ze,{className:"rf-w-3 rf-h-3 rf-opacity-30"}),Te===$e&&je.jsx(RY,{className:"rf-w-3 rf-h-3"}),je.jsx("div",{className:"rf-pr-2",children:hNe($e)}),$e==="errors"&&(Qe&&Qe.length>0||n)&&je.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:n?1:Qe==null?void 0:Qe.length})]},$e)),je.jsx(i2,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:je.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/runframe@",exn.split(".").map(($e,_t)=>_t===2?parseInt($e)+1:$e).join(".")]})}),ye&&je.jsx(i2,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:je.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/eval@",ye]})})]})]})]}),ue&&je.jsx(jC,{onClick:pt,variant:"ghost",children:nt?je.jsx(Bhn,{size:16}):je.jsx(Ehn,{size:16})})]}),l&&je.jsx(C2,{value:"code",className:"rf-flex-grow rf-overflow-hidden",children:je.jsx("div",{className:"rf-h-full",children:c})}),(!K||K.includes("pcb"))&&je.jsx(C2,{value:"pcb",children:je.jsx("div",{className:ip("rf-overflow-hidden",nt?"rf-h-[calc(100vh-52px)]":"rf-h-full"),children:je.jsx(uD,{fallbackRender:({error:$e})=>je.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading PCB viewer"}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:($e==null?void 0:$e.message)||"An unknown error occurred"})]})}),children:o?je.jsx(J9n,{focusOnHover:!1,circuitJson:o,debugGraphics:a,containerClassName:ip("rf-h-full rf-w-full",nt?"rf-min-h-[calc(100vh-240px)]":"rf-min-h-[620px]"),onEditEventsChanged:$e=>{k&&$e.forEach(_t=>k(_t))}}):je.jsx(xM,{onRunClicked:t})})})}),(!K||K.includes("assembly"))&&je.jsx(C2,{value:"assembly",children:je.jsx("div",{className:ip("rf-overflow-auto",nt?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(uD,{fallback:je.jsx("div",{children:"Error loading Assembly"}),children:o?je.jsx(nvn,{circuitJson:o,containerStyle:{height:"100%"},editingEnabled:!0,debugGrid:!0}):je.jsx(xM,{onRunClicked:t})})})}),(!K||K.includes("schematic"))&&je.jsx(C2,{value:"schematic",children:je.jsx("div",{className:ip("rf-overflow-auto rf-bg-white",nt?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(uD,{fallbackRender:({error:$e})=>je.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Schematic"}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:($e==null?void 0:$e.message)||"An unknown error occurred"})]})}),children:o?je.jsx($yn,{circuitJson:o,containerStyle:{height:"100%"},editingEnabled:!0,onEditEvent:$e=>{k==null||k($e)},debugGrid:ce}):je.jsx(xM,{onRunClicked:t})})})}),(!K||K.includes("cad"))&&je.jsx(C2,{value:"cad",children:je.jsx("div",{className:ip("rf-overflow-auto",nt?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(uD,{FallbackComponent:chn,children:o?je.jsx(shn,{ref:Fe,circuitJson:o,autoRotateDisabled:ie}):je.jsx(xM,{onRunClicked:t})})})}),(!K||K.includes("bom"))&&je.jsx(C2,{value:"bom",children:je.jsx("div",{className:ip("rf-overflow-auto",nt?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(uD,{fallbackRender:({error:$e})=>je.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Bill of Materials"}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:($e==null?void 0:$e.message)||"An unknown error occurred"})]})}),children:o?je.jsx(svn,{circuitJson:o}):je.jsx(xM,{onRunClicked:t})})})}),(!K||K.includes("circuit_json"))&&je.jsx(C2,{value:"circuit_json",children:je.jsx("div",{className:ip("rf-overflow-auto",nt?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(uD,{fallback:je.jsx("div",{children:"Error loading JSON viewer"}),children:o?je.jsx(ovn,{elements:o}):je.jsx(xM,{onRunClicked:t})})})}),(!K||K.includes("errors"))&&je.jsx(C2,{value:"errors",children:je.jsx("div",{className:ip("rf-overflow-auto",nt?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:n||Qe&&Qe.length>0||o?je.jsx(hmn,{code:i,fsMap:e,circuitJsonErrors:Qe,circuitJsonWarnings:Me,errorMessage:n,errorStack:r,circuitJson:o,evalVersion:ye,autoroutingLog:M,onReportAutoroutingLog:z}):je.jsx(xM,{onRunClicked:t})})}),d&&(!K||K.includes("render_log"))&&je.jsx(C2,{value:"render_log",children:je.jsx($9n,{renderLog:h})})]})})})};var ej="Dialog",[Nrt,Trt]=NB(ej),[ixn,cB]=Nrt(ej),Prt=i=>{const{__scopeDialog:e,children:t,open:n,defaultOpen:r,onOpenChange:o,modal:a=!0}=i,s=rt.useRef(null),l=rt.useRef(null),[c,u]=t4({prop:n,defaultProp:r??!1,onChange:o,caller:ej});return je.jsx(ixn,{scope:e,triggerRef:s,contentRef:l,contentId:dE(),titleId:dE(),descriptionId:dE(),open:c,onOpenChange:u,onOpenToggle:rt.useCallback(()=>u(d=>!d),[u]),modal:a,children:t})};Prt.displayName=ej;var krt="DialogTrigger",Lrt=rt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=cB(krt,t),o=_C(e,r.triggerRef);return je.jsx(_y.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":hye(r.open),...n,ref:o,onClick:Fp(i.onClick,r.onOpenToggle)})});Lrt.displayName=krt;var Aye="DialogPortal",[rxn,Frt]=Nrt(Aye,{forceMount:void 0}),Urt=i=>{const{__scopeDialog:e,forceMount:t,children:n,container:r}=i,o=cB(Aye,e);return je.jsx(rxn,{scope:e,forceMount:t,children:rt.Children.map(n,a=>je.jsx(y2,{present:t||o.open,children:je.jsx(YY,{asChild:!0,container:r,children:a})}))})};Urt.displayName=Aye;var tj="DialogOverlay",Grt=rt.forwardRef((i,e)=>{const t=Frt(tj,i.__scopeDialog),{forceMount:n=t.forceMount,...r}=i,o=cB(tj,i.__scopeDialog);return o.modal?je.jsx(y2,{present:n||o.open,children:je.jsx(axn,{...r,ref:e})}):null});Grt.displayName=tj;var oxn=e4("DialogOverlay.RemoveScroll"),axn=rt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=cB(tj,t);return je.jsx(ZY,{as:oxn,allowPinchZoom:!0,shards:[r.contentRef],children:je.jsx(_y.div,{"data-state":hye(r.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),NM="DialogContent",Ort=rt.forwardRef((i,e)=>{const t=Frt(NM,i.__scopeDialog),{forceMount:n=t.forceMount,...r}=i,o=cB(NM,i.__scopeDialog);return je.jsx(y2,{present:n||o.open,children:o.modal?je.jsx(sxn,{...r,ref:e}):je.jsx(lxn,{...r,ref:e})})});Ort.displayName=NM;var sxn=rt.forwardRef((i,e)=>{const t=cB(NM,i.__scopeDialog),n=rt.useRef(null),r=_C(e,t.contentRef,n);return rt.useEffect(()=>{const o=n.current;if(o)return ige(o)},[]),je.jsx(zrt,{...i,ref:r,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Fp(i.onCloseAutoFocus,o=>{var a;o.preventDefault(),(a=t.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Fp(i.onPointerDownOutside,o=>{const a=o.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&o.preventDefault()}),onFocusOutside:Fp(i.onFocusOutside,o=>o.preventDefault())})}),lxn=rt.forwardRef((i,e)=>{const t=cB(NM,i.__scopeDialog),n=rt.useRef(!1),r=rt.useRef(!1);return je.jsx(zrt,{...i,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,s;(a=i.onCloseAutoFocus)==null||a.call(i,o),o.defaultPrevented||(n.current||(s=t.triggerRef.current)==null||s.focus(),o.preventDefault()),n.current=!1,r.current=!1},onInteractOutside:o=>{var l,c;(l=i.onInteractOutside)==null||l.call(i,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=o.target;((c=t.triggerRef.current)==null?void 0:c.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&r.current&&o.preventDefault()}})}),zrt=rt.forwardRef((i,e)=>{const{__scopeDialog:t,trapFocus:n,onOpenAutoFocus:r,onCloseAutoFocus:o,...a}=i,s=cB(NM,t),l=rt.useRef(null),c=_C(e,l);return L0e(),je.jsxs(je.Fragment,{children:[je.jsx(NY,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:r,onUnmountAutoFocus:o,children:je.jsx(DY,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":hye(s.open),...a,ref:c,onDismiss:()=>s.onOpenChange(!1)})}),je.jsxs(je.Fragment,{children:[je.jsx(uxn,{titleId:s.titleId}),je.jsx(Axn,{contentRef:l,descriptionId:s.descriptionId})]})]})}),fye="DialogTitle",Hrt=rt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=cB(fye,t);return je.jsx(_y.h2,{id:r.titleId,...n,ref:e})});Hrt.displayName=fye;var Yrt="DialogDescription",Vrt=rt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=cB(Yrt,t);return je.jsx(_y.p,{id:r.descriptionId,...n,ref:e})});Vrt.displayName=Yrt;var jrt="DialogClose",Krt=rt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=cB(jrt,t);return je.jsx(_y.button,{type:"button",...n,ref:e,onClick:Fp(i.onClick,()=>r.onOpenChange(!1))})});Krt.displayName=jrt;function hye(i){return i?"open":"closed"}var Jrt="DialogTitleWarning",[cxn,Wrt]=yTt(Jrt,{contentName:NM,titleName:fye,docsSlug:"dialog"}),uxn=({titleId:i})=>{const e=Wrt(Jrt),t=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
13515
+ `,onClick:n=>{n.stopPropagation(),t()},children:[je.jsx("input",{type:"checkbox",checked:e}),je.jsx("span",{style:{color:"#eee"},children:i})]}),Y9n=({children:i,elements:e})=>{const[t,n]=M9(k=>[k.is_mouse_over_container,k.setIsMouseOverContainer]),[r,o]=rt.useState(!1),[a,s]=rt.useState(!1),[l,c]=rt.useState(!1),[u,d]=M9(k=>[k.selected_layer,k.selectLayer]),[f,h,g,y,v,_]=M9(k=>[k.in_move_footprint_mode,k.in_draw_trace_mode,k.is_showing_rats_nest,k.is_showing_multiple_traces_length,k.is_showing_autorouting,k.is_showing_drc_errors]),x=M9(k=>k.setEditMode),S=M9(k=>k.setIsShowingRatsNest),M=M9(k=>k.setIsShowingMultipleTracesLength),z=M9(k=>k.setIsShowingAutorouting),U=M9(k=>k.setIsShowingDrcErrors);l3("1",()=>d("top")),l3("2",()=>d("bottom")),l3("3",()=>d("inner1")),l3("4",()=>d("inner2")),l3("5",()=>d("inner3")),l3("6",()=>d("inner4")),l3("7",()=>d("inner5")),l3("8",()=>d("inner6"));const H=(e==null?void 0:e.filter(k=>k.type.includes("error")).length)??0;return je.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>{n(!0)},onMouseLeave:k=>{n(!1),s(!1)},children:[i,je.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@",z9n.version]}),je.jsxs("div",{style:{position:"absolute",opacity:t?1:0,top:16,left:16,transition:t?"opacity 100ms linear":"opacity 1s linear",zIndex:wE.toolbarOverlay,color:"red",display:"flex",fontSize:12,height:100,fontFamily:"sans-serif"},children:[je.jsxs(LD,{onClick:()=>{s(!a)},onMouseLeave:()=>{a&&s(!1)},children:[je.jsxs("div",{children:["layer:"," ",je.jsx("span",{style:{marginLeft:2,fontWeight:500,color:kD[u]},children:u})]}),a&&je.jsx("div",{style:{marginTop:4,minWidth:120},children:rye.map(k=>k.replace(/-/g,"")).map(k=>je.jsx(H9n,{name:k,selected:k===u,onClick:()=>{d(k.replace(/-/,""))}},k))})]}),je.jsxs(LD,{style:H>0?{color:"red"}:{},onClick:()=>c(!l),onMouseLeave:()=>c(!1),children:[je.jsxs("div",{children:[H," errors"]}),l&&je.jsx("div",{style:{display:"grid",gridTemplateColumns:"100px 300px"},children:e==null?void 0:e.filter(k=>k.type.includes("error")).map((k,j)=>je.jsxs(rt.Fragment,{children:[je.jsx("div",{children:k.error_type}),je.jsx("div",{children:k.message})]},j))})]}),je.jsx(LD,{style:{},onClick:()=>{x(h?"off":"draw_trace")},children:je.jsxs("div",{children:[h?"✖ ":"","Edit Traces"]})}),je.jsx(LD,{style:{},onClick:()=>{x(f?"off":"move_footprint")},children:je.jsxs("div",{children:[f?"✖ ":"","Move Components"]})}),je.jsx(LD,{style:{},onClick:()=>{S(!g)},children:je.jsxs("div",{children:[g?"✖ ":"","Rats Nest"]})}),je.jsx(LD,{onClick:()=>{o(!r)},children:je.jsxs("div",{children:[je.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:["View"," ",je.jsx("span",{style:{fontSize:"8px",transform:r?"rotate(180deg)":"rotate(0)",transition:"transform 0.1s ease",display:"inline-block"},children:"▼"})]}),r&&je.jsxs("div",{style:{marginTop:4,minWidth:120},children:[je.jsx(uye,{label:"Show All Trace Lengths",checked:y,onClick:()=>{M(!y)}}),je.jsx(uye,{label:"Show Autorouting Animation",checked:v,onClick:()=>{z(!v)}}),je.jsx(uye,{label:"Show DRC Errors",checked:_,onClick:()=>{U(!_)}})]})]})})]})]})},V9n=i=>{const{transform:e,elements:t}=i,[n,r]=rt.useMemo(()=>{const c=i.elements.flatMap(d=>n9n(d,i.elements)),u=OS(i.elements);return[c,u]},[i.elements]),[o,a]=rt.useState({drawingObjectIdsWithMouseOver:new Set,primitiveIdsInMousedOverNet:[]}),s=rt.useMemo(()=>e9n({primitivesWithoutInteractionMetadata:n,drawingObjectIdsWithMouseOver:o.drawingObjectIdsWithMouseOver,primitiveIdsInMousedOverNet:o.primitiveIdsInMousedOverNet}),[n,o]),l=rt.useCallback(c=>{var f,h;const u=[];for(const g of c)if(g._element){const y=r.getNetConnectedToId("pcb_port_id"in g._element?(f=g._element)==null?void 0:f.pcb_port_id:"pcb_trace_id"in g._element?(h=g._element)==null?void 0:h.pcb_trace_id:"");u.push(...r.getIdsConnectedToNet(y))}const d=new Set(c.map(g=>g._pcb_drawing_object_id));a({drawingObjectIdsWithMouseOver:d,primitiveIdsInMousedOverNet:u})},[r]);return je.jsx(G9n,{elements:t,transform:e,primitives:n,onMouseHoverOverPrimitives:l,children:je.jsx(x9n,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:je.jsx(S9n,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:je.jsx(I9n,{transform:e,focusOnHover:i.focusOnHover,children:je.jsx(Y9n,{elements:t,children:je.jsx(Q9n,{transform:e,elements:t,children:je.jsx(O9n,{transform:e,soup:t,children:je.jsx(v9n,{transform:e,debugGraphics:i.debugGraphics,children:je.jsx(_9n,{transform:e,elements:t,children:je.jsx(y9n,{transform:e,primitives:s,width:i.width,height:i.height,grid:i.grid})})})})})})})})})})},j9n=XA(hp(400,300),H9(40,-40)),K9n=({circuitJson:i,debugGraphics:e,height:t=600,initialState:n,allowEditing:r=!0,editEvents:o,onEditEventsChanged:a,focusOnHover:s=!1,clickToInteractEnabled:l=!1})=>{const[c,u]=rt.useState(!l),[d,f]=lye(),[h,g]=rt.useState(j9n),{ref:y,setTransform:v,cancelDrag:_}=$Cn({transform:h,onSetTransform:g,enabled:c});let[x,S]=rt.useState([]);x=o??x;const M=rt.useRef(!1),z=rt.useRef(null),U=`${(i==null?void 0:i.length)||0}_${(i==null?void 0:i.editCount)||0}`,H=()=>{const K=(f==null?void 0:f.width)>0?f:{width:500,height:500},{center:ie,width:ce,height:ue}=j.some(ye=>ye.type.startsWith("pcb_"))?HCn(j.filter(ye=>ye.type.startsWith("pcb_"))):{center:{x:0,y:0},width:.001,height:.001},le=Math.min((K.width??0)/ce,(K.height??0)/ue,100)*.75,_e=XA(hp((K.width??0)/2,(K.height??0)/2),H9(le,-le,0,0),hp(-ie.x,-ie.y));v(_e)};rt.useEffect(()=>{f!=null&&f.width&&i&&i.length!==0&&(M.current||(H(),M.current=!0))},[i,f]);const k=rt.useMemo(()=>(i==null?void 0:i.filter(K=>K.type.startsWith("pcb_")||K.type.startsWith("source_")))??[],[U]),j=rt.useMemo(()=>n_n({circuitJson:k,editEvents:x}),[k,x]),G=K=>{S([...x,K]),a==null||a([...x,K])},ee=K=>{const ie=x.map(ce=>ce.edit_event_id===K.edit_event_id?{...ce,...K}:ce);S(ie),a==null||a(ie)};return je.jsxs("div",{ref:y,style:{position:"relative"},children:[je.jsx("div",{ref:d,children:je.jsxs(VCn,{initialState:n,children:[je.jsx(V9n,{transform:h,height:t,width:f.width,allowEditing:r,focusOnHover:s,cancelPanDrag:_,onCreateEditEvent:G,onModifyEditEvent:ee,grid:{spacing:1,view_window:{left:0,right:f.width||500,top:t,bottom:0}},elements:j,debugGraphics:e},f.width),je.jsx(KCn,{})]})}),l&&!c&&je.jsx("div",{onClick:()=>{u(!0),H()},onTouchStart:K=>{const ie=K.touches[0];z.current={x:ie.clientX,y:ie.clientY}},onTouchEnd:K=>{const ie=K.changedTouches[0],ce=z.current;if(!ce)return;const ue=Math.abs(ie.clientX-ce.x),le=Math.abs(ie.clientY-ce.y);ue<10&&le<10&&(K.preventDefault(),u(!0),H()),z.current=null},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:wE.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",touchAction:"pan-x pan-y pinch-zoom"},children:je.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 J9n=({containerClassName:i,...e})=>{const t=rt.useRef(null),[n,r]=rt.useState(620);return rt.useLayoutEffect(()=>{const o=()=>{if(t.current){const s=t.current.clientHeight,l=window.innerHeight;r(Math.min(Math.max(s,620),l))}};o();const a=new ResizeObserver(o);return t.current&&a.observe(t.current),window.addEventListener("resize",o),()=>{a.disconnect(),window.removeEventListener("resize",o)}},[]),je.jsx("div",{ref:t,className:i||"rf-w-full rf-h-full",children:je.jsx(K9n,{...e,height:n})})},W9n='*,: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-1{right:.25rem}.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-10{z-index:10}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.rf-order-1{order:1}.rf-order-2{order:2}.rf-order-3{order:3}.rf-m-1{margin:.25rem}.rf-m-6{margin:1.5rem}.-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-4{margin-left:1rem;margin-right:1rem}.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-block{display:inline-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-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-auto{height:auto}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.rf-h-screen{height:100vh}.\\!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-\\[300px\\]{max-height:300px}.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-\\[300px\\]{min-height:300px}.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-20{width:5rem}.rf-w-28{width:7rem}.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-w-screen{width:100vw}.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-origin-\\[--radix-popover-content-transform-origin\\]{transform-origin:var(--radix-popover-content-transform-origin)}.-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-1\\/2{--tw-translate-x:-50%}.rf--translate-x-1\\/2,.rf--translate-y-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-y-1{--tw-translate-y:-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-items-stretch{align-items:stretch}.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-2{border-width:2px}.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-400{--tw-border-opacity:1;border-color:rgb(96 165 250/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-400{--tw-border-opacity:1;border-color:rgb(248 113 113/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-transparent{background-color:transparent}.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-6{padding-bottom:1.5rem;padding-top:1.5rem}.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-0{padding-top:0}.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-normal{font-weight:400!important}.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-100{opacity:1}.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\\=true\\]\\:rf-pointer-events-none[data-disabled=true],.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-\\[selected\\=true\\]\\:rf-bg-zinc-100[data-selected=true]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.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-\\[selected\\=true\\]\\:rf-text-zinc-900[data-selected=true]{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-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\\=true\\]\\:rf-opacity-50[data-disabled=true],.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\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:placeholder\\:rf-text-zinc-400:is(.rf-dark *)::placeholder{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.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-\\[selected\\=true\\]\\:rf-bg-zinc-800[data-selected=true]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-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-\\[selected\\=true\\]\\:rf-text-zinc-50[data-selected=true]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-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-order-1{order:1}.sm\\:rf-order-2{order:2}.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-inline{display:inline}.sm\\:rf-hidden{display:none}.sm\\:rf-w-auto{width:auto}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-items-center{align-items:center}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-gap-3{gap:.75rem}.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-px-4{padding-left:1rem;padding-right:1rem}.sm\\:rf-text-left{text-align:left}.sm\\:rf-text-sm{font-size:.875rem;line-height:1.25rem}.sm\\:rf-text-xl{font-size:1.25rem;line-height:1.75rem}}@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))}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-py-1\\.5 [cmdk-group-heading]{padding-bottom:.375rem;padding-top:.375rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-font-medium [cmdk-group-heading]{font-weight:500}.\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-500 [cmdk-group-heading]{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.dark\\:\\[\\&_\\[cmdk-group-heading\\]\\]\\:rf-text-zinc-400 [cmdk-group-heading]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.\\[\\&_\\[cmdk-group\\]\\:not\\(\\[hidden\\]\\)_\\~\\[cmdk-group\\]\\]\\:rf-pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\\[\\&_\\[cmdk-group\\]\\]\\:rf-px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\\[\\&_\\[cmdk-input-wrapper\\]_svg\\]\\:rf-w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\\[\\&_\\[cmdk-input\\]\\]\\:rf-h-12 [cmdk-input]{height:3rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\\[\\&_\\[cmdk-item\\]\\]\\:rf-py-3 [cmdk-item]{padding-bottom:.75rem;padding-top:.75rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-h-5 [cmdk-item] svg{height:1.25rem}.\\[\\&_\\[cmdk-item\\]_svg\\]\\:rf-w-5 [cmdk-item] svg{width:1.25rem}.\\[\\&_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}',q9n=()=>{rt.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=W9n,document.head.appendChild(e)},[])},X9n=i=>{rt.useEffect(()=>(i?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[i])},Rrt=i=>`hsl(${Ab.indexOf(i)*137.5%360}, 70%, 50%)`,Z9n=({phaseTimings:i})=>{if(!i)return null;const e=Object.values(i).reduce((t,n)=>t+n,0);return je.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[je.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:Ab.map(t=>{const n=i[t]||0,r=n/e*100;return je.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${r}%`,backgroundColor:Rrt(t)},children:je.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)})}),je.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},$9n=({renderLog:i})=>{const[e,t]=rt.useState("chronological");if(!i)return je.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((o,a)=>Ab.indexOf(o[0])-Ab.indexOf(a[0])):n.sort((o,a)=>a[1]-o[1]);const r=n.reduce((o,[a,s])=>o+s,0);return je.jsxs("div",{className:"rf-bg-white",children:[je.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[je.jsx("div",{children:"Render Logs"}),je.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[je.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),je.jsxs("select",{value:e,onChange:o=>t(o.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[je.jsx("option",{value:"chronological",children:"Phase Order"}),je.jsx("option",{value:"longest",children:"Duration"})]})]})]}),je.jsx(Z9n,{phaseTimings:i.phaseTimings}),je.jsxs("table",{className:"rf-w-full rf-text-xs",children:[je.jsx("thead",{children:je.jsxs("tr",{children:[je.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),je.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),je.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),je.jsx("tbody",{children:n.map(([o,a])=>je.jsxs("tr",{children:[je.jsx("td",{className:"rf-p-2",children:Ab.indexOf(o)}),je.jsx("td",{className:"rf-p-2",children:o}),je.jsx("td",{className:"rf-p-2",children:je.jsx("div",{className:"rf-w-8",children:je.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:Rrt(o),width:`${a/r*100}%`}})})}),je.jsx("td",{className:"rf-p-2",children:je.jsxs("div",{className:"rf-flex w-full",children:[je.jsxs("span",{className:"rf-flex-grow",children:[a,"ms"]}),je.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(a/r*100).toFixed(1),"%"]})]})})]},o))})]})]})},Drt=({errorMessage:i,errorStack:e,circuitJsonErrors:t})=>{rt.useEffect(()=>{if(i){const n=new Error(i);e&&(n.stack=e);try{_G.captureException(n)}catch{}}},[i,e]),rt.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{_G.captureException(r,{error_type:n.type})}catch{}}},[t])},exn="0.0.724",dye=aQe()(sQe(i=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:e=>{i({lastRunEvalVersion:e})}}),{name:"runframe-runner-store"})),txn=["assembly","bom","circuit_json","errors","render_log"],nxn=({code:i,fsMap:e,onRunClicked:t=void 0,errorMessage:n,errorStack:r,circuitJson:o,autoroutingGraphics:a,showRightHeaderContent:s=!0,showCodeTab:l=!1,codeTabContent:c,showJsonTab:u=!0,showRenderLogTab:d=!0,onActiveTabChange:f,renderLog:h,showImportAndFormatButtons:g=!0,className:y,headerClassName:v,leftHeaderContent:_,readOnly:x,isStreaming:S,autoroutingLog:M,onReportAutoroutingLog:z,isRunningCode:U,hasCodeChangedSinceLastRun:H,onEditEvent:k,editEvents:j,defaultActiveTab:G,defaultTab:ee,availableTabs:K,autoRotate3dViewerDisabled:ie,showSchematicDebugGrid:ce=!1,showToggleFullScreen:ue=!0,defaultToFullScreen:le=!1,activeEffectName:_e})=>{var We;q9n();const ye=dye($e=>$e.lastRunEvalVersion),Qe=rt.useMemo(()=>o?o.filter($e=>$e&&"error_type"in $e||$e.type.includes("error")):null,[o]),Me=rt.useMemo(()=>o?o.filter($e=>$e&&"warning_type"in $e||$e.type.includes("warning")):null,[o]);Drt({errorMessage:n,errorStack:r,circuitJsonErrors:Qe});const[Te,Ee]=rt.useState(G??ee??(K==null?void 0:K[0])??"pcb"),[Ge,Ke]=rt.useState(null),[nt,lt]=rt.useState(le);X9n(nt);const Rt=rt.useCallback($e=>{Ee($e),f==null||f($e)},[f]),pt=()=>{lt(!nt)};rt.useEffect(()=>{n&&(Te!=="errors"&&Ke(Te),Rt("errors"))},[n]),rt.useEffect(()=>{(Te==="code"||Te==="errors")&&o&&!n&&Rt(Ge??G??ee??(K==null?void 0:K[0])??"pcb")},[o]);const Fe=rt.useCallback($e=>{window.TSCIRCUIT_3D_OBJECT_REF=$e===null?void 0:$e},[]);return je.jsx("div",{className:ip("flex flex-col relative rf-overflow-x-hidden rf-h-full",y),children:je.jsx("div",{className:ip("rf-md:sticky rf-md:top-2 rf-h-full",nt&&"rf-fixed rf-top-0 rf-left-0 rf-w-full rf-h-full rf-bg-white rf-overflow-hidden"),children:je.jsxs(Iie,{value:Te,onValueChange:Rt,className:"rf-flex-grow rf-flex rf-flex-col rf-h-full",children:[je.jsxs("div",{className:ip("rf-flex rf-items-center rf-gap-2 rf-p-2 rf-pb-0",v),children:[_,_&&je.jsx("div",{className:"rf-flex-grow"}),!_&&U&&je.jsx(vM,{className:"rf-w-4 rf-h-4 rf-animate-spin"}),!_&&je.jsx("div",{className:"rf-flex-grow"}),h&&h.progress!==1&&!n&&je.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[_e?je.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:_e}):h.lastRenderEvent&&je.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:((We=h.lastRenderEvent)==null?void 0:We.phase)??""}),je.jsx("div",{className:"rf-w-4 rf-h-4 rf-bg-blue-500 rf-opacity-50 rf-rounded-full rf-text-white",children:je.jsx(vM,{className:"rf-w-4 rf-h-4 rf-animate-spin"})}),je.jsxs("div",{className:"rf-text-xs rf-font-bold rf-text-gray-700 rf-tabular-nums",children:[((h.progress??0)*100).toFixed(1),"%"]})]}),s&&je.jsxs(CG,{children:[l&&je.jsx(zB,{value:"code",children:"Code"}),!K||K.includes("pcb")?je.jsxs(zB,{value:"pcb",className:"rf-whitespace-nowrap",children:[o&&je.jsx("span",{className:ip("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",H?"rf-bg-gray-500":"rf-bg-blue-500")}),"PCB"]}):null,!K||K.includes("schematic")?je.jsxs(zB,{value:"schematic",className:"rf-whitespace-nowrap",children:[o&&je.jsx("span",{className:ip("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",H?"rf-bg-gray-500":"rf-bg-blue-500")}),"Schematic"]}):null,!K||K.includes("cad")?je.jsxs(zB,{value:"cad",children:[o&&je.jsx("span",{className:ip("inline-flex items-center justify-center w-2 h-2 mr-1 text-xs font-bold text-white rounded-full",H?"rf-bg-gray-500":"rf-bg-blue-500")}),"3D"]}):null,!["pcb","cad","schematic"].includes(Te)&&je.jsx(zB,{value:Te,children:hNe(Te)}),je.jsxs(mge,{children:[je.jsx(yge,{asChild:!0,children:je.jsxs("div",{className:"rf-whitespace-nowrap rf-p-2 rf-mr-1 rf-cursor-pointer rf-relative",children:[je.jsx(Chn,{className:"rf-w-4 rf-h-4"}),(Qe&&Qe.length>0||n)&&je.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"})]})}),je.jsxs(iV,{className:"rf-*:text-xs",children:[txn.filter($e=>!K||K.includes($e)).map($e=>je.jsxs(i2,{onSelect:()=>Rt($e),children:[Te!==$e&&je.jsx(_Ze,{className:"rf-w-3 rf-h-3 rf-opacity-30"}),Te===$e&&je.jsx(RY,{className:"rf-w-3 rf-h-3"}),je.jsx("div",{className:"rf-pr-2",children:hNe($e)}),$e==="errors"&&(Qe&&Qe.length>0||n)&&je.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:n?1:Qe==null?void 0:Qe.length})]},$e)),je.jsx(i2,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:je.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/runframe@",exn.split(".").map(($e,_t)=>_t===2?parseInt($e)+1:$e).join(".")]})}),ye&&je.jsx(i2,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:je.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/eval@",ye]})})]})]})]}),ue&&je.jsx(jC,{onClick:pt,variant:"ghost",children:nt?je.jsx(Bhn,{size:16}):je.jsx(Ehn,{size:16})})]}),l&&je.jsx(C2,{value:"code",className:"rf-flex-grow rf-overflow-hidden",children:je.jsx("div",{className:"rf-h-full",children:c})}),(!K||K.includes("pcb"))&&je.jsx(C2,{value:"pcb",children:je.jsx("div",{className:ip("rf-overflow-hidden",nt?"rf-h-[calc(100vh-52px)]":"rf-h-full"),children:je.jsx(uD,{fallbackRender:({error:$e})=>je.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading PCB viewer"}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:($e==null?void 0:$e.message)||"An unknown error occurred"})]})}),children:o?je.jsx(J9n,{focusOnHover:!1,circuitJson:o,debugGraphics:a,containerClassName:ip("rf-h-full rf-w-full",nt?"rf-min-h-[calc(100vh-240px)]":"rf-min-h-[620px]"),onEditEventsChanged:$e=>{if(k)for(const _t of $e)k(_t)}}):je.jsx(xM,{onRunClicked:t})})})}),(!K||K.includes("assembly"))&&je.jsx(C2,{value:"assembly",children:je.jsx("div",{className:ip("rf-overflow-auto",nt?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(uD,{fallback:je.jsx("div",{children:"Error loading Assembly"}),children:o?je.jsx(nvn,{circuitJson:o,containerStyle:{height:"100%"},editingEnabled:!0,debugGrid:!0}):je.jsx(xM,{onRunClicked:t})})})}),(!K||K.includes("schematic"))&&je.jsx(C2,{value:"schematic",children:je.jsx("div",{className:ip("rf-overflow-auto rf-bg-white",nt?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(uD,{fallbackRender:({error:$e})=>je.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Schematic"}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:($e==null?void 0:$e.message)||"An unknown error occurred"})]})}),children:o?je.jsx($yn,{circuitJson:o,containerStyle:{height:"100%"},editingEnabled:!0,onEditEvent:$e=>{k==null||k($e)},debugGrid:ce}):je.jsx(xM,{onRunClicked:t})})})}),(!K||K.includes("cad"))&&je.jsx(C2,{value:"cad",children:je.jsx("div",{className:ip("rf-overflow-auto",nt?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(uD,{FallbackComponent:chn,children:o?je.jsx(shn,{ref:Fe,circuitJson:o,autoRotateDisabled:ie}):je.jsx(xM,{onRunClicked:t})})})}),(!K||K.includes("bom"))&&je.jsx(C2,{value:"bom",children:je.jsx("div",{className:ip("rf-overflow-auto",nt?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(uD,{fallbackRender:({error:$e})=>je.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:je.jsxs("div",{className:"rf-p-4",children:[je.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Bill of Materials"}),je.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:($e==null?void 0:$e.message)||"An unknown error occurred"})]})}),children:o?je.jsx(svn,{circuitJson:o}):je.jsx(xM,{onRunClicked:t})})})}),(!K||K.includes("circuit_json"))&&je.jsx(C2,{value:"circuit_json",children:je.jsx("div",{className:ip("rf-overflow-auto",nt?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:je.jsx(uD,{fallback:je.jsx("div",{children:"Error loading JSON viewer"}),children:o?je.jsx(ovn,{elements:o}):je.jsx(xM,{onRunClicked:t})})})}),(!K||K.includes("errors"))&&je.jsx(C2,{value:"errors",children:je.jsx("div",{className:ip("rf-overflow-auto",nt?"rf-h-screen":"rf-h-full rf-min-h-[620px]"),children:n||Qe&&Qe.length>0||o?je.jsx(hmn,{code:i,fsMap:e,circuitJsonErrors:Qe,circuitJsonWarnings:Me,errorMessage:n,errorStack:r,circuitJson:o,evalVersion:ye,autoroutingLog:M,onReportAutoroutingLog:z}):je.jsx(xM,{onRunClicked:t})})}),d&&(!K||K.includes("render_log"))&&je.jsx(C2,{value:"render_log",children:je.jsx($9n,{renderLog:h})})]})})})};var ej="Dialog",[Nrt,Trt]=NB(ej),[ixn,cB]=Nrt(ej),Prt=i=>{const{__scopeDialog:e,children:t,open:n,defaultOpen:r,onOpenChange:o,modal:a=!0}=i,s=rt.useRef(null),l=rt.useRef(null),[c,u]=t4({prop:n,defaultProp:r??!1,onChange:o,caller:ej});return je.jsx(ixn,{scope:e,triggerRef:s,contentRef:l,contentId:dE(),titleId:dE(),descriptionId:dE(),open:c,onOpenChange:u,onOpenToggle:rt.useCallback(()=>u(d=>!d),[u]),modal:a,children:t})};Prt.displayName=ej;var krt="DialogTrigger",Lrt=rt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=cB(krt,t),o=_C(e,r.triggerRef);return je.jsx(_y.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":hye(r.open),...n,ref:o,onClick:Fp(i.onClick,r.onOpenToggle)})});Lrt.displayName=krt;var Aye="DialogPortal",[rxn,Frt]=Nrt(Aye,{forceMount:void 0}),Urt=i=>{const{__scopeDialog:e,forceMount:t,children:n,container:r}=i,o=cB(Aye,e);return je.jsx(rxn,{scope:e,forceMount:t,children:rt.Children.map(n,a=>je.jsx(y2,{present:t||o.open,children:je.jsx(YY,{asChild:!0,container:r,children:a})}))})};Urt.displayName=Aye;var tj="DialogOverlay",Grt=rt.forwardRef((i,e)=>{const t=Frt(tj,i.__scopeDialog),{forceMount:n=t.forceMount,...r}=i,o=cB(tj,i.__scopeDialog);return o.modal?je.jsx(y2,{present:n||o.open,children:je.jsx(axn,{...r,ref:e})}):null});Grt.displayName=tj;var oxn=e4("DialogOverlay.RemoveScroll"),axn=rt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=cB(tj,t);return je.jsx(ZY,{as:oxn,allowPinchZoom:!0,shards:[r.contentRef],children:je.jsx(_y.div,{"data-state":hye(r.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),NM="DialogContent",Ort=rt.forwardRef((i,e)=>{const t=Frt(NM,i.__scopeDialog),{forceMount:n=t.forceMount,...r}=i,o=cB(NM,i.__scopeDialog);return je.jsx(y2,{present:n||o.open,children:o.modal?je.jsx(sxn,{...r,ref:e}):je.jsx(lxn,{...r,ref:e})})});Ort.displayName=NM;var sxn=rt.forwardRef((i,e)=>{const t=cB(NM,i.__scopeDialog),n=rt.useRef(null),r=_C(e,t.contentRef,n);return rt.useEffect(()=>{const o=n.current;if(o)return ige(o)},[]),je.jsx(zrt,{...i,ref:r,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Fp(i.onCloseAutoFocus,o=>{var a;o.preventDefault(),(a=t.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Fp(i.onPointerDownOutside,o=>{const a=o.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&o.preventDefault()}),onFocusOutside:Fp(i.onFocusOutside,o=>o.preventDefault())})}),lxn=rt.forwardRef((i,e)=>{const t=cB(NM,i.__scopeDialog),n=rt.useRef(!1),r=rt.useRef(!1);return je.jsx(zrt,{...i,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,s;(a=i.onCloseAutoFocus)==null||a.call(i,o),o.defaultPrevented||(n.current||(s=t.triggerRef.current)==null||s.focus(),o.preventDefault()),n.current=!1,r.current=!1},onInteractOutside:o=>{var l,c;(l=i.onInteractOutside)==null||l.call(i,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=o.target;((c=t.triggerRef.current)==null?void 0:c.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&r.current&&o.preventDefault()}})}),zrt=rt.forwardRef((i,e)=>{const{__scopeDialog:t,trapFocus:n,onOpenAutoFocus:r,onCloseAutoFocus:o,...a}=i,s=cB(NM,t),l=rt.useRef(null),c=_C(e,l);return L0e(),je.jsxs(je.Fragment,{children:[je.jsx(NY,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:r,onUnmountAutoFocus:o,children:je.jsx(DY,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":hye(s.open),...a,ref:c,onDismiss:()=>s.onOpenChange(!1)})}),je.jsxs(je.Fragment,{children:[je.jsx(uxn,{titleId:s.titleId}),je.jsx(Axn,{contentRef:l,descriptionId:s.descriptionId})]})]})}),fye="DialogTitle",Hrt=rt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=cB(fye,t);return je.jsx(_y.h2,{id:r.titleId,...n,ref:e})});Hrt.displayName=fye;var Yrt="DialogDescription",Vrt=rt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=cB(Yrt,t);return je.jsx(_y.p,{id:r.descriptionId,...n,ref:e})});Vrt.displayName=Yrt;var jrt="DialogClose",Krt=rt.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=cB(jrt,t);return je.jsx(_y.button,{type:"button",...n,ref:e,onClick:Fp(i.onClick,()=>r.onOpenChange(!1))})});Krt.displayName=jrt;function hye(i){return i?"open":"closed"}var Jrt="DialogTitleWarning",[cxn,Wrt]=yTt(Jrt,{contentName:NM,titleName:fye,docsSlug:"dialog"}),uxn=({titleId:i})=>{const e=Wrt(Jrt),t=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
13516
13516
 
13517
13517
  If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
13518
13518
 
@@ -13774,7 +13774,7 @@ License: MIT
13774
13774
  `&&(G=`
13775
13775
  `);var Qe=0,Me=!1;this.parse=function(Te,Ee,Ge){if(typeof Te!="string")throw new Error("Input must be a string");var Ke=Te.length,nt=j.length,lt=G.length,Rt=ee.length,pt=H(K),Fe=[],We=[],$e=[],_t=Qe=0;if(!Te)return Tn();if(ce||ce!==!1&&Te.indexOf(_e)===-1){for(var Tt=Te.split(G),yt=0;yt<Tt.length;yt++){if($e=Tt[yt],Qe+=$e.length,yt!==Tt.length-1)Qe+=G.length;else if(Ge)return Tn();if(!ee||$e.substring(0,Rt)!==ee){if(pt){if(Fe=[],on($e.split(j)),Vn(),Me)return Tn()}else on($e.split(j));if(ie&&ie<=yt)return Fe=Fe.slice(0,ie),Tn(!0)}}return Tn()}for(var tt=Te.indexOf(j,Qe),Pt=Te.indexOf(G,Qe),Et=new RegExp(v(ye)+v(_e),"g"),Dt=Te.indexOf(_e,Qe);;)if(Te[Qe]===_e)for(Dt=Qe,Qe++;;){if((Dt=Te.indexOf(_e,Dt+1))===-1)return Ge||We.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Fe.length,index:Qe}),It();if(Dt===Ke-1)return It(Te.substring(Qe,Dt).replace(Et,_e));if(_e===ye&&Te[Dt+1]===ye)Dt++;else if(_e===ye||Dt===0||Te[Dt-1]!==ye){tt!==-1&&tt<Dt+1&&(tt=Te.indexOf(j,Dt+1));var Ht=ft((Pt=Pt!==-1&&Pt<Dt+1?Te.indexOf(G,Dt+1):Pt)===-1?tt:Math.min(tt,Pt));if(Te.substr(Dt+1+Ht,nt)===j){$e.push(Te.substring(Qe,Dt).replace(Et,_e)),Te[Qe=Dt+1+Ht+nt]!==_e&&(Dt=Te.indexOf(_e,Qe)),tt=Te.indexOf(j,Qe),Pt=Te.indexOf(G,Qe);break}if(Ht=ft(Pt),Te.substring(Dt+1+Ht,Dt+1+Ht+lt)===G){if($e.push(Te.substring(Qe,Dt).replace(Et,_e)),Yt(Dt+1+Ht+lt),tt=Te.indexOf(j,Qe),Dt=Te.indexOf(_e,Qe),pt&&(Vn(),Me))return Tn();if(ie&&Fe.length>=ie)return Tn(!0);break}We.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Fe.length,index:Qe}),Dt++}}else if(ee&&$e.length===0&&Te.substring(Qe,Qe+Rt)===ee){if(Pt===-1)return Tn();Qe=Pt+lt,Pt=Te.indexOf(G,Qe),tt=Te.indexOf(j,Qe)}else if(tt!==-1&&(tt<Pt||Pt===-1))$e.push(Te.substring(Qe,tt)),Qe=tt+nt,tt=Te.indexOf(j,Qe);else{if(Pt===-1)break;if($e.push(Te.substring(Qe,Pt)),Yt(Pt+lt),pt&&(Vn(),Me))return Tn();if(ie&&Fe.length>=ie)return Tn(!0)}return It();function on(Xn){Fe.push(Xn),_t=Qe}function ft(Xn){var wi=0;return wi=Xn!==-1&&(Xn=Te.substring(Dt+1,Xn))&&Xn.trim()===""?Xn.length:wi}function It(Xn){return Ge||(Xn===void 0&&(Xn=Te.substring(Qe)),$e.push(Xn),Qe=Ke,on($e),pt&&Vn()),Tn()}function Yt(Xn){Qe=Xn,on($e),$e=[],Pt=Te.indexOf(G,Qe)}function Tn(Xn){if(k.header&&!Ee&&Fe.length&&!le){var wi=Fe[0],Yi=Object.create(null),Oi=new Set(wi);let dn=!1;for(let Bn=0;Bn<wi.length;Bn++){let ri=wi[Bn];if(Yi[ri=H(k.transformHeader)?k.transformHeader(ri,Bn):ri]){let Jn,Li=Yi[ri];for(;Jn=ri+"_"+Li,Li++,Oi.has(Jn););Oi.add(Jn),wi[Bn]=Jn,Yi[ri]++,dn=!0,(ue=ue===null?{}:ue)[Jn]=ri}else Yi[ri]=1,wi[Bn]=ri;Oi.add(ri)}dn&&console.warn("Duplicate headers found and renamed."),le=!0}return{data:Fe,errors:We,meta:{delimiter:j,linebreak:G,aborted:Me,truncated:!!Xn,cursor:_t+(Ee||0),renamedHeaders:ue}}}function Vn(){K(Tn()),Fe=[],We=[]}},this.abort=function(){Me=!0},this.getCharIndex=function(){return Qe}}function x(k){var j=k.data,G=s[j.workerId],ee=!1;if(j.error)G.userError(j.error,j.file);else if(j.results&&j.results.data){var K={abort:function(){ee=!0,S(j.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:M,resume:M};if(H(G.userStep)){for(var ie=0;ie<j.results.data.length&&(G.userStep({data:j.results.data[ie],errors:j.results.errors,meta:j.results.meta},K),!ee);ie++);delete j.results}else H(G.userChunk)&&(G.userChunk(j.results,K,j.file),delete j.results)}j.finished&&!ee&&S(j.workerId,j.results)}function S(k,j){var G=s[k];H(G.userComplete)&&G.userComplete(j),G.terminate(),delete s[k]}function M(){throw new Error("Not implemented.")}function z(k){if(typeof k!="object"||k===null)return k;var j,G=Array.isArray(k)?[]:{};for(j in k)G[j]=z(k[j]);return G}function U(k,j){return function(){k.apply(j,arguments)}}function H(k){return typeof k=="function"}return c.parse=function(k,j){var G=(j=j||{}).dynamicTyping||!1;if(H(G)&&(j.dynamicTypingFunction=G,G={}),j.dynamicTyping=G,j.transform=!!H(j.transform)&&j.transform,!j.worker||!c.WORKERS_SUPPORTED)return G=null,c.NODE_STREAM_INPUT,typeof k=="string"?(k=(ee=>ee.charCodeAt(0)!==65279?ee:ee.slice(1))(k),G=new(j.download?d:h)(j)):k.readable===!0&&H(k.read)&&H(k.on)?G=new g(j):(n.File&&k instanceof File||k instanceof Object)&&(G=new f(j)),G.stream(k);(G=(()=>{var ee;return!!c.WORKERS_SUPPORTED&&(ee=(()=>{var K=n.URL||n.webkitURL||null,ie=t.toString();return c.BLOB_URL||(c.BLOB_URL=K.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",ie,")();"],{type:"text/javascript"})))})(),(ee=new n.Worker(ee)).onmessage=x,ee.id=l++,s[ee.id]=ee)})()).userStep=j.step,G.userChunk=j.chunk,G.userComplete=j.complete,G.userError=j.error,j.step=H(j.step),j.chunk=H(j.chunk),j.complete=H(j.complete),j.error=H(j.error),delete j.worker,G.postMessage({input:k,config:j,workerId:G.id})},c.unparse=function(k,j){var G=!1,ee=!0,K=",",ie=`\r
13776
13776
  `,ce='"',ue=ce+ce,le=!1,_e=null,ye=!1,Qe=((()=>{if(typeof j=="object"){if(typeof j.delimiter!="string"||c.BAD_DELIMITERS.filter(function(Ee){return j.delimiter.indexOf(Ee)!==-1}).length||(K=j.delimiter),typeof j.quotes!="boolean"&&typeof j.quotes!="function"&&!Array.isArray(j.quotes)||(G=j.quotes),typeof j.skipEmptyLines!="boolean"&&typeof j.skipEmptyLines!="string"||(le=j.skipEmptyLines),typeof j.newline=="string"&&(ie=j.newline),typeof j.quoteChar=="string"&&(ce=j.quoteChar),typeof j.header=="boolean"&&(ee=j.header),Array.isArray(j.columns)){if(j.columns.length===0)throw new Error("Option columns is empty");_e=j.columns}j.escapeChar!==void 0&&(ue=j.escapeChar+ce),j.escapeFormulae instanceof RegExp?ye=j.escapeFormulae:typeof j.escapeFormulae=="boolean"&&j.escapeFormulae&&(ye=/^[=+\-@\t\r].*$/)}})(),new RegExp(v(ce),"g"));if(typeof k=="string"&&(k=JSON.parse(k)),Array.isArray(k)){if(!k.length||Array.isArray(k[0]))return Me(null,k,le);if(typeof k[0]=="object")return Me(_e||Object.keys(k[0]),k,le)}else if(typeof k=="object")return typeof k.data=="string"&&(k.data=JSON.parse(k.data)),Array.isArray(k.data)&&(k.fields||(k.fields=k.meta&&k.meta.fields||_e),k.fields||(k.fields=Array.isArray(k.data[0])?k.fields:typeof k.data[0]=="object"?Object.keys(k.data[0]):[]),Array.isArray(k.data[0])||typeof k.data[0]=="object"||(k.data=[k.data])),Me(k.fields||[],k.data||[],le);throw new Error("Unable to serialize unrecognized input");function Me(Ee,Ge,Ke){var nt="",lt=(typeof Ee=="string"&&(Ee=JSON.parse(Ee)),typeof Ge=="string"&&(Ge=JSON.parse(Ge)),Array.isArray(Ee)&&0<Ee.length),Rt=!Array.isArray(Ge[0]);if(lt&&ee){for(var pt=0;pt<Ee.length;pt++)0<pt&&(nt+=K),nt+=Te(Ee[pt],pt);0<Ge.length&&(nt+=ie)}for(var Fe=0;Fe<Ge.length;Fe++){var We=(lt?Ee:Ge[Fe]).length,$e=!1,_t=lt?Object.keys(Ge[Fe]).length===0:Ge[Fe].length===0;if(Ke&&!lt&&($e=Ke==="greedy"?Ge[Fe].join("").trim()==="":Ge[Fe].length===1&&Ge[Fe][0].length===0),Ke==="greedy"&&lt){for(var Tt=[],yt=0;yt<We;yt++){var tt=Rt?Ee[yt]:yt;Tt.push(Ge[Fe][tt])}$e=Tt.join("").trim()===""}if(!$e){for(var Pt=0;Pt<We;Pt++){0<Pt&&!_t&&(nt+=K);var Et=lt&&Rt?Ee[Pt]:Pt;nt+=Te(Ge[Fe][Et],Pt)}Fe<Ge.length-1&&(!Ke||0<We&&!_t)&&(nt+=ie)}}return nt}function Te(Ee,Ge){var Ke,nt;return Ee==null?"":Ee.constructor===Date?JSON.stringify(Ee).slice(1,25):(nt=!1,ye&&typeof Ee=="string"&&ye.test(Ee)&&(Ee="'"+Ee,nt=!0),Ke=Ee.toString().replace(Qe,ue),(nt=nt||G===!0||typeof G=="function"&&G(Ee,Ge)||Array.isArray(G)&&G[Ge]||((lt,Rt)=>{for(var pt=0;pt<Rt.length;pt++)if(-1<lt.indexOf(Rt[pt]))return!0;return!1})(Ke,c.BAD_DELIMITERS)||-1<Ke.indexOf(K)||Ke.charAt(0)===" "||Ke.charAt(Ke.length-1)===" ")?ce+Ke+ce:Ke)}},c.RECORD_SEP="",c.UNIT_SEP="",c.BYTE_ORDER_MARK="\uFEFF",c.BAD_DELIMITERS=["\r",`
13777
- `,'"',c.BYTE_ORDER_MARK],c.WORKERS_SUPPORTED=!o&&!!n.Worker,c.NODE_STREAM_INPUT=1,c.LocalChunkSize=10485760,c.RemoteChunkSize=5242880,c.DefaultDelimiter=",",c.Parser=_,c.ParserHandle=y,c.NetworkStreamer=d,c.FileStreamer=f,c.StringStreamer=h,c.ReadableStreamStreamer=g,n.jQuery&&((r=n.jQuery).fn.parse=function(k){var j=k.config||{},G=[];return this.each(function(ie){if(!(r(this).prop("tagName").toUpperCase()==="INPUT"&&r(this).attr("type").toLowerCase()==="file"&&n.FileReader)||!this.files||this.files.length===0)return!0;for(var ce=0;ce<this.files.length;ce++)G.push({file:this.files[ce],inputElem:this,instanceConfig:r.extend({},j)})}),ee(),this;function ee(){if(G.length===0)H(k.complete)&&k.complete();else{var ie,ce,ue,le,_e=G[0];if(H(k.before)){var ye=k.before(_e.file,_e.inputElem);if(typeof ye=="object"){if(ye.action==="abort")return ie="AbortError",ce=_e.file,ue=_e.inputElem,le=ye.reason,void(H(k.error)&&k.error({name:ie},ce,ue,le));if(ye.action==="skip")return void K();typeof ye.config=="object"&&(_e.instanceConfig=r.extend(_e.instanceConfig,ye.config))}else if(ye==="skip")return void K()}var Qe=_e.instanceConfig.complete;_e.instanceConfig.complete=function(Me){H(Qe)&&Qe(Me,_e.file,_e.inputElem),K()},c.parse(_e.file,_e.instanceConfig)}}function K(){G.splice(0,1),ee()}}),a&&(n.onmessage=function(k){k=k.data,c.WORKER_ID===void 0&&k&&(c.WORKER_ID=k.workerId),typeof k.input=="string"?n.postMessage({workerId:c.WORKER_ID,results:c.parse(k.input,k.config),finished:!0}):(n.File&&k.input instanceof File||k.input instanceof Object)&&(k=c.parse(k.input,k.config))&&n.postMessage({workerId:c.WORKER_ID,results:k,finished:!0})}),(d.prototype=Object.create(u.prototype)).constructor=d,(f.prototype=Object.create(u.prototype)).constructor=f,(h.prototype=Object.create(h.prototype)).constructor=h,(g.prototype=Object.create(u.prototype)).constructor=g,c})}(Qj)),Qj.exports}var wBn=SBn();const Hat=e9(wBn);var MBn=async({circuitJson:i,resolvePart:e})=>{const t=[];for(const n of i){if(n.type!=="pcb_component")continue;const r=i.find(s=>s.type==="source_component"&&s.source_component_id===n.source_component_id);if(!r)continue;const o=await(e==null?void 0:e({pcb_component:n,source_component:r}))??{};let a="";r.ftype==="simple_resistor"&&(a=Yat(r.resistance)),r.ftype==="simple_capacitor"&&(a=Yat(r.capacitance)),t.push({designator:r.name??n.pcb_component_id,comment:a,value:a,footprint:o.footprint||"",supplier_part_number_columns:o.supplier_part_number_columns??r.supplier_part_numbers?QBn(r.supplier_part_numbers):void 0})}return t};function QBn(i){const e={};return i!=null&&i.jlcpcb&&(e["JLCPCB Part #"]=i.jlcpcb[0]),i!=null&&i.lcsc&&(e["JLCPCB Part #"]=i.lcsc[0]),e}function Yat(i){return i==null?"":typeof i=="string"?i:bBn.formatSI(i)}var RBn=i=>{const e=i.map(n=>{const r=n.supplier_part_number_columns;return Object.values(r||{}).join(", "),Object.entries(n.extra_columns||{}).map(([o,a])=>`${o}: ${a}`).join(", "),{Designator:n.designator,Comment:n.comment,Value:n.value,Footprint:n.footprint,...r}}),t=["Designator","Comment","Value","Footprint"];for(const n of e)for(const r in n)t.includes(r)||t.push(r);return Hat.unparse(e,{columns:t})},Vat=3,DBn=(i,e={})=>{e.flip_y_axis??(e.flip_y_axis=!1);const t=[];for(const n of i)if(n.type==="pcb_component"){const r=Nv(i).source_component.get(n.source_component_id);t.push({designator:(r==null?void 0:r.name)??n.pcb_component_id,mid_x:n.center.x,mid_y:n.center.y*(e.flip_y_axis?-1:1),layer:n.layer,rotation:n.rotation})}return t},NBn=i=>Hat.unparse(DBn(i).map(e=>({Designator:e.designator,"Mid X":e.mid_x.toFixed(Vat),"Mid Y":e.mid_y.toFixed(Vat),Layer:e.layer,Rotation:e.rotation})));const jat=(i,e)=>{const{fileName:t,mimeType:n="text/plain"}=e,r=i instanceof Blob?i:new Blob([i],{type:n}),o=URL.createObjectURL(r),a=document.createElement("a");a.href=o,a.download=t,document.body.appendChild(a),a.click(),setTimeout(()=>{document.body.removeChild(a),URL.revokeObjectURL(o)},0)},TBn=async({circuitJson:i,projectName:e})=>{const t=new t2n,n=CBn(i,{flip_y_axis:!1}),r=ABn(n);for(const[d,f]of Object.entries(r))t.file(`gerber/${d}.gbr`,f);const o=R2n({circuitJson:i,is_plated:!0,flip_y_axis:!1}),a=w2n(o);t.file("gerber/drill.drl",a);const s=await MBn({circuitJson:i}),l=await RBn(s);t.file("bom.csv",l);const c=await NBn(i);t.file("pick_and_place.csv",c);const u=await t.generateAsync({type:"blob"});jat(u,{fileName:`${e}_fabrication_files.zip`})},PBn=[{extension:"json",name:"Circuit JSON"},{extension:"zip",name:"Fabrication Files"}],kBn=async({exportName:i,circuitJson:e,projectName:t})=>{if(i==="Fabrication Files"){TBn({circuitJson:e,projectName:t});return}if(i==="Circuit JSON"){jat(JSON.stringify(e,null,2),{fileName:`${t}.circuit.json`,mimeType:"application/json"});return}throw new Error(`Unsupported export type: "${i}"`)},LBn=({packageName:i,onSelectReview:e})=>{const t=Yb(d=>d.fsMap),n=Yb(d=>d.circuitJson),[r,o]=rt.useState([]),[a,s]=rt.useState(!1),[l,c]=rt.useState(!1);rt.useEffect(()=>{!i||!Nye()||(s(!0),nP.get("ai_reviews/list",{searchParams:{package_name:i}}).json().then(d=>o(d.ai_reviews)).catch(d=>{console.error("Failed to load AI reviews",d),BC.error("Failed to load AI reviews")}).finally(()=>s(!1)))},[i]);const u=async()=>{if(!n){BC.error("Need Circuit JSON to Request AI Review");return}if(!Nye()){BC.error("Missing registry token");return}c(!0);try{const{ai_review:d}=await nP.post("ai_reviews/create",{json:{package_name:i??"unknown",fs_map:Object.fromEntries(t),circuit_json:n}}).json();o(f=>[d,...f]),e(d),BC.success("AI review requested")}catch(d){console.error("Failed to create AI review",d),BC.error("Failed to request AI review")}finally{c(!1)}};return je.jsxs(je.Fragment,{children:[je.jsxs(W7,{children:[je.jsx(q7,{children:"AI Review"}),je.jsx(vye,{children:"Select an AI review or request a new one."})]}),je.jsx("div",{className:"rf-flex rf-gap-4 rf-mt-4",children:je.jsx("div",{className:"rf-w-48 rf-h-64 rf-overflow-y-auto rf-border rf-rounded rf-p-2 rf-flex-shrink-0",children:a?je.jsx("div",{className:"rf-text-sm",children:"Loading..."}):r.length>0?r.map(d=>je.jsx("div",{className:"rf-text-sm rf-p-2 rf-cursor-pointer rf-rounded hover:rf-bg-zinc-100",onClick:()=>e(d),children:new Date(d.created_at||"").toLocaleString()},d.ai_review_id)):je.jsx("div",{className:"rf-text-sm rf-text-muted-foreground",children:"No AI reviews found."})})}),je.jsx(oj,{className:"rf-mt-4",children:je.jsx(jC,{onClick:u,disabled:l,children:l?"Requesting...":"Review my Board"})})]})};function Vye(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var FM=Vye();function Kat(i){FM=i}var oP={exec:()=>null};function q_(i,e=""){let t=typeof i=="string"?i:i.source;const n={replace:(r,o)=>{let a=typeof o=="string"?o:o.source;return a=a.replace(jE.caret,"$1"),t=t.replace(r,a),n},getRegex:()=>new RegExp(t,e)};return n}var jE={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}#`),htmlBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}<(?:[a-z].*>|!--)`,"i")},FBn=/^(?:[ \t]*(?:\n|$))+/,UBn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,GBn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,aP=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,OBn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,jye=/(?:[*+-]|\d{1,9}[.)])/,Jat=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Wat=q_(Jat).replace(/bull/g,jye).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),zBn=q_(Jat).replace(/bull/g,jye).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Kye=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,HBn=/^[^\n]+/,Jye=/(?!\s*\])(?:\\.|[^\[\]\\])+/,YBn=q_(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Jye).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),VBn=q_(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,jye).getRegex(),Rj="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Wye=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,jBn=q_("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Wye).replace("tag",Rj).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),qat=q_(Kye).replace("hr",aP).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Rj).getRegex(),KBn=q_(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",qat).getRegex(),qye={blockquote:KBn,code:UBn,def:YBn,fences:GBn,heading:OBn,hr:aP,html:jBn,lheading:Wat,list:VBn,newline:FBn,paragraph:qat,table:oP,text:HBn},Xat=q_("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",aP).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Rj).getRegex(),JBn={...qye,lheading:zBn,table:Xat,paragraph:q_(Kye).replace("hr",aP).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Xat).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Rj).getRegex()},WBn={...qye,html:q_(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Wye).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:oP,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:q_(Kye).replace("hr",aP).replace("heading",` *#{1,6} *[^
13777
+ `,'"',c.BYTE_ORDER_MARK],c.WORKERS_SUPPORTED=!o&&!!n.Worker,c.NODE_STREAM_INPUT=1,c.LocalChunkSize=10485760,c.RemoteChunkSize=5242880,c.DefaultDelimiter=",",c.Parser=_,c.ParserHandle=y,c.NetworkStreamer=d,c.FileStreamer=f,c.StringStreamer=h,c.ReadableStreamStreamer=g,n.jQuery&&((r=n.jQuery).fn.parse=function(k){var j=k.config||{},G=[];return this.each(function(ie){if(!(r(this).prop("tagName").toUpperCase()==="INPUT"&&r(this).attr("type").toLowerCase()==="file"&&n.FileReader)||!this.files||this.files.length===0)return!0;for(var ce=0;ce<this.files.length;ce++)G.push({file:this.files[ce],inputElem:this,instanceConfig:r.extend({},j)})}),ee(),this;function ee(){if(G.length===0)H(k.complete)&&k.complete();else{var ie,ce,ue,le,_e=G[0];if(H(k.before)){var ye=k.before(_e.file,_e.inputElem);if(typeof ye=="object"){if(ye.action==="abort")return ie="AbortError",ce=_e.file,ue=_e.inputElem,le=ye.reason,void(H(k.error)&&k.error({name:ie},ce,ue,le));if(ye.action==="skip")return void K();typeof ye.config=="object"&&(_e.instanceConfig=r.extend(_e.instanceConfig,ye.config))}else if(ye==="skip")return void K()}var Qe=_e.instanceConfig.complete;_e.instanceConfig.complete=function(Me){H(Qe)&&Qe(Me,_e.file,_e.inputElem),K()},c.parse(_e.file,_e.instanceConfig)}}function K(){G.splice(0,1),ee()}}),a&&(n.onmessage=function(k){k=k.data,c.WORKER_ID===void 0&&k&&(c.WORKER_ID=k.workerId),typeof k.input=="string"?n.postMessage({workerId:c.WORKER_ID,results:c.parse(k.input,k.config),finished:!0}):(n.File&&k.input instanceof File||k.input instanceof Object)&&(k=c.parse(k.input,k.config))&&n.postMessage({workerId:c.WORKER_ID,results:k,finished:!0})}),(d.prototype=Object.create(u.prototype)).constructor=d,(f.prototype=Object.create(u.prototype)).constructor=f,(h.prototype=Object.create(h.prototype)).constructor=h,(g.prototype=Object.create(u.prototype)).constructor=g,c})}(Qj)),Qj.exports}var wBn=SBn();const Hat=e9(wBn);var MBn=async({circuitJson:i,resolvePart:e})=>{const t=[];for(const n of i){if(n.type!=="pcb_component")continue;const r=i.find(s=>s.type==="source_component"&&s.source_component_id===n.source_component_id);if(!r)continue;const o=await(e==null?void 0:e({pcb_component:n,source_component:r}))??{};let a="";r.ftype==="simple_resistor"&&(a=Yat(r.resistance)),r.ftype==="simple_capacitor"&&(a=Yat(r.capacitance)),t.push({designator:r.name??n.pcb_component_id,comment:a,value:a,footprint:o.footprint||"",supplier_part_number_columns:o.supplier_part_number_columns??r.supplier_part_numbers?QBn(r.supplier_part_numbers):void 0})}return t};function QBn(i){const e={};return i!=null&&i.jlcpcb&&(e["JLCPCB Part #"]=i.jlcpcb[0]),i!=null&&i.lcsc&&(e["JLCPCB Part #"]=i.lcsc[0]),e}function Yat(i){return i==null?"":typeof i=="string"?i:bBn.formatSI(i)}var RBn=i=>{const e=i.map(n=>{const r=n.supplier_part_number_columns;return Object.values(r||{}).join(", "),Object.entries(n.extra_columns||{}).map(([o,a])=>`${o}: ${a}`).join(", "),{Designator:n.designator,Comment:n.comment,Value:n.value,Footprint:n.footprint,...r}}),t=["Designator","Comment","Value","Footprint"];for(const n of e)for(const r in n)t.includes(r)||t.push(r);return Hat.unparse(e,{columns:t})},Vat=3,DBn=(i,e={})=>{e.flip_y_axis??(e.flip_y_axis=!1);const t=[];for(const n of i)if(n.type==="pcb_component"){const r=Nv(i).source_component.get(n.source_component_id);t.push({designator:(r==null?void 0:r.name)??n.pcb_component_id,mid_x:n.center.x,mid_y:n.center.y*(e.flip_y_axis?-1:1),layer:n.layer,rotation:n.rotation})}return t},NBn=i=>Hat.unparse(DBn(i).map(e=>({Designator:e.designator,"Mid X":e.mid_x.toFixed(Vat),"Mid Y":e.mid_y.toFixed(Vat),Layer:e.layer,Rotation:e.rotation})));const jat=(i,e)=>{const{fileName:t,mimeType:n="text/plain"}=e,r=i instanceof Blob?i:new Blob([i],{type:n}),o=URL.createObjectURL(r),a=document.createElement("a");a.href=o,a.download=t,document.body.appendChild(a),a.click(),setTimeout(()=>{document.body.removeChild(a),URL.revokeObjectURL(o)},0)},TBn=async({circuitJson:i,projectName:e})=>{const t=new t2n,n=i.filter(f=>!("error_type"in f)&&!("warning_type"in f)),r=CBn(n,{flip_y_axis:!1}),o=ABn(r);for(const[f,h]of Object.entries(o))t.file(`gerber/${f}.gbr`,h);const a=R2n({circuitJson:n,is_plated:!0,flip_y_axis:!1}),s=w2n(a);t.file("gerber/drill.drl",s);const l=await MBn({circuitJson:i}),c=await RBn(l);t.file("bom.csv",c);const u=await NBn(i);t.file("pick_and_place.csv",u);const d=await t.generateAsync({type:"blob"});jat(d,{fileName:`${e}_fabrication_files.zip`})},PBn=[{extension:"json",name:"Circuit JSON"},{extension:"zip",name:"Fabrication Files"}],kBn=async({exportName:i,circuitJson:e,projectName:t})=>{if(i==="Fabrication Files"){TBn({circuitJson:e,projectName:t});return}if(i==="Circuit JSON"){jat(JSON.stringify(e,null,2),{fileName:`${t}.circuit.json`,mimeType:"application/json"});return}throw new Error(`Unsupported export type: "${i}"`)},LBn=({packageName:i,onSelectReview:e})=>{const t=Yb(d=>d.fsMap),n=Yb(d=>d.circuitJson),[r,o]=rt.useState([]),[a,s]=rt.useState(!1),[l,c]=rt.useState(!1);rt.useEffect(()=>{!i||!Nye()||(s(!0),nP.get("ai_reviews/list",{searchParams:{package_name:i}}).json().then(d=>o(d.ai_reviews)).catch(d=>{console.error("Failed to load AI reviews",d),BC.error("Failed to load AI reviews")}).finally(()=>s(!1)))},[i]);const u=async()=>{if(!n){BC.error("Need Circuit JSON to Request AI Review");return}if(!Nye()){BC.error("Missing registry token");return}c(!0);try{const{ai_review:d}=await nP.post("ai_reviews/create",{json:{package_name:i??"unknown",fs_map:Object.fromEntries(t),circuit_json:n}}).json();o(f=>[d,...f]),e(d),BC.success("AI review requested")}catch(d){console.error("Failed to create AI review",d),BC.error("Failed to request AI review")}finally{c(!1)}};return je.jsxs(je.Fragment,{children:[je.jsxs(W7,{children:[je.jsx(q7,{children:"AI Review"}),je.jsx(vye,{children:"Select an AI review or request a new one."})]}),je.jsx("div",{className:"rf-flex rf-gap-4 rf-mt-4",children:je.jsx("div",{className:"rf-w-48 rf-h-64 rf-overflow-y-auto rf-border rf-rounded rf-p-2 rf-flex-shrink-0",children:a?je.jsx("div",{className:"rf-text-sm",children:"Loading..."}):r.length>0?r.map(d=>je.jsx("div",{className:"rf-text-sm rf-p-2 rf-cursor-pointer rf-rounded hover:rf-bg-zinc-100",onClick:()=>e(d),children:new Date(d.created_at||"").toLocaleString()},d.ai_review_id)):je.jsx("div",{className:"rf-text-sm rf-text-muted-foreground",children:"No AI reviews found."})})}),je.jsx(oj,{className:"rf-mt-4",children:je.jsx(jC,{onClick:u,disabled:l,children:l?"Requesting...":"Review my Board"})})]})};function Vye(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var FM=Vye();function Kat(i){FM=i}var oP={exec:()=>null};function q_(i,e=""){let t=typeof i=="string"?i:i.source;const n={replace:(r,o)=>{let a=typeof o=="string"?o:o.source;return a=a.replace(jE.caret,"$1"),t=t.replace(r,a),n},getRegex:()=>new RegExp(t,e)};return n}var jE={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}#`),htmlBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}<(?:[a-z].*>|!--)`,"i")},FBn=/^(?:[ \t]*(?:\n|$))+/,UBn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,GBn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,aP=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,OBn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,jye=/(?:[*+-]|\d{1,9}[.)])/,Jat=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Wat=q_(Jat).replace(/bull/g,jye).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),zBn=q_(Jat).replace(/bull/g,jye).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Kye=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,HBn=/^[^\n]+/,Jye=/(?!\s*\])(?:\\.|[^\[\]\\])+/,YBn=q_(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Jye).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),VBn=q_(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,jye).getRegex(),Rj="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Wye=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,jBn=q_("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Wye).replace("tag",Rj).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),qat=q_(Kye).replace("hr",aP).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Rj).getRegex(),KBn=q_(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",qat).getRegex(),qye={blockquote:KBn,code:UBn,def:YBn,fences:GBn,heading:OBn,hr:aP,html:jBn,lheading:Wat,list:VBn,newline:FBn,paragraph:qat,table:oP,text:HBn},Xat=q_("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",aP).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Rj).getRegex(),JBn={...qye,lheading:zBn,table:Xat,paragraph:q_(Kye).replace("hr",aP).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Xat).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Rj).getRegex()},WBn={...qye,html:q_(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Wye).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:oP,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:q_(Kye).replace("hr",aP).replace("heading",` *#{1,6} *[^
13778
13778
  ]`).replace("lheading",Wat).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},qBn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,XBn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Zat=/^( {2,}|\\)\n(?!\s*$)/,ZBn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Dj=/[\p{P}\p{S}]/u,Xye=/[\s\p{P}\p{S}]/u,$at=/[^\s\p{P}\p{S}]/u,$Bn=q_(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Xye).getRegex(),est=/(?!~)[\p{P}\p{S}]/u,eSn=/(?!~)[\s\p{P}\p{S}]/u,tSn=/(?:[^\s\p{P}\p{S}]|~)/u,nSn=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,tst=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,iSn=q_(tst,"u").replace(/punct/g,Dj).getRegex(),rSn=q_(tst,"u").replace(/punct/g,est).getRegex(),nst="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",oSn=q_(nst,"gu").replace(/notPunctSpace/g,$at).replace(/punctSpace/g,Xye).replace(/punct/g,Dj).getRegex(),aSn=q_(nst,"gu").replace(/notPunctSpace/g,tSn).replace(/punctSpace/g,eSn).replace(/punct/g,est).getRegex(),sSn=q_("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,$at).replace(/punctSpace/g,Xye).replace(/punct/g,Dj).getRegex(),lSn=q_(/\\(punct)/,"gu").replace(/punct/g,Dj).getRegex(),cSn=q_(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),uSn=q_(Wye).replace("(?:-->|$)","-->").getRegex(),dSn=q_("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",uSn).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Nj=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ASn=q_(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Nj).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ist=q_(/^!?\[(label)\]\[(ref)\]/).replace("label",Nj).replace("ref",Jye).getRegex(),rst=q_(/^!?\[(ref)\](?:\[\])?/).replace("ref",Jye).getRegex(),fSn=q_("reflink|nolink(?!\\()","g").replace("reflink",ist).replace("nolink",rst).getRegex(),Zye={_backpedal:oP,anyPunctuation:lSn,autolink:cSn,blockSkip:nSn,br:Zat,code:XBn,del:oP,emStrongLDelim:iSn,emStrongRDelimAst:oSn,emStrongRDelimUnd:sSn,escape:qBn,link:ASn,nolink:rst,punctuation:$Bn,reflink:ist,reflinkSearch:fSn,tag:dSn,text:ZBn,url:oP},hSn={...Zye,link:q_(/^!?\[(label)\]\((.*?)\)/).replace("label",Nj).getRegex(),reflink:q_(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Nj).getRegex()},$ye={...Zye,emStrongRDelimAst:aSn,emStrongLDelim:rSn,url:q_(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},pSn={...$ye,br:q_(Zat).replace("{2,}","*").getRegex(),text:q_($ye.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Tj={normal:qye,gfm:JBn,pedantic:WBn},sP={normal:Zye,gfm:$ye,breaks:pSn,pedantic:hSn},gSn={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ost=i=>gSn[i];function _S(i,e){if(e){if(jE.escapeTest.test(i))return i.replace(jE.escapeReplace,ost)}else if(jE.escapeTestNoEncode.test(i))return i.replace(jE.escapeReplaceNoEncode,ost);return i}function ast(i){try{i=encodeURI(i).replace(jE.percentDecode,"%")}catch{return null}return i}function sst(i,e){var o;const t=i.replace(jE.findPipe,(a,s,l)=>{let c=!1,u=s;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),n=t.split(jE.splitPipe);let r=0;if(n[0].trim()||n.shift(),n.length>0&&!((o=n.at(-1))!=null&&o.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(jE.slashPipe,"|");return n}function lP(i,e,t){const n=i.length;if(n===0)return"";let r=0;for(;r<n&&i.charAt(n-r-1)===e;)r++;return i.slice(0,n-r)}function mSn(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<i.length;n++)if(i[n]==="\\")n++;else if(i[n]===e[0])t++;else if(i[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function lst(i,e,t,n,r){const o=e.href,a=e.title||null,s=i[1].replace(r.other.outputLinkReplace,"$1");n.state.inLink=!0;const l={type:i[0].charAt(0)==="!"?"image":"link",raw:t,href:o,title:a,text:s,tokens:n.inlineTokens(s)};return n.state.inLink=!1,l}function ySn(i,e,t){const n=i.match(t.other.indentCodeCompensation);if(n===null)return e;const r=n[1];return e.split(`
13779
13779
  `).map(o=>{const a=o.match(t.other.beginningSpace);if(a===null)return o;const[s]=a;return s.length>=r.length?o.slice(r.length):o}).join(`
13780
13780
  `)}var Pj=class{constructor(i){Ce(this,"options");Ce(this,"rules");Ce(this,"lexer");this.options=i||FM}space(i){const e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){const e=this.rules.block.code.exec(i);if(e){const t=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:lP(t,`