@mcpjam/inspector 3.25.1 → 3.25.3

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.
Files changed (28) hide show
  1. package/dist/client/assets/{app-bootstrap-NUHAuQhV.js → app-bootstrap-D8p1xxJL.js} +349 -348
  2. package/dist/client/assets/{chunk-D32TOXHM-DD721INw.js → chunk-D32TOXHM-_lcmAHBS.js} +5 -5
  3. package/dist/client/assets/{dead-clicks-autocapture-0g7bn_r2.js → dead-clicks-autocapture--Cc80oY_.js} +2 -2
  4. package/dist/client/assets/{error-reporting-e2IXoekl.js → error-reporting-B4cQ3ELy.js} +1 -1
  5. package/dist/client/assets/{error-reporting-RuZxlzDb.js → error-reporting-D-VMAV0k.js} +44 -44
  6. package/dist/client/assets/{exception-autocapture-CSedHhr8.js → exception-autocapture-DginYM1x.js} +2 -2
  7. package/dist/client/assets/{first-run-oauth-return-B6apLua6.css → first-run-oauth-return-DZl0Ds5X.css} +1 -1
  8. package/dist/client/assets/{first-run-oauth-return-C9z1PZdO.js → first-run-oauth-return-rF56NddK.js} +3 -3
  9. package/dist/client/assets/{highlighted-body-KQOG7T2V-D8pWcF_9.js → highlighted-body-KQOG7T2V-CXee3ser.js} +2 -2
  10. package/dist/client/assets/{index-Cn2mh3Wt.js → index-82wefelr.js} +3 -3
  11. package/dist/client/assets/{jszip.min-615s08Jt.js → jszip.min-DVVdSEhZ.js} +2 -2
  12. package/dist/client/assets/{mermaid-MCJ5UELQ-CP2WL7Jq.js → mermaid-MCJ5UELQ-DrjPVbUm.js} +1 -1
  13. package/dist/client/assets/{posthog-recorder-Dfj32i9J.js → posthog-recorder-DNy5bFB1.js} +2 -2
  14. package/dist/client/assets/{preload-helper-Cx1qaWZi.js → preload-helper-BYOM8wou.js} +2 -2
  15. package/dist/client/assets/{project-route-eSY9Jjxk.js → project-route-CshTCVmQ.js} +3 -3
  16. package/dist/client/assets/{react-dom-8jLMvrQh.js → react-dom-y0CFBu2J.js} +2 -2
  17. package/dist/client/assets/{rolldown-runtime-C4BN53g5.js → rolldown-runtime-Ck0AUAe_.js} +1 -1
  18. package/dist/client/assets/{surveys-C0qbQIlK.js → surveys-P23Cz34L.js} +2 -2
  19. package/dist/client/assets/telemetry-files-2454aee542431dd3.js +1 -0
  20. package/dist/client/assets/{trace-timeline-BKiCE1_P.js → trace-timeline-CWdGYeWw.js} +1 -1
  21. package/dist/client/assets/{trace-timeline-CJIm22zK.js → trace-timeline-mjuETy67.js} +4 -4
  22. package/dist/client/assets/{use-reduced-motion-BxwRjxNg.js → use-reduced-motion-_Ge9sKbc.js} +2 -2
  23. package/dist/client/assets/{web-vitals-CHmGmjBw.js → web-vitals-DgeVvuPL.js} +2 -2
  24. package/dist/client/index.html +9 -9
  25. package/dist/server/harness-install-cli.js +116 -445
  26. package/dist/server/index.js +2 -2
  27. package/package.json +3 -2
  28. package/dist/client/assets/telemetry-files-da4238acc777adba.js +0 -1
@@ -1,4 +1,4 @@
1
- import{o as Xx}from"./rolldown-runtime-C4BN53g5.js";import{Dt as Ge,Gt as lf,It as nt,Kt as yo,Lt as Mr,Nt as br,Tt as Qt,Ut as ve,Vt as Sl,bt as xo,ft as zc,mt as GE,wt as Jx}from"./project-route-eSY9Jjxk.js";import{Dt as QE,Gt as Wn,Ht as cf,Jt as YE,Kt as XE,Ot as JE,T as ZE,Ut as In,Wt as sc,Z as Zx,Zi as eM,c as tM,ds as nM,et as rM,fs as iM,ms as eb,ot as Mg,ps as tb,qt as sM,t as oM,w as Rg,y as aM}from"./error-reporting-RuZxlzDb.js";import{A as cs,C as lM,D as G,H as cM,I as nb,N as Ce,O as uM,S as hM,T as Ot,V as Mp,i as fM,j as dM,k as pM,n as mM,r as gM,t as vM,w as xe,z as yM}from"./use-reduced-motion-BxwRjxNg.js";import{n as xM,t as bM}from"./react-dom-8jLMvrQh.js";import{i as wM}from"./preload-helper-Cx1qaWZi.js";import{a as SM,c as kM,n as CM,o as AM}from"./chunk-D32TOXHM-DD721INw.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"3.25.1"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c80ceb55-37e6-46cf-9417-4ede68dcfb2b",e._sentryDebugIdIdentifier="sentry-dbid-c80ceb55-37e6-46cf-9417-4ede68dcfb2b")}catch{}})();var g=Xx(xM(),1),pa=Xx(bM(),1),p=wM(),TM=Object.defineProperty,EM=(e,t)=>TM(e,"name",{value:t,configurable:!0}),Le=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const n=cs(`Primitive.${t}`),r=g.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,p.jsx)(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Rp(e,t){e&&pa.flushSync(()=>e.dispatchEvent(t))}EM(Rp,"dispatchDiscreteCustomEvent");var MM=Object.defineProperty,RM=(e,t)=>MM(e,"name",{value:t,configurable:!0}),PM=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),IM=g.forwardRef(RM(function(t,n){return(0,p.jsx)(Le.span,{...t,ref:n,style:{...PM,...t.style}})},"VisuallyHidden")),OM=IM,DM=Object.defineProperty,Dt=(e,t)=>DM(e,"name",{value:t,configurable:!0});function NM(e,t){const n=g.createContext(t);n.displayName=e+"Context";const r=Dt(s=>{const{children:o,...a}=s,l=g.useMemo(()=>a,Object.values(a));return(0,p.jsx)(n.Provider,{value:l,children:o})},"Provider");r.displayName=e+"Provider";function i(s,o={}){const{optional:a=!1}=o,l=g.useContext(n);if(l)return l;if(t!==void 0)return t;if(!a)throw new Error(`\`${s}\` must be used within \`${e}\``)}return Dt(i,"useContext"),[r,i]}Dt(NM,"createContext");function cr(e,t=[]){let n=[];function r(s,o){const a=g.createContext(o);a.displayName=s+"Context";const l=n.length;n=[...n,o];const c=Dt(h=>{const{scope:f,children:d,...m}=h,v=f?.[e]?.[l]||a,y=g.useMemo(()=>m,Object.values(m));return(0,p.jsx)(v.Provider,{value:y,children:d})},"Provider");c.displayName=s+"Provider";function u(h,f,d={}){const{optional:m=!1}=d,v=f?.[e]?.[l]||a,y=g.useContext(v);if(y)return y;if(o!==void 0)return o;if(!m)throw new Error(`\`${h}\` must be used within \`${s}\``)}return Dt(u,"useContext"),[c,u]}Dt(r,"createContext");const i=Dt(()=>{const s=n.map(o=>g.createContext(o));return Dt(function(a){const l=a?.[e]||s;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])},"useScope")},"createScope");return i.scopeName=e,[r,rb(i,...t)]}Dt(cr,"createContextScope");function rb(...e){const t=e[0];if(e.length===1)return t;const n=Dt(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return Dt(function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const u=l(s)[`__scope${c}`];return{...a,...u}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Dt(rb,"composeContextScopes");var LM=Object.defineProperty,Ye=(e,t)=>LM(e,"name",{value:t,configurable:!0});function Pp(e){const t=e+"CollectionProvider",[n,r]=cr(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=Ye(v=>{const{scope:y,children:x}=v,b=g.useRef(null),w=g.useRef(new Map).current;return(0,p.jsx)(i,{scope:y,itemMap:w,collectionRef:b,children:x})},"CollectionProvider");o.displayName=t;const a=e+"CollectionSlot",l=cs(a),c=g.forwardRef((v,y)=>{const{scope:x,children:b}=v,w=s(a,x),S=Ce(y,w.collectionRef);return(0,p.jsx)(l,{ref:S,children:b})});c.displayName=a;const u=e+"CollectionItemSlot",h="data-radix-collection-item",f=cs(u),d=g.forwardRef((v,y)=>{const{scope:x,children:b,...w}=v,S=g.useRef(null),C=Ce(y,S),A=s(u,x);return g.useEffect(()=>(A.itemMap.set(S,{ref:S,...w}),()=>{A.itemMap.delete(S)})),(0,p.jsx)(f,{[h]:"",ref:C,children:b})});d.displayName=u;function m(v){const y=s(e+"CollectionConsumer",v);return g.useCallback(()=>{const x=y.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((w,S)=>b.indexOf(w.ref.current)-b.indexOf(S.ref.current))},[y.collectionRef,y.itemMap])}return Ye(m,"useCollection"),[{Provider:o,Slot:c,ItemSlot:d},m,r]}Ye(Pp,"createCollection");var Pg=new WeakMap,$u=class dr extends Map{static{Ye(this,"OrderedDict")}#e;constructor(t){super(t),this.#e=[...super.keys()],Pg.set(this,!0)}set(t,n){return Pg.get(this)&&(this.has(t)?this.#e[this.#e.indexOf(t)]=t:this.#e.push(t)),super.set(t,n),this}insert(t,n,r){const i=this.has(n),s=this.#e.length,o=Ip(t);let a=o>=0?o:s+o;const l=a<0||a>=s?-1:a;if(l===this.size||i&&l===this.size-1||l===-1)return this.set(n,r),this;const c=this.size+(i?0:1);o<0&&a++;const u=[...this.#e];let h,f=!1;for(let d=a;d<c;d++)if(a===d){let m=u[d];u[d]===n&&(m=u[d+1]),i&&this.delete(n),h=this.get(m),this.set(n,r)}else{!f&&u[d-1]===n&&(f=!0);const m=u[f?d:d-1],v=h;h=this.get(m),this.delete(m),this.set(m,v)}return this}with(t,n,r){const i=new dr(this);return i.insert(t,n,r),i}before(t){const n=this.#e.indexOf(t)-1;if(!(n<0))return this.entryAt(n)}setBefore(t,n,r){const i=this.#e.indexOf(t);return i===-1?this:this.insert(i,n,r)}after(t){let n=this.#e.indexOf(t);if(n=n===-1||n===this.size-1?-1:n+1,n!==-1)return this.entryAt(n)}setAfter(t,n,r){const i=this.#e.indexOf(t);return i===-1?this:this.insert(i+1,n,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(t){const n=super.delete(t);return n&&this.#e.splice(this.#e.indexOf(t),1),n}deleteAt(t){const n=this.keyAt(t);return n!==void 0?this.delete(n):!1}at(t){const n=kl(this.#e,t);if(n!==void 0)return this.get(n)}entryAt(t){const n=kl(this.#e,t);if(n!==void 0)return[n,this.get(n)]}indexOf(t){return this.#e.indexOf(t)}keyAt(t){return kl(this.#e,t)}from(t,n){const r=this.indexOf(t);if(r===-1)return;let i=r+n;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.at(i)}keyFrom(t,n){const r=this.indexOf(t);if(r===-1)return;let i=r+n;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.keyAt(i)}find(t,n){let r=0;for(const i of this){if(Reflect.apply(t,n,[i,r,this]))return i;r++}}findIndex(t,n){let r=0;for(const i of this){if(Reflect.apply(t,n,[i,r,this]))return r;r++}return-1}filter(t,n){const r=[];let i=0;for(const s of this)Reflect.apply(t,n,[s,i,this])&&r.push(s),i++;return new dr(r)}map(t,n){const r=[];let i=0;for(const s of this)r.push([s[0],Reflect.apply(t,n,[s,i,this])]),i++;return new dr(r)}reduce(...t){const[n,r]=t;let i=0,s=r??this.at(0);for(const o of this)i===0&&t.length===1?s=o:s=Reflect.apply(n,this,[s,o,i,this]),i++;return s}reduceRight(...t){const[n,r]=t;let i=r??this.at(-1);for(let s=this.size-1;s>=0;s--){const o=this.at(s);s===this.size-1&&t.length===1?i=o:i=Reflect.apply(n,this,[i,o,s,this])}return i}toSorted(t){const n=[...this.entries()].sort(t);return new dr(n)}toReversed(){const t=new dr;for(let n=this.size-1;n>=0;n--){const r=this.keyAt(n),i=this.get(r);t.set(r,i)}return t}toSpliced(...t){const n=[...this.entries()];return n.splice(...t),new dr(n)}slice(t,n){const r=new dr;let i=this.size-1;if(t===void 0)return r;t<0&&(t=t+this.size),n!==void 0&&n>0&&(i=n-1);for(let s=t;s<=i;s++){const o=this.keyAt(s),a=this.get(o);r.set(o,a)}return r}every(t,n){let r=0;for(const i of this){if(!Reflect.apply(t,n,[i,r,this]))return!1;r++}return!0}some(t,n){let r=0;for(const i of this){if(Reflect.apply(t,n,[i,r,this]))return!0;r++}return!1}};function kl(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=ib(e,t);return n===-1?void 0:e[n]}Ye(kl,"at");function ib(e,t){const n=e.length,r=Ip(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}Ye(ib,"toSafeIndex");function Ip(e){return e!==e||e===0?0:Math.trunc(e)}Ye(Ip,"toSafeInteger");function _M(e){const t=e+"CollectionProvider",[n,r]=cr(t),[i,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new $u,setItemMap:Ye(()=>{},"setItemMap")}),o=Ye(({state:b,...w})=>b?(0,p.jsx)(l,{...w,state:b}):(0,p.jsx)(a,{...w}),"CollectionProvider");o.displayName=t;const a=Ye(b=>{const w=y();return(0,p.jsx)(l,{...b,state:w})},"CollectionInit");a.displayName=t+"Init";const l=Ye(b=>{const{scope:w,children:S,state:C}=b,A=g.useRef(null),[k,E]=g.useState(null),T=Ce(A,E),[R,P]=C;return g.useEffect(()=>{if(!k)return;const M=ab(()=>{});return M.observe(k,{childList:!0,subtree:!0}),()=>{M.disconnect()}},[k]),(0,p.jsx)(i,{scope:w,itemMap:R,setItemMap:P,collectionRef:T,collectionRefObject:A,collectionElement:k,children:S})},"CollectionProviderImpl");l.displayName=t+"Impl";const c=e+"CollectionSlot",u=cs(c),h=g.forwardRef((b,w)=>{const{scope:S,children:C}=b,A=s(c,S),k=Ce(w,A.collectionRef);return(0,p.jsx)(u,{ref:k,children:C})});h.displayName=c;const f=e+"CollectionItemSlot",d="data-radix-collection-item",m=cs(f),v=g.forwardRef((b,w)=>{const{scope:S,children:C,...A}=b,k=g.useRef(null),[E,T]=g.useState(null),R=Ce(w,k,T),{setItemMap:P}=s(f,S),M=g.useRef(A);sb(M.current,A)||(M.current=A);const N=M.current;return g.useEffect(()=>{const L=N;return P(I=>E?I.has(E)?I.set(E,{...L,element:E}).toSorted(uf):(I.set(E,{...L,element:E}),I.toSorted(uf)):I),()=>{P(I=>!E||!I.has(E)?I:(I.delete(E),new $u(I)))}},[E,N,P]),(0,p.jsx)(m,{[d]:"",ref:R,children:C})});v.displayName=f;function y(){return g.useState(new $u)}Ye(y,"useInitCollection");function x(b){const{itemMap:w}=s(e+"CollectionConsumer",b);return w}return Ye(x,"useCollection"),[{Provider:o,Slot:h,ItemSlot:v},{createCollectionScope:r,useCollection:x,useInitCollection:y}]}Ye(_M,"createCollection");function sb(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||e[i]!==t[i])return!1;return!0}Ye(sb,"shallowEqual");function ob(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Ye(ob,"isElementPreceding");function uf(e,t){return!e[1].element||!t[1].element?0:ob(e[1].element,t[1].element)?-1:1}Ye(uf,"sortByDocumentPosition");function ab(e){return new MutationObserver(t=>{for(const n of t)if(n.type==="childList"){e();return}})}Ye(ab,"getChildListObserver");var jM=Object.defineProperty,Ms=(e,t)=>jM(e,"name",{value:t,configurable:!0}),lb=!!(typeof window<"u"&&window.document&&window.document.createElement);function te(e,t,{checkForDefaultPrevented:n=!0}={}){return Ms(function(i){if(e?.(i),n===!1||!i||!i.defaultPrevented)return t?.(i)},"handleEvent")}Ms(te,"composeEventHandlers");function BM(e){if(!lb)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Ms(BM,"getOwnerWindow");function hf(e){if(!lb)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Ms(hf,"getOwnerDocument");function cb(e,t=!1){const{activeElement:n}=hf(e);if(!n?.nodeName)return null;if(ub(n)&&n.contentDocument)return cb(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=hf(n).getElementById(r);if(i)return i}}return n}Ms(cb,"getActiveElement");function ub(e){return e.tagName==="IFRAME"}Ms(ub,"isFrame");var Rt=globalThis?.document?g.useLayoutEffect:()=>{},FM=Object.defineProperty,VM=(e,t)=>FM(e,"name",{value:t,configurable:!0}),Ig=g[" useEffectEvent ".trim().toString()],Og=g[" useInsertionEffect ".trim().toString()];function hb(e){if(typeof Ig=="function")return Ig(e);const t=g.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Og=="function"?Og(()=>{t.current=e}):Rt(()=>{t.current=e}),g.useMemo(()=>((...n)=>t.current?.(...n)),[])}VM(hb,"useEffectEvent");var zM=Object.defineProperty,ma=(e,t)=>zM(e,"name",{value:t,configurable:!0}),$M=g[" useInsertionEffect ".trim().toString()]||Rt;function ga({prop:e,defaultProp:t,onChange:n=ma(()=>{},"onChange"),caller:r}){const[i,s,o]=fb({defaultProp:t,onChange:n}),a=e!==void 0;return[a?e:i,g.useCallback(c=>{if(a){const u=db(c)?c(e):c;u!==e&&o.current?.(u)}else s(c)},[a,e,s,o])]}ma(ga,"useControllableState");function fb({defaultProp:e,onChange:t}){const[n,r]=g.useState(e),i=g.useRef(n),s=g.useRef(t);return $M(()=>{s.current=t},[t]),g.useEffect(()=>{i.current!==n&&(s.current?.(n),i.current=n)},[n,i]),[n,r,s]}ma(fb,"useUncontrolledState");function db(e){return typeof e=="function"}ma(db,"isFunction");var Dg=Symbol("RADIX:SYNC_STATE");function HM(e,t,n,r){const{prop:i,defaultProp:s,onChange:o,caller:a}=t,l=i!==void 0,c=hb(o),u=[{...n,state:s}];r&&u.push(r);const[h,f]=g.useReducer((y,x)=>{if(x.type===Dg)return{...y,state:x.state};const b=e(y,x);return l&&!Object.is(b.state,y.state)&&c(b.state),b},...u),d=h.state,m=g.useRef(d);g.useEffect(()=>{m.current!==d&&(m.current=d,l||c(d))},[d,m,l]);const v=g.useMemo(()=>i!==void 0?{...h,state:i}:h,[h,i]);return g.useEffect(()=>{l&&!Object.is(i,h.state)&&f({type:Dg,state:i})},[i,h.state,l]),[v,f]}ma(HM,"useControllableStateReducer");var WM=Object.defineProperty,sr=(e,t)=>WM(e,"name",{value:t,configurable:!0});function pb(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}sr(pb,"useStateMachine");var Ln=sr(e=>{const{present:t,children:n}=e,r=mb(t),i=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),s=gb(r.ref,vb(i));return typeof n=="function"||r.isPresent?g.cloneElement(i,{ref:s}):null},"Presence");function mb(e){const[t,n]=g.useState(),r=g.useRef(null),i=g.useRef(e),s=g.useRef("none"),o=g.useRef(void 0),[a,l]=pb(e?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{a==="mounted"?(s.current=o.current??ji(r.current),o.current=void 0):s.current="none"},[a]),Rt(()=>{const c=r.current,u=i.current;if(u!==e){const h=s.current,f=ji(c);e?(o.current=f,l("MOUNT")):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Rt(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,h=sr(d=>{const m=ji(r.current).includes(CSS.escape(d.animationName));if(d.target===t&&m&&(l("ANIMATION_END"),!i.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},"handleAnimationEnd"),f=sr(d=>{d.target===t&&(s.current=ji(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:g.useCallback(c=>{if(c){const u=getComputedStyle(c);r.current=u,o.current=ji(u)}else r.current=null;n(c)},[])}}sr(mb,"usePresence");function ff(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}sr(ff,"setRef");function gb(...e){const t=g.useRef(e);return t.current=e,g.useCallback(n=>{const r=t.current;let i=!1;const s=r.map(o=>{const a=ff(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o<s.length;o++){const a=s[o];typeof a=="function"?a():ff(r[o],null)}}},[])}sr(gb,"useStableComposedRefs");function ji(e){return e?.animationName||"none"}sr(ji,"getAnimationName");function vb(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}sr(vb,"getElementRef");var UM=Object.defineProperty,qM=(e,t)=>UM(e,"name",{value:t,configurable:!0}),KM=g[" useId ".trim().toString()]||(()=>{}),GM=0;function di(e){const[t,n]=g.useState(KM());return Rt(()=>{e||n(r=>r??String(GM++))},[e]),e||(t?`radix-${t}`:"")}qM(di,"useId");var QM=Object.defineProperty,YM=(e,t)=>QM(e,"name",{value:t,configurable:!0}),XM=g.createContext(void 0);function $c(e){const t=g.useContext(XM);return e||t||"ltr"}YM($c,"useDirection");var JM=Object.defineProperty,ZM=(e,t)=>JM(e,"name",{value:t,configurable:!0});function Je(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>((...n)=>t.current?.(...n)),[])}ZM(Je,"useCallbackRef");var eR=Object.defineProperty,Qe=(e,t)=>eR(e,"name",{value:t,configurable:!0}),df="dismissableLayer.update",tR="dismissableLayer.pointerDownOutside",nR="dismissableLayer.focusOutside",Ng,yb=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),xb=g.forwardRef(Qe(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...u}=t,h=g.useContext(yb),[f,d]=g.useState(null),m=f?.ownerDocument??globalThis?.document,[,v]=g.useState({}),y=Ce(n,d),x=Array.from(h.layers),[b]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),w=b?x.indexOf(b):-1,S=f?x.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,A=S>=w,k=g.useRef(!1),E=bb(M=>{o?.(M),l?.(M),M.defaultPrevented||c?.()},{ownerDocument:m,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:h.dismissableSurfaces,shouldHandlePointerDownOutside:g.useCallback(M=>{if(!(M instanceof Node))return!1;const N=[...h.branches].some(L=>L.contains(M));return A&&!N},[h.branches,A])}),T=wb(M=>{if(i&&k.current)return;const N=M.target;[...h.branches].some(L=>L.contains(N))||(a?.(M),l?.(M),M.defaultPrevented||c?.())},m),R=f?S===x.length-1:!1,P=Je(M=>{M.key==="Escape"&&(s?.(M),!M.defaultPrevented&&c&&(M.preventDefault(),c()))});return g.useEffect(()=>{if(R)return m.addEventListener("keydown",P,{capture:!0}),()=>m.removeEventListener("keydown",P,{capture:!0})},[m,R,P]),g.useEffect(()=>{if(f)return r&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Ng=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),pf(),()=>{r&&(h.layersWithOutsidePointerEventsDisabled.delete(f),h.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=Ng))}},[f,m,r,h]),g.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),pf())},[f,h]),g.useEffect(()=>{const M=Qe(()=>v({}),"handleUpdate");return document.addEventListener(df,M),()=>document.removeEventListener(df,M)},[]),(0,p.jsx)(Le.div,{...u,ref:y,style:{pointerEvents:C?A?"auto":"none":void 0,...t.style},onFocusCapture:te(t.onFocusCapture,T.onFocusCapture),onBlurCapture:te(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:te(t.onPointerDownCapture,E.onPointerDownCapture)})},"DismissableLayer"));function rR(){const e=g.useContext(yb),[t,n]=g.useState(null);return g.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Qe(rR,"useDismissableLayerSurface");var iR=Qe(()=>!0,"IS_TRUE");function bb(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:o=iR}=t,a=Je(e),l=g.useRef(!1),c=g.useRef(!1),u=g.useRef(new Map),h=g.useRef(()=>{});return g.useEffect(()=>{function f(){c.current=!1,i.current=!1,u.current.clear()}Qe(f,"resetOutsideInteraction");function d(){return Array.from(u.current.values()).some(Boolean)}Qe(d,"isOutsideInteractionIntercepted");function m(w){if(!c.current)return;const S=w.target;S instanceof Node&&[...s].some(C=>C.contains(S))||u.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{c.current&&h.current()},0)}Qe(m,"handleInteractionCapture");function v(w){c.current&&u.current.set(w.type,!1)}Qe(v,"handleInteractionBubble");const y=Qe(w=>{if(w.target&&!l.current){let S=function(){n.removeEventListener("click",h.current);const A=d();f(),A||Op(tR,a,C,{discrete:!0})};if(Qe(S,"handleAndDispatchPointerDownOutsideEvent"),!o(w.target)){n.removeEventListener("click",h.current),f(),l.current=!1;return}const C={originalEvent:w};c.current=!0,i.current=r&&w.button===0,u.current.clear(),!r||w.button!==0?S():(n.removeEventListener("click",h.current),h.current=S,n.addEventListener("click",h.current,{once:!0}))}else n.removeEventListener("click",h.current),f();l.current=!1},"handlePointerDown"),x=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of x)n.addEventListener(w,m,!0),n.addEventListener(w,v);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",y),n.removeEventListener("click",h.current);for(const w of x)n.removeEventListener(w,m,!0),n.removeEventListener(w,v)}},[n,a,r,i,s,o]),{onPointerDownCapture:Qe(()=>l.current=!0,"onPointerDownCapture")}}Qe(bb,"usePointerDownOutside");function wb(e,t=globalThis?.document){const n=Je(e),r=g.useRef(!1);return g.useEffect(()=>{const i=Qe(s=>{s.target&&!r.current&&Op(nR,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:Qe(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Qe(()=>r.current=!1,"onBlurCapture")}}Qe(wb,"useFocusOutside");function pf(){const e=new CustomEvent(df);document.dispatchEvent(e)}Qe(pf,"dispatchUpdate");function Op(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Rp(i,s):i.dispatchEvent(s)}Qe(Op,"handleAndDispatchCustomEvent");var sR=Object.defineProperty,ft=(e,t)=>sR(e,"name",{value:t,configurable:!0}),Hu="focusScope.autoFocusOnMount",Wu="focusScope.autoFocusOnUnmount",Lg={bubbles:!1,cancelable:!0},oR=g.forwardRef(ft(function(t,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...a}=t,[l,c]=g.useState(null),u=Je(s),h=Je(o),f=g.useRef(null),d=Ce(n,c),m=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(i){let y=function(S){if(m.paused||!l)return;const C=S.target;l.contains(C)?f.current=C:Hn(f.current,{select:!0})},x=function(S){if(m.paused||!l)return;const C=S.relatedTarget;C!==null&&(l.contains(C)||Hn(f.current,{select:!0}))},b=function(S){if(document.activeElement===document.body)for(const C of S)C.removedNodes.length>0&&Hn(l)};ft(y,"handleFocusIn"),ft(x,"handleFocusOut"),ft(b,"handleMutations"),document.addEventListener("focusin",y),document.addEventListener("focusout",x);const w=new MutationObserver(b);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),w.disconnect()}}},[i,l,m.paused]),g.useEffect(()=>{if(l){_g.add(m);const y=document.activeElement;if(!l.contains(y)){const x=new CustomEvent(Hu,Lg);l.addEventListener(Hu,u),l.dispatchEvent(x),x.defaultPrevented||(Sb(Eb(Dp(l)),{select:!0}),document.activeElement===y&&Hn(l))}return()=>{l.removeEventListener(Hu,u),setTimeout(()=>{const x=new CustomEvent(Wu,Lg);l.addEventListener(Wu,h),l.dispatchEvent(x),x.defaultPrevented||Hn(y??document.body,{select:!0}),l.removeEventListener(Wu,h),_g.remove(m)},0)}}},[l,u,h,m]);const v=g.useCallback(y=>{if(!r&&!i||m.paused)return;const x=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,b=document.activeElement;if(x&&b){const w=y.currentTarget,[S,C]=kb(w);S&&C?!y.shiftKey&&b===C?(y.preventDefault(),r&&Hn(S,{select:!0})):y.shiftKey&&b===S&&(y.preventDefault(),r&&Hn(C,{select:!0})):b===w&&y.preventDefault()}},[r,i,m.paused]);return(0,p.jsx)(Le.div,{tabIndex:-1,...a,ref:d,onKeyDown:v})},"FocusScope"));function Sb(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Hn(r,{select:t}),document.activeElement!==n)return}ft(Sb,"focusFirst");function kb(e){const t=Dp(e);return[mf(t,e),mf(t.reverse(),e)]}ft(kb,"getTabbableEdges");function Dp(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:ft(r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}ft(Dp,"getTabbableCandidates");function mf(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Cb(r,{upTo:t})))return r}ft(mf,"findVisible");function Cb(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}ft(Cb,"isHidden");function Ab(e){return e instanceof HTMLInputElement&&"select"in e}ft(Ab,"isSelectableInput");function Hn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ab(e)&&t&&e.select()}}ft(Hn,"focus");var _g=Tb();function Tb(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=gf(e,t),e.unshift(t)},remove(t){e=gf(e,t),e[0]?.resume()}}}ft(Tb,"createFocusScopesStack");function gf(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}ft(gf,"arrayRemove");function Eb(e){return e.filter(t=>t.tagName!=="A")}ft(Eb,"removeLinks");var aR=Object.defineProperty,lR=(e,t)=>aR(e,"name",{value:t,configurable:!0}),Mb=g.forwardRef(lR(function(t,n){const{container:r,...i}=t,[s,o]=g.useState(!1);Rt(()=>o(!0),[]);const a=r||s&&globalThis?.document?.body;return a?pa.createPortal((0,p.jsx)(Le.div,{...i,ref:n}),a):null},"Portal")),cR=Object.defineProperty,Np=(e,t)=>cR(e,"name",{value:t,configurable:!0}),Ba=0,Ei=null;function uR(e){return Lp(),e.children}Np(uR,"FocusGuards");function Lp(){g.useEffect(()=>{Ei||(Ei={start:vf(),end:vf()});const{start:e,end:t}=Ei;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Ba++,()=>{Ba===1&&(Ei?.start.remove(),Ei?.end.remove(),Ei=null),Ba=Math.max(0,Ba-1)}},[])}Np(Lp,"useFocusGuards");function vf(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}Np(vf,"createFocusGuard");var kn=function(){return kn=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},kn.apply(this,arguments)};function Rb(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function hR(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Cl="right-scroll-bar-position",Al="width-before-scroll-bar",fR="with-scroll-bars-hidden",dR="--removed-body-scroll-bar-size";function Uu(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function pR(e,t){var n=(0,g.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var mR=typeof window<"u"?g.useLayoutEffect:g.useEffect,jg=new WeakMap;function gR(e,t){var n=pR(t||null,function(r){return e.forEach(function(i){return Uu(i,r)})});return mR(function(){var r=jg.get(n);if(r){var i=new Set(r),s=new Set(e),o=n.current;i.forEach(function(a){s.has(a)||Uu(a,null)}),s.forEach(function(a){i.has(a)||Uu(a,o)})}jg.set(n,e)},[e]),n}function vR(e){return e}function yR(e,t){t===void 0&&(t=vR);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(o){return o!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(o){return i(o)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var o=n;n=[],o.forEach(i),s=n}var a=function(){var c=s;s=[],c.forEach(i)},l=function(){return Promise.resolve().then(a)};l(),n={push:function(c){s.push(c),l()},filter:function(c){return s=s.filter(c),n}}}}}function xR(e){e===void 0&&(e={});var t=yR(null);return t.options=kn({async:!0,ssr:!1},e),t}var Pb=function(e){var t=e.sideCar,n=Rb(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return g.createElement(r,kn({},n))};Pb.isSideCarExport=!0;function bR(e,t){return e.useMedium(t),Pb}var Ib=xR(),qu=function(){},Hc=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:qu,onWheelCapture:qu,onTouchMoveCapture:qu}),i=r[0],s=r[1],o=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,h=e.shards,f=e.sideCar,d=e.noRelative,m=e.noIsolation,v=e.inert,y=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,S=Rb(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=f,A=gR([n,t]),k=kn(kn({},S),i);return g.createElement(g.Fragment,null,u&&g.createElement(C,{sideCar:Ib,removeScrollBar:c,shards:h,noRelative:d,noIsolation:m,inert:v,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:w}),o?g.cloneElement(g.Children.only(a),kn(kn({},k),{ref:A})):g.createElement(b,kn({},k,{className:l,ref:A}),a))});Hc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Hc.classNames={fullWidth:Al,zeroRight:Cl};var Bg,wR=function(){if(Bg)return Bg;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function SR(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=wR();return t&&e.setAttribute("nonce",t),e}function kR(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function CR(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}var AR=function(){var e=0,t=null;return{add:function(n){e==0&&(t=SR())&&(kR(t,n),CR(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},TR=function(){var e=AR();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ob=function(){var e=TR(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},ER={left:0,top:0,right:0,gap:0},Ku=function(e){return parseInt(e||"",10)||0},MR=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Ku(n),Ku(r),Ku(i)]},RR=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return ER;var t=MR(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},PR=Ob(),bo="data-scroll-locked",IR=function(e,t,n,r){var i=e.left,s=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
1
+ import{o as Xx}from"./rolldown-runtime-Ck0AUAe_.js";import{Dt as Ge,Gt as lf,It as nt,Kt as yo,Lt as Mr,Nt as br,Tt as Qt,Ut as ve,Vt as Sl,bt as xo,ft as zc,mt as GE,wt as Jx}from"./project-route-CshTCVmQ.js";import{Dt as QE,Gt as Wn,Ht as cf,Jt as YE,Kt as XE,Ot as JE,T as ZE,Ut as In,Wt as sc,Z as Zx,Zi as eM,c as tM,et as nM,fs as rM,hs as eb,ms as tb,ot as Mg,ps as iM,qt as sM,t as oM,w as Rg,y as aM}from"./error-reporting-D-VMAV0k.js";import{A as cs,C as lM,D as G,H as cM,I as nb,N as Ce,O as uM,S as hM,T as Ot,V as Mp,i as fM,j as dM,k as pM,n as mM,r as gM,t as vM,w as xe,z as yM}from"./use-reduced-motion-_Ge9sKbc.js";import{n as xM,t as bM}from"./react-dom-y0CFBu2J.js";import{i as wM}from"./preload-helper-BYOM8wou.js";import{a as SM,c as kM,n as CM,o as AM}from"./chunk-D32TOXHM-_lcmAHBS.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"3.25.3"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d1b80e2e-4f29-4b37-8c68-07838df7c4e3",e._sentryDebugIdIdentifier="sentry-dbid-d1b80e2e-4f29-4b37-8c68-07838df7c4e3")}catch{}})();var g=Xx(xM(),1),pa=Xx(bM(),1),p=wM(),TM=Object.defineProperty,EM=(e,t)=>TM(e,"name",{value:t,configurable:!0}),Le=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const n=cs(`Primitive.${t}`),r=g.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,p.jsx)(l,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Rp(e,t){e&&pa.flushSync(()=>e.dispatchEvent(t))}EM(Rp,"dispatchDiscreteCustomEvent");var MM=Object.defineProperty,RM=(e,t)=>MM(e,"name",{value:t,configurable:!0}),PM=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),IM=g.forwardRef(RM(function(t,n){return(0,p.jsx)(Le.span,{...t,ref:n,style:{...PM,...t.style}})},"VisuallyHidden")),OM=IM,DM=Object.defineProperty,Dt=(e,t)=>DM(e,"name",{value:t,configurable:!0});function NM(e,t){const n=g.createContext(t);n.displayName=e+"Context";const r=Dt(s=>{const{children:o,...a}=s,l=g.useMemo(()=>a,Object.values(a));return(0,p.jsx)(n.Provider,{value:l,children:o})},"Provider");r.displayName=e+"Provider";function i(s,o={}){const{optional:a=!1}=o,l=g.useContext(n);if(l)return l;if(t!==void 0)return t;if(!a)throw new Error(`\`${s}\` must be used within \`${e}\``)}return Dt(i,"useContext"),[r,i]}Dt(NM,"createContext");function cr(e,t=[]){let n=[];function r(s,o){const a=g.createContext(o);a.displayName=s+"Context";const l=n.length;n=[...n,o];const c=Dt(h=>{const{scope:f,children:d,...m}=h,v=f?.[e]?.[l]||a,y=g.useMemo(()=>m,Object.values(m));return(0,p.jsx)(v.Provider,{value:y,children:d})},"Provider");c.displayName=s+"Provider";function u(h,f,d={}){const{optional:m=!1}=d,v=f?.[e]?.[l]||a,y=g.useContext(v);if(y)return y;if(o!==void 0)return o;if(!m)throw new Error(`\`${h}\` must be used within \`${s}\``)}return Dt(u,"useContext"),[c,u]}Dt(r,"createContext");const i=Dt(()=>{const s=n.map(o=>g.createContext(o));return Dt(function(a){const l=a?.[e]||s;return g.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])},"useScope")},"createScope");return i.scopeName=e,[r,rb(i,...t)]}Dt(cr,"createContextScope");function rb(...e){const t=e[0];if(e.length===1)return t;const n=Dt(()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return Dt(function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const u=l(s)[`__scope${c}`];return{...a,...u}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Dt(rb,"composeContextScopes");var LM=Object.defineProperty,Ye=(e,t)=>LM(e,"name",{value:t,configurable:!0});function Pp(e){const t=e+"CollectionProvider",[n,r]=cr(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=Ye(v=>{const{scope:y,children:x}=v,b=g.useRef(null),w=g.useRef(new Map).current;return(0,p.jsx)(i,{scope:y,itemMap:w,collectionRef:b,children:x})},"CollectionProvider");o.displayName=t;const a=e+"CollectionSlot",l=cs(a),c=g.forwardRef((v,y)=>{const{scope:x,children:b}=v,w=s(a,x),S=Ce(y,w.collectionRef);return(0,p.jsx)(l,{ref:S,children:b})});c.displayName=a;const u=e+"CollectionItemSlot",h="data-radix-collection-item",f=cs(u),d=g.forwardRef((v,y)=>{const{scope:x,children:b,...w}=v,S=g.useRef(null),C=Ce(y,S),A=s(u,x);return g.useEffect(()=>(A.itemMap.set(S,{ref:S,...w}),()=>{A.itemMap.delete(S)})),(0,p.jsx)(f,{[h]:"",ref:C,children:b})});d.displayName=u;function m(v){const y=s(e+"CollectionConsumer",v);return g.useCallback(()=>{const x=y.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((w,S)=>b.indexOf(w.ref.current)-b.indexOf(S.ref.current))},[y.collectionRef,y.itemMap])}return Ye(m,"useCollection"),[{Provider:o,Slot:c,ItemSlot:d},m,r]}Ye(Pp,"createCollection");var Pg=new WeakMap,$u=class dr extends Map{static{Ye(this,"OrderedDict")}#e;constructor(t){super(t),this.#e=[...super.keys()],Pg.set(this,!0)}set(t,n){return Pg.get(this)&&(this.has(t)?this.#e[this.#e.indexOf(t)]=t:this.#e.push(t)),super.set(t,n),this}insert(t,n,r){const i=this.has(n),s=this.#e.length,o=Ip(t);let a=o>=0?o:s+o;const l=a<0||a>=s?-1:a;if(l===this.size||i&&l===this.size-1||l===-1)return this.set(n,r),this;const c=this.size+(i?0:1);o<0&&a++;const u=[...this.#e];let h,f=!1;for(let d=a;d<c;d++)if(a===d){let m=u[d];u[d]===n&&(m=u[d+1]),i&&this.delete(n),h=this.get(m),this.set(n,r)}else{!f&&u[d-1]===n&&(f=!0);const m=u[f?d:d-1],v=h;h=this.get(m),this.delete(m),this.set(m,v)}return this}with(t,n,r){const i=new dr(this);return i.insert(t,n,r),i}before(t){const n=this.#e.indexOf(t)-1;if(!(n<0))return this.entryAt(n)}setBefore(t,n,r){const i=this.#e.indexOf(t);return i===-1?this:this.insert(i,n,r)}after(t){let n=this.#e.indexOf(t);if(n=n===-1||n===this.size-1?-1:n+1,n!==-1)return this.entryAt(n)}setAfter(t,n,r){const i=this.#e.indexOf(t);return i===-1?this:this.insert(i+1,n,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(t){const n=super.delete(t);return n&&this.#e.splice(this.#e.indexOf(t),1),n}deleteAt(t){const n=this.keyAt(t);return n!==void 0?this.delete(n):!1}at(t){const n=kl(this.#e,t);if(n!==void 0)return this.get(n)}entryAt(t){const n=kl(this.#e,t);if(n!==void 0)return[n,this.get(n)]}indexOf(t){return this.#e.indexOf(t)}keyAt(t){return kl(this.#e,t)}from(t,n){const r=this.indexOf(t);if(r===-1)return;let i=r+n;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.at(i)}keyFrom(t,n){const r=this.indexOf(t);if(r===-1)return;let i=r+n;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.keyAt(i)}find(t,n){let r=0;for(const i of this){if(Reflect.apply(t,n,[i,r,this]))return i;r++}}findIndex(t,n){let r=0;for(const i of this){if(Reflect.apply(t,n,[i,r,this]))return r;r++}return-1}filter(t,n){const r=[];let i=0;for(const s of this)Reflect.apply(t,n,[s,i,this])&&r.push(s),i++;return new dr(r)}map(t,n){const r=[];let i=0;for(const s of this)r.push([s[0],Reflect.apply(t,n,[s,i,this])]),i++;return new dr(r)}reduce(...t){const[n,r]=t;let i=0,s=r??this.at(0);for(const o of this)i===0&&t.length===1?s=o:s=Reflect.apply(n,this,[s,o,i,this]),i++;return s}reduceRight(...t){const[n,r]=t;let i=r??this.at(-1);for(let s=this.size-1;s>=0;s--){const o=this.at(s);s===this.size-1&&t.length===1?i=o:i=Reflect.apply(n,this,[i,o,s,this])}return i}toSorted(t){const n=[...this.entries()].sort(t);return new dr(n)}toReversed(){const t=new dr;for(let n=this.size-1;n>=0;n--){const r=this.keyAt(n),i=this.get(r);t.set(r,i)}return t}toSpliced(...t){const n=[...this.entries()];return n.splice(...t),new dr(n)}slice(t,n){const r=new dr;let i=this.size-1;if(t===void 0)return r;t<0&&(t=t+this.size),n!==void 0&&n>0&&(i=n-1);for(let s=t;s<=i;s++){const o=this.keyAt(s),a=this.get(o);r.set(o,a)}return r}every(t,n){let r=0;for(const i of this){if(!Reflect.apply(t,n,[i,r,this]))return!1;r++}return!0}some(t,n){let r=0;for(const i of this){if(Reflect.apply(t,n,[i,r,this]))return!0;r++}return!1}};function kl(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=ib(e,t);return n===-1?void 0:e[n]}Ye(kl,"at");function ib(e,t){const n=e.length,r=Ip(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}Ye(ib,"toSafeIndex");function Ip(e){return e!==e||e===0?0:Math.trunc(e)}Ye(Ip,"toSafeInteger");function _M(e){const t=e+"CollectionProvider",[n,r]=cr(t),[i,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new $u,setItemMap:Ye(()=>{},"setItemMap")}),o=Ye(({state:b,...w})=>b?(0,p.jsx)(l,{...w,state:b}):(0,p.jsx)(a,{...w}),"CollectionProvider");o.displayName=t;const a=Ye(b=>{const w=y();return(0,p.jsx)(l,{...b,state:w})},"CollectionInit");a.displayName=t+"Init";const l=Ye(b=>{const{scope:w,children:S,state:C}=b,A=g.useRef(null),[k,E]=g.useState(null),T=Ce(A,E),[R,P]=C;return g.useEffect(()=>{if(!k)return;const M=ab(()=>{});return M.observe(k,{childList:!0,subtree:!0}),()=>{M.disconnect()}},[k]),(0,p.jsx)(i,{scope:w,itemMap:R,setItemMap:P,collectionRef:T,collectionRefObject:A,collectionElement:k,children:S})},"CollectionProviderImpl");l.displayName=t+"Impl";const c=e+"CollectionSlot",u=cs(c),h=g.forwardRef((b,w)=>{const{scope:S,children:C}=b,A=s(c,S),k=Ce(w,A.collectionRef);return(0,p.jsx)(u,{ref:k,children:C})});h.displayName=c;const f=e+"CollectionItemSlot",d="data-radix-collection-item",m=cs(f),v=g.forwardRef((b,w)=>{const{scope:S,children:C,...A}=b,k=g.useRef(null),[E,T]=g.useState(null),R=Ce(w,k,T),{setItemMap:P}=s(f,S),M=g.useRef(A);sb(M.current,A)||(M.current=A);const N=M.current;return g.useEffect(()=>{const L=N;return P(I=>E?I.has(E)?I.set(E,{...L,element:E}).toSorted(uf):(I.set(E,{...L,element:E}),I.toSorted(uf)):I),()=>{P(I=>!E||!I.has(E)?I:(I.delete(E),new $u(I)))}},[E,N,P]),(0,p.jsx)(m,{[d]:"",ref:R,children:C})});v.displayName=f;function y(){return g.useState(new $u)}Ye(y,"useInitCollection");function x(b){const{itemMap:w}=s(e+"CollectionConsumer",b);return w}return Ye(x,"useCollection"),[{Provider:o,Slot:h,ItemSlot:v},{createCollectionScope:r,useCollection:x,useInitCollection:y}]}Ye(_M,"createCollection");function sb(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(t,i)||e[i]!==t[i])return!1;return!0}Ye(sb,"shallowEqual");function ob(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Ye(ob,"isElementPreceding");function uf(e,t){return!e[1].element||!t[1].element?0:ob(e[1].element,t[1].element)?-1:1}Ye(uf,"sortByDocumentPosition");function ab(e){return new MutationObserver(t=>{for(const n of t)if(n.type==="childList"){e();return}})}Ye(ab,"getChildListObserver");var jM=Object.defineProperty,Ms=(e,t)=>jM(e,"name",{value:t,configurable:!0}),lb=!!(typeof window<"u"&&window.document&&window.document.createElement);function te(e,t,{checkForDefaultPrevented:n=!0}={}){return Ms(function(i){if(e?.(i),n===!1||!i||!i.defaultPrevented)return t?.(i)},"handleEvent")}Ms(te,"composeEventHandlers");function BM(e){if(!lb)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Ms(BM,"getOwnerWindow");function hf(e){if(!lb)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Ms(hf,"getOwnerDocument");function cb(e,t=!1){const{activeElement:n}=hf(e);if(!n?.nodeName)return null;if(ub(n)&&n.contentDocument)return cb(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const i=hf(n).getElementById(r);if(i)return i}}return n}Ms(cb,"getActiveElement");function ub(e){return e.tagName==="IFRAME"}Ms(ub,"isFrame");var Rt=globalThis?.document?g.useLayoutEffect:()=>{},FM=Object.defineProperty,VM=(e,t)=>FM(e,"name",{value:t,configurable:!0}),Ig=g[" useEffectEvent ".trim().toString()],Og=g[" useInsertionEffect ".trim().toString()];function hb(e){if(typeof Ig=="function")return Ig(e);const t=g.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Og=="function"?Og(()=>{t.current=e}):Rt(()=>{t.current=e}),g.useMemo(()=>((...n)=>t.current?.(...n)),[])}VM(hb,"useEffectEvent");var zM=Object.defineProperty,ma=(e,t)=>zM(e,"name",{value:t,configurable:!0}),$M=g[" useInsertionEffect ".trim().toString()]||Rt;function ga({prop:e,defaultProp:t,onChange:n=ma(()=>{},"onChange"),caller:r}){const[i,s,o]=fb({defaultProp:t,onChange:n}),a=e!==void 0;return[a?e:i,g.useCallback(c=>{if(a){const u=db(c)?c(e):c;u!==e&&o.current?.(u)}else s(c)},[a,e,s,o])]}ma(ga,"useControllableState");function fb({defaultProp:e,onChange:t}){const[n,r]=g.useState(e),i=g.useRef(n),s=g.useRef(t);return $M(()=>{s.current=t},[t]),g.useEffect(()=>{i.current!==n&&(s.current?.(n),i.current=n)},[n,i]),[n,r,s]}ma(fb,"useUncontrolledState");function db(e){return typeof e=="function"}ma(db,"isFunction");var Dg=Symbol("RADIX:SYNC_STATE");function HM(e,t,n,r){const{prop:i,defaultProp:s,onChange:o,caller:a}=t,l=i!==void 0,c=hb(o),u=[{...n,state:s}];r&&u.push(r);const[h,f]=g.useReducer((y,x)=>{if(x.type===Dg)return{...y,state:x.state};const b=e(y,x);return l&&!Object.is(b.state,y.state)&&c(b.state),b},...u),d=h.state,m=g.useRef(d);g.useEffect(()=>{m.current!==d&&(m.current=d,l||c(d))},[d,m,l]);const v=g.useMemo(()=>i!==void 0?{...h,state:i}:h,[h,i]);return g.useEffect(()=>{l&&!Object.is(i,h.state)&&f({type:Dg,state:i})},[i,h.state,l]),[v,f]}ma(HM,"useControllableStateReducer");var WM=Object.defineProperty,sr=(e,t)=>WM(e,"name",{value:t,configurable:!0});function pb(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}sr(pb,"useStateMachine");var Ln=sr(e=>{const{present:t,children:n}=e,r=mb(t),i=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),s=gb(r.ref,vb(i));return typeof n=="function"||r.isPresent?g.cloneElement(i,{ref:s}):null},"Presence");function mb(e){const[t,n]=g.useState(),r=g.useRef(null),i=g.useRef(e),s=g.useRef("none"),o=g.useRef(void 0),[a,l]=pb(e?"mounted":"unmounted",{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{a==="mounted"?(s.current=o.current??ji(r.current),o.current=void 0):s.current="none"},[a]),Rt(()=>{const c=r.current,u=i.current;if(u!==e){const h=s.current,f=ji(c);e?(o.current=f,l("MOUNT")):f==="none"||c?.display==="none"?l("UNMOUNT"):l(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Rt(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,h=sr(d=>{const m=ji(r.current).includes(CSS.escape(d.animationName));if(d.target===t&&m&&(l("ANIMATION_END"),!i.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},"handleAnimationEnd"),f=sr(d=>{d.target===t&&(s.current=ji(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:g.useCallback(c=>{if(c){const u=getComputedStyle(c);r.current=u,o.current=ji(u)}else r.current=null;n(c)},[])}}sr(mb,"usePresence");function ff(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}sr(ff,"setRef");function gb(...e){const t=g.useRef(e);return t.current=e,g.useCallback(n=>{const r=t.current;let i=!1;const s=r.map(o=>{const a=ff(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o<s.length;o++){const a=s[o];typeof a=="function"?a():ff(r[o],null)}}},[])}sr(gb,"useStableComposedRefs");function ji(e){return e?.animationName||"none"}sr(ji,"getAnimationName");function vb(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}sr(vb,"getElementRef");var UM=Object.defineProperty,qM=(e,t)=>UM(e,"name",{value:t,configurable:!0}),KM=g[" useId ".trim().toString()]||(()=>{}),GM=0;function di(e){const[t,n]=g.useState(KM());return Rt(()=>{e||n(r=>r??String(GM++))},[e]),e||(t?`radix-${t}`:"")}qM(di,"useId");var QM=Object.defineProperty,YM=(e,t)=>QM(e,"name",{value:t,configurable:!0}),XM=g.createContext(void 0);function $c(e){const t=g.useContext(XM);return e||t||"ltr"}YM($c,"useDirection");var JM=Object.defineProperty,ZM=(e,t)=>JM(e,"name",{value:t,configurable:!0});function Je(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>((...n)=>t.current?.(...n)),[])}ZM(Je,"useCallbackRef");var eR=Object.defineProperty,Qe=(e,t)=>eR(e,"name",{value:t,configurable:!0}),df="dismissableLayer.update",tR="dismissableLayer.pointerDownOutside",nR="dismissableLayer.focusOutside",Ng,yb=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),xb=g.forwardRef(Qe(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...u}=t,h=g.useContext(yb),[f,d]=g.useState(null),m=f?.ownerDocument??globalThis?.document,[,v]=g.useState({}),y=Ce(n,d),x=Array.from(h.layers),[b]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),w=b?x.indexOf(b):-1,S=f?x.indexOf(f):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,A=S>=w,k=g.useRef(!1),E=bb(M=>{o?.(M),l?.(M),M.defaultPrevented||c?.()},{ownerDocument:m,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:h.dismissableSurfaces,shouldHandlePointerDownOutside:g.useCallback(M=>{if(!(M instanceof Node))return!1;const N=[...h.branches].some(L=>L.contains(M));return A&&!N},[h.branches,A])}),T=wb(M=>{if(i&&k.current)return;const N=M.target;[...h.branches].some(L=>L.contains(N))||(a?.(M),l?.(M),M.defaultPrevented||c?.())},m),R=f?S===x.length-1:!1,P=Je(M=>{M.key==="Escape"&&(s?.(M),!M.defaultPrevented&&c&&(M.preventDefault(),c()))});return g.useEffect(()=>{if(R)return m.addEventListener("keydown",P,{capture:!0}),()=>m.removeEventListener("keydown",P,{capture:!0})},[m,R,P]),g.useEffect(()=>{if(f)return r&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Ng=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(f)),h.layers.add(f),pf(),()=>{r&&(h.layersWithOutsidePointerEventsDisabled.delete(f),h.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=Ng))}},[f,m,r,h]),g.useEffect(()=>()=>{f&&(h.layers.delete(f),h.layersWithOutsidePointerEventsDisabled.delete(f),pf())},[f,h]),g.useEffect(()=>{const M=Qe(()=>v({}),"handleUpdate");return document.addEventListener(df,M),()=>document.removeEventListener(df,M)},[]),(0,p.jsx)(Le.div,{...u,ref:y,style:{pointerEvents:C?A?"auto":"none":void 0,...t.style},onFocusCapture:te(t.onFocusCapture,T.onFocusCapture),onBlurCapture:te(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:te(t.onPointerDownCapture,E.onPointerDownCapture)})},"DismissableLayer"));function rR(){const e=g.useContext(yb),[t,n]=g.useState(null);return g.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Qe(rR,"useDismissableLayerSurface");var iR=Qe(()=>!0,"IS_TRUE");function bb(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s,shouldHandlePointerDownOutside:o=iR}=t,a=Je(e),l=g.useRef(!1),c=g.useRef(!1),u=g.useRef(new Map),h=g.useRef(()=>{});return g.useEffect(()=>{function f(){c.current=!1,i.current=!1,u.current.clear()}Qe(f,"resetOutsideInteraction");function d(){return Array.from(u.current.values()).some(Boolean)}Qe(d,"isOutsideInteractionIntercepted");function m(w){if(!c.current)return;const S=w.target;S instanceof Node&&[...s].some(C=>C.contains(S))||u.current.set(w.type,!0),w.type==="click"&&window.setTimeout(()=>{c.current&&h.current()},0)}Qe(m,"handleInteractionCapture");function v(w){c.current&&u.current.set(w.type,!1)}Qe(v,"handleInteractionBubble");const y=Qe(w=>{if(w.target&&!l.current){let S=function(){n.removeEventListener("click",h.current);const A=d();f(),A||Op(tR,a,C,{discrete:!0})};if(Qe(S,"handleAndDispatchPointerDownOutsideEvent"),!o(w.target)){n.removeEventListener("click",h.current),f(),l.current=!1;return}const C={originalEvent:w};c.current=!0,i.current=r&&w.button===0,u.current.clear(),!r||w.button!==0?S():(n.removeEventListener("click",h.current),h.current=S,n.addEventListener("click",h.current,{once:!0}))}else n.removeEventListener("click",h.current),f();l.current=!1},"handlePointerDown"),x=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const w of x)n.addEventListener(w,m,!0),n.addEventListener(w,v);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",y),n.removeEventListener("click",h.current);for(const w of x)n.removeEventListener(w,m,!0),n.removeEventListener(w,v)}},[n,a,r,i,s,o]),{onPointerDownCapture:Qe(()=>l.current=!0,"onPointerDownCapture")}}Qe(bb,"usePointerDownOutside");function wb(e,t=globalThis?.document){const n=Je(e),r=g.useRef(!1);return g.useEffect(()=>{const i=Qe(s=>{s.target&&!r.current&&Op(nR,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:Qe(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Qe(()=>r.current=!1,"onBlurCapture")}}Qe(wb,"useFocusOutside");function pf(){const e=new CustomEvent(df);document.dispatchEvent(e)}Qe(pf,"dispatchUpdate");function Op(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Rp(i,s):i.dispatchEvent(s)}Qe(Op,"handleAndDispatchCustomEvent");var sR=Object.defineProperty,ft=(e,t)=>sR(e,"name",{value:t,configurable:!0}),Hu="focusScope.autoFocusOnMount",Wu="focusScope.autoFocusOnUnmount",Lg={bubbles:!1,cancelable:!0},oR=g.forwardRef(ft(function(t,n){const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...a}=t,[l,c]=g.useState(null),u=Je(s),h=Je(o),f=g.useRef(null),d=Ce(n,c),m=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(i){let y=function(S){if(m.paused||!l)return;const C=S.target;l.contains(C)?f.current=C:Hn(f.current,{select:!0})},x=function(S){if(m.paused||!l)return;const C=S.relatedTarget;C!==null&&(l.contains(C)||Hn(f.current,{select:!0}))},b=function(S){if(document.activeElement===document.body)for(const C of S)C.removedNodes.length>0&&Hn(l)};ft(y,"handleFocusIn"),ft(x,"handleFocusOut"),ft(b,"handleMutations"),document.addEventListener("focusin",y),document.addEventListener("focusout",x);const w=new MutationObserver(b);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),w.disconnect()}}},[i,l,m.paused]),g.useEffect(()=>{if(l){_g.add(m);const y=document.activeElement;if(!l.contains(y)){const x=new CustomEvent(Hu,Lg);l.addEventListener(Hu,u),l.dispatchEvent(x),x.defaultPrevented||(Sb(Eb(Dp(l)),{select:!0}),document.activeElement===y&&Hn(l))}return()=>{l.removeEventListener(Hu,u),setTimeout(()=>{const x=new CustomEvent(Wu,Lg);l.addEventListener(Wu,h),l.dispatchEvent(x),x.defaultPrevented||Hn(y??document.body,{select:!0}),l.removeEventListener(Wu,h),_g.remove(m)},0)}}},[l,u,h,m]);const v=g.useCallback(y=>{if(!r&&!i||m.paused)return;const x=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,b=document.activeElement;if(x&&b){const w=y.currentTarget,[S,C]=kb(w);S&&C?!y.shiftKey&&b===C?(y.preventDefault(),r&&Hn(S,{select:!0})):y.shiftKey&&b===S&&(y.preventDefault(),r&&Hn(C,{select:!0})):b===w&&y.preventDefault()}},[r,i,m.paused]);return(0,p.jsx)(Le.div,{tabIndex:-1,...a,ref:d,onKeyDown:v})},"FocusScope"));function Sb(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Hn(r,{select:t}),document.activeElement!==n)return}ft(Sb,"focusFirst");function kb(e){const t=Dp(e);return[mf(t,e),mf(t.reverse(),e)]}ft(kb,"getTabbableEdges");function Dp(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:ft(r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}ft(Dp,"getTabbableCandidates");function mf(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Cb(r,{upTo:t})))return r}ft(mf,"findVisible");function Cb(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}ft(Cb,"isHidden");function Ab(e){return e instanceof HTMLInputElement&&"select"in e}ft(Ab,"isSelectableInput");function Hn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ab(e)&&t&&e.select()}}ft(Hn,"focus");var _g=Tb();function Tb(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=gf(e,t),e.unshift(t)},remove(t){e=gf(e,t),e[0]?.resume()}}}ft(Tb,"createFocusScopesStack");function gf(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}ft(gf,"arrayRemove");function Eb(e){return e.filter(t=>t.tagName!=="A")}ft(Eb,"removeLinks");var aR=Object.defineProperty,lR=(e,t)=>aR(e,"name",{value:t,configurable:!0}),Mb=g.forwardRef(lR(function(t,n){const{container:r,...i}=t,[s,o]=g.useState(!1);Rt(()=>o(!0),[]);const a=r||s&&globalThis?.document?.body;return a?pa.createPortal((0,p.jsx)(Le.div,{...i,ref:n}),a):null},"Portal")),cR=Object.defineProperty,Np=(e,t)=>cR(e,"name",{value:t,configurable:!0}),Ba=0,Ei=null;function uR(e){return Lp(),e.children}Np(uR,"FocusGuards");function Lp(){g.useEffect(()=>{Ei||(Ei={start:vf(),end:vf()});const{start:e,end:t}=Ei;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Ba++,()=>{Ba===1&&(Ei?.start.remove(),Ei?.end.remove(),Ei=null),Ba=Math.max(0,Ba-1)}},[])}Np(Lp,"useFocusGuards");function vf(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}Np(vf,"createFocusGuard");var kn=function(){return kn=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},kn.apply(this,arguments)};function Rb(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function hR(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,s;r<i;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Cl="right-scroll-bar-position",Al="width-before-scroll-bar",fR="with-scroll-bars-hidden",dR="--removed-body-scroll-bar-size";function Uu(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function pR(e,t){var n=(0,g.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=t,n.facade}var mR=typeof window<"u"?g.useLayoutEffect:g.useEffect,jg=new WeakMap;function gR(e,t){var n=pR(t||null,function(r){return e.forEach(function(i){return Uu(i,r)})});return mR(function(){var r=jg.get(n);if(r){var i=new Set(r),s=new Set(e),o=n.current;i.forEach(function(a){s.has(a)||Uu(a,null)}),s.forEach(function(a){i.has(a)||Uu(a,o)})}jg.set(n,e)},[e]),n}function vR(e){return e}function yR(e,t){t===void 0&&(t=vR);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(o){return o!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(o){return i(o)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var o=n;n=[],o.forEach(i),s=n}var a=function(){var c=s;s=[],c.forEach(i)},l=function(){return Promise.resolve().then(a)};l(),n={push:function(c){s.push(c),l()},filter:function(c){return s=s.filter(c),n}}}}}function xR(e){e===void 0&&(e={});var t=yR(null);return t.options=kn({async:!0,ssr:!1},e),t}var Pb=function(e){var t=e.sideCar,n=Rb(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return g.createElement(r,kn({},n))};Pb.isSideCarExport=!0;function bR(e,t){return e.useMedium(t),Pb}var Ib=xR(),qu=function(){},Hc=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:qu,onWheelCapture:qu,onTouchMoveCapture:qu}),i=r[0],s=r[1],o=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,h=e.shards,f=e.sideCar,d=e.noRelative,m=e.noIsolation,v=e.inert,y=e.allowPinchZoom,x=e.as,b=x===void 0?"div":x,w=e.gapMode,S=Rb(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=f,A=gR([n,t]),k=kn(kn({},S),i);return g.createElement(g.Fragment,null,u&&g.createElement(C,{sideCar:Ib,removeScrollBar:c,shards:h,noRelative:d,noIsolation:m,inert:v,setCallbacks:s,allowPinchZoom:!!y,lockRef:n,gapMode:w}),o?g.cloneElement(g.Children.only(a),kn(kn({},k),{ref:A})):g.createElement(b,kn({},k,{className:l,ref:A}),a))});Hc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Hc.classNames={fullWidth:Al,zeroRight:Cl};var Bg,wR=function(){if(Bg)return Bg;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function SR(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=wR();return t&&e.setAttribute("nonce",t),e}function kR(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function CR(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}var AR=function(){var e=0,t=null;return{add:function(n){e==0&&(t=SR())&&(kR(t,n),CR(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},TR=function(){var e=AR();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ob=function(){var e=TR(),t=function(n){var r=n.styles,i=n.dynamic;return e(r,i),null};return t},ER={left:0,top:0,right:0,gap:0},Ku=function(e){return parseInt(e||"",10)||0},MR=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[Ku(n),Ku(r),Ku(i)]},RR=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return ER;var t=MR(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},PR=Ob(),bo="data-scroll-locked",IR=function(e,t,n,r){var i=e.left,s=e.top,o=e.right,a=e.gap;return n===void 0&&(n="margin"),`
2
2
  .`.concat(fR,` {
3
3
  overflow: hidden `).concat(r,`;
4
4
  padding-right: `).concat(a,"px ").concat(r,`;
@@ -38,8 +38,8 @@ import{o as Xx}from"./rolldown-runtime-C4BN53g5.js";import{Dt as Ge,Gt as lf,It
38
38
  `)},Fg=function(){var e=parseInt(document.body.getAttribute("data-scroll-locked")||"0",10);return isFinite(e)?e:0},OR=function(){g.useEffect(function(){return document.body.setAttribute(bo,(Fg()+1).toString()),function(){var e=Fg()-1;e<=0?document.body.removeAttribute(bo):document.body.setAttribute(bo,e.toString())}},[])},DR=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;OR();var s=g.useMemo(function(){return RR(i)},[i]);return g.createElement(PR,{styles:IR(s,!t,i,n?"":"!important")})},yf=!1;if(typeof window<"u")try{var Fa=Object.defineProperty({},"passive",{get:function(){return yf=!0,!0}});window.addEventListener("test",Fa,Fa),window.removeEventListener("test",Fa,Fa)}catch{yf=!1}var Mi=yf?{passive:!1}:!1,NR=function(e){return e.tagName==="TEXTAREA"},Db=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!NR(e)&&n[t]==="visible")},LR=function(e){return Db(e,"overflowY")},_R=function(e){return Db(e,"overflowX")},Vg=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host),Nb(e,r)){var i=Lb(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},jR=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},BR=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Nb=function(e,t){return e==="v"?LR(t):_R(t)},Lb=function(e,t){return e==="v"?jR(t):BR(t)},FR=function(e,t){return e==="h"&&t==="rtl"?-1:1},VR=function(e,t,n,r,i){var s=FR(e,window.getComputedStyle(t).direction),o=s*r,a=n.target,l=t.contains(a),c=!1,u=o>0,h=0,f=0;do{if(!a)break;var d=Lb(e,a),m=d[0],v=d[1]-d[2]-s*m;(m||v)&&Nb(e,a)&&(h+=v,f+=m);var y=a.parentNode;a=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&(i&&Math.abs(h)<1||!i&&o>h)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(c=!0),c},Va=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},zg=function(e){return[e.deltaX,e.deltaY]},$g=function(e){return e&&"current"in e?e.current:e},zR=function(e,t){return e[0]===t[0]&&e[1]===t[1]},$R=function(e){return`
39
39
  .block-interactivity-`.concat(e,` {pointer-events: none;}
40
40
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
41
- `)},HR=0,Ri=[];function WR(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(HR++)[0],s=g.useState(Ob)[0],o=g.useRef(e);g.useEffect(function(){o.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var v=hR([e.lockRef.current],(e.shards||[]).map($g),!0).filter(Boolean);return v.forEach(function(y){return y.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(v,y){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var x=Va(v),b=n.current,w="deltaX"in v?v.deltaX:b[0]-x[0],S="deltaY"in v?v.deltaY:b[1]-x[1],C,A=v.target,k=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in v&&k==="h"&&A.type==="range")return!1;var E=window.getSelection(),T=E&&E.anchorNode;if(T&&(T===A||T.contains(A)))return!1;var R=Vg(k,A);if(!R)return!0;if(R?C=k:(C=k==="v"?"h":"v",R=Vg(k,A)),!R)return!1;if(!r.current&&"changedTouches"in v&&(w||S)&&(r.current=C),!C)return!0;var P=r.current||C;return VR(P,y,v,P==="h"?w:S,!0)},[]),l=g.useCallback(function(v){var y=v;if(!(!Ri.length||Ri[Ri.length-1]!==s)){var x="deltaY"in y?zg(y):Va(y),b=t.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&zR(S.delta,x)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var w=(o.current.shards||[]).map($g).filter(Boolean).filter(function(S){return S.contains(y.target)});(w.length>0?a(y,w[0]):!o.current.noIsolation)&&y.cancelable&&y.preventDefault()}}},[]),c=g.useCallback(function(v,y,x,b){var w={name:v,delta:y,target:x,should:b,shadowParent:UR(x)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),u=g.useCallback(function(v){n.current=Va(v),r.current=void 0},[]),h=g.useCallback(function(v){c(v.type,zg(v),v.target,a(v,e.lockRef.current))},[]),f=g.useCallback(function(v){c(v.type,Va(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return Ri.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",l,Mi),document.addEventListener("touchmove",l,Mi),document.addEventListener("touchstart",u,Mi),function(){Ri=Ri.filter(function(v){return v!==s}),document.removeEventListener("wheel",l,Mi),document.removeEventListener("touchmove",l,Mi),document.removeEventListener("touchstart",u,Mi)}},[]);var d=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(s,{styles:$R(i)}):null,d?g.createElement(DR,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function UR(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var qR=bR(Ib,WR),_b=g.forwardRef(function(e,t){return g.createElement(Hc,kn({},e,{ref:t,sideCar:qR}))});_b.classNames=Hc.classNames;var KR=function(e){return typeof document>"u"?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Pi=new WeakMap,za=new WeakMap,$a={},Gu=0,jb=function(e){return e&&(e.host||jb(e.parentNode))},GR=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=jb(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},QR=function(e,t,n,r){var i=GR(t,Array.isArray(e)?e:[e]);$a[n]||($a[n]=new WeakMap);var s=$a[n],o=[],a=new Set,l=new Set(i),c=function(h){!h||a.has(h)||(a.add(h),c(h.parentNode))};i.forEach(c);var u=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(f){if(a.has(f))u(f);else try{var d=f.getAttribute(r),m=d!==null&&d!=="false",v=(Pi.get(f)||0)+1,y=(s.get(f)||0)+1;Pi.set(f,v),s.set(f,y),o.push(f),v===1&&m&&za.set(f,!0),y===1&&f.setAttribute(n,"true"),m||f.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",f,x)}})};return u(t),a.clear(),Gu++,function(){o.forEach(function(h){var f=Pi.get(h)-1,d=s.get(h)-1;Pi.set(h,f),s.set(h,d),f||(za.has(h)||h.removeAttribute(r),za.delete(h)),d||h.removeAttribute(n)}),Gu--,Gu||(Pi=new WeakMap,Pi=new WeakMap,za=new WeakMap,$a={})}},YR=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||KR(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),QR(r,i,n,"aria-hidden")):function(){return null}},XR=Object.defineProperty,JR=(e,t)=>XR(e,"name",{value:t,configurable:!0});function Bb(e){const[t,n]=g.useState(void 0);return Rt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}JR(Bb,"useSize");var ZR=["top","right","bottom","left"],Rr=Math.min,tr=Math.max,oc=Math.round,Ha=Math.floor,nr=e=>({x:e,y:e}),eP={left:"right",right:"left",bottom:"top",top:"bottom"};function Fb(e,t,n){return tr(e,Rr(t,n))}function or(e,t){return typeof e=="function"?e(t):e}function Pr(e){return e.split("-")[0]}function Rs(e){return e.split("-")[1]}function _p(e){return e==="x"?"y":"x"}function jp(e){return e==="y"?"height":"width"}function An(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Bp(e){return _p(An(e))}function tP(e,t,n){n===void 0&&(n=!1);const r=Rs(e),i=Bp(e),s=jp(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=ac(o)),[o,ac(o)]}function nP(e){const t=ac(e);return[xf(e),t,xf(t)]}function xf(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var Hg=["left","right"],Wg=["right","left"],rP=["top","bottom"],iP=["bottom","top"];function sP(e,t,n){switch(e){case"top":case"bottom":return n?t?Wg:Hg:t?Hg:Wg;case"left":case"right":return t?rP:iP;default:return[]}}function oP(e,t,n,r){const i=Rs(e);let s=sP(Pr(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(xf)))),s}function ac(e){const t=Pr(e);return eP[t]+e.slice(t.length)}function aP(e){var t,n,r,i;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(i=e.left)!=null?i:0}}function Vb(e){return typeof e!="number"?aP(e):{top:e,right:e,bottom:e,left:e}}function lc(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ug(e,t,n){let{reference:r,floating:i}=e;const s=An(t),o=Bp(t),a=jp(o),l=Pr(t),c=s==="y",u=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let d;switch(l){case"top":d={x:u,y:r.y-i.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:h};break;case"left":d={x:r.x-i.width,y:h};break;default:d={x:r.x,y:r.y}}const m=Rs(t);return m&&(d[o]+=f*(m==="end"?1:-1)*(n&&c?-1:1)),d}async function lP(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:f=!1,padding:d=0}=or(t,e),m=Vb(d),v=a[f?h==="floating"?"reference":"floating":h],y=lc(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),x=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),w=await(s.isElement==null?void 0:s.isElement(b))&&await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1},S=lc(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:b,strategy:l}):x);return{top:(y.top-S.top+m.top)/w.y,bottom:(S.bottom-y.bottom+m.bottom)/w.y,left:(y.left-S.left+m.left)/w.x,right:(S.right-y.right+m.right)/w.x}}var cP=50,uP=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:lP},l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:h}=Ug(c,r,l),f=r,d=0;const m={};for(let v=0;v<s.length;v++){const y=s[v];if(!y)continue;const{name:x,fn:b}=y,{x:w,y:S,data:C,reset:A}=await b({x:u,y:h,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:c,platform:a,elements:{reference:e,floating:t}});u=w??u,h=S??h,m[x]={...m[x],...C},A&&d<cP&&(d++,typeof A=="object"&&(A.placement&&(f=A.placement),A.rects&&(c=A.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):A.rects),{x:u,y:h}=Ug(c,f,l)),v=-1)}return{x:u,y:h,placement:f,strategy:i,middlewareData:m}},hP=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=or(e,t)||{};if(c==null)return{};const h=Vb(u),f={x:n,y:r},d=Bp(i),m=jp(d),v=await o.getDimensions(c),y=d==="y",x=y?"top":"left",b=y?"bottom":"right",w=y?"clientHeight":"clientWidth",S=s.reference[m]+s.reference[d]-f[d]-s.floating[m],C=f[d]-s.reference[d],A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let k=A?A[w]:0;(!k||!await(o.isElement==null?void 0:o.isElement(A)))&&(k=a.floating[w]||s.floating[m]);const E=S/2-C/2,T=k/2-v[m]/2-1,R=Rr(h[x],T),P=Rr(h[b],T),M=k-v[m]-P,N=k/2-v[m]/2+E,L=Fb(R,N,M),I=!l.arrow&&Rs(i)!=null&&N!==L&&s.reference[m]/2-(N<R?R:P)-v[m]/2<0,_=I?N<R?N-R:N-M:0;return{[d]:f[d]+_,data:{[d]:L,centerOffset:N-L-_,...I&&{alignmentOffset:_}},reset:I}}}),fP=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...y}=or(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=Pr(i),b=An(a),w=Pr(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=f||(w||!v?[ac(a)]:nP(a)),A=m!=="none";!f&&A&&C.push(...oP(a,v,m,S));const k=[a,...C],E=await l.detectOverflow(t,y),T=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&T.push(E[x]),h){const L=tP(i,o,S);T.push(E[L[0]],E[L[1]])}if(R=[...R,{placement:i,overflows:T}],!T.every(L=>L<=0)){var P,M;const L=(((P=s.flip)==null?void 0:P.index)||0)+1,I=k[L];if(I&&(!(h==="alignment"&&b!==An(I))||R.every(j=>An(j.placement)===b?j.overflows[0]>0:!0)))return{data:{index:L,overflows:R},reset:{placement:I}};let _=(M=R.filter(j=>j.overflows[0]<=0).sort((j,$)=>j.overflows[1]-$.overflows[1])[0])==null?void 0:M.placement;if(!_)switch(d){case"bestFit":{var N;const j=(N=R.filter($=>{if(A){const B=An($.placement);return B===b||B==="y"}return!0}).map($=>[$.placement,$.overflows.filter(B=>B>0).reduce((B,D)=>B+D,0)]).sort(($,B)=>$[1]-B[1])[0])==null?void 0:N[0];j&&(_=j);break}case"initialPlacement":_=a}if(i!==_)return{reset:{placement:_}}}return{}}}};function qg(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Kg(e){return ZR.some(t=>e[t]>=0)}var dP=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=or(e,t);switch(i){case"referenceHidden":{const o=qg(await r.detectOverflow(t,{...s,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Kg(o)}}}case"escaped":{const o=qg(await r.detectOverflow(t,{...s,altBoundary:!0}),n.floating);return{data:{escapedOffsets:o,escaped:Kg(o)}}}default:return{}}}}},zb=new Set(["left","top"]);async function pP(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Pr(n),a=Rs(n),l=An(n)==="y",c=zb.has(o)?-1:1,u=s&&l?-1:1,h=or(t,e);let{mainAxis:f,crossAxis:d,alignmentAxis:m}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof m=="number"&&(d=a==="end"?m*-1:m),l?{x:d*u,y:f*c}:{x:f*c,y:d*u}}var mP=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=t,l=await pP(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},gP=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x:w,y:S}=b;return{x:w,y:S}}},...c}=or(e,t),u={x:n,y:r},h=await s.detectOverflow(t,c),f=An(i),d=_p(f);let m=u[d],v=u[f];const y=(b,w)=>Fb(w+h[b==="y"?"top":"left"],w,w-h[b==="y"?"bottom":"right"]);o&&(m=y(d,m)),a&&(v=y(f,v));const x=l.fn({...t,[d]:m,[f]:v});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[d]:o,[f]:a}}}}}},vP=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:i,y:s,placement:o,rects:a,middlewareData:l}=t,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=or(e,t),f={x:i,y:s},d=An(o),m=_p(d);let v=f[m],y=f[d];const x=or(c,t),b=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:(n=x.mainAxis)!=null?n:0,crossAxis:(r=x.crossAxis)!=null?r:0};if(u){const C=m==="y"?"height":"width",A=a.reference[m]-a.floating[C]+b.mainAxis,k=a.reference[m]+a.reference[C]-b.mainAxis;v<A?v=A:v>k&&(v=k)}if(h){var w,S;const C=m==="y"?"width":"height",A=zb.has(Pr(o)),k=a.reference[d]-a.floating[C]+(A&&((w=l.offset)==null?void 0:w[d])||0)+(A?0:b.crossAxis),E=a.reference[d]+a.reference[C]+(A?0:((S=l.offset)==null?void 0:S[d])||0)-(A?b.crossAxis:0);y<k?y=k:y>E&&(y=E)}return{[m]:v,[d]:y}}}},yP=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:i,elements:s}=t,{apply:o=()=>{},...a}=or(e,t),l=await i.detectOverflow(t,a),c=Pr(n),u=Rs(n),h=An(n)==="y",{width:f,height:d}=r.floating;let m,v;c==="top"||c==="bottom"?(m=c,v=u===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(v=c,m=u==="end"?"top":"bottom");const y=d-l.top-l.bottom,x=f-l.left-l.right,b=Rr(d-l[m],y),w=Rr(f-l[v],x),S=t.middlewareData.shift,C=!S;let A=b,k=w;S!=null&&S.enabled.x&&(k=x),S!=null&&S.enabled.y&&(A=y),C&&!u&&(h?k=f-2*tr(l.left,l.right):A=d-2*tr(l.top,l.bottom)),await o({...t,availableWidth:k,availableHeight:A});const E=await i.getDimensions(s.floating);return f!==E.width||d!==E.height?{reset:{rects:!0}}:{}}}};function Wc(){return typeof window<"u"}function Ps(e){return $b(e)?(e.nodeName||"").toLowerCase():"#document"}function yt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ur(e){var t;return(t=($b(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function $b(e){return Wc()?e instanceof Node||e instanceof yt(e).Node:!1}function On(e){return Wc()?e instanceof Element||e instanceof yt(e).Element:!1}function Fr(e){return Wc()?e instanceof HTMLElement||e instanceof yt(e).HTMLElement:!1}function Gg(e){return!Wc()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof yt(e).ShadowRoot}function Uc(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Dn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function xP(e){return/^(table|td|th)$/.test(Ps(e))}function qc(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}var bP=/transform|translate|scale|rotate|perspective|filter/,wP=/paint|layout|strict|content/,Ur=e=>!!e&&e!=="none",Qu;function Fp(e){const t=On(e)?Dn(e):e;return Ur(t.transform)||Ur(t.translate)||Ur(t.scale)||Ur(t.rotate)||Ur(t.perspective)||!Vp()&&(Ur(t.backdropFilter)||Ur(t.filter))||bP.test(t.willChange||"")||wP.test(t.contain||"")}function SP(e){let t=pi(e);for(;Fr(t)&&!Lo(t);){if(Fp(t))return t;if(qc(t))return null;t=pi(t)}return null}function Vp(){return Qu==null&&(Qu=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Qu}function Lo(e){return/^(html|body|#document)$/.test(Ps(e))}function Dn(e){return yt(e).getComputedStyle(e)}function Kc(e){return On(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function pi(e){if(Ps(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Gg(e)&&e.host||ur(e);return Gg(t)?t.host:t}function Hb(e){const t=pi(e);return Lo(t)?(e.ownerDocument||e).body:Fr(t)&&Uc(t)?t:Hb(t)}function _o(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Hb(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=yt(i);if(s){const a=bf(o);return t.concat(o,o.visualViewport||[],Uc(i)?i:[],a&&n?_o(a):[])}else return t.concat(i,_o(i,[],n))}function bf(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Wb(e){const t=Dn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Fr(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=oc(n)!==s||oc(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function zp(e){return On(e)?e:e.contextElement}function es(e){const t=zp(e);if(!Fr(t))return nr(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=Wb(t);let o=(s?oc(n.width):n.width)/r,a=(s?oc(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var kP=nr(0);function Ub(e){const t=yt(e);return!Vp()||!t.visualViewport?kP:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function CP(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===yt(e)}function mi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=zp(e);let o=nr(1);t&&(r?On(r)&&(o=es(r)):o=es(e));const a=CP(s,n,r)?Ub(s):nr(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,h=i.height/o.y;if(s&&r){const f=yt(s),d=On(r)?yt(r):r;let m=f,v=bf(m);for(;v&&d!==m;){const y=es(v),x=v.getBoundingClientRect(),b=Dn(v),w=x.left+(v.clientLeft+parseFloat(b.paddingLeft))*y.x,S=x.top+(v.clientTop+parseFloat(b.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,h*=y.y,l+=w,c+=S,m=yt(v),v=bf(m)}}return lc({width:u,height:h,x:l,y:c})}function Gc(e,t){const n=Kc(e).scrollLeft;return t?t.left+n:mi(ur(e)).left+n}function qb(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Gc(e,n),y:n.top+t.scrollTop}}function AP(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=ur(r),a=t?qc(t.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=nr(1);const u=nr(0),h=Fr(r);if((h||!s)&&((Ps(r)!=="body"||Uc(o))&&(l=Kc(r)),h)){const d=mi(r);c=es(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const f=o&&!h&&!s?qb(o,l):nr(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function TP(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function EP(e){const t=Kc(e),n=e.ownerDocument.body,r=tr(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=tr(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+Gc(e);const o=-t.scrollTop;return Dn(n).direction==="rtl"&&(s+=tr(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:s,y:o}}var MP=25;function RP(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",i=yt(e),s=ur(e),o=i.visualViewport;let a=s.clientWidth,l=s.clientHeight,c=0,u=0;if(o){const h=!Vp()||t==="fixed";r?h||(c=-o.offsetLeft,u=-o.offsetTop):(a=o.width,l=o.height,h&&(c=o.offsetLeft,u=o.offsetTop))}if(Gc(s)<=0){const h=s.ownerDocument,f=h.body,d=getComputedStyle(f),m=h.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,v=Math.abs(s.clientWidth-f.clientWidth-m),y=getComputedStyle(s).scrollbarGutter==="stable both-edges"?v/2:v;y<=MP&&(a-=y)}return{width:a,height:l,x:c,y:u}}function PP(e,t){const n=mi(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=es(e);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:i*s.x,y:r*s.y}}function Qg(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=RP(e,n,t);else if(t==="document")r=EP(ur(e));else if(On(t))r=PP(t,n);else{const i=Ub(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return lc(r)}function IP(e,t){const n=t.get(e);if(n)return n;let r=_o(e,[],!1).filter(a=>On(a)&&Ps(a)!=="body"),i=null;const s=Dn(e).position==="fixed";let o=s?pi(e):e;for(;On(o)&&!Lo(o);){const a=Dn(o),l=Fp(o),c=i?i.position:s?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?r=r.filter(u=>u!==o):i=a,o=pi(o)}return t.set(e,r),r}function OP(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?qc(t)?[]:IP(t,this._c):[].concat(n),r],o=Qg(t,s[0],i);let a=o.top,l=o.right,c=o.bottom,u=o.left;for(let h=1;h<s.length;h++){const f=Qg(t,s[h],i);a=tr(f.top,a),l=Rr(f.right,l),c=Rr(f.bottom,c),u=tr(f.left,u)}return{width:l-u,height:c-a,x:u,y:a}}function DP(e){const{width:t,height:n}=Wb(e);return{width:t,height:n}}function NP(e,t,n){const r=Fr(t),i=ur(t),s=n==="fixed",o=mi(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=nr(0);if((r||!s)&&((Ps(t)!=="body"||Uc(i))&&(a=Kc(t)),r)){const u=mi(t,!0,s,t);l.x=u.x+t.clientLeft,l.y=u.y+t.clientTop}!r&&i&&(l.x=Gc(i));const c=i&&!r&&!s?qb(i,a):nr(0);return{x:o.left+a.scrollLeft-l.x-c.x,y:o.top+a.scrollTop-l.y-c.y,width:o.width,height:o.height}}function Yu(e){return Dn(e).position==="static"}function Yg(e,t){if(!Fr(e)||Dn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ur(e)===n&&(n=n.ownerDocument.body),n}function Kb(e,t){const n=yt(e);if(qc(e))return n;if(!Fr(e)){let i=pi(e);for(;i&&!Lo(i);){if(On(i)&&!Yu(i))return i;i=pi(i)}return n}let r=Yg(e,t);for(;r&&xP(r)&&Yu(r);)r=Yg(r,t);return r&&Lo(r)&&Yu(r)&&!Fp(r)?n:r||SP(e)||n}var LP=async function(e){const t=this.getOffsetParent||Kb,n=this.getDimensions,r=await n(e.floating);return{reference:NP(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _P(e){return Dn(e).direction==="rtl"}var jP={convertOffsetParentRelativeRectToViewportRelativeRect:AP,getDocumentElement:ur,getClippingRect:OP,getOffsetParent:Kb,getElementRects:LP,getClientRects:TP,getDimensions:DP,getScale:es,isElement:On,isRTL:_P};function Gb(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function BP(e,t,n){let r=null,i;const s=ur(e);function o(){var u;clearTimeout(i),(u=r)==null||u.disconnect(),r=null}function a(u,h){u===void 0&&(u=!1),h===void 0&&(h=1),o();const f=e.getBoundingClientRect(),{left:d,top:m,width:v,height:y}=f;if(u||t(),!v||!y)return;const x=Ha(m),b=Ha(s.clientWidth-(d+v)),w=Ha(s.clientHeight-(m+y)),S=Ha(d),C={rootMargin:-x+"px "+-b+"px "+-w+"px "+-S+"px",threshold:tr(0,Rr(1,h))||1};let A=!0;function k(E){const T=E[0].intersectionRatio;if(!Gb(f,e.getBoundingClientRect()))return a();if(T!==h){if(!A)return a();T?a(!1,T):i=setTimeout(()=>{a(!1,1e-7)},1e3)}A=!1}try{r=new IntersectionObserver(k,{...C,root:s.ownerDocument})}catch{r=new IntersectionObserver(k,C)}r.observe(e)}const l=yt(e),c=()=>a(n);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),o()}}function FP(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=zp(e),u=i||s?[...c?_o(c):[],...t?_o(t):[]]:[];u.forEach(x=>{i&&x.addEventListener("scroll",n),s&&x.addEventListener("resize",n)});const h=c&&a?BP(c,n,s):null;let f=-1,d=null;o&&(d=new ResizeObserver(x=>{let[b]=x;b&&b.target===c&&d&&t&&(d.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=d)==null||w.observe(t)})),n()}),c&&!l&&d.observe(c),t&&d.observe(t));let m,v=l?mi(e):null;l&&y();function y(){const x=mi(e);v&&!Gb(v,x)&&n(),v=x,m=requestAnimationFrame(y)}return n(),()=>{var x;u.forEach(b=>{i&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),h?.(),(x=d)==null||x.disconnect(),d=null,l&&cancelAnimationFrame(m)}}var VP=mP,zP=gP,$P=fP,HP=yP,WP=dP,Xg=hP,UP=vP,qP=(e,t,n)=>{const r=new Map,i=n??{},s={...jP,...i.platform,_c:r};return uP(e,t,{...i,platform:s})},Tl=typeof document<"u"?g.useLayoutEffect:function(){};function cc(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!cc(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!cc(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Qb(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Jg(e,t){const n=Qb(e);return Math.round(t*n)/n}function Xu(e){const t=g.useRef(e);return Tl(()=>{t.current=e}),t}function KP(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,h]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,d]=g.useState(r);cc(f,r)||d(r);const[m,v]=g.useState(null),[y,x]=g.useState(null),b=g.useCallback($=>{$!==A.current&&(A.current=$,v($))},[]),w=g.useCallback($=>{$!==k.current&&(k.current=$,x($))},[]),S=s||m,C=o||y,A=g.useRef(null),k=g.useRef(null),E=g.useRef(u),T=l!=null,R=Xu(l),P=Xu(i),M=Xu(c),N=g.useCallback(()=>{if(!A.current||!k.current)return;const $={placement:t,strategy:n,middleware:f};P.current&&($.platform=P.current),qP(A.current,k.current,$).then(B=>{const D={...B,isPositioned:M.current!==!1};L.current&&!cc(E.current,D)&&(E.current=D,pa.flushSync(()=>{h(D)}))})},[f,t,n,P,M]);Tl(()=>{c===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,h($=>({...$,isPositioned:!1})))},[c]);const L=g.useRef(!1);Tl(()=>(L.current=!0,()=>{L.current=!1}),[]),Tl(()=>{if(S&&(A.current=S),C&&(k.current=C),S&&C){if(R.current)return R.current(S,C,N);N()}},[S,C,N,R,T]);const I=g.useMemo(()=>({reference:A,floating:k,setReference:b,setFloating:w}),[b,w]),_=g.useMemo(()=>({reference:S,floating:C}),[S,C]),j=g.useMemo(()=>{const $={position:n,left:0,top:0};if(!_.floating)return $;const B=Jg(_.floating,u.x),D=Jg(_.floating,u.y);return a?{...$,transform:"translate("+B+"px, "+D+"px)",...Qb(_.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:D}},[n,a,_.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:N,refs:I,elements:_,floatingStyles:j}),[u,N,I,_,j])}var GP=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Xg({element:r.current,padding:i}).fn(n):{}:r?Xg({element:r,padding:i}).fn(n):{}}}},QP=(e,t)=>{const n=VP(e);return{name:n.name,fn:n.fn,options:[e,t]}},YP=(e,t)=>{const n=zP(e);return{name:n.name,fn:n.fn,options:[e,t]}},XP=(e,t)=>({fn:UP(e).fn,options:[e,t]}),JP=(e,t)=>{const n=$P(e);return{name:n.name,fn:n.fn,options:[e,t]}},ZP=(e,t)=>{const n=HP(e);return{name:n.name,fn:n.fn,options:[e,t]}},eI=(e,t)=>{const n=WP(e);return{name:n.name,fn:n.fn,options:[e,t]}},tI=(e,t)=>{const n=GP(e);return{name:n.name,fn:n.fn,options:[e,t]}},nI=Object.defineProperty,rI=(e,t)=>nI(e,"name",{value:t,configurable:!0}),iI=g.forwardRef(rI(function(t,n){const{children:r,width:i=10,height:s=5,...o}=t;return(0,p.jsx)(Le.svg,{...o,ref:n,width:i,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,p.jsx)("polygon",{points:"0,0 30,0 15,10"})})},"Arrow")),sI=iI,oI=Object.defineProperty,rr=(e,t)=>oI(e,"name",{value:t,configurable:!0}),Yb="Popper",[Xb,Qc]=cr(Yb),[aI,Jb]=Xb(Yb),lI=rr(e=>{const{__scopePopper:t,children:n}=e,[r,i]=g.useState(null),[s,o]=g.useState(void 0);return(0,p.jsx)(aI,{scope:t,anchor:r,onAnchorChange:i,placementState:s,setPlacementState:o,children:n})},"Popper"),cI="PopperAnchor",uI=g.forwardRef(rr(function(t,n){const{__scopePopper:r,virtualRef:i,...s}=t,o=Jb(cI,r),a=g.useRef(null),l=o.onAnchorChange,c=g.useCallback(v=>{a.current=v,v&&l(v)},[l]),u=Ce(n,c),h=g.useRef(null);g.useEffect(()=>{if(!i)return;const v=h.current;h.current=i.current,v!==h.current&&l(h.current)});const f=o.placementState&&Yc(o.placementState),d=f?.[0],m=f?.[1];return i?null:(0,p.jsx)(Le.div,{"data-radix-popper-side":d,"data-radix-popper-align":m,...s,ref:u})},"PopperAnchor")),Zb="PopperContent",[hI,fI]=Xb(Zb),dI=g.forwardRef(rr(function(t,n){const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:o="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:h=0,sticky:f="partial",hideWhenDetached:d=!1,updatePositionStrategy:m="optimized",onPlaced:v,...y}=t,x=Jb(Zb,r),[b,w]=g.useState(null),S=Ce(n,w),[C,A]=g.useState(null),k=Bb(C),E=k?.width??0,T=k?.height??0,R=i+(o!=="center"?"-"+o:""),P=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},M=Array.isArray(u)?u:[u],N=M.length>0,L={padding:P,boundary:M.filter(ew),altBoundary:N},{refs:I,floatingStyles:_,placement:j,isPositioned:$,middlewareData:B}=KP({strategy:"fixed",placement:R,whileElementsMounted:rr((...oe)=>FP(...oe,{animationFrame:m==="always"}),"whileElementsMounted"),elements:{reference:x.anchor},middleware:[QP({mainAxis:s+T,alignmentAxis:a}),c&&YP({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?XP():void 0,...L}),c&&JP({...L}),ZP({...L,apply:rr(({elements:oe,rects:pe,availableWidth:ae,availableHeight:at})=>{const{width:et,height:Re}=pe.reference,ze=oe.floating.style;ze.setProperty("--radix-popper-available-width",`${ae}px`),ze.setProperty("--radix-popper-available-height",`${at}px`),ze.setProperty("--radix-popper-anchor-width",`${et}px`),ze.setProperty("--radix-popper-anchor-height",`${Re}px`)},"apply")}),C&&tI({element:C,padding:l}),vI({arrowWidth:E,arrowHeight:T}),d&&eI({strategy:"referenceHidden",...L,boundary:N?L.boundary:void 0})]}),D=x.setPlacementState;Rt(()=>(D(j),()=>{D(void 0)}),[j,D]);const[se,ne]=Yc(j),F=Je(v);Rt(()=>{$&&F?.()},[$,F]);const q=B.arrow?.x,K=B.arrow?.y,Y=B.arrow?.centerOffset!==0,[H,X]=g.useState();return Rt(()=>{b&&X(window.getComputedStyle(b).zIndex)},[b]),(0,p.jsx)("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{..._,transform:$?_.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,p.jsx)(hI,{scope:r,placedSide:se,placedAlign:ne,onArrowChange:A,arrowX:q,arrowY:K,shouldHideArrow:Y,children:(0,p.jsx)(Le.div,{"data-side":se,"data-align":ne,...y,ref:S,style:{...y.style,animation:$?y.style?.animation:"none"}})})})},"PopperContent")),pI="PopperArrow",mI={top:"bottom",right:"left",bottom:"top",left:"right"},gI=g.forwardRef(rr(function(t,n){const{__scopePopper:r,...i}=t,s=fI(pI,r),o=mI[s.placedSide];return(0,p.jsx)("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:(0,p.jsx)(sI,{...i,ref:n,style:{...i.style,display:"block"}})})},"PopperArrow"));function ew(e){return e!==null}rr(ew,"isNotNull");var vI=rr(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:i}=t,s=i.arrow?.centerOffset!==0,o=s?0:e.arrowWidth,a=s?0:e.arrowHeight,[l,c]=Yc(n),u={start:"0%",center:"50%",end:"100%"}[c],h=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+a/2;let d="",m="";return l==="bottom"?(d=s?u:`${h}px`,m=`${-a}px`):l==="top"?(d=s?u:`${h}px`,m=`${r.floating.height+a}px`):l==="right"?(d=`${-a}px`,m=s?u:`${f}px`):l==="left"&&(d=`${r.floating.width+a}px`,m=s?u:`${f}px`),{data:{x:d,y:m}}}}),"transformOrigin");function Yc(e){const[t,n="center"]=e.split("-");return[t,n]}rr(Yc,"getSideAndAlignFromPlacement");var $p=lI,tw=uI,nw=dI,yI=gI,xI=Object.defineProperty,Hp=(e,t)=>xI(e,"name",{value:t,configurable:!0}),Ju=!1;function rw(){const[e,t]=g.useState(Ju);return g.useEffect(()=>{Ju||(Ju=!0,t(!0))},[]),e}Hp(rw,"useIsHydrated");var iw=g[" useSyncExternalStore ".trim().toString()];function sw(){return()=>{}}Hp(sw,"subscribe");function ow(){return iw(sw,()=>!0,()=>!1)}Hp(ow,"useIsHydratedModern");var bI=typeof iw=="function"?ow:rw,wI=Object.defineProperty,Si=(e,t)=>wI(e,"name",{value:t,configurable:!0}),Zu="rovingFocusGroup.onEntryFocus",SI={bubbles:!1,cancelable:!0},Xc="RovingFocusGroup",[wf,aw,kI]=Pp(Xc),[CI,lw]=cr(Xc,[kI]),[AI,TI]=CI(Xc),EI=g.forwardRef(Si(function(t,n){return(0,p.jsx)(wf.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,p.jsx)(wf.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,p.jsx)(MI,{...t,ref:n})})})},"RovingFocusGroup")),MI=g.forwardRef(Si(function(t,n){const{__scopeRovingFocusGroup:r,orientation:i,loop:s=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:h=!1,...f}=t,d=g.useRef(null),m=Ce(n,d),v=$c(o),[y,x]=ga({prop:a,defaultProp:l??null,onChange:c,caller:Xc}),[b,w]=g.useState(!1),S=Je(u),C=aw(r),A=g.useRef(!1),[k,E]=g.useState(0);return g.useEffect(()=>{const T=d.current;if(T)return T.addEventListener(Zu,S),()=>T.removeEventListener(Zu,S)},[S]),(0,p.jsx)(AI,{scope:r,orientation:i,dir:v,loop:s,currentTabStopId:y,onItemFocus:g.useCallback(T=>x(T),[x]),onItemShiftTab:g.useCallback(()=>w(!0),[]),onFocusableItemAdd:g.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:g.useCallback(()=>E(T=>T-1),[]),children:(0,p.jsx)(Le.div,{tabIndex:b||k===0?-1:0,"data-orientation":i,...f,ref:m,style:{outline:"none",...t.style},onMouseDown:te(t.onMouseDown,()=>{A.current=!0}),onFocus:te(t.onFocus,T=>{const R=!A.current;if(T.target===T.currentTarget&&R&&!b){const P=new CustomEvent(Zu,SI);if(T.currentTarget.dispatchEvent(P),!P.defaultPrevented){const M=C().filter(N=>N.focusable);Wp([M.find(N=>N.active),M.find(N=>N.id===y),...M].filter(Boolean).map(N=>N.ref.current),h)}}A.current=!1}),onBlur:te(t.onBlur,()=>w(!1))})})},"RovingFocusGroupImpl")),RI="RovingFocusGroupItem",PI=g.forwardRef(Si(function(t,n){const{__scopeRovingFocusGroup:r,focusable:i=!0,active:s=!1,tabStopId:o,children:a,...l}=t,c=di(),u=o||c,h=TI(RI,r),f=h.currentTabStopId===u,d=aw(r),{onFocusableItemAdd:m,onFocusableItemRemove:v,currentTabStopId:y}=h,x=bI();return Rt(()=>{if(!(!x||!i))return m(),()=>v()},[x,i,m,v]),g.useEffect(()=>{if(!(x||!i))return m(),()=>v()},[x,i,m,v]),(0,p.jsx)(wf.ItemSlot,{scope:r,id:u,focusable:i,active:s,children:(0,p.jsx)(Le.span,{tabIndex:f?0:-1,"data-orientation":h.orientation,...l,ref:n,onMouseDown:te(t.onMouseDown,b=>{i?h.onItemFocus(u):b.preventDefault()}),onFocus:te(t.onFocus,()=>h.onItemFocus(u)),onKeyDown:te(t.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){h.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const w=uw(b,h.orientation,h.dir);if(w!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let S=d().filter(C=>C.focusable).map(C=>C.ref.current);if(w==="last")S.reverse();else if(w==="prev"||w==="next"){w==="prev"&&S.reverse();const C=S.indexOf(b.currentTarget);S=h.loop?hw(S,C+1):S.slice(C+1)}setTimeout(()=>Wp(S))}}),children:typeof a=="function"?a({isCurrentTabStop:f,hasTabStop:y!=null}):a})})},"RovingFocusGroupItem")),II={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function cw(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Si(cw,"getDirectionAwareKey");function uw(e,t,n){const r=cw(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return II[r]}Si(uw,"getFocusIntent");function Wp(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Si(Wp,"focusFirst");function hw(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Si(hw,"wrapArray");var OI=EI,DI=PI,NI=Object.defineProperty,de=(e,t)=>NI(e,"name",{value:t,configurable:!0}),Sf=["Enter"," "],LI=["ArrowDown","PageUp","Home"],fw=["ArrowUp","PageDown","End"],_I=[...LI,...fw],jI={ltr:[...Sf,"ArrowRight"],rtl:[...Sf,"ArrowLeft"]},BI={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Jc="Menu",[jo,FI,VI]=Pp(Jc),[ki,dw]=cr(Jc,[VI,Qc,lw]),Zc=Qc(),pw=lw(),[mw,Vr]=ki(Jc),[zI,va]=ki(Jc),$I=de(e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,a=Zc(t),[l,c]=g.useState(null),u=g.useRef(!1),h=Je(s),f=$c(i);return g.useEffect(()=>{const d=de(()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},"handleKeyDown"),m=de(()=>u.current=!1,"handlePointer");return document.addEventListener("keydown",d,{capture:!0}),()=>{document.removeEventListener("keydown",d,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),g.useEffect(()=>{if(!n)return;const d=de(()=>h(!1),"handleBlur");return window.addEventListener("blur",d),()=>window.removeEventListener("blur",d)},[n,h]),(0,p.jsx)($p,{...a,children:(0,p.jsx)(mw,{scope:t,open:n,onOpenChange:h,content:l,onContentChange:c,children:(0,p.jsx)(zI,{scope:t,onClose:g.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},"Menu"),gw=g.forwardRef(de(function(t,n){const{__scopeMenu:r,...i}=t,s=Zc(r);return(0,p.jsx)(tw,{...s,...i,ref:n})},"MenuAnchor")),vw="MenuPortal",[HI,yw]=ki(vw,{forceMount:void 0}),WI=de(e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Vr(vw,t);return(0,p.jsx)(HI,{scope:t,forceMount:n,children:(0,p.jsx)(Ln,{present:n||s.open,children:(0,p.jsx)(Mb,{asChild:!0,container:i,children:r})})})},"MenuPortal"),en="MenuContent",[UI,Up]=ki(en),qI=g.forwardRef(de(function(t,n){const r=yw(en,t.__scopeMenu),{forceMount:i=r.forceMount,...s}=t,o=Vr(en,t.__scopeMenu),a=va(en,t.__scopeMenu);return(0,p.jsx)(jo.Provider,{scope:t.__scopeMenu,children:(0,p.jsx)(Ln,{present:i||o.open,children:(0,p.jsx)(jo.Slot,{scope:t.__scopeMenu,children:a.modal?(0,p.jsx)(KI,{...s,ref:n}):(0,p.jsx)(GI,{...s,ref:n})})})})},"MenuContent")),KI=g.forwardRef(de(function(t,n){const r=Vr(en,t.__scopeMenu),i=g.useRef(null),s=Ce(n,i);return g.useEffect(()=>{const o=i.current;if(o)return YR(o)},[]),(0,p.jsx)(qp,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:te(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),GI=g.forwardRef(de(function(t,n){const r=Vr(en,t.__scopeMenu);return(0,p.jsx)(qp,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),QI=cs("MenuContent.ScrollLock"),qp=g.forwardRef(de(function(t,n){const{__scopeMenu:r,loop:i=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:d,onDismiss:m,disableOutsideScroll:v,...y}=t,x=Vr(en,r),b=va(en,r),w=Zc(r),S=pw(r),C=FI(r),[A,k]=g.useState(null),E=g.useRef(null),T=Ce(n,E,x.onContentChange),R=g.useRef(0),P=g.useRef(""),M=g.useRef(0),N=g.useRef(null),L=g.useRef("right"),I=g.useRef(0),_=v?_b:g.Fragment,j=v?{as:QI,allowPinchZoom:!0}:void 0,$=de(D=>{const se=P.current+D,ne=C().filter(H=>!H.disabled),F=document.activeElement,q=ne.find(H=>H.ref.current===F)?.textValue,K=Tw(ne.map(H=>H.textValue),se,q),Y=ne.find(H=>H.textValue===K)?.ref.current;de((function H(X){P.current=X,window.clearTimeout(R.current),X!==""&&(R.current=window.setTimeout(()=>H(""),1e3))}),"updateSearch")(se),Y&&setTimeout(()=>Y.focus())},"handleTypeaheadSearch");g.useEffect(()=>()=>window.clearTimeout(R.current),[]),Lp();const B=g.useCallback(D=>L.current===N.current?.side&&Mw(D,N.current?.area),[]);return(0,p.jsx)(UI,{scope:r,searchRef:P,onItemEnter:g.useCallback(D=>{B(D)&&D.preventDefault()},[B]),onItemLeave:g.useCallback(D=>{B(D)||(E.current?.focus(),k(null))},[B]),onTriggerLeave:g.useCallback(D=>{B(D)&&D.preventDefault()},[B]),pointerGraceTimerRef:M,onPointerGraceIntentChange:g.useCallback(D=>{N.current=D},[]),children:(0,p.jsx)(_,{...j,children:(0,p.jsx)(oR,{asChild:!0,trapped:s,onMountAutoFocus:te(o,D=>{D.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,p.jsx)(xb,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:d,onDismiss:m,children:(0,p.jsx)(OI,{asChild:!0,...S,dir:b.dir,orientation:"vertical",loop:i,currentTabStopId:A,onCurrentTabStopIdChange:k,onEntryFocus:te(c,D=>{b.isUsingKeyboardRef.current||D.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,p.jsx)(nw,{role:"menu","aria-orientation":"vertical","data-state":Gp(x.open),"data-radix-menu-content":"",dir:b.dir,...w,...y,ref:T,style:{outline:"none",...y.style},onKeyDown:te(y.onKeyDown,D=>{const se=D.target.closest("[data-radix-menu-content]")===D.currentTarget,ne=D.ctrlKey||D.altKey||D.metaKey,F=D.key.length===1;se&&(D.key==="Tab"&&D.preventDefault(),!ne&&F&&$(D.key));const q=E.current;if(D.target!==q||!_I.includes(D.key))return;D.preventDefault();const K=C().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);fw.includes(D.key)&&K.reverse(),Cw(K)}),onBlur:te(t.onBlur,D=>{D.currentTarget.contains(D.target)||(window.clearTimeout(R.current),P.current="")}),onPointerMove:te(t.onPointerMove,us(D=>{const se=D.target,ne=I.current!==D.clientX;if(D.currentTarget.contains(se)&&ne){const F=D.clientX>I.current?"right":"left";L.current=F,I.current=D.clientX}}))})})})})})})},"MenuContentImpl")),YI=g.forwardRef(de(function(t,n){const{__scopeMenu:r,...i}=t;return(0,p.jsx)(Le.div,{role:"group",...i,ref:n})},"MenuGroup")),XI=g.forwardRef(de(function(t,n){const{__scopeMenu:r,...i}=t;return(0,p.jsx)(Le.div,{...i,ref:n})},"MenuLabel")),kf="MenuItem",Zg="menu.itemSelect",Kp=g.forwardRef(de(function(t,n){const{disabled:r=!1,onSelect:i,...s}=t,o=g.useRef(null),a=va(kf,t.__scopeMenu),l=Up(kf,t.__scopeMenu),c=Ce(n,o),u=g.useRef(!1),h=de(()=>{const f=o.current;if(!r&&f){const d=new CustomEvent(Zg,{bubbles:!0,cancelable:!0});f.addEventListener(Zg,m=>i?.(m),{once:!0}),Rp(f,d),d.defaultPrevented?u.current=!1:a.onClose()}},"handleSelect");return(0,p.jsx)(xw,{...s,ref:c,disabled:r,onClick:te(t.onClick,h),onPointerDown:f=>{t.onPointerDown?.(f),u.current=!0},onPointerUp:te(t.onPointerUp,f=>{u.current||f.currentTarget?.click()}),onKeyDown:te(t.onKeyDown,f=>{r||f.target!==f.currentTarget||l.searchRef.current!==""&&f.key===" "||Sf.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})},"MenuItem")),xw=g.forwardRef(de(function(t,n){const{__scopeMenu:r,disabled:i=!1,textValue:s,...o}=t,a=Up(kf,r),l=pw(r),c=g.useRef(null),u=Ce(n,c),[h,f]=g.useState(!1),[d,m]=g.useState("");return g.useEffect(()=>{const v=c.current;v&&m((v.textContent??"").trim())},[o.children]),(0,p.jsx)(jo.ItemSlot,{scope:r,disabled:i,textValue:s??d,children:(0,p.jsx)(DI,{asChild:!0,...l,focusable:!i,children:(0,p.jsx)(Le.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...o,ref:u,onPointerMove:te(t.onPointerMove,us(v=>{i?a.onItemLeave(v):(a.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:te(t.onPointerLeave,us(v=>a.onItemLeave(v))),onFocus:te(t.onFocus,()=>f(!0)),onBlur:te(t.onBlur,()=>f(!1))})})})},"MenuItemImpl")),JI=g.forwardRef(de(function(t,n){const{checked:r=!1,onCheckedChange:i,...s}=t;return(0,p.jsx)(ww,{scope:t.__scopeMenu,checked:r,children:(0,p.jsx)(Kp,{role:"menuitemcheckbox","aria-checked":Bo(r)?"mixed":r,...s,ref:n,"data-state":eu(r),onSelect:te(s.onSelect,()=>i?.(Bo(r)?!0:!r),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),[ZI,eO]=ki("MenuRadioGroup",{value:void 0,onValueChange:de(()=>{},"onValueChange")}),tO=g.forwardRef(de(function(t,n){const{value:r,onValueChange:i,...s}=t,o=Je(i);return(0,p.jsx)(ZI,{scope:t.__scopeMenu,value:r,onValueChange:o,children:(0,p.jsx)(YI,{...s,ref:n})})},"MenuRadioGroup")),nO="MenuRadioItem",rO=g.forwardRef(de(function(t,n){const{value:r,...i}=t,s=eO(nO,t.__scopeMenu),o=r===s.value;return(0,p.jsx)(ww,{scope:t.__scopeMenu,checked:o,children:(0,p.jsx)(Kp,{role:"menuitemradio","aria-checked":o,...i,ref:n,"data-state":eu(o),onSelect:te(i.onSelect,()=>s.onValueChange?.(r),{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),bw="MenuItemIndicator",[ww,iO]=ki(bw,{checked:!1}),sO=g.forwardRef(de(function(t,n){const{__scopeMenu:r,forceMount:i,...s}=t,o=iO(bw,r);return(0,p.jsx)(Ln,{present:i||Bo(o.checked)||o.checked===!0,children:(0,p.jsx)(Le.span,{...s,ref:n,"data-state":eu(o.checked)})})},"MenuItemIndicator")),oO=g.forwardRef(de(function(t,n){const{__scopeMenu:r,...i}=t;return(0,p.jsx)(Le.div,{role:"separator","aria-orientation":"horizontal",...i,ref:n})},"MenuSeparator")),Sw="MenuSub",[aO,kw]=ki(Sw),lO=de(e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,s=Vr(Sw,t),o=Zc(t),[a,l]=g.useState(null),[c,u]=g.useState(null),h=Je(i);return g.useEffect(()=>(s.open===!1&&h(!1),()=>h(!1)),[s.open,h]),(0,p.jsx)($p,{...o,children:(0,p.jsx)(mw,{scope:t,open:r,onOpenChange:h,content:c,onContentChange:u,children:(0,p.jsx)(aO,{scope:t,contentId:di(),triggerId:di(),trigger:a,onTriggerChange:l,children:n})})})},"MenuSub"),Wa="MenuSubTrigger",cO=g.forwardRef(de(function(t,n){const r=Vr(Wa,t.__scopeMenu),i=va(Wa,t.__scopeMenu),s=kw(Wa,t.__scopeMenu),o=Up(Wa,t.__scopeMenu),a=g.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=o,u={__scopeMenu:t.__scopeMenu},h=g.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);g.useEffect(()=>h,[h]),g.useEffect(()=>{const d=l.current;return()=>{window.clearTimeout(d),c(null)}},[l,c]);const f=Ce(n,s.onTriggerChange);return(0,p.jsx)(gw,{asChild:!0,...u,children:(0,p.jsx)(xw,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?s.contentId:void 0,"data-state":Gp(r.open),...t,ref:f,onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:te(t.onPointerMove,us(d=>{o.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!r.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),h()},100))})),onPointerLeave:te(t.onPointerLeave,us(d=>{h();const m=r.content?.getBoundingClientRect();if(m){const v=r.content?.dataset.side,y=v==="right",x=y?-5:5,b=m[y?"left":"right"],w=m[y?"right":"left"];o.onPointerGraceIntentChange({area:[{x:d.clientX+x,y:d.clientY},{x:b,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x:b,y:m.bottom}],side:v}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(d),d.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:te(t.onKeyDown,d=>{t.disabled||d.target!==d.currentTarget||o.searchRef.current!==""&&d.key===" "||jI[i.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})},"MenuSubTrigger")),uO="MenuSubContent",hO=g.forwardRef(de(function(t,n){const r=yw(en,t.__scopeMenu),{forceMount:i=r.forceMount,align:s="start",...o}=t,a=Vr(en,t.__scopeMenu),l=va(en,t.__scopeMenu),c=kw(uO,t.__scopeMenu),u=g.useRef(null),h=Ce(n,u);return(0,p.jsx)(jo.Provider,{scope:t.__scopeMenu,children:(0,p.jsx)(Ln,{present:i||a.open,children:(0,p.jsx)(jo.Slot,{scope:t.__scopeMenu,children:(0,p.jsx)(qp,{id:c.contentId,"aria-labelledby":c.triggerId,...o,ref:h,align:s,side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{l.isUsingKeyboardRef.current&&u.current?.focus(),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:te(t.onFocusOutside,f=>{f.target!==c.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:te(t.onEscapeKeyDown,f=>{l.onClose(),f.preventDefault()}),onKeyDown:te(t.onKeyDown,f=>{const d=f.currentTarget.contains(f.target),m=BI[l.dir].includes(f.key);d&&m&&(a.onOpenChange(!1),c.trigger?.focus(),f.preventDefault())})})})})})},"MenuSubContent"));function Gp(e){return e?"open":"closed"}de(Gp,"getOpenState");function Bo(e){return e==="indeterminate"}de(Bo,"isIndeterminate");function eu(e){return Bo(e)?"indeterminate":e?"checked":"unchecked"}de(eu,"getCheckedState");function Cw(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}de(Cw,"focusFirst");function Aw(e,t){return e.map((n,r)=>e[(t+r)%e.length])}de(Aw,"wrapArray");function Tw(e,t,n){const r=t.length>1&&Array.from(t).every(a=>a===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=Aw(e,Math.max(i,0));r.length===1&&(s=s.filter(a=>a!==n));const o=s.find(a=>a.toLowerCase().startsWith(r.toLowerCase()));return o!==n?o:void 0}de(Tw,"getNextMatch");function Ew(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],l=t[o],c=a.x,u=a.y,h=l.x,f=l.y;u>r!=f>r&&n<(h-c)*(r-u)/(f-u)+c&&(i=!i)}return i}de(Ew,"isPointInPolygon");function Mw(e,t){return t?Ew({x:e.clientX,y:e.clientY},t):!1}de(Mw,"isPointerInGraceArea");function us(e){return t=>t.pointerType==="mouse"?e(t):void 0}de(us,"whenMouse");var fO=$I,dO=gw,pO=WI,mO=qI,gO=XI,vO=Kp,yO=JI,xO=tO,bO=rO,wO=sO,SO=oO,kO=lO,CO=cO,AO=hO,TO=Object.defineProperty,xt=(e,t)=>TO(e,"name",{value:t,configurable:!0}),Qp="DropdownMenu",[EO,g6]=cr(Qp,[dw]),bt=dw(),[MO,Rw]=EO(Qp),RO=xt(e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,l=bt(t),c=g.useRef(null),[u,h]=ga({prop:i,defaultProp:s??!1,onChange:o,caller:Qp});return(0,p.jsx)(MO,{scope:t,triggerId:di(),triggerRef:c,contentId:di(),open:u,onOpenChange:h,onOpenToggle:g.useCallback(()=>h(f=>!f),[h]),modal:a,children:(0,p.jsx)(fO,{...l,open:u,onOpenChange:h,dir:r,modal:a,children:n})})},"DropdownMenu"),PO="DropdownMenuTrigger",IO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,disabled:i=!1,...s}=t,o=Rw(PO,r),a=bt(r),l=Ce(n,o.triggerRef);return(0,p.jsx)(dO,{asChild:!0,...a,children:(0,p.jsx)(Le.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":i?"":void 0,disabled:i,...s,ref:l,onPointerDown:te(t.onPointerDown,c=>{!i&&c.button===0&&c.ctrlKey===!1&&(o.onOpenToggle(),o.open||c.preventDefault())}),onKeyDown:te(t.onKeyDown,c=>{i||(["Enter"," "].includes(c.key)&&o.onOpenToggle(),c.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})},"DropdownMenuTrigger")),OO=xt(e=>{const{__scopeDropdownMenu:t,...n}=e,r=bt(t);return(0,p.jsx)(pO,{...r,...n})},"DropdownMenuPortal"),DO="DropdownMenuContent",NO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=Rw(DO,r),o=bt(r),a=g.useRef(!1);return(0,p.jsx)(mO,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...i,ref:n,onCloseAutoFocus:te(t.onCloseAutoFocus,l=>{a.current||s.triggerRef.current?.focus(),a.current=!1,l.preventDefault()}),onInteractOutside:te(t.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,h=c.button===2||u;(!s.modal||h)&&(a.current=!0)}),style:{...t.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)"}})},"DropdownMenuContent")),LO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(gO,{...s,...i,ref:n})},"DropdownMenuLabel")),_O=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(vO,{...s,...i,ref:n})},"DropdownMenuItem")),jO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(yO,{...s,...i,ref:n})},"DropdownMenuCheckboxItem")),BO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(xO,{...s,...i,ref:n})},"DropdownMenuRadioGroup")),FO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(bO,{...s,...i,ref:n})},"DropdownMenuRadioItem")),VO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(wO,{...s,...i,ref:n})},"DropdownMenuItemIndicator")),zO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(SO,{...s,...i,ref:n})},"DropdownMenuSeparator")),$O=xt(e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:s}=e,o=bt(t),[a,l]=ga({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return(0,p.jsx)(kO,{...o,open:a,onOpenChange:l,children:n})},"DropdownMenuSub"),HO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(CO,{...s,...i,ref:n})},"DropdownMenuSubTrigger")),WO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(AO,{...s,...i,ref:n,style:{...t.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)"}})},"DropdownMenuSubContent")),UO=RO,qO=IO,KO=OO,GO=NO,QO=LO,YO=_O,XO=jO,JO=BO,ZO=FO,Pw=VO,eD=zO,tD=$O,nD=HO,rD=WO,iD=Object.defineProperty,sD=(e,t)=>iD(e,"name",{value:t,configurable:!0});function Iw(e,[t,n]){return Math.min(n,Math.max(t,e))}sD(Iw,"clamp");var oD=Object.defineProperty,he=(e,t)=>oD(e,"name",{value:t,configurable:!0});function Ow(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}he(Ow,"useStateMachine");var Dw="ScrollArea",[Nw,v6]=cr(Dw),[aD,Ft]=Nw(Dw),lD=g.forwardRef(he(function(t,n){const{__scopeScrollArea:r,type:i="hover",dir:s,scrollHideDelay:o=600,...a}=t,[l,c]=g.useState(null),[u,h]=g.useState(null),[f,d]=g.useState(null),[m,v]=g.useState(null),[y,x]=g.useState(null),[b,w]=g.useState(0),[S,C]=g.useState(0),[A,k]=g.useState(!1),[E,T]=g.useState(!1),R=Ce(n,c),P=$c(s);return(0,p.jsx)(aD,{scope:r,type:i,dir:P,scrollHideDelay:o,scrollArea:l,viewport:u,onViewportChange:h,content:f,onContentChange:d,scrollbarX:m,onScrollbarXChange:v,scrollbarXEnabled:A,onScrollbarXEnabledChange:k,scrollbarY:y,onScrollbarYChange:x,scrollbarYEnabled:E,onScrollbarYEnabledChange:T,onCornerWidthChange:w,onCornerHeightChange:C,children:(0,p.jsx)(Le.div,{dir:P,...a,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":S+"px",...t.style}})})},"ScrollArea")),cD="ScrollAreaViewport",uD=g.forwardRef(he(function(t,n){const{__scopeScrollArea:r,children:i,nonce:s,...o}=t,a=Ft(cD,r),l=g.useRef(null),c=Ce(n,l,a.onViewportChange);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(hD,{nonce:s}),(0,p.jsx)(Le.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:(0,p.jsx)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:i})})]})},"ScrollAreaViewport")),hD=g.memo(he(function({nonce:t}){return(0,p.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t})},"ScrollAreaViewportStyle"),(e,t)=>e.nonce===t.nonce),hr="ScrollAreaScrollbar",fD=g.forwardRef(he(function(t,n){const{forceMount:r,...i}=t,s=Ft(hr,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:a}=s,l=t.orientation==="horizontal";return g.useEffect(()=>(l?o(!0):a(!0),()=>{l?o(!1):a(!1)}),[l,o,a]),s.type==="hover"?(0,p.jsx)(dD,{...i,ref:n,forceMount:r}):s.type==="scroll"?(0,p.jsx)(pD,{...i,ref:n,forceMount:r}):s.type==="auto"?(0,p.jsx)(Lw,{...i,ref:n,forceMount:r}):s.type==="always"?(0,p.jsx)(Yp,{...i,ref:n,"data-state":"visible"}):null},"ScrollAreaScrollbar")),dD=g.forwardRef(he(function(t,n){const{forceMount:r,...i}=t,s=Ft(hr,t.__scopeScrollArea),[o,a]=g.useState(!1);return g.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const u=he(()=>{window.clearTimeout(c),a(!0)},"handlePointerEnter"),h=he(()=>{c=window.setTimeout(()=>a(!1),s.scrollHideDelay)},"handlePointerLeave");return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",h),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",h)}}},[s.scrollArea,s.scrollHideDelay]),(0,p.jsx)(Ln,{present:r||o,children:(0,p.jsx)(Lw,{"data-state":o?"visible":"hidden",...i,ref:n})})},"ScrollAreaScrollbarHover")),pD=g.forwardRef(he(function(t,n){const{forceMount:r,...i}=t,s=Ft(hr,t.__scopeScrollArea),o=t.orientation==="horizontal",a=xa(()=>c("SCROLL_END"),100),[l,c]=Ow("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,s.scrollHideDelay,c]),g.useEffect(()=>{const u=s.viewport,h=o?"scrollLeft":"scrollTop";if(u){let f=u[h];const d=he(()=>{const m=u[h];f!==m&&(c("SCROLL"),a()),f=m},"handleScroll");return u.addEventListener("scroll",d),()=>u.removeEventListener("scroll",d)}},[s.viewport,o,c,a]),(0,p.jsx)(Ln,{present:r||l!=="hidden",children:(0,p.jsx)(Yp,{"data-state":l==="hidden"?"hidden":"visible",...i,ref:n,onPointerEnter:te(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:te(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),Lw=g.forwardRef(he(function(t,n){const r=Ft(hr,t.__scopeScrollArea),{forceMount:i,...s}=t,[o,a]=g.useState(!1),l=t.orientation==="horizontal",c=xa(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,h=r.viewport.offsetHeight<r.viewport.scrollHeight;a(l?u:h)}},10);return gi(r.viewport,c),gi(r.content,c),(0,p.jsx)(Ln,{present:i||o,children:(0,p.jsx)(Yp,{"data-state":o?"visible":"hidden",...s,ref:n})})},"ScrollAreaScrollbarAuto")),Yp=g.forwardRef(he(function(t,n){const{orientation:r="vertical",...i}=t,s=Ft(hr,t.__scopeScrollArea),o=g.useRef(null),a=g.useRef(0),[l,c]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Xp(l.viewport,l.content),h={...i,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:he(d=>o.current=d,"onThumbChange"),onThumbPointerUp:he(()=>a.current=0,"onThumbPointerUp"),onThumbPointerDown:he(d=>a.current=d,"onThumbPointerDown")};function f(d,m){return Fw(d,a.current,l,m)}return he(f,"getScrollPosition"),r==="horizontal"?(0,p.jsx)(mD,{...h,ref:n,onThumbPositionChange:()=>{if(s.viewport&&o.current){const d=s.viewport.scrollLeft,m=Af(d,l,s.dir);o.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:d=>{s.viewport&&(s.viewport.scrollLeft=d)},onDragScroll:d=>{s.viewport&&(s.viewport.scrollLeft=f(d,s.dir))}}):r==="vertical"?(0,p.jsx)(gD,{...h,ref:n,onThumbPositionChange:()=>{if(s.viewport&&o.current){const d=s.viewport.scrollTop,m=Af(d,l);o.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:d=>{s.viewport&&(s.viewport.scrollTop=d)},onDragScroll:d=>{s.viewport&&(s.viewport.scrollTop=f(d))}}):null},"ScrollAreaScrollbarVisible")),mD=g.forwardRef(he(function(t,n){const{sizes:r,onSizesChange:i,...s}=t,o=Ft(hr,t.__scopeScrollArea),[a,l]=g.useState(),c=g.useRef(null),u=Ce(n,c,o.onScrollbarXChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),(0,p.jsx)(jw,{"data-orientation":"horizontal",...s,ref:u,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ya(r)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.x),onDragScroll:h=>t.onDragScroll(h.x),onWheelScroll:(h,f)=>{if(o.viewport){const d=o.viewport.scrollLeft+h.deltaX;t.onWheelScroll(d),Zp(d,f)&&h.preventDefault()}},onResize:()=>{c.current&&o.viewport&&a&&i({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Fo(a.paddingLeft),paddingEnd:Fo(a.paddingRight)}})}})},"ScrollAreaScrollbarX")),gD=g.forwardRef(he(function(t,n){const{sizes:r,onSizesChange:i,...s}=t,o=Ft(hr,t.__scopeScrollArea),[a,l]=g.useState(),c=g.useRef(null),u=Ce(n,c,o.onScrollbarYChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),(0,p.jsx)(jw,{"data-orientation":"vertical",...s,ref:u,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ya(r)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.y),onDragScroll:h=>t.onDragScroll(h.y),onWheelScroll:(h,f)=>{if(o.viewport){const d=o.viewport.scrollTop+h.deltaY;t.onWheelScroll(d),Zp(d,f)&&h.preventDefault()}},onResize:()=>{c.current&&o.viewport&&a&&i({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Fo(a.paddingTop),paddingEnd:Fo(a.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[vD,_w]=Nw(hr),jw=g.forwardRef(he(function(t,n){const{__scopeScrollArea:r,sizes:i,hasThumb:s,onThumbChange:o,onThumbPointerUp:a,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:h,onResize:f,...d}=t,m=Ft(hr,r),[v,y]=g.useState(null),x=Ce(n,y),b=g.useRef(null),w=g.useRef(""),S=m.viewport,C=i.content-i.viewport,A=Je(h),k=Je(c),E=xa(f,10);function T(R){if(b.current){const P=R.clientX-b.current.left,M=R.clientY-b.current.top;u({x:P,y:M})}}return he(T,"handleDragScroll"),g.useEffect(()=>{const R=he(P=>{const M=P.target;v?.contains(M)&&A(P,C)},"handleWheel");return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[S,v,C,A]),g.useEffect(k,[i,k]),gi(v,E),gi(m.content,E),(0,p.jsx)(vD,{scope:r,scrollbar:v,hasThumb:s,onThumbChange:Je(o),onThumbPointerUp:Je(a),onThumbPositionChange:k,onThumbPointerDown:Je(l),children:(0,p.jsx)(Le.div,{...d,ref:x,style:{position:"absolute",...d.style},onPointerDown:te(t.onPointerDown,R=>{R.button===0&&(R.target.setPointerCapture(R.pointerId),b.current=v.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),T(R))}),onPointerMove:te(t.onPointerMove,T),onPointerUp:te(t.onPointerUp,R=>{const P=R.target;P.hasPointerCapture(R.pointerId)&&P.releasePointerCapture(R.pointerId),document.body.style.webkitUserSelect=w.current,m.viewport&&(m.viewport.style.scrollBehavior=""),b.current=null})})})},"ScrollAreaScrollbarImpl")),Cf="ScrollAreaThumb",yD=g.forwardRef(he(function(t,n){const{forceMount:r,...i}=t,s=_w(Cf,t.__scopeScrollArea);return(0,p.jsx)(Ln,{present:r||s.hasThumb,children:(0,p.jsx)(xD,{ref:n,...i})})},"ScrollAreaThumb")),xD=g.forwardRef(he(function(t,n){const{__scopeScrollArea:r,style:i,...s}=t,o=Ft(Cf,r),a=_w(Cf,r),{onThumbPositionChange:l}=a,c=Ce(n,a.onThumbChange),u=g.useRef(void 0),h=xa(()=>{u.current&&(u.current(),u.current=void 0)},100);return g.useEffect(()=>{const f=o.viewport;if(f){const d=he(()=>{if(h(),!u.current){const m=SD(f,l);u.current=m,l()}},"handleScroll");return l(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[o.viewport,h,l]),(0,p.jsx)(Le.div,{"data-state":a.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...i},onPointerDownCapture:te(t.onPointerDownCapture,f=>{const d=f.target.getBoundingClientRect(),m=f.clientX-d.left,v=f.clientY-d.top;a.onThumbPointerDown({x:m,y:v})}),onPointerUp:te(t.onPointerUp,a.onThumbPointerUp)})},"ScrollAreaThumbImpl")),Bw="ScrollAreaCorner",bD=g.forwardRef(he(function(t,n){const r=Ft(Bw,t.__scopeScrollArea),i=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&i?(0,p.jsx)(wD,{...t,ref:n}):null},"ScrollAreaCorner")),wD=g.forwardRef(he(function(t,n){const{__scopeScrollArea:r,...i}=t,s=Ft(Bw,r),[o,a]=g.useState(0),[l,c]=g.useState(0),u=!!(o&&l),{onCornerWidthChange:h,onCornerHeightChange:f}=s;return gi(s.scrollbarX,()=>{const d=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(d),c(d)}),gi(s.scrollbarY,()=>{const d=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(d),a(d)}),g.useEffect(()=>()=>{h(0),f(0)},[h,f]),u?(0,p.jsx)(Le.div,{...i,ref:n,style:{width:o,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null},"ScrollAreaCornerImpl"));function Fo(e){return e?parseInt(e,10):0}he(Fo,"toInt");function Xp(e,t){const n=e/t;return isNaN(n)?0:n}he(Xp,"getThumbRatio");function ya(e){const t=Xp(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}he(ya,"getThumbSize");function Fw(e,t,n,r="ltr"){const i=ya(n),s=i/2,o=t||s,a=i-o,l=n.scrollbar.paddingStart+o,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,u=n.content-n.viewport,h=r==="ltr"?[0,u]:[u*-1,0];return Jp([l,c],h)(e)}he(Fw,"getScrollPositionFromPointer");function Af(e,t,n="ltr"){const r=ya(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-i,o=t.content-t.viewport,a=s-r,l=n==="ltr"?[0,o]:[o*-1,0],c=Iw(e,l);return Jp([0,o],[0,a])(c)}he(Af,"getThumbOffsetFromScroll");function Jp(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}he(Jp,"linearScale");function Zp(e,t){return e>0&&e<t}he(Zp,"isScrollingWithinScrollbarBounds");var SD=he((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return he((function i(){const s={left:e.scrollLeft,top:e.scrollTop},o=n.left!==s.left,a=n.top!==s.top;(o||a)&&t(),n=s,r=window.requestAnimationFrame(i)}),"loop")(),()=>window.cancelAnimationFrame(r)},"addUnlinkedScrollListener");function xa(e,t){const n=Je(e),r=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),g.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}he(xa,"useDebounceCallback");function gi(e,t){const n=Je(t);Rt(()=>{let r=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(e),()=>{window.cancelAnimationFrame(r),i.unobserve(e)}}},[e,n])}he(gi,"useResizeObserver");var kD=lD,CD=uD,AD=bD,TD=Object.defineProperty,qe=(e,t)=>TD(e,"name",{value:t,configurable:!0}),[em,y6]=cr("Tooltip",[Qc]),tu=Qc(),ED="TooltipProvider",MD=700,Tf="tooltip.open",[RD,tm]=em(ED),PD=qe(e=>{const{__scopeTooltip:t,delayDuration:n=MD,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,o=g.useRef(!0),a=g.useRef(!1),l=g.useRef(0);return g.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),(0,p.jsx)(RD,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:g.useCallback(()=>{r<=0||(window.clearTimeout(l.current),o.current=!1)},[r]),onClose:g.useCallback(()=>{r<=0||(window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:a,onPointerInTransitChange:g.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:s})},"TooltipProvider"),Ef="Tooltip",[ID,ba]=em(Ef),OD=qe(e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=e,l=tm(Ef,e.__scopeTooltip),c=tu(t),[u,h]=g.useState(null),[f,d]=g.useState(void 0),m=di(),v=g.useRef(0),y=o??l.disableHoverableContent,x=a??l.delayDuration,b=g.useRef(!1),[w,S]=ga({prop:r,defaultProp:i??!1,onChange:qe(R=>{R?(l.onOpen(),document.dispatchEvent(new CustomEvent(Tf))):l.onClose(),s?.(R)},"onChange"),caller:Ef}),C=g.useMemo(()=>w?b.current?"delayed-open":"instant-open":"closed",[w]),A=g.useCallback(()=>{window.clearTimeout(v.current),v.current=0,b.current=!1,S(!0)},[S]),k=g.useCallback(()=>{window.clearTimeout(v.current),v.current=0,S(!1)},[S]),E=g.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{b.current=!0,S(!0),v.current=0},x)},[x,S]);g.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]);const T=f??m;return(0,p.jsx)($p,{...c,children:(0,p.jsx)(ID,{scope:t,contentId:T,setContentId:d,open:w,stateAttribute:C,trigger:u,onTriggerChange:h,onTriggerEnter:g.useCallback(()=>{l.isOpenDelayedRef.current?E():A()},[l.isOpenDelayedRef,E,A]),onTriggerLeave:g.useCallback(()=>{y?k():(window.clearTimeout(v.current),v.current=0)},[k,y]),onOpen:A,onClose:k,disableHoverableContent:y,children:n})})},"Tooltip"),ev="TooltipTrigger",DD=g.forwardRef(qe(function(t,n){const{__scopeTooltip:r,...i}=t,s=ba(ev,r),o=tm(ev,r),a=tu(r),l=g.useRef(null),c=Ce(n,l,s.onTriggerChange),u=g.useRef(!1),h=g.useRef(!1),f=g.useCallback(()=>u.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),(0,p.jsx)(tw,{asChild:!0,...a,children:(0,p.jsx)(Le.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...i,ref:c,onPointerMove:te(t.onPointerMove,d=>{d.pointerType!=="touch"&&!h.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),h.current=!0)}),onPointerLeave:te(t.onPointerLeave,()=>{s.onTriggerLeave(),h.current=!1}),onPointerDown:te(t.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:te(t.onFocus,()=>{u.current||s.onOpen()}),onBlur:te(t.onBlur,s.onClose),onClick:te(t.onClick,s.onClose)})})},"TooltipTrigger")),Vw="TooltipPortal",[ND,LD]=em(Vw,{forceMount:void 0}),_D=qe(e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=ba(Vw,t);return(0,p.jsx)(ND,{scope:t,forceMount:n,children:(0,p.jsx)(Ln,{present:n||s.open,children:(0,p.jsx)(Mb,{asChild:!0,container:i,children:r})})})},"TooltipPortal"),Vo="TooltipContent",jD=g.forwardRef(qe(function(t,n){const r=LD(Vo,t.__scopeTooltip),{forceMount:i=r.forceMount,side:s="top",...o}=t,a=ba(Vo,t.__scopeTooltip);return(0,p.jsx)(Ln,{present:i||a.open,children:a.disableHoverableContent?(0,p.jsx)(zw,{side:s,...o,ref:n}):(0,p.jsx)(BD,{side:s,...o,ref:n})})},"TooltipContent")),BD=g.forwardRef(qe(function(t,n){const r=ba(Vo,t.__scopeTooltip),i=tm(Vo,t.__scopeTooltip),s=g.useRef(null),o=Ce(n,s),[a,l]=g.useState(null),{trigger:c,onClose:u}=r,h=s.current,{onPointerInTransitChange:f}=i,d=g.useCallback(()=>{l(null),f(!1)},[f]),m=g.useCallback((v,y)=>{const x=v.currentTarget,b={x:v.clientX,y:v.clientY},w=Hw(b,$w(b,x.getBoundingClientRect())),S=Ww(y.getBoundingClientRect()),C=qw([...w,...S]);l(C),f(!0)},[f]);return g.useEffect(()=>()=>d(),[d]),g.useEffect(()=>{if(c&&h){const v=qe(x=>m(x,h),"handleTriggerLeave"),y=qe(x=>m(x,c),"handleContentLeave");return c.addEventListener("pointerleave",v),h.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",v),h.removeEventListener("pointerleave",y)}}},[c,h,m,d]),g.useEffect(()=>{if(a){const v=qe(y=>{const x=y.target,b={x:y.clientX,y:y.clientY},w=c?.contains(x)||h?.contains(x),S=!Uw(b,a);w?d():S&&(d(),u())},"handleTrackPointerGrace");return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[c,h,a,u,d]),(0,p.jsx)(zw,{...t,ref:o})},"TooltipContentHoverable")),FD=dM("TooltipContent"),zw=g.forwardRef(qe(function(t,n){const{__scopeTooltip:r,children:i,"aria-label":s,id:o,onEscapeKeyDown:a,onPointerDownOutside:l,...c}=t,u=ba(Vo,r),h=tu(r),{onClose:f}=u;g.useEffect(()=>(document.addEventListener(Tf,f),()=>document.removeEventListener(Tf,f)),[f]),g.useEffect(()=>{if(u.trigger){const m=qe(v=>{v.target instanceof Node&&v.target.contains(u.trigger)&&f()},"handleScroll");return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[u.trigger,f]);const{setContentId:d}=u;return Rt(()=>(d(o),()=>{d(void 0)}),[o,d]),(0,p.jsx)(xb,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:m=>m.preventDefault(),onDismiss:f,children:(0,p.jsxs)(nw,{"data-state":u.stateAttribute,role:s?void 0:"tooltip",id:s?void 0:u.contentId,...h,...c,ref:n,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,p.jsx)(FD,{children:i}),s?(0,p.jsx)(OM,{id:u.contentId,role:"tooltip",children:s}):null]})})},"TooltipContentImpl")),VD=g.forwardRef(qe(function(t,n){const{__scopeTooltip:r,...i}=t,s=tu(r);return(0,p.jsx)(yI,{...s,...i,ref:n})},"TooltipArrow"));function $w(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}qe($w,"getExitSideFromRect");function Hw(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}qe(Hw,"getPaddedExitPoints");function Ww(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}qe(Ww,"getPointsFromRect");function Uw(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],l=t[o],c=a.x,u=a.y,h=l.x,f=l.y;u>r!=f>r&&n<(h-c)*(r-u)/(f-u)+c&&(i=!i)}return i}qe(Uw,"isPointInPolygon");function qw(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Kw(t)}qe(qw,"getHull");function Kw(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}qe(Kw,"getHullPresorted");var zD=PD,$D=OD,HD=DD,WD=_D,UD=jD,qD=VD,Gw={name:"bot",size:24,node:[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]};Gw.node;var KD=xe(Gw),Qw={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};Qw.node;var hs=xe(Qw),Yw={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};Yw.node;var Xw=xe(Yw),Jw={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};Jw.node;var fs=xe(Jw),Zw={name:"circle-alert",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],aliases:["alert-circle"]};Zw.node;var GD=xe(Zw),eS={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};eS.node;var tv=xe(eS),tS={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};tS.node;var ts=xe(tS),nS={name:"expand",size:24,node:[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}],["path",{d:"M3 16v5h5",key:"1t08am"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 8V3h5",key:"1ln10m"}],["path",{d:"M9 9 3 3",key:"v551iv"}]]};nS.node;var QD=xe(nS),rS={name:"eye",size:24,node:[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};rS.node;var YD=xe(rS),iS={name:"grip-vertical",size:24,node:[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]};iS.node;var XD=xe(iS),sS={name:"layers",size:24,node:[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],aliases:["layers-3"]};sS.node;var JD=xe(sS),oS={name:"list-filter",size:24,node:[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]]};oS.node;var ZD=xe(oS),aS={name:"list-tree",size:24,node:[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]]};aS.node;var nv=xe(aS),lS={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]};lS.node;var eN=xe(lS),cS={name:"message-square-quote",size:24,node:[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]]};cS.node;var tN=xe(cS),uS={name:"minimize-2",size:24,node:[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]};uS.node;var nN=xe(uS),hS={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};hS.node;var rN=xe(hS),fS={name:"mouse-pointer-click",size:24,node:[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]};fS.node;var iN=xe(fS),dS={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};dS.node;var sN=xe(dS),pS={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]};pS.node;var oN=xe(pS),mS={name:"redo-2",size:24,node:[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]};mS.node;var aN=xe(mS),gS={name:"shrink",size:24,node:[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]]};gS.node;var lN=xe(gS),vS={name:"text-align-start",size:24,node:[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],aliases:["text","align-left"]};vS.node;var cN=xe(vS),yS={name:"triangle-alert",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle"]};yS.node;var nu=xe(yS),xS={name:"undo-2",size:24,node:[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]};xS.node;var uN=xe(xS),bS={name:"user-round",size:24,node:[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],aliases:["user-2"]};bS.node;var hN=xe(bS),wS={name:"user",size:24,node:[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]};wS.node;var fN=xe(wS),SS={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};SS.node;var dN=xe(SS);function pN(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function mN(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function gN(e){const t=Object.entries(e).filter(([,n])=>n!==void 0);return t.length>0?Object.fromEntries(t):void 0}var vN=["uncachedInputTokens","cacheReadTokens","cacheWriteTokens","cacheWrite1hTokens","outputTokens","reasoningTokens","webSearchRequests"];function yN(e){const t=pN(e);if(!t)return;const n={};for(const r of vN){const i=mN(t[r]);i!==void 0&&(n[r]=i)}return gN(n)}var zo=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,Gn=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0,Mf=e=>typeof e=="string"&&e.length>0?e:void 0;function Yr(e,t){return t.includes(e)?e:void 0}function kr(e,t,n){const r={};for(const i of t){const s=n(e[i]);s!==void 0&&(r[i]=s)}return r}var rv=["input","output","cacheRead","cacheWrite","cacheWrite1h"];function xN(e){const t=zo(e);if(!t||t.currency!=="USD")return;const n=kr(t,[...rv,"webSearchPerThousand"],Gn);if(n.input===void 0||n.output===void 0)return;const r=(Array.isArray(t.tiers)?t.tiers:[]).map(zo).filter(i=>Gn(i?.aboveInputTokens)!==void 0).map(i=>kr(i,["aboveInputTokens",...rv],Gn));return{...n,currency:"USD",...r.length>0?{tiers:r}:{}}}function bN(e){const t=zo(e),n=Yr(t?.source,["list_price","customer_rate"]),r=xN(t?.rates),i=Mf(t?.modelId);if(!t||!n||!r||!i)return;const s=Array.isArray(t.assumptions)?t.assumptions.filter(o=>typeof o=="string"):[];return{source:n,rates:r,modelId:i,...kr(t,["provider","versionId"],Mf),...kr(t,["effectiveAt","retrievedAt"],Gn),...s.length>0?{assumptions:s}:{}}}function kS(e){const t=zo(e);if(!t||t.currency!=="USD")return;const n=Yr(t.completeness,["complete","partial","unavailable"]),r=Gn(t.calculationVersion),i=Gn(t.amountUsd),s=Yr(t.source,["provider_reported","list_price","customer_rate","runner_reported"]);if(!n||r===void 0||n==="unavailable"!=(i===void 0)||i!==void 0&&!s)return;const o=kr(zo(t.parts)??{},["input","cacheRead","cacheWrite","output","webSearch"],Gn),a=(Array.isArray(t.missing)?t.missing:[]).filter(d=>Yr(d,["usage","input_tokens","output_tokens","rate","cache_read_rate","cache_write_rate","cache_write_1h_rate","web_search_rate"])!==void 0),l=Yr(t.reason,["no_usage","no_rate","invalid_rate","unsupported_currency"]),c=Yr(t.funding,["mcpjam","customer"]),u=Yr(t.usageSource,["provider","runner","interrupted_estimate"]),h=yN(t.usage),f=bN(t.rate);return{calculationVersion:r,currency:"USD",completeness:n,...i!==void 0?{amountUsd:i}:{},...s?{source:s}:{},...Object.keys(o).length>0?{parts:o}:{},...a.length>0?{missing:a}:{},...l?{reason:l}:{},...kr(t,["tierAboveInputTokens"],Gn),...f?{rate:f}:{},...kr(t,["reporter"],Mf),...c?{funding:c}:{},...h?{usage:h}:{},...u?{usageSource:u}:{},...kr(t,["recordedAt"],Gn)}}var iv=1000000000000000n,CS=1e15;function wN(e){return BigInt(Math.round(e*CS))}function SN(e){const t=e/iv,n=e%iv;return Number(t)+Number(n)/CS}var kN=["provider_reported","customer_rate","list_price","runner_reported"];function CN(e){let t=0n,n=0,r=0,i=0;const s=new Set;for(const l of e){if(!l||l.amountUsd===void 0||l.currency!=="USD"){i+=1;continue}t+=wN(l.amountUsd),l.source&&s.add(l.source),l.completeness==="complete"?n+=1:r+=1}const o=e.length,a=n===o?"complete":n+r===0?"unavailable":"partial";return{currency:"USD",knownSubtotalUsd:SN(t),completeness:a,totalCalls:o,completeCalls:n,partialCalls:r,unavailableCalls:i,sources:kN.filter(l=>s.has(l))}}function Xr(e){const t=[e.scope??"",e.serverId,e.wire,e.taskId];if(e.connectionId!==void 0&&t.push(e.connectionId),t.some(n=>n.includes("\0"))||e.connectionId==="")throw new Error("Invalid task identity");return t.join("\0")}var AN=["completed","failed","cancelled","expired"];function no(e){return AN.includes(e)}var TN=250,EN=3e5,MN=1e3,RN=6e4;function sv(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:0}function Ii(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:void 0}function Hs(e){return{...e,respondedInputKeys:[...e.respondedInputKeys],terminal:no(e.status)}}var x6=class{records=new Map;now;absoluteFloorMs;maximumIntervalMs;backoffBaseMs;backoffMaxMs;userMinimumIntervalMs;callbacks;constructor(e={}){this.now=e.now??(()=>Date.now()),this.absoluteFloorMs=e.absoluteFloorMs??TN,this.maximumIntervalMs=e.maximumIntervalMs??EN,this.backoffBaseMs=e.errorBackoffBaseMs??MN,this.backoffMaxMs=e.errorBackoffMaxMs??RN,this.userMinimumIntervalMs=sv(e.userMinimumIntervalMs),this.callbacks=e.callbacks??{}}setCallbacks(e){this.callbacks=e}setUserMinimumIntervalMs(e){this.userMinimumIntervalMs=sv(e);for(const t of this.records.values()){if(no(t.status))continue;const n=(t.lastObservedAt??this.now())+this.effectiveIntervalMs(t),r=t.consecutiveErrors>0?t.nextPollAt:0;t.nextPollAt=Math.max(n,t.retryAfterUntil??0,r)}}getUserMinimumIntervalMs(){return this.userMinimumIntervalMs}effectiveIntervalMs(e,t){const n=t??this.now(),r=Ii(e.pollIntervalMs)??0,i=e.consecutiveErrors>0?Math.min(this.backoffBaseMs*2**(e.consecutiveErrors-1),this.backoffMaxMs):0,s=e.retryAfterUntil?Math.max(0,e.retryAfterUntil-n):0,o=Math.min(Math.max(this.absoluteFloorMs,this.userMinimumIntervalMs,i),Math.max(this.maximumIntervalMs,this.absoluteFloorMs));return Math.max(o,r,s)}get(e){return this.records.get(Xr(e))}getByKey(e){return this.records.get(e)}snapshot(e){const t=this.get(e);return t?Hs(t):void 0}all(){return[...this.records.values()].map(Hs)}register(e,t={}){const n=Xr(e),r=this.records.get(n);if(r)return r;const i=this.now(),s={key:n,identity:{...e},status:t.status??"unknown",createdAt:t.createdAt,ttlMs:t.ttlMs??null,pollIntervalMs:Ii(t.pollIntervalMs),nextPollAt:typeof t.nextPollAt=="number"&&Number.isFinite(t.nextPollAt)?Math.max(i,t.nextPollAt):i,lastObservedAt:typeof t.lastObservedAt=="number"&&Number.isFinite(t.lastObservedAt)?t.lastObservedAt:void 0,consecutiveErrors:0,cancellationRequested:!1,restored:t.restored===!0,pollInFlight:!1,respondedInputKeys:new Set(t.respondedInputKeys??[]),toolName:t.toolName,surface:t.surface};return this.records.set(n,s),t.restored||this.callbacks.onTaskCreated?.(Hs(s)),s}forget(e){this.records.delete(Xr(e))}clear(){this.records.clear()}observe(e,t,n="poll"){const r=this.register(e,{restored:!0}),i=r.status,s=this.now();if(no(r.status)&&!r.restored)return r.lastObservedAt=s,r;r.restored=!1,r.status=t.status,r.statusMessage=t.statusMessage,t.createdAt!==void 0&&(r.createdAt=t.createdAt),t.lastUpdatedAt!==void 0&&(r.lastUpdatedAt=t.lastUpdatedAt),t.ttlMs!==void 0&&(r.ttlMs=t.ttlMs),t.pollIntervalMs!==void 0&&(r.pollIntervalMs=Ii(t.pollIntervalMs)),r.inputRequests=t.inputRequests,r.result=t.result,r.error=t.error,r.raw=t.raw,r.lastObservedAt=s,n!=="notification"&&(r.consecutiveErrors=0,r.retryAfterUntil=void 0);const o=no(r.status);o?r.nextPollAt=Number.POSITIVE_INFINITY:n==="notification"&&r.consecutiveErrors>0?r.nextPollAt=Math.min(r.nextPollAt,s+this.effectiveIntervalMs(r,s)):r.nextPollAt=s+this.effectiveIntervalMs(r,s);const a=Hs(r);return i!==r.status?(this.callbacks.onState?.(a,i),r.status==="input_required"&&this.callbacks.onInputRequired?.(a),o&&this.callbacks.onTerminal?.(a)):r.status==="input_required"&&n!=="create"&&this.callbacks.onInputRequired?.(a),r}observeError(e,t={}){const n=this.register(e,{restored:!0}),r=this.now();n.consecutiveErrors+=1;const i=Ii(t.retryAfterMs);return i!==void 0&&(n.retryAfterUntil=r+i),n.nextPollAt=r+this.effectiveIntervalMs(n,r),n}applyRetryAfter(e,t){const n=this.register(e,{restored:!0}),r=this.now(),i=Ii(t);i!==void 0&&(n.retryAfterUntil=r+i,n.nextPollAt=Math.max(n.nextPollAt,r+i))}clearErrorBackoff(e){const t=this.records.get(Xr(e));if(!t)return;const n=this.now();t.consecutiveErrors=0;const r=Ii(t.pollIntervalMs)??0;t.nextPollAt=Math.max(n,t.lastObservedAt!==void 0?t.lastObservedAt+r:0,t.retryAfterUntil??0)}markExpired(e){const t=this.register(e,{restored:!0}),n=t.status;t.status="expired",t.lastObservedAt=this.now(),t.nextPollAt=Number.POSITIVE_INFINITY,t.consecutiveErrors=0;const r=Hs(t);return n!=="expired"&&(this.callbacks.onState?.(r,n),this.callbacks.onTerminal?.(r)),t}markCancellationRequested(e){const t=this.register(e,{restored:!0});t.cancellationRequested=!0}markInputKeysResponded(e,t){const n=this.register(e,{restored:!0});for(const r of t)n.respondedInputKeys.add(r)}pendingInputKeys(e){const t=this.get(e);return t?.inputRequests?Object.keys(t.inputRequests).filter(n=>Object.prototype.hasOwnProperty.call(t.inputRequests,n)&&!t.respondedInputKeys.has(n)):[]}owesRead(e){return no(e.status)?e.restored&&e.identity.wire==="extension":!0}due(e){const t=e??this.now();return[...this.records.values()].filter(n=>this.owesRead(n)&&!n.pollInFlight&&n.nextPollAt<=t).sort((n,r)=>n.nextPollAt-r.nextPollAt)}active(){return[...this.records.values()].filter(e=>this.owesRead(e))}msUntilNextDue(e){const t=e??this.now();let n=Number.POSITIVE_INFINITY;for(const r of this.records.values())this.owesRead(r)&&(n=Math.min(n,r.nextPollAt));if(Number.isFinite(n))return Math.max(0,n-t)}reserve(e,t){const n=t??this.now();for(const r of e)r.nextPollAt=n+this.effectiveIntervalMs(r,n)}acquirePoll(e,t){const n=this.records.get(Xr(e));return!n||n.pollInFlight?!1:(n.pollInFlight=!0,this.reserve([n],t),!0)}releasePoll(e){const t=this.records.get(Xr(e));t&&(t.pollInFlight=!1)}batchIntervalMs(e,t){const n=t??this.now();let r=Math.max(this.absoluteFloorMs,this.userMinimumIntervalMs);for(const i of e)r=Math.max(r,this.effectiveIntervalMs(i,n));return r}},AS=(0,g.createContext)({});function PN(e){const t=(0,g.useRef)(null);return t.current===null&&(t.current=e()),t.current}var IN=typeof window<"u",ov=IN?g.useLayoutEffect:g.useEffect,ru=(0,g.createContext)(null);function nm(e,t){e.indexOf(t)===-1&&e.push(t)}function uc(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}var fr=(e,t,n)=>n>t?t:n<e?e:n,iu=()=>{},vi=()=>{},ar={},rm=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),TS=e=>typeof e=="object"&&e!==null,im=e=>/^0[^.\s]+$/u.test(e);function ES(e){let t;return()=>(t===void 0&&(t=e()),t)}var tn=e=>e,wa=(...e)=>e.reduce((t,n)=>r=>n(t(r))),$o=(e,t,n)=>{const r=t-e;return r?(n-e)/r:1},hc=class{constructor(){this.subscriptions=[]}add(e){return nm(this.subscriptions,e),()=>this.remove(e)}remove(e){uc(this.subscriptions,e)}notify(e,t,n){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){const s=this.subscriptions[i];s&&s(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},Pt=e=>e*1e3,Lt=e=>e/1e3,MS=(e,t)=>t?e*(1e3/t):0,RS=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,ON=1e-7,DN=12;function NN(e,t,n,r,i){let s,o,a=0;do o=t+(n-t)/2,s=RS(o,r,i)-e,s>0?n=o:t=o;while(Math.abs(s)>ON&&++a<DN);return o}function Sa(e,t,n,r){if(e===t&&n===r)return tn;const i=s=>NN(s,0,1,e,n);return s=>s===0||s===1?s:RS(i(s),t,r)}var PS=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,IS=e=>t=>1-e(1-t),OS=Sa(.33,1.53,.69,.99),sm=IS(OS),DS=PS(sm),NS=e=>e>=1?1:(e*=2)<1?.5*sm(e):.5*(2-Math.pow(2,-10*(e-1))),om=e=>1-Math.sin(Math.acos(e)),LS=IS(om),_S=PS(om),LN=Sa(.42,0,1,1),_N=Sa(0,0,.58,1),am=Sa(.42,0,.58,1),jN=e=>Array.isArray(e)&&typeof e[0]!="number",jS=e=>Array.isArray(e)&&typeof e[0]=="number",av={linear:tn,easeIn:LN,easeInOut:am,easeOut:_N,circIn:om,circInOut:_S,circOut:LS,backIn:sm,backInOut:DS,backOut:OS,anticipate:NS},BN=e=>typeof e=="string",lv=e=>{if(jS(e)){vi(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,r,i]=e;return Sa(t,n,r,i)}else if(BN(e))return vi(av[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),av[e];return e},We={delta:0,timestamp:0,isProcessing:!1},El;function FN(){El=void 0}var it={now:()=>(El===void 0&&it.set(We.isProcessing||ar.useManualTiming?We.timestamp:performance.now()),El),set:e=>{El=e,queueMicrotask(FN)}},ns=e=>Math.round(e*1e5)/1e5,BS=e=>t=>typeof t=="string"&&t.startsWith(e),FS=BS("--"),VN=BS("var(--"),lm=e=>VN(e)?zN.test(e.split("/*")[0].trim()):!1,zN=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function cv(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}var Is={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Ho={...Is,transform:e=>fr(0,1,e)},Ua={...Is,default:1},cm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function $N(e){return e==null}var HN=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,um=(e,t)=>n=>!!(typeof n=="string"&&HN.test(n)&&n.startsWith(e)||t&&!$N(n)&&Object.prototype.hasOwnProperty.call(n,t)),VS=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,s,o,a]=r.match(cm);return{[e]:parseFloat(i),[t]:parseFloat(s),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},WN=e=>fr(0,255,e),eh={...Is,transform:e=>Math.round(WN(e))},ni={test:um("rgb","red"),parse:VS("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+eh.transform(e)+", "+eh.transform(t)+", "+eh.transform(n)+", "+ns(Ho.transform(r))+")"};function UN(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Rf={test:um("#"),parse:UN,transform:ni.transform},ka=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Vn=ka("deg"),Pn=ka("%"),Q=ka("px"),qN=ka("vh"),KN=ka("vw"),uv={...Pn,parse:e=>Pn.parse(e)/100,transform:e=>Pn.transform(e*100)},Wi={test:um("hsl","hue"),parse:VS("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Pn.transform(ns(t))+", "+Pn.transform(ns(n))+", "+ns(Ho.transform(r))+")"},Ue={test:e=>ni.test(e)||Rf.test(e)||Wi.test(e),parse:e=>ni.test(e)?ni.parse(e):Wi.test(e)?Wi.parse(e):Rf.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?ni.transform(e):Wi.transform(e),getAnimatableNone:e=>{const t=Ue.parse(e);return t.alpha=0,Ue.transform(t)}},GN=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,zS=new RegExp(cm.source),$S=new RegExp(GN.source,"i");function QN(e){return isNaN(e)&&typeof e=="string"&&(zS.test(e)||$S.test(e))}var HS="number",WS="color",YN="var",XN="var(",hv="${}",JN=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ZN(e){const t=e.toString();return zS.test(t)||$S.test(t)}function Wo(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let s=0;return{values:n,split:t.replace(JN,o=>(Ue.test(o)?(r.color.push(s),i.push(WS),n.push(Ue.parse(o))):o.startsWith(XN)?(r.var.push(s),i.push(YN),n.push(o)):(r.number.push(s),i.push(HS),n.push(parseFloat(o))),++s,hv)).split(hv),indexes:r,types:i}}function e2(e){return Wo(e).values}function US({split:e,types:t}){const n=e.length;return r=>{let i="";for(let s=0;s<n;s++)if(i+=e[s],r[s]!==void 0){const o=t[s];o===HS?i+=ns(r[s]):o===WS?i+=Ue.transform(r[s]):i+=r[s]}return i}}function t2(e){return US(Wo(e))}var n2=e=>typeof e=="number"?0:Ue.test(e)?Ue.getAnimatableNone(e):e,r2=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:n2(e);function i2(e){const t=Wo(e);return US(t)(t.values.map((n,r)=>r2(n,t.split[r])))}var It={test:QN,parse:e2,createTransformer:t2,getAnimatableNone:i2};function th(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function s2({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,s=0,o=0;if(!t)i=s=o=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;i=th(l,a,e+1/3),s=th(l,a,e),o=th(l,a,e-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:r}}function fc(e,t){return n=>n>0?t:e}var ye=(e,t,n)=>e+(t-e)*n,nh=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},o2=[Rf,ni,Wi],a2=e=>o2.find(t=>t.test(e));function fv(e){const t=a2(e);if(!t)return iu(!1,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!1;let n=t.parse(e);return t===Wi&&(n=s2(n)),n}var dv=(e,t)=>{const n=fv(e),r=fv(t);if(!n||!r)return fc(e,t);const i={...n};return s=>(i.red=nh(n.red,r.red,s),i.green=nh(n.green,r.green,s),i.blue=nh(n.blue,r.blue,s),i.alpha=ye(n.alpha,r.alpha,s),ni.transform(i))},Pf=new Set(["none","hidden"]);function l2(e,t){return Pf.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function c2(e,t){return n=>ye(e,t,n)}function hm(e){return typeof e=="number"?c2:typeof e=="string"?lm(e)?fc:Ue.test(e)?dv:f2:Array.isArray(e)?qS:typeof e=="object"?Ue.test(e)?dv:u2:fc}function qS(e,t){const n=[...e],r=n.length,i=e.map((s,o)=>hm(s)(s,t[o]));return s=>{for(let o=0;o<r;o++)n[o]=i[o](s);return n}}function u2(e,t){const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=hm(e[i])(e[i],t[i]));return i=>{for(const s in r)n[s]=r[s](i);return n}}function h2(e,t){const n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const s=t.types[i],o=e.indexes[s][r[s]],a=e.values[o]??0;n[i]=a,r[s]++}return n}var f2=(e,t)=>{const n=It.createTransformer(t),r=Wo(e),i=Wo(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Pf.has(e)&&!i.values.length||Pf.has(t)&&!r.values.length?l2(e,t):wa(qS(h2(r,i),i.values),n):(iu(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),fc(e,t))},pv=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function d2(e,t){const n=pv.exec(e);if(!n)return;const r=pv.exec(t);if(!r||n[2]!==r[2])return;const i=n[2],s=parseFloat(n[1]),o=parseFloat(r[1]);return a=>ns(ye(s,o,a))+i}function fm(e,t,n){if(typeof e=="number"&&typeof t=="number"&&typeof n=="number")return ye(e,t,n);if(typeof e=="string"&&typeof t=="string"){const r=d2(e,t);if(r)return r}return hm(e)(e,t)}var qa=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function p2(e){let t=new Set,n=new Set,r=!1,i=!1;const s=new Set;let o={delta:0,timestamp:0,isProcessing:!1};function a(c){s.has(c)&&(n.add(c),e()),c(o)}const l={schedule:(c,u=!1,h=!1)=>{const f=h&&r?t:n;return u&&s.add(c),f.add(c),c},cancel:c=>{n.delete(c),s.delete(c)},process:c=>{if(o=c,r){i=!0;return}r=!0;const u=t;t=n,n=u,t.forEach(a),t.clear(),r=!1,i&&(i=!1,l.process(c))}};return l}var m2=40;function KS(e,t,n={delta:0,timestamp:0,isProcessing:!1}){let r=!1,i=!0;const s=()=>r=!0,o=qa.reduce((w,S)=>(w[S]=p2(s),w),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:h,preRender:f,render:d,postRender:m}=o,v=()=>{const w=ar.useManualTiming,S=w?n.timestamp:performance.now();r=!1,w||(n.delta=i?1e3/60:Math.max(Math.min(S-n.timestamp,m2),1)),n.timestamp=S,n.isProcessing=!0,a.process(n),l.process(n),c.process(n),u.process(n),h.process(n),f.process(n),d.process(n),m.process(n),n.isProcessing=!1,r&&t&&(i=!1,e(v))},y=()=>{r=!0,i=!0,n.isProcessing||e(v)};return{schedule:qa.reduce((w,S)=>{const C=o[S];return w[S]=(A,k=!1,E=!1)=>(r||y(),C.schedule(A,k,E)),w},{}),cancel:w=>{for(let S=0;S<qa.length;S++)o[qa[S]].cancel(w)},state:n,steps:o}}var{schedule:we,cancel:Ir,steps:rh}=KS(typeof requestAnimationFrame<"u"?requestAnimationFrame:tn,!0,We),g2=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>we.update(t,n),stop:()=>Ir(t),now:()=>We.isProcessing?We.timestamp:it.now()}},GS=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let s=0;s<i;s++)r+=Math.round(e(s/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},dm=2e4;function pm(e,t=50,n=dm,r){let i=0,s=e.next(i);for(r?.push(s.value);!s.done&&i<n;)i+=t,s=e.next(i),r?.push(s.value);return i>=n?1/0:i}function v2(e,t=100,n){const r=n({...e,keyframes:[0,t]}),i=Math.min(pm(r),dm);return{type:"keyframes",ease:s=>r.next(i*s).value/t,duration:Lt(i)}}var Xe={stiffness:100,damping:10,mass:1,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05},QS=e=>e<0?1/Math.max(1+e,Xe.minDamping):Math.max(1-e,Xe.minDamping);function YS(e,t){if(!(e>1))return 1;const n=Math.sqrt(e*e-1),r=e-n,i=e+n,s=2*n*Math.exp(-t)*(1+t);return XS(o=>i*Math.exp(-r*o)-r*Math.exp(-i*o)-s,o=>Math.exp(-i*o)-Math.exp(-r*o),t)/t}function If(e,t){return e*Math.sqrt(1-t*t)}var y2=12;function XS(e,t,n){let r=n;for(let i=1;i<y2;i++)r=r-e(r)/t(r);return r}var mv=.001;function x2({duration:e=Xe.duration,bounce:t=Xe.bounce}){let n,r;iu(e<=Pt(Xe.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");const i=QS(t);e=fr(Xe.minDuration,Xe.maxDuration,Lt(e)),i<1?(n=c=>{const u=c*i,h=u*e,f=If(c,i),d=Math.exp(-h);return mv-u/f*d},r=c=>{const u=c*i*e,h=i*i*c*c*e,f=Math.exp(-u),d=If(c*c,i);return(-n(c)+mv>0?-1:1)*-h*f/d}):(n=c=>-.001+Math.exp(-c*e)*(c*e+1),r=c=>Math.exp(-c*e)*(-c*(e*e)));const s=5/e,o=XS(n,r,s),a=o*YS(i,o*e),l=a*a;return{stiffness:l,damping:i*2*Math.sqrt(l),duration:Pt(e)}}var Of=(e,t)=>(t?e>=0:e>0)&&e<1/0;function ih(e,t){if(Of(e,t))return e}function b2(e){const t=ih(e.stiffness),n=ih(e.damping,!0),r=ih(e.mass),i={...e,stiffness:t??Xe.stiffness,damping:n??Xe.damping,mass:r??Xe.mass,isResolvedFromDuration:!1,isTimeDefined:(t??n??r)===void 0&&(e.duration!==void 0||e.bounce!==void 0)};if(i.isTimeDefined){if(e.visualDuration){const s=QS(e.bounce||0),o=2*Math.PI/(e.visualDuration*1.2)*YS(s,2*Math.PI/1.2);i.stiffness=o*o,i.damping=2*s*Math.sqrt(i.stiffness)}else Object.assign(i,x2(i)),i.isResolvedFromDuration=!0;(!Of(i.stiffness)||!Of(i.damping,!0))&&(i.stiffness=Xe.stiffness,i.damping=Xe.damping)}return i}function dc(e=Xe.visualDuration,t=Xe.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e,r=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],s={done:!1,value:r},{stiffness:o,damping:a,mass:l,duration:c,isResolvedFromDuration:u,isTimeDefined:h}=b2({...n}),f=k=>h?0:-Lt(k),d=a/(2*Math.sqrt(o*l)),m=Lt(Math.sqrt(o/l)),v=d*m,y={target:i,delta:i-r,velocity:f(n.velocity||0)||0,restSpeed:0,restDelta:0},x=()=>{const k=Math.abs(y.delta)<5;y.restSpeed=n.restSpeed||(k?Xe.restSpeed.granular:Xe.restSpeed.default),y.restDelta=n.restDelta||(k?Xe.restDelta.granular:Xe.restDelta.default)};x();let b,w,S;if(d<1){const k=If(m,d),E={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};S=()=>{E.A=(y.velocity+v*y.delta)/k,E.sinC=v*E.A+y.delta*k,E.cosC=v*y.delta-E.A*k};const T=R=>{R!==E.t&&(E.t=R,E.env=Math.exp(-v*R),E.sin=Math.sin(k*R),E.cos=Math.cos(k*R))};b=R=>(T(R),y.target-E.env*(E.A*E.sin+y.delta*E.cos)),w=R=>(T(R),E.env*(E.sinC*E.sin+E.cosC*E.cos))}else if(d===1){b=E=>y.target-Math.exp(-m*E)*(y.delta+(y.velocity+m*y.delta)*E);const k={C:0};S=()=>{k.C=y.velocity+m*y.delta},w=E=>Math.exp(-m*E)*(m*k.C*E-y.velocity)}else{const k=m*Math.sqrt(d*d-1),E=v-k,T=v+k,R=h?1/0:300/k,P=(N,L)=>Math.exp(L>R?-N*R-v*(L-R):-N*L),M={S:0,F:0};S=()=>{const N=(y.velocity+v*y.delta)/k;M.S=(y.delta+N)/2,M.F=(y.delta-N)/2},b=N=>y.target-M.S*P(E,N)-M.F*P(T,N),w=N=>E*M.S*P(E,N)+T*M.F*P(T,N)}S();const C=u&&c||null,A={calculatedDuration:C,retarget:(k,E)=>{y.target=k[k.length-1],y.delta=y.target-k[0],y.velocity=f(E),n.restSpeed&&n.restDelta||x(),A.calculatedDuration=C,s.done=!1,S()},velocity:k=>Pt(w(k)),next:k=>{const E=b(k);if(u)s.done=k>=c;else{const T=Pt(w(k));s.done=Math.abs(T)<=y.restSpeed&&Math.abs(y.target-E)<=y.restDelta}return s.value=s.done?y.target:E,s},toString:()=>{const k=Math.min(pm(A),dm),E=GS(T=>A.next(k*T).value,k,30);return k+"ms "+E},toTransition:()=>{}};return A}dc.applyToOptions=e=>{const t=v2(e,100,dc);return e.ease=t.ease,e.duration=Pt(t.duration),e.type="keyframes",e};function Df({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const h=e[0],f={done:!1,value:h},d=k=>k<a||k>l,m=k=>a===void 0?l:l===void 0||Math.abs(a-k)<Math.abs(l-k)?a:l;let v=n*t;const y=h+v,x=o===void 0?y:o(y);x!==y&&(v=x-h);const b=k=>-v*Math.exp(-k/r),w=k=>{const E=b(k);f.done=Math.abs(E)<=c,f.value=f.done?x:x+E};let S,C;const A=k=>{d(f.value)&&(S=k,C=dc({keyframes:[f.value,m(f.value)],velocity:-b(k)/r*1e3,damping:i,stiffness:s,restDelta:c,restSpeed:u}))};return A(0),{calculatedDuration:null,next:k=>{let E=!1;return!C&&S===void 0&&(E=!0,w(k),A(k)),S!==void 0&&k>=S?C.next(k-S):(!E&&w(k),f)}}}function w2(e,t,n){const r=[],i=n||ar.mix||fm,s=e.length-1;for(let o=0;o<s;o++){let a=i(e[o],e[o+1]);if(t){const l=Array.isArray(t)?t[o]||tn:t;a=wa(l,a)}r.push(a)}return r}function S2(e,t,{clamp:n=!0,ease:r,mixer:i}={}){const s=e.length;if(vi(s===t.length,"Both input and output ranges must be the same length","range-length"),s===1)return()=>t[0];if(s===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=w2(t,r,i),l=a.length,c=u=>{if(o&&u<e[0])return t[0];let h=0;if(l>1)for(;h<e.length-2&&!(u<e[h+1]);h++);const f=$o(e[h],e[h+1],u);return a[h](f)};return n?u=>c(fr(e[0],e[s-1],u)):c}function k2(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=$o(0,t,r);e.push(ye(n,1,i))}}function C2(e){const t=[0];return k2(t,e.length-1),t}function A2(e,t){return e.map(n=>n*t)}function T2(e,t){return e.map(()=>t||am).splice(0,e.length-1)}function wo({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=jN(r)?r.map(lv):lv(r)||am,s={done:!1,value:t[0]};if(t.length===2&&!Array.isArray(i)&&(!n||n.length!==2||n[0]===0&&n[1]===1)){const[l,c]=t,u=l===c?void 0:(ar.mix||fm)(l,c);return{calculatedDuration:e,next:h=>(s.value=u?u(i(e>0?fr(0,1,h/e):1)):c,s.done=h>=e,s)}}const o=A2(n&&n.length===t.length?n:C2(t),e),a=S2(o,t,{ease:Array.isArray(i)?i:T2(t,i)});return{calculatedDuration:e,next:l=>(s.value=a(l),s.done=l>=e,s)}}var E2=5;function M2(e,t,n){const r=Math.max(t-E2,0);return MS(n-e(r),t-r)}function R2(e,t,n=0){return t<=0?n:e.velocity?e.velocity(t):M2(r=>e.next(r).value,t,e.next(t).value)}var P2=e=>e!==null;function su(e,{repeat:t,repeatType:n="loop"},r,i=1){const s=e.filter(P2),o=i<0||t&&n!=="loop"&&t%2===1?0:s.length-1;return!o||r===void 0?s[o]:r}var I2={decay:Df,inertia:Df,tween:wo,keyframes:wo,spring:dc};function JS(e){typeof e.type=="string"&&(e.type=I2[e.type])}function ZS(e,t){return{kind:e,animation:t,timestamp:it.now(),frameTimestamp:We.timestamp,frameIsProcessing:We.isProcessing}}function ek(e,t,n){const r=globalThis.__MOTION_INSPECT__;if(r)try{r({...ZS("animation-start",e),options:n?{...t,...n}:t})}catch{}}function O2(e,t){const n=globalThis.__MOTION_INSPECT__;if(n)try{n({...ZS("layout-animation-start",e),node:t})}catch{}}var mm=class{constructor(){this.isResolved=!1}get finished(){return this._finished||(this._finished=this.isResolved?Promise.resolve():new Promise(e=>{this._resolve=e})),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){this.isResolved=!0,this._resolve?.()}then(e,t){return this.finished.then(e,t)}},D2=e=>e/100,pc=class extends mm{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==it.now()&&this.tick(it.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause(),ek(this,this.options)}initAnimation(){const{options:e}=this;JS(e);const{type:t=wo,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:s=0}=e;let{keyframes:o}=e;const a=t||wo;a!==wo&&typeof o[0]!="number"&&(this.mixKeyframes=wa(D2,fm(o[0],o[1])),o=[0,100]);const l=a(o===e.keyframes?e:{...e,keyframes:o});i==="mirror"&&(this.mirroredGenerator=a({...e,keyframes:[...o].reverse(),velocity:-s})),l.calculatedDuration===null&&(l.calculatedDuration=pm(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=l}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:s,resolvedDuration:o,calculatedDuration:a}=this;if(this.startTime===null)return n.next(0);const{delay:l=0,keyframes:c,repeat:u,repeatType:h,repeatDelay:f,type:d,onUpdate:m,finalKeyframe:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const y=this.currentTime-l*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?y<0:y>r;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let b=this.currentTime,w=n;if(u){const k=Math.min(this.currentTime,r)/o;let E=Math.floor(k),T=k%1;!T&&k>=1&&(T=1),T===1&&E--,E=Math.min(E,u+1),E%2&&(h==="reverse"?(T=1-T,f&&(T-=f/o)):h==="mirror"&&(w=s)),b=fr(0,1,T)*o}let S;x?(this.delayState.value=c[0],S=this.delayState):S=w.next(b),i&&!x&&(S.value=i(S.value));let{done:C}=S;!x&&a!==null&&(C=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const A=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return A&&d!==Df&&(S.value=su(c,this.options,v,this.speed)),m&&m(S.value),A&&this.finish(),S}then(e,t){return this.finished.then(e,t)}get duration(){return Lt(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Lt(e)}get time(){return Lt(this.currentTime)}set time(e){e=Pt(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){return R2(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(it.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Lt(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=g2,startTime:t}=this.options;this.driver||(this.driver=e(r=>this.tick(r))),this.options.onPlay?.();const n=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=n):this.holdTime!==null?this.startTime=n-this.holdTime:this.startTime||(this.startTime=t??n),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(it.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}},N2=new Set(["brightness","contrast","saturate","opacity"]);function L2(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(cm)||[];if(!r)return e;const i=n.replace(r,"");let s=N2.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+i+")"}var _2=/\b([a-z-]*)\(.*?\)/gu,Nf={...It,getAnimatableNone:e=>{const t=e.match(_2);return t?t.map(L2).join(" "):e}},Lf={...It,getAnimatableNone:e=>{const t=It.parse(e);return It.createTransformer(e)(t.map(n=>typeof n=="number"?0:typeof n=="object"?{...n,alpha:1}:n))}},gv={...Is,transform:Math.round},j2={rotate:Vn,pathRotation:Vn,rotateX:Vn,rotateY:Vn,rotateZ:Vn,scale:Ua,scaleX:Ua,scaleY:Ua,scaleZ:Ua,skew:Vn,skewX:Vn,skewY:Vn,distance:Q,translateX:Q,translateY:Q,translateZ:Q,x:Q,y:Q,z:Q,perspective:Q,transformPerspective:Q,opacity:Ho,originX:uv,originY:uv,originZ:Q},mc={borderWidth:Q,borderTopWidth:Q,borderRightWidth:Q,borderBottomWidth:Q,borderLeftWidth:Q,borderRadius:Q,borderTopLeftRadius:Q,borderTopRightRadius:Q,borderBottomRightRadius:Q,borderBottomLeftRadius:Q,width:Q,maxWidth:Q,height:Q,maxHeight:Q,top:Q,right:Q,bottom:Q,left:Q,inset:Q,insetBlock:Q,insetBlockStart:Q,insetBlockEnd:Q,insetInline:Q,insetInlineStart:Q,insetInlineEnd:Q,padding:Q,paddingTop:Q,paddingRight:Q,paddingBottom:Q,paddingLeft:Q,paddingBlock:Q,paddingBlockStart:Q,paddingBlockEnd:Q,paddingInline:Q,paddingInlineStart:Q,paddingInlineEnd:Q,margin:Q,marginTop:Q,marginRight:Q,marginBottom:Q,marginLeft:Q,marginBlock:Q,marginBlockStart:Q,marginBlockEnd:Q,marginInline:Q,marginInlineStart:Q,marginInlineEnd:Q,fontSize:Q,backgroundPositionX:Q,backgroundPositionY:Q,...j2,zIndex:gv,fillOpacity:Ho,strokeOpacity:Ho,numOctaves:gv},B2={...mc,color:Ue,backgroundColor:Ue,outlineColor:Ue,fill:Ue,stroke:Ue,borderColor:Ue,borderTopColor:Ue,borderRightColor:Ue,borderBottomColor:Ue,borderLeftColor:Ue,filter:Nf,WebkitFilter:Nf,mask:Lf,WebkitMask:Lf},tk=e=>B2[e],F2=new Set([Nf,Lf]);function gm(e,t){let n=tk(e);return F2.has(n)||(n=It),n.getAnimatableNone?n.getAnimatableNone(t):void 0}function V2(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var ri=e=>e*180/Math.PI,_f=e=>{const t=ri(Math.atan2(e[1],e[0]));return jf(t)},z2={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:_f,rotateZ:_f,skewX:e=>ri(Math.atan(e[1])),skewY:e=>ri(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},jf=e=>(e=e%360,e<0&&(e+=360),e),vv=_f,yv=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),xv=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),$2={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:yv,scaleY:xv,scale:e=>(yv(e)+xv(e))/2,rotateX:e=>jf(ri(Math.atan2(e[6],e[5]))),rotateY:e=>jf(ri(Math.atan2(-e[2],e[0]))),rotateZ:vv,rotate:vv,skewX:e=>ri(Math.atan(e[4])),skewY:e=>ri(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Uo(e){return e.includes("scale")?1:0}function Bf(e,t){if(!e||e==="none")return Uo(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=$2,i=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=z2,i=a}if(!i)return Uo(t);const s=r[t],o=i[1].split(",").map(W2);return typeof s=="function"?s(o):o[s]}var H2=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Bf(n,t)};function W2(e){return parseFloat(e.trim())}var Os=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Er=new Set([...Os,"pathRotation"]),bv=e=>e===Is||e===Q,U2=new Set(["x","y","z"]),q2=Os.filter(e=>!U2.has(e));function K2(e){const t=[];return q2.forEach(n=>{const r=e.getValue(n);if(r!==void 0){const i=r.get(),s=n.startsWith("scale")?1:0;if(i===s)return;t.push([n,i]),r.set(s)}}),t}var G2=new Set(["bottom","right"]);function wv(e,t,n,r,i,s){const o=parseFloat(e);if(!isNaN(o))return o;const{min:a,max:l}=t()[n],c=l-a;return s==="border-box"?c:c-parseFloat(r)-parseFloat(i)}var si={width:({width:e,paddingLeft:t="0",paddingRight:n="0",boxSizing:r},i)=>wv(e,i,"x",t,n,r),height:({height:e,paddingTop:t="0",paddingBottom:n="0",boxSizing:r},i)=>wv(e,i,"y",t,n,r),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{const{y:n}=t();return parseFloat(e)+(n.max-n.min)},right:({left:e},t)=>{const{x:n}=t();return parseFloat(e)+(n.max-n.min)},x:({transform:e})=>Bf(e,"x"),y:({transform:e})=>Bf(e,"y")};si.translateX=si.x;si.translateY=si.y;var oi=new Set,Ff=!1,Vf=!1,zf=!1;function nk(){if(Vf){const e=[],t=new Set,n=new Set;oi.forEach(i=>{i.needsMeasurement&&(e.push(i),t.add(i.element),G2.has(i.name)&&n.add(i.element))});const r=new Map;n.forEach(i=>{const s=K2(i);s.length&&(r.set(i,s),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const s=r.get(i);s&&s.forEach(([o,a])=>{i.getValue(o)?.set(a)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}Vf=!1,Ff=!1,oi.forEach(e=>e.complete(zf)),oi.clear()}function rk(){oi.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Vf=!0)})}function Q2(){zf=!0,rk(),nk(),zf=!1}function Y2(e,t,n){if(typeof e=="string"){if(rm(e)||im(e))return parseFloat(e);if(!It.test(e)&&It.test(n))return gm(t,n)}return e??void 0}var vm=class{constructor(e,t,n,r,i,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(oi.add(this),Ff||(Ff=!0,we.read(rk),we.resolveKeyframes(nk))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){const i=r?.get(),s=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){const o=Y2(n.readValue(t,s),t,s);o!==void 0&&(e[0]=o)}e[0]===void 0&&(e[0]=s),r&&i===void 0&&r.set(e[0])}V2(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),oi.delete(this)}cancel(){this.state==="scheduled"&&(oi.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}},X2=e=>e.startsWith("--");function ik(e,t,n){X2(t)?e.style.setProperty(t,n):e.style[t]=n}var J2={};function sk(e,t){const n=ES(e);return()=>J2[t]??n()}var Z2=sk(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),ok=sk(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),ro=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Sv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ro([0,.65,.55,1]),circOut:ro([.55,0,1,.45]),backIn:ro([.31,.01,.66,-.59]),backOut:ro([.33,1.53,.69,.99])};function ak(e,t){if(e)return typeof e=="function"?ok()?GS(e,t):"ease-out":jS(e)?ro(e):Array.isArray(e)?e.map(n=>ak(n,t)||Sv.easeOut):Sv[e]}function eL(e,t,n,{delay:r=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const h=ak(a,i);Array.isArray(h)&&(u.easing=h);const f={delay:r,duration:i,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"};return c&&(f.pseudoElement=c),e.animate(u,f)}function lk(e){return typeof e=="function"&&"applyToOptions"in e}function tL({type:e,...t}){return lk(e)&&ok()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}var ck=class extends mm{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:s=!1,finalKeyframe:o,onComplete:a}=e;this.isPseudoElement=!!i,this.allowFlatten=s,this.options=e,vi(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const l=tL(e);this.animation=eL(t,n,r,l,i),l.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const c=su(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(c),ik(t,n,c),this.animation.cancel()}a?.(),this.notifyFinished()},ek(this,e,l)}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return Lt(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Lt(e)}get time(){return Lt(Number(this.animation.currentTime)||0)}set time(e){const t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Pt(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,onAttach:t,observe:n,...r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&Z2()?(this.animation.timeline=e,Object.assign(this.animation,r),t?.(this.animation),tn):n(this)}},uk={anticipate:NS,backInOut:DS,circInOut:_S};function nL(e){return e in uk}function rL(e){typeof e.ease=="string"&&nL(e.ease)&&(e.ease=uk[e.ease])}var sh=10,iL=class extends ck{constructor(e){rL(e),JS(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:n,onComplete:r,element:i,...s}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}const o=new pc({...s,autoplay:!1}),a=Math.max(sh,it.now()-this.startTime),l=fr(0,sh,a-sh),c=o.sample(a).value,{name:u}=this.options;i&&u&&ik(i,u,c),t.setWithVelocity(o.sample(Math.max(0,a-l)).value,c,l),o.stop()}},kv=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(It.test(e)||e==="0")&&!e.startsWith("url("));function sL(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function oL(e,t,n,r){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const s=e[e.length-1],o=kv(i,t),a=kv(s,t);return!o||!a?(o!==a&&iu(!1,`You are trying to animate ${t} from "${i}" to "${s}". "${o?s:i}" is not an animatable value.`,"value-not-animatable"),!1):sL(e)||(n==="spring"||lk(n))&&r}function $f(e){e.duration=0,e.type="keyframes"}var Hf=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),aL=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function lL(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&aL.test(e[t]))return!0;return!1}var Cv=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),cL=ES(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function uL(e){const{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:s,type:o,keyframes:a}=e;if(!n||!(Hf.has(n)||Cv.has(n)))return!1;const l=t?.owner?.current;if(!(l instanceof HTMLElement)&&!(l instanceof SVGElement))return!1;const{onUpdate:c,transformTemplate:u}=t.owner.getProps();return cL()&&(Hf.has(n)||Cv.has(n)&&lL(a))&&(n!=="transform"||!u)&&!c&&!r&&i!=="mirror"&&s!==0&&o!=="inertia"}var hL=40,fL=class extends mm{constructor(e){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=it.now();const{keyframes:t,name:n,motionValue:r,element:i}=e,s=e;s.autoplay??(s.autoplay=!0),s.delay??(s.delay=0),s.type??(s.type="keyframes"),s.repeat??(s.repeat=0),s.repeatDelay??(s.repeatDelay=0),s.repeatType??(s.repeatType="loop");const o=i?.KeyframeResolver||vm;this.keyframeResolver=new o(t,(a,l,c)=>this.onKeyframesResolved(a,l,s,!c),n,r,i),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;const{name:i,type:s,velocity:o,delay:a,isHandoff:l,onUpdate:c}=n;this.resolvedAt=it.now();let u=!0;oL(e,i,s,o)||(u=!1,(ar.instantAnimations||!a)&&c?.(su(e,n,t)),e[0]=e[e.length-1],$f(n),n.repeat=0);const h=r?this.resolvedAt?this.resolvedAt-this.createdAt>hL?this.resolvedAt:this.createdAt:this.createdAt:void 0,{onComplete:f}=n;n.startTime??(n.startTime=h),n.finalKeyframe=t,n.keyframes=e,n.onComplete=()=>{f?.(),this.notifyFinished()};const d=u&&!l&&uL(n);let m;if(d){n.element=n.motionValue?.owner?.current;try{m=new iL(n)}catch{m=new pc(n)}}else m=new pc(n);this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this._animation.finished:super.finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Q2()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function hk(e,t,n,r=0,i=1){const s=Array.from(e).sort((l,c)=>l.sortNodePosition(c)).indexOf(t),o=e.size,a=(o-1)*r;return typeof n=="function"?n(s,o):i===1?s*r:a-s*r}var Av=30,dL=e=>!isNaN(parseFloat(e)),Tv={current:void 0},pL=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{const r=it.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&(this.notifyChange(),this.dependents))for(const i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=it.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=dL(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){var n;return e==="change"?this.onChangeSubscribe(t):((n=this.events)[e]||(n[e]=new hc)).add(t)}onChangeSubscribe(e){const{events:t}=this;return!t.change&&!this.changeSubscriber?this.changeSubscriber=e:(t.change||(t.change=new hc,t.change.add(this.changeSubscriber),this.changeSubscriber=void 0),t.change.add(e)),()=>{this.changeSubscriber===e?this.changeSubscriber=void 0:t.change?.remove(e),this.stopIfUnobserved()}}stopIfUnobserved(){we.read(()=>{!this.changeSubscriber&&!this.events.change?.getSize()&&this.stop()})}clearListeners(){this.changeSubscriber=void 0;for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.notifyChange()}notifyChange(){const{current:e,changeSubscriber:t}=this;t?t(e):this.events.change?.notify(e)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Tv.current&&Tv.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=it.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Av)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,Av);return MS(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0;let n=!1,r;r=e(()=>{n=!0,this.events.animationComplete?.notify(),this.animation===r&&this.clearAnimation(),t()}),n||(this.animation=r),this.events.animationStart?.notify()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){this.animation=void 0}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function ds(e,t){return new pL(e,t)}function fk(e,t){if(e?.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function ym(e,t){const n=e?.[t]??e?.default??e;return n!==e?fk(n,e):n}var mL={type:"spring",stiffness:500,damping:25,restSpeed:10},gL=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),vL={type:"keyframes",duration:.8},yL={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},xL=(e,{keyframes:t})=>t.length>2?vL:Er.has(e)?e.startsWith("scale")?gL(t[1]):mL:yL,bL=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function wL(e){for(const t in e)if(!bL.has(t))return!0;return!1}var xm=(e,t,n,r={},i,s)=>o=>{const a=ym(r,e)||{},l=a.delay||r.delay||0;let{elapsed:c=0}=r;c=c-Pt(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-c,onUpdate:f=>{t.set(f),a.onUpdate&&a.onUpdate(f)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:s?void 0:i};wL(a)||Object.assign(u,xL(e,u)),u.duration&&(u.duration=Pt(u.duration)),u.repeatDelay&&(u.repeatDelay=Pt(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let h=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&($f(u),u.delay===0&&(h=!0)),(ar.instantAnimations||ar.skipAnimations||i?.shouldSkipAnimations||a.skipAnimations)&&(h=!0,$f(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,h&&!s&&t.get()!==void 0){const f=su(u.keyframes,a);if(f!==void 0){we.update(()=>{u.onUpdate(f),u.onComplete()});return}}return a.isSync?new pc(u):new fL(u)},SL=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function kL(e){const t=SL.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}var CL=4;function dk(e,t,n=1){vi(n<=CL,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,i]=kL(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const o=s.trim();return rm(o)?parseFloat(o):o}return lm(i)?dk(i,t,n+1):i}function AL(e){const t=[{},{}];return e?.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function pk(e,t,n,r){const i=s=>typeof s=="function"?s(n!==void 0?n:e.custom,...AL(r)):s;return t=i(t),typeof t=="string"&&(t=e.variants&&e.variants[t]),i(t)}function ai(e,t,n){return pk(e.getProps(),t,n,e)}var mk=(e,t)=>t==="exit"?e.presenceContext?.custom:void 0,gk=new Set(["width","height","top","left","right","bottom",...Os]),TL=e=>Array.isArray(e);function EL(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,ds(n))}function ML(e){return TL(e)?e[e.length-1]||0:e}function RL(e,t){let{transitionEnd:n={},transition:r={},...i}=ai(e,t)||{};i={...i,...n};for(const s in i)EL(e,s,ML(i[s]))}var st=e=>!!(e&&e.getVelocity);function PL(e){return!!(st(e)&&e.add)}function Wf(e,t){const n=e.getValue("willChange");if(PL(n))return n.add(t);if(!n&&ar.WillChange){const r=new ar.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function bm(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var IL="framerAppearId",vk="data-"+bm(IL);function yk(e){return e.props[vk]}var OL=typeof window<"u";function DL({protectedKeys:e,needsAnimating:t},n){const r=n in e&&!t[n];return t[n]=!1,r}function xk(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:s,transitionEnd:o,...a}=t;const l=e.getDefaultTransition();s=s?fk(s,l):l;const c=s?.reduceMotion,u=s?.skipAnimations;r&&(s=r);const h=[],f=i&&e.animationState?.getState()[i],d=s?.path;d&&d.animateVisualElement(e,a,s,n,h);for(const m in a){const v=e.getValue(m,e.latestValues[m]??null),y=a[m];if(y===void 0||f&&DL(f,m))continue;const x={delay:n,...ym(s||{},m)};u&&(x.skipAnimations=!0);const b=v.get();if(b!==void 0&&!v.isAnimating()&&!Array.isArray(y)&&y===b&&!x.velocity){we.update(()=>v.set(y));continue}let w=!1;if(OL&&window.MotionHandoffAnimation){const A=yk(e);if(A){const k=window.MotionHandoffAnimation(A,m,we);k!==null&&(x.startTime=k,w=!0)}}Wf(e,m);const S=c??e.shouldReduceMotion;v.start(xm(m,v,y,S&&gk.has(m)?{type:!1}:x,e,w));const C=v.animation;C&&h.push(C)}if(o){const m=()=>we.update(()=>{o&&RL(e,o)});h.length?Promise.all(h).then(m):m()}return h}function Uf(e,t,n={}){const r=ai(e,t,mk(e,n.type)),i=n.transitionOverride||(r?.transition??(e.getDefaultTransition()||{})),s=()=>Promise.all(r?xk(e,r,n):[]),o=(l=0)=>{const{variantChildren:c}=e,{delayChildren:u=0,staggerChildren:h,staggerDirection:f}=i,d=[];return c?.forEach(m=>{m.notify("AnimationStart",t),d.push(Uf(m,t,{...n,delay:l+(typeof u=="function"?0:u)+hk(c,m,u,h,f)}).then(()=>m.notify("AnimationComplete",t)))}),Promise.all(d)},{when:a}=i;return a?a==="beforeChildren"?s().then(()=>o()):o().then(s):Promise.all([s(),o(n.delay)])}function NL(e,t,n={}){return e.notify("AnimationStart",t),(Array.isArray(t)?Promise.all(t.map(r=>Uf(e,r,n))):typeof t=="string"?Uf(e,t,n):Promise.all(xk(e,ai(e,t,n.custom),n))).then(()=>{e.notify("AnimationComplete",t)})}var LL={test:e=>e==="auto",parse:e=>e},_L=e=>t=>t.test(e),jL=[Is,Q,Pn,Vn,KN,qN,LL],Ev=e=>jL.find(_L(e));function BL(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||im(e):!0}var FL=new Set(["auto","none","0"]);function VL(e,t,n){let r=0,i;for(;r<e.length&&!i;){const s=e[r];typeof s=="string"&&!FL.has(s)&&ZN(s)&&(i=e[r]),r++}if(i&&n)for(const s of t)e[s]!==i&&(e[s]=gm(n,i))}var zL=class extends vm{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let a=0;a<e.length;a++){let l=e[a];if(typeof l=="string"&&(l=l.trim(),lm(l))){const c=dk(l,t.current);c!==void 0&&(e[a]=c),a===e.length-1&&(this.finalKeyframe=l)}}if(this.resolveNoneKeyframes(),!gk.has(n)||e.length!==2)return;const[r,i]=e;if(typeof r=="number"&&typeof i=="number")return;const s=Ev(r),o=Ev(i);if(cv(r)!==cv(i)&&si[n]){this.needsMeasurement=!0;return}if(s!==o)if(bv(s)&&bv(o))for(let a=0;a<e.length;a++){const l=e[a];typeof l=="string"&&(e[a]=parseFloat(l))}else si[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,n=[];for(let r=0;r<e.length;r++)(e[r]===null||BL(e[r]))&&n.push(r);n.length&&VL(e,n,t)}measure(){const{element:e,name:t}=this;return si[t](window.getComputedStyle(e.current),()=>e.measureViewportBox())}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),t[0]=this.measuredOrigin;const r=t[t.length-1];r!==void 0&&this.motionValue?.jump(r,!1)}measureEndState(){const{element:e,unresolvedKeyframes:t}=this;if(!e||!e.current)return;this.motionValue?.jump(this.measuredOrigin,!1);const n=t.length-1,r=t[n];t[n]=this.measure(),r!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach(([i,s])=>{e.getValue(i).set(s)}),this.resolveNoneKeyframes()}},wm=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function $L(e){return TS(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}function Sm(e){return TS(e)&&"ownerSVGElement"in e}var qf=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function bk(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;t&&(r=t.current);const i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(r=>r!=null)}var HL={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},WL=Os.length;function UL(e,t,n){let r="",i=!0;for(let o=0;o<WL;o++){const a=Os[o],l=e[a];if(l===void 0)continue;let c=!0;if(typeof l=="number")c=l===(a.startsWith("scale")?1:0);else{const u=parseFloat(l);c=a.startsWith("scale")?u===1:u===0}if(!c||n){const u=qf(l,mc[a]);if(!c){i=!1;const h=HL[a]||a;r+=`${h}(${u}) `}n&&(t[a]=u)}}const s=e.pathRotation;return s&&(i=!1,r+=`rotate(${qf(s,mc.pathRotation)}) `),r=r.trim(),n?r=n(t,i?"":r):i&&(r="none"),r}function km(e,t,n){const{style:r,vars:i,transformOrigin:s}=e;let o=!1,a=!1;for(const l in t){const c=t[l];if(Er.has(l)){o=!0;continue}else if(FS(l)){i[l]=c;continue}else{const u=qf(c,mc[l]);l.startsWith("origin")?(a=!0,s[l]=u):r[l]=u}}if(t.transform||(o||n?r.transform=UL(t,e.transform,n):r.transform&&(r.transform="none")),a){const{originX:l="50%",originY:c="50%",originZ:u=0}=s;r.transformOrigin=`${l} ${c} ${u}`}}var qL={offset:"stroke-dashoffset",array:"stroke-dasharray"},KL={offset:"strokeDashoffset",array:"strokeDasharray"};function GL(e,t,n=1,r=0,i=!0){e.pathLength=1;const s=i?qL:KL;e[s.offset]=`${-r}`,e[s.array]=`${t} ${n}`}var wk=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Sk(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:s=1,pathOffset:o=0,...a},l,c,u){if(km(e,a,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:f}=e;for(const d of wk)h[d]!==void 0&&(f[d]=h[d],delete h[d]);(f.transform||h.transformOrigin)&&(f.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??"fill-box",delete h.transformBox),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),i!==void 0&&GL(h,i,s,o,!1)}function kk({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function QL({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function YL(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function oh(e){return e===void 0||e===1}function Kf({scale:e,scaleX:t,scaleY:n}){return!oh(e)||!oh(t)||!oh(n)}function Jr(e){return Kf(e)||Ck(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Ck(e){return Mv(e.x)||Mv(e.y)}function Mv(e){return e&&e!=="0%"}function gc(e,t,n){return n+t*(e-n)}function Rv(e,t,n,r,i){return i!==void 0&&(e=gc(e,i,r)),gc(e,n,r)+t}function Gf(e,t=0,n=1,r,i){e.min=Rv(e.min,t,n,r,i),e.max=Rv(e.max,t,n,r,i)}function Ak(e,{x:t,y:n}){Gf(e.x,t.translate,t.scale,t.originPoint),Gf(e.y,n.translate,n.scale,n.originPoint)}var Pv=.999999999999,Iv=1.0000000000001;function XL(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let s,o;for(let a=0;a<i;a++){s=n[a],o=s.projectionDelta;const{visualElement:l}=s.options;l&&l.props.style&&l.props.style.display==="contents"||(r&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(Sn(e.x,-s.scroll.offset.x),Sn(e.y,-s.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Ak(e,o)),r&&Jr(s.latestValues)&&Ml(e,s.latestValues,s.layout?.layoutBox))}t.x<Iv&&t.x>Pv&&(t.x=1),t.y<Iv&&t.y>Pv&&(t.y=1)}function Sn(e,t){e.min+=t,e.max+=t}function Ov(e,t,n,r,i=.5){Gf(e,t,n,ye(e.min,e.max,i),r)}function Dv(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Ml(e,t,n){const r=n??e;Ov(e.x,Dv(t.x,r.x),t.scaleX,t.scale,t.originX),Ov(e.y,Dv(t.y,r.y),t.scaleY,t.scale,t.originY)}function Tk(e,t){return kk(YL(e.getBoundingClientRect(),t))}function JL(e,t,n){const r=Tk(e,n),{scroll:i}=t;return i&&(Sn(r.x,i.offset.x),Sn(r.y,i.offset.y)),r}var{schedule:Cm,cancel:b6}=KS(queueMicrotask,!1),Kt={x:!1,y:!1};function Ek(){return Kt.x||Kt.y}function ZL(e){return e==="x"||e==="y"?Kt[e]?null:(Kt[e]=!0,()=>{Kt[e]=!1}):Kt.x||Kt.y?null:(Kt.x=Kt.y=!0,()=>{Kt.x=Kt.y=!1})}function Mk(e,t){const n=bk(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function e_(e){return!(e.pointerType==="touch"||Ek())}function t_(e,t,n={}){const[r,i,s]=Mk(e,n);return r.forEach(o=>{let a=!1,l=!1,c;const u=()=>{o.removeEventListener("pointerleave",m)},h=y=>{c&&(c(y),c=void 0),u()},f=y=>{a=!1,window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),l&&(l=!1,h(y))},d=()=>{a=!0,window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",f,i)},m=y=>{if(y.pointerType!=="touch"){if(a){l=!0;return}h(y)}},v=y=>{if(!e_(y))return;l=!1;const x=t(o,y);typeof x=="function"&&(c=x,o.addEventListener("pointerleave",m,i))};o.addEventListener("pointerenter",v,i),o.addEventListener("pointerdown",d,i)}),s}var Rk=(e,t)=>t?e===t?!0:Rk(e,t.parentElement):!1,Am=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,n_=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function r_(e){return n_.has(e.tagName)||e.isContentEditable===!0}var i_=new Set(["INPUT","SELECT","TEXTAREA"]);function s_(e){return i_.has(e.tagName)||e.isContentEditable===!0}var Rl=new WeakSet;function Nv(e){return t=>{t.key==="Enter"&&e(t)}}function ah(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}var o_=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=Nv(()=>{if(Rl.has(n))return;ah(n,"down");const i=Nv(()=>{ah(n,"up")}),s=()=>ah(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Lv(e){return Am(e)&&!Ek()}var _v=new WeakSet;function a_(e,t,n={}){const[r,i,s]=Mk(e,n),o=a=>{const l=a.currentTarget;if(!Lv(a)||_v.has(a))return;Rl.add(l),n.stopPropagation&&_v.add(a);const c=t(l,a),u={...i,capture:!0},h=(m,v)=>{window.removeEventListener("pointerup",f,u),window.removeEventListener("pointercancel",d,u),Rl.has(l)&&Rl.delete(l),Lv(m)&&typeof c=="function"&&c(m,{success:v})},f=m=>{h(m,l===window||l===document||n.useGlobalTarget||Rk(l,m.target))},d=m=>{h(m,!1)};window.addEventListener("pointerup",f,u),window.addEventListener("pointercancel",d,u)};return r.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,i),$L(a)&&(a.addEventListener("focus",l=>o_(l,i)),!r_(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),s}var Pl=new WeakMap,Il,Pk=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+"Size"]:Sm(r)&&"getBBox"in r?r.getBBox()[t]:r[n],l_=Pk("inline","width","offsetWidth"),c_=Pk("block","height","offsetHeight");function u_({target:e,borderBoxSize:t}){Pl.get(e)?.forEach(n=>{n(e,{get width(){return l_(e,t)},get height(){return c_(e,t)}})})}function h_(e){e.forEach(u_)}function f_(){typeof ResizeObserver>"u"||(Il=new ResizeObserver(h_))}function d_(e,t){Il||f_();const n=bk(e);return n.forEach(r=>{let i=Pl.get(r);i||(i=new Set,Pl.set(r,i)),i.add(t),Il?.observe(r)}),()=>{n.forEach(r=>{const i=Pl.get(r);i?.delete(t),i?.size||Il?.unobserve(r)})}}var Ol=new Set,Ui;function p_(){Ui=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Ol.forEach(t=>t(e))},window.addEventListener("resize",Ui)}function m_(e){return Ol.add(e),Ui||p_(),()=>{Ol.delete(e),!Ol.size&&typeof Ui=="function"&&(window.removeEventListener("resize",Ui),Ui=void 0)}}function jv(e,t){return typeof e=="function"?m_(e):d_(e,t)}var Bi={value:null,addProjectionMetrics:null};function g_(e){return Sm(e)&&e.tagName==="svg"}var Bv=e=>typeof e=="number"?e:parseFloat(e),Fv=()=>({translate:0,scale:1,origin:0,originPoint:0}),qi=()=>({x:Fv(),y:Fv()}),Vv=()=>({min:0,max:0}),He=()=>({x:Vv(),y:Vv()}),v_=new WeakMap;function ou(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function qo(e){return typeof e=="string"||Array.isArray(e)}var Tm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],zv=["initial",...Tm];function au(e){if(ou(e.animate))return!0;for(let t=0;t<zv.length;t++)if(qo(e[zv[t]]))return!0;return!1}function Ik(e){return!!(au(e)||e.variants)}function y_(e,t,n){for(const r in t){const i=t[r],s=n[r];if(st(i))e.addValue(r,i);else if(st(s))e.addValue(r,ds(i,{owner:e}));else if(s!==i)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=e.getStaticValue(r);e.addValue(r,ds(o!==void 0?o:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}var $v=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],vc={};function Ok(e){vc=e}function x_(){return vc}var b_=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=vm,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=it.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,we.render(this.render,!1,!0))};const{latestValues:l,renderState:c}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=a,this.blockInitialAnimation=!!s,this.isControllingVariants=au(t),this.isVariantNode=Ik(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:u,...h}=this.scrapeMotionValuesFromProps(t,{},this);for(const f in h){const d=h[f];l[f]!==void 0&&st(d)&&d.set(l[f])}}mount(e){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];if(this.current=e,v_.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.isVariantNode&&!this.isControllingVariants){let t=this;do t=t.props.inherit!==!1&&t.parent;while(t&&!t.isVariantNode);if(t){const{variantChildren:n}=t;n.add(this),this.removeFromVariantTree=()=>n.delete(this)}}this.values.forEach((t,n)=>this.bindToMotionValue(n,t)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(gM.current||mM(),this.shouldReduceMotion=fM.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Ir(this.notifyUpdate),Ir(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&Hf.has(e)&&this.current instanceof HTMLElement){const{factory:s,keyframes:o,times:a,ease:l,duration:c}=t.accelerate,u=new ck({element:this.current,name:e,keyframes:o,times:a,ease:l,duration:Pt(c)}),h=s(u);this.valueSubscriptions.set(e,()=>{h(),u.cancel()});return}const n=Er.has(e);n&&this.onBindTransform&&this.onBindTransform();const r=t.on("change",s=>{this.latestValues[e]=s,this.props.onUpdate&&we.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!e.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in vc){const t=vc[e];if(!t)continue;const{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):He()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let n=0;n<$v.length;n++){const r=$v[n];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const i=e["on"+r];i&&(this.propEventSubscriptions[r]=this.on(r,i))}this.prevMotionValues=y_(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}addValue(e,t){const n=this.values.get(e);if(t!==n){n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t);const r=t.get();r!==void 0&&(this.latestValues[e]=r)}}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=ds(t??this.getDefaultValue?.(e),{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n=="string"&&(rm(n)||im(n))?n=parseFloat(n):typeof n!="number"&&!It.test(n)&&It.test(t)&&(n=gm(e,t)),this.setBaseTarget(e,st(n)?n.get():n)),st(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}on(e,t){return this.events[e]||(this.events[e]=new hc),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Cm.render(this.render)}},Dk=class extends b_{constructor(){super(...arguments),this.KeyframeResolver=zL}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){const n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;st(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}},zr=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function Nk(e,{style:t,vars:n},r,i){const s=e.style;let o;for(o in t)s[o]=t[o];i?.applyProjectionStyles(s,r);for(o in n)s.setProperty(o,n[o])}var Ko={};function Lk(e,{layout:t,layoutId:n}){return Er.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Ko[e]||e==="opacity")}function Em(e,t,n){const r=e.style,i=t?.style,s={};if(!r)return s;for(const o in r)(st(r[o])||i&&st(i[o])||Lk(o,e)||n?.getValue(o)?.liveStyle!==void 0)&&(s[o]=r[o]);return s}function w_(e){return window.getComputedStyle(e)}var S_=class extends Dk{constructor(){super(...arguments),this.type="html",this.renderInstance=Nk}mount(e){vi(!!e.style,"motion.create() components must forward their ref to a HTML or SVG element","custom-component-ref"),super.mount(e)}readValueFromInstance(e,t){if(Er.has(t))return this.projection?.isProjecting?Uo(t):H2(e,t);{const n=w_(e),r=(FS(t)?n.getPropertyValue(t):n[t])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Tk(e,t)}build(e,t,n){km(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Em(e,t,n)}},_k=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),jk=e=>typeof e=="string"&&e.toLowerCase()==="svg";function k_(e,t,n,r){Nk(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(_k.has(i)?i:bm(i),t.attrs[i])}function Bk(e,t,n){const r=Em(e,t,n);for(const i in e)if(st(e[i])||st(t[i])){const s=Os.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[s]=e[i]}return r}var C_=class extends Dk{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=He}getBaseTargetFromProps(e,t){return Er.has(t)?super.getBaseTargetFromProps(e,t)??Uo(t):e[t]}getDefaultValue(e){return Er.has(e)?this.latestValues[e]??Uo(e):void 0}readValueFromInstance(e,t){if(Er.has(t)){const n=tk(t);return n&&n.default||0}if(wk.includes(t)){const n=getComputedStyle(e)[t];if(typeof n=="string"&&n)return n.trim()}return t=_k.has(t)?t:bm(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Bk(e,t,n)}build(e,t,n){Sk(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){k_(e,t,n,r)}mount(e){this.isSVGTag=jk(e.tagName),super.mount(e)}};function Fk(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var A_=[...Tm].reverse();function T_(e){let t=a=>Promise.all(a.map(({animation:l,options:c})=>NL(e,l,c))),n=Hv(),r=!0,i=!1;function s(a){const{props:l,parent:c,manuallyAnimateOnMount:u}=e,h=r||i,f=[],d=new Set;let m={},v=1/0,y=e;do y=y.props.inherit!==!1&&y.parent;while(y&&!y.isControllingVariants);if(A_.forEach((b,w)=>{const S=n[b],C=l[b],A=y&&y.props[b],k=C!==void 0?C:qo(A)||A===!1?A:void 0,E=qo(k),T=b===a?S.isActive:null;T===!1&&(v=w);const R=E&&C===void 0&&!(h&&u);if(S.protectedKeys={...m},!S.isActive&&T===null||!k&&!S.prevProp||ou(k)||typeof k=="boolean")return;if(b==="exit"&&S.isActive&&T!==!0){m={...m,...S.prevResolvedValues};return}const P=E_(S.prevProp,k);let M=P||E&&(T&&!R||w>v),N=!1;const L=Array.isArray(k)?k:[k];let I={};if(T!==!1)for(const j of L){const{transition:$,transitionEnd:B,...D}=ai(e,j,mk(e,b))||{};I={...I,...D,...B}}const{prevResolvedValues:_}=S;for(const j in{..._,...I}){if(j in m)continue;const $=I[j],B=_[j],D=Array.isArray($)&&Array.isArray(B)?!Fk($,B)||P:$!==B;if(D&&$==null)d.add(j);else if(D||$!==void 0&&d.has(j)){M=!0,d.delete(j)&&(N=!0),S.needsAnimating[j]=!0;const se=e.getValue(j);se&&(se.liveStyle=!1)}else S.protectedKeys[j]=!0}if(S.prevProp=k,S.prevResolvedValues=I,S.isActive&&(m={...m,...I}),M&&(!(R&&P)||N))for(const j of L){const $={type:b};if(typeof j=="string"&&h&&u&&c?.enteringChildren){const B=ai(c,j)?.transition?.delayChildren;$.delay=hk(c.enteringChildren,e,B)}f.push({animation:j,options:$})}}),d.size){const{initial:b}=l,w={},S=typeof b!="boolean"&&ai(e,Array.isArray(b)?b[0]:b,e.presenceContext?.custom);S&&S.transition&&(w.transition=S.transition),d.forEach(C=>{const A=e.getValue(C);A&&(A.liveStyle=!0);const k=S&&!Array.isArray(b)?S[C]:void 0,E=e.getBaseTargetFromProps(l,C);w[C]=(k!==void 0?k:E!==void 0&&!st(E)?E:e.initialValues[C]===void 0?e.baseTarget[C]:void 0)??null}),f.push({animation:w})}const x=h&&e.blockInitialAnimation||r&&!u&&(l.initial===!1||l.initial===l.animate);return r=i=!1,!x&&f.length?t(f):Promise.resolve()}function o(a,l){if(n[a].isActive===l)return Promise.resolve();e.variantChildren?.forEach(u=>u.animationState?.setActive(a,l)),n[a].isActive=l;const c=s(a);for(const u in n)n[u].protectedKeys={};return c}return{animateChanges:s,setActive:o,setAnimateFunction:a=>{t=a(e)},getState:()=>n,reset:()=>{n=Hv(),i=!0}}}function E_(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Fk(t,e):!1}function Hv(){const e={};for(const t of Tm)e[t]={isActive:t==="animate",protectedKeys:{},needsAnimating:{},prevResolvedValues:{}};return e}function Qf(e,t){e.min=t.min,e.max=t.max}function Ht(e,t){Qf(e.x,t.x),Qf(e.y,t.y)}function Wv(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var M_=.9999,R_=1.0001,P_=-.01,I_=.01;function dt(e){return e.max-e.min}function O_(e,t,n){return Math.abs(e-t)<=n}function Uv(e,t,n,r=.5){e.origin=r,e.originPoint=ye(t.min,t.max,e.origin),e.scale=dt(n)/dt(t),e.translate=ye(n.min,n.max,e.origin)-e.originPoint,(e.scale>=M_&&e.scale<=R_||isNaN(e.scale))&&(e.scale=1),(e.translate>=P_&&e.translate<=I_||isNaN(e.translate))&&(e.translate=0)}function So(e,t,n,r){Uv(e.x,t.x,n.x,r?r.originX:void 0),Uv(e.y,t.y,n.y,r?r.originY:void 0)}function qv(e,t,n,r=0){e.min=(r?ye(n.min,n.max,r):n.min)+t.min,e.max=e.min+dt(t)}function D_(e,t,n,r){qv(e.x,t.x,n.x,r?.x),qv(e.y,t.y,n.y,r?.y)}function Kv(e,t,n,r=0){const i=r?ye(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+dt(t)}function yc(e,t,n,r){Kv(e.x,t.x,n.x,r?.x),Kv(e.y,t.y,n.y,r?.y)}function Gv(e,t,n,r,i){return e-=t,e=gc(e,1/n,r),i!==void 0&&(e=gc(e,1/i,r)),e}function N_(e,t=0,n=1,r=.5,i,s=e,o=e){if(Pn.test(t)&&(t=parseFloat(t),t=ye(o.min,o.max,t/100)-o.min),typeof t!="number")return;let a=ye(s.min,s.max,r);e===s&&(a-=t),e.min=Gv(e.min,t,n,a,i),e.max=Gv(e.max,t,n,a,i)}function Qv(e,t,[n,r,i],s,o){N_(e,t[n],t[r],t[i],t.scale,s,o)}var L_=["x","scaleX","originX"],__=["y","scaleY","originY"];function Yv(e,t,n,r){Qv(e.x,t,L_,n?n.x:void 0,r?r.x:void 0),Qv(e.y,t,__,n?n.y:void 0,r?r.y:void 0)}function Xv(e){return e.translate===0&&e.scale===1}function Vk(e){return Xv(e.x)&&Xv(e.y)}function Jv(e,t){return e.min===t.min&&e.max===t.max}function j_(e,t){return Jv(e.x,t.x)&&Jv(e.y,t.y)}function Zv(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function zk(e,t){return Zv(e.x,t.x)&&Zv(e.y,t.y)}function e0(e){return dt(e.x)/dt(e.y)}function t0(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function bn(e){return[e("x"),e("y")]}function n0(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var Ws={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Q.test(e))e=parseFloat(e);else return e;return`${n0(e,t.target.x)}% ${n0(e,t.target.y)}%`}},B_={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=It.parse(e);if(i.length>5)return r;const s=It.createTransformer(e),o=typeof i[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;i[0+o]/=a,i[1+o]/=l;const c=ye(a,l,.5);return typeof i[2+o]=="number"&&(i[2+o]/=c),typeof i[3+o]=="number"&&(i[3+o]/=c),s(i)}};function F_(e,t,n){let r="";const i=e.x.translate/t.x,s=e.y.translate/t.y,o=n?.z||0;if((i||s||o)&&(r=`translate3d(${i}px, ${s}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:c,rotate:u,pathRotation:h,rotateX:f,rotateY:d,skewX:m,skewY:v}=n;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),h&&(r+=`rotate(${h}deg) `),f&&(r+=`rotateX(${f}deg) `),d&&(r+=`rotateY(${d}deg) `),m&&(r+=`skewX(${m}deg) `),v&&(r+=`skewY(${v}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}var V_=wm.length,r0=e=>typeof e=="number"||Q.test(e);function z_(e,t,n,r,i,s){i?(e.opacity=ye(0,n.opacity??1,$_(r)),e.opacityExit=ye(t.opacity??1,0,H_(r))):s&&(e.opacity=ye(t.opacity??1,n.opacity??1,r));for(let o=0;o<V_;o++){const a=wm[o];let l=i0(t,a),c=i0(n,a);l===void 0&&c===void 0||(l||(l=0),c||(c=0),l===0||c===0||r0(l)===r0(c)?(e[a]=Math.max(ye(Bv(l),Bv(c),r),0),(Pn.test(c)||Pn.test(l))&&(e[a]+="%")):e[a]=c)}(t.rotate||n.rotate)&&(e.rotate=ye(t.rotate||0,n.rotate||0,r))}function i0(e,t){return e[t]!==void 0?e[t]:e.borderRadius}var $_=$k(0,.5,LS),H_=$k(.5,.95,tn);function $k(e,t,n){return r=>r<e?0:r>t?1:n($o(e,t,r))}function W_(e,t,n){const r=st(e)?e:ds(e);return r.start(xm("",r,t,n)),r.animation}function Go(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var U_=(e,t)=>e.depth-t.depth,q_=class{constructor(){this.children=[],this.isDirty=!1}add(e){nm(this.children,e),this.isDirty=!0}remove(e){uc(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(U_),this.isDirty=!1,this.children.forEach(e)}};function K_(e,t){const n=it.now(),r=({timestamp:i})=>{const s=i-n;s>=t&&(Ir(r),e(s-t))};return we.setup(r,!0),()=>Ir(r)}function Dl(e){return st(e)?e.get():e}var G_=class{constructor(){this.members=[]}add(e){nm(this.members,e);for(let t=this.members.length-1;t>=0;t--){const n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;const r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(uc(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(uc(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){const n=this.members[t];if(n.isPresent!==!1&&n.instance?.isConnected!==!1)return this.promote(n),!0}return!1}promote(e,t){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();const{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},Q_={borderRadius:{...Ws,applyTo:[...wm]},borderTopLeftRadius:Ws,borderTopRightRadius:Ws,borderBottomLeftRadius:Ws,borderBottomRightRadius:Ws,boxShadow:B_},Nl={hasAnimatedSinceResize:!0,hasEverUpdated:!1};Object.assign(Ko,{...Q_,...Ko});var Zr={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},lh=["","X","Y","Z"],Y_=1e3,X_=0;function ch(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Hk(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=yk(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",we,!(i||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Hk(r)}function Wk({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(o={},a=t?.()){this.id=X_++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Bi.value&&(Zr.nodes=Zr.calculatedTargetDeltas=Zr.calculatedProjections=0),this.nodes.forEach(ej),this.nodes.forEach(aj),this.nodes.forEach(lj),this.nodes.forEach(tj),Bi.addProjectionMetrics&&Bi.addProjectionMetrics(Zr)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new q_)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new hc),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const l=this.eventHandlers.get(o);l&&l.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=Sm(o)&&!g_(o),this.instance=o;const{layoutId:a,layout:l,visualElement:c}=this.options;if(c&&!c.current&&c.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||a)&&(this.isLayoutDirty=!0),e){let u,h=0;const f=()=>this.root.updateBlockedByResize=!1;we.read(()=>{h=window.innerWidth}),e(o,()=>{const d=window.innerWidth;d!==h&&(h=d,this.root.updateBlockedByResize=!0,u&&u(),u=K_(f,250),Nl.hasAnimatedSinceResize&&(Nl.hasAnimatedSinceResize=!1,this.nodes.forEach(a0)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&c&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:f,layout:d})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||dj,{onLayoutAnimationStart:v,onLayoutAnimationComplete:y}=c.getProps(),x=!this.targetLayout||!zk(this.targetLayout,d),b=!h&&f;if(this.options.layoutRoot||this.resumeFrom||b||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const w={...ym(m,"layout"),onPlay:v,onComplete:y};(c.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w),this.setAnimationOrigin(u,b,w.path)}else h||a0(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=d})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Ir(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(cj),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Hk(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const h=this.path[u];h.shouldResetTransform=!0,(typeof h.latestValues.x=="string"||typeof h.latestValues.y=="string")&&(h.isLayoutDirty=!0),h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const a=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),a&&this.nodes.forEach(rj),this.nodes.forEach(s0);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(o0);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(ij),this.nodes.forEach(sj),this.nodes.forEach(oj),this.nodes.forEach(J_),this.nodes.forEach(Z_)):this.nodes.forEach(o0),this.clearAllSnapshots();const o=it.now();We.delta=fr(0,1e3/60,o-We.timestamp),We.timestamp=o,We.isProcessing=!0,rh.update.process(We),rh.preRender.process(We),rh.render.process(We),We.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Cm.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(nj),this.sharedNodes.forEach(uj)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,we.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){we.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!dt(this.snapshot.measuredBox.x)&&!dt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected||(this.layoutCorrected=He()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&this.instance){const l=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!i)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!Vk(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;o&&this.instance&&(a||Jr(this.latestValues)||u)&&(i(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),pj(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return He();const a=o.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(mj))){const{scroll:l}=this.root;l&&(Sn(a.x,l.offset.x),Sn(a.y,l.offset.y))}return a}removeElementScroll(o){const a=He();if(Ht(a,o),this.scroll?.wasRoot)return a;for(let l=0;l<this.path.length;l++){const c=this.path[l],{scroll:u,options:h}=c;c!==this.root&&u&&h.layoutScroll&&(u.wasRoot&&Ht(a,o),Sn(a.x,u.offset.x),Sn(a.y,u.offset.y))}return a}applyTransform(o,a=!1,l){const c=l||He();Ht(c,o);for(let u=0;u<this.path.length;u++){const h=this.path[u];!a&&h.options.layoutScroll&&h.scroll&&h!==h.root&&(Sn(c.x,-h.scroll.offset.x),Sn(c.y,-h.scroll.offset.y)),Jr(h.latestValues)&&Ml(c,h.latestValues,h.layout?.layoutBox)}return Jr(this.latestValues)&&Ml(c,this.latestValues,this.layout?.layoutBox),c}removeTransform(o){const a=He();Ht(a,o);for(let l=0;l<this.path.length;l++){const c=this.path[l];if(!Jr(c.latestValues))continue;let u;c.instance&&(Kf(c.latestValues)&&c.updateSnapshot(),u=He(),Ht(u,c.measurePageBox())),Yv(a,c.latestValues,c.snapshot?.layoutBox,u)}return Jr(this.latestValues)&&Yv(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==We.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==a;if(!(o||l&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:c,layoutId:u}=this.options;if(!this.layout||!(c||u))return;this.resolvedRelativeTargetAt=We.timestamp;const h=this.getClosestProjectingParent();!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&h&&h.layout?this.createRelativeTarget(h,this.layout.layoutBox,h.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=He(),this.targetWithTransforms=He()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),D_(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Ht(this.target,this.layout.layoutBox),Ak(this.target,this.targetDelta)):Ht(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&h&&!!h.resumingFrom==!!this.resumingFrom&&!h.options.layoutScroll&&h.target&&this.animationProgress!==1?this.createRelativeTarget(h,this.target,h.target):this.relativeParent=this.relativeTarget=void 0),Bi.value&&Zr.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||Kf(this.parent.latestValues)||Ck(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,a,l){this.relativeParent=o,this.forceRelativeParentToResolveTarget(),this.relativeTarget=He(),this.relativeTargetOrigin=He(),yc(this.relativeTargetOrigin,a,l,this.options.layoutAnchor||void 0),Ht(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const o=this.getLead(),a=!!this.resumingFrom||this!==o;let l=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(l=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===We.timestamp&&(l=!1),l)return;const{layout:c,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||u))return;Ht(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,f=this.treeScale.y;XL(this.layoutCorrected,this.treeScale,this.path,a),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=He());const{target:d}=o;if(!d){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Wv(this.prevProjectionDelta.x,this.projectionDelta.x),Wv(this.prevProjectionDelta.y,this.projectionDelta.y)),So(this.projectionDelta,this.layoutCorrected,d,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==f||!t0(this.projectionDelta.x,this.prevProjectionDelta.x)||!t0(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",d)),Bi.value&&Zr.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){if(this.options.visualElement?.scheduleRender(),o){const a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=qi(),this.projectionDelta=qi(),this.projectionDeltaWithTransform=qi()}setAnimationOrigin(o,a=!1,l){const c=this.snapshot,u=c?c.latestValues:{},h={...this.latestValues},f=qi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const d=He(),m=(c?c.source:void 0)!==(this.layout?this.layout.source:void 0),v=this.getStack(),y=!v||v.members.length<=1,x=!!(m&&!y&&this.options.crossfade===!0&&!this.path.some(fj));this.animationProgress=0;let b;const w=l?.interpolateProjection(o);this.mixTargetDelta=S=>{const C=S/1e3,A=w?.(C);A?(f.x.translate=A.x,f.x.scale=ye(o.x.scale,1,C),f.x.origin=o.x.origin,f.x.originPoint=o.x.originPoint,f.y.translate=A.y,f.y.scale=ye(o.y.scale,1,C),f.y.origin=o.y.origin,f.y.originPoint=o.y.originPoint):(l0(f.x,o.x,C),l0(f.y,o.y,C)),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(yc(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),hj(this.relativeTarget,this.relativeTargetOrigin,d,C),b&&j_(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=He()),Ht(b,this.relativeTarget)),m&&(this.animationValues=h,z_(h,u,this.latestValues,C,x,y)),A&&A.rotate!==void 0&&(this.animationValues||(this.animationValues=h),this.animationValues.pathRotation=A.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Ir(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=we.update(()=>{Nl.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ds(0)),this.motionValue.jump(0,!1),this.currentAnimation=W_(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),O2(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Y_),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead(),{targetWithTransforms:a,layout:l,latestValues:c}=o;let{target:u}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&Uk(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||He();const h=dt(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+h;const f=dt(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+f}Ht(a,u),Ml(a,c),So(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new G_),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){const{layoutId:o}=this.options;return o?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:o}=this.options;return o?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&ch("z",o,c,this.animationValues);for(let u=0;u<lh.length;u++)ch(`rotate${lh[u]}`,o,c,this.animationValues),ch(`skew${lh[u]}`,o,c,this.animationValues);o.render();for(const u in c)o.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);o.scheduleRender()}applyProjectionStyles(o,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=Dl(a?.pointerEvents)||"",o.transform=l?l(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=Dl(a?.pointerEvents)||""),this.hasProjected&&!Jr(this.latestValues)&&(o.transform=l?l({},""):"none",this.hasProjected=!1);return}o.visibility="";const u=c.animationValues||c.latestValues;this.applyTransformsToTarget();let h=F_(this.projectionDeltaWithTransform,this.treeScale,u);l&&(h=l(u,h)),o.transform=h;const{x:f,y:d}=this.projectionDelta;o.transformOrigin=`${f.origin*100}% ${d.origin*100}% 0`,c.animationValues?o.opacity=c===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:o.opacity=c===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const m in Ko){if(u[m]===void 0)continue;const{correct:v,applyTo:y,isCSSVariable:x}=Ko[m],b=h==="none"?u[m]:v(u[m],c);if(y){const w=y.length;for(let S=0;S<w;S++)o[y[S]]=b}else x?this.options.visualElement.renderState.vars[m]=b:o[m]=b}this.options.layoutId&&(o.pointerEvents=c===this?Dl(a?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>o.currentAnimation?.stop()),this.root.nodes.forEach(s0),this.root.sharedNodes.clear()}}}function J_(e){e.updateLayout()}function Z_(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,s=t.source!==e.layout.source;if(i==="size")bn(u=>{const h=s?t.measuredBox[u]:t.layoutBox[u],f=dt(h);h.min=n[u].min,h.max=h.min+f});else if(i==="x"||i==="y"){const u=i==="x"?"y":"x";Qf(s?t.measuredBox[u]:t.layoutBox[u],n[u])}else Uk(i,t.layoutBox,n)&&bn(u=>{const h=s?t.measuredBox[u]:t.layoutBox[u],f=dt(n[u]);h.max=h.min+f,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[u].max=e.relativeTarget[u].min+f)});const o=qi();So(o,n,t.layoutBox);const a=qi();s?So(a,e.applyTransform(r,!0),t.measuredBox):So(a,n,t.layoutBox);const l=!Vk(o);let c=!1;if(!e.resumeFrom){const u=e.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:h,layout:f}=u;if(h&&f){const d=e.options.layoutAnchor||void 0,m=He();yc(m,t.layoutBox,h.layoutBox,d);const v=He();yc(v,n,f.layoutBox,d),zk(m,v)||(c=!0),u.options.layoutRoot&&(e.relativeTarget=v,e.relativeTargetOrigin=m,e.relativeParent=u)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:a,layoutDelta:o,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function ej(e){Bi.value&&Zr.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function tj(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function nj(e){e.clearSnapshot()}function s0(e){e.clearMeasurements()}function rj(e){e.isLayoutDirty=!0,e.updateLayout()}function o0(e){e.isLayoutDirty=!1}function ij(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function sj(e){e.relativeTarget&&e.relativeParent?.isLayoutDirty&&(e.currentAnimation?e.isLayoutDirty=!0:(e.targetDelta=void 0,e.removeRelativeTarget()))}function oj(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function a0(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function aj(e){e.resolveTargetDelta()}function lj(e){e.calcProjection()}function cj(e){e.resetSkewAndRotation()}function uj(e){e.removeLeadSnapshot()}function l0(e,t,n){e.translate=ye(t.translate,0,n),e.scale=ye(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function c0(e,t,n,r){e.min=ye(t.min,n.min,r),e.max=ye(t.max,n.max,r)}function hj(e,t,n,r){c0(e.x,t.x,n.x,r),c0(e.y,t.y,n.y,r)}function fj(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var dj={duration:.45,ease:[.4,0,.1,1]},u0=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),h0=u0("applewebkit/")&&!u0("chrome/")?Math.round:tn;function f0(e){e.min=h0(e.min),e.max=h0(e.max)}function pj(e){f0(e.x),f0(e.y)}function Uk(e,t,n){return e==="position"||e==="preserve-aspect"&&!O_(e0(t),e0(n),.2)}function mj(e){return e!==e.root&&e.scroll?.wasRoot}var gj=Wk({attachResizeListener:(e,t)=>Go(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),uh={current:void 0},qk=Wk({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!uh.current){const e=new gj({});e.mount(window),e.setOptions({layoutScroll:!0}),uh.current=e}return uh.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Kk=(0,g.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function vj(e=!0){const t=(0,g.useContext)(ru);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,s=(0,g.useId)();(0,g.useEffect)(()=>{if(e)return i(s)},[e]);const o=(0,g.useCallback)(()=>e&&r&&r(s),[s,r,e]);return!n&&r?[!1,o]:[!0]}function S6(){return yj((0,g.useContext)(ru))}function yj(e){return e===null?!0:e.isPresent}var Gk=(0,g.createContext)({strict:!1}),d0={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},p0=!1;function xj(){if(p0)return;const e={};for(const t in d0)e[t]={isEnabled:n=>d0[t].some(r=>!!n[r])};Ok(e),p0=!0}function Qk(){return xj(),x_()}function bj(e){const t=Qk();for(const n in e)t[n]={...t[n],...e[n]};Ok(t)}var lu=(0,g.createContext)({});function wj(e,t){if(au(e)){const{initial:n,animate:r}=e;return{initial:n===!1||qo(n)?n:void 0,animate:qo(r)?r:void 0}}return e.inherit!==!1?t:{}}function Sj(e){const{initial:t,animate:n}=wj(e,(0,g.useContext)(lu));return(0,g.useMemo)(()=>({initial:t,animate:n}),[m0(t),m0(n)])}function m0(e){return Array.isArray(e)?e.join(" "):e}var Mm=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Yk(e,t,n){for(const r in t)!st(t[r])&&!Lk(r,n)&&(e[r]=t[r])}function kj({transformTemplate:e},t){return(0,g.useMemo)(()=>{const n=Mm();return km(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Cj(e,t){const n=e.style||{},r={};return Yk(r,n,e),Object.assign(r,kj(e,t)),r}function Aj(e,t){const n={},r=Cj(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var Xk=()=>({...Mm(),attrs:{}});function Tj(e,t,n,r){const i=(0,g.useMemo)(()=>{const s=Xk();return Sk(s,t,jk(r),e.transformTemplate,e.style),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};Yk(s,e.style,e),i.style={...s,...i.style}}return i}var Ej=new Set(["animate","exit","variants","initial","style","values","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function xc(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Ej.has(e)}function Mj(e,t){return e.startsWith("on")?!xc(e):t?.(e)??!xc(e)}function Rj(e,t,n,r){const i={};for(const s in e)s==="values"&&typeof e.values=="object"||st(e[s])||(Mj(s,r)||n===!0&&xc(s)||!t&&!xc(s)||e.draggable&&s.startsWith("onDrag"))&&(i[s]=e[s]);return i}var Pj=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Rm(e){return typeof e!="string"||e.includes("-")?!1:!!(Pj.indexOf(e)>-1||/[A-Z]/u.test(e))}function Ij(e,t,n,{latestValues:r},i,s=!1,o,a){const l=(o??Rm(e)?Tj:Aj)(t,r,i,e),c=Rj(t,typeof e=="string",s,a),u=e!==g.Fragment?{...c,...l,ref:n}:{},{children:h}=t,f=(0,g.useMemo)(()=>st(h)?h.get():h,[h]);return(0,g.createElement)(e,{...u,children:f})}function Oj({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:Dj(n,r,i,e),renderState:t()}}function Dj(e,t,n,r){const i={},s=r(e,{});for(const f in s)i[f]=Dl(s[f]);let{initial:o,animate:a}=e;const l=au(e),c=Ik(e);t&&c&&!l&&e.inherit!==!1&&(o===void 0&&(o=t.initial),a===void 0&&(a=t.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const h=u?a:o;if(h&&typeof h!="boolean"&&!ou(h)){const f=Array.isArray(h)?h:[h];for(let d=0;d<f.length;d++){const m=pk(e,f[d]);if(m){const{transitionEnd:v,transition:y,...x}=m;for(const b in x){let w=x[b];if(Array.isArray(w)){const S=u?w.length-1:0;w=w[S]}w!==null&&(i[b]=w)}for(const b in v)i[b]=v[b]}}}return i}var Jk=e=>(t,n)=>{const r=(0,g.useContext)(lu),i=(0,g.useContext)(ru),s=()=>Oj(e,t,r,i);return n?s():PN(s)},Nj=Jk({scrapeMotionValuesFromProps:Em,createRenderState:Mm}),Lj=Jk({scrapeMotionValuesFromProps:Bk,createRenderState:Xk}),_j=Symbol.for("motionComponentSymbol");function jj(e,t,n){const r=(0,g.useRef)(n);(0,g.useInsertionEffect)(()=>{r.current=n});const i=(0,g.useRef)(null);return(0,g.useCallback)(s=>{s&&e.onMount?.(s),t&&(s?t.mount(s):t.unmount());const o=r.current;if(typeof o=="function")if(s){const a=o(s);typeof a=="function"&&(i.current=a)}else i.current?(i.current(),i.current=null):o(s);else o&&(o.current=s)},[t])}var Zk=(0,g.createContext)({});function Fi(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Bj(e,t,n,r,i,s){const{visualElement:o}=(0,g.useContext)(lu),a=(0,g.useContext)(Gk),l=(0,g.useContext)(ru),c=(0,g.useContext)(Kk),u=c.reducedMotion,h=c.skipAnimations,f=(0,g.useRef)(null),d=(0,g.useRef)(!1);r=r||a.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,skipAnimations:h,isSVG:s}),d.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));const m=f.current,v=(0,g.useContext)(Zk);m&&!m.projection&&i&&(m.type==="html"||m.type==="svg")&&Fj(f.current,n,i,v);const y=(0,g.useRef)(!1);(0,g.useInsertionEffect)(()=>{m&&y.current&&m.update(n,l)});const x=n[vk],b=(0,g.useRef)(!!x&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(x)&&window.MotionHasOptimisedAnimation?.(x));return ov(()=>{!d.current||!m||(m.animationState?.animateChanges(),m.enteringChildren=void 0)},[]),ov(()=>{d.current=!0,m&&(y.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),b.current&&m.animationState&&m.animationState.animateChanges())}),(0,g.useEffect)(()=>{m&&(!b.current&&m.animationState&&m.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(x)}),b.current=!1),m.enteringChildren=void 0)}),m}function Fj(e,t,n,r){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutAnchor:u,layoutCrossfade:h}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:e1(e.parent)),e.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&Fi(a),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:l,layoutRoot:c,layoutAnchor:u})}function e1(e){if(e)return e.options.allowProjection!==!1?e.projection:e1(e.parent)}function hh(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&bj(r);const s=n?n==="svg":Rm(e),o=s?Lj:Nj;function a(c,u){let h;const f={...(0,g.useContext)(Kk),...c,layoutId:Vj(c)},{isStatic:d,isValidProp:m}=f,v=Sj(c),y=o(c,d);if(!d&&typeof window<"u"){zj(f,r);const x=$j(f);h=x.MeasureLayout,v.visualElement=Bj(e,y,f,i,x.ProjectionNode,s)}return(0,p.jsxs)(lu.Provider,{value:v,children:[h&&v.visualElement?(0,p.jsx)(h,{visualElement:v.visualElement,...f}):null,Ij(e,c,jj(y,v.visualElement,u),y,d,t,s,m)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const l=(0,g.forwardRef)(a);return l[_j]=e,l}function Vj({layoutId:e}){const t=(0,g.useContext)(AS).id;return t&&e!==void 0?t+"-"+e:e}function zj(e,t){(0,g.useContext)(Gk).strict}function $j(e){const{drag:t,layout:n}=Qk();if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Hj(e,t){if(typeof Proxy>"u")return hh;const n=new Map,r=(s,o)=>hh(s,o,e,t),i=(s,o)=>r(s,o);return new Proxy(i,{get:(s,o)=>o==="create"?r:(n.has(o)||n.set(o,hh(o,void 0,e,t)),n.get(o))})}var Wj=(e,t)=>t.isSVG??Rm(e)?new C_(t):new S_(t,{allowProjection:e!==g.Fragment}),Uj=class extends zr{constructor(e){super(e),e.animationState||(e.animationState=T_(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();ou(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},qj=0,Kj=class extends zr{constructor(){super(...arguments),this.id=qj++}update(){const{presenceContext:e,prevPresenceContext:t,animationState:n}=this.node;if(!e||!n)return;const{isPresent:r,onExitComplete:i}=e,s=t?.isPresent;if(r===s)return;if(r&&s===!1){if(this.exit===!0){const{initial:a}=this.node.getProps();if(a&&!Array.isArray(a)){const{transition:l,transitionEnd:c,...u}=ai(this.node,a)||{};for(const h in u)this.node.getValue(h)?.jump(u[h])}this.node.blockInitialAnimation=!1,n.reset(),n.animateChanges()}else n.setActive("exit",!1);this.exit=void 0;return}const o=this.exit=n.setActive("exit",!r);i&&!r&&o.then(()=>{this.exit===o&&(this.exit=!0,i(this.id))})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}},Gj={animation:{Feature:Uj},exit:{Feature:Kj}};function cu(e){return{point:{x:e.pageX,y:e.pageY}}}var Qj=e=>t=>Am(t)&&e(t,cu(t));function ko(e,t,n,r){return Go(e,t,Qj(n),r)}var t1=({current:e})=>e?e.ownerDocument.defaultView:null,g0=(e,t)=>Math.abs(e-t);function Yj(e,t){const n=g0(e.x,t.x),r=g0(e.y,t.y);return Math.sqrt(n**2+r**2)}var v0=new Set(["auto","scroll"]),n1=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:s=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=f=>{this.handleScroll(f.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Ka(this.lastRawMoveEventInfo,this.transformPagePoint));const f=fh(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,m=Yj(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!d&&!m)return;const{point:v}=f;this.history.push({...v,timestamp:it.now()});const{onStart:y,onMove:x}=this.handlers;d||(y&&y(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,f)},this.handlePointerMove=(f,d)=>{this.lastMoveEvent=f,this.lastRawMoveEventInfo=d,this.lastMoveEventInfo=Ka(d,this.transformPagePoint),this.hasPendingMove=!0,we.update(this.updatePoint,!0)},this.handlePointerUp=(f,d)=>{this.hasPendingMove&&this.updatePoint(),this.end();const{onEnd:m,onSessionEnd:v,resumeAnimation:y}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=fh(f.type==="pointercancel"?this.lastMoveEventInfo:Ka(d,this.transformPagePoint),this.history);this.startEvent&&m&&m(f,x),v&&v(f,x)},!Am(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=s,this.contextWindow=r||window;const a=Ka(cu(e),this.transformPagePoint),{point:l}=a,{timestamp:c}=We;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,fh(a,this.history));const h={passive:!0,capture:!0};this.removeListeners=wa(ko(this.contextWindow,"pointermove",this.handlePointerMove,h),ko(this.contextWindow,"pointerup",this.handlePointerUp,h),ko(this.contextWindow,"pointercancel",this.handlePointerUp,h)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){const n=getComputedStyle(t);(v0.has(n.overflowX)||v0.has(n.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),we.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Ir(this.updatePoint)}};function Ka(e,t){return t?{point:t(e.point)}:e}function y0(e,t){return{x:e.x-t.x,y:e.y-t.y}}function fh({point:e},t){return{point:e,delta:y0(e,r1(t)),offset:y0(e,Xj(t)),velocity:Jj(t,.1)}}function Xj(e){return e[0]}function r1(e){return e[e.length-1]}function Jj(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=r1(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Pt(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>Pt(t)*2&&(r=e[1]);const s=Lt(i.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-r.x)/s,y:(i.y-r.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Zj(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?ye(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?ye(n,e,r.max):Math.min(e,n)),e}function x0(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function eB(e,{top:t,left:n,bottom:r,right:i}){return{x:x0(e.x,n,i),y:x0(e.y,t,r)}}function b0(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function tB(e,t){return{x:b0(e.x,t.x),y:b0(e.y,t.y)}}function nB(e,t){let n=.5;const r=dt(e),i=dt(t);return i>r?n=$o(t.min,t.max-r,e.min):r>i&&(n=$o(e.min,e.max-i,t.min)),fr(0,1,n)}function rB(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var Yf=.35;function iB(e=Yf){return e===!1?e=0:e===!0&&(e=Yf),{x:w0(e,"left","right"),y:w0(e,"top","bottom")}}function w0(e,t,n){return{min:S0(e,t),max:S0(e,n)}}function S0(e,t){return typeof e=="number"?e:e[t]||0}var sB=new WeakMap,oB=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=He(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=u=>{t&&this.snapToCursor(u),this.stopAnimation()},s=(u,h)=>{const{drag:f,dragPropagation:d,onDragStart:m}=this.getProps();if(f&&!d&&(this.openDragLock&&this.openDragLock(),this.openDragLock=ZL(f),!this.openDragLock))return;this.latestPointerEvent=u,this.latestPanInfo=h,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),bn(y=>{let x=this.getAxisMotionValue(y).get()||0;if(Pn.test(x)){const{projection:b}=this.visualElement;if(b&&b.layout){const w=b.layout.layoutBox[y];w&&(x=dt(w)*(parseFloat(x)/100))}}this.originPoint[y]=x}),m&&we.update(()=>m(u,h),!1,!0),Wf(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},o=(u,h)=>{this.latestPointerEvent=u,this.latestPanInfo=h;const{dragPropagation:f,dragDirectionLock:d,onDirectionLock:m,onDrag:v}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:y}=h;if(d&&this.currentDirection===null){this.currentDirection=lB(y),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",h.point,y),this.updateAxis("y",h.point,y),this.visualElement.render(),v&&we.update(()=>v(u,h),!1,!0)},a=(u,h)=>{this.latestPointerEvent=u,this.latestPanInfo=h,this.stop(u,h),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>{const{dragSnapToOrigin:u}=this.getProps();(u||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:c}=this.getProps();this.panSession=new n1(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:n,contextWindow:t1(this.visualElement),element:this.visualElement.current})}stop(e,t){const n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;const{velocity:s}=r;this.startAnimation(s);const{onDragEnd:o}=this.getProps();o&&we.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){const{drag:r}=this.getProps();if(!n||!Ga(e,r,this.currentDirection))return;const i=this.getAxisMotionValue(e);let s=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(s=Zj(s,this.constraints[e],this.elastic[e])),i.set(s)}resolveConstraints(){const{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&Fi(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&n?this.constraints=eB(n.layoutBox,e):this.constraints=!1,this.elastic=iB(t),r!==this.constraints&&!Fi(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&bn(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=rB(n.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Fi(e))return!1;const n=e.current;vi(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());const i=JL(n,r.root,this.visualElement.getTransformPagePoint());let s=tB(r.layout.layoutBox,i);if(t){const o=t(QL(s));this.hasMutatedConstraints=!!o,o&&(s=kk(o))}return s}startAnimation(e){const{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:s,onDragTransitionEnd:o}=this.getProps(),a=this.constraints||{},l=bn(c=>{if(!Ga(c,t,this.currentDirection))return;let u=a&&a[c]||{};(s===!0||s===c)&&(u={min:0,max:0});const h=r?200:1e6,f=r?40:1e7,d={type:"inertia",velocity:n?e[c]:0,bounceStiffness:h,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...i,...u};return this.startAxisValueAnimation(c,d)});return Promise.all(l).then(o)}startAxisValueAnimation(e,t){const n=this.getAxisMotionValue(e);return Wf(this.visualElement,e),n.start(xm(e,n,0,t,this.visualElement,!1))}stopAnimation(){bn(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps()[t];return n||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor({clientX:e,clientY:t}){const{drag:n}=this.getProps(),r={x:e,y:t},i=this.visualElement.getTransformPagePoint()?.(r)||r,s=this.visualElement.measureViewportBox();bn(o=>{if(!Ga(o,n,this.currentDirection))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=s[o];a.set((a.get()||0)+i[o]-ye(l,c,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!Fi(t)||!n||!this.constraints)return;this.stopAnimation();const r=this.constraints,i={x:0,y:0};bn(o=>{const a=this.getAxisMotionValue(o).get();i[o]=nB({min:a,max:a},r[o])});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),bn(o=>{const a=this.getAxisMotionValue(o);if(!Ga(o,e,null)||!a.get())return;const{min:l,max:c}=this.constraints[o];a.set(ye(l,c,i[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;sB.set(this.visualElement,this);const e=this.visualElement.current,t=ko(e,"pointerdown",l=>{const{drag:c,dragListener:u=!0}=this.getProps(),h=l.target,f=h!==e&&s_(h);c&&u&&!f&&this.start(l)});let n;const r=()=>{const{dragConstraints:l}=this.getProps();Fi(l)&&l.current&&(this.constraints=this.resolveRefConstraints(),n||(n=aB(e,l.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,s=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),we.read(r);const o=Go(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",(({delta:l,hasLayoutChanged:c})=>{this.isDragging&&c&&(bn(u=>{const h=this.getAxisMotionValue(u);h&&(this.originPoint[u]+=l[u].translate,h.set(h.get()+l[u].translate))}),this.visualElement.render())}));return()=>{o(),t(),s(),a&&a(),n&&n()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:s=Yf,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:s,dragMomentum:o}}};function k0(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function aB(e,t,n){const r=jv(e,k0(n)),i=jv(t,k0(n));return()=>{r(),i()}}function Ga(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function lB(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}var cB=class extends zr{constructor(e){super(e),this.removeGroupControls=tn,this.removeListeners=tn,this.controls=new oB(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||tn}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},dh=e=>(t,n)=>{e&&we.update(()=>e(t,n),!1,!0)},uB=class extends zr{constructor(){super(...arguments),this.removePointerDownListener=tn}onPointerDown(e){this.session=new n1(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:t1(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:dh(e),onStart:dh(t),onMove:dh(n),onEnd:(i,s)=>{delete this.session,r&&we.postRender(()=>r(i,s))}}}mount(){this.removePointerDownListener=ko(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},ph=!1,hB=class extends g.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),ph&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Nl.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:s}=n;return s&&(s.isPresent=i,e.layoutDependency!==t&&s.setOptions({...s.options,layoutDependency:t}),ph=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?s.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?s.promote():s.relegate()||we.postRender(()=>{const o=s.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),Cm.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;ph=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}};function i1(e){const[t,n]=vj(),r=(0,g.useContext)(AS);return(0,p.jsx)(hB,{...e,layoutGroup:r,switchLayoutGroup:(0,g.useContext)(Zk),isPresent:t,safeToRemove:n})}var fB={pan:{Feature:uB},drag:{Feature:cB,ProjectionNode:qk,MeasureLayout:i1}};function C0(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i=r["onHover"+n];i&&we.postRender(()=>i(t,cu(t)))}var dB=class extends zr{mount(){const{current:e}=this.node;e&&(this.unmount=t_(e,(t,n)=>(C0(this.node,n,"Start"),r=>C0(this.node,r,"End"))))}unmount(){}},pB=class extends zr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=wa(Go(this.node.current,"focus",()=>this.onFocus()),Go(this.node.current,"blur",()=>this.onBlur()))}unmount(){}};function A0(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i=r["onTap"+(n==="End"?"":n)];i&&we.postRender(()=>i(t,cu(t)))}var mB=class extends zr{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=a_(e,(r,i)=>(A0(this.node,i,"Start"),(s,{success:o})=>A0(this.node,s,o?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},Xf=new WeakMap,mh=new WeakMap,gB=e=>{const t=Xf.get(e.target);t&&t(e)},vB=e=>{e.forEach(gB)};function yB({root:e,...t}){const n=e||document;mh.has(n)||mh.set(n,{});const r=mh.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(vB,{root:e,...t})),r[i]}function xB(e,t,n){const r=yB(t);return Xf.set(e,n),r.observe(e),()=>{Xf.delete(e),r.unobserve(e)}}var bB={some:0,all:1},wB=class extends zr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r="some",once:i}=e,s={root:t?t.current:void 0,rootMargin:n,threshold:typeof r=="number"?r:bB[r]},o=a=>{const{isIntersecting:l}=a;if(this.isInView===l||(this.isInView=l,i&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:c,onViewportLeave:u}=this.node.getProps(),h=l?c:u;h&&h(a)};this.stopObserver=xB(this.node.current,s,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(SB(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function SB({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var kB={inView:{Feature:wB},tap:{Feature:mB},focus:{Feature:pB},hover:{Feature:dB}},CB={layout:{ProjectionNode:qk,MeasureLayout:i1}},AB={...Gj,...kB,...fB,...CB},s1=Hj(AB,Wj);function TB(){return document.activeElement?.closest('[role="dialog"],[role="alertdialog"]')??document.body}async function uu(e){try{return await navigator.clipboard.writeText(e),!0}catch{const t=document.createElement("textarea");try{return t.value=e,t.style.position="fixed",t.style.opacity="0",TB().appendChild(t),t.select(),t.selectionStart!==0||t.selectionEnd!==t.value.length?(console.warn("Clipboard copy failed: fallback selection did not take, nothing was copied"),!1):document.execCommand("copy")?(console.warn("Clipboard API unavailable, used deprecated execCommand fallback"),!0):(console.warn("Clipboard copy failed: execCommand fallback reported failure"),!1)}catch{return console.warn("Clipboard copy failed: both modern and fallback methods failed"),!1}finally{t.remove()}}}var EB="Project connection defaults are still syncing. Try again in a moment.",k6="Finishing setup.",MB=1e4,RB={hover:!0,touch:!1},PB={top:0,right:0,bottom:0,left:0},o1=["inline","pip","fullscreen"];function a1(){return{headers:{},requestTimeout:MB}}function C6(){return{version:1,connectionDefaults:a1(),clientCapabilities:zc()}}function A6(e){return{theme:e.theme,displayMode:e.displayMode,availableDisplayModes:o1,locale:e.locale,timeZone:e.timeZone,deviceCapabilities:e.deviceCapabilities,safeAreaInsets:e.safeAreaInsets}}function T6(e){if(!e||typeof e!="object")return!1;const t=e;return t.version===1&&(t.connectionDefaults===void 0||u1(t.connectionDefaults))&&ps(t.clientCapabilities)&&ps(t.hostContext)}function IB(e,t=zc()){return ps(e)?e:t}function OB(e,t={}){return ps(e)?e:t}function E6(e){return{version:1,connectionDefaults:l1(e?.connectionDefaults),clientCapabilities:IB(e?.clientCapabilities)}}function M6(e,t={}){return OB(e?.hostContext,t)}function l1(e,t=a1()){return u1(e)?{headers:h1(e.headers),requestTimeout:BB(e.requestTimeout,t.requestTimeout)}:t}function R6(e){return l1(e?.connectionDefaults)}function P6(e,t){return{...h1(e),...jB(t)}}function I6(e){return DB(e?.clientCapabilities??zc())}function DB(e){return GE(e)}function NB(e){const t=e?.availableDisplayModes;if(!Array.isArray(t))return o1;const n=t.filter(c1);return n.length>0?n:["inline"]}function LB(e){const t=e?.displayMode;return c1(t)?t:void 0}function O6(e){return _B(LB(e),NB(e))}function D6(e){const t=e?.theme;return t==="light"||t==="dark"?t:void 0}function N6(e,t="en-US"){return typeof e?.locale=="string"?e.locale:t}function L6(e,t="UTC"){return typeof e?.timeZone=="string"?e.timeZone:t}function _6(e,t=RB){const n=e?.deviceCapabilities;if(!n||typeof n!="object"||Array.isArray(n))return t;const r=n;return{hover:r.hover??t.hover,touch:r.touch??t.touch}}function j6(e,t=PB){const n=e?.safeAreaInsets;if(!n||typeof n!="object"||Array.isArray(n))return t;const r=n;return{top:r.top??t.top,right:r.right??t.right,bottom:r.bottom??t.bottom,left:r.left??t.left}}function _B(e,t){return e&&t.includes(e)?e:t[0]??"inline"}function c1(e){return e==="inline"||e==="pip"||e==="fullscreen"}function u1(e){return!ps(e)||e.headers!==void 0&&!ps(e.headers)?!1:e.requestTimeout===void 0||typeof e.requestTimeout=="number"&&Number.isFinite(e.requestTimeout)}function h1(e){return e?Object.fromEntries(Object.entries(e).filter(([t,n])=>t.trim()!==""&&t.toLowerCase()!=="authorization"&&typeof n=="string")):{}}function jB(e){return e?Object.fromEntries(Object.entries(e).filter(([t,n])=>t.trim()!==""&&typeof n=="string")):{}}function BB(e,t){return typeof e!="number"||!Number.isFinite(e)||e<=0?t:e}function ps(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var FB=class extends Error{reason;constructor(e,t){super(t?`App is still bootstrapping (${e}): ${t}`:`App is still bootstrapping (${e}). Wait for useAppReady() to resolve before initiating requests.`),this.name="BootstrapNotReadyError",this.reason=e}},Jf="mcpjam:task-bookmarks-changed";function VB(){typeof window<"u"&&window.dispatchEvent(new Event(Jf))}function B6(e){return window.addEventListener(Jf,e),window.addEventListener("storage",e),()=>{window.removeEventListener(Jf,e),window.removeEventListener("storage",e)}}var zB=2e3,$B=6048e5;function F6(e){return e!=="working"&&e!=="input_required"}function V6(e,t){return Math.max(e,zB,t??0)}function HB(e,t){return e&&t?JSON.stringify(["owned-task-v1",e,t]):void 0}var hu,Qo;function WB(e){hu=e??void 0}function UB(){return hu}function qB(e,t){Qo=HB(e,t)}function Pm(){return Qo}function ms(e){return e.connectionId!==void 0||e.sourceExecutionId!==void 0}function Ca(e){return{...e,scope:e.scope??(ms(e)?Qo:hu)}}function f1(e){return ms(e)?Qo!==void 0&&e.scope===Qo:e.scope===hu}function Zf(e,t){const n=`${t?.scope??(t?.connectionId!==void 0?Pm():UB())??""}\0${e}`;return t?.wire!==void 0||t?.connectionId!==void 0?`${n}\0${t.wire??""}\0${t.connectionId??""}`:n}function Ds(e,t){return e.connectionId===t?.connectionId&&(t?.scope===void 0||e.scope===t.scope)&&(t?.wire===void 0||e.wire===t.wire)}var d1="mcp-tracked-tasks",p1="mcp-tracked-tasks-v4",Ll=4,KB=50,gs=1024,m1=100,GB=524288;function jt(e){return Xr(e)}function QB(e,t){const n=Date.parse(e.createdAt);return Number.isNaN(n)?!0:t-n<$B}function Wt(e){if(typeof e=="string")return e.length>gs?e.slice(0,gs):e}function Yt(e){if(typeof e=="string")return e.length>gs||e.includes("\0")?void 0:e}function qr(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function T0(e){if(typeof e!="object"||e===null||Array.isArray(e))return;const t=e,n=Yt(t.taskId),r=Yt(t.serverId),i=Wt(t.createdAt);if(!n||!r)return;const s=Yt(t.connectionId),o=Yt(t.sourceExecutionId);if(t.connectionId!==void 0&&!s||t.sourceExecutionId!==void 0&&!o)return;const a=Yt(t.scope);if(t.scope!==void 0&&a===void 0||!i||Number.isNaN(Date.parse(i)))return;const l=t.wire==="extension"||t.wire==="legacy"?t.wire:"legacy",c=t.ttlMs===null?null:qr(t.ttlMs),u=Array.isArray(t.respondedInputKeys)?t.respondedInputKeys.filter(h=>typeof h=="string").slice(0,m1).map(h=>h.slice(0,gs)):void 0;return{taskId:n,serverId:r,wire:l,createdAt:i,...Wt(t.toolName)?{toolName:Wt(t.toolName)}:{},...t.primitiveType==="tool"||t.primitiveType==="prompt"||t.primitiveType==="resource"?{primitiveType:t.primitiveType}:{},...Wt(t.primitiveName)?{primitiveName:Wt(t.primitiveName)}:{},...t.dismissed===!0?{dismissed:!0}:{},...t.expired===!0?{expired:!0}:{},...a!==void 0?{scope:a}:{},...s!==void 0?{connectionId:s}:{},...o!==void 0?{sourceExecutionId:o}:{},...Wt(t.serverName)?{serverName:Wt(t.serverName)}:{},...Wt(t.lastUpdatedAt)?{lastUpdatedAt:Wt(t.lastUpdatedAt)}:{},...Wt(t.status)?{status:Wt(t.status)}:{},...c!==void 0?{ttlMs:c}:{},...qr(t.pollIntervalMs)!==void 0?{pollIntervalMs:qr(t.pollIntervalMs)}:{},...qr(t.nextPollAt)!==void 0?{nextPollAt:qr(t.nextPollAt)}:{},...qr(t.lastObservedAt)!==void 0?{lastObservedAt:qr(t.lastObservedAt)}:{},...u?.length?{respondedInputKeys:u}:{}}}function YB(e){if(Array.isArray(e))return e.map(T0).filter(n=>n!==void 0);if(typeof e!="object"||e===null)return[];const t=e;return typeof t.version=="number"&&t.version>Ll?[]:Array.isArray(t.tasks)?t.tasks.map(T0).filter(n=>n!==void 0):[]}function E0(e){try{const t=localStorage.getItem(e);return t?YB(JSON.parse(t)).filter(n=>QB(n,Date.now())):[]}catch{return[]}}function fu(){const e=E0(d1).filter(n=>!ms(n)),t=E0(p1);return[...new Map([...e,...t].map(n=>[jt(n),n])).values()]}function ln(){return fu().filter(f1)}function Aa(e){Im([...e,...fu().filter(t=>!f1(t))])}function Im(e){try{let t=e,n=JSON.stringify({version:Ll,tasks:t});for(;n.length>GB&&t.length>1;)t=t.slice(0,Math.floor(t.length/2)),n=JSON.stringify({version:Ll,tasks:t});localStorage.setItem(d1,JSON.stringify({version:3,tasks:t.filter(r=>!ms(r))})),localStorage.setItem(p1,JSON.stringify({version:Ll,tasks:t.filter(ms)})),VB()}catch{}}function z6(){return ln()}function $6(e,t,n,r){return ln().filter(i=>i.serverId===e&&!i.dismissed&&Ds(i,{wire:t,connectionId:n,scope:r}))}function H6(e,t,n){return ln().find(r=>r.taskId===e&&(t===void 0||r.serverId===t)&&Ds(r,n))}function W6(e){const t=Ca(e);if(ms(t)&&t.scope===void 0||Yt(t.taskId)===void 0||Yt(t.serverId)===void 0||t.scope!==void 0&&Yt(t.scope)===void 0||t.connectionId!==void 0&&!Yt(t.connectionId)||t.sourceExecutionId!==void 0&&!Yt(t.sourceExecutionId))return;const n=fu(),r=jt(t);if(n.some(o=>jt(o)===r))return;const i=o=>(o.scope??void 0)===(t.scope??void 0),s=n.filter(i);s.unshift({...t,dismissed:!1}),Im([...s.slice(0,KB),...n.filter(o=>!i(o))])}function XB(e,t){t.status!==void 0&&(e.status=t.status),t.lastUpdatedAt!==void 0&&(e.lastUpdatedAt=t.lastUpdatedAt),t.ttlMs!==void 0&&(e.ttlMs=t.ttlMs),t.pollIntervalMs!==void 0&&(e.pollIntervalMs=t.pollIntervalMs),t.nextPollAt!==void 0&&(e.nextPollAt=t.nextPollAt),t.lastObservedAt!==void 0&&(e.lastObservedAt=t.lastObservedAt)}function U6(e){if(e.length===0)return;const t=ln(),n=new Map(t.map(i=>[jt(i),i]));let r=!1;for(const{identity:i,observation:s}of e){const o=n.get(jt(Ca(i)));o&&(XB(o,s),r=!0)}r&&Aa(t)}function q6(e){const t=new Map;if(e.length===0)return t;const n=new Map;for(const r of e)n.set(jt(Ca(r)),jt(r));for(const r of ln()){const i=n.get(jt(r));i!==void 0&&t.set(i,{nextPollAt:r.nextPollAt,lastObservedAt:r.lastObservedAt,pollIntervalMs:r.pollIntervalMs,ttlMs:r.ttlMs,status:r.status,respondedInputKeys:r.respondedInputKeys??[]})}return t}function K6(e,t){if(t.length===0)return;const n=jt(Ca(e)),r=ln(),i=r.find(s=>jt(s)===n);i&&(i.respondedInputKeys=[...new Set([...i.respondedInputKeys??[],...t])].slice(0,m1).map(s=>s.slice(0,gs)),Aa(r))}function G6(e){const t=jt(Ca(e));return ln().find(n=>jt(n)===t)?.respondedInputKeys??[]}function Q6(e,t,n){const r=ln();for(const i of r)i.taskId===e&&(t===void 0||i.serverId===t)&&Ds(i,n)&&(i.expired=!0);Aa(r)}function Y6(e,t,n){const r=new Set(t),i=ln();for(const s of i)s.serverId===e&&r.has(s.taskId)&&Ds(s,n)&&(s.dismissed=!0);Aa(i)}var g1="mcp-dismissed-registry-tasks",JB=200;function Om(){try{const e=localStorage.getItem(g1);if(!e)return{};const t=JSON.parse(e);if(typeof t!="object"||t===null||Array.isArray(t))return{};const n={};for(const[r,i]of Object.entries(t))Array.isArray(i)&&(n[r]=i.filter(s=>typeof s=="string"&&s.length>0&&s.length<=gs).slice(0,JB));return n}catch{return{}}}function v1(e){try{localStorage.setItem(g1,JSON.stringify(e))}catch{}}function X6(e,t,n){if(n?.connectionId!==void 0&&n.scope===void 0&&Pm()===void 0)return;const r=t.filter(o=>Yt(o)!==void 0);if(r.length===0)return;const i=Om(),s=Zf(e,n);i[s]=[...new Set([...i[s]??[],...r])].slice(-200),v1(i)}function J6(e,t){if(t?.connectionId!==void 0&&t.scope===void 0&&Pm()===void 0)return new Set;const n=new Set(ln().filter(s=>s.serverId===e&&s.dismissed&&Ds(s,t)).map(s=>s.taskId)),r=Om(),i=[Zf(e,t)];t?.connectionId===void 0&&t?.scope===void 0&&i.push(Zf(e));for(const s of i)for(const o of r[s]??[])n.add(o);return n}function Z6(e,t){Aa(ln().filter(n=>n.serverId!==e||!Ds(n,t)))}function ZB(e){const t=e??void 0;Im(fu().filter(s=>(s.scope??void 0)!==t));const n=Om(),r=`${t??""}\0`;let i=!1;for(const s of Object.keys(n))s.startsWith(r)&&(delete n[s],i=!0);i&&v1(n)}var y1={projectId:null,serverIdsByName:{}},Z=y1,Gt=null,Or=0,ed=new Set,io=3e4,eF=3e3,tF=100,gh=null;function Dm(){Gt=null}var nF=1e4;async function rF(){if(Ki())return null;const e=Z.getAccessToken;if(!e)return null;const t=Or;Dm();let n;try{const r=await Promise.race([e({forceRefresh:!0}),new Promise(i=>{n=setTimeout(()=>i(null),nF)})]);return!r||t!==Or?null:(Gt={token:r,expiresAt:Date.now()+io,kind:"session"},r)}catch{return null}finally{clearTimeout(n)}}function x1(){Or+=1;for(const e of ed)e()}function e8(e){return ed.add(e),()=>{ed.delete(e)}}function t8(){return Or}var M0=null;function n8(e){const t=M0;if(t&&t.revision===Or&&t.serverNameOrId===e)return t.key;const n=Z.clientConfigSyncPending||!oF(e)?null:JSON.stringify([Ki(),uF(e)]);return M0={revision:Or,serverNameOrId:e,key:n},n}function iF(){throw new Error("Hosted API context is only available in hosted mode")}function Nm(){if(Z.clientConfigSyncPending)throw new Error(EB)}function sF(){return!Z.isAuthenticated&&!Z.hasSession}function Lm(){return!(Z.isAuthenticated||Z.hasSession)}function Ki(){return Lm()}function r8(e){const t=Z.projectId??void 0,n=e?.projectId??void 0;t&&n&&t!==n&&ZB(t),WB(n),qB(n,e?.taskOwnerId),Z=e?{...e,clientCapabilities:e.clientCapabilities??zc()}:y1,Dm(),x1()}function i8(e,t,n){Z.projectId===n&&Z.serverIdsByName[e]!==t&&(Z={...Z,serverIdsByName:{...Z.serverIdsByName,[e]:t}},x1())}function b1(){const e=Z.projectId;if(!e)throw new FB("provisioning-project","hosted projectId is not in the API context yet");return e}function oF(e){const t=Z.projectId;if(!t)return null;const n=Z.serverIdsByName[e];return n?{projectId:t,serverId:n}:Object.values(Z.serverIdsByName).includes(e)?{projectId:t,serverId:e}:null}function aF(e){const t=e.trim();return!(t.length<1||t.length>=20&&/^[a-z0-9]+$/i.test(t))}var lF="Hosted server not found. The server is not in your hosted project, or the server list is still loading.";function w1(e){const t=Z.serverIdsByName[e];if(t)return t;if(Object.values(Z.serverIdsByName).includes(e))return e;throw aF(e)?new Error(`Hosted server not found for "${e}"`):new Error(lF)}function Ta(e){return Object.entries(Z.serverIdsByName).find(([,t])=>t===e)?.[0]}function s8(e){return Ta(e)}function o8(e){}function a8(e){iF();const t=new Set,n=[];for(const r of e){if(typeof r!="string")continue;const i=r.trim();if(!i)continue;const s=Z.serverIdsByName[i]!==void 0?i:Ta(i)??i,o=s.toLowerCase();t.has(o)||(t.add(o),n.push(s))}return n}function cF(e){const t=new Set,n=[];for(const r of e){const i=w1(r);t.has(i)||(t.add(i),n.push({serverId:i,serverName:Z.serverIdsByName[r]!==void 0?r:Ta(i)??r}))}return n}function _m(){return Z.scenarioId}function S1(){return Z.accessVersion}function k1(){return _m()?"chat_v2":void 0}function jm(e){return{...e.mirrorToolParamHeaders===!1?{mirrorToolParamHeaders:!1}:{},...e.firstPageOnly===!0?{firstPageOnly:!0}:{},...e.suppressListenChannel===!0?{suppressListenChannel:!0}:{},...e.dropToolListChanged===!0?{dropToolListChanged:!0}:{},...e.toolCallCancellation?{toolCallCancellation:e.toolCallCancellation}:{},...e.supportsMrtr===!1?{supportsMrtr:!1}:{}}}function uF(e){Nm();const t=b1(),n=w1(e),r=_m(),i=S1(),s=k1();return{projectId:t,serverId:n,serverName:Z.serverIdsByName[e]!==void 0?e:Ta(n)??e,...Z.clientCapabilities?{clientCapabilities:Z.clientCapabilities}:{},...Z.clientInfo?{clientInfo:Z.clientInfo}:{},...Z.supportedProtocolVersions?.length?{supportedProtocolVersions:Z.supportedProtocolVersions}:{},...Z.mcpProtocolVersionsByServerId?.[n]?{mcpProtocolVersion:Z.mcpProtocolVersionsByServerId[n]}:{},...jm(Z),...Z.xaaPolicy?{xaaPolicy:Z.xaaPolicy}:{},...s?{accessScope:s}:{},...r?{scenarioId:r}:{},...r&&Number.isFinite(i)?{accessVersion:i}:{}}}function l8(e){Nm();const t=b1(),n=cF(e),r=n.map(c=>c.serverId),i=n.map(c=>c.serverName),s=C1(r),o=_m(),a=S1(),l=k1();return{projectId:t,serverIds:r,serverNames:i,...Z.clientCapabilities?{clientCapabilities:Z.clientCapabilities}:{},...Z.clientInfo?{clientInfo:Z.clientInfo}:{},...Z.supportedProtocolVersions?.length?{supportedProtocolVersions:Z.supportedProtocolVersions}:{},...s?{mcpProtocolVersionsByServerId:s}:{},...jm(Z),...Z.xaaPolicy?{xaaPolicy:Z.xaaPolicy}:{},...l?{accessScope:l}:{},...o?{scenarioId:o}:{},...o&&Number.isFinite(a)?{accessVersion:a}:{}}}function C1(e){const t=Z.mcpProtocolVersionsByServerId;if(!t)return;const n={};for(const r of e){const i=t[r];i&&(n[r]=i)}return Object.keys(n).length>0?n:void 0}function c8(e){Nm();const t=C1(e.serverIds);return{projectId:e.projectId,serverIds:e.serverIds,serverNames:e.serverNames,...Z.clientCapabilities?{clientCapabilities:Z.clientCapabilities}:{},...Z.clientInfo?{clientInfo:Z.clientInfo}:{},...Z.supportedProtocolVersions?.length?{supportedProtocolVersions:Z.supportedProtocolVersions}:{},...t?{mcpProtocolVersionsByServerId:t}:{},...jm(Z),...Z.xaaPolicy?{xaaPolicy:Z.xaaPolicy}:{},...e.accessScope?{accessScope:e.accessScope}:{},...e.scenarioId?{scenarioId:e.scenarioId}:{},...e.scenarioId&&Number.isFinite(e.accessVersion)?{accessVersion:e.accessVersion}:{}}}function hF(){return gh??=fF().finally(()=>{gh=null}),gh}async function fF(){const e=Date.now()+eF;for(;Date.now()<e;){if(await new Promise(n=>setTimeout(n,tF)),Lm())return null;const t=Z.getAccessToken;if(t)try{const n=await t();if(n)return n}catch{}}return null}async function A1(e=1){const t=Or,n=Ki(),r=()=>Or!==t||Ki()!==n,i=()=>e>0?A1(e-1):null,s=Date.now();if(Gt&&Gt.expiresAt>s)if(Gt.kind==="guest"&&!Ki())Gt=null;else return`Bearer ${Gt.token}`;if(Ki()){const l=await Mg();if(r())return i();if(l)return Gt={token:l,expiresAt:s+io,kind:"guest"},`Bearer ${l}`}const o=Z.getAccessToken;if(o)try{const l=await o();if(r())return i();if(l)return Gt={token:l,expiresAt:s+io,kind:"session"},`Bearer ${l}`}catch{}if(!Lm()){const l=await hF();return r()?i():l?(Gt={token:l,expiresAt:Date.now()+io,kind:"session"},`Bearer ${l}`):null}const a=await Mg();return r()?i():a?(Gt={token:a,expiresAt:s+io,kind:"guest"},`Bearer ${a}`):null}function dF(){const e=QE();if(e)return e;const t=JE()??"https://rt.mcpjam.com";return t&&typeof t=="string"?t.replace(".convex.cloud",".convex.site"):null}var pF=["billing_","credit_topup_","plan_limit_","plans_upgrade_confirm_","pricing_"];function mF(e){return pF.some(t=>e.startsWith(t))}function gF(e){const t=e.toLowerCase();return t==="organization_id"||t==="package_id"||t==="price_cents"||t==="price_paid_cents"||t==="granted_credits"||t==="amount_credits"||t==="error"||t==="error_name"||t==="error_message"||t.startsWith("stripe_")||t.startsWith("invoice_")||t==="checkout_session_id"||t==="payment_intent_id"}function td(e,t={}){const{location:n="unknown",platform:r,environment:i,...s}=t;try{const o=mF(e),a=o?s.organization_id:void 0,l=typeof a=="string"&&a.length>0?a:void 0,c=o?Object.fromEntries(Object.entries(s).filter(([u])=>!gF(u))):s;Zx.capture(e,{...c,...aM(n),...o?{organization_id:null,...l?{$groups:{organization:l}}:{}}:{}})}catch(o){console.warn(`[analytics] Failed to capture ${e}`,o)}}function u8(e,t,n=Rg()){const r=ZE();!n||Rg()!==n||r.policy.content!=="full"||e.capture("$set",{},{$set:r.policy.identity==="full"?t:{deployment:t.deployment}})}function vF(e){if(typeof e!="object"||e===null)return!1;const{code:t,details:n}=e;return t==="SESSION_REVOKED"?!0:t==="UNAUTHORIZED"&&typeof n=="object"&&n!==null&&n.reason==="SESSION_REVOKED"}async function yF(e){if(e.status!==401)return!1;try{return typeof e.clone!="function"?!1:vF(await e.clone().json())}catch{return!1}}var Co=null,R0=!1,nd=!1;function T1(e){try{e()}catch{}}function xF(){R0||(R0=!0,Co?T1(Co):nd=!0)}function h8(e){return Co=e,nd&&(nd=!1,T1(e)),()=>{Co===e&&(Co=null)}}var vs=null,so=null,Bm=class extends Error{status;code;restarted;constructor(e,t,n=!1){super(`Failed to get session token: ${e}`),this.name="SessionTokenError",this.status=e,this.code=t,this.restarted=n}};function f8(e){return e instanceof Bm&&e.status===403}var P0={"/api/web/scenarios/bootstrap":"scenario"};function bF(e){const t=e instanceof URL?e.toString():typeof Request<"u"&&e instanceof Request?e.url:String(e),n=typeof window<"u"?window.location.origin:"http://localhost";try{const r=new URL(t,n);return P0[r.pathname]??null}catch{return P0[t]??null}}function wF(...e){const t={};for(const n of e)if(n){if(n instanceof Headers){n.forEach((r,i)=>{t[i]=r});continue}if(Array.isArray(n)){for(const[r,i]of n)t[r]=i;continue}Object.assign(t,n)}return t}function SF(e){return e?e instanceof Headers?e.has("Authorization"):Array.isArray(e)?e.some(([t])=>t.toLowerCase()==="authorization"):Object.keys(e).some(t=>t.toLowerCase()==="authorization"):!1}function Qa(e,t,n){const r=P1(e)?CF():void 0,i=n&&I1(e)?{Authorization:n}:void 0;return{...t,headers:wF(r,i,t?.headers)}}async function E1(e){const t=await fetch("/api/session-token",{headers:e?{"X-MCP-Session-Auth":`Bearer ${e}`}:{},cache:"no-store"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Bm(t.status,n.code,!!e)}if(!yM(e)||(await t.json()).ok!==!0)throw new Error("Invalid Inspector access response");return vs=e,cM(e),e}async function d8(){return vs||(so||(so=E1(Mp()).catch(e=>{throw so=null,e})),so)}async function kF(){vs=null,so=null;try{return await E1(Mp(!0))}catch(e){return e instanceof Bm&&e.code==="ACCESS_LINK_REQUIRED"&&window.dispatchEvent(new CustomEvent(nb,{detail:{restarted:e.restarted}})),null}}function du(){return vs||(Mp()??"")}function p8(){return!!du()}function CF(){const e=du();return e?{"X-MCP-Session-Auth":`Bearer ${e}`}:(console.warn("[Auth] Session token not available"),{})}function M1(e){return e==="localhost"||e==="127.0.0.1"||e==="::1"||e==="[::1]"}function Fm(e){const t=typeof window<"u"?window.location.origin:"http://localhost";try{return e instanceof URL?e:typeof Request<"u"&&e instanceof Request?new URL(e.url,t):new URL(String(e),t)}catch{return null}}function R1(e){return M1(e.hostname)?!0:typeof window<"u"&&e.origin===window.location.origin}function P1(e){const t=Fm(e);return t?R1(t)&&t.pathname.startsWith("/api/"):typeof e=="string"&&e.startsWith("/api/")}var AF=["/api/mcp/webmcp","/api/web/","/api/v1/harness/","/api/v1/built-in-tools/","/api/web-clients/accounts/","/api/web-clients/reconnect/","/api/v1/agent-ops","/api/mcp/local-harness","/api/mcp/connect","/api/mcp/servers/reconnect","/api/mcp/servers/approve-command","/api/mcp/server-features/observations","/api/mcp/servers/canvas/refresh","/api/mcp/chat-v2","/api/mcp/xaa/proxy/token","/api/mcp/xaa/negative-tests","/api/mcp/xaa/authenticate","/api/mcp/xaa/token-exchange","/api/mcp/xaa/token","/api/mcp/computers/local-consent","/api/mcp/computers/local-terminal-token","/api/mcp/computers/local-browser","/api/mcp/computers/browser-location","/web/oauth/","/web/registry/"];function TF(e){if(typeof window<"u"&&e.origin===window.location.origin||M1(e.hostname))return!0;const t=dF();if(t)try{const n=new URL(t).hostname;if(e.hostname===n)return!0}catch{}return!1}var EF=[/^\/api\/mcp\/(chat-persistence|turn-authorization)\/?$/,/^\/api\/mcp\/servers\/command-approval\/?$/,/^\/api\/v1\/projects\/[^/]+\/readiness-runs(\/[^/]+(\/(cancel|report|resume))?)?$/,/^\/api\/v1\/projects\/[^/]+\/servers\/[^/]+\/revisions(\/\d+\/diff)?$/,/^\/api\/v1\/projects\/[^/]+\/servers\/[^/]+\/readiness-runs\/(claude|openai)$/,/^\/api\/v1\/projects\/[^/]+\/directory-submissions\/[^/]+\/reviewer-attempts(\/[^/]+(\/(resume|cancel|handoff))?)?$/,/^\/api\/v1\/directory-flows(\/[^/]+)?$/,/^\/api\/v1\/projects\/[^/]+\/directory-submissions(\/[^/]+(\/(runs|results|handoff|export|events|snapshots|findings(\/[^/]+)?))?)?$/,/^\/api\/v1\/projects\/[^/]+\/directory-submissions\/[^/]+\/(test-plan(\/draft)?|tool-tests)$/,/^\/api\/v1\/projects\/[^/]+\/eval-suites\/[^/]+\/run-disclosure$/,/^\/api\/v1\/projects\/[^/]+\/eval-runs\/[^/]+\/(decision-summary|stage-analytics|route-facts|server-facts)$/,/^\/api\/v1\/projects\/[^/]+\/eval-suites\/[^/]+\/stage-analytics$/,/^\/api\/v1\/projects\/[^/]+\/eval-runs\/[^/]+\/description-experiments$/,/^\/api\/v1\/projects\/[^/]+\/eval-description-experiments\/[^/]+(\/start)?$/,/^\/api\/v1\/projects\/[^/]+\/eval-runs\/[^/]+\/backtest$/,/^\/api\/v1\/projects\/[^/]+\/eval-runs\/[^/]+\/iterations$/,/^\/api\/v1\/projects\/[^/]+\/eval-runs\/[^/]+\/compare$/,/^\/api\/v1\/projects\/[^/]+\/eval-runs\/[^/]+\/cancel$/];function I0(e){return EF.some(t=>t.test(e))?!0:AF.some(t=>t.endsWith("/")?e.startsWith(t):e===t||e.startsWith(`${t}/`))}var MF=["/api/web/apps/plugin-instances/","/api/web/plugin-forms/"];function RF(e){const t=Fm(e),n=t?t.pathname:typeof e=="string"?e.split("?")[0]:"";return/^\/api\/(web|mcp)\/(chat-persistence|turn-authorization)\/?$/.test(n)||MF.some(r=>n.startsWith(r))}function PF(e){return e==null||typeof e=="string"||e instanceof FormData||e instanceof URLSearchParams||e instanceof Blob||e instanceof ArrayBuffer||ArrayBuffer.isView(e)}function I1(e){const t=Fm(e);if(t)return TF(t)?I0(t.pathname):!1;if(typeof e!="string"||!e.startsWith("/"))return!1;const n=e.split("?")[0];return I0(n)}function IF(e){const t=du();if(!t)return console.warn("[Auth] Session token not available for URL"),e;try{const n=new URL(e,window.location.origin);return R1(n)?(n.searchParams.set("_token",t),n.origin===window.location.origin?n.pathname+n.search:n.href):(console.warn("[Auth] Refusing to attach session token to foreign origin"),e)}catch{return`${e}${e.includes("?")?"&":"?"}_token=${encodeURIComponent(t)}`}}async function m8(e,t){const n=bF(e),r=SF(t?.headers),i=I1(e),s=i&&!r?await A1():null,o=Qa(e,t,s),a=await fetch(e,o);if(a.status===401&&i&&await yF(a))return xF(),a;if(a.status===401&&i&&!r&&RF(e)&&PF(t?.body)&&a.headers?.get("X-MCP-Auth-Required")!=="oauth"){const u=await rF();if(u)return t?.signal?.throwIfAborted(),fetch(e,Qa(e,t,`Bearer ${u}`))}if(a.status===401&&P1(e)&&a.headers?.get("X-MCPJam-Session")!=null){const u=du(),h=await kF();if(h&&h!==u){const f=Qa(e,t,s),d=await fetch(e,f);return d.status===401&&d.headers.get("X-MCPJam-Session")&&window.dispatchEvent(new CustomEvent(nb,{detail:{restarted:!0}})),d}}if(a.status!==401||!i||!sF()||r||a.headers?.get("X-MCP-Auth-Required")==="oauth")return a;Dm();const l=await rM();if(!l)return n&&td("guest_refresh_failure",{location:"auth_fetch",surface:n,auth_mode:"guest",status:"failure",error_kind:"guest_refresh_unavailable"}),a;n&&td("guest_refresh_success",{location:"auth_fetch",surface:n,auth_mode:"guest",status:"success"});const c=Qa(e,t,`Bearer ${l}`);return fetch(e,c)}var O0="1.46.0",Yo=Symbol.for("functionName"),OF=Symbol.for("toReferencePath");function DF(e){return e[OF]??null}function NF(e){return e.startsWith("function://")}function LF(e){let t;if(typeof e=="string")NF(e)?t={functionHandle:e}:t={name:e};else if(e[Yo])t={name:e[Yo]};else{const n=DF(e);if(!n)throw new Error(`${e} is not a functionReference`);t={reference:n}}return t}function pt(e){const t=LF(e);if(t.name===void 0)throw t.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`):t.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`);if(typeof e=="string")return e;const n=e[Yo];if(!n)throw new Error(`${e} is not a functionReference`);return n}function pu(e){return{[Yo]:e}}function O1(e=[]){return new Proxy({},{get(t,n){if(typeof n=="string")return O1([...e,n]);if(n===Yo){if(e.length<2){const s=["api",...e].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${s}\``)}const r=e.slice(0,-1).join("/"),i=e[e.length-1];return i==="default"?r:r+":"+i}else return n===Symbol.toStringTag?"FunctionReference":void 0}})}var g8=O1(),_F=Object.defineProperty,jF=(e,t,n)=>t in e?_F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,D0=(e,t,n)=>jF(e,typeof t!="symbol"?t+"":t,n),BF="color:rgb(0, 145, 255)";function D1(e){switch(e){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}var N1=class{constructor(e){D0(this,"_onLogLineFuncs"),D0(this,"_verbose"),this._onLogLineFuncs={},this._verbose=e.verbose}addLogLineListener(e){let t=Math.random().toString(36).substring(2,15);for(let n=0;n<10&&this._onLogLineFuncs[t]!==void 0;n++)t=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[t]=e,()=>{delete this._onLogLineFuncs[t]}}logVerbose(...e){if(this._verbose)for(const t of Object.values(this._onLogLineFuncs))t("debug",`${new Date().toISOString()}`,...e)}log(...e){for(const t of Object.values(this._onLogLineFuncs))t("info",...e)}warn(...e){for(const t of Object.values(this._onLogLineFuncs))t("warn",...e)}error(...e){for(const t of Object.values(this._onLogLineFuncs))t("error",...e)}};function L1(e){const t=new N1(e);return t.addLogLineListener((n,...r)=>{switch(n){case"debug":console.debug(...r);break;case"info":console.log(...r);break;case"warn":console.warn(...r);break;case"error":console.error(...r);break;default:console.log(...r)}}),t}function _1(e){return new N1(e)}function bc(e,t,n,r,i){const s=D1(n);if(typeof i=="object"&&(i=`ConvexError ${JSON.stringify(i.errorData,null,2)}`),t==="info"){const o=i.match(/^\[.*?\] /);if(o===null){e.error(`[CONVEX ${s}(${r})] Could not parse console.log`);return}const a=i.slice(1,o[0].length-2),l=i.slice(o[0].length);e.log(`%c[CONVEX ${s}(${r})] [${a}]`,BF,l)}else e.error(`[CONVEX ${s}(${r})] ${i}`)}function FF(e,t){const n=`[CONVEX FATAL ERROR] ${t}`;return e.error(n),new Error(n)}function Gi(e,t,n){return`[CONVEX ${D1(e)}(${t})] ${n.errorMessage}
42
- Called by client`}function rd(e,t){return t.data=e.errorData,t}function yi(e){const t=e.split(":");let n,r;return t.length===1?(n=t[0],r="default"):(n=t.slice(0,t.length-1).join(":"),r=t[t.length-1]),n.endsWith(".js")&&(n=n.slice(0,-3)),`${n}:${r}`}function li(e,t){return JSON.stringify({udfPath:yi(e),args:In(t)})}function N0(e,t,n){const{initialNumItems:r,id:i}=n;return JSON.stringify({type:"paginated",udfPath:yi(e),args:In(t),options:In({initialNumItems:r,id:i})})}var VF=Object.defineProperty,zF=(e,t,n)=>t in e?VF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pn=(e,t,n)=>zF(e,typeof t!="symbol"?t+"":t,n),$F=class{constructor(){pn(this,"nextQueryId"),pn(this,"querySetVersion"),pn(this,"querySet"),pn(this,"queryIdToToken"),pn(this,"identityVersion"),pn(this,"auth"),pn(this,"outstandingQueriesOlderThanRestart"),pn(this,"outstandingAuthOlderThanRestart"),pn(this,"paused"),pn(this,"pendingQuerySetModifications"),this.nextQueryId=0,this.querySetVersion=0,this.identityVersion=0,this.querySet=new Map,this.queryIdToToken=new Map,this.outstandingQueriesOlderThanRestart=new Set,this.outstandingAuthOlderThanRestart=!1,this.paused=!1,this.pendingQuerySetModifications=new Map}hasSyncedPastLastReconnect(){return this.outstandingQueriesOlderThanRestart.size===0&&!this.outstandingAuthOlderThanRestart}markAuthCompletion(){this.outstandingAuthOlderThanRestart=!1}subscribe(e,t,n,r){const i=yi(e),s=li(i,t),o=this.querySet.get(s);if(o!==void 0)return o.numSubscribers+=1,{queryToken:s,modification:null,unsubscribe:()=>this.removeSubscriber(s)};{const a=this.nextQueryId++,l={id:a,canonicalizedUdfPath:i,args:t,numSubscribers:1,journal:n,componentPath:r};this.querySet.set(s,l),this.queryIdToToken.set(a,s);const c=this.querySetVersion,u=this.querySetVersion+1,h={type:"Add",queryId:a,udfPath:i,args:[In(t)],journal:n,componentPath:r};return this.paused?this.pendingQuerySetModifications.set(a,h):this.querySetVersion=u,{queryToken:s,modification:{type:"ModifyQuerySet",baseVersion:c,newVersion:u,modifications:[h]},unsubscribe:()=>this.removeSubscriber(s)}}}transition(e){for(const t of e.modifications)switch(t.type){case"QueryUpdated":case"QueryFailed":{this.outstandingQueriesOlderThanRestart.delete(t.queryId);const n=t.journal;if(n!==void 0){const r=this.queryIdToToken.get(t.queryId);r!==void 0&&(this.querySet.get(r).journal=n)}break}case"QueryRemoved":this.outstandingQueriesOlderThanRestart.delete(t.queryId);break;default:throw new Error(`Invalid modification ${t.type}`)}}queryId(e,t){const n=yi(e),r=li(n,t),i=this.querySet.get(r);return i!==void 0?i.id:null}isCurrentOrNewerAuthVersion(e){return e>=this.identityVersion}getAuth(){return this.auth}setAuth(e){this.auth={tokenType:"User",value:e};const t=this.identityVersion;return this.paused||(this.identityVersion=t+1),{type:"Authenticate",baseVersion:t,...this.auth}}setAdminAuth(e,t){const n={tokenType:"Admin",value:e,impersonating:t};this.auth=n;const r=this.identityVersion;return this.paused||(this.identityVersion=r+1),{type:"Authenticate",baseVersion:r,...n}}clearAuth(){this.auth=void 0,this.markAuthCompletion();const e=this.identityVersion;return this.paused||(this.identityVersion=e+1),{type:"Authenticate",tokenType:"None",baseVersion:e}}hasAuth(){return!!this.auth}isNewAuth(e){return this.auth?.value!==e}queryPath(e){const t=this.queryIdToToken.get(e);return t?this.querySet.get(t).canonicalizedUdfPath:null}queryArgs(e){const t=this.queryIdToToken.get(e);return t?this.querySet.get(t).args:null}queryToken(e){return this.queryIdToToken.get(e)??null}queryJournal(e){return this.querySet.get(e)?.journal}restart(){this.unpause(),this.outstandingQueriesOlderThanRestart.clear();const e=[];for(const r of this.querySet.values()){const i={type:"Add",queryId:r.id,udfPath:r.canonicalizedUdfPath,args:[In(r.args)],journal:r.journal,componentPath:r.componentPath};e.push(i),this.outstandingQueriesOlderThanRestart.add(r.id)}this.querySetVersion=1;const t={type:"ModifyQuerySet",baseVersion:0,newVersion:1,modifications:e};if(!this.auth)return this.identityVersion=0,[t,void 0];this.outstandingAuthOlderThanRestart=!0;const n={type:"Authenticate",baseVersion:0,...this.auth};return this.identityVersion=1,[t,n]}pause(){this.paused=!0}resume(){const e=this.pendingQuerySetModifications.size>0?{type:"ModifyQuerySet",baseVersion:this.querySetVersion,newVersion:++this.querySetVersion,modifications:Array.from(this.pendingQuerySetModifications.values())}:void 0,t=this.auth!==void 0?{type:"Authenticate",baseVersion:this.identityVersion++,...this.auth}:void 0;return this.unpause(),[e,t]}unpause(){this.paused=!1,this.pendingQuerySetModifications.clear()}removeSubscriber(e){const t=this.querySet.get(e);if(t.numSubscribers>1)return t.numSubscribers-=1,null;{this.querySet.delete(e),this.queryIdToToken.delete(t.id),this.outstandingQueriesOlderThanRestart.delete(t.id);const n=this.querySetVersion,r=this.querySetVersion+1,i={type:"Remove",queryId:t.id};return this.paused?this.pendingQuerySetModifications.has(t.id)?this.pendingQuerySetModifications.delete(t.id):this.pendingQuerySetModifications.set(t.id,i):this.querySetVersion=r,{type:"ModifyQuerySet",baseVersion:n,newVersion:r,modifications:[i]}}}},HF=Object.defineProperty,WF=(e,t,n)=>t in e?HF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ya=(e,t,n)=>WF(e,typeof t!="symbol"?t+"":t,n),UF=class{constructor(e,t){this.logger=e,this.markConnectionStateDirty=t,Ya(this,"inflightRequests"),Ya(this,"requestsOlderThanRestart"),Ya(this,"inflightMutationsCount",0),Ya(this,"inflightActionsCount",0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(e,t){const n=new Promise(r=>{const i=t?"Requested":"NotSent";this.inflightRequests.set(e.requestId,{message:e,status:{status:i,requestedAt:new Date,onResult:r}}),e.type==="Mutation"?this.inflightMutationsCount++:e.type==="Action"&&this.inflightActionsCount++});return this.markConnectionStateDirty(),n}onResponse(e){const t=this.inflightRequests.get(e.requestId);if(t===void 0||t.status.status==="Completed")return null;const n=t.message.type==="Mutation"?"mutation":"action",r=t.message.udfPath;for(const a of e.logLines)bc(this.logger,"info",n,r,a);const i=t.status;let s,o;if(e.success)s={success:!0,logLines:e.logLines,value:sc(e.result)},o=()=>i.onResult(s);else{const a=e.result,{errorData:l}=e;bc(this.logger,"error",n,r,a),s={success:!1,errorMessage:a,errorData:l!==void 0?sc(l):void 0,logLines:e.logLines},o=()=>i.onResult(s)}return e.type==="ActionResponse"||!e.success?(o(),this.inflightRequests.delete(e.requestId),this.requestsOlderThanRestart.delete(e.requestId),t.message.type==="Action"?this.inflightActionsCount--:t.message.type==="Mutation"&&this.inflightMutationsCount--,this.markConnectionStateDirty(),{requestId:e.requestId,result:s}):(t.status={status:"Completed",result:s,ts:e.ts,onResolve:o},null)}removeCompleted(e){const t=new Map;for(const[n,r]of this.inflightRequests.entries()){const i=r.status;i.status==="Completed"&&i.ts.lessThanOrEqual(e)&&(i.onResolve(),t.set(n,i.result),r.message.type==="Mutation"?this.inflightMutationsCount--:r.message.type==="Action"&&this.inflightActionsCount--,this.inflightRequests.delete(n),this.requestsOlderThanRestart.delete(n))}return t.size>0&&this.markConnectionStateDirty(),t}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());const e=[];for(const[t,n]of this.inflightRequests){if(n.status.status==="NotSent"){n.status.status="Requested",e.push(n.message);continue}if(n.message.type==="Mutation")e.push(n.message);else if(n.message.type==="Action"){if(this.inflightRequests.delete(t),this.requestsOlderThanRestart.delete(t),this.inflightActionsCount--,n.status.status==="Completed")throw new Error("Action should never be in 'Completed' state");n.status.onResult({success:!1,errorMessage:"Connection lost while action was in flight",logLines:[]})}}return this.markConnectionStateDirty(),e}resume(){const e=[];for(const[,t]of this.inflightRequests)if(t.status.status==="NotSent"){t.status.status="Requested",e.push(t.message);continue}return e}hasIncompleteRequests(){for(const e of this.inflightRequests.values())if(e.status.status==="Requested")return!0;return!1}hasInflightRequests(){return this.inflightRequests.size>0}hasSyncedPastLastReconnect(){return this.requestsOlderThanRestart.size===0}timeOfOldestInflightRequest(){if(this.inflightRequests.size===0)return null;let e=Date.now();for(const t of this.inflightRequests.values())t.status.status!=="Completed"&&t.status.requestedAt.getTime()<e&&(e=t.status.requestedAt.getTime());return new Date(e)}inflightMutations(){return this.inflightMutationsCount}inflightActions(){return this.inflightActionsCount}},qF=Object.defineProperty,KF=(e,t,n)=>t in e?qF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wc=(e,t,n)=>KF(e,typeof t!="symbol"?t+"":t,n),L0=class id{constructor(t){wc(this,"queryResults"),wc(this,"modifiedQueries"),this.queryResults=t,this.modifiedQueries=[]}getQuery(t,...n){const r=Wn(n[0]),i=pt(t),s=this.queryResults.get(li(i,r));if(s!==void 0)return id.queryValue(s.result)}getAllQueries(t){const n=[],r=pt(t);for(const i of this.queryResults.values())i.udfPath===yi(r)&&n.push({args:i.args,value:id.queryValue(i.result)});return n}setQuery(t,n,r){const i=Wn(n),s=pt(t),o=li(s,i);let a;r===void 0?a=void 0:a={success:!0,value:r,logLines:[]};const l={udfPath:s,args:i,result:a};this.queryResults.set(o,l),this.modifiedQueries.push(o)}static queryValue(t){if(t!==void 0)return t.success?t.value:void 0}},GF=class{constructor(){wc(this,"queryResults"),wc(this,"optimisticUpdates"),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(e,t){this.optimisticUpdates=this.optimisticUpdates.filter(s=>!t.has(s.mutationId));const n=this.queryResults;this.queryResults=new Map(e);const r=new L0(this.queryResults);for(const s of this.optimisticUpdates)s.update(r);const i=[];for(const[s,o]of this.queryResults){const a=n.get(s);(a===void 0||a.result!==o.result)&&i.push(s)}return i}applyOptimisticUpdate(e,t){this.optimisticUpdates.push({update:e,mutationId:t});const n=new L0(this.queryResults);return e(n),n.modifiedQueries}rawQueryResult(e){const t=this.queryResults.get(e);if(t!==void 0)return t.result}queryResult(e){const t=this.queryResults.get(e);if(t===void 0)return;const n=t.result;if(n!==void 0){if(n.success)return n.value;throw n.errorData!==void 0?rd(n,new cf(Gi("query",t.udfPath,n))):new Error(Gi("query",t.udfPath,n))}}hasQueryResult(e){return this.queryResults.get(e)!==void 0}queryLogs(e){return this.queryResults.get(e)?.result?.logLines}},QF=Object.defineProperty,YF=(e,t,n)=>t in e?QF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vh=(e,t,n)=>YF(e,typeof t!="symbol"?t+"":t,n),Ea=class zn{constructor(t,n){vh(this,"low"),vh(this,"high"),vh(this,"__isUnsignedLong__"),this.low=t|0,this.high=n|0,this.__isUnsignedLong__=!0}static isLong(t){return(t&&t.__isUnsignedLong__)===!0}static fromBytesLE(t){return new zn(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24)}toBytesLE(){const t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]}static fromNumber(t){return isNaN(t)||t<0?_0:t>=XF?JF:new zn(t%Ao|0,t/Ao|0)}toString(){return(BigInt(this.high)*BigInt(Ao)+BigInt(this.low)).toString()}equals(t){return zn.isLong(t)||(t=zn.fromValue(t)),this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low}notEquals(t){return!this.equals(t)}comp(t){return zn.isLong(t)||(t=zn.fromValue(t)),this.equals(t)?0:t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(t){return this.comp(t)<=0}static fromValue(t){return typeof t=="number"?zn.fromNumber(t):new zn(t.low,t.high)}},_0=new Ea(0,0),j0=65536,Ao=j0*j0,XF=Ao*Ao,JF=new Ea(-1,-1),ZF=Object.defineProperty,eV=(e,t,n)=>t in e?ZF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xa=(e,t,n)=>eV(e,typeof t!="symbol"?t+"":t,n),B0=class{constructor(e,t){Xa(this,"version"),Xa(this,"remoteQuerySet"),Xa(this,"queryPath"),Xa(this,"logger"),this.version={querySet:0,ts:Ea.fromNumber(0),identity:0},this.remoteQuerySet=new Map,this.queryPath=e,this.logger=t}transition(e){const t=e.startVersion;if(this.version.querySet!==t.querySet||this.version.ts.notEquals(t.ts)||this.version.identity!==t.identity)throw new Error(`Invalid start version: ${t.ts.toString()}:${t.querySet}:${t.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`);for(const n of e.modifications)switch(n.type){case"QueryUpdated":{const r=this.queryPath(n.queryId);if(r)for(const s of n.logLines)bc(this.logger,"info","query",r,s);const i=sc(n.value??null);this.remoteQuerySet.set(n.queryId,{success:!0,value:i,logLines:n.logLines});break}case"QueryFailed":{const r=this.queryPath(n.queryId);if(r)for(const s of n.logLines)bc(this.logger,"info","query",r,s);const{errorData:i}=n;this.remoteQuerySet.set(n.queryId,{success:!1,errorMessage:n.errorMessage,errorData:i!==void 0?sc(i):void 0,logLines:n.logLines});break}case"QueryRemoved":this.remoteQuerySet.delete(n.queryId);break;default:throw new Error(`Invalid modification ${n.type}`)}this.version=e.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}};function yh(e){const t=YE(e);return Ea.fromBytesLE(Array.from(t))}function tV(e){const t=new Uint8Array(e.toBytesLE());return sM(t)}function F0(e){switch(e.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...e};case"MutationResponse":return e.success?{...e,ts:yh(e.ts)}:{...e};case"Transition":return{...e,startVersion:{...e.startVersion,ts:yh(e.startVersion.ts)},endVersion:{...e.endVersion,ts:yh(e.endVersion.ts)}}}}function nV(e){switch(e.type){case"Authenticate":case"ModifyQuerySet":case"Mutation":case"Action":case"Event":return{...e};case"Connect":return e.maxObservedTimestamp!==void 0?{...e,maxObservedTimestamp:tV(e.maxObservedTimestamp)}:{...e,maxObservedTimestamp:void 0}}}var rV=Object.defineProperty,iV=(e,t,n)=>t in e?rV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Be=(e,t,n)=>iV(e,typeof t!="symbol"?t+"":t,n),sV=1e3,oV=1001,aV=1005,lV=4040,_l;function Vi(){return _l===void 0&&(_l=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(_l+performance.now())}function V0(){return`t=${Math.round((Vi()-_l)/100)/10}s`}var j1={InternalServerError:{timeout:1e3},SubscriptionsWorkerFullError:{timeout:3e3},TooManyConcurrentRequests:{timeout:3e3},CommitterFullError:{timeout:3e3},AwsTooManyRequestsException:{timeout:3e3},ExecuteFullError:{timeout:3e3},SystemTimeoutError:{timeout:3e3},ExpiredInQueue:{timeout:3e3},VectorIndexesUnavailable:{timeout:1e3},SearchIndexesUnavailable:{timeout:1e3},TableSummariesUnavailable:{timeout:1e3},VectorIndexTooLarge:{timeout:3e3},SearchIndexTooLarge:{timeout:3e3},TooManyWritesInTimePeriod:{timeout:3e3}};function cV(e){if(e===void 0)return"Unknown";for(const t of Object.keys(j1))if(e.startsWith(t))return t;return"Unknown"}var uV=class{constructor(e,t,n,r,i,s){this.markConnectionStateDirty=i,this.debug=s,Be(this,"socket"),Be(this,"connectionCount"),Be(this,"_hasEverConnected",!1),Be(this,"lastCloseReason"),Be(this,"transitionChunkBuffer",null),Be(this,"defaultInitialBackoff"),Be(this,"maxBackoff"),Be(this,"retries"),Be(this,"serverInactivityThreshold"),Be(this,"reconnectDueToServerInactivityTimeout"),Be(this,"scheduledReconnect",null),Be(this,"networkOnlineHandler",null),Be(this,"pendingNetworkRecoveryInfo",null),Be(this,"uri"),Be(this,"onOpen"),Be(this,"onResume"),Be(this,"onMessage"),Be(this,"webSocketConstructor"),Be(this,"logger"),Be(this,"onServerDisconnectError"),this.webSocketConstructor=n,this.socket={state:"disconnected"},this.connectionCount=0,this.lastCloseReason="InitialConnect",this.defaultInitialBackoff=1e3,this.maxBackoff=16e3,this.retries=0,this.serverInactivityThreshold=6e4,this.reconnectDueToServerInactivityTimeout=null,this.uri=e,this.onOpen=t.onOpen,this.onResume=t.onResume,this.onMessage=t.onMessage,this.onServerDisconnectError=t.onServerDisconnectError,this.logger=r,this.setupNetworkListener(),this.connect()}setSocketState(e){this.socket=e,this._logVerbose(`socket state changed: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}`),this.markConnectionStateDirty()}setupNetworkListener(){typeof window>"u"||typeof window.addEventListener!="function"||this.networkOnlineHandler===null&&(this.networkOnlineHandler=()=>{this._logVerbose("network online event detected"),this.tryReconnectImmediately()},window.addEventListener("online",this.networkOnlineHandler),this._logVerbose("network online event listener registered"))}cleanupNetworkListener(){this.networkOnlineHandler&&typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("online",this.networkOnlineHandler),this.networkOnlineHandler=null,this._logVerbose("network online event listener removed"))}assembleTransition(e){if(e.partNumber<0||e.partNumber>=e.totalParts||e.totalParts===0||this.transitionChunkBuffer&&(this.transitionChunkBuffer.totalParts!==e.totalParts||this.transitionChunkBuffer.transitionId!==e.transitionId))throw this.transitionChunkBuffer=null,new Error("Invalid TransitionChunk");if(this.transitionChunkBuffer===null&&(this.transitionChunkBuffer={chunks:[],totalParts:e.totalParts,transitionId:e.transitionId}),e.partNumber!==this.transitionChunkBuffer.chunks.length){const t=this.transitionChunkBuffer.chunks.length;throw this.transitionChunkBuffer=null,new Error(`TransitionChunk received out of order: expected part ${t}, got ${e.partNumber}`)}if(this.transitionChunkBuffer.chunks.push(e.chunk),this.transitionChunkBuffer.chunks.length===e.totalParts){const t=this.transitionChunkBuffer.chunks.join("");this.transitionChunkBuffer=null;const n=F0(JSON.parse(t));if(n.type!=="Transition")throw new Error(`Expected Transition, got ${n.type} after assembling chunks`);return n}return null}connect(){if(this.socket.state==="terminated")return;if(this.socket.state!=="disconnected"&&this.socket.state!=="stopped")throw new Error("Didn't start connection from disconnected state: "+this.socket.state);const e=new this.webSocketConstructor(this.uri);this._logVerbose("constructed WebSocket"),this.setSocketState({state:"connecting",ws:e,paused:"no"}),this.resetServerInactivityTimeout(),e.onopen=()=>{if(this.logger.logVerbose("begin ws.onopen"),this.socket.state!=="connecting")throw new Error("onopen called with socket not in connecting state");if(this.setSocketState({state:"ready",ws:e,paused:this.socket.paused==="yes"?"uninitialized":"no"}),this.resetServerInactivityTimeout(),this.socket.paused==="no"&&(this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Vi()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",V0(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",V0())),this.connectionCount+=1,this.lastCloseReason=null,this.pendingNetworkRecoveryInfo!==null){const{timeSavedMs:t}=this.pendingNetworkRecoveryInfo;this.pendingNetworkRecoveryInfo=null,this.sendMessage({type:"Event",eventType:"NetworkRecoveryReconnect",event:{timeSavedMs:t}}),this.logger.log(`Network recovery reconnect saved ~${Math.round(t/1e3)}s of waiting`)}},e.onerror=t=>{this.transitionChunkBuffer=null;const n=t.message;n&&this.logger.log(`WebSocket error message: ${n}`)},e.onmessage=t=>{this.resetServerInactivityTimeout();const n=t.data.length;let r=F0(JSON.parse(t.data));if(this._logVerbose(`received ws message with type ${r.type}`),r.type!=="Ping"){if(r.type==="TransitionChunk"){const i=this.assembleTransition(r);if(!i)return;r=i,this._logVerbose(`assembled full ws message of type ${r.type}`)}this.transitionChunkBuffer!==null&&(this.transitionChunkBuffer=null,this.logger.log(`Received unexpected ${r.type} while buffering TransitionChunks`)),r.type==="Transition"&&this.reportLargeTransition({messageLength:n,transition:r}),this.onMessage(r).hasSyncedPastLastReconnect&&(this.retries=0,this.markConnectionStateDirty())}},e.onclose=t=>{if(this._logVerbose("begin ws.onclose"),this.transitionChunkBuffer=null,this.lastCloseReason===null&&(this.lastCloseReason=t.reason||`closed with code ${t.code}`),t.code!==sV&&t.code!==oV&&t.code!==aV&&t.code!==lV){let r=`WebSocket closed with code ${t.code}`;t.reason&&(r+=`: ${t.reason}`),this.logger.log(r),this.onServerDisconnectError&&t.reason&&this.onServerDisconnectError(r)}const n=cV(t.reason);this.scheduleReconnect(n)}}socketState(){return this.socket.state}sendMessage(e){const t={type:e.type,...e.type==="Authenticate"&&e.tokenType==="User"?{value:`...${e.value.slice(-7)}`}:{}};if(this.socket.state==="ready"&&this.socket.paused==="no"){const n=nV(e),r=JSON.stringify(n);let i=!1;try{this.socket.ws.send(r),i=!0}catch(s){this.logger.log(`Failed to send message on WebSocket, reconnecting: ${s}`),this.closeAndReconnect("FailedToSendMessage")}return this._logVerbose(`${i?"sent":"failed to send"} message with type ${e.type}: ${JSON.stringify(t)}`),!0}return this._logVerbose(`message not sent (socket state: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}): ${JSON.stringify(t)}`),!1}resetServerInactivityTimeout(){this.socket.state!=="terminated"&&(this.reconnectDueToServerInactivityTimeout!==null&&(clearTimeout(this.reconnectDueToServerInactivityTimeout),this.reconnectDueToServerInactivityTimeout=null),this.reconnectDueToServerInactivityTimeout=setTimeout(()=>{this.closeAndReconnect("InactiveServer")},this.serverInactivityThreshold))}scheduleReconnect(e){this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.socket={state:"disconnected"};const t=this.nextBackoff(e);this.markConnectionStateDirty(),this.logger.log(`Attempting reconnect in ${Math.round(t)}ms`);const n=Vi(),r=setTimeout(()=>{this.scheduledReconnect?.timeout===r&&(this.scheduledReconnect=null,this.connect())},t);this.scheduledReconnect={timeout:r,scheduledAt:n,backoffMs:t}}closeAndReconnect(e){switch(this._logVerbose(`begin closeAndReconnect with reason ${e}`),this.socket.state){case"disconnected":case"terminated":case"stopped":return;case"connecting":case"ready":this.lastCloseReason=e,this.close(),this.scheduleReconnect("client");return;default:this.socket}}close(){switch(this.transitionChunkBuffer=null,this.socket.state){case"disconnected":case"terminated":case"stopped":return Promise.resolve();case"connecting":{const e=this.socket.ws;return e.onmessage=t=>{this._logVerbose("Ignoring message received after close")},new Promise(t=>{e.onclose=()=>{this._logVerbose("Closed after connecting"),t()},e.onopen=()=>{this._logVerbose("Opened after connecting"),e.close()}})}case"ready":{this._logVerbose("ws.close called");const e=this.socket.ws;e.onmessage=n=>{this._logVerbose("Ignoring message received after close")};const t=new Promise(n=>{e.onclose=()=>{n()}});return e.close(),t}default:return this.socket,Promise.resolve()}}terminate(){switch(this.reconnectDueToServerInactivityTimeout&&clearTimeout(this.reconnectDueToServerInactivityTimeout),this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.cleanupNetworkListener(),this.socket.state){case"terminated":case"stopped":case"disconnected":case"connecting":case"ready":{const e=this.close();return this.setSocketState({state:"terminated"}),e}default:throw this.socket,new Error(`Invalid websocket state: ${this.socket.state}`)}}stop(){switch(this.socket.state){case"terminated":return Promise.resolve();case"connecting":case"stopped":case"disconnected":case"ready":{this.cleanupNetworkListener();const e=this.close();return this.socket={state:"stopped"},e}default:return this.socket,Promise.resolve()}}tryRestart(){switch(this.socket.state){case"stopped":break;case"terminated":case"connecting":case"ready":case"disconnected":this.logger.logVerbose("Restart called without stopping first");return;default:this.socket}this.setupNetworkListener(),this.connect()}pause(){switch(this.socket.state){case"disconnected":case"stopped":case"terminated":return;case"connecting":case"ready":this.socket={...this.socket,paused:"yes"};return;default:this.socket;return}}tryReconnectImmediately(){if(this._logVerbose("tryReconnectImmediately called"),this.socket.state!=="disconnected"){this._logVerbose(`tryReconnectImmediately called but socket state is ${this.socket.state}, no action taken`);return}let e=null;if(this.scheduledReconnect){const t=Vi()-this.scheduledReconnect.scheduledAt;e=Math.max(0,this.scheduledReconnect.backoffMs-t),this._logVerbose(`would have waited ${Math.round(e)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(t)}ms)`),clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null,this._logVerbose("canceled scheduled reconnect")}this.logger.log("Network recovery detected, reconnecting immediately"),this.pendingNetworkRecoveryInfo=e!==null?{timeSavedMs:e}:null,this.connect()}resume(){switch(this.socket.state){case"connecting":this.socket={...this.socket,paused:"no"};return;case"ready":this.socket.paused==="uninitialized"?(this.socket={...this.socket,paused:"no"},this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Vi()})):this.socket.paused==="yes"&&(this.socket={...this.socket,paused:"no"},this.onResume());return;case"terminated":case"stopped":case"disconnected":return;default:this.socket}this.connect()}connectionState(){return{isConnected:this.socket.state==="ready",hasEverConnected:this._hasEverConnected,connectionCount:this.connectionCount,connectionRetries:this.retries}}_logVerbose(e){this.logger.logVerbose(e)}nextBackoff(e){const t=(e==="client"?100:e==="Unknown"?this.defaultInitialBackoff:j1[e].timeout)*Math.pow(2,this.retries);this.retries+=1;const n=Math.min(t,this.maxBackoff);return n+n*(Math.random()-.5)}reportLargeTransition({transition:e,messageLength:t}){if(e.clientClockSkew===void 0||e.serverTs===void 0)return;const n=Vi()-e.clientClockSkew-e.serverTs/1e6,r=`${Math.round(n)}ms`,i=`${Math.round(t/1e4)/100}MB`,s=t/(n/1e3),o=`${Math.round(s/1e4)/100}MB per second`;this._logVerbose(`received ${i} transition in ${r} at ${o}`),t>2e7?this.logger.log(`received query results totaling more that 20MB (${i}) which will take a long time to download on slower connections`):n>2e4&&this.logger.log(`received query results totaling ${i} which took more than 20s to arrive (${r})`),this.debug&&this.sendMessage({type:"Event",eventType:"ClientReceivedTransition",event:{transitionTransitTime:n,messageLength:t}})}};function hV(){return fV()}function fV(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var oo=class extends Error{};oo.prototype.name="InvalidTokenError";function dV(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let r=n.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function pV(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return dV(t)}catch{return atob(t)}}function B1(e,t){if(typeof e!="string")throw new oo("Invalid token specified: must be a string");t||(t={});const n=t.header===!0?0:1,r=e.split(".")[n];if(typeof r!="string")throw new oo(`Invalid token specified: missing part #${n+1}`);let i;try{i=pV(r)}catch(s){throw new oo(`Invalid token specified: invalid base64 for part #${n+1} (${s.message})`)}try{return JSON.parse(i)}catch(s){throw new oo(`Invalid token specified: invalid json for part #${n+1} (${s.message})`)}}var mV=Object.defineProperty,gV=(e,t,n)=>t in e?mV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vt=(e,t,n)=>gV(e,typeof t!="symbol"?t+"":t,n),vV=1728e6,z0=2,yV=class{constructor(e,t,n){vt(this,"authState",{state:"noAuth"}),vt(this,"configVersion",0),vt(this,"syncState"),vt(this,"authenticate"),vt(this,"stopSocket"),vt(this,"tryRestartSocket"),vt(this,"pauseSocket"),vt(this,"resumeSocket"),vt(this,"clearAuth"),vt(this,"logger"),vt(this,"refreshTokenLeewaySeconds"),vt(this,"initialAuthTokenReuse"),vt(this,"lastRefreshChange"),vt(this,"tokenConfirmationAttempts",0),this.syncState=e,this.authenticate=t.authenticate,this.stopSocket=t.stopSocket,this.tryRestartSocket=t.tryRestartSocket,this.pauseSocket=t.pauseSocket,this.resumeSocket=t.resumeSocket,this.clearAuth=t.clearAuth,this.logger=n.logger,this.refreshTokenLeewaySeconds=n.refreshTokenLeewaySeconds,this.initialAuthTokenReuse=n.initialAuthTokenReuse,this.lastRefreshChange=!1}notifyRefreshChange(e){this.authState.state!=="noAuth"&&this.authState.state!=="initialRefetch"&&this.authState.config.onRefreshChange&&this.lastRefreshChange!==e&&(this.lastRefreshChange=e,this.authState.config.onRefreshChange(e))}async setConfig(e,t,n){this.resetAuthState(),this._logVerbose("pausing WS for auth token fetch"),this.pauseSocket();const r=await this.fetchTokenAndGuardAgainstRace(e,{forceRefreshToken:!1});if(r.isFromOutdatedConfig)return;const i={fetchToken:e,onAuthChange:t,onRefreshChange:n};r.value?(this.setAuthState({state:"waitingForServerConfirmationOfCachedToken",config:i,hasRetried:!1}),this.authenticate(r.value)):(this.setAuthState({state:"initialRefetch",config:i}),await this.refetchToken()),this._logVerbose("resuming WS after auth token fetch"),this.resumeSocket()}onTransition(e){if(this.syncState.isCurrentOrNewerAuthVersion(e.endVersion.identity)&&!(e.endVersion.identity<=e.startVersion.identity)){if(this._logVerbose(`auth state is ${this.authState.state} when handling transition`),this.syncState.markAuthCompletion(),this.authState.state==="waitingForServerConfirmationOfCachedToken"){this._logVerbose("server confirmed auth token is valid");const t=this.syncState.getAuth()?.value;this.initialAuthTokenReuse&&t?this.scheduleTokenRefetch(t,e.clientClockSkew):this.refetchToken(),this.authState.config.onAuthChange(!0);return}this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this._logVerbose("server confirmed new auth token is valid"),this.notifyRefreshChange(!1),this.scheduleTokenRefetch(this.authState.token),this.tokenConfirmationAttempts=0,this.authState.hadAuth||this.authState.config.onAuthChange(!0))}}onAuthError(e){if(e.authUpdateAttempted===!1&&(this.authState.state==="waitingForServerConfirmationOfFreshToken"||this.authState.state==="waitingForServerConfirmationOfCachedToken")){this._logVerbose("ignoring non-auth token expired error");return}const{baseVersion:t}=e;if(!this.syncState.isCurrentOrNewerAuthVersion(t+1)){this._logVerbose("ignoring auth error for previous auth attempt");return}this.tryToReauthenticate(e)}async tryToReauthenticate(e){if(this._logVerbose(`attempting to reauthenticate: ${e.error}`),this.authState.state==="noAuth"||this.authState.state==="waitingForServerConfirmationOfFreshToken"&&this.tokenConfirmationAttempts>=z0){this.logger.error(`Failed to authenticate: "${e.error}", check your server auth config`),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.authState.state!=="noAuth"&&this.setAndReportAuthFailed(this.authState.config.onAuthChange);return}if(this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this.tokenConfirmationAttempts++,this._logVerbose(`retrying reauthentication, ${z0-this.tokenConfirmationAttempts} attempts remaining`)),this.notifyRefreshChange(!0),await this.stopSocket(),this.authState.state==="noAuth")return;const t=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});t.isFromOutdatedConfig||(t.value&&this.syncState.isNewAuth(t.value)?(this.authenticate(t.value),this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",config:this.authState.config,token:t.value,hadAuth:this.authState.state==="notRefetching"||this.authState.state==="waitingForScheduledRefetch"})):(this._logVerbose("reauthentication failed, could not fetch a new token"),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this.tryRestartSocket())}async refetchToken(){if(this.authState.state==="noAuth")return;this._logVerbose("refetching auth token");const e=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});e.isFromOutdatedConfig||(e.value?this.syncState.isNewAuth(e.value)?(this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",hadAuth:this.syncState.hasAuth(),token:e.value,config:this.authState.config}),this.authenticate(e.value)):this.setAuthState({state:"notRefetching",config:this.authState.config}):(this._logVerbose("refetching token failed"),this.syncState.hasAuth()&&this.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this._logVerbose("restarting WS after auth token fetch (if currently stopped)"),this.tryRestartSocket())}scheduleTokenRefetch(e,t){if(this.authState.state==="noAuth")return;const n=this.decodeToken(e);if(!n){this.logger.error("Auth token is not a valid JWT, cannot refetch the token");return}const{iat:r,exp:i}=n;if(!r||!i){this.logger.error("Auth token does not have required fields, cannot refetch the token");return}const s=i-r;if(s<=2){this.logger.error("Auth token does not live long enough, cannot refetch the token");return}let o;t!==void 0?(o=i-(Date.now()-t)/1e3,o<=0&&(o=0)):o=s;let a=Math.min(vV,(o-this.refreshTokenLeewaySeconds)*1e3);a<=0&&(this.logger.warn(`Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${o}s`),a=0);const l=setTimeout(()=>{this._logVerbose("running scheduled token refetch"),this.refetchToken()},a);this.setAuthState({state:"waitingForScheduledRefetch",refetchTokenTimeoutId:l,config:this.authState.config}),this._logVerbose(`scheduled preemptive auth token refetching in ${a}ms`)}async fetchTokenAndGuardAgainstRace(e,t){const n=++this.configVersion;this._logVerbose(`fetching token with config version ${n}`);const r=await e(t);return this.configVersion!==n?(this._logVerbose(`stale config version, expected ${n}, got ${this.configVersion}`),{isFromOutdatedConfig:!0}):{isFromOutdatedConfig:!1,value:r}}stop(){this.resetAuthState(),this.configVersion++,this._logVerbose(`config version bumped to ${this.configVersion}`)}setAndReportAuthFailed(e){e(!1),this.resetAuthState()}resetAuthState(){this.notifyRefreshChange(!1),this.setAuthState({state:"noAuth"})}setAuthState(e){const t=e.state==="waitingForServerConfirmationOfFreshToken"?{hadAuth:e.hadAuth,state:e.state,token:`...${e.token.slice(-7)}`}:{state:e.state};switch(this._logVerbose(`setting auth state to ${JSON.stringify(t)}`),e.state){case"waitingForScheduledRefetch":case"notRefetching":case"noAuth":this.tokenConfirmationAttempts=0}this.authState.state==="waitingForScheduledRefetch"&&clearTimeout(this.authState.refetchTokenTimeoutId),this.authState=e}decodeToken(e){try{return B1(e)}catch(t){return this._logVerbose(`Error decoding token: ${t instanceof Error?t.message:"Unknown error"}`),null}}_logVerbose(e){this.logger.logVerbose(`${e} [v${this.configVersion}]`)}},xV=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function bV(e,t){const n={sessionId:t};typeof performance>"u"||!performance.mark||performance.mark(e,{detail:n})}function wV(e){let t=e.name.slice(6);return t=t.charAt(0).toLowerCase()+t.slice(1),{name:t,startTime:e.startTime}}function SV(e){if(typeof performance>"u"||!performance.getEntriesByName)return[];const t=[];for(const n of xV){const r=performance.getEntriesByName(n).filter(i=>i.entryType==="mark").filter(i=>i.detail.sessionId===e);t.push(...r)}return t.map(wV)}var kV=Object.defineProperty,CV=(e,t,n)=>t in e?kV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fe=(e,t,n)=>CV(e,typeof t!="symbol"?t+"":t,n),AV=class{constructor(e,t,n){if(Fe(this,"address"),Fe(this,"state"),Fe(this,"requestManager"),Fe(this,"webSocketManager"),Fe(this,"authenticationManager"),Fe(this,"remoteQuerySet"),Fe(this,"optimisticQueryResults"),Fe(this,"_transitionHandlerCounter",0),Fe(this,"_nextRequestId"),Fe(this,"_onTransitionFns",new Map),Fe(this,"_sessionId"),Fe(this,"firstMessageReceived",!1),Fe(this,"debug"),Fe(this,"logger"),Fe(this,"maxObservedTimestamp"),Fe(this,"connectionStateSubscribers",new Map),Fe(this,"nextConnectionStateSubscriberId",0),Fe(this,"_lastPublishedConnectionState"),Fe(this,"markConnectionStateDirty",()=>{Promise.resolve().then(()=>{const f=this.connectionState();if(JSON.stringify(f)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=f;for(const d of this.connectionStateSubscribers.values())d(f)}})}),Fe(this,"mark",f=>{this.debug&&bV(f,this.sessionId)}),typeof e=="object")throw new Error("Passing a ClientConfig object is no longer supported. Pass the URL of the Convex deployment as a string directly.");n?.skipConvexDeploymentUrlCheck!==!0&&XE(e),n={...n};const r=n.authRefreshTokenLeewaySeconds??10;let i=n.webSocketConstructor;if(!i&&typeof WebSocket>"u")throw new Error("No WebSocket global variable defined! To use Convex in an environment without WebSocket try the HTTP client: https://docs.convex.dev/api/classes/browser.ConvexHttpClient");i=i||WebSocket,this.debug=n.reportDebugInfoToConvex??!1,this.address=e,this.logger=n.logger===!1?_1({verbose:n.verbose??!1}):n.logger!==!0&&n.logger?n.logger:L1({verbose:n.verbose??!1});const s=e.search("://");if(s===-1)throw new Error("Provided address was not an absolute URL.");const o=e.substring(s+3),a=e.substring(0,s);let l;if(a==="http")l="ws";else if(a==="https")l="wss";else throw new Error(`Unknown parent protocol ${a}`);const c=`${l}://${o}/api/${O0}/sync`;this.state=new $F,this.remoteQuerySet=new B0(f=>this.state.queryPath(f),this.logger),this.requestManager=new UF(this.logger,this.markConnectionStateDirty);const u=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new yV(this.state,{authenticate:f=>{const d=this.state.setAuth(f);return this.webSocketManager.sendMessage(d),d.baseVersion},stopSocket:()=>this.webSocketManager.stop(),tryRestartSocket:()=>this.webSocketManager.tryRestart(),pauseSocket:u,resumeSocket:()=>this.webSocketManager.resume(),clearAuth:()=>{this.clearAuth()}},{logger:this.logger,refreshTokenLeewaySeconds:r,initialAuthTokenReuse:n.initialAuthTokenReuse??!1}),this.optimisticQueryResults=new GF,this.addOnTransitionHandler(f=>{t(f.queries.map(d=>d.token))}),this._nextRequestId=0,this._sessionId=hV();const{unsavedChangesWarning:h}=n;if(typeof window>"u"||typeof window.addEventListener>"u"){if(h===!0)throw new Error("unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.")}else h!==!1&&window.addEventListener("beforeunload",f=>{if(this.requestManager.hasIncompleteRequests()){f.preventDefault();const d="Are you sure you want to leave? Your changes may not be saved.";return(f||window.event).returnValue=d,d}});this.webSocketManager=new uV(c,{onOpen:f=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({...f,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp}),this.remoteQuerySet=new B0(v=>this.state.queryPath(v),this.logger);const[d,m]=this.state.restart();m&&this.webSocketManager.sendMessage(m),this.webSocketManager.sendMessage(d);for(const v of this.requestManager.restart())this.webSocketManager.sendMessage(v)},onResume:()=>{const[f,d]=this.state.resume();d&&this.webSocketManager.sendMessage(d),f&&this.webSocketManager.sendMessage(f);for(const m of this.requestManager.resume())this.webSocketManager.sendMessage(m)},onMessage:f=>{switch(this.firstMessageReceived||(this.firstMessageReceived=!0,this.mark("convexFirstMessageReceived"),this.reportMarks()),f.type){case"Transition":{this.observedTimestamp(f.endVersion.ts),this.authenticationManager.onTransition(f),this.remoteQuerySet.transition(f),this.state.transition(f);const d=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(d);break}case"MutationResponse":{f.success&&this.observedTimestamp(f.ts);const d=this.requestManager.onResponse(f);d!==null&&this.notifyOnQueryResultChanges(new Map([[d.requestId,d.result]]));break}case"ActionResponse":this.requestManager.onResponse(f);break;case"AuthError":this.authenticationManager.onAuthError(f);break;case"FatalError":{const d=FF(this.logger,f.error);throw this.webSocketManager.terminate(),d}}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:n.onServerDisconnectError},i,this.logger,this.markConnectionStateDirty,this.debug),this.mark("convexClientConstructed"),n.expectAuth&&u()}hasSyncedPastLastReconnect(){return this.requestManager.hasSyncedPastLastReconnect()&&this.state.hasSyncedPastLastReconnect()}observedTimestamp(e){(this.maxObservedTimestamp===void 0||this.maxObservedTimestamp.lessThanOrEqual(e))&&(this.maxObservedTimestamp=e)}getMaxObservedTimestamp(){return this.maxObservedTimestamp}notifyOnQueryResultChanges(e){const t=this.remoteQuerySet.remoteQueryResults(),n=new Map;for(const[i,s]of t){const o=this.state.queryToken(i);if(o!==null){const a={result:s,udfPath:this.state.queryPath(i),args:this.state.queryArgs(i)};n.set(o,a)}}const r=this.optimisticQueryResults.ingestQueryResultsFromServer(n,new Set(e.keys()));this.handleTransition({queries:r.map(i=>({token:i,modification:{kind:"Updated",result:this.optimisticQueryResults.rawQueryResult(i)}})),reflectedMutations:Array.from(e).map(([i,s])=>({requestId:i,result:s})),timestamp:this.remoteQuerySet.timestamp()})}handleTransition(e){for(const t of this._onTransitionFns.values())t(e)}addOnTransitionHandler(e){const t=this._transitionHandlerCounter++;return this._onTransitionFns.set(t,e),()=>this._onTransitionFns.delete(t)}getCurrentAuthClaims(){const e=this.state.getAuth();let t={};if(e&&e.tokenType==="User")try{t=e?B1(e.value):{}}catch{t={}}else return;return{token:e.value,decoded:t}}setAuth(e,t,n){this.authenticationManager.setConfig(e,t,n)}hasAuth(){return this.state.hasAuth()}setAdminAuth(e,t){const n=this.state.setAdminAuth(e,t);this.webSocketManager.sendMessage(n)}clearAuth(){const e=this.state.clearAuth();this.webSocketManager.sendMessage(e)}subscribe(e,t,n){const r=Wn(t),{modification:i,queryToken:s,unsubscribe:o}=this.state.subscribe(e,r,n?.journal,n?.componentPath);return i!==null&&this.webSocketManager.sendMessage(i),{queryToken:s,unsubscribe:()=>{const a=o();a&&this.webSocketManager.sendMessage(a)}}}localQueryResult(e,t){const n=Wn(t),r=li(e,n);return this.optimisticQueryResults.queryResult(r)}localQueryResultByToken(e){return this.optimisticQueryResults.queryResult(e)}hasLocalQueryResultByToken(e){return this.optimisticQueryResults.hasQueryResult(e)}localQueryLogs(e,t){const n=Wn(t),r=li(e,n);return this.optimisticQueryResults.queryLogs(r)}queryJournal(e,t){const n=Wn(t),r=li(e,n);return this.state.queryJournal(r)}connectionState(){const e=this.webSocketManager.connectionState();return{hasInflightRequests:this.requestManager.hasInflightRequests(),isWebSocketConnected:e.isConnected,hasEverConnected:e.hasEverConnected,connectionCount:e.connectionCount,connectionRetries:e.connectionRetries,timeOfOldestInflightRequest:this.requestManager.timeOfOldestInflightRequest(),inflightMutations:this.requestManager.inflightMutations(),inflightActions:this.requestManager.inflightActions()}}subscribeToConnectionState(e){const t=this.nextConnectionStateSubscriberId++;return this.connectionStateSubscribers.set(t,e),()=>{this.connectionStateSubscribers.delete(t)}}async mutation(e,t,n){const r=await this.mutationInternal(e,t,n);if(!r.success)throw r.errorData!==void 0?rd(r,new cf(Gi("mutation",e,r))):new Error(Gi("mutation",e,r));return r.value}async mutationInternal(e,t,n,r){const{mutationPromise:i}=this.enqueueMutation(e,t,n,r);return i}enqueueMutation(e,t,n,r){const i=Wn(t);this.tryReportLongDisconnect();const s=this.nextRequestId;if(this._nextRequestId++,n!==void 0){const l=n.optimisticUpdate;if(l!==void 0){const c=h=>{l(h,i)instanceof Promise&&this.logger.warn("Optimistic update handler returned a Promise. Optimistic updates should be synchronous.")},u=this.optimisticQueryResults.applyOptimisticUpdate(c,s).map(h=>{const f=this.localQueryResultByToken(h);return{token:h,modification:{kind:"Updated",result:f===void 0?void 0:{success:!0,value:f,logLines:[]}}}});this.handleTransition({queries:u,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}const o={type:"Mutation",requestId:s,udfPath:e,componentPath:r,args:[In(i)]},a=this.webSocketManager.sendMessage(o);return{requestId:s,mutationPromise:this.requestManager.request(o,a)}}async action(e,t){const n=await this.actionInternal(e,t);if(!n.success)throw n.errorData!==void 0?rd(n,new cf(Gi("action",e,n))):new Error(Gi("action",e,n));return n.value}async actionInternal(e,t,n){const r=Wn(t),i=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const s={type:"Action",requestId:i,udfPath:e,componentPath:n,args:[In(r)]},o=this.webSocketManager.sendMessage(s);return this.requestManager.request(s,o)}async close(){return this.authenticationManager.stop(),this.webSocketManager.terminate()}get url(){return this.address}get nextRequestId(){return this._nextRequestId}get sessionId(){return this._sessionId}reportMarks(){if(this.debug){const e=SV(this.sessionId);this.webSocketManager.sendMessage({type:"Event",eventType:"ClientConnect",event:e})}}tryReportLongDisconnect(){if(!this.debug)return;const e=this.connectionState().timeOfOldestInflightRequest;if(e===null||Date.now()-e.getTime()<=6e4)return;const t=`${this.address}/api/debug_event`;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","Convex-Client":`npm-${O0}`},body:JSON.stringify({event:"LongWebsocketDisconnect"})}).then(n=>{n.ok||this.logger.warn("Analytics request failed with response:",n.body)}).catch(n=>{this.logger.warn("Analytics response failed with error:",n)})}};function xh(e){if(typeof e!="object"||e===null||!Array.isArray(e.page)||typeof e.isDone!="boolean"||typeof e.continueCursor!="string")throw new Error(`Not a valid paginated query result: ${e?.toString()}`);return e}var TV=Object.defineProperty,EV=(e,t,n)=>t in e?TV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$0=(e,t,n)=>EV(e,typeof t!="symbol"?t+"":t,n),MV=class{constructor(e,t){this.client=e,this.onTransition=t,$0(this,"paginatedQuerySet",new Map),$0(this,"lastTransitionTs"),this.lastTransitionTs=Ea.fromNumber(0),this.client.addOnTransitionHandler(n=>this.onBaseTransition(n))}subscribe(e,t,n){const r=yi(e),i=N0(r,t,n),s=()=>this.removePaginatedQuerySubscriber(i),o=this.paginatedQuerySet.get(i);return o?(o.numSubscribers+=1,{paginatedQueryToken:i,unsubscribe:s}):(this.paginatedQuerySet.set(i,{token:i,canonicalizedUdfPath:r,args:t,numSubscribers:1,options:{initialNumItems:n.initialNumItems},nextPageKey:0,pageKeys:[],pageKeyToQuery:new Map,ongoingSplits:new Map,skip:!1,id:n.id}),this.addPageToPaginatedQuery(i,null,n.initialNumItems),{paginatedQueryToken:i,unsubscribe:s})}localQueryResult(e,t,n){const r=yi(e),i=N0(r,t,n);return this.localQueryResultByToken(i)}localQueryResultByToken(e){const t=this.paginatedQuerySet.get(e);if(!t)return;const n=this.activePageQueryTokens(t);if(n.length===0)return{results:[],status:"LoadingFirstPage",loadMore:a=>this.loadMoreOfPaginatedQuery(e,a)};let r=[],i=!1,s=!1;for(const a of n){const l=this.client.localQueryResultByToken(a);if(l===void 0){i=!0,s=!1;continue}const c=xh(l);r=r.concat(c.page),s=!!c.isDone}let o;return i?o=r.length===0?"LoadingFirstPage":"LoadingMore":s?o="Exhausted":o="CanLoadMore",{results:r,status:o,loadMore:a=>this.loadMoreOfPaginatedQuery(e,a)}}onBaseTransition(e){const t=e.queries.map(s=>s.token),n=this.queriesContainingTokens(t);let r=[];n.length>0&&(this.processPaginatedQuerySplits(n,s=>this.client.localQueryResultByToken(s)),r=n.map(s=>({token:s,modification:{kind:"Updated",result:this.localQueryResultByToken(s)}})));const i={...e,paginatedQueries:r};this.onTransition(i)}loadMoreOfPaginatedQuery(e,t){this.mustGetPaginatedQuery(e);const n=this.queryTokenForLastPageOfPaginatedQuery(e),r=this.client.localQueryResultByToken(n);if(!r)return!1;const i=xh(r);if(i.isDone)return!1;this.addPageToPaginatedQuery(e,i.continueCursor,t);const s={timestamp:this.lastTransitionTs,reflectedMutations:[],queries:[],paginatedQueries:[{token:e,modification:{kind:"Updated",result:this.localQueryResultByToken(e)}}]};return this.onTransition(s),!0}queriesContainingTokens(e){if(e.length===0)return[];const t=[],n=new Set(e);for(const[r,i]of this.paginatedQuerySet)for(const s of this.allQueryTokens(i))if(n.has(s)){t.push(r);break}return t}processPaginatedQuerySplits(e,t){for(const n of e){const r=this.mustGetPaginatedQuery(n),{ongoingSplits:i,pageKeyToQuery:s,pageKeys:o}=r;for(const[a,[l,c]]of i)t(s.get(l).queryToken)!==void 0&&t(s.get(c).queryToken)!==void 0&&this.completePaginatedQuerySplit(r,a,l,c);for(const a of o){if(i.has(a))continue;const l=s.get(a);if(!l)throw new Error(`No page query for active pageKey ${a}`);const c=t(l.queryToken);if(!c)continue;const u=xh(c);u.splitCursor&&(u.pageStatus==="SplitRecommended"||u.pageStatus==="SplitRequired"||u.page.length>r.options.initialNumItems*2)&&this.splitPaginatedQueryPage(r,a,l.cursor,u.splitCursor,u.continueCursor)}}}splitPaginatedQueryPage(e,t,n,r,i){const s=e.nextPageKey++,o=e.nextPageKey++,a={numItems:e.options.initialNumItems,id:e.id},l=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...a,cursor:n,endCursor:r}});e.pageKeyToQuery.set(s,{...l,cursor:n});const c=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...a,cursor:r,endCursor:i}});e.pageKeyToQuery.set(o,{...c,cursor:r}),e.ongoingSplits.set(t,[s,o])}addPageToPaginatedQuery(e,t,n){const r=this.mustGetPaginatedQuery(e),i=r.nextPageKey++,s={cursor:t,numItems:n,id:r.id},o={...r.args,paginationOpts:s},a=this.client.subscribe(r.canonicalizedUdfPath,o);return r.pageKeys.push(i),r.pageKeyToQuery.set(i,{...a,cursor:t}),a}removePaginatedQuerySubscriber(e){const t=this.paginatedQuerySet.get(e);if(t&&(t.numSubscribers-=1,!(t.numSubscribers>0))){for(const n of t.pageKeyToQuery.values())n.unsubscribe();this.paginatedQuerySet.delete(e)}}completePaginatedQuerySplit(e,t,n,r){const i=e.pageKeyToQuery.get(t);e.pageKeyToQuery.delete(t);const s=e.pageKeys.indexOf(t);e.pageKeys.splice(s,1,n,r),e.ongoingSplits.delete(t),i.unsubscribe()}activePageQueryTokens(e){return e.pageKeys.map(t=>e.pageKeyToQuery.get(t).queryToken)}allQueryTokens(e){return Array.from(e.pageKeyToQuery.values()).map(t=>t.queryToken)}queryTokenForLastPageOfPaginatedQuery(e){const t=this.mustGetPaginatedQuery(e),n=t.pageKeys[t.pageKeys.length-1];if(n===void 0)throw new Error(`No pages for paginated query ${e}`);return t.pageKeyToQuery.get(n).queryToken}mustGetPaginatedQuery(e){const t=this.paginatedQuerySet.get(e);if(!t)throw new Error("paginated query no longer exists for token "+e);return t}};function RV({getCurrentValue:e,subscribe:t}){const[n,r]=(0,g.useState)(()=>({getCurrentValue:e,subscribe:t,value:e()}));let i=n.value;return(n.getCurrentValue!==e||n.subscribe!==t)&&(i=e(),r({getCurrentValue:e,subscribe:t,value:i})),(0,g.useEffect)(()=>{let s=!1;const o=()=>{s||r(l=>{if(l.getCurrentValue!==e||l.subscribe!==t)return l;const c=e();return l.value===c?l:{...l,value:c}})},a=t(o);return o(),()=>{s=!0,a()}},[e,t]),i}var PV=Object.defineProperty,IV=(e,t,n)=>t in e?PV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bn=(e,t,n)=>IV(e,typeof t!="symbol"?t+"":t,n),OV=5e3;if(typeof g.default>"u")throw new Error("Required dependency 'react' not found");function F1(e,t,n){function r(i){return LV(i),t.mutation(e,i,{optimisticUpdate:n})}return r.withOptimisticUpdate=function(s){if(n!==void 0)throw new Error(`Already specified optimistic update for mutation ${pt(e)}`);return F1(e,t,s)},r}function DV(e,t){return function(n){return t.action(e,n)}}var v8=class{constructor(e,t){if(Bn(this,"address"),Bn(this,"cachedSync"),Bn(this,"cachedPaginatedQueryClient"),Bn(this,"listeners"),Bn(this,"options"),Bn(this,"closed",!1),Bn(this,"_logger"),Bn(this,"adminAuth"),Bn(this,"fakeUserIdentity"),e===void 0)throw new Error("No address provided to ConvexReactClient.\nIf trying to deploy to production, make sure to follow all the instructions found at https://docs.convex.dev/production/hosting/\nIf running locally, make sure to run `convex dev` and ensure the .env.local file is populated.");if(typeof e!="string")throw new Error(`ConvexReactClient requires a URL like 'https://happy-otter-123.convex.cloud', received something of type ${typeof e} instead.`);if(!e.includes("://"))throw new Error("Provided address was not an absolute URL.");this.address=e,this.listeners=new Map,this._logger=t?.logger===!1?_1({verbose:t?.verbose??!1}):t?.logger!==!0&&t?.logger?t.logger:L1({verbose:t?.verbose??!1}),this.options={...t,logger:this._logger}}get url(){return this.address}get sync(){if(this.closed)throw new Error("ConvexReactClient has already been closed.");return this.cachedSync?this.cachedSync:(this.cachedSync=this.options.baseClient??new AV(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new MV(this.cachedSync,e=>this.handleTransition(e)),this.cachedSync)}get paginatedQueryClient(){if(this.sync,this.cachedPaginatedQueryClient)return this.cachedPaginatedQueryClient;throw new Error("Should already be instantiated")}setAuth(e,t,n){if(typeof e=="string")throw new Error("Passing a string to ConvexReactClient.setAuth is no longer supported, please upgrade to passing in an async function to handle reauthentication.");this.sync.setAuth(e,t??(()=>{}),n)}clearAuth(){this.sync.clearAuth()}setAdminAuth(e,t){if(this.adminAuth=e,this.fakeUserIdentity=t,this.closed)throw new Error("ConvexReactClient has already been closed.");this.cachedSync&&this.sync.setAdminAuth(e,t)}watchQuery(e,...t){const[n,r]=t,i=pt(e);return{onUpdate:s=>{const{queryToken:o,unsubscribe:a}=this.sync.subscribe(i,n,r),l=this.listeners.get(o);return l!==void 0?l.add(s):this.listeners.set(o,new Set([s])),()=>{if(this.closed)return;const c=this.listeners.get(o);c.delete(s),c.size===0&&this.listeners.delete(o),a()}},localQueryResult:()=>{if(this.cachedSync)return this.cachedSync.localQueryResult(i,n)},localQueryLogs:()=>{if(this.cachedSync)return this.cachedSync.localQueryLogs(i,n)},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(i,n)}}}prewarmQuery(e){const t=e.extendSubscriptionFor??OV,n=this.watchQuery(e.query,e.args||{}).onUpdate(()=>{});setTimeout(n,t)}watchPaginatedQuery(e,t,n){const r=pt(e);return{onUpdate:i=>{const{paginatedQueryToken:s,unsubscribe:o}=this.paginatedQueryClient.subscribe(r,t||{},n),a=this.listeners.get(s);return a!==void 0?a.add(i):this.listeners.set(s,new Set([i])),()=>{if(this.closed)return;const l=this.listeners.get(s);l.delete(i),l.size===0&&this.listeners.delete(s),o()}},localQueryResult:()=>this.paginatedQueryClient.localQueryResult(r,t,n)}}mutation(e,...t){const[n,r]=t,i=pt(e);return this.sync.mutation(i,n,r)}action(e,...t){const n=pt(e);return this.sync.action(n,...t)}query(e,...t){const n=this.watchQuery(e,...t),r=n.localQueryResult();return r!==void 0?Promise.resolve(r):new Promise((i,s)=>{const o=n.onUpdate(()=>{o();try{i(n.localQueryResult())}catch(a){s(a)}})})}connectionState(){return this.sync.connectionState()}subscribeToConnectionState(e){return this.sync.subscribeToConnectionState(e)}get logger(){return this._logger}async close(){if(this.closed=!0,this.listeners=new Map,this.cachedPaginatedQueryClient&&(this.cachedPaginatedQueryClient=void 0),this.cachedSync){const e=this.cachedSync;this.cachedSync=void 0,await e.close()}}handleTransition(e){const t=e.queries.map(r=>r.token),n=e.paginatedQueries.map(r=>r.token);this.transition([...t,...n])}transition(e){for(const t of e){const n=this.listeners.get(t);if(n)for(const r of n)r()}}},mu=g.createContext(void 0);function NV(){return(0,g.useContext)(mu)}var y8=({client:e,children:t})=>g.createElement(mu.Provider,{value:e},t);function V1(e,...t){const n=t[0]==="skip",r=t[0]==="skip"?{}:Wn(t[0]),i=typeof e=="string"?pu(e):e,s=pt(i),o=(0,g.useMemo)(()=>n?{}:{query:{query:i,args:r}},[JSON.stringify(In(r)),s,n]),a=FV(o).query;if(a instanceof Error)throw a;return a}function x8(e){const t=typeof e=="string"?pu(e):e,n=(0,g.useContext)(mu);if(n===void 0)throw new Error("Could not find Convex client! `useMutation` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return(0,g.useMemo)(()=>F1(t,n),[n,pt(t)])}function b8(e){const t=(0,g.useContext)(mu),n=typeof e=="string"?pu(e):e;if(t===void 0)throw new Error("Could not find Convex client! `useAction` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return(0,g.useMemo)(()=>DV(n,t),[t,pt(n)])}function LV(e){if(typeof e=="object"&&e!==null&&"bubbles"in e&&"persist"in e&&"isDefaultPrevented"in e)throw new Error("Convex function called with SyntheticEvent object. Did you use a Convex function as an event handler directly? Event handlers like onClick receive an event object as their first argument. These SyntheticEvent objects are not valid Convex values. Try wrapping the function like `const handler = () => myMutation();` and using `handler` in the event handler.")}var _V=Object.defineProperty,jV=(e,t,n)=>t in e?_V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bh=(e,t,n)=>jV(e,typeof t!="symbol"?t+"":t,n),BV=class{constructor(e){bh(this,"createWatch"),bh(this,"queries"),bh(this,"listeners"),this.createWatch=e,this.queries={},this.listeners=new Set}setQueries(e){for(const t of Object.keys(e)){const{query:n,args:r,paginationOptions:i}=e[t];if(pt(n),this.queries[t]===void 0)this.addQuery(t,n,r,i?{paginationOptions:i}:{});else{const s=this.queries[t];(pt(n)!==pt(s.query)||JSON.stringify(In(r))!==JSON.stringify(In(s.args))||JSON.stringify(i)!==JSON.stringify(s.paginationOptions))&&(this.removeQuery(t),this.addQuery(t,n,r,i?{paginationOptions:i}:{}))}}for(const t of Object.keys(this.queries))e[t]===void 0&&this.removeQuery(t)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getLocalResults(e){const t={};for(const n of Object.keys(e)){const{query:r,args:i}=e[n],s=e[n].paginationOptions;pt(r);const o=this.createWatch(r,i,s?{paginationOptions:s}:{});let a;try{a=o.localQueryResult()}catch(l){if(l instanceof Error)a=l;else throw l}t[n]=a}return t}setCreateWatch(e){this.createWatch=e;for(const t of Object.keys(this.queries)){const{query:n,args:r,watch:i,paginationOptions:s}=this.queries[t],o="journal"in i?i.journal():void 0;this.removeQuery(t),this.addQuery(t,n,r,{...o?{journal:o}:[],...s?{paginationOptions:s}:{}})}}destroy(){for(const e of Object.keys(this.queries))this.removeQuery(e);this.listeners=new Set}addQuery(e,t,n,{paginationOptions:r,journal:i}){if(this.queries[e]!==void 0)throw new Error(`Tried to add a new query with identifier ${e} when it already exists.`);const s=this.createWatch(t,n,{...i?{journal:i}:[],...r?{paginationOptions:r}:{}}),o=s.onUpdate(()=>this.notifyListeners());this.queries[e]={query:t,args:n,watch:s,unsubscribe:o,...r?{paginationOptions:r}:{}}}removeQuery(e){const t=this.queries[e];if(t===void 0)throw new Error(`No query found with identifier ${e}.`);t.unsubscribe(),delete this.queries[e]}notifyListeners(){for(const e of this.listeners)e()}};function FV(e){const t=NV();if(t===void 0)throw new Error("Could not find Convex client! `useQuery` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return VV(e,(0,g.useMemo)(()=>(n,r,{journal:i,paginationOptions:s})=>s?t.watchPaginatedQuery(n,r,s):t.watchQuery(n,r,i?{journal:i}:{}),[t]))}function VV(e,t){const[n]=(0,g.useState)(()=>new BV(t));n.createWatch!==t&&n.setCreateWatch(t),(0,g.useEffect)(()=>()=>n.destroy(),[n]);const r=(0,g.useMemo)(()=>({getCurrentValue:()=>n.getLocalResults(e),subscribe:i=>(n.setQueries(e),n.subscribe(i))}),[n,e]);return RV(r)}var Sc=class extends g.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.isExpected(e)?console.debug("ErrorBoundary caught an expected error:",e):(console.error("ErrorBoundary caught an error:",e,t),oM(e,t,this.props.name)),this.props.onError?.(e,t)}isExpected(e){if(!this.props.isExpectedError)return!1;try{return this.props.isExpectedError(e)===!0}catch{return!1}}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback!==void 0?typeof this.props.fallback=="function"?this.props.fallback({error:this.state.error,reset:this.handleReset}):this.props.fallback:(0,p.jsx)("div",{className:"flex items-center justify-center min-h-[400px] p-6",children:(0,p.jsxs)("div",{className:"text-center max-w-md",children:[(0,p.jsx)(nu,{className:"h-12 w-12 text-destructive mx-auto mb-4"}),(0,p.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Something went wrong"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:this.state.error?.message||"An unexpected error occurred"}),(0,p.jsx)(Ot,{onClick:this.handleReset,variant:"outline",children:"Try again"})]})}):this.props.children}},zV=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();var $V=function(e,t,n){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})};var Ja,H0="__POSTHOG_REACT_SHARED_STATE__",W0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},Xo;try{Xo=W0[H0]=W0[H0]||new WeakMap}catch{Xo=new WeakMap}Xo.has(g.createContext)||Xo.set(g.createContext,{});var ci=Xo.get(g.createContext),sd;function HV(e){(!ci.defaultPostHogInstance||ci.defaultPostHogInstance===sd)&&(ci.defaultPostHogInstance=e),sd=e}function od(){return sd}ci.context||(ci.context=(0,g.createContext)({get client(){return od()||ci.defaultPostHogInstance},bootstrap:void 0}));var Ns=ci.context;function z1(e,t,n){if(n===void 0&&(n=new WeakMap),e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(n.has(e)&&n.get(e)===t)return!0;n.set(e,t);var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(var s=0,o=r;s<o.length;s++){var a=o[s];if(!i.includes(a)||!z1(e[a],t[a],n))return!1}return!0}function w8(e){var t,n,r=e.children,i=e.client,s=e.apiKey,o=e.options,a=(0,g.useRef)(null),l=(0,g.useMemo)(function(){if(i)return s&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),o&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),i;var c=od();return s||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),c},[i,s,JSON.stringify(o)]);return(0,g.useEffect)(function(){if(!(i||!s)){var c=od(),u=a.current;u?(s!==u.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),o&&!z1(o,u.options)&&c.set_config(o),a.current={apiKey:s,options:o??{}}):(c.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),c.init(s,o),a.current={apiKey:s,options:o??{}})}},[i,s,JSON.stringify(o)]),g.createElement(Ns.Provider,{value:{client:l,bootstrap:(t=o?.bootstrap)!==null&&t!==void 0?t:(n=i?.config)===null||n===void 0?void 0:n.bootstrap}},r)}var wh=function(e){return typeof e=="function"},ad=function(e){return e===void 0};function $1(e,t){var n,r,i=(0,g.useContext)(Ns),s=i.client,o=i.bootstrap,a=(0,g.useState)(function(){return s.isFeatureEnabled(e)}),l=a[0],c=a[1];(0,g.useEffect)(function(){return s.onFeatureFlags(function(){c(s.isFeatureEnabled(e))})},[s,e]);var u=(n=o?.featureFlags)===null||n===void 0?void 0:n[e];return!(!((r=s?.featureFlags)===null||r===void 0)&&r.hasLoadedFlags)&&o?.featureFlags?ad(u)?t:!!u:ad(l)?t:l}function S8(){var e,t=(0,g.useContext)(Ns),n=t.client,r=t.bootstrap,i=(0,g.useState)(function(){return n.featureFlags.getFlags()}),s=i[0],o=i[1];return(0,g.useEffect)(function(){return n.onFeatureFlags(function(a){o(a)})},[n]),!(!((e=n?.featureFlags)===null||e===void 0)&&e.hasLoadedFlags)&&r?.featureFlags?Object.entries(r.featureFlags).filter(function(a){return a[1]}).map(function(a){return a[0]}):s}function k8(e){var t,n=(0,g.useContext)(Ns),r=n.client,i=n.bootstrap,s=(0,g.useState)(function(){return r.getFeatureFlag(e)}),o=s[0],a=s[1];return(0,g.useEffect)(function(){return r.onFeatureFlags(function(){a(r.getFeatureFlag(e))})},[r,e]),!(!((t=r?.featureFlags)===null||t===void 0)&&t.hasLoadedFlags)&&i?.featureFlags?i.featureFlags[e]:o}var C8=function(){return(0,g.useContext)(Ns).client},jl=function(e){var t=Object.prototype.toString.call(e);return e instanceof Error||t==="[object Error]"||t==="[object Exception]"||t==="[object DOMException]"||t==="[object DOMError]"},WV=function(e,t){try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch{}},UV=function(e,t){for(var n=new WeakSet,r=e;!n.has(r);){if(n.add(r),!jl(r.cause)){ad(r.cause)||(t.cause=r.cause),r.cause=t;return}r=r.cause}},qV=function(e,t){if(!t)return e;var n=new Error(jl(e)?e.message:"Primitive value captured as exception: ".concat(String(e)));return WV(n,"React ErrorBoundary ".concat(jl(e)?e.name:"Error")),n.stack=t,jl(e)?(UV(e,n),e):n},U0={componentStack:null,exceptionEvent:null,error:null},KV={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."},A8=(Ja=(function(e){zV(t,e);function t(n){var r=e.call(this,n)||this;return r._resetError=function(){r.setState(U0)},r.state=U0,r}return t.prototype.componentDidCatch=function(n,r){var i=this.props.additionalProperties,s;wh(i)?s=i(n,r):typeof i=="object"&&(s=i);var o=this.context.client,a=r.componentStack,l=o.captureException(qV(n,a),s);this.setState({error:n,componentStack:a??null,exceptionEvent:l})},t.prototype.render=function(){var n=this.props,r=n.children,i=n.fallback,s=this.state;if(s.componentStack==null)return wh(r)?r():r;var o=wh(i)?g.createElement(i,{error:s.error,componentStack:s.componentStack,exceptionEvent:s.exceptionEvent,resetError:this._resetError}):i;return g.isValidElement(o)?o:(console.warn(KV.INVALID_FALLBACK),g.createElement(g.Fragment,null))},t})(g.Component),$V(Ja,"PostHogErrorBoundary"),(function(){Ja.contextType=Ns})(),Ja);HV(Zx);function Vm({...e}){return(0,p.jsx)(UO,{"data-slot":"dropdown-menu",...e})}function zm({...e}){return(0,p.jsx)(qO,{"data-slot":"dropdown-menu-trigger",...e})}function $m({className:e,sideOffset:t=4,...n}){return(0,p.jsx)(KO,{children:(0,p.jsx)(GO,{"data-slot":"dropdown-menu-content",sideOffset:t,className:G("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function Bl({className:e,inset:t,variant:n="default",...r}){return(0,p.jsx)(YO,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:G("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function T8({className:e,children:t,checked:n,...r}){return(0,p.jsxs)(XO,{"data-slot":"dropdown-menu-checkbox-item",className:G("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:n,...r,children:[(0,p.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,p.jsx)(Pw,{children:(0,p.jsx)(hs,{className:"size-4"})})}),t]})}function GV({...e}){return(0,p.jsx)(JO,{"data-slot":"dropdown-menu-radio-group",...e})}function QV({className:e,children:t,hideIndicator:n=!1,...r}){return(0,p.jsxs)(ZO,{"data-slot":"dropdown-menu-radio-item",className:G("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",n?"pl-2":"pl-8",e),...r,children:[n?null:(0,p.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,p.jsx)(Pw,{children:(0,p.jsx)(lM,{className:"size-2 fill-current"})})}),t]})}function YV({className:e,inset:t,...n}){return(0,p.jsx)(QO,{"data-slot":"dropdown-menu-label","data-inset":t,className:G("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function E8({className:e,...t}){return(0,p.jsx)(eD,{"data-slot":"dropdown-menu-separator",className:G("bg-border -mx-1 my-1 h-px",e),...t})}function M8({...e}){return(0,p.jsx)(tD,{"data-slot":"dropdown-menu-sub",...e})}function R8({className:e,inset:t,children:n,...r}){return(0,p.jsxs)(nD,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:G("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",e),...r,children:[n,(0,p.jsx)(fs,{className:"ml-auto size-4"})]})}function P8({className:e,...t}){return(0,p.jsx)(rD,{"data-slot":"dropdown-menu-sub-content",className:G("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}var XV=8192,JV=8192,Sh=64,ZV=new Set(["_truncated","bytes","limitBytes","reason","head"]);function Cr(e,t){let n=0,r=0;for(let i=0;i<e.length&&!(n>t);i++){const s=e.charCodeAt(i);if(s<128){n+=1,s===34||s===92?r+=1:s<32&&(r+=s===8||s===9||s===10||s===12||s===13?1:5);continue}if(s<2048){n+=2;continue}if(s>=55296&&s<=56319){const o=e.charCodeAt(i+1);if(o>=56320&&o<=57343){n+=4,i++;continue}}if(s>=55296&&s<=57343){n+=3,r+=3;continue}n+=3}return{utf8:n,json:n+r+2}}function ez(e){const t=e.charCodeAt(8191);return e.slice(0,t>=55296&&t<=56319?8191:JV)}var tz=8,H1=5e4;function W1(e,t){let n=0,r=0;const i=[e];for(;i.length>0;){if(n>t)return{bytes:n,exceeded:!0};if(++r>H1)return{bytes:n,exceeded:!0};const s=i.pop();if(typeof s=="string"){n+=Cr(s,t-n).json;continue}if(s===null||typeof s!="object"){n+=5;continue}if(Array.isArray(s)){n+=2+s.length;for(const o of s){if(n>t)return{bytes:n,exceeded:!0};i.push(o)}continue}n+=2;for(const o in s)if(Object.hasOwn(s,o)){if(n+=Cr(o,t-n).json+2,n>t)return{bytes:n,exceeded:!0};i.push(s[o])}}return{bytes:n,exceeded:n>t}}function nz(e,t){const n={_truncated:!0,limitBytes:t};if(typeof e!="object"||e===null||Array.isArray(e))return n;let r=0,i=0;const s=new Set,o=h=>h===void 0?{_truncated:!0}:{_truncated:!0,bytes:h},a=(h,f)=>{if(++i>H1)return o();if(typeof h=="string"){const m=Cr(h,t-r);if(h.length<=XV&&r+m.json<=t)return r+=m.json,h;const v=Cr(h,Number.POSITIVE_INFINITY).utf8,y=ez(h);if(y.length<h.length){const x=Cr(y,Number.POSITIVE_INFINITY).json;if(r+x+Sh<=t)return r+=x+Sh,{_truncated:!0,bytes:v,head:y}}return r+=Sh,o(v)}if(h===null||typeof h!="object")return r+=5,h;if(f>=tz||s.has(h))return o();if(s.add(h),Array.isArray(h)){r+=2;const m=[];for(const v of h){if(r+=1,r>t)return s.delete(h),o();m.push(a(v,f+1))}return s.delete(h),m}r+=2;const d={};for(const m in h)if(Object.hasOwn(h,m)){if(r+=Cr(m,t-r).json+2,r>t)return s.delete(h),o();d[m]=a(h[m],f+1)}return s.delete(h),d},l=a(e,0),c={};if(!rz(l)&&typeof l=="object"&&l!==null)for(const[h,f]of Object.entries(l))ZV.has(h)||(c[h]=f);const u={...c,...n};return W1(u,t).exceeded?n:u}function rz(e){return typeof e=="object"&&e!==null&&e._truncated===!0}function kh(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function I8(e){if(e.reason)return`Payload not recorded: ${e.reason}.`;const t=typeof e.limitBytes=="number"?`over the ${kh(e.limitBytes)} log limit`:"over the log size limit",n=typeof e.bytes=="number"?` It was ${kh(e.bytes)}.`:"";return typeof e.head=="string"?`Payload truncated — ${t}.${n} Showing the first ${kh(Cr(e.head,Number.POSITIVE_INFINITY).utf8)}.`:`Payload not recorded — ${t}.${n}`}function U1(e){try{return new URL(e).pathname}catch{return e}}function iz(e){return typeof e=="string"&&e.startsWith("Automatic resolved to ")}var ld=1e3,Ch=1048576,q1=8388608,K1=new WeakMap;function sz(e){const t=e.length>ld?e.slice(0,ld):e;let n=0;for(let r=0;r<t.length;r++)if(n+=K1.get(t[r])??0,n>q1&&r>0)return t.slice(0,r);return t}var ys=nM(e=>({items:[],mcpServerItems:[],addLog:t=>{const n={...t,id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,timestamp:new Date().toISOString()};e(r=>({items:[n,...r.items].slice(0,ld)}))},addMcpServerLog:t=>{const n={...t,id:t.id??`${t.timestamp}-${Math.random().toString(36).slice(2)}`};K1.set(n,W1(n.payload,q1).bytes),e(r=>({mcpServerItems:sz(r.mcpServerItems.some(i=>i.id===n.id)?r.mcpServerItems.map(i=>i.id===n.id?n:i):[n,...r.mcpServerItems])}))},clear:()=>e({items:[],mcpServerItems:[]})}));function G1(e){return typeof e.eventId=="string"&&e.eventId.length>0?e.eventId:void 0}function O8(e){if(!Array.isArray(e)||e.length===0)return;const t=ys.getState();e.forEach(n=>{const r=G1(n);t.addMcpServerLog({...r?{id:r}:{},serverId:n.serverId,serverName:n.serverName,direction:n.direction.toUpperCase(),method:eb(n.message),timestamp:n.timestamp,payload:n.message})})}function D8(e){if(!Array.isArray(e)||e.length===0)return;const t=ys.getState();e.forEach(n=>{const r=G1(n);t.addMcpServerLog({...r?{id:r}:{},serverId:n.serverId,serverName:n.serverName,direction:"HTTP",method:`${n.exchange.request.method} ${U1(n.exchange.request.url)}`,timestamp:n.timestamp,payload:n.exchange,kind:"http"})})}function N8(e){const{serverId:t,serverName:n,trace:r}=e;if(!r||!Array.isArray(r.steps)||r.steps.length===0)return;const i=ys.getState();r.steps.forEach(s=>{const o=new Date(s.completedAt??s.startedAt).toISOString();iz(s.message)&&i.addMcpServerLog({id:`oauth:${t}:${r.source}:automatic_resolution:${s.startedAt}`,serverId:t,serverName:n,direction:"OAUTH",method:"Automatic Resolution",timestamp:o,payload:{source:r.source,step:"automatic_resolution",title:"Automatic Resolution",status:s.status,message:s.message,details:s.details,relatedStep:s.step},kind:"oauth",oauthStatus:s.status,oauthSource:r.source,oauthRecovered:s.recovered===!0}),i.addMcpServerLog({id:`oauth:${t}:${r.source}:${s.step}:${s.startedAt}`,serverId:t,serverName:n,direction:"OAUTH",method:s.title,timestamp:o,payload:{source:r.source,step:s.step,title:s.title,status:s.status,message:s.message,error:s.error,details:s.details,recovered:s.recovered,recoveredAt:s.recoveredAt,recoveryMessage:s.recoveryMessage,httpHistory:r.httpHistory.filter(a=>a.step===s.step)},kind:"oauth",oauthStatus:s.status,oauthSource:r.source,oauthRecovered:s.recovered===!0})})}var Fn=null,Us=0;function L8(){if(Us++,!Fn){const e=new URLSearchParams;e.set("replay","3"),e.set("_t",Date.now().toString()),Fn=new EventSource(IF(`/api/mcp/servers/rpc/stream?${e.toString()}`)),Fn.onmessage=t=>{try{const n=JSON.parse(t.data);if(!n)return;const r=typeof n.eventId=="string"&&n.eventId.length>0?n.eventId:void 0;if(n.type==="http"){if(!n.exchange)return;const l=n.exchange;ys.getState().addMcpServerLog({...r?{id:r}:{},serverId:typeof n.serverId=="string"?n.serverId:"unknown",direction:"HTTP",method:`${l.request.method} ${U1(l.request.url)}`,timestamp:n.timestamp??new Date().toISOString(),payload:l,kind:"http"});return}if(n.type!=="rpc")return;const{serverId:i,direction:s,message:o,timestamp:a}=n;ys.getState().addMcpServerLog({...r?{id:r}:{},serverId:typeof i=="string"?i:"unknown",direction:typeof s=="string"?s.toUpperCase():"",method:eb(o),timestamp:a??new Date().toISOString(),payload:Cr(t.data,Ch).utf8>Ch?nz(o,Ch):o})}catch{}},Fn.onerror=()=>{Fn?.close(),Fn=null,Us=0}}return()=>{Us--,Us<=0&&Fn&&(Fn.close(),Fn=null,Us=0)}}var oz=uM("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-destructive-foreground [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",inverse:"border-transparent bg-popover text-popover-foreground"}},defaultVariants:{variant:"default"}});function kc({className:e,variant:t,asChild:n=!1,...r}){const i=n?pM:"span";return(0,p.jsx)(i,{"data-slot":"badge",className:G(oz({variant:t}),e),...r})}function az({delayDuration:e=0,...t}){return(0,p.jsx)(zD,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function mr({...e}){return(0,p.jsx)(az,{children:(0,p.jsx)($D,{"data-slot":"tooltip",...e})})}function gr({...e}){return(0,p.jsx)(HD,{"data-slot":"tooltip-trigger",...e})}var Q1="rounded-md px-3 py-1.5 text-xs",Y1="bg-primary text-primary-foreground",X1="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]",_8=`${Q1} ${Y1}`,lz=`${X1} bg-primary fill-primary`;function vr({className:e,sideOffset:t=0,children:n,variant:r="default",...i}){const s=r==="muted";return(0,p.jsx)(WD,{children:(0,p.jsxs)(UD,{"data-slot":"tooltip-content",sideOffset:t,className:G("animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin)",Q1,s?"border border-border bg-popover text-popover-foreground shadow-md":Y1,e),...i,children:[n,(0,p.jsx)(qD,{className:s?G(X1,"fill-popover"):lz})]})})}function j8({reason:e,fallback:t,children:n,...r}){const i=e||t;return i?(0,p.jsxs)(mr,{children:[(0,p.jsx)(gr,{asChild:!0,children:e?(0,p.jsx)("span",{className:"inline-flex rounded-md outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px]",tabIndex:0,children:n}):n}),(0,p.jsx)(vr,{...r,children:i})]}):n}function cz(e){try{ys.getState().addMcpServerLog({...e.dedupeKey?{id:`plugin-extensions:${e.dedupeKey}`}:{},serverId:e.serverId??"plugin-extensions",serverName:e.serverName??"Plugin extensions",direction:"RECEIVE",method:`plugin-extensions/${e.code}`,timestamp:new Date().toISOString(),payload:{level:e.level??"error",code:e.code,message:e.message,...e.detail??{}}})}catch{}}function q0(e){cz({code:`workspace/${e.label}`,message:e.message,level:e.level,serverId:e.serverId,...e.serverName?{serverName:e.serverName}:{},...e.detail?{detail:e.detail}:{}})}var K0={APPROVAL_DENIED:"Tool approval was denied.",INSTANCE_UNAVAILABLE:"The App's instance is no longer available. Close it and open it again.",INSTANCE_DENIED:"This App belongs to a different chat or client.",INSTANCE_BINDING_CHANGED:"The server changed this App's tool while it was open. Close it and open it again.",ACTIVATION_BINDING_CHANGED:"The server changed this App's tool while it was open. Close it and open it again.",INSTANCE_DEEP_LINK_UNAVAILABLE:"No global App with that tool accepts this link.",INSTANCE_RESPONSE_INVALID:"The host returned a response the App can't use.",INSTANCE_RESPONSE_TOO_LARGE:"The App's response was too large.",INSTANCE_UI_UNAVAILABLE:"The App's UI resource couldn't be read, isn't text/html;profile=mcp-app, or is over 5 MB.",INSTANCE_UNSUPPORTED_CONTINUATION:"The tool asked for input in a way this client can't answer.",INSTANCE_LIMIT:"Too many Apps are open. Close one and try again.",ACTIVATION_SCHEMA_INVALID:"The entrypoint's input schema doesn't accept the arguments this entrypoint sends."};function B8(e){const t=e&&typeof e=="object"&&"description"in e?e.description:void 0,n=e&&typeof e=="object"&&"candidates"in e?e.candidates:void 0,r=Array.isArray(n)&&n.length?n.filter(s=>typeof s=="string"):[];if(typeof t=="string"&&t.trim())return r.length&&!r.every(s=>t.includes(s))?`${t} (${r.join(", ")})`:t;const i=e&&typeof e=="object"&&"code"in e?String(e.code):void 0;return i&&K0[i]?K0[i]:e instanceof Error&&e.message&&!/^[A-Z_]+$/.test(e.message)?e.message:i?`The App couldn't open (${i}).`:"The App couldn't open."}var gu=(0,g.createContext)(null),F8=()=>(0,g.useContext)(gu),Hm=(0,g.createContext)(null),uz=512;function V8({value:e,children:t}){const n=(0,g.useMemo)(()=>tb(()=>({links:{}})),[e?.api]);return(0,p.jsx)(gu.Provider,{value:e,children:(0,p.jsx)(Hm.Provider,{value:n,children:t})})}function hz(e,t){const n=(0,g.useContext)(Hm),r=JSON.stringify([e,t.map(i=>[i.uri,i.name])]);(0,g.useEffect)(()=>{!n||!e||!t.length||n.setState(i=>{const s={...i.links};for(const a of t)s[a.uri]={serverId:e,name:a.name};const o=Object.keys(s);for(const a of o.slice(0,Math.max(0,o.length-uz)))delete s[a];return{links:s}})},[n,r])}var fz={},dz=tb(()=>({links:fz}));function pz(){const e=(0,g.useContext)(Hm);return iM(e??dz,t=>t.links)}function Fl(e,t){return!!e&&e.enabled!==!1&&!!t&&e.serverIds.includes(t.serverId)&&!!t.resourceUri}function mz(e,t){const[n,r]=(0,g.useState)({state:"closed"}),[i,s]=(0,g.useState)(!1),o=(0,g.useRef)(null),a=JSON.stringify([t?.serverId,t?.resourceUri]),l=(0,g.useRef)({actions:e,reference:t});l.current={actions:e,reference:t};const c=()=>l.current.actions?.api===e?.api&&l.current.actions?.workspaceId===e?.workspaceId&&l.current.reference?.serverId===t?.serverId&&l.current.reference?.resourceUri===t?.resourceUri&&Fl(l.current.actions,l.current.reference);(0,g.useEffect)(()=>(r({state:"closed"}),s(!1),()=>o.current?.abort()),[a,e?.api]);const u=async f=>{if(!(!Fl(e,t)||!c())){r({state:"closed"}),s(!1);try{await e.open(t.serverId,f)}catch{s(!0)}}};return{menu:n,setMenu:r,failed:i,activate:async()=>{if(!Fl(e,t)||!c())return;o.current?.abort();const f=new AbortController;o.current=f,s(!1),r({state:"loading"});try{const d=await e.api.discoverFile(t.serverId,t.resourceUri,f.signal);if(f.signal.aborted||!c())return;if(d.length===1){await u(d[0]);return}d.length===0&&q0({serverId:t.serverId,label:"file-viewer",level:"info",message:"No file viewer of this server accepts this file's extension."}),r({state:"ready",entries:d})}catch{if(f.signal.aborted||!c())return;r({state:"error"}),q0({serverId:t.serverId,label:"file-viewer",level:"error",message:"Couldn't list the file viewers for this file."})}},open:u}}var gz={onPointerDown:e=>e.preventDefault(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&e.preventDefault()}};function vz({menu:e,onOpen:t}){return(0,p.jsxs)($m,{align:"start",children:[(0,p.jsx)(YV,{className:"text-xs text-muted-foreground",children:"Open with…"}),e.state==="error"&&(0,p.jsx)(Bl,{disabled:!0,children:"Couldn't load viewers"}),e.state==="ready"&&e.entries.length===0&&(0,p.jsx)(Bl,{disabled:!0,children:"No viewer can open this file"}),e.state==="ready"&&e.entries.map(n=>(0,p.jsx)(Bl,{onSelect:()=>t(n),children:n.title},n.toolName))]})}function J1({reference:e,label:t,className:n}){const r=(0,g.useContext)(gu),i=mz(r,e);return Fl(r,e)?(0,p.jsxs)(Vm,{open:i.menu.state==="ready"||i.menu.state==="error",onOpenChange:s=>{s||i.setMenu({state:"closed"})},children:[(0,p.jsx)(zm,{asChild:!0,...gz,children:(0,p.jsxs)("button",{type:"button",onClick:s=>{s.stopPropagation(),i.activate()},className:G("inline-flex max-w-full items-center gap-1 text-left text-primary underline-offset-2 hover:underline",n),children:[(0,p.jsx)("span",{className:"truncate",children:t}),i.menu.state==="loading"?(0,p.jsx)(hM,{className:"size-3 shrink-0 animate-spin","aria-hidden":!0}):null]})}),(0,p.jsx)(vz,{menu:i.menu,onOpen:s=>{i.open(s)}}),i.failed&&(0,p.jsx)("span",{role:"alert",className:"ms-1 text-xs text-destructive",children:"Could not open viewer"})]}):(0,p.jsx)("span",{className:n,children:t})}function z8({result:e,serverId:t}){const n=(0,g.useContext)(gu);if(!n||!t||!n.serverIds.includes(t)||!e||typeof e!="object")return null;const r=e,i=r.content??r.value?.content;if(!Array.isArray(i))return null;const s=i.slice(0,64).filter(o=>!!o&&typeof o=="object"&&o.type==="resource_link"&&typeof o.uri=="string"&&o.uri.length<=4096&&typeof o.name=="string"&&o.name.length<=4096);return s.length?(0,p.jsx)(yz,{serverId:t,links:s}):null}function yz({serverId:e,links:t}){return hz(e,t),(0,p.jsx)("div",{className:"flex flex-wrap gap-2 px-3 pb-2",children:t.map((n,r)=>(0,p.jsx)("div",{className:"inline-flex max-w-64 items-center gap-2 rounded-md border border-border px-2 py-1 text-xs",title:n.name,children:(0,p.jsx)(J1,{reference:{serverId:e,resourceUri:n.uri},label:n.name})},`${n.uri}:${r}`))})}var Z1=(0,g.createContext)(new Map);function $8(e){const t=(0,g.useContext)(Z1);return e?t.get(e):void 0}function xz({name:e}){return e?(0,p.jsxs)("span",{className:"inline-flex max-w-40 shrink-0 items-center gap-1 rounded-full bg-foreground/5 px-1.5 py-0.5 text-[10px] text-muted-foreground/80",title:`Ran with the ${e} account`,"data-testid":"tool-call-account",children:[(0,p.jsx)(hN,{className:"size-2.5 shrink-0","aria-hidden":!0}),(0,p.jsx)("span",{className:"min-w-0 truncate",children:e})]}):null}var bz=50,Ah="null";function Oi(){return{line:1,column:1}}function wz(e){if(e===void 0)return Ah;try{return JSON.stringify(e,null,2)??Ah}catch{return Ah}}function Di(e){try{return{value:JSON.parse(e),error:null}}catch(t){return{value:void 0,error:t instanceof Error?t.message:"Invalid JSON"}}}function Ni(e){try{return JSON.stringify(e)}catch{return null}}function ui(e){if(typeof e=="string"){try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null)return ui(t)}catch{}return e}if(Array.isArray(e))return e.map(ui);if(typeof e=="object"&&e!==null){const t={};for(const[n,r]of Object.entries(e))t[n]=ui(r);return t}return e}function To(e,t){if(typeof t=="string"&&typeof e!="string")try{const n=JSON.parse(t);if(typeof n=="object"&&n!==null)return JSON.stringify(e)}catch{}if(typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof t=="object"&&t!==null&&!Array.isArray(t)){const n={},r=t;for(const[i,s]of Object.entries(e))n[i]=i in r?To(s,r[i]):s;return n}return Array.isArray(e)&&Array.isArray(t)?e.map((n,r)=>r<t.length?To(n,t[r]):n):e}function Za(e,t,n){return e!==void 0?e:wz(n?ui(t):t)}function Sz({initialValue:e,initialContent:t,onChange:n,onRawChange:r,onValidationError:i,expandJsonStrings:s=!1}){const o=(0,g.useRef)(null);if(o.current===null){const I=Za(t,e,s),_=Di(I);let j;_.error!==null?j=null:s?j=Ni(To(_.value,e)):j=Ni(_.value),o.current={content:I,lastEmitted:j,error:_.error}}const[a,l]=(0,g.useState)(o.current.content),c=(0,g.useRef)(e),u=(0,g.useRef)(o.current.content),h=(0,g.useRef)(o.current.content),f=(0,g.useRef)(o.current.lastEmitted),[d,m]=(0,g.useState)(o.current.error),[v,y]=(0,g.useState)(Oi),x=(0,g.useRef)([{content:o.current.content,cursorPosition:Oi()}]),b=(0,g.useRef)(0),w=(0,g.useCallback)(I=>{const _=Di(I);return m(_.error),i?.(_.error),_},[i]);(0,g.useEffect)(()=>{u.current=a},[a]);const S=(0,g.useRef)({value:e,content:t});if(e!==S.current.value||t!==S.current.content)if(S.current={value:e,content:t},t===void 0&&s){const I=Ni(e);I!==null&&I===f.current?(c.current=e,h.current=u.current):(c.current=e,h.current=Za(void 0,e,!0))}else c.current=e,h.current=Za(t,e,s);(0,g.useEffect)(()=>{const I=h.current;if(I===u.current)return;u.current=I,l(I),y(Oi()),x.current=[{content:I,cursorPosition:Oi()}],b.current=0,w(I);const _=Di(I);if(_.error===null&&s){const j=To(_.value,e);f.current=Ni(j)}else f.current=_.error===null?Ni(_.value):null},[e,t,w,s]);const C=(0,g.useCallback)((I,_,j)=>{r?.(I);const $=B=>{const D=s?To(B,c.current):B,se=Ni(D);if(se===null){n?.(D);return}se!==f.current&&(f.current=se,n?.(D))};if(j===void 0){const B=Di(I);B.error===null&&$(B.value);return}j===null&&$(_)},[n,r,s]),A=(0,g.useCallback)(I=>{if(I===u.current)return;u.current=I,l(I);const{value:_,error:j}=w(I),$=b.current;let B=x.current;$<B.length-1&&(B=B.slice(0,$+1));const D=B[B.length-1];(!D||D.content!==I)&&(B=[...B,{content:I,cursorPosition:v}]),B.length>bz&&(B=B.slice(-50)),x.current=B,b.current=B.length-1,C(I,_,j)},[v,C,w]),k=(0,g.useCallback)(I=>{u.current=I.content,l(I.content),y(I.cursorPosition);const{value:_,error:j}=w(I.content);C(I.content,_,j)},[C,w]),E=(0,g.useCallback)(()=>{const I=x.current,_=b.current;if(_>0){b.current=_-1;const j=I[_-1];k(j)}},[k]),T=(0,g.useCallback)(()=>{const I=x.current,_=b.current;if(_<I.length-1){b.current=_+1;const j=I[_+1];k(j)}},[k]),R=(0,g.useCallback)(()=>{const{value:I,error:_}=Di(a);if(_===null){const j=s?ui(I):I,$=JSON.stringify(j,null,2);A($)}},[a,A,s]),P=(0,g.useCallback)(()=>{c.current=e;const I=Za(t,e,s);h.current=I,u.current=I,l(I),y(Oi()),x.current=[{content:I,cursorPosition:Oi()}],b.current=0;const{value:_,error:j}=w(I);C(I,_,j)},[e,t,w,C,s]),M=(0,g.useCallback)(()=>{const{value:I,error:_}=Di(a);return _===null?I:void 0},[a]),N=b.current>0,L=b.current<x.current.length-1;return{content:a,setContent:A,isValid:d===null,validationError:d,cursorPosition:v,setCursorPosition:y,undo:E,redo:T,canUndo:N,canRedo:L,format:R,reset:P,getParsedValue:M,sourceContent:h.current}}function kz(e){return typeof e=="object"?e.key:e}function Cz(e,t){const n=e.length;return new Proxy(e,{get(r,i,s){if(typeof i=="string"){const o=i.charCodeAt(0);if(o>=48&&o<=57){const a=+i;if(Number.isInteger(a)&&a>=0&&a<n){let l=r[a];if(typeof l!="object"){const c=t[a*2];l=r[a]={index:a,key:l,start:c,size:t[a*2+1],end:c+t[a*2+1],lane:0}}return l}}if(i==="length")return n}return Reflect.get(r,i,s)}})}function Li(e,t,n){let r=n.initialDeps??[],i,s=!0;function o(){const a=e();return(a.length!==r.length||a.some((l,c)=>r[c]!==l))&&(r=a,i=t(...a),n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(i),s=!1),i}return o.updateDeps=a=>{r=a},o}function G0(e,t){if(e===void 0)throw new Error(`Unexpected undefined${t?`: ${t}`:""}`);return e}var Q0=(e,t)=>Math.abs(e-t)<1.01,Az=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})},qs,Th=()=>{if(qs!==void 0)return qs;if(typeof navigator>"u")return qs=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return qs=!0;const e=navigator.maxTouchPoints;return qs=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Y0=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Tz=e=>e,Ez=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=new Array(n);for(let i=0;i<n;i++)r[i]=t+i;return r},Mz=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=o=>{const{width:a,height:l}=o;t({width:Math.round(a),height:Math.round(l)})};if(i(Y0(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(o=>{const a=()=>{const l=o[0];if(l?.borderBoxSize){const c=l.borderBoxSize[0];if(c){i({width:c.inlineSize,height:c.blockSize});return}}i(Y0(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},Cc={passive:!0},Rz=typeof window>"u"?!0:"onscrollend"in window,Pz=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const i=e.targetWindow;if(!i)return;const s=e.options.useScrollendEvent&&Rz;let o=0;const a=s?null:Az(i,()=>t(n(r),!1),e.options.isScrollingResetDelay),l=h=>()=>{o=n(r),a?.(),t(o,h)},c=l(!0),u=l(!1);return r.addEventListener("scroll",c,Cc),s&&r.addEventListener("scrollend",u,Cc),()=>{r.removeEventListener("scroll",c),s&&r.removeEventListener("scrollend",u),a?.cancel()}},Iz=(e,t)=>Pz(e,t,n=>{const{horizontal:r,isRtl:i}=e.options;return r?n.scrollLeft*(i&&-1||1):n.scrollTop}),Oz=(e,t,n)=>{if(n.options.useCachedMeasurements){const r=n.indexFromElement(e),i=n.options.getItemKey(r);return n.itemSizeCache.get(i)??n.options.estimateSize(r)}if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const r=n.indexFromElement(e),i=n.options.getItemKey(r),s=n.itemSizeCache.get(i);if(s!==void 0)return s}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},Dz=(e,{adjustments:t=0,behavior:n},r)=>{var i,s;(s=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},Nz=Dz;function Lz(e,t,n,r){if(t===0)return!1;const i=r(0),s=new Set;let o=0;for(;o<e;){const l=n(o);if(l===i)break;s.add(l),o++}const a=e-o;if(a===0||a>=t)return!1;for(let l=0;l<a;l++)if(r(l)!==n(o+l))return!1;for(let l=a;l<t;l++)if(s.has(r(l)))return!1;return!0}var _z=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this._clampedAdjustment=null,this.elementsCache=new Map,this.now=()=>{var t,n,r;return((r=(n=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:n.now)==null?void 0:r.call(n))??Date.now()},this.observer=(()=>{let t=null;const n=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(r=>{r.forEach(i=>{const s=()=>{const o=i.target,a=this.indexFromElement(o);if(!o.isConnected){this.observer.unobserve(o);for(const[l,c]of this.elementsCache)if(c===o){this.elementsCache.delete(l);break}return}this.isIndexInRange(a)&&this.shouldMeasureDuringScroll(a)&&this.resizeItem(a,this.options.measureElement(o,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()})}));return{disconnect:()=>{var r;(r=n())==null||r.disconnect(),t=null},observe:r=>{var i;return(i=n())==null?void 0:i.observe(r,{box:"border-box"})},unobserve:r=>{var i;return(i=n())==null?void 0:i.unobserve(r)}}})(),this.range=null,this.setOptions=t=>{var n;const r={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Tz,rangeExtractor:Ez,onChange:()=>{},measureElement:Oz,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const u in t){const h=t[u];h!==void 0&&(r[u]=h)}const i=this.options;let s=null,o=null,a=!1;if(i!==void 0&&i.enabled&&r.enabled&&r.anchorTo==="end"&&this.scrollElement!==null){const u=i.count,h=r.count,f=this.getMeasurements(),d=((n=this._singleLaneMeasurements)==null?void 0:n.items)??f,m=x=>kz(d[x]),v=u>0?m(0):null,y=u>0?m(u-1):null;if(h!==u||u>0&&h>0&&(r.getItemKey(0)!==v||r.getItemKey(h-1)!==y)){a=!0;const x=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??f[0]:null;x&&(s=[x.key,this.getScrollOffset()-x.start]);const b=r.followOnAppend===!0?"auto":r.followOnAppend||null;b&&h>0&&this.isAtEnd(i.scrollEndThreshold)&&(u===0||r.getItemKey(h-1)!==y)&&(h>u||Lz(u,h,m,r.getItemKey))&&(o=b)}}this.options=r,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let l=!1,c=0;if(s&&this.scrollOffset!==null){const[u,h]=s,f=this.getMeasurements(),{count:d,getItemKey:m}=this.options;let v=0;for(;v<d&&m(v)!==u;)v++;if(v<d){const y=f[v];if(y){const x=Math.max(0,y.start+h);!o&&x!==this.scrollOffset&&(c=x-this.scrollOffset,this.scrollOffset=x,l=!0)}}}(l||o)&&(this.pendingScrollAnchor=[l?s[0]:null,l?s[1]:0,o,c])},this.notify=t=>{var n,r;(r=(n=this.options).onChange)==null||r.call(n,this,t)},this.maybeNotify=Li(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._clampedAdjustment=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t,n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,o)=>{if(o&&this._intendedScrollOffset===null&&s===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(s-this._intendedScrollOffset)<1.5&&(s=this._intendedScrollOffset),this._intendedScrollOffset=null,this._clampedAdjustment!==null&&Math.abs(s-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null),this.scrollAdjustments=0;const a=this.getScrollOffset();this.scrollDirection=o?a===s?this.scrollDirection:a<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const s=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!Th()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",o,Cc),s.addEventListener("touchend",a,Cc),this.unsubs.push(()=>{s.removeEventListener("touchstart",o),s.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const i=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,i&&this.scrollElement&&this.options.enabled){const[s,o,a,l]=i;s!==null&&!a&&(Th()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):((n=this.scrollState)==null?void 0:n.behavior)==="smooth"&&!Q0(this.getScrollOffset()-l,this.scrollState.lastTargetOffset)||this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),a&&this.scrollToEnd({behavior:a})}this._retryClampedAdjustment()},this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled)return;const{target:t,maxAtWrite:n}=this._clampedAdjustment,r=this.getMaxScrollOffset();r>n+.5&&(this._clampedAdjustment=t>r+.5?{target:t,maxAtWrite:r}:null,this._scrollToOffset(t,{adjustments:void 0,behavior:void 0}))},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const t=this.getScrollOffset(),n=this.getMaxScrollOffset();if(t<0||t>n)return;if(this._iosDeferredAdjustment<0&&t>=n-1){this._iosDeferredAdjustment=0;return}const r=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=r,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=Li(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(t,n,r,i,s,o,a,l)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMin=null,{count:t,paddingStart:n,scrollMargin:r,getItemKey:i,enabled:s,lanes:o,laneAssignmentMode:a,gap:l}),{key:!1}),this.isIndexInRange=t=>t>=0&&t<this.options.count,this.getMeasurements=Li(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:n,scrollMargin:r,getItemKey:i,enabled:s,lanes:o,laneAssignmentMode:a,gap:l},c)=>{var u;const h=this.itemSizeCache;if(!s)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const x of this.laneAssignments.keys())x>=t&&this.laneAssignments.delete(x);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(x=>{this.itemSizeCache.set(x.key,x.size)}));const f=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),o===1){const x=t*2;let b=(u=this._singleLaneMeasurements)==null?void 0:u.flat;if(!b||b.length<x){const A=new Float64Array(x);b&&f>0&&A.set(b.subarray(0,f*2)),b=A}const w=f===0?new Array(t):this._singleLaneMeasurements.items.slice();let S;if(f===0)S=n+r;else{const A=f-1;S=b[A*2]+b[A*2+1]+l}for(let A=f;A<t;A++){const k=i(A);w[A]=k;const E=h.get(k),T=typeof E=="number"?E:this.options.estimateSize(A);b[A*2]=S,b[A*2+1]=T,S+=T+l}this._singleLaneMeasurements={flat:b,items:w};const C=Cz(w,b);return this.measurementsCache=C,C}const d=this.measurementsCache.slice(0,f),m=new Array(o).fill(void 0),v=new Float64Array(o);let y=0;for(let x=0;x<f;x++){const b=d[x];b&&(m[b.lane]===void 0&&y++,m[b.lane]=x,v[b.lane]=b.end)}for(let x=f;x<t;x++){const b=i(x),w=this.laneAssignments.get(x);let S,C;const A=a==="estimate"||h.has(b);if(w!==void 0&&this.options.lanes>1){S=w;const R=m[S],P=R!==void 0?d[R]:void 0;C=P?P.end+l:n+r}else if(y===o){let R=0,P=v[0],M=m[0];for(let N=1;N<o;N++){const L=v[N];(L<P||L===P&&m[N]<M)&&(R=N,P=L,M=m[N])}S=R,C=P+l,A&&this.laneAssignments.set(x,S)}else S=x%this.options.lanes,C=n+r,A&&this.laneAssignments.set(x,S);const k=h.get(b),E=typeof k=="number"?k:this.options.estimateSize(x),T=C+E;d[x]={index:x,start:C,size:E,end:T,key:b,lane:S},m[S]===void 0&&y++,m[S]=x,v[S]=T}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Li(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,n,r,i)=>t.length===0||n===0?(this.range=null,null):(this.range=Bz(t,n,r,i,i===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Li(()=>{let t=null,n=null;const r=this.calculateRange();return r&&(t=r.startIndex,n=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,n]},(t,n,r,i,s)=>i===null||s===null?[]:t({startIndex:i,endIndex:s,overscan:n,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const n=this.options.indexAttribute,r=t.getAttribute(n);return r?parseInt(r,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const r=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(r!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),s=Math.max(0,r-i),o=Math.min(this.options.count-1,r+i);return t>=s&&t<=o}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((s,o)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(o))});return}const n=this.indexFromElement(t);if(!this.isIndexInRange(n))return;const r=this.options.getItemKey(n),i=this.elementsCache.get(r);i!==t&&(i&&this.observer.unobserve(i),this.observer.observe(t),this.elementsCache.set(r,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,n)=>{var r,i,s;if(!this.isIndexInRange(t))return;let o,a,l;const c=(r=this._singleLaneMeasurements)==null?void 0:r.flat;if(this.options.lanes===1&&c!=null)l=this.options.getItemKey(t),a=c[t*2],o=c[t*2+1];else{const f=this.measurementsCache[t];if(!f)return;l=f.key,a=f.start,o=f.size}const u=this.itemSizeCache.get(l)??o,h=n-u;if(h!==0){const f=this.options.anchorTo==="end"&&((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,d=f?this.getTotalSize():0,m=this.getScrollOffset()+this.scrollAdjustments,v=this.itemSizeCache.has(l)?a+u<=m&&this.scrollDirection!=="backward":a<m,y=((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:l,start:a,size:o,end:a+o,lane:0},h,this):v);(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(l,n),this.itemSizeCacheVersion++;let x=!1;f?x=this.applyScrollAdjustment(this.getTotalSize()-d):y&&(x=this.applyScrollAdjustment(h)),this.notify(x),this._retryClampedAdjustment()}},this.getVirtualItems=Li(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,n)=>{const r=[];for(let i=0,s=t.length;i<s;i++){const o=n[t[i]];r.push(o)}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{var n;const r=this.getMeasurements();if(r.length===0)return;const i=(n=this._singleLaneMeasurements)==null?void 0:n.flat,s=this.options.lanes===1&&i!=null,o=eC(0,r.length-1,s?a=>i[a*2]:a=>G0(r[a]).start,t);return G0(r[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,n,r=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),s=this.getScrollOffset();n==="auto"&&(n=t>=s+i?"end":"start"),n==="center"?t+=(r-i)/2:n==="end"&&(t-=i);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,t),0)},this.getOffsetForIndex=(t,n="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const r=this.getSize(),i=this.getScrollOffset(),s=this.measurementsCache[t];if(!s)return;if(n==="auto")if(s.end>=i+r-this.options.scrollPaddingEnd)n="end";else if(s.start<=i+this.options.scrollPaddingStart)n="start";else return[i,n];if(n==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),n];const o=n==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,n,s.size),n]},this.scrollToOffset=(t,{align:n="start",behavior:r="auto"}={})=>{this._iosDeferredAdjustment=0;const i=this.getOffsetForAlignment(t,n),s=this.now();this.scrollState={index:null,align:n,behavior:r,startedAt:s,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:n="auto",behavior:r="auto"}={})=>{this._iosDeferredAdjustment=0,t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getOffsetForIndex(t,n);if(!i)return;const[s,o]=i,a=this.now();this.scrollState={index:t,align:o,behavior:r,startedAt:a,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:n="auto"}={})=>{const r=this.getScrollOffset()+t,i=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:t});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t,n;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1){const s=r.length-1,o=(t=this._singleLaneMeasurements)==null?void 0:t.flat;o!=null?i=o[s*2]+o[s*2+1]:i=((n=r[s])==null?void 0:n.end)??0}else{const s=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&s.some(a=>a===null);){const a=r[o];s[a.lane]===null&&(s[a.lane]=a.end),o--}i=Math.max(...s.filter(a=>a!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(this.itemSizeCache.size===0)return t;const n=this.getMeasurements();for(const r of n)r&&this.itemSizeCache.has(r.key)&&t.push({index:r.index,key:r.key,start:r.start,size:r.size,end:r.end,lane:r.lane});return t},this._scrollToOffset=(t,{adjustments:n,behavior:r})=>{this._intendedScrollOffset=t+(n??0),this.options.scrollToFn(t,{behavior:r,adjustments:n},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){if(e===0)return!1;if(Th()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded))return this._iosDeferredAdjustment+=e,!1;{const n=this.getScrollOffset()+this.scrollAdjustments+e,r=this.scrollElement,i=r!==null&&("scrollHeight"in r||"document"in r)?this.getMaxScrollOffset():null;return this._clampedAdjustment=i!==null&&n>i+.5?{target:n,maxAtWrite:i}:null,this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0}}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const e=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,t=e?e[0]:this.scrollState.lastTargetOffset,n=1,r=t!==this.scrollState.lastTargetOffset;if(!r&&Q0(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=n){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,r){const i=this.getSize()||600,s=Math.abs(t-this.getScrollOffset()),o=this.scrollState.behavior==="smooth"&&s>i;this.scrollState.lastTargetOffset=t,o||(this.scrollState.behavior="auto"),this._scrollToOffset(t,{adjustments:void 0,behavior:o?"smooth":"auto"})}this.scheduleScrollReconcile()}},eC=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,s=n(i);if(s<r)e=i+1;else if(s>r)t=i-1;else return i}return e>0?e-1:0};function jz(e,t,n){let r=0;for(;r<=t;){const i=(r+t)/2|0,s=e[i*2];if(s<n)r=i+1;else if(s>n)t=i-1;else return i}return r>0?r-1:0}function Bz(e,t,n,r,i){const s=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:s};if(r===1&&i!==null){const c=jz(i,s,n);let u=c;const h=n+t;for(;u<s&&i[u*2]+i[u*2+1]<h;)u++;return{startIndex:c,endIndex:u}}let a=eC(0,s,c=>e[c].start,n),l=a;if(r===1)for(;l<s&&e[l].end<n+t;)l++;else if(r>1){const c=Array(r).fill(0);for(;l<s&&c.some(h=>h<n+t);){const h=e[l];c[h.lane]=h.end,l++}const u=Array(r).fill(n+t);for(;a>=0&&u.some(h=>h>=n);){const h=e[a];u[h.lane]=h.start,a--}a=Math.max(0,a-a%r),l=Math.min(s,l+(r-1-l%r))}return{startIndex:a,endIndex:l}}var Eh=typeof document<"u"?g.useLayoutEffect:g.useEffect;function Fz({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){const i=g.useReducer(h=>h+1,0)[1],s=g.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});s.current.enabled=t,s.current.mode=n;const o=g.useRef(!1),a=h=>{const f=s.current;if(!f.enabled||!f.container)return;const d=h.getTotalSize();if(d!==f.lastSize){f.lastSize=d;const m=h.options.horizontal?"width":"height";f.container.style[m]=`${d}px`}},l=h=>{const f=s.current;if(!f.enabled||!f.container)return;a(h);const d=!!h.options.horizontal,m=f.mode==="transform",v=d?"left":"top",y=h.options.scrollMargin,x=h.getVirtualItems();for(const b of x){const w=b.start-y,S=h.elementsCache.get(b.key);S&&f.lastPositions.get(S)!==w&&(f.lastPositions.set(S,w),m?S.style.transform=d?`translate3d(${w}px, 0, 0)`:`translate3d(0, ${w}px, 0)`:S.style[v]=`${w}px`)}},c={...r,onChange:(h,f)=>{var d;const m=s.current;let v=!0;if(m.enabled){l(h);const y=h.range,x=m.prevRange;v=!x||x.isScrolling!==h.isScrolling||x.startIndex!==y?.startIndex||x.endIndex!==y?.endIndex,v&&(m.prevRange=y?{startIndex:y.startIndex,endIndex:y.endIndex,isScrolling:h.isScrolling}:null)}v&&(e&&f&&!o.current?(0,pa.flushSync)(i):i()),(d=r.onChange)==null||d.call(r,h,f)}},[u]=g.useState(()=>{const h=new _z(c),f=h.measureElement;return h.measureElement=d=>{o.current=!0;try{f(d)}finally{o.current=!1}},Object.assign(h,{containerRef:d=>{const m=s.current;if(m.container=d,m.lastSize=null,d&&m.enabled){const v=h.getTotalSize();m.lastSize=v;const y=h.options.horizontal?"width":"height";d.style[y]=`${v}px`}}})});return u.setOptions(c),Eh(()=>u._didMount(),[]),Eh(()=>(a(u),u._willUpdate())),Eh(()=>{l(u)}),u}function Vz(e){return Fz({observeElementRect:Mz,observeElementOffset:Iz,scrollToFn:Nz,...e})}function zz(e){return e.map((t,n)=>typeof t=="number"?`[${t}]`:n===0?t:`.${t}`).join("")}function tC(e){const t=[];let n=0;const r=()=>{for(;n<e.length&&/\s/.test(e[n]);)n++},i=()=>{const h=n;for(n++;n<e.length;)if(e[n]==="\\")n+=2;else if(e[n]==='"'){n++;break}else n++;return e.slice(h,n)},s=()=>{const h=n;for(e[n]==="-"&&n++;n<e.length&&/[0-9]/.test(e[n]);)n++;if(e[n]===".")for(n++;n<e.length&&/[0-9]/.test(e[n]);)n++;if(e[n]==="e"||e[n]==="E")for(n++,(e[n]==="+"||e[n]==="-")&&n++;n<e.length&&/[0-9]/.test(e[n]);)n++;return e.slice(h,n)},o=()=>{const h=n;for(;n<e.length&&/[a-z]/.test(e[n]);)n++;return e.slice(h,n)},a=[];let l=!1;const c=[];let u=null;for(;n<e.length&&(r(),!(n>=e.length));){const h=e[n],f=n;switch(h){case"{":t.push({type:"punctuation",value:"{",start:f,end:n+1}),a.push("object"),l=!0,u!==null&&(c.push(u),u=null),n++;break;case"}":t.push({type:"punctuation",value:"}",start:f,end:n+1}),a.pop(),c.length>0&&typeof c[c.length-1]=="string"&&c.pop(),l=!1,n++;break;case"[":t.push({type:"punctuation",value:"[",start:f,end:n+1}),a.push("array"),u!==null&&(c.push(u),u=null),c.push(0),l=!1,n++;break;case"]":t.push({type:"punctuation",value:"]",start:f,end:n+1}),a.pop(),c.length>0&&typeof c[c.length-1]=="number"&&c.pop(),c.length>0&&typeof c[c.length-1]=="string"&&c.pop(),l=!1,n++;break;case":":t.push({type:"punctuation",value:":",start:f,end:n+1}),l=!1,n++;break;case",":t.push({type:"punctuation",value:",",start:f,end:n+1}),l=a.length>0&&a[a.length-1]==="object",a.length>0&&a[a.length-1]==="array"&&c.length>0&&typeof c[c.length-1]=="number"&&(c[c.length-1]=c[c.length-1]+1),n++;break;case'"':{const d=i();if(l&&a.length>0&&a[a.length-1]==="object"){let m;try{m=JSON.parse(d)}catch{m=d.slice(1,-1)}u=m,t.push({type:"key",value:d,start:f,end:n,path:[...c,m],keyName:m})}else{const m=u!==null?[...c,u]:[...c];t.push({type:"string",value:d,start:f,end:n,path:m,keyName:u??void 0}),u=null}break}case"-":case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{const d=s(),m=u!==null?[...c,u]:[...c];t.push({type:"number",value:d,start:f,end:n,path:m,keyName:u??void 0}),u=null,l=!1;break}case"t":case"f":{const d=o(),m=u!==null?[...c,u]:[...c];d==="true"?t.push({type:"boolean",value:d,start:f,end:n,path:m,keyName:u??void 0}):d==="false"&&t.push({type:"boolean-false",value:d,start:f,end:n,path:m,keyName:u??void 0}),u=null,l=!1;break}case"n":{const d=o();if(d==="null"){const m=u!==null?[...c,u]:[...c];t.push({type:"null",value:d,start:f,end:n,path:m,keyName:u??void 0}),u=null}l=!1;break}default:n++}}return t}function nC(e){const t=tC(e);let n="",r=0;const i=s=>{s&&(n+=`<span class="json-punctuation">${X0(s)}</span>`)};for(const s of t){s.start>r&&i(e.slice(r,s.start));const o=`json-${s.type}`;n+=`<span class="${o}">${X0(s.value)}</span>`,r=s.end}return r<e.length&&i(e.slice(r)),n}function X0(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function rC({value:e,displayValue:t,maxLength:n,onCopy:r,keyName:i,path:s}){const[o,a]=(0,g.useState)(null),[l,c]=(0,g.useState)(!1),[u,h]=(0,g.useState)(!1),f=e.length>n,d=f&&!u?`"${e.slice(0,n)}..."`:t,m=(0,g.useCallback)(async(b,w)=>{await uu(b)&&(a(w),r?.(b),setTimeout(()=>a(null),1500))},[r]),v=(0,g.useCallback)(b=>{f&&(b.stopPropagation(),h(w=>!w))},[f]),y=s&&s.length>0?zz(s):null,x=[];return x.push({label:"Copy value",value:e,key:"value"}),i&&x.push({label:"Copy key",value:i,key:"key"}),y&&x.push({label:"Copy path",value:y,key:"path"}),x.length===1?(0,p.jsxs)("span",{className:"relative group/copy",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,p.jsx)("span",{onClick:v,className:G("json-string",f&&!u&&"json-string-truncated"),children:d}),(0,p.jsx)("button",{onClick:b=>{b.stopPropagation(),m(x[0].value,x[0].key)},className:G("inline-flex items-center justify-center ml-1 p-0.5 rounded","transition-all duration-150","hover:bg-muted",l||o?"opacity-100":"opacity-0"),style:{verticalAlign:"middle"},children:o?(0,p.jsx)(hs,{className:"h-3 w-3 text-green-500"}):(0,p.jsx)(ts,{className:"h-3 w-3 text-muted-foreground/60 hover:text-muted-foreground"})})]}):(0,p.jsxs)("span",{className:"relative group/copy",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,p.jsx)("span",{onClick:v,className:G("json-string",f&&!u&&"json-string-truncated"),children:d}),(0,p.jsxs)(Vm,{children:[(0,p.jsx)(zm,{asChild:!0,children:(0,p.jsx)("button",{className:G("inline-flex items-center justify-center ml-1 p-0.5 rounded","transition-all duration-150","hover:bg-muted",l||o?"opacity-100":"opacity-0"),style:{verticalAlign:"middle"},onClick:b=>b.stopPropagation(),children:o?(0,p.jsx)(hs,{className:"h-3 w-3 text-green-500"}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ts,{className:"h-3 w-3 text-muted-foreground/60"}),(0,p.jsx)(Xw,{className:"h-2 w-2 text-muted-foreground/60 -ml-0.5"})]})})}),(0,p.jsx)($m,{align:"start",className:"min-w-[140px]",children:x.map(b=>(0,p.jsxs)(Bl,{onClick:()=>m(b.value,b.key),className:"text-xs",children:[(0,p.jsx)(ts,{className:"h-3 w-3 mr-2"}),b.label]},b.key))})]})]})}function J0(e,t){return t?(0,p.jsx)("span",{className:"json-punctuation",children:t},e):null}function Mh({children:e,value:t,onCopy:n}){const[r,i]=(0,g.useState)(!1),[s,o]=(0,g.useState)(!1),a=(0,g.useCallback)(async l=>{await uu(l)&&(i(!0),n?.(l),setTimeout(()=>i(!1),1500))},[n]);return(0,p.jsxs)("span",{className:"relative group/copy",onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[e,(0,p.jsx)("button",{onClick:l=>{l.stopPropagation(),a(t)},className:G("inline-flex items-center justify-center ml-1 p-0.5 rounded","transition-all duration-150","hover:bg-muted",s||r?"opacity-100":"opacity-0"),style:{verticalAlign:"middle"},children:r?(0,p.jsx)(hs,{className:"h-3 w-3 text-green-500"}):(0,p.jsx)(ts,{className:"h-3 w-3 text-muted-foreground/60 hover:text-muted-foreground"})})]})}function Z0(e,t){const n=e[t],r=n==="{"?"}":"]";let i=1,s=t+1,o=!1,a=!1;for(;s<e.length&&i>0;){const l=e[s];a?a=!1:l==="\\"?a=!0:l==='"'?o=!o:o||(l===n?i++:l===r&&i--),s++}return e.slice(t,s)}function $z({content:e,onCopy:t,collapseStringsAfterLength:n}){const r=(0,g.useMemo)(()=>{const i=tC(e),s=[];let o=0,a=null,l=!0;const c=u=>{for(let h=u+1;h<i.length;h++){const f=i[h];if(!(f.type==="punctuation"&&f.value===":"))return f}return null};for(let u=0;u<i.length;u++){const h=i[u];h.start>o&&s.push(J0(`ws-${o}`,e.slice(o,h.start)));const f=`json-${h.type}`;if(h.type==="key"){const v=c(u);v&&v.type==="punctuation"&&(v.value==="{"||v.value==="[")&&(a={start:v.start}),s.push((0,p.jsx)("span",{className:f,children:h.value},`token-${u}`)),o=h.end;continue}if(l&&h.type==="punctuation"&&(h.value==="{"||h.value==="[")){l=!1;const v=Z0(e,h.start);s.push((0,p.jsx)(Mh,{value:v,onCopy:t,children:(0,p.jsx)("span",{className:f,children:h.value})},`token-${u}`)),o=h.end;continue}if(a&&h.type==="punctuation"&&(h.value==="{"||h.value==="[")&&h.start===a.start){const v=Z0(e,h.start);a=null,s.push((0,p.jsx)(Mh,{value:v,onCopy:t,children:(0,p.jsx)("span",{className:f,children:h.value})},`token-${u}`)),o=h.end;continue}const d=h.type==="string"||h.type==="number"||h.type==="boolean"||h.type==="boolean-false"||h.type==="null",m=()=>{if(h.type==="string")try{return JSON.parse(h.value)}catch{return h.value.slice(1,-1)}return h.value};if(h.type==="string"&&n!==void 0){const v=m();s.push((0,p.jsx)(rC,{value:v,displayValue:h.value,maxLength:n,onCopy:t,keyName:h.keyName,path:h.path},`token-${u}`))}else d?s.push((0,p.jsx)(Mh,{value:m(),onCopy:t,children:(0,p.jsx)("span",{className:f,children:h.value})},`token-${u}`)):s.push((0,p.jsx)("span",{className:f,children:h.value},`token-${u}`));o=h.end}return o<e.length&&s.push(J0("ws-end",e.slice(o))),s},[e,t,n]);return(0,p.jsx)(p.Fragment,{children:r})}var ii=20,ey=30,ty=12,cd=80,Hz=2;function Wz(e){const t=e.value,n=e.selectionStart,r=t.substring(0,n).split(`
41
+ `)},HR=0,Ri=[];function WR(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(HR++)[0],s=g.useState(Ob)[0],o=g.useRef(e);g.useEffect(function(){o.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var v=hR([e.lockRef.current],(e.shards||[]).map($g),!0).filter(Boolean);return v.forEach(function(y){return y.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),v.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=g.useCallback(function(v,y){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!o.current.allowPinchZoom;var x=Va(v),b=n.current,w="deltaX"in v?v.deltaX:b[0]-x[0],S="deltaY"in v?v.deltaY:b[1]-x[1],C,A=v.target,k=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in v&&k==="h"&&A.type==="range")return!1;var E=window.getSelection(),T=E&&E.anchorNode;if(T&&(T===A||T.contains(A)))return!1;var R=Vg(k,A);if(!R)return!0;if(R?C=k:(C=k==="v"?"h":"v",R=Vg(k,A)),!R)return!1;if(!r.current&&"changedTouches"in v&&(w||S)&&(r.current=C),!C)return!0;var P=r.current||C;return VR(P,y,v,P==="h"?w:S,!0)},[]),l=g.useCallback(function(v){var y=v;if(!(!Ri.length||Ri[Ri.length-1]!==s)){var x="deltaY"in y?zg(y):Va(y),b=t.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&zR(S.delta,x)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var w=(o.current.shards||[]).map($g).filter(Boolean).filter(function(S){return S.contains(y.target)});(w.length>0?a(y,w[0]):!o.current.noIsolation)&&y.cancelable&&y.preventDefault()}}},[]),c=g.useCallback(function(v,y,x,b){var w={name:v,delta:y,target:x,should:b,shadowParent:UR(x)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),u=g.useCallback(function(v){n.current=Va(v),r.current=void 0},[]),h=g.useCallback(function(v){c(v.type,zg(v),v.target,a(v,e.lockRef.current))},[]),f=g.useCallback(function(v){c(v.type,Va(v),v.target,a(v,e.lockRef.current))},[]);g.useEffect(function(){return Ri.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:f}),document.addEventListener("wheel",l,Mi),document.addEventListener("touchmove",l,Mi),document.addEventListener("touchstart",u,Mi),function(){Ri=Ri.filter(function(v){return v!==s}),document.removeEventListener("wheel",l,Mi),document.removeEventListener("touchmove",l,Mi),document.removeEventListener("touchstart",u,Mi)}},[]);var d=e.removeScrollBar,m=e.inert;return g.createElement(g.Fragment,null,m?g.createElement(s,{styles:$R(i)}):null,d?g.createElement(DR,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function UR(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var qR=bR(Ib,WR),_b=g.forwardRef(function(e,t){return g.createElement(Hc,kn({},e,{ref:t,sideCar:qR}))});_b.classNames=Hc.classNames;var KR=function(e){return typeof document>"u"?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Pi=new WeakMap,za=new WeakMap,$a={},Gu=0,jb=function(e){return e&&(e.host||jb(e.parentNode))},GR=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=jb(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},QR=function(e,t,n,r){var i=GR(t,Array.isArray(e)?e:[e]);$a[n]||($a[n]=new WeakMap);var s=$a[n],o=[],a=new Set,l=new Set(i),c=function(h){!h||a.has(h)||(a.add(h),c(h.parentNode))};i.forEach(c);var u=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(f){if(a.has(f))u(f);else try{var d=f.getAttribute(r),m=d!==null&&d!=="false",v=(Pi.get(f)||0)+1,y=(s.get(f)||0)+1;Pi.set(f,v),s.set(f,y),o.push(f),v===1&&m&&za.set(f,!0),y===1&&f.setAttribute(n,"true"),m||f.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",f,x)}})};return u(t),a.clear(),Gu++,function(){o.forEach(function(h){var f=Pi.get(h)-1,d=s.get(h)-1;Pi.set(h,f),s.set(h,d),f||(za.has(h)||h.removeAttribute(r),za.delete(h)),d||h.removeAttribute(n)}),Gu--,Gu||(Pi=new WeakMap,Pi=new WeakMap,za=new WeakMap,$a={})}},YR=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=t||KR(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),QR(r,i,n,"aria-hidden")):function(){return null}},XR=Object.defineProperty,JR=(e,t)=>XR(e,"name",{value:t,configurable:!0});function Bb(e){const[t,n]=g.useState(void 0);return Rt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}JR(Bb,"useSize");var ZR=["top","right","bottom","left"],Rr=Math.min,tr=Math.max,oc=Math.round,Ha=Math.floor,nr=e=>({x:e,y:e}),eP={left:"right",right:"left",bottom:"top",top:"bottom"};function Fb(e,t,n){return tr(e,Rr(t,n))}function or(e,t){return typeof e=="function"?e(t):e}function Pr(e){return e.split("-")[0]}function Rs(e){return e.split("-")[1]}function _p(e){return e==="x"?"y":"x"}function jp(e){return e==="y"?"height":"width"}function An(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Bp(e){return _p(An(e))}function tP(e,t,n){n===void 0&&(n=!1);const r=Rs(e),i=Bp(e),s=jp(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=ac(o)),[o,ac(o)]}function nP(e){const t=ac(e);return[xf(e),t,xf(t)]}function xf(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var Hg=["left","right"],Wg=["right","left"],rP=["top","bottom"],iP=["bottom","top"];function sP(e,t,n){switch(e){case"top":case"bottom":return n?t?Wg:Hg:t?Hg:Wg;case"left":case"right":return t?rP:iP;default:return[]}}function oP(e,t,n,r){const i=Rs(e);let s=sP(Pr(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(xf)))),s}function ac(e){const t=Pr(e);return eP[t]+e.slice(t.length)}function aP(e){var t,n,r,i;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(r=e.bottom)!=null?r:0,left:(i=e.left)!=null?i:0}}function Vb(e){return typeof e!="number"?aP(e):{top:e,right:e,bottom:e,left:e}}function lc(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ug(e,t,n){let{reference:r,floating:i}=e;const s=An(t),o=Bp(t),a=jp(o),l=Pr(t),c=s==="y",u=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let d;switch(l){case"top":d={x:u,y:r.y-i.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:h};break;case"left":d={x:r.x-i.width,y:h};break;default:d={x:r.x,y:r.y}}const m=Rs(t);return m&&(d[o]+=f*(m==="end"?1:-1)*(n&&c?-1:1)),d}async function lP(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:f=!1,padding:d=0}=or(t,e),m=Vb(d),v=a[f?h==="floating"?"reference":"floating":h],y=lc(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),x=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),w=await(s.isElement==null?void 0:s.isElement(b))&&await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1},S=lc(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:b,strategy:l}):x);return{top:(y.top-S.top+m.top)/w.y,bottom:(S.bottom-y.bottom+m.bottom)/w.y,left:(y.left-S.left+m.left)/w.x,right:(S.right-y.right+m.right)/w.x}}var cP=50,uP=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:lP},l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:h}=Ug(c,r,l),f=r,d=0;const m={};for(let v=0;v<s.length;v++){const y=s[v];if(!y)continue;const{name:x,fn:b}=y,{x:w,y:S,data:C,reset:A}=await b({x:u,y:h,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:c,platform:a,elements:{reference:e,floating:t}});u=w??u,h=S??h,m[x]={...m[x],...C},A&&d<cP&&(d++,typeof A=="object"&&(A.placement&&(f=A.placement),A.rects&&(c=A.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):A.rects),{x:u,y:h}=Ug(c,f,l)),v=-1)}return{x:u,y:h,placement:f,strategy:i,middlewareData:m}},hP=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=or(e,t)||{};if(c==null)return{};const h=Vb(u),f={x:n,y:r},d=Bp(i),m=jp(d),v=await o.getDimensions(c),y=d==="y",x=y?"top":"left",b=y?"bottom":"right",w=y?"clientHeight":"clientWidth",S=s.reference[m]+s.reference[d]-f[d]-s.floating[m],C=f[d]-s.reference[d],A=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let k=A?A[w]:0;(!k||!await(o.isElement==null?void 0:o.isElement(A)))&&(k=a.floating[w]||s.floating[m]);const E=S/2-C/2,T=k/2-v[m]/2-1,R=Rr(h[x],T),P=Rr(h[b],T),M=k-v[m]-P,N=k/2-v[m]/2+E,L=Fb(R,N,M),I=!l.arrow&&Rs(i)!=null&&N!==L&&s.reference[m]/2-(N<R?R:P)-v[m]/2<0,_=I?N<R?N-R:N-M:0;return{[d]:f[d]+_,data:{[d]:L,centerOffset:N-L-_,...I&&{alignmentOffset:_}},reset:I}}}),fP=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...y}=or(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=Pr(i),b=An(a),w=Pr(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=f||(w||!v?[ac(a)]:nP(a)),A=m!=="none";!f&&A&&C.push(...oP(a,v,m,S));const k=[a,...C],E=await l.detectOverflow(t,y),T=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&T.push(E[x]),h){const L=tP(i,o,S);T.push(E[L[0]],E[L[1]])}if(R=[...R,{placement:i,overflows:T}],!T.every(L=>L<=0)){var P,M;const L=(((P=s.flip)==null?void 0:P.index)||0)+1,I=k[L];if(I&&(!(h==="alignment"&&b!==An(I))||R.every(j=>An(j.placement)===b?j.overflows[0]>0:!0)))return{data:{index:L,overflows:R},reset:{placement:I}};let _=(M=R.filter(j=>j.overflows[0]<=0).sort((j,$)=>j.overflows[1]-$.overflows[1])[0])==null?void 0:M.placement;if(!_)switch(d){case"bestFit":{var N;const j=(N=R.filter($=>{if(A){const B=An($.placement);return B===b||B==="y"}return!0}).map($=>[$.placement,$.overflows.filter(B=>B>0).reduce((B,D)=>B+D,0)]).sort(($,B)=>$[1]-B[1])[0])==null?void 0:N[0];j&&(_=j);break}case"initialPlacement":_=a}if(i!==_)return{reset:{placement:_}}}return{}}}};function qg(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Kg(e){return ZR.some(t=>e[t]>=0)}var dP=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=or(e,t);switch(i){case"referenceHidden":{const o=qg(await r.detectOverflow(t,{...s,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Kg(o)}}}case"escaped":{const o=qg(await r.detectOverflow(t,{...s,altBoundary:!0}),n.floating);return{data:{escapedOffsets:o,escaped:Kg(o)}}}default:return{}}}}},zb=new Set(["left","top"]);async function pP(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Pr(n),a=Rs(n),l=An(n)==="y",c=zb.has(o)?-1:1,u=s&&l?-1:1,h=or(t,e);let{mainAxis:f,crossAxis:d,alignmentAxis:m}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof m=="number"&&(d=a==="end"?m*-1:m),l?{x:d*u,y:f*c}:{x:f*c,y:d*u}}var mP=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=t,l=await pP(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},gP=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x:w,y:S}=b;return{x:w,y:S}}},...c}=or(e,t),u={x:n,y:r},h=await s.detectOverflow(t,c),f=An(i),d=_p(f);let m=u[d],v=u[f];const y=(b,w)=>Fb(w+h[b==="y"?"top":"left"],w,w-h[b==="y"?"bottom":"right"]);o&&(m=y(d,m)),a&&(v=y(f,v));const x=l.fn({...t,[d]:m,[f]:v});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[d]:o,[f]:a}}}}}},vP=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,r;const{x:i,y:s,placement:o,rects:a,middlewareData:l}=t,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=or(e,t),f={x:i,y:s},d=An(o),m=_p(d);let v=f[m],y=f[d];const x=or(c,t),b=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:(n=x.mainAxis)!=null?n:0,crossAxis:(r=x.crossAxis)!=null?r:0};if(u){const C=m==="y"?"height":"width",A=a.reference[m]-a.floating[C]+b.mainAxis,k=a.reference[m]+a.reference[C]-b.mainAxis;v<A?v=A:v>k&&(v=k)}if(h){var w,S;const C=m==="y"?"width":"height",A=zb.has(Pr(o)),k=a.reference[d]-a.floating[C]+(A&&((w=l.offset)==null?void 0:w[d])||0)+(A?0:b.crossAxis),E=a.reference[d]+a.reference[C]+(A?0:((S=l.offset)==null?void 0:S[d])||0)-(A?b.crossAxis:0);y<k?y=k:y>E&&(y=E)}return{[m]:v,[d]:y}}}},yP=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:i,elements:s}=t,{apply:o=()=>{},...a}=or(e,t),l=await i.detectOverflow(t,a),c=Pr(n),u=Rs(n),h=An(n)==="y",{width:f,height:d}=r.floating;let m,v;c==="top"||c==="bottom"?(m=c,v=u===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(v=c,m=u==="end"?"top":"bottom");const y=d-l.top-l.bottom,x=f-l.left-l.right,b=Rr(d-l[m],y),w=Rr(f-l[v],x),S=t.middlewareData.shift,C=!S;let A=b,k=w;S!=null&&S.enabled.x&&(k=x),S!=null&&S.enabled.y&&(A=y),C&&!u&&(h?k=f-2*tr(l.left,l.right):A=d-2*tr(l.top,l.bottom)),await o({...t,availableWidth:k,availableHeight:A});const E=await i.getDimensions(s.floating);return f!==E.width||d!==E.height?{reset:{rects:!0}}:{}}}};function Wc(){return typeof window<"u"}function Ps(e){return $b(e)?(e.nodeName||"").toLowerCase():"#document"}function yt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ur(e){var t;return(t=($b(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function $b(e){return Wc()?e instanceof Node||e instanceof yt(e).Node:!1}function On(e){return Wc()?e instanceof Element||e instanceof yt(e).Element:!1}function Fr(e){return Wc()?e instanceof HTMLElement||e instanceof yt(e).HTMLElement:!1}function Gg(e){return!Wc()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof yt(e).ShadowRoot}function Uc(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Dn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function xP(e){return/^(table|td|th)$/.test(Ps(e))}function qc(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}var bP=/transform|translate|scale|rotate|perspective|filter/,wP=/paint|layout|strict|content/,Ur=e=>!!e&&e!=="none",Qu;function Fp(e){const t=On(e)?Dn(e):e;return Ur(t.transform)||Ur(t.translate)||Ur(t.scale)||Ur(t.rotate)||Ur(t.perspective)||!Vp()&&(Ur(t.backdropFilter)||Ur(t.filter))||bP.test(t.willChange||"")||wP.test(t.contain||"")}function SP(e){let t=pi(e);for(;Fr(t)&&!Lo(t);){if(Fp(t))return t;if(qc(t))return null;t=pi(t)}return null}function Vp(){return Qu==null&&(Qu=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Qu}function Lo(e){return/^(html|body|#document)$/.test(Ps(e))}function Dn(e){return yt(e).getComputedStyle(e)}function Kc(e){return On(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function pi(e){if(Ps(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Gg(e)&&e.host||ur(e);return Gg(t)?t.host:t}function Hb(e){const t=pi(e);return Lo(t)?(e.ownerDocument||e).body:Fr(t)&&Uc(t)?t:Hb(t)}function _o(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Hb(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=yt(i);if(s){const a=bf(o);return t.concat(o,o.visualViewport||[],Uc(i)?i:[],a&&n?_o(a):[])}else return t.concat(i,_o(i,[],n))}function bf(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Wb(e){const t=Dn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Fr(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=oc(n)!==s||oc(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function zp(e){return On(e)?e:e.contextElement}function es(e){const t=zp(e);if(!Fr(t))return nr(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=Wb(t);let o=(s?oc(n.width):n.width)/r,a=(s?oc(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}var kP=nr(0);function Ub(e){const t=yt(e);return!Vp()||!t.visualViewport?kP:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function CP(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===yt(e)}function mi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=zp(e);let o=nr(1);t&&(r?On(r)&&(o=es(r)):o=es(e));const a=CP(s,n,r)?Ub(s):nr(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,h=i.height/o.y;if(s&&r){const f=yt(s),d=On(r)?yt(r):r;let m=f,v=bf(m);for(;v&&d!==m;){const y=es(v),x=v.getBoundingClientRect(),b=Dn(v),w=x.left+(v.clientLeft+parseFloat(b.paddingLeft))*y.x,S=x.top+(v.clientTop+parseFloat(b.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,h*=y.y,l+=w,c+=S,m=yt(v),v=bf(m)}}return lc({width:u,height:h,x:l,y:c})}function Gc(e,t){const n=Kc(e).scrollLeft;return t?t.left+n:mi(ur(e)).left+n}function qb(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Gc(e,n),y:n.top+t.scrollTop}}function AP(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=ur(r),a=t?qc(t.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=nr(1);const u=nr(0),h=Fr(r);if((h||!s)&&((Ps(r)!=="body"||Uc(o))&&(l=Kc(r)),h)){const d=mi(r);c=es(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const f=o&&!h&&!s?qb(o,l):nr(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-l.scrollTop*c.y+u.y+f.y}}function TP(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function EP(e){const t=Kc(e),n=e.ownerDocument.body,r=tr(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=tr(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let s=-t.scrollLeft+Gc(e);const o=-t.scrollTop;return Dn(n).direction==="rtl"&&(s+=tr(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:s,y:o}}var MP=25;function RP(e,t,n){n===void 0&&(n="viewport");const r=n==="layoutViewport",i=yt(e),s=ur(e),o=i.visualViewport;let a=s.clientWidth,l=s.clientHeight,c=0,u=0;if(o){const h=!Vp()||t==="fixed";r?h||(c=-o.offsetLeft,u=-o.offsetTop):(a=o.width,l=o.height,h&&(c=o.offsetLeft,u=o.offsetTop))}if(Gc(s)<=0){const h=s.ownerDocument,f=h.body,d=getComputedStyle(f),m=h.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,v=Math.abs(s.clientWidth-f.clientWidth-m),y=getComputedStyle(s).scrollbarGutter==="stable both-edges"?v/2:v;y<=MP&&(a-=y)}return{width:a,height:l,x:c,y:u}}function PP(e,t){const n=mi(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=es(e);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:i*s.x,y:r*s.y}}function Qg(e,t,n){let r;if(t==="viewport"||t==="layoutViewport")r=RP(e,n,t);else if(t==="document")r=EP(ur(e));else if(On(t))r=PP(t,n);else{const i=Ub(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return lc(r)}function IP(e,t){const n=t.get(e);if(n)return n;let r=_o(e,[],!1).filter(a=>On(a)&&Ps(a)!=="body"),i=null;const s=Dn(e).position==="fixed";let o=s?pi(e):e;for(;On(o)&&!Lo(o);){const a=Dn(o),l=Fp(o),c=i?i.position:s?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&a.position==="static")?r=r.filter(u=>u!==o):i=a,o=pi(o)}return t.set(e,r),r}function OP(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?qc(t)?[]:IP(t,this._c):[].concat(n),r],o=Qg(t,s[0],i);let a=o.top,l=o.right,c=o.bottom,u=o.left;for(let h=1;h<s.length;h++){const f=Qg(t,s[h],i);a=tr(f.top,a),l=Rr(f.right,l),c=Rr(f.bottom,c),u=tr(f.left,u)}return{width:l-u,height:c-a,x:u,y:a}}function DP(e){const{width:t,height:n}=Wb(e);return{width:t,height:n}}function NP(e,t,n){const r=Fr(t),i=ur(t),s=n==="fixed",o=mi(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=nr(0);if((r||!s)&&((Ps(t)!=="body"||Uc(i))&&(a=Kc(t)),r)){const u=mi(t,!0,s,t);l.x=u.x+t.clientLeft,l.y=u.y+t.clientTop}!r&&i&&(l.x=Gc(i));const c=i&&!r&&!s?qb(i,a):nr(0);return{x:o.left+a.scrollLeft-l.x-c.x,y:o.top+a.scrollTop-l.y-c.y,width:o.width,height:o.height}}function Yu(e){return Dn(e).position==="static"}function Yg(e,t){if(!Fr(e)||Dn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ur(e)===n&&(n=n.ownerDocument.body),n}function Kb(e,t){const n=yt(e);if(qc(e))return n;if(!Fr(e)){let i=pi(e);for(;i&&!Lo(i);){if(On(i)&&!Yu(i))return i;i=pi(i)}return n}let r=Yg(e,t);for(;r&&xP(r)&&Yu(r);)r=Yg(r,t);return r&&Lo(r)&&Yu(r)&&!Fp(r)?n:r||SP(e)||n}var LP=async function(e){const t=this.getOffsetParent||Kb,n=this.getDimensions,r=await n(e.floating);return{reference:NP(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _P(e){return Dn(e).direction==="rtl"}var jP={convertOffsetParentRelativeRectToViewportRelativeRect:AP,getDocumentElement:ur,getClippingRect:OP,getOffsetParent:Kb,getElementRects:LP,getClientRects:TP,getDimensions:DP,getScale:es,isElement:On,isRTL:_P};function Gb(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function BP(e,t,n){let r=null,i;const s=ur(e);function o(){var u;clearTimeout(i),(u=r)==null||u.disconnect(),r=null}function a(u,h){u===void 0&&(u=!1),h===void 0&&(h=1),o();const f=e.getBoundingClientRect(),{left:d,top:m,width:v,height:y}=f;if(u||t(),!v||!y)return;const x=Ha(m),b=Ha(s.clientWidth-(d+v)),w=Ha(s.clientHeight-(m+y)),S=Ha(d),C={rootMargin:-x+"px "+-b+"px "+-w+"px "+-S+"px",threshold:tr(0,Rr(1,h))||1};let A=!0;function k(E){const T=E[0].intersectionRatio;if(!Gb(f,e.getBoundingClientRect()))return a();if(T!==h){if(!A)return a();T?a(!1,T):i=setTimeout(()=>{a(!1,1e-7)},1e3)}A=!1}try{r=new IntersectionObserver(k,{...C,root:s.ownerDocument})}catch{r=new IntersectionObserver(k,C)}r.observe(e)}const l=yt(e),c=()=>a(n);return l.addEventListener("resize",c),a(!0),()=>{l.removeEventListener("resize",c),o()}}function FP(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=zp(e),u=i||s?[...c?_o(c):[],...t?_o(t):[]]:[];u.forEach(x=>{i&&x.addEventListener("scroll",n),s&&x.addEventListener("resize",n)});const h=c&&a?BP(c,n,s):null;let f=-1,d=null;o&&(d=new ResizeObserver(x=>{let[b]=x;b&&b.target===c&&d&&t&&(d.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=d)==null||w.observe(t)})),n()}),c&&!l&&d.observe(c),t&&d.observe(t));let m,v=l?mi(e):null;l&&y();function y(){const x=mi(e);v&&!Gb(v,x)&&n(),v=x,m=requestAnimationFrame(y)}return n(),()=>{var x;u.forEach(b=>{i&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),h?.(),(x=d)==null||x.disconnect(),d=null,l&&cancelAnimationFrame(m)}}var VP=mP,zP=gP,$P=fP,HP=yP,WP=dP,Xg=hP,UP=vP,qP=(e,t,n)=>{const r=new Map,i=n??{},s={...jP,...i.platform,_c:r};return uP(e,t,{...i,platform:s})},Tl=typeof document<"u"?g.useLayoutEffect:function(){};function cc(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!cc(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!cc(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Qb(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Jg(e,t){const n=Qb(e);return Math.round(t*n)/n}function Xu(e){const t=g.useRef(e);return Tl(()=>{t.current=e}),t}function KP(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,h]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,d]=g.useState(r);cc(f,r)||d(r);const[m,v]=g.useState(null),[y,x]=g.useState(null),b=g.useCallback($=>{$!==A.current&&(A.current=$,v($))},[]),w=g.useCallback($=>{$!==k.current&&(k.current=$,x($))},[]),S=s||m,C=o||y,A=g.useRef(null),k=g.useRef(null),E=g.useRef(u),T=l!=null,R=Xu(l),P=Xu(i),M=Xu(c),N=g.useCallback(()=>{if(!A.current||!k.current)return;const $={placement:t,strategy:n,middleware:f};P.current&&($.platform=P.current),qP(A.current,k.current,$).then(B=>{const D={...B,isPositioned:M.current!==!1};L.current&&!cc(E.current,D)&&(E.current=D,pa.flushSync(()=>{h(D)}))})},[f,t,n,P,M]);Tl(()=>{c===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,h($=>({...$,isPositioned:!1})))},[c]);const L=g.useRef(!1);Tl(()=>(L.current=!0,()=>{L.current=!1}),[]),Tl(()=>{if(S&&(A.current=S),C&&(k.current=C),S&&C){if(R.current)return R.current(S,C,N);N()}},[S,C,N,R,T]);const I=g.useMemo(()=>({reference:A,floating:k,setReference:b,setFloating:w}),[b,w]),_=g.useMemo(()=>({reference:S,floating:C}),[S,C]),j=g.useMemo(()=>{const $={position:n,left:0,top:0};if(!_.floating)return $;const B=Jg(_.floating,u.x),D=Jg(_.floating,u.y);return a?{...$,transform:"translate("+B+"px, "+D+"px)",...Qb(_.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:D}},[n,a,_.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:N,refs:I,elements:_,floatingStyles:j}),[u,N,I,_,j])}var GP=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Xg({element:r.current,padding:i}).fn(n):{}:r?Xg({element:r,padding:i}).fn(n):{}}}},QP=(e,t)=>{const n=VP(e);return{name:n.name,fn:n.fn,options:[e,t]}},YP=(e,t)=>{const n=zP(e);return{name:n.name,fn:n.fn,options:[e,t]}},XP=(e,t)=>({fn:UP(e).fn,options:[e,t]}),JP=(e,t)=>{const n=$P(e);return{name:n.name,fn:n.fn,options:[e,t]}},ZP=(e,t)=>{const n=HP(e);return{name:n.name,fn:n.fn,options:[e,t]}},eI=(e,t)=>{const n=WP(e);return{name:n.name,fn:n.fn,options:[e,t]}},tI=(e,t)=>{const n=GP(e);return{name:n.name,fn:n.fn,options:[e,t]}},nI=Object.defineProperty,rI=(e,t)=>nI(e,"name",{value:t,configurable:!0}),iI=g.forwardRef(rI(function(t,n){const{children:r,width:i=10,height:s=5,...o}=t;return(0,p.jsx)(Le.svg,{...o,ref:n,width:i,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?r:(0,p.jsx)("polygon",{points:"0,0 30,0 15,10"})})},"Arrow")),sI=iI,oI=Object.defineProperty,rr=(e,t)=>oI(e,"name",{value:t,configurable:!0}),Yb="Popper",[Xb,Qc]=cr(Yb),[aI,Jb]=Xb(Yb),lI=rr(e=>{const{__scopePopper:t,children:n}=e,[r,i]=g.useState(null),[s,o]=g.useState(void 0);return(0,p.jsx)(aI,{scope:t,anchor:r,onAnchorChange:i,placementState:s,setPlacementState:o,children:n})},"Popper"),cI="PopperAnchor",uI=g.forwardRef(rr(function(t,n){const{__scopePopper:r,virtualRef:i,...s}=t,o=Jb(cI,r),a=g.useRef(null),l=o.onAnchorChange,c=g.useCallback(v=>{a.current=v,v&&l(v)},[l]),u=Ce(n,c),h=g.useRef(null);g.useEffect(()=>{if(!i)return;const v=h.current;h.current=i.current,v!==h.current&&l(h.current)});const f=o.placementState&&Yc(o.placementState),d=f?.[0],m=f?.[1];return i?null:(0,p.jsx)(Le.div,{"data-radix-popper-side":d,"data-radix-popper-align":m,...s,ref:u})},"PopperAnchor")),Zb="PopperContent",[hI,fI]=Xb(Zb),dI=g.forwardRef(rr(function(t,n){const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:o="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:h=0,sticky:f="partial",hideWhenDetached:d=!1,updatePositionStrategy:m="optimized",onPlaced:v,...y}=t,x=Jb(Zb,r),[b,w]=g.useState(null),S=Ce(n,w),[C,A]=g.useState(null),k=Bb(C),E=k?.width??0,T=k?.height??0,R=i+(o!=="center"?"-"+o:""),P=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},M=Array.isArray(u)?u:[u],N=M.length>0,L={padding:P,boundary:M.filter(ew),altBoundary:N},{refs:I,floatingStyles:_,placement:j,isPositioned:$,middlewareData:B}=KP({strategy:"fixed",placement:R,whileElementsMounted:rr((...oe)=>FP(...oe,{animationFrame:m==="always"}),"whileElementsMounted"),elements:{reference:x.anchor},middleware:[QP({mainAxis:s+T,alignmentAxis:a}),c&&YP({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?XP():void 0,...L}),c&&JP({...L}),ZP({...L,apply:rr(({elements:oe,rects:pe,availableWidth:ae,availableHeight:at})=>{const{width:et,height:Re}=pe.reference,ze=oe.floating.style;ze.setProperty("--radix-popper-available-width",`${ae}px`),ze.setProperty("--radix-popper-available-height",`${at}px`),ze.setProperty("--radix-popper-anchor-width",`${et}px`),ze.setProperty("--radix-popper-anchor-height",`${Re}px`)},"apply")}),C&&tI({element:C,padding:l}),vI({arrowWidth:E,arrowHeight:T}),d&&eI({strategy:"referenceHidden",...L,boundary:N?L.boundary:void 0})]}),D=x.setPlacementState;Rt(()=>(D(j),()=>{D(void 0)}),[j,D]);const[se,ne]=Yc(j),F=Je(v);Rt(()=>{$&&F?.()},[$,F]);const q=B.arrow?.x,K=B.arrow?.y,Y=B.arrow?.centerOffset!==0,[H,X]=g.useState();return Rt(()=>{b&&X(window.getComputedStyle(b).zIndex)},[b]),(0,p.jsx)("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{..._,transform:$?_.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,p.jsx)(hI,{scope:r,placedSide:se,placedAlign:ne,onArrowChange:A,arrowX:q,arrowY:K,shouldHideArrow:Y,children:(0,p.jsx)(Le.div,{"data-side":se,"data-align":ne,...y,ref:S,style:{...y.style,animation:$?y.style?.animation:"none"}})})})},"PopperContent")),pI="PopperArrow",mI={top:"bottom",right:"left",bottom:"top",left:"right"},gI=g.forwardRef(rr(function(t,n){const{__scopePopper:r,...i}=t,s=fI(pI,r),o=mI[s.placedSide];return(0,p.jsx)("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:(0,p.jsx)(sI,{...i,ref:n,style:{...i.style,display:"block"}})})},"PopperArrow"));function ew(e){return e!==null}rr(ew,"isNotNull");var vI=rr(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:i}=t,s=i.arrow?.centerOffset!==0,o=s?0:e.arrowWidth,a=s?0:e.arrowHeight,[l,c]=Yc(n),u={start:"0%",center:"50%",end:"100%"}[c],h=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+a/2;let d="",m="";return l==="bottom"?(d=s?u:`${h}px`,m=`${-a}px`):l==="top"?(d=s?u:`${h}px`,m=`${r.floating.height+a}px`):l==="right"?(d=`${-a}px`,m=s?u:`${f}px`):l==="left"&&(d=`${r.floating.width+a}px`,m=s?u:`${f}px`),{data:{x:d,y:m}}}}),"transformOrigin");function Yc(e){const[t,n="center"]=e.split("-");return[t,n]}rr(Yc,"getSideAndAlignFromPlacement");var $p=lI,tw=uI,nw=dI,yI=gI,xI=Object.defineProperty,Hp=(e,t)=>xI(e,"name",{value:t,configurable:!0}),Ju=!1;function rw(){const[e,t]=g.useState(Ju);return g.useEffect(()=>{Ju||(Ju=!0,t(!0))},[]),e}Hp(rw,"useIsHydrated");var iw=g[" useSyncExternalStore ".trim().toString()];function sw(){return()=>{}}Hp(sw,"subscribe");function ow(){return iw(sw,()=>!0,()=>!1)}Hp(ow,"useIsHydratedModern");var bI=typeof iw=="function"?ow:rw,wI=Object.defineProperty,Si=(e,t)=>wI(e,"name",{value:t,configurable:!0}),Zu="rovingFocusGroup.onEntryFocus",SI={bubbles:!1,cancelable:!0},Xc="RovingFocusGroup",[wf,aw,kI]=Pp(Xc),[CI,lw]=cr(Xc,[kI]),[AI,TI]=CI(Xc),EI=g.forwardRef(Si(function(t,n){return(0,p.jsx)(wf.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,p.jsx)(wf.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,p.jsx)(MI,{...t,ref:n})})})},"RovingFocusGroup")),MI=g.forwardRef(Si(function(t,n){const{__scopeRovingFocusGroup:r,orientation:i,loop:s=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:h=!1,...f}=t,d=g.useRef(null),m=Ce(n,d),v=$c(o),[y,x]=ga({prop:a,defaultProp:l??null,onChange:c,caller:Xc}),[b,w]=g.useState(!1),S=Je(u),C=aw(r),A=g.useRef(!1),[k,E]=g.useState(0);return g.useEffect(()=>{const T=d.current;if(T)return T.addEventListener(Zu,S),()=>T.removeEventListener(Zu,S)},[S]),(0,p.jsx)(AI,{scope:r,orientation:i,dir:v,loop:s,currentTabStopId:y,onItemFocus:g.useCallback(T=>x(T),[x]),onItemShiftTab:g.useCallback(()=>w(!0),[]),onFocusableItemAdd:g.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:g.useCallback(()=>E(T=>T-1),[]),children:(0,p.jsx)(Le.div,{tabIndex:b||k===0?-1:0,"data-orientation":i,...f,ref:m,style:{outline:"none",...t.style},onMouseDown:te(t.onMouseDown,()=>{A.current=!0}),onFocus:te(t.onFocus,T=>{const R=!A.current;if(T.target===T.currentTarget&&R&&!b){const P=new CustomEvent(Zu,SI);if(T.currentTarget.dispatchEvent(P),!P.defaultPrevented){const M=C().filter(N=>N.focusable);Wp([M.find(N=>N.active),M.find(N=>N.id===y),...M].filter(Boolean).map(N=>N.ref.current),h)}}A.current=!1}),onBlur:te(t.onBlur,()=>w(!1))})})},"RovingFocusGroupImpl")),RI="RovingFocusGroupItem",PI=g.forwardRef(Si(function(t,n){const{__scopeRovingFocusGroup:r,focusable:i=!0,active:s=!1,tabStopId:o,children:a,...l}=t,c=di(),u=o||c,h=TI(RI,r),f=h.currentTabStopId===u,d=aw(r),{onFocusableItemAdd:m,onFocusableItemRemove:v,currentTabStopId:y}=h,x=bI();return Rt(()=>{if(!(!x||!i))return m(),()=>v()},[x,i,m,v]),g.useEffect(()=>{if(!(x||!i))return m(),()=>v()},[x,i,m,v]),(0,p.jsx)(wf.ItemSlot,{scope:r,id:u,focusable:i,active:s,children:(0,p.jsx)(Le.span,{tabIndex:f?0:-1,"data-orientation":h.orientation,...l,ref:n,onMouseDown:te(t.onMouseDown,b=>{i?h.onItemFocus(u):b.preventDefault()}),onFocus:te(t.onFocus,()=>h.onItemFocus(u)),onKeyDown:te(t.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){h.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const w=uw(b,h.orientation,h.dir);if(w!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let S=d().filter(C=>C.focusable).map(C=>C.ref.current);if(w==="last")S.reverse();else if(w==="prev"||w==="next"){w==="prev"&&S.reverse();const C=S.indexOf(b.currentTarget);S=h.loop?hw(S,C+1):S.slice(C+1)}setTimeout(()=>Wp(S))}}),children:typeof a=="function"?a({isCurrentTabStop:f,hasTabStop:y!=null}):a})})},"RovingFocusGroupItem")),II={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function cw(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Si(cw,"getDirectionAwareKey");function uw(e,t,n){const r=cw(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return II[r]}Si(uw,"getFocusIntent");function Wp(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}Si(Wp,"focusFirst");function hw(e,t){return e.map((n,r)=>e[(t+r)%e.length])}Si(hw,"wrapArray");var OI=EI,DI=PI,NI=Object.defineProperty,de=(e,t)=>NI(e,"name",{value:t,configurable:!0}),Sf=["Enter"," "],LI=["ArrowDown","PageUp","Home"],fw=["ArrowUp","PageDown","End"],_I=[...LI,...fw],jI={ltr:[...Sf,"ArrowRight"],rtl:[...Sf,"ArrowLeft"]},BI={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Jc="Menu",[jo,FI,VI]=Pp(Jc),[ki,dw]=cr(Jc,[VI,Qc,lw]),Zc=Qc(),pw=lw(),[mw,Vr]=ki(Jc),[zI,va]=ki(Jc),$I=de(e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,a=Zc(t),[l,c]=g.useState(null),u=g.useRef(!1),h=Je(s),f=$c(i);return g.useEffect(()=>{const d=de(()=>{u.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},"handleKeyDown"),m=de(()=>u.current=!1,"handlePointer");return document.addEventListener("keydown",d,{capture:!0}),()=>{document.removeEventListener("keydown",d,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),g.useEffect(()=>{if(!n)return;const d=de(()=>h(!1),"handleBlur");return window.addEventListener("blur",d),()=>window.removeEventListener("blur",d)},[n,h]),(0,p.jsx)($p,{...a,children:(0,p.jsx)(mw,{scope:t,open:n,onOpenChange:h,content:l,onContentChange:c,children:(0,p.jsx)(zI,{scope:t,onClose:g.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},"Menu"),gw=g.forwardRef(de(function(t,n){const{__scopeMenu:r,...i}=t,s=Zc(r);return(0,p.jsx)(tw,{...s,...i,ref:n})},"MenuAnchor")),vw="MenuPortal",[HI,yw]=ki(vw,{forceMount:void 0}),WI=de(e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Vr(vw,t);return(0,p.jsx)(HI,{scope:t,forceMount:n,children:(0,p.jsx)(Ln,{present:n||s.open,children:(0,p.jsx)(Mb,{asChild:!0,container:i,children:r})})})},"MenuPortal"),en="MenuContent",[UI,Up]=ki(en),qI=g.forwardRef(de(function(t,n){const r=yw(en,t.__scopeMenu),{forceMount:i=r.forceMount,...s}=t,o=Vr(en,t.__scopeMenu),a=va(en,t.__scopeMenu);return(0,p.jsx)(jo.Provider,{scope:t.__scopeMenu,children:(0,p.jsx)(Ln,{present:i||o.open,children:(0,p.jsx)(jo.Slot,{scope:t.__scopeMenu,children:a.modal?(0,p.jsx)(KI,{...s,ref:n}):(0,p.jsx)(GI,{...s,ref:n})})})})},"MenuContent")),KI=g.forwardRef(de(function(t,n){const r=Vr(en,t.__scopeMenu),i=g.useRef(null),s=Ce(n,i);return g.useEffect(()=>{const o=i.current;if(o)return YR(o)},[]),(0,p.jsx)(qp,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:te(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),GI=g.forwardRef(de(function(t,n){const r=Vr(en,t.__scopeMenu);return(0,p.jsx)(qp,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),QI=cs("MenuContent.ScrollLock"),qp=g.forwardRef(de(function(t,n){const{__scopeMenu:r,loop:i=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:d,onDismiss:m,disableOutsideScroll:v,...y}=t,x=Vr(en,r),b=va(en,r),w=Zc(r),S=pw(r),C=FI(r),[A,k]=g.useState(null),E=g.useRef(null),T=Ce(n,E,x.onContentChange),R=g.useRef(0),P=g.useRef(""),M=g.useRef(0),N=g.useRef(null),L=g.useRef("right"),I=g.useRef(0),_=v?_b:g.Fragment,j=v?{as:QI,allowPinchZoom:!0}:void 0,$=de(D=>{const se=P.current+D,ne=C().filter(H=>!H.disabled),F=document.activeElement,q=ne.find(H=>H.ref.current===F)?.textValue,K=Tw(ne.map(H=>H.textValue),se,q),Y=ne.find(H=>H.textValue===K)?.ref.current;de((function H(X){P.current=X,window.clearTimeout(R.current),X!==""&&(R.current=window.setTimeout(()=>H(""),1e3))}),"updateSearch")(se),Y&&setTimeout(()=>Y.focus())},"handleTypeaheadSearch");g.useEffect(()=>()=>window.clearTimeout(R.current),[]),Lp();const B=g.useCallback(D=>L.current===N.current?.side&&Mw(D,N.current?.area),[]);return(0,p.jsx)(UI,{scope:r,searchRef:P,onItemEnter:g.useCallback(D=>{B(D)&&D.preventDefault()},[B]),onItemLeave:g.useCallback(D=>{B(D)||(E.current?.focus(),k(null))},[B]),onTriggerLeave:g.useCallback(D=>{B(D)&&D.preventDefault()},[B]),pointerGraceTimerRef:M,onPointerGraceIntentChange:g.useCallback(D=>{N.current=D},[]),children:(0,p.jsx)(_,{...j,children:(0,p.jsx)(oR,{asChild:!0,trapped:s,onMountAutoFocus:te(o,D=>{D.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,p.jsx)(xb,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:h,onFocusOutside:f,onInteractOutside:d,onDismiss:m,children:(0,p.jsx)(OI,{asChild:!0,...S,dir:b.dir,orientation:"vertical",loop:i,currentTabStopId:A,onCurrentTabStopIdChange:k,onEntryFocus:te(c,D=>{b.isUsingKeyboardRef.current||D.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,p.jsx)(nw,{role:"menu","aria-orientation":"vertical","data-state":Gp(x.open),"data-radix-menu-content":"",dir:b.dir,...w,...y,ref:T,style:{outline:"none",...y.style},onKeyDown:te(y.onKeyDown,D=>{const se=D.target.closest("[data-radix-menu-content]")===D.currentTarget,ne=D.ctrlKey||D.altKey||D.metaKey,F=D.key.length===1;se&&(D.key==="Tab"&&D.preventDefault(),!ne&&F&&$(D.key));const q=E.current;if(D.target!==q||!_I.includes(D.key))return;D.preventDefault();const K=C().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);fw.includes(D.key)&&K.reverse(),Cw(K)}),onBlur:te(t.onBlur,D=>{D.currentTarget.contains(D.target)||(window.clearTimeout(R.current),P.current="")}),onPointerMove:te(t.onPointerMove,us(D=>{const se=D.target,ne=I.current!==D.clientX;if(D.currentTarget.contains(se)&&ne){const F=D.clientX>I.current?"right":"left";L.current=F,I.current=D.clientX}}))})})})})})})},"MenuContentImpl")),YI=g.forwardRef(de(function(t,n){const{__scopeMenu:r,...i}=t;return(0,p.jsx)(Le.div,{role:"group",...i,ref:n})},"MenuGroup")),XI=g.forwardRef(de(function(t,n){const{__scopeMenu:r,...i}=t;return(0,p.jsx)(Le.div,{...i,ref:n})},"MenuLabel")),kf="MenuItem",Zg="menu.itemSelect",Kp=g.forwardRef(de(function(t,n){const{disabled:r=!1,onSelect:i,...s}=t,o=g.useRef(null),a=va(kf,t.__scopeMenu),l=Up(kf,t.__scopeMenu),c=Ce(n,o),u=g.useRef(!1),h=de(()=>{const f=o.current;if(!r&&f){const d=new CustomEvent(Zg,{bubbles:!0,cancelable:!0});f.addEventListener(Zg,m=>i?.(m),{once:!0}),Rp(f,d),d.defaultPrevented?u.current=!1:a.onClose()}},"handleSelect");return(0,p.jsx)(xw,{...s,ref:c,disabled:r,onClick:te(t.onClick,h),onPointerDown:f=>{t.onPointerDown?.(f),u.current=!0},onPointerUp:te(t.onPointerUp,f=>{u.current||f.currentTarget?.click()}),onKeyDown:te(t.onKeyDown,f=>{r||f.target!==f.currentTarget||l.searchRef.current!==""&&f.key===" "||Sf.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})},"MenuItem")),xw=g.forwardRef(de(function(t,n){const{__scopeMenu:r,disabled:i=!1,textValue:s,...o}=t,a=Up(kf,r),l=pw(r),c=g.useRef(null),u=Ce(n,c),[h,f]=g.useState(!1),[d,m]=g.useState("");return g.useEffect(()=>{const v=c.current;v&&m((v.textContent??"").trim())},[o.children]),(0,p.jsx)(jo.ItemSlot,{scope:r,disabled:i,textValue:s??d,children:(0,p.jsx)(DI,{asChild:!0,...l,focusable:!i,children:(0,p.jsx)(Le.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...o,ref:u,onPointerMove:te(t.onPointerMove,us(v=>{i?a.onItemLeave(v):(a.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:te(t.onPointerLeave,us(v=>a.onItemLeave(v))),onFocus:te(t.onFocus,()=>f(!0)),onBlur:te(t.onBlur,()=>f(!1))})})})},"MenuItemImpl")),JI=g.forwardRef(de(function(t,n){const{checked:r=!1,onCheckedChange:i,...s}=t;return(0,p.jsx)(ww,{scope:t.__scopeMenu,checked:r,children:(0,p.jsx)(Kp,{role:"menuitemcheckbox","aria-checked":Bo(r)?"mixed":r,...s,ref:n,"data-state":eu(r),onSelect:te(s.onSelect,()=>i?.(Bo(r)?!0:!r),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),[ZI,eO]=ki("MenuRadioGroup",{value:void 0,onValueChange:de(()=>{},"onValueChange")}),tO=g.forwardRef(de(function(t,n){const{value:r,onValueChange:i,...s}=t,o=Je(i);return(0,p.jsx)(ZI,{scope:t.__scopeMenu,value:r,onValueChange:o,children:(0,p.jsx)(YI,{...s,ref:n})})},"MenuRadioGroup")),nO="MenuRadioItem",rO=g.forwardRef(de(function(t,n){const{value:r,...i}=t,s=eO(nO,t.__scopeMenu),o=r===s.value;return(0,p.jsx)(ww,{scope:t.__scopeMenu,checked:o,children:(0,p.jsx)(Kp,{role:"menuitemradio","aria-checked":o,...i,ref:n,"data-state":eu(o),onSelect:te(i.onSelect,()=>s.onValueChange?.(r),{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),bw="MenuItemIndicator",[ww,iO]=ki(bw,{checked:!1}),sO=g.forwardRef(de(function(t,n){const{__scopeMenu:r,forceMount:i,...s}=t,o=iO(bw,r);return(0,p.jsx)(Ln,{present:i||Bo(o.checked)||o.checked===!0,children:(0,p.jsx)(Le.span,{...s,ref:n,"data-state":eu(o.checked)})})},"MenuItemIndicator")),oO=g.forwardRef(de(function(t,n){const{__scopeMenu:r,...i}=t;return(0,p.jsx)(Le.div,{role:"separator","aria-orientation":"horizontal",...i,ref:n})},"MenuSeparator")),Sw="MenuSub",[aO,kw]=ki(Sw),lO=de(e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,s=Vr(Sw,t),o=Zc(t),[a,l]=g.useState(null),[c,u]=g.useState(null),h=Je(i);return g.useEffect(()=>(s.open===!1&&h(!1),()=>h(!1)),[s.open,h]),(0,p.jsx)($p,{...o,children:(0,p.jsx)(mw,{scope:t,open:r,onOpenChange:h,content:c,onContentChange:u,children:(0,p.jsx)(aO,{scope:t,contentId:di(),triggerId:di(),trigger:a,onTriggerChange:l,children:n})})})},"MenuSub"),Wa="MenuSubTrigger",cO=g.forwardRef(de(function(t,n){const r=Vr(Wa,t.__scopeMenu),i=va(Wa,t.__scopeMenu),s=kw(Wa,t.__scopeMenu),o=Up(Wa,t.__scopeMenu),a=g.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=o,u={__scopeMenu:t.__scopeMenu},h=g.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);g.useEffect(()=>h,[h]),g.useEffect(()=>{const d=l.current;return()=>{window.clearTimeout(d),c(null)}},[l,c]);const f=Ce(n,s.onTriggerChange);return(0,p.jsx)(gw,{asChild:!0,...u,children:(0,p.jsx)(xw,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?s.contentId:void 0,"data-state":Gp(r.open),...t,ref:f,onClick:d=>{t.onClick?.(d),!(t.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:te(t.onPointerMove,us(d=>{o.onItemEnter(d),!d.defaultPrevented&&!t.disabled&&!r.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),h()},100))})),onPointerLeave:te(t.onPointerLeave,us(d=>{h();const m=r.content?.getBoundingClientRect();if(m){const v=r.content?.dataset.side,y=v==="right",x=y?-5:5,b=m[y?"left":"right"],w=m[y?"right":"left"];o.onPointerGraceIntentChange({area:[{x:d.clientX+x,y:d.clientY},{x:b,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x:b,y:m.bottom}],side:v}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(d),d.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:te(t.onKeyDown,d=>{t.disabled||d.target!==d.currentTarget||o.searchRef.current!==""&&d.key===" "||jI[i.dir].includes(d.key)&&(r.onOpenChange(!0),r.content?.focus(),d.preventDefault())})})})},"MenuSubTrigger")),uO="MenuSubContent",hO=g.forwardRef(de(function(t,n){const r=yw(en,t.__scopeMenu),{forceMount:i=r.forceMount,align:s="start",...o}=t,a=Vr(en,t.__scopeMenu),l=va(en,t.__scopeMenu),c=kw(uO,t.__scopeMenu),u=g.useRef(null),h=Ce(n,u);return(0,p.jsx)(jo.Provider,{scope:t.__scopeMenu,children:(0,p.jsx)(Ln,{present:i||a.open,children:(0,p.jsx)(jo.Slot,{scope:t.__scopeMenu,children:(0,p.jsx)(qp,{id:c.contentId,"aria-labelledby":c.triggerId,...o,ref:h,align:s,side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{l.isUsingKeyboardRef.current&&u.current?.focus(),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:te(t.onFocusOutside,f=>{f.target!==c.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:te(t.onEscapeKeyDown,f=>{l.onClose(),f.preventDefault()}),onKeyDown:te(t.onKeyDown,f=>{const d=f.currentTarget.contains(f.target),m=BI[l.dir].includes(f.key);d&&m&&(a.onOpenChange(!1),c.trigger?.focus(),f.preventDefault())})})})})})},"MenuSubContent"));function Gp(e){return e?"open":"closed"}de(Gp,"getOpenState");function Bo(e){return e==="indeterminate"}de(Bo,"isIndeterminate");function eu(e){return Bo(e)?"indeterminate":e?"checked":"unchecked"}de(eu,"getCheckedState");function Cw(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}de(Cw,"focusFirst");function Aw(e,t){return e.map((n,r)=>e[(t+r)%e.length])}de(Aw,"wrapArray");function Tw(e,t,n){const r=t.length>1&&Array.from(t).every(a=>a===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=Aw(e,Math.max(i,0));r.length===1&&(s=s.filter(a=>a!==n));const o=s.find(a=>a.toLowerCase().startsWith(r.toLowerCase()));return o!==n?o:void 0}de(Tw,"getNextMatch");function Ew(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],l=t[o],c=a.x,u=a.y,h=l.x,f=l.y;u>r!=f>r&&n<(h-c)*(r-u)/(f-u)+c&&(i=!i)}return i}de(Ew,"isPointInPolygon");function Mw(e,t){return t?Ew({x:e.clientX,y:e.clientY},t):!1}de(Mw,"isPointerInGraceArea");function us(e){return t=>t.pointerType==="mouse"?e(t):void 0}de(us,"whenMouse");var fO=$I,dO=gw,pO=WI,mO=qI,gO=XI,vO=Kp,yO=JI,xO=tO,bO=rO,wO=sO,SO=oO,kO=lO,CO=cO,AO=hO,TO=Object.defineProperty,xt=(e,t)=>TO(e,"name",{value:t,configurable:!0}),Qp="DropdownMenu",[EO,g6]=cr(Qp,[dw]),bt=dw(),[MO,Rw]=EO(Qp),RO=xt(e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,l=bt(t),c=g.useRef(null),[u,h]=ga({prop:i,defaultProp:s??!1,onChange:o,caller:Qp});return(0,p.jsx)(MO,{scope:t,triggerId:di(),triggerRef:c,contentId:di(),open:u,onOpenChange:h,onOpenToggle:g.useCallback(()=>h(f=>!f),[h]),modal:a,children:(0,p.jsx)(fO,{...l,open:u,onOpenChange:h,dir:r,modal:a,children:n})})},"DropdownMenu"),PO="DropdownMenuTrigger",IO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,disabled:i=!1,...s}=t,o=Rw(PO,r),a=bt(r),l=Ce(n,o.triggerRef);return(0,p.jsx)(dO,{asChild:!0,...a,children:(0,p.jsx)(Le.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":i?"":void 0,disabled:i,...s,ref:l,onPointerDown:te(t.onPointerDown,c=>{!i&&c.button===0&&c.ctrlKey===!1&&(o.onOpenToggle(),o.open||c.preventDefault())}),onKeyDown:te(t.onKeyDown,c=>{i||(["Enter"," "].includes(c.key)&&o.onOpenToggle(),c.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})},"DropdownMenuTrigger")),OO=xt(e=>{const{__scopeDropdownMenu:t,...n}=e,r=bt(t);return(0,p.jsx)(pO,{...r,...n})},"DropdownMenuPortal"),DO="DropdownMenuContent",NO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=Rw(DO,r),o=bt(r),a=g.useRef(!1);return(0,p.jsx)(mO,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...i,ref:n,onCloseAutoFocus:te(t.onCloseAutoFocus,l=>{a.current||s.triggerRef.current?.focus(),a.current=!1,l.preventDefault()}),onInteractOutside:te(t.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,h=c.button===2||u;(!s.modal||h)&&(a.current=!0)}),style:{...t.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)"}})},"DropdownMenuContent")),LO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(gO,{...s,...i,ref:n})},"DropdownMenuLabel")),_O=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(vO,{...s,...i,ref:n})},"DropdownMenuItem")),jO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(yO,{...s,...i,ref:n})},"DropdownMenuCheckboxItem")),BO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(xO,{...s,...i,ref:n})},"DropdownMenuRadioGroup")),FO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(bO,{...s,...i,ref:n})},"DropdownMenuRadioItem")),VO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(wO,{...s,...i,ref:n})},"DropdownMenuItemIndicator")),zO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(SO,{...s,...i,ref:n})},"DropdownMenuSeparator")),$O=xt(e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:s}=e,o=bt(t),[a,l]=ga({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return(0,p.jsx)(kO,{...o,open:a,onOpenChange:l,children:n})},"DropdownMenuSub"),HO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(CO,{...s,...i,ref:n})},"DropdownMenuSubTrigger")),WO=g.forwardRef(xt(function(t,n){const{__scopeDropdownMenu:r,...i}=t,s=bt(r);return(0,p.jsx)(AO,{...s,...i,ref:n,style:{...t.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)"}})},"DropdownMenuSubContent")),UO=RO,qO=IO,KO=OO,GO=NO,QO=LO,YO=_O,XO=jO,JO=BO,ZO=FO,Pw=VO,eD=zO,tD=$O,nD=HO,rD=WO,iD=Object.defineProperty,sD=(e,t)=>iD(e,"name",{value:t,configurable:!0});function Iw(e,[t,n]){return Math.min(n,Math.max(t,e))}sD(Iw,"clamp");var oD=Object.defineProperty,he=(e,t)=>oD(e,"name",{value:t,configurable:!0});function Ow(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}he(Ow,"useStateMachine");var Dw="ScrollArea",[Nw,v6]=cr(Dw),[aD,Ft]=Nw(Dw),lD=g.forwardRef(he(function(t,n){const{__scopeScrollArea:r,type:i="hover",dir:s,scrollHideDelay:o=600,...a}=t,[l,c]=g.useState(null),[u,h]=g.useState(null),[f,d]=g.useState(null),[m,v]=g.useState(null),[y,x]=g.useState(null),[b,w]=g.useState(0),[S,C]=g.useState(0),[A,k]=g.useState(!1),[E,T]=g.useState(!1),R=Ce(n,c),P=$c(s);return(0,p.jsx)(aD,{scope:r,type:i,dir:P,scrollHideDelay:o,scrollArea:l,viewport:u,onViewportChange:h,content:f,onContentChange:d,scrollbarX:m,onScrollbarXChange:v,scrollbarXEnabled:A,onScrollbarXEnabledChange:k,scrollbarY:y,onScrollbarYChange:x,scrollbarYEnabled:E,onScrollbarYEnabledChange:T,onCornerWidthChange:w,onCornerHeightChange:C,children:(0,p.jsx)(Le.div,{dir:P,...a,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":S+"px",...t.style}})})},"ScrollArea")),cD="ScrollAreaViewport",uD=g.forwardRef(he(function(t,n){const{__scopeScrollArea:r,children:i,nonce:s,...o}=t,a=Ft(cD,r),l=g.useRef(null),c=Ce(n,l,a.onViewportChange);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(hD,{nonce:s}),(0,p.jsx)(Le.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:(0,p.jsx)("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:i})})]})},"ScrollAreaViewport")),hD=g.memo(he(function({nonce:t}){return(0,p.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t})},"ScrollAreaViewportStyle"),(e,t)=>e.nonce===t.nonce),hr="ScrollAreaScrollbar",fD=g.forwardRef(he(function(t,n){const{forceMount:r,...i}=t,s=Ft(hr,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:a}=s,l=t.orientation==="horizontal";return g.useEffect(()=>(l?o(!0):a(!0),()=>{l?o(!1):a(!1)}),[l,o,a]),s.type==="hover"?(0,p.jsx)(dD,{...i,ref:n,forceMount:r}):s.type==="scroll"?(0,p.jsx)(pD,{...i,ref:n,forceMount:r}):s.type==="auto"?(0,p.jsx)(Lw,{...i,ref:n,forceMount:r}):s.type==="always"?(0,p.jsx)(Yp,{...i,ref:n,"data-state":"visible"}):null},"ScrollAreaScrollbar")),dD=g.forwardRef(he(function(t,n){const{forceMount:r,...i}=t,s=Ft(hr,t.__scopeScrollArea),[o,a]=g.useState(!1);return g.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const u=he(()=>{window.clearTimeout(c),a(!0)},"handlePointerEnter"),h=he(()=>{c=window.setTimeout(()=>a(!1),s.scrollHideDelay)},"handlePointerLeave");return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",h),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",h)}}},[s.scrollArea,s.scrollHideDelay]),(0,p.jsx)(Ln,{present:r||o,children:(0,p.jsx)(Lw,{"data-state":o?"visible":"hidden",...i,ref:n})})},"ScrollAreaScrollbarHover")),pD=g.forwardRef(he(function(t,n){const{forceMount:r,...i}=t,s=Ft(hr,t.__scopeScrollArea),o=t.orientation==="horizontal",a=xa(()=>c("SCROLL_END"),100),[l,c]=Ow("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,s.scrollHideDelay,c]),g.useEffect(()=>{const u=s.viewport,h=o?"scrollLeft":"scrollTop";if(u){let f=u[h];const d=he(()=>{const m=u[h];f!==m&&(c("SCROLL"),a()),f=m},"handleScroll");return u.addEventListener("scroll",d),()=>u.removeEventListener("scroll",d)}},[s.viewport,o,c,a]),(0,p.jsx)(Ln,{present:r||l!=="hidden",children:(0,p.jsx)(Yp,{"data-state":l==="hidden"?"hidden":"visible",...i,ref:n,onPointerEnter:te(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:te(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})},"ScrollAreaScrollbarScroll")),Lw=g.forwardRef(he(function(t,n){const r=Ft(hr,t.__scopeScrollArea),{forceMount:i,...s}=t,[o,a]=g.useState(!1),l=t.orientation==="horizontal",c=xa(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,h=r.viewport.offsetHeight<r.viewport.scrollHeight;a(l?u:h)}},10);return gi(r.viewport,c),gi(r.content,c),(0,p.jsx)(Ln,{present:i||o,children:(0,p.jsx)(Yp,{"data-state":o?"visible":"hidden",...s,ref:n})})},"ScrollAreaScrollbarAuto")),Yp=g.forwardRef(he(function(t,n){const{orientation:r="vertical",...i}=t,s=Ft(hr,t.__scopeScrollArea),o=g.useRef(null),a=g.useRef(0),[l,c]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Xp(l.viewport,l.content),h={...i,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:he(d=>o.current=d,"onThumbChange"),onThumbPointerUp:he(()=>a.current=0,"onThumbPointerUp"),onThumbPointerDown:he(d=>a.current=d,"onThumbPointerDown")};function f(d,m){return Fw(d,a.current,l,m)}return he(f,"getScrollPosition"),r==="horizontal"?(0,p.jsx)(mD,{...h,ref:n,onThumbPositionChange:()=>{if(s.viewport&&o.current){const d=s.viewport.scrollLeft,m=Af(d,l,s.dir);o.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:d=>{s.viewport&&(s.viewport.scrollLeft=d)},onDragScroll:d=>{s.viewport&&(s.viewport.scrollLeft=f(d,s.dir))}}):r==="vertical"?(0,p.jsx)(gD,{...h,ref:n,onThumbPositionChange:()=>{if(s.viewport&&o.current){const d=s.viewport.scrollTop,m=Af(d,l);o.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:d=>{s.viewport&&(s.viewport.scrollTop=d)},onDragScroll:d=>{s.viewport&&(s.viewport.scrollTop=f(d))}}):null},"ScrollAreaScrollbarVisible")),mD=g.forwardRef(he(function(t,n){const{sizes:r,onSizesChange:i,...s}=t,o=Ft(hr,t.__scopeScrollArea),[a,l]=g.useState(),c=g.useRef(null),u=Ce(n,c,o.onScrollbarXChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),(0,p.jsx)(jw,{"data-orientation":"horizontal",...s,ref:u,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ya(r)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.x),onDragScroll:h=>t.onDragScroll(h.x),onWheelScroll:(h,f)=>{if(o.viewport){const d=o.viewport.scrollLeft+h.deltaX;t.onWheelScroll(d),Zp(d,f)&&h.preventDefault()}},onResize:()=>{c.current&&o.viewport&&a&&i({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Fo(a.paddingLeft),paddingEnd:Fo(a.paddingRight)}})}})},"ScrollAreaScrollbarX")),gD=g.forwardRef(he(function(t,n){const{sizes:r,onSizesChange:i,...s}=t,o=Ft(hr,t.__scopeScrollArea),[a,l]=g.useState(),c=g.useRef(null),u=Ce(n,c,o.onScrollbarYChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),(0,p.jsx)(jw,{"data-orientation":"vertical",...s,ref:u,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ya(r)+"px",...t.style},onThumbPointerDown:h=>t.onThumbPointerDown(h.y),onDragScroll:h=>t.onDragScroll(h.y),onWheelScroll:(h,f)=>{if(o.viewport){const d=o.viewport.scrollTop+h.deltaY;t.onWheelScroll(d),Zp(d,f)&&h.preventDefault()}},onResize:()=>{c.current&&o.viewport&&a&&i({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Fo(a.paddingTop),paddingEnd:Fo(a.paddingBottom)}})}})},"ScrollAreaScrollbarY")),[vD,_w]=Nw(hr),jw=g.forwardRef(he(function(t,n){const{__scopeScrollArea:r,sizes:i,hasThumb:s,onThumbChange:o,onThumbPointerUp:a,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:h,onResize:f,...d}=t,m=Ft(hr,r),[v,y]=g.useState(null),x=Ce(n,y),b=g.useRef(null),w=g.useRef(""),S=m.viewport,C=i.content-i.viewport,A=Je(h),k=Je(c),E=xa(f,10);function T(R){if(b.current){const P=R.clientX-b.current.left,M=R.clientY-b.current.top;u({x:P,y:M})}}return he(T,"handleDragScroll"),g.useEffect(()=>{const R=he(P=>{const M=P.target;v?.contains(M)&&A(P,C)},"handleWheel");return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[S,v,C,A]),g.useEffect(k,[i,k]),gi(v,E),gi(m.content,E),(0,p.jsx)(vD,{scope:r,scrollbar:v,hasThumb:s,onThumbChange:Je(o),onThumbPointerUp:Je(a),onThumbPositionChange:k,onThumbPointerDown:Je(l),children:(0,p.jsx)(Le.div,{...d,ref:x,style:{position:"absolute",...d.style},onPointerDown:te(t.onPointerDown,R=>{R.button===0&&(R.target.setPointerCapture(R.pointerId),b.current=v.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),T(R))}),onPointerMove:te(t.onPointerMove,T),onPointerUp:te(t.onPointerUp,R=>{const P=R.target;P.hasPointerCapture(R.pointerId)&&P.releasePointerCapture(R.pointerId),document.body.style.webkitUserSelect=w.current,m.viewport&&(m.viewport.style.scrollBehavior=""),b.current=null})})})},"ScrollAreaScrollbarImpl")),Cf="ScrollAreaThumb",yD=g.forwardRef(he(function(t,n){const{forceMount:r,...i}=t,s=_w(Cf,t.__scopeScrollArea);return(0,p.jsx)(Ln,{present:r||s.hasThumb,children:(0,p.jsx)(xD,{ref:n,...i})})},"ScrollAreaThumb")),xD=g.forwardRef(he(function(t,n){const{__scopeScrollArea:r,style:i,...s}=t,o=Ft(Cf,r),a=_w(Cf,r),{onThumbPositionChange:l}=a,c=Ce(n,a.onThumbChange),u=g.useRef(void 0),h=xa(()=>{u.current&&(u.current(),u.current=void 0)},100);return g.useEffect(()=>{const f=o.viewport;if(f){const d=he(()=>{if(h(),!u.current){const m=SD(f,l);u.current=m,l()}},"handleScroll");return l(),f.addEventListener("scroll",d),()=>f.removeEventListener("scroll",d)}},[o.viewport,h,l]),(0,p.jsx)(Le.div,{"data-state":a.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...i},onPointerDownCapture:te(t.onPointerDownCapture,f=>{const d=f.target.getBoundingClientRect(),m=f.clientX-d.left,v=f.clientY-d.top;a.onThumbPointerDown({x:m,y:v})}),onPointerUp:te(t.onPointerUp,a.onThumbPointerUp)})},"ScrollAreaThumbImpl")),Bw="ScrollAreaCorner",bD=g.forwardRef(he(function(t,n){const r=Ft(Bw,t.__scopeScrollArea),i=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&i?(0,p.jsx)(wD,{...t,ref:n}):null},"ScrollAreaCorner")),wD=g.forwardRef(he(function(t,n){const{__scopeScrollArea:r,...i}=t,s=Ft(Bw,r),[o,a]=g.useState(0),[l,c]=g.useState(0),u=!!(o&&l),{onCornerWidthChange:h,onCornerHeightChange:f}=s;return gi(s.scrollbarX,()=>{const d=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(d),c(d)}),gi(s.scrollbarY,()=>{const d=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(d),a(d)}),g.useEffect(()=>()=>{h(0),f(0)},[h,f]),u?(0,p.jsx)(Le.div,{...i,ref:n,style:{width:o,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null},"ScrollAreaCornerImpl"));function Fo(e){return e?parseInt(e,10):0}he(Fo,"toInt");function Xp(e,t){const n=e/t;return isNaN(n)?0:n}he(Xp,"getThumbRatio");function ya(e){const t=Xp(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}he(ya,"getThumbSize");function Fw(e,t,n,r="ltr"){const i=ya(n),s=i/2,o=t||s,a=i-o,l=n.scrollbar.paddingStart+o,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,u=n.content-n.viewport,h=r==="ltr"?[0,u]:[u*-1,0];return Jp([l,c],h)(e)}he(Fw,"getScrollPositionFromPointer");function Af(e,t,n="ltr"){const r=ya(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-i,o=t.content-t.viewport,a=s-r,l=n==="ltr"?[0,o]:[o*-1,0],c=Iw(e,l);return Jp([0,o],[0,a])(c)}he(Af,"getThumbOffsetFromScroll");function Jp(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}he(Jp,"linearScale");function Zp(e,t){return e>0&&e<t}he(Zp,"isScrollingWithinScrollbarBounds");var SD=he((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return he((function i(){const s={left:e.scrollLeft,top:e.scrollTop},o=n.left!==s.left,a=n.top!==s.top;(o||a)&&t(),n=s,r=window.requestAnimationFrame(i)}),"loop")(),()=>window.cancelAnimationFrame(r)},"addUnlinkedScrollListener");function xa(e,t){const n=Je(e),r=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),g.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}he(xa,"useDebounceCallback");function gi(e,t){const n=Je(t);Rt(()=>{let r=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(e),()=>{window.cancelAnimationFrame(r),i.unobserve(e)}}},[e,n])}he(gi,"useResizeObserver");var kD=lD,CD=uD,AD=bD,TD=Object.defineProperty,qe=(e,t)=>TD(e,"name",{value:t,configurable:!0}),[em,y6]=cr("Tooltip",[Qc]),tu=Qc(),ED="TooltipProvider",MD=700,Tf="tooltip.open",[RD,tm]=em(ED),PD=qe(e=>{const{__scopeTooltip:t,delayDuration:n=MD,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,o=g.useRef(!0),a=g.useRef(!1),l=g.useRef(0);return g.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),(0,p.jsx)(RD,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:g.useCallback(()=>{r<=0||(window.clearTimeout(l.current),o.current=!1)},[r]),onClose:g.useCallback(()=>{r<=0||(window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:a,onPointerInTransitChange:g.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:s})},"TooltipProvider"),Ef="Tooltip",[ID,ba]=em(Ef),OD=qe(e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=e,l=tm(Ef,e.__scopeTooltip),c=tu(t),[u,h]=g.useState(null),[f,d]=g.useState(void 0),m=di(),v=g.useRef(0),y=o??l.disableHoverableContent,x=a??l.delayDuration,b=g.useRef(!1),[w,S]=ga({prop:r,defaultProp:i??!1,onChange:qe(R=>{R?(l.onOpen(),document.dispatchEvent(new CustomEvent(Tf))):l.onClose(),s?.(R)},"onChange"),caller:Ef}),C=g.useMemo(()=>w?b.current?"delayed-open":"instant-open":"closed",[w]),A=g.useCallback(()=>{window.clearTimeout(v.current),v.current=0,b.current=!1,S(!0)},[S]),k=g.useCallback(()=>{window.clearTimeout(v.current),v.current=0,S(!1)},[S]),E=g.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{b.current=!0,S(!0),v.current=0},x)},[x,S]);g.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]);const T=f??m;return(0,p.jsx)($p,{...c,children:(0,p.jsx)(ID,{scope:t,contentId:T,setContentId:d,open:w,stateAttribute:C,trigger:u,onTriggerChange:h,onTriggerEnter:g.useCallback(()=>{l.isOpenDelayedRef.current?E():A()},[l.isOpenDelayedRef,E,A]),onTriggerLeave:g.useCallback(()=>{y?k():(window.clearTimeout(v.current),v.current=0)},[k,y]),onOpen:A,onClose:k,disableHoverableContent:y,children:n})})},"Tooltip"),ev="TooltipTrigger",DD=g.forwardRef(qe(function(t,n){const{__scopeTooltip:r,...i}=t,s=ba(ev,r),o=tm(ev,r),a=tu(r),l=g.useRef(null),c=Ce(n,l,s.onTriggerChange),u=g.useRef(!1),h=g.useRef(!1),f=g.useCallback(()=>u.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),(0,p.jsx)(tw,{asChild:!0,...a,children:(0,p.jsx)(Le.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...i,ref:c,onPointerMove:te(t.onPointerMove,d=>{d.pointerType!=="touch"&&!h.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),h.current=!0)}),onPointerLeave:te(t.onPointerLeave,()=>{s.onTriggerLeave(),h.current=!1}),onPointerDown:te(t.onPointerDown,()=>{s.open&&s.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:te(t.onFocus,()=>{u.current||s.onOpen()}),onBlur:te(t.onBlur,s.onClose),onClick:te(t.onClick,s.onClose)})})},"TooltipTrigger")),Vw="TooltipPortal",[ND,LD]=em(Vw,{forceMount:void 0}),_D=qe(e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,s=ba(Vw,t);return(0,p.jsx)(ND,{scope:t,forceMount:n,children:(0,p.jsx)(Ln,{present:n||s.open,children:(0,p.jsx)(Mb,{asChild:!0,container:i,children:r})})})},"TooltipPortal"),Vo="TooltipContent",jD=g.forwardRef(qe(function(t,n){const r=LD(Vo,t.__scopeTooltip),{forceMount:i=r.forceMount,side:s="top",...o}=t,a=ba(Vo,t.__scopeTooltip);return(0,p.jsx)(Ln,{present:i||a.open,children:a.disableHoverableContent?(0,p.jsx)(zw,{side:s,...o,ref:n}):(0,p.jsx)(BD,{side:s,...o,ref:n})})},"TooltipContent")),BD=g.forwardRef(qe(function(t,n){const r=ba(Vo,t.__scopeTooltip),i=tm(Vo,t.__scopeTooltip),s=g.useRef(null),o=Ce(n,s),[a,l]=g.useState(null),{trigger:c,onClose:u}=r,h=s.current,{onPointerInTransitChange:f}=i,d=g.useCallback(()=>{l(null),f(!1)},[f]),m=g.useCallback((v,y)=>{const x=v.currentTarget,b={x:v.clientX,y:v.clientY},w=Hw(b,$w(b,x.getBoundingClientRect())),S=Ww(y.getBoundingClientRect()),C=qw([...w,...S]);l(C),f(!0)},[f]);return g.useEffect(()=>()=>d(),[d]),g.useEffect(()=>{if(c&&h){const v=qe(x=>m(x,h),"handleTriggerLeave"),y=qe(x=>m(x,c),"handleContentLeave");return c.addEventListener("pointerleave",v),h.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",v),h.removeEventListener("pointerleave",y)}}},[c,h,m,d]),g.useEffect(()=>{if(a){const v=qe(y=>{const x=y.target,b={x:y.clientX,y:y.clientY},w=c?.contains(x)||h?.contains(x),S=!Uw(b,a);w?d():S&&(d(),u())},"handleTrackPointerGrace");return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[c,h,a,u,d]),(0,p.jsx)(zw,{...t,ref:o})},"TooltipContentHoverable")),FD=dM("TooltipContent"),zw=g.forwardRef(qe(function(t,n){const{__scopeTooltip:r,children:i,"aria-label":s,id:o,onEscapeKeyDown:a,onPointerDownOutside:l,...c}=t,u=ba(Vo,r),h=tu(r),{onClose:f}=u;g.useEffect(()=>(document.addEventListener(Tf,f),()=>document.removeEventListener(Tf,f)),[f]),g.useEffect(()=>{if(u.trigger){const m=qe(v=>{v.target instanceof Node&&v.target.contains(u.trigger)&&f()},"handleScroll");return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[u.trigger,f]);const{setContentId:d}=u;return Rt(()=>(d(o),()=>{d(void 0)}),[o,d]),(0,p.jsx)(xb,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:m=>m.preventDefault(),onDismiss:f,children:(0,p.jsxs)(nw,{"data-state":u.stateAttribute,role:s?void 0:"tooltip",id:s?void 0:u.contentId,...h,...c,ref:n,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,p.jsx)(FD,{children:i}),s?(0,p.jsx)(OM,{id:u.contentId,role:"tooltip",children:s}):null]})})},"TooltipContentImpl")),VD=g.forwardRef(qe(function(t,n){const{__scopeTooltip:r,...i}=t,s=tu(r);return(0,p.jsx)(yI,{...s,...i,ref:n})},"TooltipArrow"));function $w(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}qe($w,"getExitSideFromRect");function Hw(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}qe(Hw,"getPaddedExitPoints");function Ww(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}qe(Ww,"getPointsFromRect");function Uw(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],l=t[o],c=a.x,u=a.y,h=l.x,f=l.y;u>r!=f>r&&n<(h-c)*(r-u)/(f-u)+c&&(i=!i)}return i}qe(Uw,"isPointInPolygon");function qw(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Kw(t)}qe(qw,"getHull");function Kw(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(;t.length>=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}qe(Kw,"getHullPresorted");var zD=PD,$D=OD,HD=DD,WD=_D,UD=jD,qD=VD,Gw={name:"bot",size:24,node:[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]};Gw.node;var KD=xe(Gw),Qw={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};Qw.node;var hs=xe(Qw),Yw={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};Yw.node;var Xw=xe(Yw),Jw={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};Jw.node;var fs=xe(Jw),Zw={name:"circle-alert",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],aliases:["alert-circle"]};Zw.node;var GD=xe(Zw),eS={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};eS.node;var tv=xe(eS),tS={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};tS.node;var ts=xe(tS),nS={name:"expand",size:24,node:[["path",{d:"m15 15 6 6",key:"1s409w"}],["path",{d:"m15 9 6-6",key:"ko1vev"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}],["path",{d:"M3 16v5h5",key:"1t08am"}],["path",{d:"m3 21 6-6",key:"wwnumi"}],["path",{d:"M3 8V3h5",key:"1ln10m"}],["path",{d:"M9 9 3 3",key:"v551iv"}]]};nS.node;var QD=xe(nS),rS={name:"eye",size:24,node:[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};rS.node;var YD=xe(rS),iS={name:"grip-vertical",size:24,node:[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]};iS.node;var XD=xe(iS),sS={name:"layers",size:24,node:[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],aliases:["layers-3"]};sS.node;var JD=xe(sS),oS={name:"list-filter",size:24,node:[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]]};oS.node;var ZD=xe(oS),aS={name:"list-tree",size:24,node:[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]]};aS.node;var nv=xe(aS),lS={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]};lS.node;var eN=xe(lS),cS={name:"message-square-quote",size:24,node:[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]]};cS.node;var tN=xe(cS),uS={name:"minimize-2",size:24,node:[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]};uS.node;var nN=xe(uS),hS={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};hS.node;var rN=xe(hS),fS={name:"mouse-pointer-click",size:24,node:[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]};fS.node;var iN=xe(fS),dS={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};dS.node;var sN=xe(dS),pS={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]};pS.node;var oN=xe(pS),mS={name:"redo-2",size:24,node:[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]};mS.node;var aN=xe(mS),gS={name:"shrink",size:24,node:[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]]};gS.node;var lN=xe(gS),vS={name:"text-align-start",size:24,node:[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],aliases:["text","align-left"]};vS.node;var cN=xe(vS),yS={name:"triangle-alert",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle"]};yS.node;var nu=xe(yS),xS={name:"undo-2",size:24,node:[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]};xS.node;var uN=xe(xS),bS={name:"user-round",size:24,node:[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],aliases:["user-2"]};bS.node;var hN=xe(bS),wS={name:"user",size:24,node:[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]};wS.node;var fN=xe(wS),SS={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};SS.node;var dN=xe(SS);function pN(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function mN(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0}function gN(e){const t=Object.entries(e).filter(([,n])=>n!==void 0);return t.length>0?Object.fromEntries(t):void 0}var vN=["uncachedInputTokens","cacheReadTokens","cacheWriteTokens","cacheWrite1hTokens","outputTokens","reasoningTokens","webSearchRequests"];function yN(e){const t=pN(e);if(!t)return;const n={};for(const r of vN){const i=mN(t[r]);i!==void 0&&(n[r]=i)}return gN(n)}var zo=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,Gn=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0,Mf=e=>typeof e=="string"&&e.length>0?e:void 0;function Yr(e,t){return t.includes(e)?e:void 0}function kr(e,t,n){const r={};for(const i of t){const s=n(e[i]);s!==void 0&&(r[i]=s)}return r}var rv=["input","output","cacheRead","cacheWrite","cacheWrite1h"];function xN(e){const t=zo(e);if(!t||t.currency!=="USD")return;const n=kr(t,[...rv,"webSearchPerThousand"],Gn);if(n.input===void 0||n.output===void 0)return;const r=(Array.isArray(t.tiers)?t.tiers:[]).map(zo).filter(i=>Gn(i?.aboveInputTokens)!==void 0).map(i=>kr(i,["aboveInputTokens",...rv],Gn));return{...n,currency:"USD",...r.length>0?{tiers:r}:{}}}function bN(e){const t=zo(e),n=Yr(t?.source,["list_price","customer_rate"]),r=xN(t?.rates),i=Mf(t?.modelId);if(!t||!n||!r||!i)return;const s=Array.isArray(t.assumptions)?t.assumptions.filter(o=>typeof o=="string"):[];return{source:n,rates:r,modelId:i,...kr(t,["provider","versionId"],Mf),...kr(t,["effectiveAt","retrievedAt"],Gn),...s.length>0?{assumptions:s}:{}}}function kS(e){const t=zo(e);if(!t||t.currency!=="USD")return;const n=Yr(t.completeness,["complete","partial","unavailable"]),r=Gn(t.calculationVersion),i=Gn(t.amountUsd),s=Yr(t.source,["provider_reported","list_price","customer_rate","runner_reported"]);if(!n||r===void 0||n==="unavailable"!=(i===void 0)||i!==void 0&&!s)return;const o=kr(zo(t.parts)??{},["input","cacheRead","cacheWrite","output","webSearch"],Gn),a=(Array.isArray(t.missing)?t.missing:[]).filter(d=>Yr(d,["usage","input_tokens","output_tokens","rate","cache_read_rate","cache_write_rate","cache_write_1h_rate","web_search_rate"])!==void 0),l=Yr(t.reason,["no_usage","no_rate","invalid_rate","unsupported_currency"]),c=Yr(t.funding,["mcpjam","customer"]),u=Yr(t.usageSource,["provider","runner","interrupted_estimate"]),h=yN(t.usage),f=bN(t.rate);return{calculationVersion:r,currency:"USD",completeness:n,...i!==void 0?{amountUsd:i}:{},...s?{source:s}:{},...Object.keys(o).length>0?{parts:o}:{},...a.length>0?{missing:a}:{},...l?{reason:l}:{},...kr(t,["tierAboveInputTokens"],Gn),...f?{rate:f}:{},...kr(t,["reporter"],Mf),...c?{funding:c}:{},...h?{usage:h}:{},...u?{usageSource:u}:{},...kr(t,["recordedAt"],Gn)}}var iv=1000000000000000n,CS=1e15;function wN(e){return BigInt(Math.round(e*CS))}function SN(e){const t=e/iv,n=e%iv;return Number(t)+Number(n)/CS}var kN=["provider_reported","customer_rate","list_price","runner_reported"];function CN(e){let t=0n,n=0,r=0,i=0;const s=new Set;for(const l of e){if(!l||l.amountUsd===void 0||l.currency!=="USD"){i+=1;continue}t+=wN(l.amountUsd),l.source&&s.add(l.source),l.completeness==="complete"?n+=1:r+=1}const o=e.length,a=n===o?"complete":n+r===0?"unavailable":"partial";return{currency:"USD",knownSubtotalUsd:SN(t),completeness:a,totalCalls:o,completeCalls:n,partialCalls:r,unavailableCalls:i,sources:kN.filter(l=>s.has(l))}}function Xr(e){const t=[e.scope??"",e.serverId,e.wire,e.taskId];if(e.connectionId!==void 0&&t.push(e.connectionId),t.some(n=>n.includes("\0"))||e.connectionId==="")throw new Error("Invalid task identity");return t.join("\0")}var AN=["completed","failed","cancelled","expired"];function no(e){return AN.includes(e)}var TN=250,EN=3e5,MN=1e3,RN=6e4;function sv(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:0}function Ii(e){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:void 0}function Hs(e){return{...e,respondedInputKeys:[...e.respondedInputKeys],terminal:no(e.status)}}var x6=class{records=new Map;now;absoluteFloorMs;maximumIntervalMs;backoffBaseMs;backoffMaxMs;userMinimumIntervalMs;callbacks;constructor(e={}){this.now=e.now??(()=>Date.now()),this.absoluteFloorMs=e.absoluteFloorMs??TN,this.maximumIntervalMs=e.maximumIntervalMs??EN,this.backoffBaseMs=e.errorBackoffBaseMs??MN,this.backoffMaxMs=e.errorBackoffMaxMs??RN,this.userMinimumIntervalMs=sv(e.userMinimumIntervalMs),this.callbacks=e.callbacks??{}}setCallbacks(e){this.callbacks=e}setUserMinimumIntervalMs(e){this.userMinimumIntervalMs=sv(e);for(const t of this.records.values()){if(no(t.status))continue;const n=(t.lastObservedAt??this.now())+this.effectiveIntervalMs(t),r=t.consecutiveErrors>0?t.nextPollAt:0;t.nextPollAt=Math.max(n,t.retryAfterUntil??0,r)}}getUserMinimumIntervalMs(){return this.userMinimumIntervalMs}effectiveIntervalMs(e,t){const n=t??this.now(),r=Ii(e.pollIntervalMs)??0,i=e.consecutiveErrors>0?Math.min(this.backoffBaseMs*2**(e.consecutiveErrors-1),this.backoffMaxMs):0,s=e.retryAfterUntil?Math.max(0,e.retryAfterUntil-n):0,o=Math.min(Math.max(this.absoluteFloorMs,this.userMinimumIntervalMs,i),Math.max(this.maximumIntervalMs,this.absoluteFloorMs));return Math.max(o,r,s)}get(e){return this.records.get(Xr(e))}getByKey(e){return this.records.get(e)}snapshot(e){const t=this.get(e);return t?Hs(t):void 0}all(){return[...this.records.values()].map(Hs)}register(e,t={}){const n=Xr(e),r=this.records.get(n);if(r)return r;const i=this.now(),s={key:n,identity:{...e},status:t.status??"unknown",createdAt:t.createdAt,ttlMs:t.ttlMs??null,pollIntervalMs:Ii(t.pollIntervalMs),nextPollAt:typeof t.nextPollAt=="number"&&Number.isFinite(t.nextPollAt)?Math.max(i,t.nextPollAt):i,lastObservedAt:typeof t.lastObservedAt=="number"&&Number.isFinite(t.lastObservedAt)?t.lastObservedAt:void 0,consecutiveErrors:0,cancellationRequested:!1,restored:t.restored===!0,pollInFlight:!1,respondedInputKeys:new Set(t.respondedInputKeys??[]),toolName:t.toolName,surface:t.surface};return this.records.set(n,s),t.restored||this.callbacks.onTaskCreated?.(Hs(s)),s}forget(e){this.records.delete(Xr(e))}clear(){this.records.clear()}observe(e,t,n="poll"){const r=this.register(e,{restored:!0}),i=r.status,s=this.now();if(no(r.status)&&!r.restored)return r.lastObservedAt=s,r;r.restored=!1,r.status=t.status,r.statusMessage=t.statusMessage,t.createdAt!==void 0&&(r.createdAt=t.createdAt),t.lastUpdatedAt!==void 0&&(r.lastUpdatedAt=t.lastUpdatedAt),t.ttlMs!==void 0&&(r.ttlMs=t.ttlMs),t.pollIntervalMs!==void 0&&(r.pollIntervalMs=Ii(t.pollIntervalMs)),r.inputRequests=t.inputRequests,r.result=t.result,r.error=t.error,r.raw=t.raw,r.lastObservedAt=s,n!=="notification"&&(r.consecutiveErrors=0,r.retryAfterUntil=void 0);const o=no(r.status);o?r.nextPollAt=Number.POSITIVE_INFINITY:n==="notification"&&r.consecutiveErrors>0?r.nextPollAt=Math.min(r.nextPollAt,s+this.effectiveIntervalMs(r,s)):r.nextPollAt=s+this.effectiveIntervalMs(r,s);const a=Hs(r);return i!==r.status?(this.callbacks.onState?.(a,i),r.status==="input_required"&&this.callbacks.onInputRequired?.(a),o&&this.callbacks.onTerminal?.(a)):r.status==="input_required"&&n!=="create"&&this.callbacks.onInputRequired?.(a),r}observeError(e,t={}){const n=this.register(e,{restored:!0}),r=this.now();n.consecutiveErrors+=1;const i=Ii(t.retryAfterMs);return i!==void 0&&(n.retryAfterUntil=r+i),n.nextPollAt=r+this.effectiveIntervalMs(n,r),n}applyRetryAfter(e,t){const n=this.register(e,{restored:!0}),r=this.now(),i=Ii(t);i!==void 0&&(n.retryAfterUntil=r+i,n.nextPollAt=Math.max(n.nextPollAt,r+i))}clearErrorBackoff(e){const t=this.records.get(Xr(e));if(!t)return;const n=this.now();t.consecutiveErrors=0;const r=Ii(t.pollIntervalMs)??0;t.nextPollAt=Math.max(n,t.lastObservedAt!==void 0?t.lastObservedAt+r:0,t.retryAfterUntil??0)}markExpired(e){const t=this.register(e,{restored:!0}),n=t.status;t.status="expired",t.lastObservedAt=this.now(),t.nextPollAt=Number.POSITIVE_INFINITY,t.consecutiveErrors=0;const r=Hs(t);return n!=="expired"&&(this.callbacks.onState?.(r,n),this.callbacks.onTerminal?.(r)),t}markCancellationRequested(e){const t=this.register(e,{restored:!0});t.cancellationRequested=!0}markInputKeysResponded(e,t){const n=this.register(e,{restored:!0});for(const r of t)n.respondedInputKeys.add(r)}pendingInputKeys(e){const t=this.get(e);return t?.inputRequests?Object.keys(t.inputRequests).filter(n=>Object.prototype.hasOwnProperty.call(t.inputRequests,n)&&!t.respondedInputKeys.has(n)):[]}owesRead(e){return no(e.status)?e.restored&&e.identity.wire==="extension":!0}due(e){const t=e??this.now();return[...this.records.values()].filter(n=>this.owesRead(n)&&!n.pollInFlight&&n.nextPollAt<=t).sort((n,r)=>n.nextPollAt-r.nextPollAt)}active(){return[...this.records.values()].filter(e=>this.owesRead(e))}msUntilNextDue(e){const t=e??this.now();let n=Number.POSITIVE_INFINITY;for(const r of this.records.values())this.owesRead(r)&&(n=Math.min(n,r.nextPollAt));if(Number.isFinite(n))return Math.max(0,n-t)}reserve(e,t){const n=t??this.now();for(const r of e)r.nextPollAt=n+this.effectiveIntervalMs(r,n)}acquirePoll(e,t){const n=this.records.get(Xr(e));return!n||n.pollInFlight?!1:(n.pollInFlight=!0,this.reserve([n],t),!0)}releasePoll(e){const t=this.records.get(Xr(e));t&&(t.pollInFlight=!1)}batchIntervalMs(e,t){const n=t??this.now();let r=Math.max(this.absoluteFloorMs,this.userMinimumIntervalMs);for(const i of e)r=Math.max(r,this.effectiveIntervalMs(i,n));return r}},AS=(0,g.createContext)({});function PN(e){const t=(0,g.useRef)(null);return t.current===null&&(t.current=e()),t.current}var IN=typeof window<"u",ov=IN?g.useLayoutEffect:g.useEffect,ru=(0,g.createContext)(null);function nm(e,t){e.indexOf(t)===-1&&e.push(t)}function uc(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}var fr=(e,t,n)=>n>t?t:n<e?e:n,iu=()=>{},vi=()=>{},ar={},rm=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),TS=e=>typeof e=="object"&&e!==null,im=e=>/^0[^.\s]+$/u.test(e);function ES(e){let t;return()=>(t===void 0&&(t=e()),t)}var tn=e=>e,wa=(...e)=>e.reduce((t,n)=>r=>n(t(r))),$o=(e,t,n)=>{const r=t-e;return r?(n-e)/r:1},hc=class{constructor(){this.subscriptions=[]}add(e){return nm(this.subscriptions,e),()=>this.remove(e)}remove(e){uc(this.subscriptions,e)}notify(e,t,n){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){const s=this.subscriptions[i];s&&s(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},Pt=e=>e*1e3,Lt=e=>e/1e3,MS=(e,t)=>t?e*(1e3/t):0,RS=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,ON=1e-7,DN=12;function NN(e,t,n,r,i){let s,o,a=0;do o=t+(n-t)/2,s=RS(o,r,i)-e,s>0?n=o:t=o;while(Math.abs(s)>ON&&++a<DN);return o}function Sa(e,t,n,r){if(e===t&&n===r)return tn;const i=s=>NN(s,0,1,e,n);return s=>s===0||s===1?s:RS(i(s),t,r)}var PS=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,IS=e=>t=>1-e(1-t),OS=Sa(.33,1.53,.69,.99),sm=IS(OS),DS=PS(sm),NS=e=>e>=1?1:(e*=2)<1?.5*sm(e):.5*(2-Math.pow(2,-10*(e-1))),om=e=>1-Math.sin(Math.acos(e)),LS=IS(om),_S=PS(om),LN=Sa(.42,0,1,1),_N=Sa(0,0,.58,1),am=Sa(.42,0,.58,1),jN=e=>Array.isArray(e)&&typeof e[0]!="number",jS=e=>Array.isArray(e)&&typeof e[0]=="number",av={linear:tn,easeIn:LN,easeInOut:am,easeOut:_N,circIn:om,circInOut:_S,circOut:LS,backIn:sm,backInOut:DS,backOut:OS,anticipate:NS},BN=e=>typeof e=="string",lv=e=>{if(jS(e)){vi(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,r,i]=e;return Sa(t,n,r,i)}else if(BN(e))return vi(av[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),av[e];return e},We={delta:0,timestamp:0,isProcessing:!1},El;function FN(){El=void 0}var it={now:()=>(El===void 0&&it.set(We.isProcessing||ar.useManualTiming?We.timestamp:performance.now()),El),set:e=>{El=e,queueMicrotask(FN)}},ns=e=>Math.round(e*1e5)/1e5,BS=e=>t=>typeof t=="string"&&t.startsWith(e),FS=BS("--"),VN=BS("var(--"),lm=e=>VN(e)?zN.test(e.split("/*")[0].trim()):!1,zN=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function cv(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}var Is={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},Ho={...Is,transform:e=>fr(0,1,e)},Ua={...Is,default:1},cm=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function $N(e){return e==null}var HN=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,um=(e,t)=>n=>!!(typeof n=="string"&&HN.test(n)&&n.startsWith(e)||t&&!$N(n)&&Object.prototype.hasOwnProperty.call(n,t)),VS=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,s,o,a]=r.match(cm);return{[e]:parseFloat(i),[t]:parseFloat(s),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},WN=e=>fr(0,255,e),eh={...Is,transform:e=>Math.round(WN(e))},ni={test:um("rgb","red"),parse:VS("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+eh.transform(e)+", "+eh.transform(t)+", "+eh.transform(n)+", "+ns(Ho.transform(r))+")"};function UN(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Rf={test:um("#"),parse:UN,transform:ni.transform},ka=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Vn=ka("deg"),Pn=ka("%"),Q=ka("px"),qN=ka("vh"),KN=ka("vw"),uv={...Pn,parse:e=>Pn.parse(e)/100,transform:e=>Pn.transform(e*100)},Wi={test:um("hsl","hue"),parse:VS("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+Pn.transform(ns(t))+", "+Pn.transform(ns(n))+", "+ns(Ho.transform(r))+")"},Ue={test:e=>ni.test(e)||Rf.test(e)||Wi.test(e),parse:e=>ni.test(e)?ni.parse(e):Wi.test(e)?Wi.parse(e):Rf.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?ni.transform(e):Wi.transform(e),getAnimatableNone:e=>{const t=Ue.parse(e);return t.alpha=0,Ue.transform(t)}},GN=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,zS=new RegExp(cm.source),$S=new RegExp(GN.source,"i");function QN(e){return isNaN(e)&&typeof e=="string"&&(zS.test(e)||$S.test(e))}var HS="number",WS="color",YN="var",XN="var(",hv="${}",JN=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ZN(e){const t=e.toString();return zS.test(t)||$S.test(t)}function Wo(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let s=0;return{values:n,split:t.replace(JN,o=>(Ue.test(o)?(r.color.push(s),i.push(WS),n.push(Ue.parse(o))):o.startsWith(XN)?(r.var.push(s),i.push(YN),n.push(o)):(r.number.push(s),i.push(HS),n.push(parseFloat(o))),++s,hv)).split(hv),indexes:r,types:i}}function e2(e){return Wo(e).values}function US({split:e,types:t}){const n=e.length;return r=>{let i="";for(let s=0;s<n;s++)if(i+=e[s],r[s]!==void 0){const o=t[s];o===HS?i+=ns(r[s]):o===WS?i+=Ue.transform(r[s]):i+=r[s]}return i}}function t2(e){return US(Wo(e))}var n2=e=>typeof e=="number"?0:Ue.test(e)?Ue.getAnimatableNone(e):e,r2=(e,t)=>typeof e=="number"?t?.trim().endsWith("/")?e:0:n2(e);function i2(e){const t=Wo(e);return US(t)(t.values.map((n,r)=>r2(n,t.split[r])))}var It={test:QN,parse:e2,createTransformer:t2,getAnimatableNone:i2};function th(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function s2({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,s=0,o=0;if(!t)i=s=o=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;i=th(l,a,e+1/3),s=th(l,a,e),o=th(l,a,e-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:r}}function fc(e,t){return n=>n>0?t:e}var ye=(e,t,n)=>e+(t-e)*n,nh=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},o2=[Rf,ni,Wi],a2=e=>o2.find(t=>t.test(e));function fv(e){const t=a2(e);if(!t)return iu(!1,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!1;let n=t.parse(e);return t===Wi&&(n=s2(n)),n}var dv=(e,t)=>{const n=fv(e),r=fv(t);if(!n||!r)return fc(e,t);const i={...n};return s=>(i.red=nh(n.red,r.red,s),i.green=nh(n.green,r.green,s),i.blue=nh(n.blue,r.blue,s),i.alpha=ye(n.alpha,r.alpha,s),ni.transform(i))},Pf=new Set(["none","hidden"]);function l2(e,t){return Pf.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function c2(e,t){return n=>ye(e,t,n)}function hm(e){return typeof e=="number"?c2:typeof e=="string"?lm(e)?fc:Ue.test(e)?dv:f2:Array.isArray(e)?qS:typeof e=="object"?Ue.test(e)?dv:u2:fc}function qS(e,t){const n=[...e],r=n.length,i=e.map((s,o)=>hm(s)(s,t[o]));return s=>{for(let o=0;o<r;o++)n[o]=i[o](s);return n}}function u2(e,t){const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=hm(e[i])(e[i],t[i]));return i=>{for(const s in r)n[s]=r[s](i);return n}}function h2(e,t){const n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const s=t.types[i],o=e.indexes[s][r[s]],a=e.values[o]??0;n[i]=a,r[s]++}return n}var f2=(e,t)=>{const n=It.createTransformer(t),r=Wo(e),i=Wo(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Pf.has(e)&&!i.values.length||Pf.has(t)&&!r.values.length?l2(e,t):wa(qS(h2(r,i),i.values),n):(iu(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),fc(e,t))},pv=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function d2(e,t){const n=pv.exec(e);if(!n)return;const r=pv.exec(t);if(!r||n[2]!==r[2])return;const i=n[2],s=parseFloat(n[1]),o=parseFloat(r[1]);return a=>ns(ye(s,o,a))+i}function fm(e,t,n){if(typeof e=="number"&&typeof t=="number"&&typeof n=="number")return ye(e,t,n);if(typeof e=="string"&&typeof t=="string"){const r=d2(e,t);if(r)return r}return hm(e)(e,t)}var qa=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function p2(e){let t=new Set,n=new Set,r=!1,i=!1;const s=new Set;let o={delta:0,timestamp:0,isProcessing:!1};function a(c){s.has(c)&&(n.add(c),e()),c(o)}const l={schedule:(c,u=!1,h=!1)=>{const f=h&&r?t:n;return u&&s.add(c),f.add(c),c},cancel:c=>{n.delete(c),s.delete(c)},process:c=>{if(o=c,r){i=!0;return}r=!0;const u=t;t=n,n=u,t.forEach(a),t.clear(),r=!1,i&&(i=!1,l.process(c))}};return l}var m2=40;function KS(e,t,n={delta:0,timestamp:0,isProcessing:!1}){let r=!1,i=!0;const s=()=>r=!0,o=qa.reduce((w,S)=>(w[S]=p2(s),w),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:h,preRender:f,render:d,postRender:m}=o,v=()=>{const w=ar.useManualTiming,S=w?n.timestamp:performance.now();r=!1,w||(n.delta=i?1e3/60:Math.max(Math.min(S-n.timestamp,m2),1)),n.timestamp=S,n.isProcessing=!0,a.process(n),l.process(n),c.process(n),u.process(n),h.process(n),f.process(n),d.process(n),m.process(n),n.isProcessing=!1,r&&t&&(i=!1,e(v))},y=()=>{r=!0,i=!0,n.isProcessing||e(v)};return{schedule:qa.reduce((w,S)=>{const C=o[S];return w[S]=(A,k=!1,E=!1)=>(r||y(),C.schedule(A,k,E)),w},{}),cancel:w=>{for(let S=0;S<qa.length;S++)o[qa[S]].cancel(w)},state:n,steps:o}}var{schedule:we,cancel:Ir,steps:rh}=KS(typeof requestAnimationFrame<"u"?requestAnimationFrame:tn,!0,We),g2=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>we.update(t,n),stop:()=>Ir(t),now:()=>We.isProcessing?We.timestamp:it.now()}},GS=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let s=0;s<i;s++)r+=Math.round(e(s/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},dm=2e4;function pm(e,t=50,n=dm,r){let i=0,s=e.next(i);for(r?.push(s.value);!s.done&&i<n;)i+=t,s=e.next(i),r?.push(s.value);return i>=n?1/0:i}function v2(e,t=100,n){const r=n({...e,keyframes:[0,t]}),i=Math.min(pm(r),dm);return{type:"keyframes",ease:s=>r.next(i*s).value/t,duration:Lt(i)}}var Xe={stiffness:100,damping:10,mass:1,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05},QS=e=>e<0?1/Math.max(1+e,Xe.minDamping):Math.max(1-e,Xe.minDamping);function YS(e,t){if(!(e>1))return 1;const n=Math.sqrt(e*e-1),r=e-n,i=e+n,s=2*n*Math.exp(-t)*(1+t);return XS(o=>i*Math.exp(-r*o)-r*Math.exp(-i*o)-s,o=>Math.exp(-i*o)-Math.exp(-r*o),t)/t}function If(e,t){return e*Math.sqrt(1-t*t)}var y2=12;function XS(e,t,n){let r=n;for(let i=1;i<y2;i++)r=r-e(r)/t(r);return r}var mv=.001;function x2({duration:e=Xe.duration,bounce:t=Xe.bounce}){let n,r;iu(e<=Pt(Xe.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");const i=QS(t);e=fr(Xe.minDuration,Xe.maxDuration,Lt(e)),i<1?(n=c=>{const u=c*i,h=u*e,f=If(c,i),d=Math.exp(-h);return mv-u/f*d},r=c=>{const u=c*i*e,h=i*i*c*c*e,f=Math.exp(-u),d=If(c*c,i);return(-n(c)+mv>0?-1:1)*-h*f/d}):(n=c=>-.001+Math.exp(-c*e)*(c*e+1),r=c=>Math.exp(-c*e)*(-c*(e*e)));const s=5/e,o=XS(n,r,s),a=o*YS(i,o*e),l=a*a;return{stiffness:l,damping:i*2*Math.sqrt(l),duration:Pt(e)}}var Of=(e,t)=>(t?e>=0:e>0)&&e<1/0;function ih(e,t){if(Of(e,t))return e}function b2(e){const t=ih(e.stiffness),n=ih(e.damping,!0),r=ih(e.mass),i={...e,stiffness:t??Xe.stiffness,damping:n??Xe.damping,mass:r??Xe.mass,isResolvedFromDuration:!1,isTimeDefined:(t??n??r)===void 0&&(e.duration!==void 0||e.bounce!==void 0)};if(i.isTimeDefined){if(e.visualDuration){const s=QS(e.bounce||0),o=2*Math.PI/(e.visualDuration*1.2)*YS(s,2*Math.PI/1.2);i.stiffness=o*o,i.damping=2*s*Math.sqrt(i.stiffness)}else Object.assign(i,x2(i)),i.isResolvedFromDuration=!0;(!Of(i.stiffness)||!Of(i.damping,!0))&&(i.stiffness=Xe.stiffness,i.damping=Xe.damping)}return i}function dc(e=Xe.visualDuration,t=Xe.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e,r=n.keyframes[0],i=n.keyframes[n.keyframes.length-1],s={done:!1,value:r},{stiffness:o,damping:a,mass:l,duration:c,isResolvedFromDuration:u,isTimeDefined:h}=b2({...n}),f=k=>h?0:-Lt(k),d=a/(2*Math.sqrt(o*l)),m=Lt(Math.sqrt(o/l)),v=d*m,y={target:i,delta:i-r,velocity:f(n.velocity||0)||0,restSpeed:0,restDelta:0},x=()=>{const k=Math.abs(y.delta)<5;y.restSpeed=n.restSpeed||(k?Xe.restSpeed.granular:Xe.restSpeed.default),y.restDelta=n.restDelta||(k?Xe.restDelta.granular:Xe.restDelta.default)};x();let b,w,S;if(d<1){const k=If(m,d),E={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};S=()=>{E.A=(y.velocity+v*y.delta)/k,E.sinC=v*E.A+y.delta*k,E.cosC=v*y.delta-E.A*k};const T=R=>{R!==E.t&&(E.t=R,E.env=Math.exp(-v*R),E.sin=Math.sin(k*R),E.cos=Math.cos(k*R))};b=R=>(T(R),y.target-E.env*(E.A*E.sin+y.delta*E.cos)),w=R=>(T(R),E.env*(E.sinC*E.sin+E.cosC*E.cos))}else if(d===1){b=E=>y.target-Math.exp(-m*E)*(y.delta+(y.velocity+m*y.delta)*E);const k={C:0};S=()=>{k.C=y.velocity+m*y.delta},w=E=>Math.exp(-m*E)*(m*k.C*E-y.velocity)}else{const k=m*Math.sqrt(d*d-1),E=v-k,T=v+k,R=h?1/0:300/k,P=(N,L)=>Math.exp(L>R?-N*R-v*(L-R):-N*L),M={S:0,F:0};S=()=>{const N=(y.velocity+v*y.delta)/k;M.S=(y.delta+N)/2,M.F=(y.delta-N)/2},b=N=>y.target-M.S*P(E,N)-M.F*P(T,N),w=N=>E*M.S*P(E,N)+T*M.F*P(T,N)}S();const C=u&&c||null,A={calculatedDuration:C,retarget:(k,E)=>{y.target=k[k.length-1],y.delta=y.target-k[0],y.velocity=f(E),n.restSpeed&&n.restDelta||x(),A.calculatedDuration=C,s.done=!1,S()},velocity:k=>Pt(w(k)),next:k=>{const E=b(k);if(u)s.done=k>=c;else{const T=Pt(w(k));s.done=Math.abs(T)<=y.restSpeed&&Math.abs(y.target-E)<=y.restDelta}return s.value=s.done?y.target:E,s},toString:()=>{const k=Math.min(pm(A),dm),E=GS(T=>A.next(k*T).value,k,30);return k+"ms "+E},toTransition:()=>{}};return A}dc.applyToOptions=e=>{const t=v2(e,100,dc);return e.ease=t.ease,e.duration=Pt(t.duration),e.type="keyframes",e};function Df({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const h=e[0],f={done:!1,value:h},d=k=>k<a||k>l,m=k=>a===void 0?l:l===void 0||Math.abs(a-k)<Math.abs(l-k)?a:l;let v=n*t;const y=h+v,x=o===void 0?y:o(y);x!==y&&(v=x-h);const b=k=>-v*Math.exp(-k/r),w=k=>{const E=b(k);f.done=Math.abs(E)<=c,f.value=f.done?x:x+E};let S,C;const A=k=>{d(f.value)&&(S=k,C=dc({keyframes:[f.value,m(f.value)],velocity:-b(k)/r*1e3,damping:i,stiffness:s,restDelta:c,restSpeed:u}))};return A(0),{calculatedDuration:null,next:k=>{let E=!1;return!C&&S===void 0&&(E=!0,w(k),A(k)),S!==void 0&&k>=S?C.next(k-S):(!E&&w(k),f)}}}function w2(e,t,n){const r=[],i=n||ar.mix||fm,s=e.length-1;for(let o=0;o<s;o++){let a=i(e[o],e[o+1]);if(t){const l=Array.isArray(t)?t[o]||tn:t;a=wa(l,a)}r.push(a)}return r}function S2(e,t,{clamp:n=!0,ease:r,mixer:i}={}){const s=e.length;if(vi(s===t.length,"Both input and output ranges must be the same length","range-length"),s===1)return()=>t[0];if(s===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=w2(t,r,i),l=a.length,c=u=>{if(o&&u<e[0])return t[0];let h=0;if(l>1)for(;h<e.length-2&&!(u<e[h+1]);h++);const f=$o(e[h],e[h+1],u);return a[h](f)};return n?u=>c(fr(e[0],e[s-1],u)):c}function k2(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=$o(0,t,r);e.push(ye(n,1,i))}}function C2(e){const t=[0];return k2(t,e.length-1),t}function A2(e,t){return e.map(n=>n*t)}function T2(e,t){return e.map(()=>t||am).splice(0,e.length-1)}function wo({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=jN(r)?r.map(lv):lv(r)||am,s={done:!1,value:t[0]};if(t.length===2&&!Array.isArray(i)&&(!n||n.length!==2||n[0]===0&&n[1]===1)){const[l,c]=t,u=l===c?void 0:(ar.mix||fm)(l,c);return{calculatedDuration:e,next:h=>(s.value=u?u(i(e>0?fr(0,1,h/e):1)):c,s.done=h>=e,s)}}const o=A2(n&&n.length===t.length?n:C2(t),e),a=S2(o,t,{ease:Array.isArray(i)?i:T2(t,i)});return{calculatedDuration:e,next:l=>(s.value=a(l),s.done=l>=e,s)}}var E2=5;function M2(e,t,n){const r=Math.max(t-E2,0);return MS(n-e(r),t-r)}function R2(e,t,n=0){return t<=0?n:e.velocity?e.velocity(t):M2(r=>e.next(r).value,t,e.next(t).value)}var P2=e=>e!==null;function su(e,{repeat:t,repeatType:n="loop"},r,i=1){const s=e.filter(P2),o=i<0||t&&n!=="loop"&&t%2===1?0:s.length-1;return!o||r===void 0?s[o]:r}var I2={decay:Df,inertia:Df,tween:wo,keyframes:wo,spring:dc};function JS(e){typeof e.type=="string"&&(e.type=I2[e.type])}function ZS(e,t){return{kind:e,animation:t,timestamp:it.now(),frameTimestamp:We.timestamp,frameIsProcessing:We.isProcessing}}function ek(e,t,n){const r=globalThis.__MOTION_INSPECT__;if(r)try{r({...ZS("animation-start",e),options:n?{...t,...n}:t})}catch{}}function O2(e,t){const n=globalThis.__MOTION_INSPECT__;if(n)try{n({...ZS("layout-animation-start",e),node:t})}catch{}}var mm=class{constructor(){this.isResolved=!1}get finished(){return this._finished||(this._finished=this.isResolved?Promise.resolve():new Promise(e=>{this._resolve=e})),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){this.isResolved=!0,this._resolve?.()}then(e,t){return this.finished.then(e,t)}},D2=e=>e/100,pc=class extends mm{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==it.now()&&this.tick(it.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause(),ek(this,this.options)}initAnimation(){const{options:e}=this;JS(e);const{type:t=wo,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:s=0}=e;let{keyframes:o}=e;const a=t||wo;a!==wo&&typeof o[0]!="number"&&(this.mixKeyframes=wa(D2,fm(o[0],o[1])),o=[0,100]);const l=a(o===e.keyframes?e:{...e,keyframes:o});i==="mirror"&&(this.mirroredGenerator=a({...e,keyframes:[...o].reverse(),velocity:-s})),l.calculatedDuration===null&&(l.calculatedDuration=pm(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=l}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:s,resolvedDuration:o,calculatedDuration:a}=this;if(this.startTime===null)return n.next(0);const{delay:l=0,keyframes:c,repeat:u,repeatType:h,repeatDelay:f,type:d,onUpdate:m,finalKeyframe:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const y=this.currentTime-l*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?y<0:y>r;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let b=this.currentTime,w=n;if(u){const k=Math.min(this.currentTime,r)/o;let E=Math.floor(k),T=k%1;!T&&k>=1&&(T=1),T===1&&E--,E=Math.min(E,u+1),E%2&&(h==="reverse"?(T=1-T,f&&(T-=f/o)):h==="mirror"&&(w=s)),b=fr(0,1,T)*o}let S;x?(this.delayState.value=c[0],S=this.delayState):S=w.next(b),i&&!x&&(S.value=i(S.value));let{done:C}=S;!x&&a!==null&&(C=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const A=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return A&&d!==Df&&(S.value=su(c,this.options,v,this.speed)),m&&m(S.value),A&&this.finish(),S}then(e,t){return this.finished.then(e,t)}get duration(){return Lt(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Lt(e)}get time(){return Lt(this.currentTime)}set time(e){e=Pt(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){return R2(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(it.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Lt(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=g2,startTime:t}=this.options;this.driver||(this.driver=e(r=>this.tick(r))),this.options.onPlay?.();const n=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=n):this.holdTime!==null?this.startTime=n-this.holdTime:this.startTime||(this.startTime=t??n),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(it.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}},N2=new Set(["brightness","contrast","saturate","opacity"]);function L2(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(cm)||[];if(!r)return e;const i=n.replace(r,"");let s=N2.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+i+")"}var _2=/\b([a-z-]*)\(.*?\)/gu,Nf={...It,getAnimatableNone:e=>{const t=e.match(_2);return t?t.map(L2).join(" "):e}},Lf={...It,getAnimatableNone:e=>{const t=It.parse(e);return It.createTransformer(e)(t.map(n=>typeof n=="number"?0:typeof n=="object"?{...n,alpha:1}:n))}},gv={...Is,transform:Math.round},j2={rotate:Vn,pathRotation:Vn,rotateX:Vn,rotateY:Vn,rotateZ:Vn,scale:Ua,scaleX:Ua,scaleY:Ua,scaleZ:Ua,skew:Vn,skewX:Vn,skewY:Vn,distance:Q,translateX:Q,translateY:Q,translateZ:Q,x:Q,y:Q,z:Q,perspective:Q,transformPerspective:Q,opacity:Ho,originX:uv,originY:uv,originZ:Q},mc={borderWidth:Q,borderTopWidth:Q,borderRightWidth:Q,borderBottomWidth:Q,borderLeftWidth:Q,borderRadius:Q,borderTopLeftRadius:Q,borderTopRightRadius:Q,borderBottomRightRadius:Q,borderBottomLeftRadius:Q,width:Q,maxWidth:Q,height:Q,maxHeight:Q,top:Q,right:Q,bottom:Q,left:Q,inset:Q,insetBlock:Q,insetBlockStart:Q,insetBlockEnd:Q,insetInline:Q,insetInlineStart:Q,insetInlineEnd:Q,padding:Q,paddingTop:Q,paddingRight:Q,paddingBottom:Q,paddingLeft:Q,paddingBlock:Q,paddingBlockStart:Q,paddingBlockEnd:Q,paddingInline:Q,paddingInlineStart:Q,paddingInlineEnd:Q,margin:Q,marginTop:Q,marginRight:Q,marginBottom:Q,marginLeft:Q,marginBlock:Q,marginBlockStart:Q,marginBlockEnd:Q,marginInline:Q,marginInlineStart:Q,marginInlineEnd:Q,fontSize:Q,backgroundPositionX:Q,backgroundPositionY:Q,...j2,zIndex:gv,fillOpacity:Ho,strokeOpacity:Ho,numOctaves:gv},B2={...mc,color:Ue,backgroundColor:Ue,outlineColor:Ue,fill:Ue,stroke:Ue,borderColor:Ue,borderTopColor:Ue,borderRightColor:Ue,borderBottomColor:Ue,borderLeftColor:Ue,filter:Nf,WebkitFilter:Nf,mask:Lf,WebkitMask:Lf},tk=e=>B2[e],F2=new Set([Nf,Lf]);function gm(e,t){let n=tk(e);return F2.has(n)||(n=It),n.getAnimatableNone?n.getAnimatableNone(t):void 0}function V2(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var ri=e=>e*180/Math.PI,_f=e=>{const t=ri(Math.atan2(e[1],e[0]));return jf(t)},z2={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:_f,rotateZ:_f,skewX:e=>ri(Math.atan(e[1])),skewY:e=>ri(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},jf=e=>(e=e%360,e<0&&(e+=360),e),vv=_f,yv=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),xv=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),$2={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:yv,scaleY:xv,scale:e=>(yv(e)+xv(e))/2,rotateX:e=>jf(ri(Math.atan2(e[6],e[5]))),rotateY:e=>jf(ri(Math.atan2(-e[2],e[0]))),rotateZ:vv,rotate:vv,skewX:e=>ri(Math.atan(e[4])),skewY:e=>ri(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Uo(e){return e.includes("scale")?1:0}function Bf(e,t){if(!e||e==="none")return Uo(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=$2,i=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=z2,i=a}if(!i)return Uo(t);const s=r[t],o=i[1].split(",").map(W2);return typeof s=="function"?s(o):o[s]}var H2=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return Bf(n,t)};function W2(e){return parseFloat(e.trim())}var Os=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Er=new Set([...Os,"pathRotation"]),bv=e=>e===Is||e===Q,U2=new Set(["x","y","z"]),q2=Os.filter(e=>!U2.has(e));function K2(e){const t=[];return q2.forEach(n=>{const r=e.getValue(n);if(r!==void 0){const i=r.get(),s=n.startsWith("scale")?1:0;if(i===s)return;t.push([n,i]),r.set(s)}}),t}var G2=new Set(["bottom","right"]);function wv(e,t,n,r,i,s){const o=parseFloat(e);if(!isNaN(o))return o;const{min:a,max:l}=t()[n],c=l-a;return s==="border-box"?c:c-parseFloat(r)-parseFloat(i)}var si={width:({width:e,paddingLeft:t="0",paddingRight:n="0",boxSizing:r},i)=>wv(e,i,"x",t,n,r),height:({height:e,paddingTop:t="0",paddingBottom:n="0",boxSizing:r},i)=>wv(e,i,"y",t,n,r),top:({top:e})=>parseFloat(e),left:({left:e})=>parseFloat(e),bottom:({top:e},t)=>{const{y:n}=t();return parseFloat(e)+(n.max-n.min)},right:({left:e},t)=>{const{x:n}=t();return parseFloat(e)+(n.max-n.min)},x:({transform:e})=>Bf(e,"x"),y:({transform:e})=>Bf(e,"y")};si.translateX=si.x;si.translateY=si.y;var oi=new Set,Ff=!1,Vf=!1,zf=!1;function nk(){if(Vf){const e=[],t=new Set,n=new Set;oi.forEach(i=>{i.needsMeasurement&&(e.push(i),t.add(i.element),G2.has(i.name)&&n.add(i.element))});const r=new Map;n.forEach(i=>{const s=K2(i);s.length&&(r.set(i,s),i.render())}),e.forEach(i=>i.measureInitialState()),t.forEach(i=>{i.render();const s=r.get(i);s&&s.forEach(([o,a])=>{i.getValue(o)?.set(a)})}),e.forEach(i=>i.measureEndState()),e.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}Vf=!1,Ff=!1,oi.forEach(e=>e.complete(zf)),oi.clear()}function rk(){oi.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Vf=!0)})}function Q2(){zf=!0,rk(),nk(),zf=!1}function Y2(e,t,n){if(typeof e=="string"){if(rm(e)||im(e))return parseFloat(e);if(!It.test(e)&&It.test(n))return gm(t,n)}return e??void 0}var vm=class{constructor(e,t,n,r,i,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(oi.add(this),Ff||(Ff=!0,we.read(rk),we.resolveKeyframes(nk))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){const i=r?.get(),s=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){const o=Y2(n.readValue(t,s),t,s);o!==void 0&&(e[0]=o)}e[0]===void 0&&(e[0]=s),r&&i===void 0&&r.set(e[0])}V2(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),oi.delete(this)}cancel(){this.state==="scheduled"&&(oi.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}},X2=e=>e.startsWith("--");function ik(e,t,n){X2(t)?e.style.setProperty(t,n):e.style[t]=n}var J2={};function sk(e,t){const n=ES(e);return()=>J2[t]??n()}var Z2=sk(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),ok=sk(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),ro=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Sv={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ro([0,.65,.55,1]),circOut:ro([.55,0,1,.45]),backIn:ro([.31,.01,.66,-.59]),backOut:ro([.33,1.53,.69,.99])};function ak(e,t){if(e)return typeof e=="function"?ok()?GS(e,t):"ease-out":jS(e)?ro(e):Array.isArray(e)?e.map(n=>ak(n,t)||Sv.easeOut):Sv[e]}function eL(e,t,n,{delay:r=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const h=ak(a,i);Array.isArray(h)&&(u.easing=h);const f={delay:r,duration:i,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"};return c&&(f.pseudoElement=c),e.animate(u,f)}function lk(e){return typeof e=="function"&&"applyToOptions"in e}function tL({type:e,...t}){return lk(e)&&ok()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}var ck=class extends mm{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:s=!1,finalKeyframe:o,onComplete:a}=e;this.isPseudoElement=!!i,this.allowFlatten=s,this.options=e,vi(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const l=tL(e);this.animation=eL(t,n,r,l,i),l.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const c=su(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(c),ik(t,n,c),this.animation.cancel()}a?.(),this.notifyFinished()},ek(this,e,l)}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return Lt(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Lt(e)}get time(){return Lt(Number(this.animation.currentTime)||0)}set time(e){const t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Pt(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,onAttach:t,observe:n,...r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&Z2()?(this.animation.timeline=e,Object.assign(this.animation,r),t?.(this.animation),tn):n(this)}},uk={anticipate:NS,backInOut:DS,circInOut:_S};function nL(e){return e in uk}function rL(e){typeof e.ease=="string"&&nL(e.ease)&&(e.ease=uk[e.ease])}var sh=10,iL=class extends ck{constructor(e){rL(e),JS(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:n,onComplete:r,element:i,...s}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}const o=new pc({...s,autoplay:!1}),a=Math.max(sh,it.now()-this.startTime),l=fr(0,sh,a-sh),c=o.sample(a).value,{name:u}=this.options;i&&u&&ik(i,u,c),t.setWithVelocity(o.sample(Math.max(0,a-l)).value,c,l),o.stop()}},kv=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(It.test(e)||e==="0")&&!e.startsWith("url("));function sL(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function oL(e,t,n,r){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const s=e[e.length-1],o=kv(i,t),a=kv(s,t);return!o||!a?(o!==a&&iu(!1,`You are trying to animate ${t} from "${i}" to "${s}". "${o?s:i}" is not an animatable value.`,"value-not-animatable"),!1):sL(e)||(n==="spring"||lk(n))&&r}function $f(e){e.duration=0,e.type="keyframes"}var Hf=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),aL=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function lL(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&aL.test(e[t]))return!0;return!1}var Cv=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),cL=ES(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function uL(e){const{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:s,type:o,keyframes:a}=e;if(!n||!(Hf.has(n)||Cv.has(n)))return!1;const l=t?.owner?.current;if(!(l instanceof HTMLElement)&&!(l instanceof SVGElement))return!1;const{onUpdate:c,transformTemplate:u}=t.owner.getProps();return cL()&&(Hf.has(n)||Cv.has(n)&&lL(a))&&(n!=="transform"||!u)&&!c&&!r&&i!=="mirror"&&s!==0&&o!=="inertia"}var hL=40,fL=class extends mm{constructor(e){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=it.now();const{keyframes:t,name:n,motionValue:r,element:i}=e,s=e;s.autoplay??(s.autoplay=!0),s.delay??(s.delay=0),s.type??(s.type="keyframes"),s.repeat??(s.repeat=0),s.repeatDelay??(s.repeatDelay=0),s.repeatType??(s.repeatType="loop");const o=i?.KeyframeResolver||vm;this.keyframeResolver=new o(t,(a,l,c)=>this.onKeyframesResolved(a,l,s,!c),n,r,i),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;const{name:i,type:s,velocity:o,delay:a,isHandoff:l,onUpdate:c}=n;this.resolvedAt=it.now();let u=!0;oL(e,i,s,o)||(u=!1,(ar.instantAnimations||!a)&&c?.(su(e,n,t)),e[0]=e[e.length-1],$f(n),n.repeat=0);const h=r?this.resolvedAt?this.resolvedAt-this.createdAt>hL?this.resolvedAt:this.createdAt:this.createdAt:void 0,{onComplete:f}=n;n.startTime??(n.startTime=h),n.finalKeyframe=t,n.keyframes=e,n.onComplete=()=>{f?.(),this.notifyFinished()};const d=u&&!l&&uL(n);let m;if(d){n.element=n.motionValue?.owner?.current;try{m=new iL(n)}catch{m=new pc(n)}}else m=new pc(n);this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this._animation.finished:super.finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Q2()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function hk(e,t,n,r=0,i=1){const s=Array.from(e).sort((l,c)=>l.sortNodePosition(c)).indexOf(t),o=e.size,a=(o-1)*r;return typeof n=="function"?n(s,o):i===1?s*r:a-s*r}var Av=30,dL=e=>!isNaN(parseFloat(e)),Tv={current:void 0},pL=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{const r=it.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&(this.notifyChange(),this.dependents))for(const i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=it.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=dL(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){var n;return e==="change"?this.onChangeSubscribe(t):((n=this.events)[e]||(n[e]=new hc)).add(t)}onChangeSubscribe(e){const{events:t}=this;return!t.change&&!this.changeSubscriber?this.changeSubscriber=e:(t.change||(t.change=new hc,t.change.add(this.changeSubscriber),this.changeSubscriber=void 0),t.change.add(e)),()=>{this.changeSubscriber===e?this.changeSubscriber=void 0:t.change?.remove(e),this.stopIfUnobserved()}}stopIfUnobserved(){we.read(()=>{!this.changeSubscriber&&!this.events.change?.getSize()&&this.stop()})}clearListeners(){this.changeSubscriber=void 0;for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.notifyChange()}notifyChange(){const{current:e,changeSubscriber:t}=this;t?t(e):this.events.change?.notify(e)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Tv.current&&Tv.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=it.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Av)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,Av);return MS(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0;let n=!1,r;r=e(()=>{n=!0,this.events.animationComplete?.notify(),this.animation===r&&this.clearAnimation(),t()}),n||(this.animation=r),this.events.animationStart?.notify()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){this.animation=void 0}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function ds(e,t){return new pL(e,t)}function fk(e,t){if(e?.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function ym(e,t){const n=e?.[t]??e?.default??e;return n!==e?fk(n,e):n}var mL={type:"spring",stiffness:500,damping:25,restSpeed:10},gL=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),vL={type:"keyframes",duration:.8},yL={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},xL=(e,{keyframes:t})=>t.length>2?vL:Er.has(e)?e.startsWith("scale")?gL(t[1]):mL:yL,bL=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function wL(e){for(const t in e)if(!bL.has(t))return!0;return!1}var xm=(e,t,n,r={},i,s)=>o=>{const a=ym(r,e)||{},l=a.delay||r.delay||0;let{elapsed:c=0}=r;c=c-Pt(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-c,onUpdate:f=>{t.set(f),a.onUpdate&&a.onUpdate(f)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:s?void 0:i};wL(a)||Object.assign(u,xL(e,u)),u.duration&&(u.duration=Pt(u.duration)),u.repeatDelay&&(u.repeatDelay=Pt(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let h=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&($f(u),u.delay===0&&(h=!0)),(ar.instantAnimations||ar.skipAnimations||i?.shouldSkipAnimations||a.skipAnimations)&&(h=!0,$f(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,h&&!s&&t.get()!==void 0){const f=su(u.keyframes,a);if(f!==void 0){we.update(()=>{u.onUpdate(f),u.onComplete()});return}}return a.isSync?new pc(u):new fL(u)},SL=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function kL(e){const t=SL.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}var CL=4;function dk(e,t,n=1){vi(n<=CL,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,i]=kL(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const o=s.trim();return rm(o)?parseFloat(o):o}return lm(i)?dk(i,t,n+1):i}function AL(e){const t=[{},{}];return e?.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function pk(e,t,n,r){const i=s=>typeof s=="function"?s(n!==void 0?n:e.custom,...AL(r)):s;return t=i(t),typeof t=="string"&&(t=e.variants&&e.variants[t]),i(t)}function ai(e,t,n){return pk(e.getProps(),t,n,e)}var mk=(e,t)=>t==="exit"?e.presenceContext?.custom:void 0,gk=new Set(["width","height","top","left","right","bottom",...Os]),TL=e=>Array.isArray(e);function EL(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,ds(n))}function ML(e){return TL(e)?e[e.length-1]||0:e}function RL(e,t){let{transitionEnd:n={},transition:r={},...i}=ai(e,t)||{};i={...i,...n};for(const s in i)EL(e,s,ML(i[s]))}var st=e=>!!(e&&e.getVelocity);function PL(e){return!!(st(e)&&e.add)}function Wf(e,t){const n=e.getValue("willChange");if(PL(n))return n.add(t);if(!n&&ar.WillChange){const r=new ar.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function bm(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var IL="framerAppearId",vk="data-"+bm(IL);function yk(e){return e.props[vk]}var OL=typeof window<"u";function DL({protectedKeys:e,needsAnimating:t},n){const r=n in e&&!t[n];return t[n]=!1,r}function xk(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:s,transitionEnd:o,...a}=t;const l=e.getDefaultTransition();s=s?fk(s,l):l;const c=s?.reduceMotion,u=s?.skipAnimations;r&&(s=r);const h=[],f=i&&e.animationState?.getState()[i],d=s?.path;d&&d.animateVisualElement(e,a,s,n,h);for(const m in a){const v=e.getValue(m,e.latestValues[m]??null),y=a[m];if(y===void 0||f&&DL(f,m))continue;const x={delay:n,...ym(s||{},m)};u&&(x.skipAnimations=!0);const b=v.get();if(b!==void 0&&!v.isAnimating()&&!Array.isArray(y)&&y===b&&!x.velocity){we.update(()=>v.set(y));continue}let w=!1;if(OL&&window.MotionHandoffAnimation){const A=yk(e);if(A){const k=window.MotionHandoffAnimation(A,m,we);k!==null&&(x.startTime=k,w=!0)}}Wf(e,m);const S=c??e.shouldReduceMotion;v.start(xm(m,v,y,S&&gk.has(m)?{type:!1}:x,e,w));const C=v.animation;C&&h.push(C)}if(o){const m=()=>we.update(()=>{o&&RL(e,o)});h.length?Promise.all(h).then(m):m()}return h}function Uf(e,t,n={}){const r=ai(e,t,mk(e,n.type)),i=n.transitionOverride||(r?.transition??(e.getDefaultTransition()||{})),s=()=>Promise.all(r?xk(e,r,n):[]),o=(l=0)=>{const{variantChildren:c}=e,{delayChildren:u=0,staggerChildren:h,staggerDirection:f}=i,d=[];return c?.forEach(m=>{m.notify("AnimationStart",t),d.push(Uf(m,t,{...n,delay:l+(typeof u=="function"?0:u)+hk(c,m,u,h,f)}).then(()=>m.notify("AnimationComplete",t)))}),Promise.all(d)},{when:a}=i;return a?a==="beforeChildren"?s().then(()=>o()):o().then(s):Promise.all([s(),o(n.delay)])}function NL(e,t,n={}){return e.notify("AnimationStart",t),(Array.isArray(t)?Promise.all(t.map(r=>Uf(e,r,n))):typeof t=="string"?Uf(e,t,n):Promise.all(xk(e,ai(e,t,n.custom),n))).then(()=>{e.notify("AnimationComplete",t)})}var LL={test:e=>e==="auto",parse:e=>e},_L=e=>t=>t.test(e),jL=[Is,Q,Pn,Vn,KN,qN,LL],Ev=e=>jL.find(_L(e));function BL(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||im(e):!0}var FL=new Set(["auto","none","0"]);function VL(e,t,n){let r=0,i;for(;r<e.length&&!i;){const s=e[r];typeof s=="string"&&!FL.has(s)&&ZN(s)&&(i=e[r]),r++}if(i&&n)for(const s of t)e[s]!==i&&(e[s]=gm(n,i))}var zL=class extends vm{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let a=0;a<e.length;a++){let l=e[a];if(typeof l=="string"&&(l=l.trim(),lm(l))){const c=dk(l,t.current);c!==void 0&&(e[a]=c),a===e.length-1&&(this.finalKeyframe=l)}}if(this.resolveNoneKeyframes(),!gk.has(n)||e.length!==2)return;const[r,i]=e;if(typeof r=="number"&&typeof i=="number")return;const s=Ev(r),o=Ev(i);if(cv(r)!==cv(i)&&si[n]){this.needsMeasurement=!0;return}if(s!==o)if(bv(s)&&bv(o))for(let a=0;a<e.length;a++){const l=e[a];typeof l=="string"&&(e[a]=parseFloat(l))}else si[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,n=[];for(let r=0;r<e.length;r++)(e[r]===null||BL(e[r]))&&n.push(r);n.length&&VL(e,n,t)}measure(){const{element:e,name:t}=this;return si[t](window.getComputedStyle(e.current),()=>e.measureViewportBox())}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),t[0]=this.measuredOrigin;const r=t[t.length-1];r!==void 0&&this.motionValue?.jump(r,!1)}measureEndState(){const{element:e,unresolvedKeyframes:t}=this;if(!e||!e.current)return;this.motionValue?.jump(this.measuredOrigin,!1);const n=t.length-1,r=t[n];t[n]=this.measure(),r!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach(([i,s])=>{e.getValue(i).set(s)}),this.resolveNoneKeyframes()}},wm=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function $L(e){return TS(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}function Sm(e){return TS(e)&&"ownerSVGElement"in e}var qf=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function bk(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;t&&(r=t.current);const i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(r=>r!=null)}var HL={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},WL=Os.length;function UL(e,t,n){let r="",i=!0;for(let o=0;o<WL;o++){const a=Os[o],l=e[a];if(l===void 0)continue;let c=!0;if(typeof l=="number")c=l===(a.startsWith("scale")?1:0);else{const u=parseFloat(l);c=a.startsWith("scale")?u===1:u===0}if(!c||n){const u=qf(l,mc[a]);if(!c){i=!1;const h=HL[a]||a;r+=`${h}(${u}) `}n&&(t[a]=u)}}const s=e.pathRotation;return s&&(i=!1,r+=`rotate(${qf(s,mc.pathRotation)}) `),r=r.trim(),n?r=n(t,i?"":r):i&&(r="none"),r}function km(e,t,n){const{style:r,vars:i,transformOrigin:s}=e;let o=!1,a=!1;for(const l in t){const c=t[l];if(Er.has(l)){o=!0;continue}else if(FS(l)){i[l]=c;continue}else{const u=qf(c,mc[l]);l.startsWith("origin")?(a=!0,s[l]=u):r[l]=u}}if(t.transform||(o||n?r.transform=UL(t,e.transform,n):r.transform&&(r.transform="none")),a){const{originX:l="50%",originY:c="50%",originZ:u=0}=s;r.transformOrigin=`${l} ${c} ${u}`}}var qL={offset:"stroke-dashoffset",array:"stroke-dasharray"},KL={offset:"strokeDashoffset",array:"strokeDasharray"};function GL(e,t,n=1,r=0,i=!0){e.pathLength=1;const s=i?qL:KL;e[s.offset]=`${-r}`,e[s.array]=`${t} ${n}`}var wk=["transform","opacity","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function Sk(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:s=1,pathOffset:o=0,...a},l,c,u){if(km(e,a,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:f}=e;for(const d of wk)h[d]!==void 0&&(f[d]=h[d],delete h[d]);(f.transform||h.transformOrigin)&&(f.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??"fill-box",delete h.transformBox),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),i!==void 0&&GL(h,i,s,o,!1)}function kk({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function QL({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function YL(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function oh(e){return e===void 0||e===1}function Kf({scale:e,scaleX:t,scaleY:n}){return!oh(e)||!oh(t)||!oh(n)}function Jr(e){return Kf(e)||Ck(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function Ck(e){return Mv(e.x)||Mv(e.y)}function Mv(e){return e&&e!=="0%"}function gc(e,t,n){return n+t*(e-n)}function Rv(e,t,n,r,i){return i!==void 0&&(e=gc(e,i,r)),gc(e,n,r)+t}function Gf(e,t=0,n=1,r,i){e.min=Rv(e.min,t,n,r,i),e.max=Rv(e.max,t,n,r,i)}function Ak(e,{x:t,y:n}){Gf(e.x,t.translate,t.scale,t.originPoint),Gf(e.y,n.translate,n.scale,n.originPoint)}var Pv=.999999999999,Iv=1.0000000000001;function XL(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let s,o;for(let a=0;a<i;a++){s=n[a],o=s.projectionDelta;const{visualElement:l}=s.options;l&&l.props.style&&l.props.style.display==="contents"||(r&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(Sn(e.x,-s.scroll.offset.x),Sn(e.y,-s.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Ak(e,o)),r&&Jr(s.latestValues)&&Ml(e,s.latestValues,s.layout?.layoutBox))}t.x<Iv&&t.x>Pv&&(t.x=1),t.y<Iv&&t.y>Pv&&(t.y=1)}function Sn(e,t){e.min+=t,e.max+=t}function Ov(e,t,n,r,i=.5){Gf(e,t,n,ye(e.min,e.max,i),r)}function Dv(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Ml(e,t,n){const r=n??e;Ov(e.x,Dv(t.x,r.x),t.scaleX,t.scale,t.originX),Ov(e.y,Dv(t.y,r.y),t.scaleY,t.scale,t.originY)}function Tk(e,t){return kk(YL(e.getBoundingClientRect(),t))}function JL(e,t,n){const r=Tk(e,n),{scroll:i}=t;return i&&(Sn(r.x,i.offset.x),Sn(r.y,i.offset.y)),r}var{schedule:Cm,cancel:b6}=KS(queueMicrotask,!1),Kt={x:!1,y:!1};function Ek(){return Kt.x||Kt.y}function ZL(e){return e==="x"||e==="y"?Kt[e]?null:(Kt[e]=!0,()=>{Kt[e]=!1}):Kt.x||Kt.y?null:(Kt.x=Kt.y=!0,()=>{Kt.x=Kt.y=!1})}function Mk(e,t){const n=bk(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function e_(e){return!(e.pointerType==="touch"||Ek())}function t_(e,t,n={}){const[r,i,s]=Mk(e,n);return r.forEach(o=>{let a=!1,l=!1,c;const u=()=>{o.removeEventListener("pointerleave",m)},h=y=>{c&&(c(y),c=void 0),u()},f=y=>{a=!1,window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",f),l&&(l=!1,h(y))},d=()=>{a=!0,window.addEventListener("pointerup",f,i),window.addEventListener("pointercancel",f,i)},m=y=>{if(y.pointerType!=="touch"){if(a){l=!0;return}h(y)}},v=y=>{if(!e_(y))return;l=!1;const x=t(o,y);typeof x=="function"&&(c=x,o.addEventListener("pointerleave",m,i))};o.addEventListener("pointerenter",v,i),o.addEventListener("pointerdown",d,i)}),s}var Rk=(e,t)=>t?e===t?!0:Rk(e,t.parentElement):!1,Am=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,n_=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function r_(e){return n_.has(e.tagName)||e.isContentEditable===!0}var i_=new Set(["INPUT","SELECT","TEXTAREA"]);function s_(e){return i_.has(e.tagName)||e.isContentEditable===!0}var Rl=new WeakSet;function Nv(e){return t=>{t.key==="Enter"&&e(t)}}function ah(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}var o_=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=Nv(()=>{if(Rl.has(n))return;ah(n,"down");const i=Nv(()=>{ah(n,"up")}),s=()=>ah(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Lv(e){return Am(e)&&!Ek()}var _v=new WeakSet;function a_(e,t,n={}){const[r,i,s]=Mk(e,n),o=a=>{const l=a.currentTarget;if(!Lv(a)||_v.has(a))return;Rl.add(l),n.stopPropagation&&_v.add(a);const c=t(l,a),u={...i,capture:!0},h=(m,v)=>{window.removeEventListener("pointerup",f,u),window.removeEventListener("pointercancel",d,u),Rl.has(l)&&Rl.delete(l),Lv(m)&&typeof c=="function"&&c(m,{success:v})},f=m=>{h(m,l===window||l===document||n.useGlobalTarget||Rk(l,m.target))},d=m=>{h(m,!1)};window.addEventListener("pointerup",f,u),window.addEventListener("pointercancel",d,u)};return r.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,i),$L(a)&&(a.addEventListener("focus",l=>o_(l,i)),!r_(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),s}var Pl=new WeakMap,Il,Pk=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+"Size"]:Sm(r)&&"getBBox"in r?r.getBBox()[t]:r[n],l_=Pk("inline","width","offsetWidth"),c_=Pk("block","height","offsetHeight");function u_({target:e,borderBoxSize:t}){Pl.get(e)?.forEach(n=>{n(e,{get width(){return l_(e,t)},get height(){return c_(e,t)}})})}function h_(e){e.forEach(u_)}function f_(){typeof ResizeObserver>"u"||(Il=new ResizeObserver(h_))}function d_(e,t){Il||f_();const n=bk(e);return n.forEach(r=>{let i=Pl.get(r);i||(i=new Set,Pl.set(r,i)),i.add(t),Il?.observe(r)}),()=>{n.forEach(r=>{const i=Pl.get(r);i?.delete(t),i?.size||Il?.unobserve(r)})}}var Ol=new Set,Ui;function p_(){Ui=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Ol.forEach(t=>t(e))},window.addEventListener("resize",Ui)}function m_(e){return Ol.add(e),Ui||p_(),()=>{Ol.delete(e),!Ol.size&&typeof Ui=="function"&&(window.removeEventListener("resize",Ui),Ui=void 0)}}function jv(e,t){return typeof e=="function"?m_(e):d_(e,t)}var Bi={value:null,addProjectionMetrics:null};function g_(e){return Sm(e)&&e.tagName==="svg"}var Bv=e=>typeof e=="number"?e:parseFloat(e),Fv=()=>({translate:0,scale:1,origin:0,originPoint:0}),qi=()=>({x:Fv(),y:Fv()}),Vv=()=>({min:0,max:0}),He=()=>({x:Vv(),y:Vv()}),v_=new WeakMap;function ou(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function qo(e){return typeof e=="string"||Array.isArray(e)}var Tm=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],zv=["initial",...Tm];function au(e){if(ou(e.animate))return!0;for(let t=0;t<zv.length;t++)if(qo(e[zv[t]]))return!0;return!1}function Ik(e){return!!(au(e)||e.variants)}function y_(e,t,n){for(const r in t){const i=t[r],s=n[r];if(st(i))e.addValue(r,i);else if(st(s))e.addValue(r,ds(i,{owner:e}));else if(s!==i)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=e.getStaticValue(r);e.addValue(r,ds(o!==void 0?o:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}var $v=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],vc={};function Ok(e){vc=e}function x_(){return vc}var b_=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=vm,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=it.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,we.render(this.render,!1,!0))};const{latestValues:l,renderState:c}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=a,this.blockInitialAnimation=!!s,this.isControllingVariants=au(t),this.isVariantNode=Ik(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:u,...h}=this.scrapeMotionValuesFromProps(t,{},this);for(const f in h){const d=h[f];l[f]!==void 0&&st(d)&&d.set(l[f])}}mount(e){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];if(this.current=e,v_.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.isVariantNode&&!this.isControllingVariants){let t=this;do t=t.props.inherit!==!1&&t.parent;while(t&&!t.isVariantNode);if(t){const{variantChildren:n}=t;n.add(this),this.removeFromVariantTree=()=>n.delete(this)}}this.values.forEach((t,n)=>this.bindToMotionValue(n,t)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(gM.current||mM(),this.shouldReduceMotion=fM.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Ir(this.notifyUpdate),Ir(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&Hf.has(e)&&this.current instanceof HTMLElement){const{factory:s,keyframes:o,times:a,ease:l,duration:c}=t.accelerate,u=new ck({element:this.current,name:e,keyframes:o,times:a,ease:l,duration:Pt(c)}),h=s(u);this.valueSubscriptions.set(e,()=>{h(),u.cancel()});return}const n=Er.has(e);n&&this.onBindTransform&&this.onBindTransform();const r=t.on("change",s=>{this.latestValues[e]=s,this.props.onUpdate&&we.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!e.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in vc){const t=vc[e];if(!t)continue;const{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):He()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let n=0;n<$v.length;n++){const r=$v[n];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const i=e["on"+r];i&&(this.propEventSubscriptions[r]=this.on(r,i))}this.prevMotionValues=y_(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}addValue(e,t){const n=this.values.get(e);if(t!==n){n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t);const r=t.get();r!==void 0&&(this.latestValues[e]=r)}}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=ds(t??this.getDefaultValue?.(e),{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n=="string"&&(rm(n)||im(n))?n=parseFloat(n):typeof n!="number"&&!It.test(n)&&It.test(t)&&(n=gm(e,t)),this.setBaseTarget(e,st(n)?n.get():n)),st(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}on(e,t){return this.events[e]||(this.events[e]=new hc),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Cm.render(this.render)}},Dk=class extends b_{constructor(){super(...arguments),this.KeyframeResolver=zL}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){const n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;st(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}},zr=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function Nk(e,{style:t,vars:n},r,i){const s=e.style;let o;for(o in t)s[o]=t[o];i?.applyProjectionStyles(s,r);for(o in n)s.setProperty(o,n[o])}var Ko={};function Lk(e,{layout:t,layoutId:n}){return Er.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Ko[e]||e==="opacity")}function Em(e,t,n){const r=e.style,i=t?.style,s={};if(!r)return s;for(const o in r)(st(r[o])||i&&st(i[o])||Lk(o,e)||n?.getValue(o)?.liveStyle!==void 0)&&(s[o]=r[o]);return s}function w_(e){return window.getComputedStyle(e)}var S_=class extends Dk{constructor(){super(...arguments),this.type="html",this.renderInstance=Nk}mount(e){vi(!!e.style,"motion.create() components must forward their ref to a HTML or SVG element","custom-component-ref"),super.mount(e)}readValueFromInstance(e,t){if(Er.has(t))return this.projection?.isProjecting?Uo(t):H2(e,t);{const n=w_(e),r=(FS(t)?n.getPropertyValue(t):n[t])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Tk(e,t)}build(e,t,n){km(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Em(e,t,n)}},_k=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),jk=e=>typeof e=="string"&&e.toLowerCase()==="svg";function k_(e,t,n,r){Nk(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(_k.has(i)?i:bm(i),t.attrs[i])}function Bk(e,t,n){const r=Em(e,t,n);for(const i in e)if(st(e[i])||st(t[i])){const s=Os.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[s]=e[i]}return r}var C_=class extends Dk{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=He}getBaseTargetFromProps(e,t){return Er.has(t)?super.getBaseTargetFromProps(e,t)??Uo(t):e[t]}getDefaultValue(e){return Er.has(e)?this.latestValues[e]??Uo(e):void 0}readValueFromInstance(e,t){if(Er.has(t)){const n=tk(t);return n&&n.default||0}if(wk.includes(t)){const n=getComputedStyle(e)[t];if(typeof n=="string"&&n)return n.trim()}return t=_k.has(t)?t:bm(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Bk(e,t,n)}build(e,t,n){Sk(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){k_(e,t,n,r)}mount(e){this.isSVGTag=jk(e.tagName),super.mount(e)}};function Fk(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var A_=[...Tm].reverse();function T_(e){let t=a=>Promise.all(a.map(({animation:l,options:c})=>NL(e,l,c))),n=Hv(),r=!0,i=!1;function s(a){const{props:l,parent:c,manuallyAnimateOnMount:u}=e,h=r||i,f=[],d=new Set;let m={},v=1/0,y=e;do y=y.props.inherit!==!1&&y.parent;while(y&&!y.isControllingVariants);if(A_.forEach((b,w)=>{const S=n[b],C=l[b],A=y&&y.props[b],k=C!==void 0?C:qo(A)||A===!1?A:void 0,E=qo(k),T=b===a?S.isActive:null;T===!1&&(v=w);const R=E&&C===void 0&&!(h&&u);if(S.protectedKeys={...m},!S.isActive&&T===null||!k&&!S.prevProp||ou(k)||typeof k=="boolean")return;if(b==="exit"&&S.isActive&&T!==!0){m={...m,...S.prevResolvedValues};return}const P=E_(S.prevProp,k);let M=P||E&&(T&&!R||w>v),N=!1;const L=Array.isArray(k)?k:[k];let I={};if(T!==!1)for(const j of L){const{transition:$,transitionEnd:B,...D}=ai(e,j,mk(e,b))||{};I={...I,...D,...B}}const{prevResolvedValues:_}=S;for(const j in{..._,...I}){if(j in m)continue;const $=I[j],B=_[j],D=Array.isArray($)&&Array.isArray(B)?!Fk($,B)||P:$!==B;if(D&&$==null)d.add(j);else if(D||$!==void 0&&d.has(j)){M=!0,d.delete(j)&&(N=!0),S.needsAnimating[j]=!0;const se=e.getValue(j);se&&(se.liveStyle=!1)}else S.protectedKeys[j]=!0}if(S.prevProp=k,S.prevResolvedValues=I,S.isActive&&(m={...m,...I}),M&&(!(R&&P)||N))for(const j of L){const $={type:b};if(typeof j=="string"&&h&&u&&c?.enteringChildren){const B=ai(c,j)?.transition?.delayChildren;$.delay=hk(c.enteringChildren,e,B)}f.push({animation:j,options:$})}}),d.size){const{initial:b}=l,w={},S=typeof b!="boolean"&&ai(e,Array.isArray(b)?b[0]:b,e.presenceContext?.custom);S&&S.transition&&(w.transition=S.transition),d.forEach(C=>{const A=e.getValue(C);A&&(A.liveStyle=!0);const k=S&&!Array.isArray(b)?S[C]:void 0,E=e.getBaseTargetFromProps(l,C);w[C]=(k!==void 0?k:E!==void 0&&!st(E)?E:e.initialValues[C]===void 0?e.baseTarget[C]:void 0)??null}),f.push({animation:w})}const x=h&&e.blockInitialAnimation||r&&!u&&(l.initial===!1||l.initial===l.animate);return r=i=!1,!x&&f.length?t(f):Promise.resolve()}function o(a,l){if(n[a].isActive===l)return Promise.resolve();e.variantChildren?.forEach(u=>u.animationState?.setActive(a,l)),n[a].isActive=l;const c=s(a);for(const u in n)n[u].protectedKeys={};return c}return{animateChanges:s,setActive:o,setAnimateFunction:a=>{t=a(e)},getState:()=>n,reset:()=>{n=Hv(),i=!0}}}function E_(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!Fk(t,e):!1}function Hv(){const e={};for(const t of Tm)e[t]={isActive:t==="animate",protectedKeys:{},needsAnimating:{},prevResolvedValues:{}};return e}function Qf(e,t){e.min=t.min,e.max=t.max}function Ht(e,t){Qf(e.x,t.x),Qf(e.y,t.y)}function Wv(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var M_=.9999,R_=1.0001,P_=-.01,I_=.01;function dt(e){return e.max-e.min}function O_(e,t,n){return Math.abs(e-t)<=n}function Uv(e,t,n,r=.5){e.origin=r,e.originPoint=ye(t.min,t.max,e.origin),e.scale=dt(n)/dt(t),e.translate=ye(n.min,n.max,e.origin)-e.originPoint,(e.scale>=M_&&e.scale<=R_||isNaN(e.scale))&&(e.scale=1),(e.translate>=P_&&e.translate<=I_||isNaN(e.translate))&&(e.translate=0)}function So(e,t,n,r){Uv(e.x,t.x,n.x,r?r.originX:void 0),Uv(e.y,t.y,n.y,r?r.originY:void 0)}function qv(e,t,n,r=0){e.min=(r?ye(n.min,n.max,r):n.min)+t.min,e.max=e.min+dt(t)}function D_(e,t,n,r){qv(e.x,t.x,n.x,r?.x),qv(e.y,t.y,n.y,r?.y)}function Kv(e,t,n,r=0){const i=r?ye(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+dt(t)}function yc(e,t,n,r){Kv(e.x,t.x,n.x,r?.x),Kv(e.y,t.y,n.y,r?.y)}function Gv(e,t,n,r,i){return e-=t,e=gc(e,1/n,r),i!==void 0&&(e=gc(e,1/i,r)),e}function N_(e,t=0,n=1,r=.5,i,s=e,o=e){if(Pn.test(t)&&(t=parseFloat(t),t=ye(o.min,o.max,t/100)-o.min),typeof t!="number")return;let a=ye(s.min,s.max,r);e===s&&(a-=t),e.min=Gv(e.min,t,n,a,i),e.max=Gv(e.max,t,n,a,i)}function Qv(e,t,[n,r,i],s,o){N_(e,t[n],t[r],t[i],t.scale,s,o)}var L_=["x","scaleX","originX"],__=["y","scaleY","originY"];function Yv(e,t,n,r){Qv(e.x,t,L_,n?n.x:void 0,r?r.x:void 0),Qv(e.y,t,__,n?n.y:void 0,r?r.y:void 0)}function Xv(e){return e.translate===0&&e.scale===1}function Vk(e){return Xv(e.x)&&Xv(e.y)}function Jv(e,t){return e.min===t.min&&e.max===t.max}function j_(e,t){return Jv(e.x,t.x)&&Jv(e.y,t.y)}function Zv(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function zk(e,t){return Zv(e.x,t.x)&&Zv(e.y,t.y)}function e0(e){return dt(e.x)/dt(e.y)}function t0(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function bn(e){return[e("x"),e("y")]}function n0(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var Ws={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Q.test(e))e=parseFloat(e);else return e;return`${n0(e,t.target.x)}% ${n0(e,t.target.y)}%`}},B_={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=It.parse(e);if(i.length>5)return r;const s=It.createTransformer(e),o=typeof i[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;i[0+o]/=a,i[1+o]/=l;const c=ye(a,l,.5);return typeof i[2+o]=="number"&&(i[2+o]/=c),typeof i[3+o]=="number"&&(i[3+o]/=c),s(i)}};function F_(e,t,n){let r="";const i=e.x.translate/t.x,s=e.y.translate/t.y,o=n?.z||0;if((i||s||o)&&(r=`translate3d(${i}px, ${s}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:c,rotate:u,pathRotation:h,rotateX:f,rotateY:d,skewX:m,skewY:v}=n;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),h&&(r+=`rotate(${h}deg) `),f&&(r+=`rotateX(${f}deg) `),d&&(r+=`rotateY(${d}deg) `),m&&(r+=`skewX(${m}deg) `),v&&(r+=`skewY(${v}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}var V_=wm.length,r0=e=>typeof e=="number"||Q.test(e);function z_(e,t,n,r,i,s){i?(e.opacity=ye(0,n.opacity??1,$_(r)),e.opacityExit=ye(t.opacity??1,0,H_(r))):s&&(e.opacity=ye(t.opacity??1,n.opacity??1,r));for(let o=0;o<V_;o++){const a=wm[o];let l=i0(t,a),c=i0(n,a);l===void 0&&c===void 0||(l||(l=0),c||(c=0),l===0||c===0||r0(l)===r0(c)?(e[a]=Math.max(ye(Bv(l),Bv(c),r),0),(Pn.test(c)||Pn.test(l))&&(e[a]+="%")):e[a]=c)}(t.rotate||n.rotate)&&(e.rotate=ye(t.rotate||0,n.rotate||0,r))}function i0(e,t){return e[t]!==void 0?e[t]:e.borderRadius}var $_=$k(0,.5,LS),H_=$k(.5,.95,tn);function $k(e,t,n){return r=>r<e?0:r>t?1:n($o(e,t,r))}function W_(e,t,n){const r=st(e)?e:ds(e);return r.start(xm("",r,t,n)),r.animation}function Go(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var U_=(e,t)=>e.depth-t.depth,q_=class{constructor(){this.children=[],this.isDirty=!1}add(e){nm(this.children,e),this.isDirty=!0}remove(e){uc(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(U_),this.isDirty=!1,this.children.forEach(e)}};function K_(e,t){const n=it.now(),r=({timestamp:i})=>{const s=i-n;s>=t&&(Ir(r),e(s-t))};return we.setup(r,!0),()=>Ir(r)}function Dl(e){return st(e)?e.get():e}var G_=class{constructor(){this.members=[]}add(e){nm(this.members,e);for(let t=this.members.length-1;t>=0;t--){const n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;const r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(uc(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(uc(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){const n=this.members[t];if(n.isPresent!==!1&&n.instance?.isConnected!==!1)return this.promote(n),!0}return!1}promote(e,t){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();const{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},Q_={borderRadius:{...Ws,applyTo:[...wm]},borderTopLeftRadius:Ws,borderTopRightRadius:Ws,borderBottomLeftRadius:Ws,borderBottomRightRadius:Ws,boxShadow:B_},Nl={hasAnimatedSinceResize:!0,hasEverUpdated:!1};Object.assign(Ko,{...Q_,...Ko});var Zr={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},lh=["","X","Y","Z"],Y_=1e3,X_=0;function ch(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function Hk(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=yk(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",we,!(i||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&Hk(r)}function Wk({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(o={},a=t?.()){this.id=X_++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Bi.value&&(Zr.nodes=Zr.calculatedTargetDeltas=Zr.calculatedProjections=0),this.nodes.forEach(ej),this.nodes.forEach(aj),this.nodes.forEach(lj),this.nodes.forEach(tj),Bi.addProjectionMetrics&&Bi.addProjectionMetrics(Zr)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new q_)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new hc),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const l=this.eventHandlers.get(o);l&&l.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=Sm(o)&&!g_(o),this.instance=o;const{layoutId:a,layout:l,visualElement:c}=this.options;if(c&&!c.current&&c.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||a)&&(this.isLayoutDirty=!0),e){let u,h=0;const f=()=>this.root.updateBlockedByResize=!1;we.read(()=>{h=window.innerWidth}),e(o,()=>{const d=window.innerWidth;d!==h&&(h=d,this.root.updateBlockedByResize=!0,u&&u(),u=K_(f,250),Nl.hasAnimatedSinceResize&&(Nl.hasAnimatedSinceResize=!1,this.nodes.forEach(a0)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&c&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:f,layout:d})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||dj,{onLayoutAnimationStart:v,onLayoutAnimationComplete:y}=c.getProps(),x=!this.targetLayout||!zk(this.targetLayout,d),b=!h&&f;if(this.options.layoutRoot||this.resumeFrom||b||h&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const w={...ym(m,"layout"),onPlay:v,onComplete:y};(c.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w),this.setAnimationOrigin(u,b,w.path)}else h||a0(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=d})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Ir(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(cj),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Hk(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const h=this.path[u];h.shouldResetTransform=!0,(typeof h.latestValues.x=="string"||typeof h.latestValues.y=="string")&&(h.isLayoutDirty=!0),h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const a=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),a&&this.nodes.forEach(rj),this.nodes.forEach(s0);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(o0);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(ij),this.nodes.forEach(sj),this.nodes.forEach(oj),this.nodes.forEach(J_),this.nodes.forEach(Z_)):this.nodes.forEach(o0),this.clearAllSnapshots();const o=it.now();We.delta=fr(0,1e3/60,o-We.timestamp),We.timestamp=o,We.isProcessing=!0,rh.update.process(We),rh.preRender.process(We),rh.render.process(We),We.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Cm.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(nj),this.sharedNodes.forEach(uj)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,we.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){we.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!dt(this.snapshot.measuredBox.x)&&!dt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected||(this.layoutCorrected=He()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&this.instance){const l=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!i)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!Vk(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;o&&this.instance&&(a||Jr(this.latestValues)||u)&&(i(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),pj(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return He();const a=o.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(mj))){const{scroll:l}=this.root;l&&(Sn(a.x,l.offset.x),Sn(a.y,l.offset.y))}return a}removeElementScroll(o){const a=He();if(Ht(a,o),this.scroll?.wasRoot)return a;for(let l=0;l<this.path.length;l++){const c=this.path[l],{scroll:u,options:h}=c;c!==this.root&&u&&h.layoutScroll&&(u.wasRoot&&Ht(a,o),Sn(a.x,u.offset.x),Sn(a.y,u.offset.y))}return a}applyTransform(o,a=!1,l){const c=l||He();Ht(c,o);for(let u=0;u<this.path.length;u++){const h=this.path[u];!a&&h.options.layoutScroll&&h.scroll&&h!==h.root&&(Sn(c.x,-h.scroll.offset.x),Sn(c.y,-h.scroll.offset.y)),Jr(h.latestValues)&&Ml(c,h.latestValues,h.layout?.layoutBox)}return Jr(this.latestValues)&&Ml(c,this.latestValues,this.layout?.layoutBox),c}removeTransform(o){const a=He();Ht(a,o);for(let l=0;l<this.path.length;l++){const c=this.path[l];if(!Jr(c.latestValues))continue;let u;c.instance&&(Kf(c.latestValues)&&c.updateSnapshot(),u=He(),Ht(u,c.measurePageBox())),Yv(a,c.latestValues,c.snapshot?.layoutBox,u)}return Jr(this.latestValues)&&Yv(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==We.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==a;if(!(o||l&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:c,layoutId:u}=this.options;if(!this.layout||!(c||u))return;this.resolvedRelativeTargetAt=We.timestamp;const h=this.getClosestProjectingParent();!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&h&&h.layout?this.createRelativeTarget(h,this.layout.layoutBox,h.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=He(),this.targetWithTransforms=He()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),D_(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Ht(this.target,this.layout.layoutBox),Ak(this.target,this.targetDelta)):Ht(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&h&&!!h.resumingFrom==!!this.resumingFrom&&!h.options.layoutScroll&&h.target&&this.animationProgress!==1?this.createRelativeTarget(h,this.target,h.target):this.relativeParent=this.relativeTarget=void 0),Bi.value&&Zr.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||Kf(this.parent.latestValues)||Ck(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,a,l){this.relativeParent=o,this.forceRelativeParentToResolveTarget(),this.relativeTarget=He(),this.relativeTargetOrigin=He(),yc(this.relativeTargetOrigin,a,l,this.options.layoutAnchor||void 0),Ht(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const o=this.getLead(),a=!!this.resumingFrom||this!==o;let l=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(l=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===We.timestamp&&(l=!1),l)return;const{layout:c,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||u))return;Ht(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,f=this.treeScale.y;XL(this.layoutCorrected,this.treeScale,this.path,a),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=He());const{target:d}=o;if(!d){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Wv(this.prevProjectionDelta.x,this.projectionDelta.x),Wv(this.prevProjectionDelta.y,this.projectionDelta.y)),So(this.projectionDelta,this.layoutCorrected,d,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==f||!t0(this.projectionDelta.x,this.prevProjectionDelta.x)||!t0(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",d)),Bi.value&&Zr.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){if(this.options.visualElement?.scheduleRender(),o){const a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=qi(),this.projectionDelta=qi(),this.projectionDeltaWithTransform=qi()}setAnimationOrigin(o,a=!1,l){const c=this.snapshot,u=c?c.latestValues:{},h={...this.latestValues},f=qi();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const d=He(),m=(c?c.source:void 0)!==(this.layout?this.layout.source:void 0),v=this.getStack(),y=!v||v.members.length<=1,x=!!(m&&!y&&this.options.crossfade===!0&&!this.path.some(fj));this.animationProgress=0;let b;const w=l?.interpolateProjection(o);this.mixTargetDelta=S=>{const C=S/1e3,A=w?.(C);A?(f.x.translate=A.x,f.x.scale=ye(o.x.scale,1,C),f.x.origin=o.x.origin,f.x.originPoint=o.x.originPoint,f.y.translate=A.y,f.y.scale=ye(o.y.scale,1,C),f.y.origin=o.y.origin,f.y.originPoint=o.y.originPoint):(l0(f.x,o.x,C),l0(f.y,o.y,C)),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(yc(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),hj(this.relativeTarget,this.relativeTargetOrigin,d,C),b&&j_(this.relativeTarget,b)&&(this.isProjectionDirty=!1),b||(b=He()),Ht(b,this.relativeTarget)),m&&(this.animationValues=h,z_(h,u,this.latestValues,C,x,y)),A&&A.rotate!==void 0&&(this.animationValues||(this.animationValues=h),this.animationValues.pathRotation=A.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Ir(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=we.update(()=>{Nl.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=ds(0)),this.motionValue.jump(0,!1),this.currentAnimation=W_(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),O2(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Y_),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead(),{targetWithTransforms:a,layout:l,latestValues:c}=o;let{target:u}=o;if(!(!a||!u||!l)){if(this!==o&&this.layout&&l&&Uk(this.options.animationType,this.layout.layoutBox,l.layoutBox)){u=this.target||He();const h=dt(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+h;const f=dt(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+f}Ht(a,u),Ml(a,c),So(this.projectionDeltaWithTransform,this.layoutCorrected,a,c)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new G_),this.sharedNodes.get(o).add(a);const l=a.options.initialPromotionConfig;a.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){const{layoutId:o}=this.options;return o?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:o}=this.options;return o?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&ch("z",o,c,this.animationValues);for(let u=0;u<lh.length;u++)ch(`rotate${lh[u]}`,o,c,this.animationValues),ch(`skew${lh[u]}`,o,c,this.animationValues);o.render();for(const u in c)o.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);o.scheduleRender()}applyProjectionStyles(o,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=Dl(a?.pointerEvents)||"",o.transform=l?l(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=Dl(a?.pointerEvents)||""),this.hasProjected&&!Jr(this.latestValues)&&(o.transform=l?l({},""):"none",this.hasProjected=!1);return}o.visibility="";const u=c.animationValues||c.latestValues;this.applyTransformsToTarget();let h=F_(this.projectionDeltaWithTransform,this.treeScale,u);l&&(h=l(u,h)),o.transform=h;const{x:f,y:d}=this.projectionDelta;o.transformOrigin=`${f.origin*100}% ${d.origin*100}% 0`,c.animationValues?o.opacity=c===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:o.opacity=c===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const m in Ko){if(u[m]===void 0)continue;const{correct:v,applyTo:y,isCSSVariable:x}=Ko[m],b=h==="none"?u[m]:v(u[m],c);if(y){const w=y.length;for(let S=0;S<w;S++)o[y[S]]=b}else x?this.options.visualElement.renderState.vars[m]=b:o[m]=b}this.options.layoutId&&(o.pointerEvents=c===this?Dl(a?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>o.currentAnimation?.stop()),this.root.nodes.forEach(s0),this.root.sharedNodes.clear()}}}function J_(e){e.updateLayout()}function Z_(e){const t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,s=t.source!==e.layout.source;if(i==="size")bn(u=>{const h=s?t.measuredBox[u]:t.layoutBox[u],f=dt(h);h.min=n[u].min,h.max=h.min+f});else if(i==="x"||i==="y"){const u=i==="x"?"y":"x";Qf(s?t.measuredBox[u]:t.layoutBox[u],n[u])}else Uk(i,t.layoutBox,n)&&bn(u=>{const h=s?t.measuredBox[u]:t.layoutBox[u],f=dt(n[u]);h.max=h.min+f,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[u].max=e.relativeTarget[u].min+f)});const o=qi();So(o,n,t.layoutBox);const a=qi();s?So(a,e.applyTransform(r,!0),t.measuredBox):So(a,n,t.layoutBox);const l=!Vk(o);let c=!1;if(!e.resumeFrom){const u=e.getClosestProjectingParent();if(u&&!u.resumeFrom){const{snapshot:h,layout:f}=u;if(h&&f){const d=e.options.layoutAnchor||void 0,m=He();yc(m,t.layoutBox,h.layoutBox,d);const v=He();yc(v,n,f.layoutBox,d),zk(m,v)||(c=!0),u.options.layoutRoot&&(e.relativeTarget=v,e.relativeTargetOrigin=m,e.relativeParent=u)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:a,layoutDelta:o,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function ej(e){Bi.value&&Zr.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function tj(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function nj(e){e.clearSnapshot()}function s0(e){e.clearMeasurements()}function rj(e){e.isLayoutDirty=!0,e.updateLayout()}function o0(e){e.isLayoutDirty=!1}function ij(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function sj(e){e.relativeTarget&&e.relativeParent?.isLayoutDirty&&(e.currentAnimation?e.isLayoutDirty=!0:(e.targetDelta=void 0,e.removeRelativeTarget()))}function oj(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function a0(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function aj(e){e.resolveTargetDelta()}function lj(e){e.calcProjection()}function cj(e){e.resetSkewAndRotation()}function uj(e){e.removeLeadSnapshot()}function l0(e,t,n){e.translate=ye(t.translate,0,n),e.scale=ye(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function c0(e,t,n,r){e.min=ye(t.min,n.min,r),e.max=ye(t.max,n.max,r)}function hj(e,t,n,r){c0(e.x,t.x,n.x,r),c0(e.y,t.y,n.y,r)}function fj(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var dj={duration:.45,ease:[.4,0,.1,1]},u0=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),h0=u0("applewebkit/")&&!u0("chrome/")?Math.round:tn;function f0(e){e.min=h0(e.min),e.max=h0(e.max)}function pj(e){f0(e.x),f0(e.y)}function Uk(e,t,n){return e==="position"||e==="preserve-aspect"&&!O_(e0(t),e0(n),.2)}function mj(e){return e!==e.root&&e.scroll?.wasRoot}var gj=Wk({attachResizeListener:(e,t)=>Go(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),uh={current:void 0},qk=Wk({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!uh.current){const e=new gj({});e.mount(window),e.setOptions({layoutScroll:!0}),uh.current=e}return uh.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Kk=(0,g.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function vj(e=!0){const t=(0,g.useContext)(ru);if(t===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=t,s=(0,g.useId)();(0,g.useEffect)(()=>{if(e)return i(s)},[e]);const o=(0,g.useCallback)(()=>e&&r&&r(s),[s,r,e]);return!n&&r?[!1,o]:[!0]}function S6(){return yj((0,g.useContext)(ru))}function yj(e){return e===null?!0:e.isPresent}var Gk=(0,g.createContext)({strict:!1}),d0={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},p0=!1;function xj(){if(p0)return;const e={};for(const t in d0)e[t]={isEnabled:n=>d0[t].some(r=>!!n[r])};Ok(e),p0=!0}function Qk(){return xj(),x_()}function bj(e){const t=Qk();for(const n in e)t[n]={...t[n],...e[n]};Ok(t)}var lu=(0,g.createContext)({});function wj(e,t){if(au(e)){const{initial:n,animate:r}=e;return{initial:n===!1||qo(n)?n:void 0,animate:qo(r)?r:void 0}}return e.inherit!==!1?t:{}}function Sj(e){const{initial:t,animate:n}=wj(e,(0,g.useContext)(lu));return(0,g.useMemo)(()=>({initial:t,animate:n}),[m0(t),m0(n)])}function m0(e){return Array.isArray(e)?e.join(" "):e}var Mm=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Yk(e,t,n){for(const r in t)!st(t[r])&&!Lk(r,n)&&(e[r]=t[r])}function kj({transformTemplate:e},t){return(0,g.useMemo)(()=>{const n=Mm();return km(n,t,e),Object.assign({},n.vars,n.style)},[t])}function Cj(e,t){const n=e.style||{},r={};return Yk(r,n,e),Object.assign(r,kj(e,t)),r}function Aj(e,t){const n={},r=Cj(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var Xk=()=>({...Mm(),attrs:{}});function Tj(e,t,n,r){const i=(0,g.useMemo)(()=>{const s=Xk();return Sk(s,t,jk(r),e.transformTemplate,e.style),{...s.attrs,style:{...s.style}}},[t]);if(e.style){const s={};Yk(s,e.style,e),i.style={...s,...i.style}}return i}var Ej=new Set(["animate","exit","variants","initial","style","values","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function xc(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||Ej.has(e)}function Mj(e,t){return e.startsWith("on")?!xc(e):t?.(e)??!xc(e)}function Rj(e,t,n,r){const i={};for(const s in e)s==="values"&&typeof e.values=="object"||st(e[s])||(Mj(s,r)||n===!0&&xc(s)||!t&&!xc(s)||e.draggable&&s.startsWith("onDrag"))&&(i[s]=e[s]);return i}var Pj=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Rm(e){return typeof e!="string"||e.includes("-")?!1:!!(Pj.indexOf(e)>-1||/[A-Z]/u.test(e))}function Ij(e,t,n,{latestValues:r},i,s=!1,o,a){const l=(o??Rm(e)?Tj:Aj)(t,r,i,e),c=Rj(t,typeof e=="string",s,a),u=e!==g.Fragment?{...c,...l,ref:n}:{},{children:h}=t,f=(0,g.useMemo)(()=>st(h)?h.get():h,[h]);return(0,g.createElement)(e,{...u,children:f})}function Oj({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:Dj(n,r,i,e),renderState:t()}}function Dj(e,t,n,r){const i={},s=r(e,{});for(const f in s)i[f]=Dl(s[f]);let{initial:o,animate:a}=e;const l=au(e),c=Ik(e);t&&c&&!l&&e.inherit!==!1&&(o===void 0&&(o=t.initial),a===void 0&&(a=t.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const h=u?a:o;if(h&&typeof h!="boolean"&&!ou(h)){const f=Array.isArray(h)?h:[h];for(let d=0;d<f.length;d++){const m=pk(e,f[d]);if(m){const{transitionEnd:v,transition:y,...x}=m;for(const b in x){let w=x[b];if(Array.isArray(w)){const S=u?w.length-1:0;w=w[S]}w!==null&&(i[b]=w)}for(const b in v)i[b]=v[b]}}}return i}var Jk=e=>(t,n)=>{const r=(0,g.useContext)(lu),i=(0,g.useContext)(ru),s=()=>Oj(e,t,r,i);return n?s():PN(s)},Nj=Jk({scrapeMotionValuesFromProps:Em,createRenderState:Mm}),Lj=Jk({scrapeMotionValuesFromProps:Bk,createRenderState:Xk}),_j=Symbol.for("motionComponentSymbol");function jj(e,t,n){const r=(0,g.useRef)(n);(0,g.useInsertionEffect)(()=>{r.current=n});const i=(0,g.useRef)(null);return(0,g.useCallback)(s=>{s&&e.onMount?.(s),t&&(s?t.mount(s):t.unmount());const o=r.current;if(typeof o=="function")if(s){const a=o(s);typeof a=="function"&&(i.current=a)}else i.current?(i.current(),i.current=null):o(s);else o&&(o.current=s)},[t])}var Zk=(0,g.createContext)({});function Fi(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Bj(e,t,n,r,i,s){const{visualElement:o}=(0,g.useContext)(lu),a=(0,g.useContext)(Gk),l=(0,g.useContext)(ru),c=(0,g.useContext)(Kk),u=c.reducedMotion,h=c.skipAnimations,f=(0,g.useRef)(null),d=(0,g.useRef)(!1);r=r||a.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:u,skipAnimations:h,isSVG:s}),d.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));const m=f.current,v=(0,g.useContext)(Zk);m&&!m.projection&&i&&(m.type==="html"||m.type==="svg")&&Fj(f.current,n,i,v);const y=(0,g.useRef)(!1);(0,g.useInsertionEffect)(()=>{m&&y.current&&m.update(n,l)});const x=n[vk],b=(0,g.useRef)(!!x&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(x)&&window.MotionHasOptimisedAnimation?.(x));return ov(()=>{!d.current||!m||(m.animationState?.animateChanges(),m.enteringChildren=void 0)},[]),ov(()=>{d.current=!0,m&&(y.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),b.current&&m.animationState&&m.animationState.animateChanges())}),(0,g.useEffect)(()=>{m&&(!b.current&&m.animationState&&m.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(x)}),b.current=!1),m.enteringChildren=void 0)}),m}function Fj(e,t,n,r){const{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutAnchor:u,layoutCrossfade:h}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:e1(e.parent)),e.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&Fi(a),visualElement:e,animationType:typeof s=="string"?s:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:l,layoutRoot:c,layoutAnchor:u})}function e1(e){if(e)return e.options.allowProjection!==!1?e.projection:e1(e.parent)}function hh(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&bj(r);const s=n?n==="svg":Rm(e),o=s?Lj:Nj;function a(c,u){let h;const f={...(0,g.useContext)(Kk),...c,layoutId:Vj(c)},{isStatic:d,isValidProp:m}=f,v=Sj(c),y=o(c,d);if(!d&&typeof window<"u"){zj(f,r);const x=$j(f);h=x.MeasureLayout,v.visualElement=Bj(e,y,f,i,x.ProjectionNode,s)}return(0,p.jsxs)(lu.Provider,{value:v,children:[h&&v.visualElement?(0,p.jsx)(h,{visualElement:v.visualElement,...f}):null,Ij(e,c,jj(y,v.visualElement,u),y,d,t,s,m)]})}a.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const l=(0,g.forwardRef)(a);return l[_j]=e,l}function Vj({layoutId:e}){const t=(0,g.useContext)(AS).id;return t&&e!==void 0?t+"-"+e:e}function zj(e,t){(0,g.useContext)(Gk).strict}function $j(e){const{drag:t,layout:n}=Qk();if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Hj(e,t){if(typeof Proxy>"u")return hh;const n=new Map,r=(s,o)=>hh(s,o,e,t),i=(s,o)=>r(s,o);return new Proxy(i,{get:(s,o)=>o==="create"?r:(n.has(o)||n.set(o,hh(o,void 0,e,t)),n.get(o))})}var Wj=(e,t)=>t.isSVG??Rm(e)?new C_(t):new S_(t,{allowProjection:e!==g.Fragment}),Uj=class extends zr{constructor(e){super(e),e.animationState||(e.animationState=T_(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();ou(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},qj=0,Kj=class extends zr{constructor(){super(...arguments),this.id=qj++}update(){const{presenceContext:e,prevPresenceContext:t,animationState:n}=this.node;if(!e||!n)return;const{isPresent:r,onExitComplete:i}=e,s=t?.isPresent;if(r===s)return;if(r&&s===!1){if(this.exit===!0){const{initial:a}=this.node.getProps();if(a&&!Array.isArray(a)){const{transition:l,transitionEnd:c,...u}=ai(this.node,a)||{};for(const h in u)this.node.getValue(h)?.jump(u[h])}this.node.blockInitialAnimation=!1,n.reset(),n.animateChanges()}else n.setActive("exit",!1);this.exit=void 0;return}const o=this.exit=n.setActive("exit",!r);i&&!r&&o.then(()=>{this.exit===o&&(this.exit=!0,i(this.id))})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}},Gj={animation:{Feature:Uj},exit:{Feature:Kj}};function cu(e){return{point:{x:e.pageX,y:e.pageY}}}var Qj=e=>t=>Am(t)&&e(t,cu(t));function ko(e,t,n,r){return Go(e,t,Qj(n),r)}var t1=({current:e})=>e?e.ownerDocument.defaultView:null,g0=(e,t)=>Math.abs(e-t);function Yj(e,t){const n=g0(e.x,t.x),r=g0(e.y,t.y);return Math.sqrt(n**2+r**2)}var v0=new Set(["auto","scroll"]),n1=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:s=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=f=>{this.handleScroll(f.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=Ka(this.lastRawMoveEventInfo,this.transformPagePoint));const f=fh(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,m=Yj(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!d&&!m)return;const{point:v}=f;this.history.push({...v,timestamp:it.now()});const{onStart:y,onMove:x}=this.handlers;d||(y&&y(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,f)},this.handlePointerMove=(f,d)=>{this.lastMoveEvent=f,this.lastRawMoveEventInfo=d,this.lastMoveEventInfo=Ka(d,this.transformPagePoint),this.hasPendingMove=!0,we.update(this.updatePoint,!0)},this.handlePointerUp=(f,d)=>{this.hasPendingMove&&this.updatePoint(),this.end();const{onEnd:m,onSessionEnd:v,resumeAnimation:y}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=fh(f.type==="pointercancel"?this.lastMoveEventInfo:Ka(d,this.transformPagePoint),this.history);this.startEvent&&m&&m(f,x),v&&v(f,x)},!Am(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=s,this.contextWindow=r||window;const a=Ka(cu(e),this.transformPagePoint),{point:l}=a,{timestamp:c}=We;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,fh(a,this.history));const h={passive:!0,capture:!0};this.removeListeners=wa(ko(this.contextWindow,"pointermove",this.handlePointerMove,h),ko(this.contextWindow,"pointerup",this.handlePointerUp,h),ko(this.contextWindow,"pointercancel",this.handlePointerUp,h)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){const n=getComputedStyle(t);(v0.has(n.overflowX)||v0.has(n.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),we.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Ir(this.updatePoint)}};function Ka(e,t){return t?{point:t(e.point)}:e}function y0(e,t){return{x:e.x-t.x,y:e.y-t.y}}function fh({point:e},t){return{point:e,delta:y0(e,r1(t)),offset:y0(e,Xj(t)),velocity:Jj(t,.1)}}function Xj(e){return e[0]}function r1(e){return e[e.length-1]}function Jj(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=r1(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Pt(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>Pt(t)*2&&(r=e[1]);const s=Lt(i.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-r.x)/s,y:(i.y-r.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Zj(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?ye(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?ye(n,e,r.max):Math.min(e,n)),e}function x0(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function eB(e,{top:t,left:n,bottom:r,right:i}){return{x:x0(e.x,n,i),y:x0(e.y,t,r)}}function b0(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function tB(e,t){return{x:b0(e.x,t.x),y:b0(e.y,t.y)}}function nB(e,t){let n=.5;const r=dt(e),i=dt(t);return i>r?n=$o(t.min,t.max-r,e.min):r>i&&(n=$o(e.min,e.max-i,t.min)),fr(0,1,n)}function rB(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var Yf=.35;function iB(e=Yf){return e===!1?e=0:e===!0&&(e=Yf),{x:w0(e,"left","right"),y:w0(e,"top","bottom")}}function w0(e,t,n){return{min:S0(e,t),max:S0(e,n)}}function S0(e,t){return typeof e=="number"?e:e[t]||0}var sB=new WeakMap,oB=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=He(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=u=>{t&&this.snapToCursor(u),this.stopAnimation()},s=(u,h)=>{const{drag:f,dragPropagation:d,onDragStart:m}=this.getProps();if(f&&!d&&(this.openDragLock&&this.openDragLock(),this.openDragLock=ZL(f),!this.openDragLock))return;this.latestPointerEvent=u,this.latestPanInfo=h,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),bn(y=>{let x=this.getAxisMotionValue(y).get()||0;if(Pn.test(x)){const{projection:b}=this.visualElement;if(b&&b.layout){const w=b.layout.layoutBox[y];w&&(x=dt(w)*(parseFloat(x)/100))}}this.originPoint[y]=x}),m&&we.update(()=>m(u,h),!1,!0),Wf(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},o=(u,h)=>{this.latestPointerEvent=u,this.latestPanInfo=h;const{dragPropagation:f,dragDirectionLock:d,onDirectionLock:m,onDrag:v}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:y}=h;if(d&&this.currentDirection===null){this.currentDirection=lB(y),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",h.point,y),this.updateAxis("y",h.point,y),this.visualElement.render(),v&&we.update(()=>v(u,h),!1,!0)},a=(u,h)=>{this.latestPointerEvent=u,this.latestPanInfo=h,this.stop(u,h),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>{const{dragSnapToOrigin:u}=this.getProps();(u||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:c}=this.getProps();this.panSession=new n1(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:n,contextWindow:t1(this.visualElement),element:this.visualElement.current})}stop(e,t){const n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;const{velocity:s}=r;this.startAnimation(s);const{onDragEnd:o}=this.getProps();o&&we.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){const{drag:r}=this.getProps();if(!n||!Ga(e,r,this.currentDirection))return;const i=this.getAxisMotionValue(e);let s=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(s=Zj(s,this.constraints[e],this.elastic[e])),i.set(s)}resolveConstraints(){const{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&Fi(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&n?this.constraints=eB(n.layoutBox,e):this.constraints=!1,this.elastic=iB(t),r!==this.constraints&&!Fi(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&bn(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=rB(n.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Fi(e))return!1;const n=e.current;vi(n!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());const i=JL(n,r.root,this.visualElement.getTransformPagePoint());let s=tB(r.layout.layoutBox,i);if(t){const o=t(QL(s));this.hasMutatedConstraints=!!o,o&&(s=kk(o))}return s}startAnimation(e){const{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:s,onDragTransitionEnd:o}=this.getProps(),a=this.constraints||{},l=bn(c=>{if(!Ga(c,t,this.currentDirection))return;let u=a&&a[c]||{};(s===!0||s===c)&&(u={min:0,max:0});const h=r?200:1e6,f=r?40:1e7,d={type:"inertia",velocity:n?e[c]:0,bounceStiffness:h,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...i,...u};return this.startAxisValueAnimation(c,d)});return Promise.all(l).then(o)}startAxisValueAnimation(e,t){const n=this.getAxisMotionValue(e);return Wf(this.visualElement,e),n.start(xm(e,n,0,t,this.visualElement,!1))}stopAnimation(){bn(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps()[t];return n||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor({clientX:e,clientY:t}){const{drag:n}=this.getProps(),r={x:e,y:t},i=this.visualElement.getTransformPagePoint()?.(r)||r,s=this.visualElement.measureViewportBox();bn(o=>{if(!Ga(o,n,this.currentDirection))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=s[o];a.set((a.get()||0)+i[o]-ye(l,c,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!Fi(t)||!n||!this.constraints)return;this.stopAnimation();const r=this.constraints,i={x:0,y:0};bn(o=>{const a=this.getAxisMotionValue(o).get();i[o]=nB({min:a,max:a},r[o])});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),bn(o=>{const a=this.getAxisMotionValue(o);if(!Ga(o,e,null)||!a.get())return;const{min:l,max:c}=this.constraints[o];a.set(ye(l,c,i[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;sB.set(this.visualElement,this);const e=this.visualElement.current,t=ko(e,"pointerdown",l=>{const{drag:c,dragListener:u=!0}=this.getProps(),h=l.target,f=h!==e&&s_(h);c&&u&&!f&&this.start(l)});let n;const r=()=>{const{dragConstraints:l}=this.getProps();Fi(l)&&l.current&&(this.constraints=this.resolveRefConstraints(),n||(n=aB(e,l.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,s=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),we.read(r);const o=Go(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",(({delta:l,hasLayoutChanged:c})=>{this.isDragging&&c&&(bn(u=>{const h=this.getAxisMotionValue(u);h&&(this.originPoint[u]+=l[u].translate,h.set(h.get()+l[u].translate))}),this.visualElement.render())}));return()=>{o(),t(),s(),a&&a(),n&&n()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:s=Yf,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:s,dragMomentum:o}}};function k0(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function aB(e,t,n){const r=jv(e,k0(n)),i=jv(t,k0(n));return()=>{r(),i()}}function Ga(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function lB(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}var cB=class extends zr{constructor(e){super(e),this.removeGroupControls=tn,this.removeListeners=tn,this.controls=new oB(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||tn}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},dh=e=>(t,n)=>{e&&we.update(()=>e(t,n),!1,!0)},uB=class extends zr{constructor(){super(...arguments),this.removePointerDownListener=tn}onPointerDown(e){this.session=new n1(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:t1(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:dh(e),onStart:dh(t),onMove:dh(n),onEnd:(i,s)=>{delete this.session,r&&we.postRender(()=>r(i,s))}}}mount(){this.removePointerDownListener=ko(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},ph=!1,hB=class extends g.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),ph&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Nl.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:s}=n;return s&&(s.isPresent=i,e.layoutDependency!==t&&s.setOptions({...s.options,layoutDependency:t}),ph=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?s.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?s.promote():s.relegate()||we.postRender(()=>{const o=s.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),Cm.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;ph=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}};function i1(e){const[t,n]=vj(),r=(0,g.useContext)(AS);return(0,p.jsx)(hB,{...e,layoutGroup:r,switchLayoutGroup:(0,g.useContext)(Zk),isPresent:t,safeToRemove:n})}var fB={pan:{Feature:uB},drag:{Feature:cB,ProjectionNode:qk,MeasureLayout:i1}};function C0(e,t,n){const{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover",n==="Start");const i=r["onHover"+n];i&&we.postRender(()=>i(t,cu(t)))}var dB=class extends zr{mount(){const{current:e}=this.node;e&&(this.unmount=t_(e,(t,n)=>(C0(this.node,n,"Start"),r=>C0(this.node,r,"End"))))}unmount(){}},pB=class extends zr{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=wa(Go(this.node.current,"focus",()=>this.onFocus()),Go(this.node.current,"blur",()=>this.onBlur()))}unmount(){}};function A0(e,t,n){const{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap",n==="Start");const i=r["onTap"+(n==="End"?"":n)];i&&we.postRender(()=>i(t,cu(t)))}var mB=class extends zr{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=a_(e,(r,i)=>(A0(this.node,i,"Start"),(s,{success:o})=>A0(this.node,s,o?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},Xf=new WeakMap,mh=new WeakMap,gB=e=>{const t=Xf.get(e.target);t&&t(e)},vB=e=>{e.forEach(gB)};function yB({root:e,...t}){const n=e||document;mh.has(n)||mh.set(n,{});const r=mh.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(vB,{root:e,...t})),r[i]}function xB(e,t,n){const r=yB(t);return Xf.set(e,n),r.observe(e),()=>{Xf.delete(e),r.unobserve(e)}}var bB={some:0,all:1},wB=class extends zr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r="some",once:i}=e,s={root:t?t.current:void 0,rootMargin:n,threshold:typeof r=="number"?r:bB[r]},o=a=>{const{isIntersecting:l}=a;if(this.isInView===l||(this.isInView=l,i&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:c,onViewportLeave:u}=this.node.getProps(),h=l?c:u;h&&h(a)};this.stopObserver=xB(this.node.current,s,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(SB(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function SB({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var kB={inView:{Feature:wB},tap:{Feature:mB},focus:{Feature:pB},hover:{Feature:dB}},CB={layout:{ProjectionNode:qk,MeasureLayout:i1}},AB={...Gj,...kB,...fB,...CB},s1=Hj(AB,Wj);function TB(){return document.activeElement?.closest('[role="dialog"],[role="alertdialog"]')??document.body}async function uu(e){try{return await navigator.clipboard.writeText(e),!0}catch{const t=document.createElement("textarea");try{return t.value=e,t.style.position="fixed",t.style.opacity="0",TB().appendChild(t),t.select(),t.selectionStart!==0||t.selectionEnd!==t.value.length?(console.warn("Clipboard copy failed: fallback selection did not take, nothing was copied"),!1):document.execCommand("copy")?(console.warn("Clipboard API unavailable, used deprecated execCommand fallback"),!0):(console.warn("Clipboard copy failed: execCommand fallback reported failure"),!1)}catch{return console.warn("Clipboard copy failed: both modern and fallback methods failed"),!1}finally{t.remove()}}}var EB="Project connection defaults are still syncing. Try again in a moment.",k6="Finishing setup.",MB=1e4,RB={hover:!0,touch:!1},PB={top:0,right:0,bottom:0,left:0},o1=["inline","pip","fullscreen"];function a1(){return{headers:{},requestTimeout:MB}}function C6(){return{version:1,connectionDefaults:a1(),clientCapabilities:zc()}}function A6(e){return{theme:e.theme,displayMode:e.displayMode,availableDisplayModes:o1,locale:e.locale,timeZone:e.timeZone,deviceCapabilities:e.deviceCapabilities,safeAreaInsets:e.safeAreaInsets}}function T6(e){if(!e||typeof e!="object")return!1;const t=e;return t.version===1&&(t.connectionDefaults===void 0||u1(t.connectionDefaults))&&ps(t.clientCapabilities)&&ps(t.hostContext)}function IB(e,t=zc()){return ps(e)?e:t}function OB(e,t={}){return ps(e)?e:t}function E6(e){return{version:1,connectionDefaults:l1(e?.connectionDefaults),clientCapabilities:IB(e?.clientCapabilities)}}function M6(e,t={}){return OB(e?.hostContext,t)}function l1(e,t=a1()){return u1(e)?{headers:h1(e.headers),requestTimeout:BB(e.requestTimeout,t.requestTimeout)}:t}function R6(e){return l1(e?.connectionDefaults)}function P6(e,t){return{...h1(e),...jB(t)}}function I6(e){return DB(e?.clientCapabilities??zc())}function DB(e){return GE(e)}function NB(e){const t=e?.availableDisplayModes;if(!Array.isArray(t))return o1;const n=t.filter(c1);return n.length>0?n:["inline"]}function LB(e){const t=e?.displayMode;return c1(t)?t:void 0}function O6(e){return _B(LB(e),NB(e))}function D6(e){const t=e?.theme;return t==="light"||t==="dark"?t:void 0}function N6(e,t="en-US"){return typeof e?.locale=="string"?e.locale:t}function L6(e,t="UTC"){return typeof e?.timeZone=="string"?e.timeZone:t}function _6(e,t=RB){const n=e?.deviceCapabilities;if(!n||typeof n!="object"||Array.isArray(n))return t;const r=n;return{hover:r.hover??t.hover,touch:r.touch??t.touch}}function j6(e,t=PB){const n=e?.safeAreaInsets;if(!n||typeof n!="object"||Array.isArray(n))return t;const r=n;return{top:r.top??t.top,right:r.right??t.right,bottom:r.bottom??t.bottom,left:r.left??t.left}}function _B(e,t){return e&&t.includes(e)?e:t[0]??"inline"}function c1(e){return e==="inline"||e==="pip"||e==="fullscreen"}function u1(e){return!ps(e)||e.headers!==void 0&&!ps(e.headers)?!1:e.requestTimeout===void 0||typeof e.requestTimeout=="number"&&Number.isFinite(e.requestTimeout)}function h1(e){return e?Object.fromEntries(Object.entries(e).filter(([t,n])=>t.trim()!==""&&t.toLowerCase()!=="authorization"&&typeof n=="string")):{}}function jB(e){return e?Object.fromEntries(Object.entries(e).filter(([t,n])=>t.trim()!==""&&typeof n=="string")):{}}function BB(e,t){return typeof e!="number"||!Number.isFinite(e)||e<=0?t:e}function ps(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var FB=class extends Error{reason;constructor(e,t){super(t?`App is still bootstrapping (${e}): ${t}`:`App is still bootstrapping (${e}). Wait for useAppReady() to resolve before initiating requests.`),this.name="BootstrapNotReadyError",this.reason=e}},Jf="mcpjam:task-bookmarks-changed";function VB(){typeof window<"u"&&window.dispatchEvent(new Event(Jf))}function B6(e){return window.addEventListener(Jf,e),window.addEventListener("storage",e),()=>{window.removeEventListener(Jf,e),window.removeEventListener("storage",e)}}var zB=2e3,$B=6048e5;function F6(e){return e!=="working"&&e!=="input_required"}function V6(e,t){return Math.max(e,zB,t??0)}function HB(e,t){return e&&t?JSON.stringify(["owned-task-v1",e,t]):void 0}var hu,Qo;function WB(e){hu=e??void 0}function UB(){return hu}function qB(e,t){Qo=HB(e,t)}function Pm(){return Qo}function ms(e){return e.connectionId!==void 0||e.sourceExecutionId!==void 0}function Ca(e){return{...e,scope:e.scope??(ms(e)?Qo:hu)}}function f1(e){return ms(e)?Qo!==void 0&&e.scope===Qo:e.scope===hu}function Zf(e,t){const n=`${t?.scope??(t?.connectionId!==void 0?Pm():UB())??""}\0${e}`;return t?.wire!==void 0||t?.connectionId!==void 0?`${n}\0${t.wire??""}\0${t.connectionId??""}`:n}function Ds(e,t){return e.connectionId===t?.connectionId&&(t?.scope===void 0||e.scope===t.scope)&&(t?.wire===void 0||e.wire===t.wire)}var d1="mcp-tracked-tasks",p1="mcp-tracked-tasks-v4",Ll=4,KB=50,gs=1024,m1=100,GB=524288;function jt(e){return Xr(e)}function QB(e,t){const n=Date.parse(e.createdAt);return Number.isNaN(n)?!0:t-n<$B}function Wt(e){if(typeof e=="string")return e.length>gs?e.slice(0,gs):e}function Yt(e){if(typeof e=="string")return e.length>gs||e.includes("\0")?void 0:e}function qr(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function T0(e){if(typeof e!="object"||e===null||Array.isArray(e))return;const t=e,n=Yt(t.taskId),r=Yt(t.serverId),i=Wt(t.createdAt);if(!n||!r)return;const s=Yt(t.connectionId),o=Yt(t.sourceExecutionId);if(t.connectionId!==void 0&&!s||t.sourceExecutionId!==void 0&&!o)return;const a=Yt(t.scope);if(t.scope!==void 0&&a===void 0||!i||Number.isNaN(Date.parse(i)))return;const l=t.wire==="extension"||t.wire==="legacy"?t.wire:"legacy",c=t.ttlMs===null?null:qr(t.ttlMs),u=Array.isArray(t.respondedInputKeys)?t.respondedInputKeys.filter(h=>typeof h=="string").slice(0,m1).map(h=>h.slice(0,gs)):void 0;return{taskId:n,serverId:r,wire:l,createdAt:i,...Wt(t.toolName)?{toolName:Wt(t.toolName)}:{},...t.primitiveType==="tool"||t.primitiveType==="prompt"||t.primitiveType==="resource"?{primitiveType:t.primitiveType}:{},...Wt(t.primitiveName)?{primitiveName:Wt(t.primitiveName)}:{},...t.dismissed===!0?{dismissed:!0}:{},...t.expired===!0?{expired:!0}:{},...a!==void 0?{scope:a}:{},...s!==void 0?{connectionId:s}:{},...o!==void 0?{sourceExecutionId:o}:{},...Wt(t.serverName)?{serverName:Wt(t.serverName)}:{},...Wt(t.lastUpdatedAt)?{lastUpdatedAt:Wt(t.lastUpdatedAt)}:{},...Wt(t.status)?{status:Wt(t.status)}:{},...c!==void 0?{ttlMs:c}:{},...qr(t.pollIntervalMs)!==void 0?{pollIntervalMs:qr(t.pollIntervalMs)}:{},...qr(t.nextPollAt)!==void 0?{nextPollAt:qr(t.nextPollAt)}:{},...qr(t.lastObservedAt)!==void 0?{lastObservedAt:qr(t.lastObservedAt)}:{},...u?.length?{respondedInputKeys:u}:{}}}function YB(e){if(Array.isArray(e))return e.map(T0).filter(n=>n!==void 0);if(typeof e!="object"||e===null)return[];const t=e;return typeof t.version=="number"&&t.version>Ll?[]:Array.isArray(t.tasks)?t.tasks.map(T0).filter(n=>n!==void 0):[]}function E0(e){try{const t=localStorage.getItem(e);return t?YB(JSON.parse(t)).filter(n=>QB(n,Date.now())):[]}catch{return[]}}function fu(){const e=E0(d1).filter(n=>!ms(n)),t=E0(p1);return[...new Map([...e,...t].map(n=>[jt(n),n])).values()]}function ln(){return fu().filter(f1)}function Aa(e){Im([...e,...fu().filter(t=>!f1(t))])}function Im(e){try{let t=e,n=JSON.stringify({version:Ll,tasks:t});for(;n.length>GB&&t.length>1;)t=t.slice(0,Math.floor(t.length/2)),n=JSON.stringify({version:Ll,tasks:t});localStorage.setItem(d1,JSON.stringify({version:3,tasks:t.filter(r=>!ms(r))})),localStorage.setItem(p1,JSON.stringify({version:Ll,tasks:t.filter(ms)})),VB()}catch{}}function z6(){return ln()}function $6(e,t,n,r){return ln().filter(i=>i.serverId===e&&!i.dismissed&&Ds(i,{wire:t,connectionId:n,scope:r}))}function H6(e,t,n){return ln().find(r=>r.taskId===e&&(t===void 0||r.serverId===t)&&Ds(r,n))}function W6(e){const t=Ca(e);if(ms(t)&&t.scope===void 0||Yt(t.taskId)===void 0||Yt(t.serverId)===void 0||t.scope!==void 0&&Yt(t.scope)===void 0||t.connectionId!==void 0&&!Yt(t.connectionId)||t.sourceExecutionId!==void 0&&!Yt(t.sourceExecutionId))return;const n=fu(),r=jt(t);if(n.some(o=>jt(o)===r))return;const i=o=>(o.scope??void 0)===(t.scope??void 0),s=n.filter(i);s.unshift({...t,dismissed:!1}),Im([...s.slice(0,KB),...n.filter(o=>!i(o))])}function XB(e,t){t.status!==void 0&&(e.status=t.status),t.lastUpdatedAt!==void 0&&(e.lastUpdatedAt=t.lastUpdatedAt),t.ttlMs!==void 0&&(e.ttlMs=t.ttlMs),t.pollIntervalMs!==void 0&&(e.pollIntervalMs=t.pollIntervalMs),t.nextPollAt!==void 0&&(e.nextPollAt=t.nextPollAt),t.lastObservedAt!==void 0&&(e.lastObservedAt=t.lastObservedAt)}function U6(e){if(e.length===0)return;const t=ln(),n=new Map(t.map(i=>[jt(i),i]));let r=!1;for(const{identity:i,observation:s}of e){const o=n.get(jt(Ca(i)));o&&(XB(o,s),r=!0)}r&&Aa(t)}function q6(e){const t=new Map;if(e.length===0)return t;const n=new Map;for(const r of e)n.set(jt(Ca(r)),jt(r));for(const r of ln()){const i=n.get(jt(r));i!==void 0&&t.set(i,{nextPollAt:r.nextPollAt,lastObservedAt:r.lastObservedAt,pollIntervalMs:r.pollIntervalMs,ttlMs:r.ttlMs,status:r.status,respondedInputKeys:r.respondedInputKeys??[]})}return t}function K6(e,t){if(t.length===0)return;const n=jt(Ca(e)),r=ln(),i=r.find(s=>jt(s)===n);i&&(i.respondedInputKeys=[...new Set([...i.respondedInputKeys??[],...t])].slice(0,m1).map(s=>s.slice(0,gs)),Aa(r))}function G6(e){const t=jt(Ca(e));return ln().find(n=>jt(n)===t)?.respondedInputKeys??[]}function Q6(e,t,n){const r=ln();for(const i of r)i.taskId===e&&(t===void 0||i.serverId===t)&&Ds(i,n)&&(i.expired=!0);Aa(r)}function Y6(e,t,n){const r=new Set(t),i=ln();for(const s of i)s.serverId===e&&r.has(s.taskId)&&Ds(s,n)&&(s.dismissed=!0);Aa(i)}var g1="mcp-dismissed-registry-tasks",JB=200;function Om(){try{const e=localStorage.getItem(g1);if(!e)return{};const t=JSON.parse(e);if(typeof t!="object"||t===null||Array.isArray(t))return{};const n={};for(const[r,i]of Object.entries(t))Array.isArray(i)&&(n[r]=i.filter(s=>typeof s=="string"&&s.length>0&&s.length<=gs).slice(0,JB));return n}catch{return{}}}function v1(e){try{localStorage.setItem(g1,JSON.stringify(e))}catch{}}function X6(e,t,n){if(n?.connectionId!==void 0&&n.scope===void 0&&Pm()===void 0)return;const r=t.filter(o=>Yt(o)!==void 0);if(r.length===0)return;const i=Om(),s=Zf(e,n);i[s]=[...new Set([...i[s]??[],...r])].slice(-200),v1(i)}function J6(e,t){if(t?.connectionId!==void 0&&t.scope===void 0&&Pm()===void 0)return new Set;const n=new Set(ln().filter(s=>s.serverId===e&&s.dismissed&&Ds(s,t)).map(s=>s.taskId)),r=Om(),i=[Zf(e,t)];t?.connectionId===void 0&&t?.scope===void 0&&i.push(Zf(e));for(const s of i)for(const o of r[s]??[])n.add(o);return n}function Z6(e,t){Aa(ln().filter(n=>n.serverId!==e||!Ds(n,t)))}function ZB(e){const t=e??void 0;Im(fu().filter(s=>(s.scope??void 0)!==t));const n=Om(),r=`${t??""}\0`;let i=!1;for(const s of Object.keys(n))s.startsWith(r)&&(delete n[s],i=!0);i&&v1(n)}var y1={projectId:null,serverIdsByName:{}},Z=y1,Gt=null,Or=0,ed=new Set,io=3e4,eF=3e3,tF=100,gh=null;function Dm(){Gt=null}var nF=1e4;async function rF(){if(Ki())return null;const e=Z.getAccessToken;if(!e)return null;const t=Or;Dm();let n;try{const r=await Promise.race([e({forceRefresh:!0}),new Promise(i=>{n=setTimeout(()=>i(null),nF)})]);return!r||t!==Or?null:(Gt={token:r,expiresAt:Date.now()+io,kind:"session"},r)}catch{return null}finally{clearTimeout(n)}}function x1(){Or+=1;for(const e of ed)e()}function e8(e){return ed.add(e),()=>{ed.delete(e)}}function t8(){return Or}var M0=null;function n8(e){const t=M0;if(t&&t.revision===Or&&t.serverNameOrId===e)return t.key;const n=Z.clientConfigSyncPending||!oF(e)?null:JSON.stringify([Ki(),uF(e)]);return M0={revision:Or,serverNameOrId:e,key:n},n}function iF(){throw new Error("Hosted API context is only available in hosted mode")}function Nm(){if(Z.clientConfigSyncPending)throw new Error(EB)}function sF(){return!Z.isAuthenticated&&!Z.hasSession}function Lm(){return!(Z.isAuthenticated||Z.hasSession)}function Ki(){return Lm()}function r8(e){const t=Z.projectId??void 0,n=e?.projectId??void 0;t&&n&&t!==n&&ZB(t),WB(n),qB(n,e?.taskOwnerId),Z=e?{...e,clientCapabilities:e.clientCapabilities??zc()}:y1,Dm(),x1()}function i8(e,t,n){Z.projectId===n&&Z.serverIdsByName[e]!==t&&(Z={...Z,serverIdsByName:{...Z.serverIdsByName,[e]:t}},x1())}function b1(){const e=Z.projectId;if(!e)throw new FB("provisioning-project","hosted projectId is not in the API context yet");return e}function oF(e){const t=Z.projectId;if(!t)return null;const n=Z.serverIdsByName[e];return n?{projectId:t,serverId:n}:Object.values(Z.serverIdsByName).includes(e)?{projectId:t,serverId:e}:null}function aF(e){const t=e.trim();return!(t.length<1||t.length>=20&&/^[a-z0-9]+$/i.test(t))}var lF="Hosted server not found. The server is not in your hosted project, or the server list is still loading.";function w1(e){const t=Z.serverIdsByName[e];if(t)return t;if(Object.values(Z.serverIdsByName).includes(e))return e;throw aF(e)?new Error(`Hosted server not found for "${e}"`):new Error(lF)}function Ta(e){return Object.entries(Z.serverIdsByName).find(([,t])=>t===e)?.[0]}function s8(e){return Ta(e)}function o8(e){}function a8(e){iF();const t=new Set,n=[];for(const r of e){if(typeof r!="string")continue;const i=r.trim();if(!i)continue;const s=Z.serverIdsByName[i]!==void 0?i:Ta(i)??i,o=s.toLowerCase();t.has(o)||(t.add(o),n.push(s))}return n}function cF(e){const t=new Set,n=[];for(const r of e){const i=w1(r);t.has(i)||(t.add(i),n.push({serverId:i,serverName:Z.serverIdsByName[r]!==void 0?r:Ta(i)??r}))}return n}function _m(){return Z.scenarioId}function S1(){return Z.accessVersion}function k1(){return _m()?"chat_v2":void 0}function jm(e){return{...e.mirrorToolParamHeaders===!1?{mirrorToolParamHeaders:!1}:{},...e.firstPageOnly===!0?{firstPageOnly:!0}:{},...e.suppressListenChannel===!0?{suppressListenChannel:!0}:{},...e.dropToolListChanged===!0?{dropToolListChanged:!0}:{},...e.toolCallCancellation?{toolCallCancellation:e.toolCallCancellation}:{},...e.supportsMrtr===!1?{supportsMrtr:!1}:{}}}function uF(e){Nm();const t=b1(),n=w1(e),r=_m(),i=S1(),s=k1();return{projectId:t,serverId:n,serverName:Z.serverIdsByName[e]!==void 0?e:Ta(n)??e,...Z.clientCapabilities?{clientCapabilities:Z.clientCapabilities}:{},...Z.clientInfo?{clientInfo:Z.clientInfo}:{},...Z.supportedProtocolVersions?.length?{supportedProtocolVersions:Z.supportedProtocolVersions}:{},...Z.mcpProtocolVersionsByServerId?.[n]?{mcpProtocolVersion:Z.mcpProtocolVersionsByServerId[n]}:{},...jm(Z),...Z.xaaPolicy?{xaaPolicy:Z.xaaPolicy}:{},...s?{accessScope:s}:{},...r?{scenarioId:r}:{},...r&&Number.isFinite(i)?{accessVersion:i}:{}}}function l8(e){Nm();const t=b1(),n=cF(e),r=n.map(c=>c.serverId),i=n.map(c=>c.serverName),s=C1(r),o=_m(),a=S1(),l=k1();return{projectId:t,serverIds:r,serverNames:i,...Z.clientCapabilities?{clientCapabilities:Z.clientCapabilities}:{},...Z.clientInfo?{clientInfo:Z.clientInfo}:{},...Z.supportedProtocolVersions?.length?{supportedProtocolVersions:Z.supportedProtocolVersions}:{},...s?{mcpProtocolVersionsByServerId:s}:{},...jm(Z),...Z.xaaPolicy?{xaaPolicy:Z.xaaPolicy}:{},...l?{accessScope:l}:{},...o?{scenarioId:o}:{},...o&&Number.isFinite(a)?{accessVersion:a}:{}}}function C1(e){const t=Z.mcpProtocolVersionsByServerId;if(!t)return;const n={};for(const r of e){const i=t[r];i&&(n[r]=i)}return Object.keys(n).length>0?n:void 0}function c8(e){Nm();const t=C1(e.serverIds);return{projectId:e.projectId,serverIds:e.serverIds,serverNames:e.serverNames,...Z.clientCapabilities?{clientCapabilities:Z.clientCapabilities}:{},...Z.clientInfo?{clientInfo:Z.clientInfo}:{},...Z.supportedProtocolVersions?.length?{supportedProtocolVersions:Z.supportedProtocolVersions}:{},...t?{mcpProtocolVersionsByServerId:t}:{},...jm(Z),...Z.xaaPolicy?{xaaPolicy:Z.xaaPolicy}:{},...e.accessScope?{accessScope:e.accessScope}:{},...e.scenarioId?{scenarioId:e.scenarioId}:{},...e.scenarioId&&Number.isFinite(e.accessVersion)?{accessVersion:e.accessVersion}:{}}}function hF(){return gh??=fF().finally(()=>{gh=null}),gh}async function fF(){const e=Date.now()+eF;for(;Date.now()<e;){if(await new Promise(n=>setTimeout(n,tF)),Lm())return null;const t=Z.getAccessToken;if(t)try{const n=await t();if(n)return n}catch{}}return null}async function A1(e=1){const t=Or,n=Ki(),r=()=>Or!==t||Ki()!==n,i=()=>e>0?A1(e-1):null,s=Date.now();if(Gt&&Gt.expiresAt>s)if(Gt.kind==="guest"&&!Ki())Gt=null;else return`Bearer ${Gt.token}`;if(Ki()){const l=await Mg();if(r())return i();if(l)return Gt={token:l,expiresAt:s+io,kind:"guest"},`Bearer ${l}`}const o=Z.getAccessToken;if(o)try{const l=await o();if(r())return i();if(l)return Gt={token:l,expiresAt:s+io,kind:"session"},`Bearer ${l}`}catch{}if(!Lm()){const l=await hF();return r()?i():l?(Gt={token:l,expiresAt:Date.now()+io,kind:"session"},`Bearer ${l}`):null}const a=await Mg();return r()?i():a?(Gt={token:a,expiresAt:s+io,kind:"guest"},`Bearer ${a}`):null}function dF(){const e=QE();if(e)return e;const t=JE()??"https://rt.mcpjam.com";return t&&typeof t=="string"?t.replace(".convex.cloud",".convex.site"):null}var pF=["billing_","credit_topup_","plan_limit_","plans_upgrade_confirm_","pricing_"];function mF(e){return pF.some(t=>e.startsWith(t))}function gF(e){const t=e.toLowerCase();return t==="organization_id"||t==="package_id"||t==="price_cents"||t==="price_paid_cents"||t==="granted_credits"||t==="amount_credits"||t==="error"||t==="error_name"||t==="error_message"||t.startsWith("stripe_")||t.startsWith("invoice_")||t==="checkout_session_id"||t==="payment_intent_id"}function td(e,t={}){const{location:n="unknown",platform:r,environment:i,...s}=t;try{const o=mF(e),a=o?s.organization_id:void 0,l=typeof a=="string"&&a.length>0?a:void 0,c=o?Object.fromEntries(Object.entries(s).filter(([u])=>!gF(u))):s;Zx.capture(e,{...c,...aM(n),...o?{organization_id:null,...l?{$groups:{organization:l}}:{}}:{}})}catch(o){console.warn(`[analytics] Failed to capture ${e}`,o)}}function u8(e,t,n=Rg()){const r=ZE();!n||Rg()!==n||r.policy.content!=="full"||e.capture("$set",{},{$set:r.policy.identity==="full"?t:{deployment:t.deployment}})}function vF(e){if(typeof e!="object"||e===null)return!1;const{code:t,details:n}=e;return t==="SESSION_REVOKED"?!0:t==="UNAUTHORIZED"&&typeof n=="object"&&n!==null&&n.reason==="SESSION_REVOKED"}async function yF(e){if(e.status!==401)return!1;try{return typeof e.clone!="function"?!1:vF(await e.clone().json())}catch{return!1}}var Co=null,R0=!1,nd=!1;function T1(e){try{e()}catch{}}function xF(){R0||(R0=!0,Co?T1(Co):nd=!0)}function h8(e){return Co=e,nd&&(nd=!1,T1(e)),()=>{Co===e&&(Co=null)}}var vs=null,so=null,Bm=class extends Error{status;code;restarted;constructor(e,t,n=!1){super(`Failed to get session token: ${e}`),this.name="SessionTokenError",this.status=e,this.code=t,this.restarted=n}};function f8(e){return e instanceof Bm&&e.status===403}var P0={"/api/web/scenarios/bootstrap":"scenario"};function bF(e){const t=e instanceof URL?e.toString():typeof Request<"u"&&e instanceof Request?e.url:String(e),n=typeof window<"u"?window.location.origin:"http://localhost";try{const r=new URL(t,n);return P0[r.pathname]??null}catch{return P0[t]??null}}function wF(...e){const t={};for(const n of e)if(n){if(n instanceof Headers){n.forEach((r,i)=>{t[i]=r});continue}if(Array.isArray(n)){for(const[r,i]of n)t[r]=i;continue}Object.assign(t,n)}return t}function SF(e){return e?e instanceof Headers?e.has("Authorization"):Array.isArray(e)?e.some(([t])=>t.toLowerCase()==="authorization"):Object.keys(e).some(t=>t.toLowerCase()==="authorization"):!1}function Qa(e,t,n){const r=P1(e)?CF():void 0,i=n&&I1(e)?{Authorization:n}:void 0;return{...t,headers:wF(r,i,t?.headers)}}async function E1(e){const t=await fetch("/api/session-token",{headers:e?{"X-MCP-Session-Auth":`Bearer ${e}`}:{},cache:"no-store"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Bm(t.status,n.code,!!e)}if(!yM(e)||(await t.json()).ok!==!0)throw new Error("Invalid Inspector access response");return vs=e,cM(e),e}async function d8(){return vs||(so||(so=E1(Mp()).catch(e=>{throw so=null,e})),so)}async function kF(){vs=null,so=null;try{return await E1(Mp(!0))}catch(e){return e instanceof Bm&&e.code==="ACCESS_LINK_REQUIRED"&&window.dispatchEvent(new CustomEvent(nb,{detail:{restarted:e.restarted}})),null}}function du(){return vs||(Mp()??"")}function p8(){return!!du()}function CF(){const e=du();return e?{"X-MCP-Session-Auth":`Bearer ${e}`}:(console.warn("[Auth] Session token not available"),{})}function M1(e){return e==="localhost"||e==="127.0.0.1"||e==="::1"||e==="[::1]"}function Fm(e){const t=typeof window<"u"?window.location.origin:"http://localhost";try{return e instanceof URL?e:typeof Request<"u"&&e instanceof Request?new URL(e.url,t):new URL(String(e),t)}catch{return null}}function R1(e){return M1(e.hostname)?!0:typeof window<"u"&&e.origin===window.location.origin}function P1(e){const t=Fm(e);return t?R1(t)&&t.pathname.startsWith("/api/"):typeof e=="string"&&e.startsWith("/api/")}var AF=["/api/mcp/webmcp","/api/web/","/api/v1/harness/","/api/v1/built-in-tools/","/api/web-clients/accounts/","/api/web-clients/reconnect/","/api/v1/agent-ops","/api/mcp/local-harness","/api/mcp/connect","/api/mcp/servers/reconnect","/api/mcp/servers/approve-command","/api/mcp/server-features/observations","/api/mcp/servers/canvas/refresh","/api/mcp/chat-v2","/api/mcp/xaa/proxy/token","/api/mcp/xaa/negative-tests","/api/mcp/xaa/authenticate","/api/mcp/xaa/token-exchange","/api/mcp/xaa/token","/api/mcp/computers/local-consent","/api/mcp/computers/local-terminal-token","/api/mcp/computers/local-browser","/api/mcp/computers/browser-location","/web/oauth/","/web/registry/"];function TF(e){if(typeof window<"u"&&e.origin===window.location.origin||M1(e.hostname))return!0;const t=dF();if(t)try{const n=new URL(t).hostname;if(e.hostname===n)return!0}catch{}return!1}var EF=[/^\/api\/mcp\/(chat-persistence|turn-authorization)\/?$/,/^\/api\/mcp\/servers\/command-approval\/?$/,/^\/api\/v1\/projects\/[^/]+\/readiness-runs(\/[^/]+(\/(cancel|report|resume))?)?$/,/^\/api\/v1\/projects\/[^/]+\/servers\/[^/]+\/revisions(\/\d+\/diff)?$/,/^\/api\/v1\/projects\/[^/]+\/servers\/[^/]+\/readiness-runs\/(claude|openai)$/,/^\/api\/v1\/projects\/[^/]+\/directory-submissions\/[^/]+\/reviewer-attempts(\/[^/]+(\/(resume|cancel|handoff))?)?$/,/^\/api\/v1\/directory-flows(\/[^/]+)?$/,/^\/api\/v1\/projects\/[^/]+\/directory-submissions(\/[^/]+(\/(runs|results|handoff|export|events|snapshots|findings(\/[^/]+)?))?)?$/,/^\/api\/v1\/projects\/[^/]+\/directory-submissions\/[^/]+\/(test-plan(\/draft)?|tool-tests)$/,/^\/api\/v1\/projects\/[^/]+\/eval-suites\/[^/]+\/run-disclosure$/,/^\/api\/v1\/projects\/[^/]+\/eval-runs\/[^/]+\/(decision-summary|stage-analytics|route-facts|server-facts)$/,/^\/api\/v1\/projects\/[^/]+\/eval-suites\/[^/]+\/stage-analytics$/,/^\/api\/v1\/projects\/[^/]+\/eval-runs\/[^/]+\/description-experiments$/,/^\/api\/v1\/projects\/[^/]+\/eval-description-experiments\/[^/]+(\/start)?$/,/^\/api\/v1\/projects\/[^/]+\/eval-runs\/[^/]+\/backtest$/,/^\/api\/v1\/projects\/[^/]+\/eval-runs\/[^/]+\/iterations$/,/^\/api\/v1\/projects\/[^/]+\/eval-runs\/[^/]+\/compare$/,/^\/api\/v1\/projects\/[^/]+\/eval-runs\/[^/]+\/cancel$/];function I0(e){return EF.some(t=>t.test(e))?!0:AF.some(t=>t.endsWith("/")?e.startsWith(t):e===t||e.startsWith(`${t}/`))}var MF=["/api/web/apps/plugin-instances/","/api/web/plugin-forms/"];function RF(e){const t=Fm(e),n=t?t.pathname:typeof e=="string"?e.split("?")[0]:"";return/^\/api\/(web|mcp)\/(chat-persistence|turn-authorization)\/?$/.test(n)||MF.some(r=>n.startsWith(r))}function PF(e){return e==null||typeof e=="string"||e instanceof FormData||e instanceof URLSearchParams||e instanceof Blob||e instanceof ArrayBuffer||ArrayBuffer.isView(e)}function I1(e){const t=Fm(e);if(t)return TF(t)?I0(t.pathname):!1;if(typeof e!="string"||!e.startsWith("/"))return!1;const n=e.split("?")[0];return I0(n)}function IF(e){const t=du();if(!t)return console.warn("[Auth] Session token not available for URL"),e;try{const n=new URL(e,window.location.origin);return R1(n)?(n.searchParams.set("_token",t),n.origin===window.location.origin?n.pathname+n.search:n.href):(console.warn("[Auth] Refusing to attach session token to foreign origin"),e)}catch{return`${e}${e.includes("?")?"&":"?"}_token=${encodeURIComponent(t)}`}}async function m8(e,t){const n=bF(e),r=SF(t?.headers),i=I1(e),s=i&&!r?await A1():null,o=Qa(e,t,s),a=await fetch(e,o);if(a.status===401&&i&&await yF(a))return xF(),a;if(a.status===401&&i&&!r&&RF(e)&&PF(t?.body)&&a.headers?.get("X-MCP-Auth-Required")!=="oauth"){const u=await rF();if(u)return t?.signal?.throwIfAborted(),fetch(e,Qa(e,t,`Bearer ${u}`))}if(a.status===401&&P1(e)&&a.headers?.get("X-MCPJam-Session")!=null){const u=du(),h=await kF();if(h&&h!==u){const f=Qa(e,t,s),d=await fetch(e,f);return d.status===401&&d.headers.get("X-MCPJam-Session")&&window.dispatchEvent(new CustomEvent(nb,{detail:{restarted:!0}})),d}}if(a.status!==401||!i||!sF()||r||a.headers?.get("X-MCP-Auth-Required")==="oauth")return a;Dm();const l=await nM();if(!l)return n&&td("guest_refresh_failure",{location:"auth_fetch",surface:n,auth_mode:"guest",status:"failure",error_kind:"guest_refresh_unavailable"}),a;n&&td("guest_refresh_success",{location:"auth_fetch",surface:n,auth_mode:"guest",status:"success"});const c=Qa(e,t,`Bearer ${l}`);return fetch(e,c)}var O0="1.46.0",Yo=Symbol.for("functionName"),OF=Symbol.for("toReferencePath");function DF(e){return e[OF]??null}function NF(e){return e.startsWith("function://")}function LF(e){let t;if(typeof e=="string")NF(e)?t={functionHandle:e}:t={name:e};else if(e[Yo])t={name:e[Yo]};else{const n=DF(e);if(!n)throw new Error(`${e} is not a functionReference`);t={reference:n}}return t}function pt(e){const t=LF(e);if(t.name===void 0)throw t.functionHandle!==void 0?new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`):t.reference!==void 0?new Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`):new Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`);if(typeof e=="string")return e;const n=e[Yo];if(!n)throw new Error(`${e} is not a functionReference`);return n}function pu(e){return{[Yo]:e}}function O1(e=[]){return new Proxy({},{get(t,n){if(typeof n=="string")return O1([...e,n]);if(n===Yo){if(e.length<2){const s=["api",...e].join(".");throw new Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${s}\``)}const r=e.slice(0,-1).join("/"),i=e[e.length-1];return i==="default"?r:r+":"+i}else return n===Symbol.toStringTag?"FunctionReference":void 0}})}var g8=O1(),_F=Object.defineProperty,jF=(e,t,n)=>t in e?_F(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,D0=(e,t,n)=>jF(e,typeof t!="symbol"?t+"":t,n),BF="color:rgb(0, 145, 255)";function D1(e){switch(e){case"query":return"Q";case"mutation":return"M";case"action":return"A";case"any":return"?"}}var N1=class{constructor(e){D0(this,"_onLogLineFuncs"),D0(this,"_verbose"),this._onLogLineFuncs={},this._verbose=e.verbose}addLogLineListener(e){let t=Math.random().toString(36).substring(2,15);for(let n=0;n<10&&this._onLogLineFuncs[t]!==void 0;n++)t=Math.random().toString(36).substring(2,15);return this._onLogLineFuncs[t]=e,()=>{delete this._onLogLineFuncs[t]}}logVerbose(...e){if(this._verbose)for(const t of Object.values(this._onLogLineFuncs))t("debug",`${new Date().toISOString()}`,...e)}log(...e){for(const t of Object.values(this._onLogLineFuncs))t("info",...e)}warn(...e){for(const t of Object.values(this._onLogLineFuncs))t("warn",...e)}error(...e){for(const t of Object.values(this._onLogLineFuncs))t("error",...e)}};function L1(e){const t=new N1(e);return t.addLogLineListener((n,...r)=>{switch(n){case"debug":console.debug(...r);break;case"info":console.log(...r);break;case"warn":console.warn(...r);break;case"error":console.error(...r);break;default:console.log(...r)}}),t}function _1(e){return new N1(e)}function bc(e,t,n,r,i){const s=D1(n);if(typeof i=="object"&&(i=`ConvexError ${JSON.stringify(i.errorData,null,2)}`),t==="info"){const o=i.match(/^\[.*?\] /);if(o===null){e.error(`[CONVEX ${s}(${r})] Could not parse console.log`);return}const a=i.slice(1,o[0].length-2),l=i.slice(o[0].length);e.log(`%c[CONVEX ${s}(${r})] [${a}]`,BF,l)}else e.error(`[CONVEX ${s}(${r})] ${i}`)}function FF(e,t){const n=`[CONVEX FATAL ERROR] ${t}`;return e.error(n),new Error(n)}function Gi(e,t,n){return`[CONVEX ${D1(e)}(${t})] ${n.errorMessage}
42
+ Called by client`}function rd(e,t){return t.data=e.errorData,t}function yi(e){const t=e.split(":");let n,r;return t.length===1?(n=t[0],r="default"):(n=t.slice(0,t.length-1).join(":"),r=t[t.length-1]),n.endsWith(".js")&&(n=n.slice(0,-3)),`${n}:${r}`}function li(e,t){return JSON.stringify({udfPath:yi(e),args:In(t)})}function N0(e,t,n){const{initialNumItems:r,id:i}=n;return JSON.stringify({type:"paginated",udfPath:yi(e),args:In(t),options:In({initialNumItems:r,id:i})})}var VF=Object.defineProperty,zF=(e,t,n)=>t in e?VF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pn=(e,t,n)=>zF(e,typeof t!="symbol"?t+"":t,n),$F=class{constructor(){pn(this,"nextQueryId"),pn(this,"querySetVersion"),pn(this,"querySet"),pn(this,"queryIdToToken"),pn(this,"identityVersion"),pn(this,"auth"),pn(this,"outstandingQueriesOlderThanRestart"),pn(this,"outstandingAuthOlderThanRestart"),pn(this,"paused"),pn(this,"pendingQuerySetModifications"),this.nextQueryId=0,this.querySetVersion=0,this.identityVersion=0,this.querySet=new Map,this.queryIdToToken=new Map,this.outstandingQueriesOlderThanRestart=new Set,this.outstandingAuthOlderThanRestart=!1,this.paused=!1,this.pendingQuerySetModifications=new Map}hasSyncedPastLastReconnect(){return this.outstandingQueriesOlderThanRestart.size===0&&!this.outstandingAuthOlderThanRestart}markAuthCompletion(){this.outstandingAuthOlderThanRestart=!1}subscribe(e,t,n,r){const i=yi(e),s=li(i,t),o=this.querySet.get(s);if(o!==void 0)return o.numSubscribers+=1,{queryToken:s,modification:null,unsubscribe:()=>this.removeSubscriber(s)};{const a=this.nextQueryId++,l={id:a,canonicalizedUdfPath:i,args:t,numSubscribers:1,journal:n,componentPath:r};this.querySet.set(s,l),this.queryIdToToken.set(a,s);const c=this.querySetVersion,u=this.querySetVersion+1,h={type:"Add",queryId:a,udfPath:i,args:[In(t)],journal:n,componentPath:r};return this.paused?this.pendingQuerySetModifications.set(a,h):this.querySetVersion=u,{queryToken:s,modification:{type:"ModifyQuerySet",baseVersion:c,newVersion:u,modifications:[h]},unsubscribe:()=>this.removeSubscriber(s)}}}transition(e){for(const t of e.modifications)switch(t.type){case"QueryUpdated":case"QueryFailed":{this.outstandingQueriesOlderThanRestart.delete(t.queryId);const n=t.journal;if(n!==void 0){const r=this.queryIdToToken.get(t.queryId);r!==void 0&&(this.querySet.get(r).journal=n)}break}case"QueryRemoved":this.outstandingQueriesOlderThanRestart.delete(t.queryId);break;default:throw new Error(`Invalid modification ${t.type}`)}}queryId(e,t){const n=yi(e),r=li(n,t),i=this.querySet.get(r);return i!==void 0?i.id:null}isCurrentOrNewerAuthVersion(e){return e>=this.identityVersion}getAuth(){return this.auth}setAuth(e){this.auth={tokenType:"User",value:e};const t=this.identityVersion;return this.paused||(this.identityVersion=t+1),{type:"Authenticate",baseVersion:t,...this.auth}}setAdminAuth(e,t){const n={tokenType:"Admin",value:e,impersonating:t};this.auth=n;const r=this.identityVersion;return this.paused||(this.identityVersion=r+1),{type:"Authenticate",baseVersion:r,...n}}clearAuth(){this.auth=void 0,this.markAuthCompletion();const e=this.identityVersion;return this.paused||(this.identityVersion=e+1),{type:"Authenticate",tokenType:"None",baseVersion:e}}hasAuth(){return!!this.auth}isNewAuth(e){return this.auth?.value!==e}queryPath(e){const t=this.queryIdToToken.get(e);return t?this.querySet.get(t).canonicalizedUdfPath:null}queryArgs(e){const t=this.queryIdToToken.get(e);return t?this.querySet.get(t).args:null}queryToken(e){return this.queryIdToToken.get(e)??null}queryJournal(e){return this.querySet.get(e)?.journal}restart(){this.unpause(),this.outstandingQueriesOlderThanRestart.clear();const e=[];for(const r of this.querySet.values()){const i={type:"Add",queryId:r.id,udfPath:r.canonicalizedUdfPath,args:[In(r.args)],journal:r.journal,componentPath:r.componentPath};e.push(i),this.outstandingQueriesOlderThanRestart.add(r.id)}this.querySetVersion=1;const t={type:"ModifyQuerySet",baseVersion:0,newVersion:1,modifications:e};if(!this.auth)return this.identityVersion=0,[t,void 0];this.outstandingAuthOlderThanRestart=!0;const n={type:"Authenticate",baseVersion:0,...this.auth};return this.identityVersion=1,[t,n]}pause(){this.paused=!0}resume(){const e=this.pendingQuerySetModifications.size>0?{type:"ModifyQuerySet",baseVersion:this.querySetVersion,newVersion:++this.querySetVersion,modifications:Array.from(this.pendingQuerySetModifications.values())}:void 0,t=this.auth!==void 0?{type:"Authenticate",baseVersion:this.identityVersion++,...this.auth}:void 0;return this.unpause(),[e,t]}unpause(){this.paused=!1,this.pendingQuerySetModifications.clear()}removeSubscriber(e){const t=this.querySet.get(e);if(t.numSubscribers>1)return t.numSubscribers-=1,null;{this.querySet.delete(e),this.queryIdToToken.delete(t.id),this.outstandingQueriesOlderThanRestart.delete(t.id);const n=this.querySetVersion,r=this.querySetVersion+1,i={type:"Remove",queryId:t.id};return this.paused?this.pendingQuerySetModifications.has(t.id)?this.pendingQuerySetModifications.delete(t.id):this.pendingQuerySetModifications.set(t.id,i):this.querySetVersion=r,{type:"ModifyQuerySet",baseVersion:n,newVersion:r,modifications:[i]}}}},HF=Object.defineProperty,WF=(e,t,n)=>t in e?HF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ya=(e,t,n)=>WF(e,typeof t!="symbol"?t+"":t,n),UF=class{constructor(e,t){this.logger=e,this.markConnectionStateDirty=t,Ya(this,"inflightRequests"),Ya(this,"requestsOlderThanRestart"),Ya(this,"inflightMutationsCount",0),Ya(this,"inflightActionsCount",0),this.inflightRequests=new Map,this.requestsOlderThanRestart=new Set}request(e,t){const n=new Promise(r=>{const i=t?"Requested":"NotSent";this.inflightRequests.set(e.requestId,{message:e,status:{status:i,requestedAt:new Date,onResult:r}}),e.type==="Mutation"?this.inflightMutationsCount++:e.type==="Action"&&this.inflightActionsCount++});return this.markConnectionStateDirty(),n}onResponse(e){const t=this.inflightRequests.get(e.requestId);if(t===void 0||t.status.status==="Completed")return null;const n=t.message.type==="Mutation"?"mutation":"action",r=t.message.udfPath;for(const a of e.logLines)bc(this.logger,"info",n,r,a);const i=t.status;let s,o;if(e.success)s={success:!0,logLines:e.logLines,value:sc(e.result)},o=()=>i.onResult(s);else{const a=e.result,{errorData:l}=e;bc(this.logger,"error",n,r,a),s={success:!1,errorMessage:a,errorData:l!==void 0?sc(l):void 0,logLines:e.logLines},o=()=>i.onResult(s)}return e.type==="ActionResponse"||!e.success?(o(),this.inflightRequests.delete(e.requestId),this.requestsOlderThanRestart.delete(e.requestId),t.message.type==="Action"?this.inflightActionsCount--:t.message.type==="Mutation"&&this.inflightMutationsCount--,this.markConnectionStateDirty(),{requestId:e.requestId,result:s}):(t.status={status:"Completed",result:s,ts:e.ts,onResolve:o},null)}removeCompleted(e){const t=new Map;for(const[n,r]of this.inflightRequests.entries()){const i=r.status;i.status==="Completed"&&i.ts.lessThanOrEqual(e)&&(i.onResolve(),t.set(n,i.result),r.message.type==="Mutation"?this.inflightMutationsCount--:r.message.type==="Action"&&this.inflightActionsCount--,this.inflightRequests.delete(n),this.requestsOlderThanRestart.delete(n))}return t.size>0&&this.markConnectionStateDirty(),t}restart(){this.requestsOlderThanRestart=new Set(this.inflightRequests.keys());const e=[];for(const[t,n]of this.inflightRequests){if(n.status.status==="NotSent"){n.status.status="Requested",e.push(n.message);continue}if(n.message.type==="Mutation")e.push(n.message);else if(n.message.type==="Action"){if(this.inflightRequests.delete(t),this.requestsOlderThanRestart.delete(t),this.inflightActionsCount--,n.status.status==="Completed")throw new Error("Action should never be in 'Completed' state");n.status.onResult({success:!1,errorMessage:"Connection lost while action was in flight",logLines:[]})}}return this.markConnectionStateDirty(),e}resume(){const e=[];for(const[,t]of this.inflightRequests)if(t.status.status==="NotSent"){t.status.status="Requested",e.push(t.message);continue}return e}hasIncompleteRequests(){for(const e of this.inflightRequests.values())if(e.status.status==="Requested")return!0;return!1}hasInflightRequests(){return this.inflightRequests.size>0}hasSyncedPastLastReconnect(){return this.requestsOlderThanRestart.size===0}timeOfOldestInflightRequest(){if(this.inflightRequests.size===0)return null;let e=Date.now();for(const t of this.inflightRequests.values())t.status.status!=="Completed"&&t.status.requestedAt.getTime()<e&&(e=t.status.requestedAt.getTime());return new Date(e)}inflightMutations(){return this.inflightMutationsCount}inflightActions(){return this.inflightActionsCount}},qF=Object.defineProperty,KF=(e,t,n)=>t in e?qF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wc=(e,t,n)=>KF(e,typeof t!="symbol"?t+"":t,n),L0=class id{constructor(t){wc(this,"queryResults"),wc(this,"modifiedQueries"),this.queryResults=t,this.modifiedQueries=[]}getQuery(t,...n){const r=Wn(n[0]),i=pt(t),s=this.queryResults.get(li(i,r));if(s!==void 0)return id.queryValue(s.result)}getAllQueries(t){const n=[],r=pt(t);for(const i of this.queryResults.values())i.udfPath===yi(r)&&n.push({args:i.args,value:id.queryValue(i.result)});return n}setQuery(t,n,r){const i=Wn(n),s=pt(t),o=li(s,i);let a;r===void 0?a=void 0:a={success:!0,value:r,logLines:[]};const l={udfPath:s,args:i,result:a};this.queryResults.set(o,l),this.modifiedQueries.push(o)}static queryValue(t){if(t!==void 0)return t.success?t.value:void 0}},GF=class{constructor(){wc(this,"queryResults"),wc(this,"optimisticUpdates"),this.queryResults=new Map,this.optimisticUpdates=[]}ingestQueryResultsFromServer(e,t){this.optimisticUpdates=this.optimisticUpdates.filter(s=>!t.has(s.mutationId));const n=this.queryResults;this.queryResults=new Map(e);const r=new L0(this.queryResults);for(const s of this.optimisticUpdates)s.update(r);const i=[];for(const[s,o]of this.queryResults){const a=n.get(s);(a===void 0||a.result!==o.result)&&i.push(s)}return i}applyOptimisticUpdate(e,t){this.optimisticUpdates.push({update:e,mutationId:t});const n=new L0(this.queryResults);return e(n),n.modifiedQueries}rawQueryResult(e){const t=this.queryResults.get(e);if(t!==void 0)return t.result}queryResult(e){const t=this.queryResults.get(e);if(t===void 0)return;const n=t.result;if(n!==void 0){if(n.success)return n.value;throw n.errorData!==void 0?rd(n,new cf(Gi("query",t.udfPath,n))):new Error(Gi("query",t.udfPath,n))}}hasQueryResult(e){return this.queryResults.get(e)!==void 0}queryLogs(e){return this.queryResults.get(e)?.result?.logLines}},QF=Object.defineProperty,YF=(e,t,n)=>t in e?QF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vh=(e,t,n)=>YF(e,typeof t!="symbol"?t+"":t,n),Ea=class zn{constructor(t,n){vh(this,"low"),vh(this,"high"),vh(this,"__isUnsignedLong__"),this.low=t|0,this.high=n|0,this.__isUnsignedLong__=!0}static isLong(t){return(t&&t.__isUnsignedLong__)===!0}static fromBytesLE(t){return new zn(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24)}toBytesLE(){const t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]}static fromNumber(t){return isNaN(t)||t<0?_0:t>=XF?JF:new zn(t%Ao|0,t/Ao|0)}toString(){return(BigInt(this.high)*BigInt(Ao)+BigInt(this.low)).toString()}equals(t){return zn.isLong(t)||(t=zn.fromValue(t)),this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low}notEquals(t){return!this.equals(t)}comp(t){return zn.isLong(t)||(t=zn.fromValue(t)),this.equals(t)?0:t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1}lessThanOrEqual(t){return this.comp(t)<=0}static fromValue(t){return typeof t=="number"?zn.fromNumber(t):new zn(t.low,t.high)}},_0=new Ea(0,0),j0=65536,Ao=j0*j0,XF=Ao*Ao,JF=new Ea(-1,-1),ZF=Object.defineProperty,eV=(e,t,n)=>t in e?ZF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xa=(e,t,n)=>eV(e,typeof t!="symbol"?t+"":t,n),B0=class{constructor(e,t){Xa(this,"version"),Xa(this,"remoteQuerySet"),Xa(this,"queryPath"),Xa(this,"logger"),this.version={querySet:0,ts:Ea.fromNumber(0),identity:0},this.remoteQuerySet=new Map,this.queryPath=e,this.logger=t}transition(e){const t=e.startVersion;if(this.version.querySet!==t.querySet||this.version.ts.notEquals(t.ts)||this.version.identity!==t.identity)throw new Error(`Invalid start version: ${t.ts.toString()}:${t.querySet}:${t.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`);for(const n of e.modifications)switch(n.type){case"QueryUpdated":{const r=this.queryPath(n.queryId);if(r)for(const s of n.logLines)bc(this.logger,"info","query",r,s);const i=sc(n.value??null);this.remoteQuerySet.set(n.queryId,{success:!0,value:i,logLines:n.logLines});break}case"QueryFailed":{const r=this.queryPath(n.queryId);if(r)for(const s of n.logLines)bc(this.logger,"info","query",r,s);const{errorData:i}=n;this.remoteQuerySet.set(n.queryId,{success:!1,errorMessage:n.errorMessage,errorData:i!==void 0?sc(i):void 0,logLines:n.logLines});break}case"QueryRemoved":this.remoteQuerySet.delete(n.queryId);break;default:throw new Error(`Invalid modification ${n.type}`)}this.version=e.endVersion}remoteQueryResults(){return this.remoteQuerySet}timestamp(){return this.version.ts}};function yh(e){const t=YE(e);return Ea.fromBytesLE(Array.from(t))}function tV(e){const t=new Uint8Array(e.toBytesLE());return sM(t)}function F0(e){switch(e.type){case"FatalError":case"AuthError":case"ActionResponse":case"TransitionChunk":case"Ping":return{...e};case"MutationResponse":return e.success?{...e,ts:yh(e.ts)}:{...e};case"Transition":return{...e,startVersion:{...e.startVersion,ts:yh(e.startVersion.ts)},endVersion:{...e.endVersion,ts:yh(e.endVersion.ts)}}}}function nV(e){switch(e.type){case"Authenticate":case"ModifyQuerySet":case"Mutation":case"Action":case"Event":return{...e};case"Connect":return e.maxObservedTimestamp!==void 0?{...e,maxObservedTimestamp:tV(e.maxObservedTimestamp)}:{...e,maxObservedTimestamp:void 0}}}var rV=Object.defineProperty,iV=(e,t,n)=>t in e?rV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Be=(e,t,n)=>iV(e,typeof t!="symbol"?t+"":t,n),sV=1e3,oV=1001,aV=1005,lV=4040,_l;function Vi(){return _l===void 0&&(_l=Date.now()),typeof performance>"u"||!performance.now?Date.now():Math.round(_l+performance.now())}function V0(){return`t=${Math.round((Vi()-_l)/100)/10}s`}var j1={InternalServerError:{timeout:1e3},SubscriptionsWorkerFullError:{timeout:3e3},TooManyConcurrentRequests:{timeout:3e3},CommitterFullError:{timeout:3e3},AwsTooManyRequestsException:{timeout:3e3},ExecuteFullError:{timeout:3e3},SystemTimeoutError:{timeout:3e3},ExpiredInQueue:{timeout:3e3},VectorIndexesUnavailable:{timeout:1e3},SearchIndexesUnavailable:{timeout:1e3},TableSummariesUnavailable:{timeout:1e3},VectorIndexTooLarge:{timeout:3e3},SearchIndexTooLarge:{timeout:3e3},TooManyWritesInTimePeriod:{timeout:3e3}};function cV(e){if(e===void 0)return"Unknown";for(const t of Object.keys(j1))if(e.startsWith(t))return t;return"Unknown"}var uV=class{constructor(e,t,n,r,i,s){this.markConnectionStateDirty=i,this.debug=s,Be(this,"socket"),Be(this,"connectionCount"),Be(this,"_hasEverConnected",!1),Be(this,"lastCloseReason"),Be(this,"transitionChunkBuffer",null),Be(this,"defaultInitialBackoff"),Be(this,"maxBackoff"),Be(this,"retries"),Be(this,"serverInactivityThreshold"),Be(this,"reconnectDueToServerInactivityTimeout"),Be(this,"scheduledReconnect",null),Be(this,"networkOnlineHandler",null),Be(this,"pendingNetworkRecoveryInfo",null),Be(this,"uri"),Be(this,"onOpen"),Be(this,"onResume"),Be(this,"onMessage"),Be(this,"webSocketConstructor"),Be(this,"logger"),Be(this,"onServerDisconnectError"),this.webSocketConstructor=n,this.socket={state:"disconnected"},this.connectionCount=0,this.lastCloseReason="InitialConnect",this.defaultInitialBackoff=1e3,this.maxBackoff=16e3,this.retries=0,this.serverInactivityThreshold=6e4,this.reconnectDueToServerInactivityTimeout=null,this.uri=e,this.onOpen=t.onOpen,this.onResume=t.onResume,this.onMessage=t.onMessage,this.onServerDisconnectError=t.onServerDisconnectError,this.logger=r,this.setupNetworkListener(),this.connect()}setSocketState(e){this.socket=e,this._logVerbose(`socket state changed: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}`),this.markConnectionStateDirty()}setupNetworkListener(){typeof window>"u"||typeof window.addEventListener!="function"||this.networkOnlineHandler===null&&(this.networkOnlineHandler=()=>{this._logVerbose("network online event detected"),this.tryReconnectImmediately()},window.addEventListener("online",this.networkOnlineHandler),this._logVerbose("network online event listener registered"))}cleanupNetworkListener(){this.networkOnlineHandler&&typeof window<"u"&&typeof window.removeEventListener=="function"&&(window.removeEventListener("online",this.networkOnlineHandler),this.networkOnlineHandler=null,this._logVerbose("network online event listener removed"))}assembleTransition(e){if(e.partNumber<0||e.partNumber>=e.totalParts||e.totalParts===0||this.transitionChunkBuffer&&(this.transitionChunkBuffer.totalParts!==e.totalParts||this.transitionChunkBuffer.transitionId!==e.transitionId))throw this.transitionChunkBuffer=null,new Error("Invalid TransitionChunk");if(this.transitionChunkBuffer===null&&(this.transitionChunkBuffer={chunks:[],totalParts:e.totalParts,transitionId:e.transitionId}),e.partNumber!==this.transitionChunkBuffer.chunks.length){const t=this.transitionChunkBuffer.chunks.length;throw this.transitionChunkBuffer=null,new Error(`TransitionChunk received out of order: expected part ${t}, got ${e.partNumber}`)}if(this.transitionChunkBuffer.chunks.push(e.chunk),this.transitionChunkBuffer.chunks.length===e.totalParts){const t=this.transitionChunkBuffer.chunks.join("");this.transitionChunkBuffer=null;const n=F0(JSON.parse(t));if(n.type!=="Transition")throw new Error(`Expected Transition, got ${n.type} after assembling chunks`);return n}return null}connect(){if(this.socket.state==="terminated")return;if(this.socket.state!=="disconnected"&&this.socket.state!=="stopped")throw new Error("Didn't start connection from disconnected state: "+this.socket.state);const e=new this.webSocketConstructor(this.uri);this._logVerbose("constructed WebSocket"),this.setSocketState({state:"connecting",ws:e,paused:"no"}),this.resetServerInactivityTimeout(),e.onopen=()=>{if(this.logger.logVerbose("begin ws.onopen"),this.socket.state!=="connecting")throw new Error("onopen called with socket not in connecting state");if(this.setSocketState({state:"ready",ws:e,paused:this.socket.paused==="yes"?"uninitialized":"no"}),this.resetServerInactivityTimeout(),this.socket.paused==="no"&&(this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Vi()})),this.lastCloseReason!=="InitialConnect"&&(this.lastCloseReason?this.logger.log("WebSocket reconnected at",V0(),"after disconnect due to",this.lastCloseReason):this.logger.log("WebSocket reconnected at",V0())),this.connectionCount+=1,this.lastCloseReason=null,this.pendingNetworkRecoveryInfo!==null){const{timeSavedMs:t}=this.pendingNetworkRecoveryInfo;this.pendingNetworkRecoveryInfo=null,this.sendMessage({type:"Event",eventType:"NetworkRecoveryReconnect",event:{timeSavedMs:t}}),this.logger.log(`Network recovery reconnect saved ~${Math.round(t/1e3)}s of waiting`)}},e.onerror=t=>{this.transitionChunkBuffer=null;const n=t.message;n&&this.logger.log(`WebSocket error message: ${n}`)},e.onmessage=t=>{this.resetServerInactivityTimeout();const n=t.data.length;let r=F0(JSON.parse(t.data));if(this._logVerbose(`received ws message with type ${r.type}`),r.type!=="Ping"){if(r.type==="TransitionChunk"){const i=this.assembleTransition(r);if(!i)return;r=i,this._logVerbose(`assembled full ws message of type ${r.type}`)}this.transitionChunkBuffer!==null&&(this.transitionChunkBuffer=null,this.logger.log(`Received unexpected ${r.type} while buffering TransitionChunks`)),r.type==="Transition"&&this.reportLargeTransition({messageLength:n,transition:r}),this.onMessage(r).hasSyncedPastLastReconnect&&(this.retries=0,this.markConnectionStateDirty())}},e.onclose=t=>{if(this._logVerbose("begin ws.onclose"),this.transitionChunkBuffer=null,this.lastCloseReason===null&&(this.lastCloseReason=t.reason||`closed with code ${t.code}`),t.code!==sV&&t.code!==oV&&t.code!==aV&&t.code!==lV){let r=`WebSocket closed with code ${t.code}`;t.reason&&(r+=`: ${t.reason}`),this.logger.log(r),this.onServerDisconnectError&&t.reason&&this.onServerDisconnectError(r)}const n=cV(t.reason);this.scheduleReconnect(n)}}socketState(){return this.socket.state}sendMessage(e){const t={type:e.type,...e.type==="Authenticate"&&e.tokenType==="User"?{value:`...${e.value.slice(-7)}`}:{}};if(this.socket.state==="ready"&&this.socket.paused==="no"){const n=nV(e),r=JSON.stringify(n);let i=!1;try{this.socket.ws.send(r),i=!0}catch(s){this.logger.log(`Failed to send message on WebSocket, reconnecting: ${s}`),this.closeAndReconnect("FailedToSendMessage")}return this._logVerbose(`${i?"sent":"failed to send"} message with type ${e.type}: ${JSON.stringify(t)}`),!0}return this._logVerbose(`message not sent (socket state: ${this.socket.state}, paused: ${"paused"in this.socket?this.socket.paused:void 0}): ${JSON.stringify(t)}`),!1}resetServerInactivityTimeout(){this.socket.state!=="terminated"&&(this.reconnectDueToServerInactivityTimeout!==null&&(clearTimeout(this.reconnectDueToServerInactivityTimeout),this.reconnectDueToServerInactivityTimeout=null),this.reconnectDueToServerInactivityTimeout=setTimeout(()=>{this.closeAndReconnect("InactiveServer")},this.serverInactivityThreshold))}scheduleReconnect(e){this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.socket={state:"disconnected"};const t=this.nextBackoff(e);this.markConnectionStateDirty(),this.logger.log(`Attempting reconnect in ${Math.round(t)}ms`);const n=Vi(),r=setTimeout(()=>{this.scheduledReconnect?.timeout===r&&(this.scheduledReconnect=null,this.connect())},t);this.scheduledReconnect={timeout:r,scheduledAt:n,backoffMs:t}}closeAndReconnect(e){switch(this._logVerbose(`begin closeAndReconnect with reason ${e}`),this.socket.state){case"disconnected":case"terminated":case"stopped":return;case"connecting":case"ready":this.lastCloseReason=e,this.close(),this.scheduleReconnect("client");return;default:this.socket}}close(){switch(this.transitionChunkBuffer=null,this.socket.state){case"disconnected":case"terminated":case"stopped":return Promise.resolve();case"connecting":{const e=this.socket.ws;return e.onmessage=t=>{this._logVerbose("Ignoring message received after close")},new Promise(t=>{e.onclose=()=>{this._logVerbose("Closed after connecting"),t()},e.onopen=()=>{this._logVerbose("Opened after connecting"),e.close()}})}case"ready":{this._logVerbose("ws.close called");const e=this.socket.ws;e.onmessage=n=>{this._logVerbose("Ignoring message received after close")};const t=new Promise(n=>{e.onclose=()=>{n()}});return e.close(),t}default:return this.socket,Promise.resolve()}}terminate(){switch(this.reconnectDueToServerInactivityTimeout&&clearTimeout(this.reconnectDueToServerInactivityTimeout),this.scheduledReconnect&&(clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null),this.cleanupNetworkListener(),this.socket.state){case"terminated":case"stopped":case"disconnected":case"connecting":case"ready":{const e=this.close();return this.setSocketState({state:"terminated"}),e}default:throw this.socket,new Error(`Invalid websocket state: ${this.socket.state}`)}}stop(){switch(this.socket.state){case"terminated":return Promise.resolve();case"connecting":case"stopped":case"disconnected":case"ready":{this.cleanupNetworkListener();const e=this.close();return this.socket={state:"stopped"},e}default:return this.socket,Promise.resolve()}}tryRestart(){switch(this.socket.state){case"stopped":break;case"terminated":case"connecting":case"ready":case"disconnected":this.logger.logVerbose("Restart called without stopping first");return;default:this.socket}this.setupNetworkListener(),this.connect()}pause(){switch(this.socket.state){case"disconnected":case"stopped":case"terminated":return;case"connecting":case"ready":this.socket={...this.socket,paused:"yes"};return;default:this.socket;return}}tryReconnectImmediately(){if(this._logVerbose("tryReconnectImmediately called"),this.socket.state!=="disconnected"){this._logVerbose(`tryReconnectImmediately called but socket state is ${this.socket.state}, no action taken`);return}let e=null;if(this.scheduledReconnect){const t=Vi()-this.scheduledReconnect.scheduledAt;e=Math.max(0,this.scheduledReconnect.backoffMs-t),this._logVerbose(`would have waited ${Math.round(e)}ms more (backoff was ${Math.round(this.scheduledReconnect.backoffMs)}ms, elapsed ${Math.round(t)}ms)`),clearTimeout(this.scheduledReconnect.timeout),this.scheduledReconnect=null,this._logVerbose("canceled scheduled reconnect")}this.logger.log("Network recovery detected, reconnecting immediately"),this.pendingNetworkRecoveryInfo=e!==null?{timeSavedMs:e}:null,this.connect()}resume(){switch(this.socket.state){case"connecting":this.socket={...this.socket,paused:"no"};return;case"ready":this.socket.paused==="uninitialized"?(this.socket={...this.socket,paused:"no"},this._hasEverConnected=!0,this.onOpen({connectionCount:this.connectionCount,lastCloseReason:this.lastCloseReason,clientTs:Vi()})):this.socket.paused==="yes"&&(this.socket={...this.socket,paused:"no"},this.onResume());return;case"terminated":case"stopped":case"disconnected":return;default:this.socket}this.connect()}connectionState(){return{isConnected:this.socket.state==="ready",hasEverConnected:this._hasEverConnected,connectionCount:this.connectionCount,connectionRetries:this.retries}}_logVerbose(e){this.logger.logVerbose(e)}nextBackoff(e){const t=(e==="client"?100:e==="Unknown"?this.defaultInitialBackoff:j1[e].timeout)*Math.pow(2,this.retries);this.retries+=1;const n=Math.min(t,this.maxBackoff);return n+n*(Math.random()-.5)}reportLargeTransition({transition:e,messageLength:t}){if(e.clientClockSkew===void 0||e.serverTs===void 0)return;const n=Vi()-e.clientClockSkew-e.serverTs/1e6,r=`${Math.round(n)}ms`,i=`${Math.round(t/1e4)/100}MB`,s=t/(n/1e3),o=`${Math.round(s/1e4)/100}MB per second`;this._logVerbose(`received ${i} transition in ${r} at ${o}`),t>2e7?this.logger.log(`received query results totaling more that 20MB (${i}) which will take a long time to download on slower connections`):n>2e4&&this.logger.log(`received query results totaling ${i} which took more than 20s to arrive (${r})`),this.debug&&this.sendMessage({type:"Event",eventType:"ClientReceivedTransition",event:{transitionTransitTime:n,messageLength:t}})}};function hV(){return fV()}function fV(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var oo=class extends Error{};oo.prototype.name="InvalidTokenError";function dV(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,n)=>{let r=n.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function pV(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return dV(t)}catch{return atob(t)}}function B1(e,t){if(typeof e!="string")throw new oo("Invalid token specified: must be a string");t||(t={});const n=t.header===!0?0:1,r=e.split(".")[n];if(typeof r!="string")throw new oo(`Invalid token specified: missing part #${n+1}`);let i;try{i=pV(r)}catch(s){throw new oo(`Invalid token specified: invalid base64 for part #${n+1} (${s.message})`)}try{return JSON.parse(i)}catch(s){throw new oo(`Invalid token specified: invalid json for part #${n+1} (${s.message})`)}}var mV=Object.defineProperty,gV=(e,t,n)=>t in e?mV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vt=(e,t,n)=>gV(e,typeof t!="symbol"?t+"":t,n),vV=1728e6,z0=2,yV=class{constructor(e,t,n){vt(this,"authState",{state:"noAuth"}),vt(this,"configVersion",0),vt(this,"syncState"),vt(this,"authenticate"),vt(this,"stopSocket"),vt(this,"tryRestartSocket"),vt(this,"pauseSocket"),vt(this,"resumeSocket"),vt(this,"clearAuth"),vt(this,"logger"),vt(this,"refreshTokenLeewaySeconds"),vt(this,"initialAuthTokenReuse"),vt(this,"lastRefreshChange"),vt(this,"tokenConfirmationAttempts",0),this.syncState=e,this.authenticate=t.authenticate,this.stopSocket=t.stopSocket,this.tryRestartSocket=t.tryRestartSocket,this.pauseSocket=t.pauseSocket,this.resumeSocket=t.resumeSocket,this.clearAuth=t.clearAuth,this.logger=n.logger,this.refreshTokenLeewaySeconds=n.refreshTokenLeewaySeconds,this.initialAuthTokenReuse=n.initialAuthTokenReuse,this.lastRefreshChange=!1}notifyRefreshChange(e){this.authState.state!=="noAuth"&&this.authState.state!=="initialRefetch"&&this.authState.config.onRefreshChange&&this.lastRefreshChange!==e&&(this.lastRefreshChange=e,this.authState.config.onRefreshChange(e))}async setConfig(e,t,n){this.resetAuthState(),this._logVerbose("pausing WS for auth token fetch"),this.pauseSocket();const r=await this.fetchTokenAndGuardAgainstRace(e,{forceRefreshToken:!1});if(r.isFromOutdatedConfig)return;const i={fetchToken:e,onAuthChange:t,onRefreshChange:n};r.value?(this.setAuthState({state:"waitingForServerConfirmationOfCachedToken",config:i,hasRetried:!1}),this.authenticate(r.value)):(this.setAuthState({state:"initialRefetch",config:i}),await this.refetchToken()),this._logVerbose("resuming WS after auth token fetch"),this.resumeSocket()}onTransition(e){if(this.syncState.isCurrentOrNewerAuthVersion(e.endVersion.identity)&&!(e.endVersion.identity<=e.startVersion.identity)){if(this._logVerbose(`auth state is ${this.authState.state} when handling transition`),this.syncState.markAuthCompletion(),this.authState.state==="waitingForServerConfirmationOfCachedToken"){this._logVerbose("server confirmed auth token is valid");const t=this.syncState.getAuth()?.value;this.initialAuthTokenReuse&&t?this.scheduleTokenRefetch(t,e.clientClockSkew):this.refetchToken(),this.authState.config.onAuthChange(!0);return}this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this._logVerbose("server confirmed new auth token is valid"),this.notifyRefreshChange(!1),this.scheduleTokenRefetch(this.authState.token),this.tokenConfirmationAttempts=0,this.authState.hadAuth||this.authState.config.onAuthChange(!0))}}onAuthError(e){if(e.authUpdateAttempted===!1&&(this.authState.state==="waitingForServerConfirmationOfFreshToken"||this.authState.state==="waitingForServerConfirmationOfCachedToken")){this._logVerbose("ignoring non-auth token expired error");return}const{baseVersion:t}=e;if(!this.syncState.isCurrentOrNewerAuthVersion(t+1)){this._logVerbose("ignoring auth error for previous auth attempt");return}this.tryToReauthenticate(e)}async tryToReauthenticate(e){if(this._logVerbose(`attempting to reauthenticate: ${e.error}`),this.authState.state==="noAuth"||this.authState.state==="waitingForServerConfirmationOfFreshToken"&&this.tokenConfirmationAttempts>=z0){this.logger.error(`Failed to authenticate: "${e.error}", check your server auth config`),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.authState.state!=="noAuth"&&this.setAndReportAuthFailed(this.authState.config.onAuthChange);return}if(this.authState.state==="waitingForServerConfirmationOfFreshToken"&&(this.tokenConfirmationAttempts++,this._logVerbose(`retrying reauthentication, ${z0-this.tokenConfirmationAttempts} attempts remaining`)),this.notifyRefreshChange(!0),await this.stopSocket(),this.authState.state==="noAuth")return;const t=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});t.isFromOutdatedConfig||(t.value&&this.syncState.isNewAuth(t.value)?(this.authenticate(t.value),this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",config:this.authState.config,token:t.value,hadAuth:this.authState.state==="notRefetching"||this.authState.state==="waitingForScheduledRefetch"})):(this._logVerbose("reauthentication failed, could not fetch a new token"),this.syncState.hasAuth()&&this.syncState.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this.tryRestartSocket())}async refetchToken(){if(this.authState.state==="noAuth")return;this._logVerbose("refetching auth token");const e=await this.fetchTokenAndGuardAgainstRace(this.authState.config.fetchToken,{forceRefreshToken:!0});e.isFromOutdatedConfig||(e.value?this.syncState.isNewAuth(e.value)?(this.setAuthState({state:"waitingForServerConfirmationOfFreshToken",hadAuth:this.syncState.hasAuth(),token:e.value,config:this.authState.config}),this.authenticate(e.value)):this.setAuthState({state:"notRefetching",config:this.authState.config}):(this._logVerbose("refetching token failed"),this.syncState.hasAuth()&&this.clearAuth(),this.setAndReportAuthFailed(this.authState.config.onAuthChange)),this._logVerbose("restarting WS after auth token fetch (if currently stopped)"),this.tryRestartSocket())}scheduleTokenRefetch(e,t){if(this.authState.state==="noAuth")return;const n=this.decodeToken(e);if(!n){this.logger.error("Auth token is not a valid JWT, cannot refetch the token");return}const{iat:r,exp:i}=n;if(!r||!i){this.logger.error("Auth token does not have required fields, cannot refetch the token");return}const s=i-r;if(s<=2){this.logger.error("Auth token does not live long enough, cannot refetch the token");return}let o;t!==void 0?(o=i-(Date.now()-t)/1e3,o<=0&&(o=0)):o=s;let a=Math.min(vV,(o-this.refreshTokenLeewaySeconds)*1e3);a<=0&&(this.logger.warn(`Refetching auth token immediately, configured leeway ${this.refreshTokenLeewaySeconds}s is larger than the token's lifetime ${o}s`),a=0);const l=setTimeout(()=>{this._logVerbose("running scheduled token refetch"),this.refetchToken()},a);this.setAuthState({state:"waitingForScheduledRefetch",refetchTokenTimeoutId:l,config:this.authState.config}),this._logVerbose(`scheduled preemptive auth token refetching in ${a}ms`)}async fetchTokenAndGuardAgainstRace(e,t){const n=++this.configVersion;this._logVerbose(`fetching token with config version ${n}`);const r=await e(t);return this.configVersion!==n?(this._logVerbose(`stale config version, expected ${n}, got ${this.configVersion}`),{isFromOutdatedConfig:!0}):{isFromOutdatedConfig:!1,value:r}}stop(){this.resetAuthState(),this.configVersion++,this._logVerbose(`config version bumped to ${this.configVersion}`)}setAndReportAuthFailed(e){e(!1),this.resetAuthState()}resetAuthState(){this.notifyRefreshChange(!1),this.setAuthState({state:"noAuth"})}setAuthState(e){const t=e.state==="waitingForServerConfirmationOfFreshToken"?{hadAuth:e.hadAuth,state:e.state,token:`...${e.token.slice(-7)}`}:{state:e.state};switch(this._logVerbose(`setting auth state to ${JSON.stringify(t)}`),e.state){case"waitingForScheduledRefetch":case"notRefetching":case"noAuth":this.tokenConfirmationAttempts=0}this.authState.state==="waitingForScheduledRefetch"&&clearTimeout(this.authState.refetchTokenTimeoutId),this.authState=e}decodeToken(e){try{return B1(e)}catch(t){return this._logVerbose(`Error decoding token: ${t instanceof Error?t.message:"Unknown error"}`),null}}_logVerbose(e){this.logger.logVerbose(`${e} [v${this.configVersion}]`)}},xV=["convexClientConstructed","convexWebSocketOpen","convexFirstMessageReceived"];function bV(e,t){const n={sessionId:t};typeof performance>"u"||!performance.mark||performance.mark(e,{detail:n})}function wV(e){let t=e.name.slice(6);return t=t.charAt(0).toLowerCase()+t.slice(1),{name:t,startTime:e.startTime}}function SV(e){if(typeof performance>"u"||!performance.getEntriesByName)return[];const t=[];for(const n of xV){const r=performance.getEntriesByName(n).filter(i=>i.entryType==="mark").filter(i=>i.detail.sessionId===e);t.push(...r)}return t.map(wV)}var kV=Object.defineProperty,CV=(e,t,n)=>t in e?kV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fe=(e,t,n)=>CV(e,typeof t!="symbol"?t+"":t,n),AV=class{constructor(e,t,n){if(Fe(this,"address"),Fe(this,"state"),Fe(this,"requestManager"),Fe(this,"webSocketManager"),Fe(this,"authenticationManager"),Fe(this,"remoteQuerySet"),Fe(this,"optimisticQueryResults"),Fe(this,"_transitionHandlerCounter",0),Fe(this,"_nextRequestId"),Fe(this,"_onTransitionFns",new Map),Fe(this,"_sessionId"),Fe(this,"firstMessageReceived",!1),Fe(this,"debug"),Fe(this,"logger"),Fe(this,"maxObservedTimestamp"),Fe(this,"connectionStateSubscribers",new Map),Fe(this,"nextConnectionStateSubscriberId",0),Fe(this,"_lastPublishedConnectionState"),Fe(this,"markConnectionStateDirty",()=>{Promise.resolve().then(()=>{const f=this.connectionState();if(JSON.stringify(f)!==JSON.stringify(this._lastPublishedConnectionState)){this._lastPublishedConnectionState=f;for(const d of this.connectionStateSubscribers.values())d(f)}})}),Fe(this,"mark",f=>{this.debug&&bV(f,this.sessionId)}),typeof e=="object")throw new Error("Passing a ClientConfig object is no longer supported. Pass the URL of the Convex deployment as a string directly.");n?.skipConvexDeploymentUrlCheck!==!0&&XE(e),n={...n};const r=n.authRefreshTokenLeewaySeconds??10;let i=n.webSocketConstructor;if(!i&&typeof WebSocket>"u")throw new Error("No WebSocket global variable defined! To use Convex in an environment without WebSocket try the HTTP client: https://docs.convex.dev/api/classes/browser.ConvexHttpClient");i=i||WebSocket,this.debug=n.reportDebugInfoToConvex??!1,this.address=e,this.logger=n.logger===!1?_1({verbose:n.verbose??!1}):n.logger!==!0&&n.logger?n.logger:L1({verbose:n.verbose??!1});const s=e.search("://");if(s===-1)throw new Error("Provided address was not an absolute URL.");const o=e.substring(s+3),a=e.substring(0,s);let l;if(a==="http")l="ws";else if(a==="https")l="wss";else throw new Error(`Unknown parent protocol ${a}`);const c=`${l}://${o}/api/${O0}/sync`;this.state=new $F,this.remoteQuerySet=new B0(f=>this.state.queryPath(f),this.logger),this.requestManager=new UF(this.logger,this.markConnectionStateDirty);const u=()=>{this.webSocketManager.pause(),this.state.pause()};this.authenticationManager=new yV(this.state,{authenticate:f=>{const d=this.state.setAuth(f);return this.webSocketManager.sendMessage(d),d.baseVersion},stopSocket:()=>this.webSocketManager.stop(),tryRestartSocket:()=>this.webSocketManager.tryRestart(),pauseSocket:u,resumeSocket:()=>this.webSocketManager.resume(),clearAuth:()=>{this.clearAuth()}},{logger:this.logger,refreshTokenLeewaySeconds:r,initialAuthTokenReuse:n.initialAuthTokenReuse??!1}),this.optimisticQueryResults=new GF,this.addOnTransitionHandler(f=>{t(f.queries.map(d=>d.token))}),this._nextRequestId=0,this._sessionId=hV();const{unsavedChangesWarning:h}=n;if(typeof window>"u"||typeof window.addEventListener>"u"){if(h===!0)throw new Error("unsavedChangesWarning requested, but window.addEventListener not found! Remove {unsavedChangesWarning: true} from Convex client options.")}else h!==!1&&window.addEventListener("beforeunload",f=>{if(this.requestManager.hasIncompleteRequests()){f.preventDefault();const d="Are you sure you want to leave? Your changes may not be saved.";return(f||window.event).returnValue=d,d}});this.webSocketManager=new uV(c,{onOpen:f=>{this.mark("convexWebSocketOpen"),this.webSocketManager.sendMessage({...f,type:"Connect",sessionId:this._sessionId,maxObservedTimestamp:this.maxObservedTimestamp}),this.remoteQuerySet=new B0(v=>this.state.queryPath(v),this.logger);const[d,m]=this.state.restart();m&&this.webSocketManager.sendMessage(m),this.webSocketManager.sendMessage(d);for(const v of this.requestManager.restart())this.webSocketManager.sendMessage(v)},onResume:()=>{const[f,d]=this.state.resume();d&&this.webSocketManager.sendMessage(d),f&&this.webSocketManager.sendMessage(f);for(const m of this.requestManager.resume())this.webSocketManager.sendMessage(m)},onMessage:f=>{switch(this.firstMessageReceived||(this.firstMessageReceived=!0,this.mark("convexFirstMessageReceived"),this.reportMarks()),f.type){case"Transition":{this.observedTimestamp(f.endVersion.ts),this.authenticationManager.onTransition(f),this.remoteQuerySet.transition(f),this.state.transition(f);const d=this.requestManager.removeCompleted(this.remoteQuerySet.timestamp());this.notifyOnQueryResultChanges(d);break}case"MutationResponse":{f.success&&this.observedTimestamp(f.ts);const d=this.requestManager.onResponse(f);d!==null&&this.notifyOnQueryResultChanges(new Map([[d.requestId,d.result]]));break}case"ActionResponse":this.requestManager.onResponse(f);break;case"AuthError":this.authenticationManager.onAuthError(f);break;case"FatalError":{const d=FF(this.logger,f.error);throw this.webSocketManager.terminate(),d}}return{hasSyncedPastLastReconnect:this.hasSyncedPastLastReconnect()}},onServerDisconnectError:n.onServerDisconnectError},i,this.logger,this.markConnectionStateDirty,this.debug),this.mark("convexClientConstructed"),n.expectAuth&&u()}hasSyncedPastLastReconnect(){return this.requestManager.hasSyncedPastLastReconnect()&&this.state.hasSyncedPastLastReconnect()}observedTimestamp(e){(this.maxObservedTimestamp===void 0||this.maxObservedTimestamp.lessThanOrEqual(e))&&(this.maxObservedTimestamp=e)}getMaxObservedTimestamp(){return this.maxObservedTimestamp}notifyOnQueryResultChanges(e){const t=this.remoteQuerySet.remoteQueryResults(),n=new Map;for(const[i,s]of t){const o=this.state.queryToken(i);if(o!==null){const a={result:s,udfPath:this.state.queryPath(i),args:this.state.queryArgs(i)};n.set(o,a)}}const r=this.optimisticQueryResults.ingestQueryResultsFromServer(n,new Set(e.keys()));this.handleTransition({queries:r.map(i=>({token:i,modification:{kind:"Updated",result:this.optimisticQueryResults.rawQueryResult(i)}})),reflectedMutations:Array.from(e).map(([i,s])=>({requestId:i,result:s})),timestamp:this.remoteQuerySet.timestamp()})}handleTransition(e){for(const t of this._onTransitionFns.values())t(e)}addOnTransitionHandler(e){const t=this._transitionHandlerCounter++;return this._onTransitionFns.set(t,e),()=>this._onTransitionFns.delete(t)}getCurrentAuthClaims(){const e=this.state.getAuth();let t={};if(e&&e.tokenType==="User")try{t=e?B1(e.value):{}}catch{t={}}else return;return{token:e.value,decoded:t}}setAuth(e,t,n){this.authenticationManager.setConfig(e,t,n)}hasAuth(){return this.state.hasAuth()}setAdminAuth(e,t){const n=this.state.setAdminAuth(e,t);this.webSocketManager.sendMessage(n)}clearAuth(){const e=this.state.clearAuth();this.webSocketManager.sendMessage(e)}subscribe(e,t,n){const r=Wn(t),{modification:i,queryToken:s,unsubscribe:o}=this.state.subscribe(e,r,n?.journal,n?.componentPath);return i!==null&&this.webSocketManager.sendMessage(i),{queryToken:s,unsubscribe:()=>{const a=o();a&&this.webSocketManager.sendMessage(a)}}}localQueryResult(e,t){const n=Wn(t),r=li(e,n);return this.optimisticQueryResults.queryResult(r)}localQueryResultByToken(e){return this.optimisticQueryResults.queryResult(e)}hasLocalQueryResultByToken(e){return this.optimisticQueryResults.hasQueryResult(e)}localQueryLogs(e,t){const n=Wn(t),r=li(e,n);return this.optimisticQueryResults.queryLogs(r)}queryJournal(e,t){const n=Wn(t),r=li(e,n);return this.state.queryJournal(r)}connectionState(){const e=this.webSocketManager.connectionState();return{hasInflightRequests:this.requestManager.hasInflightRequests(),isWebSocketConnected:e.isConnected,hasEverConnected:e.hasEverConnected,connectionCount:e.connectionCount,connectionRetries:e.connectionRetries,timeOfOldestInflightRequest:this.requestManager.timeOfOldestInflightRequest(),inflightMutations:this.requestManager.inflightMutations(),inflightActions:this.requestManager.inflightActions()}}subscribeToConnectionState(e){const t=this.nextConnectionStateSubscriberId++;return this.connectionStateSubscribers.set(t,e),()=>{this.connectionStateSubscribers.delete(t)}}async mutation(e,t,n){const r=await this.mutationInternal(e,t,n);if(!r.success)throw r.errorData!==void 0?rd(r,new cf(Gi("mutation",e,r))):new Error(Gi("mutation",e,r));return r.value}async mutationInternal(e,t,n,r){const{mutationPromise:i}=this.enqueueMutation(e,t,n,r);return i}enqueueMutation(e,t,n,r){const i=Wn(t);this.tryReportLongDisconnect();const s=this.nextRequestId;if(this._nextRequestId++,n!==void 0){const l=n.optimisticUpdate;if(l!==void 0){const c=h=>{l(h,i)instanceof Promise&&this.logger.warn("Optimistic update handler returned a Promise. Optimistic updates should be synchronous.")},u=this.optimisticQueryResults.applyOptimisticUpdate(c,s).map(h=>{const f=this.localQueryResultByToken(h);return{token:h,modification:{kind:"Updated",result:f===void 0?void 0:{success:!0,value:f,logLines:[]}}}});this.handleTransition({queries:u,reflectedMutations:[],timestamp:this.remoteQuerySet.timestamp()})}}const o={type:"Mutation",requestId:s,udfPath:e,componentPath:r,args:[In(i)]},a=this.webSocketManager.sendMessage(o);return{requestId:s,mutationPromise:this.requestManager.request(o,a)}}async action(e,t){const n=await this.actionInternal(e,t);if(!n.success)throw n.errorData!==void 0?rd(n,new cf(Gi("action",e,n))):new Error(Gi("action",e,n));return n.value}async actionInternal(e,t,n){const r=Wn(t),i=this.nextRequestId;this._nextRequestId++,this.tryReportLongDisconnect();const s={type:"Action",requestId:i,udfPath:e,componentPath:n,args:[In(r)]},o=this.webSocketManager.sendMessage(s);return this.requestManager.request(s,o)}async close(){return this.authenticationManager.stop(),this.webSocketManager.terminate()}get url(){return this.address}get nextRequestId(){return this._nextRequestId}get sessionId(){return this._sessionId}reportMarks(){if(this.debug){const e=SV(this.sessionId);this.webSocketManager.sendMessage({type:"Event",eventType:"ClientConnect",event:e})}}tryReportLongDisconnect(){if(!this.debug)return;const e=this.connectionState().timeOfOldestInflightRequest;if(e===null||Date.now()-e.getTime()<=6e4)return;const t=`${this.address}/api/debug_event`;fetch(t,{method:"POST",headers:{"Content-Type":"application/json","Convex-Client":`npm-${O0}`},body:JSON.stringify({event:"LongWebsocketDisconnect"})}).then(n=>{n.ok||this.logger.warn("Analytics request failed with response:",n.body)}).catch(n=>{this.logger.warn("Analytics response failed with error:",n)})}};function xh(e){if(typeof e!="object"||e===null||!Array.isArray(e.page)||typeof e.isDone!="boolean"||typeof e.continueCursor!="string")throw new Error(`Not a valid paginated query result: ${e?.toString()}`);return e}var TV=Object.defineProperty,EV=(e,t,n)=>t in e?TV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$0=(e,t,n)=>EV(e,typeof t!="symbol"?t+"":t,n),MV=class{constructor(e,t){this.client=e,this.onTransition=t,$0(this,"paginatedQuerySet",new Map),$0(this,"lastTransitionTs"),this.lastTransitionTs=Ea.fromNumber(0),this.client.addOnTransitionHandler(n=>this.onBaseTransition(n))}subscribe(e,t,n){const r=yi(e),i=N0(r,t,n),s=()=>this.removePaginatedQuerySubscriber(i),o=this.paginatedQuerySet.get(i);return o?(o.numSubscribers+=1,{paginatedQueryToken:i,unsubscribe:s}):(this.paginatedQuerySet.set(i,{token:i,canonicalizedUdfPath:r,args:t,numSubscribers:1,options:{initialNumItems:n.initialNumItems},nextPageKey:0,pageKeys:[],pageKeyToQuery:new Map,ongoingSplits:new Map,skip:!1,id:n.id}),this.addPageToPaginatedQuery(i,null,n.initialNumItems),{paginatedQueryToken:i,unsubscribe:s})}localQueryResult(e,t,n){const r=yi(e),i=N0(r,t,n);return this.localQueryResultByToken(i)}localQueryResultByToken(e){const t=this.paginatedQuerySet.get(e);if(!t)return;const n=this.activePageQueryTokens(t);if(n.length===0)return{results:[],status:"LoadingFirstPage",loadMore:a=>this.loadMoreOfPaginatedQuery(e,a)};let r=[],i=!1,s=!1;for(const a of n){const l=this.client.localQueryResultByToken(a);if(l===void 0){i=!0,s=!1;continue}const c=xh(l);r=r.concat(c.page),s=!!c.isDone}let o;return i?o=r.length===0?"LoadingFirstPage":"LoadingMore":s?o="Exhausted":o="CanLoadMore",{results:r,status:o,loadMore:a=>this.loadMoreOfPaginatedQuery(e,a)}}onBaseTransition(e){const t=e.queries.map(s=>s.token),n=this.queriesContainingTokens(t);let r=[];n.length>0&&(this.processPaginatedQuerySplits(n,s=>this.client.localQueryResultByToken(s)),r=n.map(s=>({token:s,modification:{kind:"Updated",result:this.localQueryResultByToken(s)}})));const i={...e,paginatedQueries:r};this.onTransition(i)}loadMoreOfPaginatedQuery(e,t){this.mustGetPaginatedQuery(e);const n=this.queryTokenForLastPageOfPaginatedQuery(e),r=this.client.localQueryResultByToken(n);if(!r)return!1;const i=xh(r);if(i.isDone)return!1;this.addPageToPaginatedQuery(e,i.continueCursor,t);const s={timestamp:this.lastTransitionTs,reflectedMutations:[],queries:[],paginatedQueries:[{token:e,modification:{kind:"Updated",result:this.localQueryResultByToken(e)}}]};return this.onTransition(s),!0}queriesContainingTokens(e){if(e.length===0)return[];const t=[],n=new Set(e);for(const[r,i]of this.paginatedQuerySet)for(const s of this.allQueryTokens(i))if(n.has(s)){t.push(r);break}return t}processPaginatedQuerySplits(e,t){for(const n of e){const r=this.mustGetPaginatedQuery(n),{ongoingSplits:i,pageKeyToQuery:s,pageKeys:o}=r;for(const[a,[l,c]]of i)t(s.get(l).queryToken)!==void 0&&t(s.get(c).queryToken)!==void 0&&this.completePaginatedQuerySplit(r,a,l,c);for(const a of o){if(i.has(a))continue;const l=s.get(a);if(!l)throw new Error(`No page query for active pageKey ${a}`);const c=t(l.queryToken);if(!c)continue;const u=xh(c);u.splitCursor&&(u.pageStatus==="SplitRecommended"||u.pageStatus==="SplitRequired"||u.page.length>r.options.initialNumItems*2)&&this.splitPaginatedQueryPage(r,a,l.cursor,u.splitCursor,u.continueCursor)}}}splitPaginatedQueryPage(e,t,n,r,i){const s=e.nextPageKey++,o=e.nextPageKey++,a={numItems:e.options.initialNumItems,id:e.id},l=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...a,cursor:n,endCursor:r}});e.pageKeyToQuery.set(s,{...l,cursor:n});const c=this.client.subscribe(e.canonicalizedUdfPath,{...e.args,paginationOpts:{...a,cursor:r,endCursor:i}});e.pageKeyToQuery.set(o,{...c,cursor:r}),e.ongoingSplits.set(t,[s,o])}addPageToPaginatedQuery(e,t,n){const r=this.mustGetPaginatedQuery(e),i=r.nextPageKey++,s={cursor:t,numItems:n,id:r.id},o={...r.args,paginationOpts:s},a=this.client.subscribe(r.canonicalizedUdfPath,o);return r.pageKeys.push(i),r.pageKeyToQuery.set(i,{...a,cursor:t}),a}removePaginatedQuerySubscriber(e){const t=this.paginatedQuerySet.get(e);if(t&&(t.numSubscribers-=1,!(t.numSubscribers>0))){for(const n of t.pageKeyToQuery.values())n.unsubscribe();this.paginatedQuerySet.delete(e)}}completePaginatedQuerySplit(e,t,n,r){const i=e.pageKeyToQuery.get(t);e.pageKeyToQuery.delete(t);const s=e.pageKeys.indexOf(t);e.pageKeys.splice(s,1,n,r),e.ongoingSplits.delete(t),i.unsubscribe()}activePageQueryTokens(e){return e.pageKeys.map(t=>e.pageKeyToQuery.get(t).queryToken)}allQueryTokens(e){return Array.from(e.pageKeyToQuery.values()).map(t=>t.queryToken)}queryTokenForLastPageOfPaginatedQuery(e){const t=this.mustGetPaginatedQuery(e),n=t.pageKeys[t.pageKeys.length-1];if(n===void 0)throw new Error(`No pages for paginated query ${e}`);return t.pageKeyToQuery.get(n).queryToken}mustGetPaginatedQuery(e){const t=this.paginatedQuerySet.get(e);if(!t)throw new Error("paginated query no longer exists for token "+e);return t}};function RV({getCurrentValue:e,subscribe:t}){const[n,r]=(0,g.useState)(()=>({getCurrentValue:e,subscribe:t,value:e()}));let i=n.value;return(n.getCurrentValue!==e||n.subscribe!==t)&&(i=e(),r({getCurrentValue:e,subscribe:t,value:i})),(0,g.useEffect)(()=>{let s=!1;const o=()=>{s||r(l=>{if(l.getCurrentValue!==e||l.subscribe!==t)return l;const c=e();return l.value===c?l:{...l,value:c}})},a=t(o);return o(),()=>{s=!0,a()}},[e,t]),i}var PV=Object.defineProperty,IV=(e,t,n)=>t in e?PV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bn=(e,t,n)=>IV(e,typeof t!="symbol"?t+"":t,n),OV=5e3;if(typeof g.default>"u")throw new Error("Required dependency 'react' not found");function F1(e,t,n){function r(i){return LV(i),t.mutation(e,i,{optimisticUpdate:n})}return r.withOptimisticUpdate=function(s){if(n!==void 0)throw new Error(`Already specified optimistic update for mutation ${pt(e)}`);return F1(e,t,s)},r}function DV(e,t){return function(n){return t.action(e,n)}}var v8=class{constructor(e,t){if(Bn(this,"address"),Bn(this,"cachedSync"),Bn(this,"cachedPaginatedQueryClient"),Bn(this,"listeners"),Bn(this,"options"),Bn(this,"closed",!1),Bn(this,"_logger"),Bn(this,"adminAuth"),Bn(this,"fakeUserIdentity"),e===void 0)throw new Error("No address provided to ConvexReactClient.\nIf trying to deploy to production, make sure to follow all the instructions found at https://docs.convex.dev/production/hosting/\nIf running locally, make sure to run `convex dev` and ensure the .env.local file is populated.");if(typeof e!="string")throw new Error(`ConvexReactClient requires a URL like 'https://happy-otter-123.convex.cloud', received something of type ${typeof e} instead.`);if(!e.includes("://"))throw new Error("Provided address was not an absolute URL.");this.address=e,this.listeners=new Map,this._logger=t?.logger===!1?_1({verbose:t?.verbose??!1}):t?.logger!==!0&&t?.logger?t.logger:L1({verbose:t?.verbose??!1}),this.options={...t,logger:this._logger}}get url(){return this.address}get sync(){if(this.closed)throw new Error("ConvexReactClient has already been closed.");return this.cachedSync?this.cachedSync:(this.cachedSync=this.options.baseClient??new AV(this.address,()=>{},this.options),this.adminAuth&&this.cachedSync.setAdminAuth(this.adminAuth,this.fakeUserIdentity),this.cachedPaginatedQueryClient=new MV(this.cachedSync,e=>this.handleTransition(e)),this.cachedSync)}get paginatedQueryClient(){if(this.sync,this.cachedPaginatedQueryClient)return this.cachedPaginatedQueryClient;throw new Error("Should already be instantiated")}setAuth(e,t,n){if(typeof e=="string")throw new Error("Passing a string to ConvexReactClient.setAuth is no longer supported, please upgrade to passing in an async function to handle reauthentication.");this.sync.setAuth(e,t??(()=>{}),n)}clearAuth(){this.sync.clearAuth()}setAdminAuth(e,t){if(this.adminAuth=e,this.fakeUserIdentity=t,this.closed)throw new Error("ConvexReactClient has already been closed.");this.cachedSync&&this.sync.setAdminAuth(e,t)}watchQuery(e,...t){const[n,r]=t,i=pt(e);return{onUpdate:s=>{const{queryToken:o,unsubscribe:a}=this.sync.subscribe(i,n,r),l=this.listeners.get(o);return l!==void 0?l.add(s):this.listeners.set(o,new Set([s])),()=>{if(this.closed)return;const c=this.listeners.get(o);c.delete(s),c.size===0&&this.listeners.delete(o),a()}},localQueryResult:()=>{if(this.cachedSync)return this.cachedSync.localQueryResult(i,n)},localQueryLogs:()=>{if(this.cachedSync)return this.cachedSync.localQueryLogs(i,n)},journal:()=>{if(this.cachedSync)return this.cachedSync.queryJournal(i,n)}}}prewarmQuery(e){const t=e.extendSubscriptionFor??OV,n=this.watchQuery(e.query,e.args||{}).onUpdate(()=>{});setTimeout(n,t)}watchPaginatedQuery(e,t,n){const r=pt(e);return{onUpdate:i=>{const{paginatedQueryToken:s,unsubscribe:o}=this.paginatedQueryClient.subscribe(r,t||{},n),a=this.listeners.get(s);return a!==void 0?a.add(i):this.listeners.set(s,new Set([i])),()=>{if(this.closed)return;const l=this.listeners.get(s);l.delete(i),l.size===0&&this.listeners.delete(s),o()}},localQueryResult:()=>this.paginatedQueryClient.localQueryResult(r,t,n)}}mutation(e,...t){const[n,r]=t,i=pt(e);return this.sync.mutation(i,n,r)}action(e,...t){const n=pt(e);return this.sync.action(n,...t)}query(e,...t){const n=this.watchQuery(e,...t),r=n.localQueryResult();return r!==void 0?Promise.resolve(r):new Promise((i,s)=>{const o=n.onUpdate(()=>{o();try{i(n.localQueryResult())}catch(a){s(a)}})})}connectionState(){return this.sync.connectionState()}subscribeToConnectionState(e){return this.sync.subscribeToConnectionState(e)}get logger(){return this._logger}async close(){if(this.closed=!0,this.listeners=new Map,this.cachedPaginatedQueryClient&&(this.cachedPaginatedQueryClient=void 0),this.cachedSync){const e=this.cachedSync;this.cachedSync=void 0,await e.close()}}handleTransition(e){const t=e.queries.map(r=>r.token),n=e.paginatedQueries.map(r=>r.token);this.transition([...t,...n])}transition(e){for(const t of e){const n=this.listeners.get(t);if(n)for(const r of n)r()}}},mu=g.createContext(void 0);function NV(){return(0,g.useContext)(mu)}var y8=({client:e,children:t})=>g.createElement(mu.Provider,{value:e},t);function V1(e,...t){const n=t[0]==="skip",r=t[0]==="skip"?{}:Wn(t[0]),i=typeof e=="string"?pu(e):e,s=pt(i),o=(0,g.useMemo)(()=>n?{}:{query:{query:i,args:r}},[JSON.stringify(In(r)),s,n]),a=FV(o).query;if(a instanceof Error)throw a;return a}function x8(e){const t=typeof e=="string"?pu(e):e,n=(0,g.useContext)(mu);if(n===void 0)throw new Error("Could not find Convex client! `useMutation` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return(0,g.useMemo)(()=>F1(t,n),[n,pt(t)])}function b8(e){const t=(0,g.useContext)(mu),n=typeof e=="string"?pu(e):e;if(t===void 0)throw new Error("Could not find Convex client! `useAction` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return(0,g.useMemo)(()=>DV(n,t),[t,pt(n)])}function LV(e){if(typeof e=="object"&&e!==null&&"bubbles"in e&&"persist"in e&&"isDefaultPrevented"in e)throw new Error("Convex function called with SyntheticEvent object. Did you use a Convex function as an event handler directly? Event handlers like onClick receive an event object as their first argument. These SyntheticEvent objects are not valid Convex values. Try wrapping the function like `const handler = () => myMutation();` and using `handler` in the event handler.")}var _V=Object.defineProperty,jV=(e,t,n)=>t in e?_V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bh=(e,t,n)=>jV(e,typeof t!="symbol"?t+"":t,n),BV=class{constructor(e){bh(this,"createWatch"),bh(this,"queries"),bh(this,"listeners"),this.createWatch=e,this.queries={},this.listeners=new Set}setQueries(e){for(const t of Object.keys(e)){const{query:n,args:r,paginationOptions:i}=e[t];if(pt(n),this.queries[t]===void 0)this.addQuery(t,n,r,i?{paginationOptions:i}:{});else{const s=this.queries[t];(pt(n)!==pt(s.query)||JSON.stringify(In(r))!==JSON.stringify(In(s.args))||JSON.stringify(i)!==JSON.stringify(s.paginationOptions))&&(this.removeQuery(t),this.addQuery(t,n,r,i?{paginationOptions:i}:{}))}}for(const t of Object.keys(this.queries))e[t]===void 0&&this.removeQuery(t)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getLocalResults(e){const t={};for(const n of Object.keys(e)){const{query:r,args:i}=e[n],s=e[n].paginationOptions;pt(r);const o=this.createWatch(r,i,s?{paginationOptions:s}:{});let a;try{a=o.localQueryResult()}catch(l){if(l instanceof Error)a=l;else throw l}t[n]=a}return t}setCreateWatch(e){this.createWatch=e;for(const t of Object.keys(this.queries)){const{query:n,args:r,watch:i,paginationOptions:s}=this.queries[t],o="journal"in i?i.journal():void 0;this.removeQuery(t),this.addQuery(t,n,r,{...o?{journal:o}:[],...s?{paginationOptions:s}:{}})}}destroy(){for(const e of Object.keys(this.queries))this.removeQuery(e);this.listeners=new Set}addQuery(e,t,n,{paginationOptions:r,journal:i}){if(this.queries[e]!==void 0)throw new Error(`Tried to add a new query with identifier ${e} when it already exists.`);const s=this.createWatch(t,n,{...i?{journal:i}:[],...r?{paginationOptions:r}:{}}),o=s.onUpdate(()=>this.notifyListeners());this.queries[e]={query:t,args:n,watch:s,unsubscribe:o,...r?{paginationOptions:r}:{}}}removeQuery(e){const t=this.queries[e];if(t===void 0)throw new Error(`No query found with identifier ${e}.`);t.unsubscribe(),delete this.queries[e]}notifyListeners(){for(const e of this.listeners)e()}};function FV(e){const t=NV();if(t===void 0)throw new Error("Could not find Convex client! `useQuery` must be used in the React component tree under `ConvexProvider`. Did you forget it? See https://docs.convex.dev/quick-start#set-up-convex-in-your-react-app");return VV(e,(0,g.useMemo)(()=>(n,r,{journal:i,paginationOptions:s})=>s?t.watchPaginatedQuery(n,r,s):t.watchQuery(n,r,i?{journal:i}:{}),[t]))}function VV(e,t){const[n]=(0,g.useState)(()=>new BV(t));n.createWatch!==t&&n.setCreateWatch(t),(0,g.useEffect)(()=>()=>n.destroy(),[n]);const r=(0,g.useMemo)(()=>({getCurrentValue:()=>n.getLocalResults(e),subscribe:i=>(n.setQueries(e),n.subscribe(i))}),[n,e]);return RV(r)}var Sc=class extends g.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){this.isExpected(e)?console.debug("ErrorBoundary caught an expected error:",e):(console.error("ErrorBoundary caught an error:",e,t),oM(e,t,this.props.name)),this.props.onError?.(e,t)}isExpected(e){if(!this.props.isExpectedError)return!1;try{return this.props.isExpectedError(e)===!0}catch{return!1}}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback!==void 0?typeof this.props.fallback=="function"?this.props.fallback({error:this.state.error,reset:this.handleReset}):this.props.fallback:(0,p.jsx)("div",{className:"flex items-center justify-center min-h-[400px] p-6",children:(0,p.jsxs)("div",{className:"text-center max-w-md",children:[(0,p.jsx)(nu,{className:"h-12 w-12 text-destructive mx-auto mb-4"}),(0,p.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"Something went wrong"}),(0,p.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:this.state.error?.message||"An unexpected error occurred"}),(0,p.jsx)(Ot,{onClick:this.handleReset,variant:"outline",children:"Try again"})]})}):this.props.children}},zV=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();var $V=function(e,t,n){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})};var Ja,H0="__POSTHOG_REACT_SHARED_STATE__",W0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},Xo;try{Xo=W0[H0]=W0[H0]||new WeakMap}catch{Xo=new WeakMap}Xo.has(g.createContext)||Xo.set(g.createContext,{});var ci=Xo.get(g.createContext),sd;function HV(e){(!ci.defaultPostHogInstance||ci.defaultPostHogInstance===sd)&&(ci.defaultPostHogInstance=e),sd=e}function od(){return sd}ci.context||(ci.context=(0,g.createContext)({get client(){return od()||ci.defaultPostHogInstance},bootstrap:void 0}));var Ns=ci.context;function z1(e,t,n){if(n===void 0&&(n=new WeakMap),e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(n.has(e)&&n.get(e)===t)return!0;n.set(e,t);var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(var s=0,o=r;s<o.length;s++){var a=o[s];if(!i.includes(a)||!z1(e[a],t[a],n))return!1}return!0}function w8(e){var t,n,r=e.children,i=e.client,s=e.apiKey,o=e.options,a=(0,g.useRef)(null),l=(0,g.useMemo)(function(){if(i)return s&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),o&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),i;var c=od();return s||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),c},[i,s,JSON.stringify(o)]);return(0,g.useEffect)(function(){if(!(i||!s)){var c=od(),u=a.current;u?(s!==u.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),o&&!z1(o,u.options)&&c.set_config(o),a.current={apiKey:s,options:o??{}}):(c.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),c.init(s,o),a.current={apiKey:s,options:o??{}})}},[i,s,JSON.stringify(o)]),g.createElement(Ns.Provider,{value:{client:l,bootstrap:(t=o?.bootstrap)!==null&&t!==void 0?t:(n=i?.config)===null||n===void 0?void 0:n.bootstrap}},r)}var wh=function(e){return typeof e=="function"},ad=function(e){return e===void 0};function $1(e,t){var n,r,i=(0,g.useContext)(Ns),s=i.client,o=i.bootstrap,a=(0,g.useState)(function(){return s.isFeatureEnabled(e)}),l=a[0],c=a[1];(0,g.useEffect)(function(){return s.onFeatureFlags(function(){c(s.isFeatureEnabled(e))})},[s,e]);var u=(n=o?.featureFlags)===null||n===void 0?void 0:n[e];return!(!((r=s?.featureFlags)===null||r===void 0)&&r.hasLoadedFlags)&&o?.featureFlags?ad(u)?t:!!u:ad(l)?t:l}function S8(){var e,t=(0,g.useContext)(Ns),n=t.client,r=t.bootstrap,i=(0,g.useState)(function(){return n.featureFlags.getFlags()}),s=i[0],o=i[1];return(0,g.useEffect)(function(){return n.onFeatureFlags(function(a){o(a)})},[n]),!(!((e=n?.featureFlags)===null||e===void 0)&&e.hasLoadedFlags)&&r?.featureFlags?Object.entries(r.featureFlags).filter(function(a){return a[1]}).map(function(a){return a[0]}):s}function k8(e){var t,n=(0,g.useContext)(Ns),r=n.client,i=n.bootstrap,s=(0,g.useState)(function(){return r.getFeatureFlag(e)}),o=s[0],a=s[1];return(0,g.useEffect)(function(){return r.onFeatureFlags(function(){a(r.getFeatureFlag(e))})},[r,e]),!(!((t=r?.featureFlags)===null||t===void 0)&&t.hasLoadedFlags)&&i?.featureFlags?i.featureFlags[e]:o}var C8=function(){return(0,g.useContext)(Ns).client},jl=function(e){var t=Object.prototype.toString.call(e);return e instanceof Error||t==="[object Error]"||t==="[object Exception]"||t==="[object DOMException]"||t==="[object DOMError]"},WV=function(e,t){try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch{}},UV=function(e,t){for(var n=new WeakSet,r=e;!n.has(r);){if(n.add(r),!jl(r.cause)){ad(r.cause)||(t.cause=r.cause),r.cause=t;return}r=r.cause}},qV=function(e,t){if(!t)return e;var n=new Error(jl(e)?e.message:"Primitive value captured as exception: ".concat(String(e)));return WV(n,"React ErrorBoundary ".concat(jl(e)?e.name:"Error")),n.stack=t,jl(e)?(UV(e,n),e):n},U0={componentStack:null,exceptionEvent:null,error:null},KV={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."},A8=(Ja=(function(e){zV(t,e);function t(n){var r=e.call(this,n)||this;return r._resetError=function(){r.setState(U0)},r.state=U0,r}return t.prototype.componentDidCatch=function(n,r){var i=this.props.additionalProperties,s;wh(i)?s=i(n,r):typeof i=="object"&&(s=i);var o=this.context.client,a=r.componentStack,l=o.captureException(qV(n,a),s);this.setState({error:n,componentStack:a??null,exceptionEvent:l})},t.prototype.render=function(){var n=this.props,r=n.children,i=n.fallback,s=this.state;if(s.componentStack==null)return wh(r)?r():r;var o=wh(i)?g.createElement(i,{error:s.error,componentStack:s.componentStack,exceptionEvent:s.exceptionEvent,resetError:this._resetError}):i;return g.isValidElement(o)?o:(console.warn(KV.INVALID_FALLBACK),g.createElement(g.Fragment,null))},t})(g.Component),$V(Ja,"PostHogErrorBoundary"),(function(){Ja.contextType=Ns})(),Ja);HV(Zx);function Vm({...e}){return(0,p.jsx)(UO,{"data-slot":"dropdown-menu",...e})}function zm({...e}){return(0,p.jsx)(qO,{"data-slot":"dropdown-menu-trigger",...e})}function $m({className:e,sideOffset:t=4,...n}){return(0,p.jsx)(KO,{children:(0,p.jsx)(GO,{"data-slot":"dropdown-menu-content",sideOffset:t,className:G("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function Bl({className:e,inset:t,variant:n="default",...r}){return(0,p.jsx)(YO,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:G("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function T8({className:e,children:t,checked:n,...r}){return(0,p.jsxs)(XO,{"data-slot":"dropdown-menu-checkbox-item",className:G("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:n,...r,children:[(0,p.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,p.jsx)(Pw,{children:(0,p.jsx)(hs,{className:"size-4"})})}),t]})}function GV({...e}){return(0,p.jsx)(JO,{"data-slot":"dropdown-menu-radio-group",...e})}function QV({className:e,children:t,hideIndicator:n=!1,...r}){return(0,p.jsxs)(ZO,{"data-slot":"dropdown-menu-radio-item",className:G("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",n?"pl-2":"pl-8",e),...r,children:[n?null:(0,p.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,p.jsx)(Pw,{children:(0,p.jsx)(lM,{className:"size-2 fill-current"})})}),t]})}function YV({className:e,inset:t,...n}){return(0,p.jsx)(QO,{"data-slot":"dropdown-menu-label","data-inset":t,className:G("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function E8({className:e,...t}){return(0,p.jsx)(eD,{"data-slot":"dropdown-menu-separator",className:G("bg-border -mx-1 my-1 h-px",e),...t})}function M8({...e}){return(0,p.jsx)(tD,{"data-slot":"dropdown-menu-sub",...e})}function R8({className:e,inset:t,children:n,...r}){return(0,p.jsxs)(nD,{"data-slot":"dropdown-menu-sub-trigger","data-inset":t,className:G("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",e),...r,children:[n,(0,p.jsx)(fs,{className:"ml-auto size-4"})]})}function P8({className:e,...t}){return(0,p.jsx)(rD,{"data-slot":"dropdown-menu-sub-content",className:G("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",e),...t})}var XV=8192,JV=8192,Sh=64,ZV=new Set(["_truncated","bytes","limitBytes","reason","head"]);function Cr(e,t){let n=0,r=0;for(let i=0;i<e.length&&!(n>t);i++){const s=e.charCodeAt(i);if(s<128){n+=1,s===34||s===92?r+=1:s<32&&(r+=s===8||s===9||s===10||s===12||s===13?1:5);continue}if(s<2048){n+=2;continue}if(s>=55296&&s<=56319){const o=e.charCodeAt(i+1);if(o>=56320&&o<=57343){n+=4,i++;continue}}if(s>=55296&&s<=57343){n+=3,r+=3;continue}n+=3}return{utf8:n,json:n+r+2}}function ez(e){const t=e.charCodeAt(8191);return e.slice(0,t>=55296&&t<=56319?8191:JV)}var tz=8,H1=5e4;function W1(e,t){let n=0,r=0;const i=[e];for(;i.length>0;){if(n>t)return{bytes:n,exceeded:!0};if(++r>H1)return{bytes:n,exceeded:!0};const s=i.pop();if(typeof s=="string"){n+=Cr(s,t-n).json;continue}if(s===null||typeof s!="object"){n+=5;continue}if(Array.isArray(s)){n+=2+s.length;for(const o of s){if(n>t)return{bytes:n,exceeded:!0};i.push(o)}continue}n+=2;for(const o in s)if(Object.hasOwn(s,o)){if(n+=Cr(o,t-n).json+2,n>t)return{bytes:n,exceeded:!0};i.push(s[o])}}return{bytes:n,exceeded:n>t}}function nz(e,t){const n={_truncated:!0,limitBytes:t};if(typeof e!="object"||e===null||Array.isArray(e))return n;let r=0,i=0;const s=new Set,o=h=>h===void 0?{_truncated:!0}:{_truncated:!0,bytes:h},a=(h,f)=>{if(++i>H1)return o();if(typeof h=="string"){const m=Cr(h,t-r);if(h.length<=XV&&r+m.json<=t)return r+=m.json,h;const v=Cr(h,Number.POSITIVE_INFINITY).utf8,y=ez(h);if(y.length<h.length){const x=Cr(y,Number.POSITIVE_INFINITY).json;if(r+x+Sh<=t)return r+=x+Sh,{_truncated:!0,bytes:v,head:y}}return r+=Sh,o(v)}if(h===null||typeof h!="object")return r+=5,h;if(f>=tz||s.has(h))return o();if(s.add(h),Array.isArray(h)){r+=2;const m=[];for(const v of h){if(r+=1,r>t)return s.delete(h),o();m.push(a(v,f+1))}return s.delete(h),m}r+=2;const d={};for(const m in h)if(Object.hasOwn(h,m)){if(r+=Cr(m,t-r).json+2,r>t)return s.delete(h),o();d[m]=a(h[m],f+1)}return s.delete(h),d},l=a(e,0),c={};if(!rz(l)&&typeof l=="object"&&l!==null)for(const[h,f]of Object.entries(l))ZV.has(h)||(c[h]=f);const u={...c,...n};return W1(u,t).exceeded?n:u}function rz(e){return typeof e=="object"&&e!==null&&e._truncated===!0}function kh(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function I8(e){if(e.reason)return`Payload not recorded: ${e.reason}.`;const t=typeof e.limitBytes=="number"?`over the ${kh(e.limitBytes)} log limit`:"over the log size limit",n=typeof e.bytes=="number"?` It was ${kh(e.bytes)}.`:"";return typeof e.head=="string"?`Payload truncated — ${t}.${n} Showing the first ${kh(Cr(e.head,Number.POSITIVE_INFINITY).utf8)}.`:`Payload not recorded — ${t}.${n}`}function U1(e){try{return new URL(e).pathname}catch{return e}}function iz(e){return typeof e=="string"&&e.startsWith("Automatic resolved to ")}var ld=1e3,Ch=1048576,q1=8388608,K1=new WeakMap;function sz(e){const t=e.length>ld?e.slice(0,ld):e;let n=0;for(let r=0;r<t.length;r++)if(n+=K1.get(t[r])??0,n>q1&&r>0)return t.slice(0,r);return t}var ys=rM(e=>({items:[],mcpServerItems:[],addLog:t=>{const n={...t,id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,timestamp:new Date().toISOString()};e(r=>({items:[n,...r.items].slice(0,ld)}))},addMcpServerLog:t=>{const n={...t,id:t.id??`${t.timestamp}-${Math.random().toString(36).slice(2)}`};K1.set(n,W1(n.payload,q1).bytes),e(r=>({mcpServerItems:sz(r.mcpServerItems.some(i=>i.id===n.id)?r.mcpServerItems.map(i=>i.id===n.id?n:i):[n,...r.mcpServerItems])}))},clear:()=>e({items:[],mcpServerItems:[]})}));function G1(e){return typeof e.eventId=="string"&&e.eventId.length>0?e.eventId:void 0}function O8(e){if(!Array.isArray(e)||e.length===0)return;const t=ys.getState();e.forEach(n=>{const r=G1(n);t.addMcpServerLog({...r?{id:r}:{},serverId:n.serverId,serverName:n.serverName,direction:n.direction.toUpperCase(),method:eb(n.message),timestamp:n.timestamp,payload:n.message})})}function D8(e){if(!Array.isArray(e)||e.length===0)return;const t=ys.getState();e.forEach(n=>{const r=G1(n);t.addMcpServerLog({...r?{id:r}:{},serverId:n.serverId,serverName:n.serverName,direction:"HTTP",method:`${n.exchange.request.method} ${U1(n.exchange.request.url)}`,timestamp:n.timestamp,payload:n.exchange,kind:"http"})})}function N8(e){const{serverId:t,serverName:n,trace:r}=e;if(!r||!Array.isArray(r.steps)||r.steps.length===0)return;const i=ys.getState();r.steps.forEach(s=>{const o=new Date(s.completedAt??s.startedAt).toISOString();iz(s.message)&&i.addMcpServerLog({id:`oauth:${t}:${r.source}:automatic_resolution:${s.startedAt}`,serverId:t,serverName:n,direction:"OAUTH",method:"Automatic Resolution",timestamp:o,payload:{source:r.source,step:"automatic_resolution",title:"Automatic Resolution",status:s.status,message:s.message,details:s.details,relatedStep:s.step},kind:"oauth",oauthStatus:s.status,oauthSource:r.source,oauthRecovered:s.recovered===!0}),i.addMcpServerLog({id:`oauth:${t}:${r.source}:${s.step}:${s.startedAt}`,serverId:t,serverName:n,direction:"OAUTH",method:s.title,timestamp:o,payload:{source:r.source,step:s.step,title:s.title,status:s.status,message:s.message,error:s.error,details:s.details,recovered:s.recovered,recoveredAt:s.recoveredAt,recoveryMessage:s.recoveryMessage,httpHistory:r.httpHistory.filter(a=>a.step===s.step)},kind:"oauth",oauthStatus:s.status,oauthSource:r.source,oauthRecovered:s.recovered===!0})})}var Fn=null,Us=0;function L8(){if(Us++,!Fn){const e=new URLSearchParams;e.set("replay","3"),e.set("_t",Date.now().toString()),Fn=new EventSource(IF(`/api/mcp/servers/rpc/stream?${e.toString()}`)),Fn.onmessage=t=>{try{const n=JSON.parse(t.data);if(!n)return;const r=typeof n.eventId=="string"&&n.eventId.length>0?n.eventId:void 0;if(n.type==="http"){if(!n.exchange)return;const l=n.exchange;ys.getState().addMcpServerLog({...r?{id:r}:{},serverId:typeof n.serverId=="string"?n.serverId:"unknown",direction:"HTTP",method:`${l.request.method} ${U1(l.request.url)}`,timestamp:n.timestamp??new Date().toISOString(),payload:l,kind:"http"});return}if(n.type!=="rpc")return;const{serverId:i,direction:s,message:o,timestamp:a}=n;ys.getState().addMcpServerLog({...r?{id:r}:{},serverId:typeof i=="string"?i:"unknown",direction:typeof s=="string"?s.toUpperCase():"",method:eb(o),timestamp:a??new Date().toISOString(),payload:Cr(t.data,Ch).utf8>Ch?nz(o,Ch):o})}catch{}},Fn.onerror=()=>{Fn?.close(),Fn=null,Us=0}}return()=>{Us--,Us<=0&&Fn&&(Fn.close(),Fn=null,Us=0)}}var oz=uM("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-destructive-foreground [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",inverse:"border-transparent bg-popover text-popover-foreground"}},defaultVariants:{variant:"default"}});function kc({className:e,variant:t,asChild:n=!1,...r}){const i=n?pM:"span";return(0,p.jsx)(i,{"data-slot":"badge",className:G(oz({variant:t}),e),...r})}function az({delayDuration:e=0,...t}){return(0,p.jsx)(zD,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function mr({...e}){return(0,p.jsx)(az,{children:(0,p.jsx)($D,{"data-slot":"tooltip",...e})})}function gr({...e}){return(0,p.jsx)(HD,{"data-slot":"tooltip-trigger",...e})}var Q1="rounded-md px-3 py-1.5 text-xs",Y1="bg-primary text-primary-foreground",X1="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]",_8=`${Q1} ${Y1}`,lz=`${X1} bg-primary fill-primary`;function vr({className:e,sideOffset:t=0,children:n,variant:r="default",...i}){const s=r==="muted";return(0,p.jsx)(WD,{children:(0,p.jsxs)(UD,{"data-slot":"tooltip-content",sideOffset:t,className:G("animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin)",Q1,s?"border border-border bg-popover text-popover-foreground shadow-md":Y1,e),...i,children:[n,(0,p.jsx)(qD,{className:s?G(X1,"fill-popover"):lz})]})})}function j8({reason:e,fallback:t,children:n,...r}){const i=e||t;return i?(0,p.jsxs)(mr,{children:[(0,p.jsx)(gr,{asChild:!0,children:e?(0,p.jsx)("span",{className:"inline-flex rounded-md outline-none focus-visible:ring-ring/50 focus-visible:ring-[3px]",tabIndex:0,children:n}):n}),(0,p.jsx)(vr,{...r,children:i})]}):n}function cz(e){try{ys.getState().addMcpServerLog({...e.dedupeKey?{id:`plugin-extensions:${e.dedupeKey}`}:{},serverId:e.serverId??"plugin-extensions",serverName:e.serverName??"Plugin extensions",direction:"RECEIVE",method:`plugin-extensions/${e.code}`,timestamp:new Date().toISOString(),payload:{level:e.level??"error",code:e.code,message:e.message,...e.detail??{}}})}catch{}}function q0(e){cz({code:`workspace/${e.label}`,message:e.message,level:e.level,serverId:e.serverId,...e.serverName?{serverName:e.serverName}:{},...e.detail?{detail:e.detail}:{}})}var K0={APPROVAL_DENIED:"Tool approval was denied.",INSTANCE_UNAVAILABLE:"The App's instance is no longer available. Close it and open it again.",INSTANCE_DENIED:"This App belongs to a different chat or client.",INSTANCE_BINDING_CHANGED:"The server changed this App's tool while it was open. Close it and open it again.",ACTIVATION_BINDING_CHANGED:"The server changed this App's tool while it was open. Close it and open it again.",INSTANCE_DEEP_LINK_UNAVAILABLE:"No global App with that tool accepts this link.",INSTANCE_RESPONSE_INVALID:"The host returned a response the App can't use.",INSTANCE_RESPONSE_TOO_LARGE:"The App's response was too large.",INSTANCE_UI_UNAVAILABLE:"The App's UI resource couldn't be read, isn't text/html;profile=mcp-app, or is over 5 MB.",INSTANCE_UNSUPPORTED_CONTINUATION:"The tool asked for input in a way this client can't answer.",INSTANCE_LIMIT:"Too many Apps are open. Close one and try again.",ACTIVATION_SCHEMA_INVALID:"The entrypoint's input schema doesn't accept the arguments this entrypoint sends."};function B8(e){const t=e&&typeof e=="object"&&"description"in e?e.description:void 0,n=e&&typeof e=="object"&&"candidates"in e?e.candidates:void 0,r=Array.isArray(n)&&n.length?n.filter(s=>typeof s=="string"):[];if(typeof t=="string"&&t.trim())return r.length&&!r.every(s=>t.includes(s))?`${t} (${r.join(", ")})`:t;const i=e&&typeof e=="object"&&"code"in e?String(e.code):void 0;return i&&K0[i]?K0[i]:e instanceof Error&&e.message&&!/^[A-Z_]+$/.test(e.message)?e.message:i?`The App couldn't open (${i}).`:"The App couldn't open."}var gu=(0,g.createContext)(null),F8=()=>(0,g.useContext)(gu),Hm=(0,g.createContext)(null),uz=512;function V8({value:e,children:t}){const n=(0,g.useMemo)(()=>tb(()=>({links:{}})),[e?.api]);return(0,p.jsx)(gu.Provider,{value:e,children:(0,p.jsx)(Hm.Provider,{value:n,children:t})})}function hz(e,t){const n=(0,g.useContext)(Hm),r=JSON.stringify([e,t.map(i=>[i.uri,i.name])]);(0,g.useEffect)(()=>{!n||!e||!t.length||n.setState(i=>{const s={...i.links};for(const a of t)s[a.uri]={serverId:e,name:a.name};const o=Object.keys(s);for(const a of o.slice(0,Math.max(0,o.length-uz)))delete s[a];return{links:s}})},[n,r])}var fz={},dz=tb(()=>({links:fz}));function pz(){const e=(0,g.useContext)(Hm);return iM(e??dz,t=>t.links)}function Fl(e,t){return!!e&&e.enabled!==!1&&!!t&&e.serverIds.includes(t.serverId)&&!!t.resourceUri}function mz(e,t){const[n,r]=(0,g.useState)({state:"closed"}),[i,s]=(0,g.useState)(!1),o=(0,g.useRef)(null),a=JSON.stringify([t?.serverId,t?.resourceUri]),l=(0,g.useRef)({actions:e,reference:t});l.current={actions:e,reference:t};const c=()=>l.current.actions?.api===e?.api&&l.current.actions?.workspaceId===e?.workspaceId&&l.current.reference?.serverId===t?.serverId&&l.current.reference?.resourceUri===t?.resourceUri&&Fl(l.current.actions,l.current.reference);(0,g.useEffect)(()=>(r({state:"closed"}),s(!1),()=>o.current?.abort()),[a,e?.api]);const u=async f=>{if(!(!Fl(e,t)||!c())){r({state:"closed"}),s(!1);try{await e.open(t.serverId,f)}catch{s(!0)}}};return{menu:n,setMenu:r,failed:i,activate:async()=>{if(!Fl(e,t)||!c())return;o.current?.abort();const f=new AbortController;o.current=f,s(!1),r({state:"loading"});try{const d=await e.api.discoverFile(t.serverId,t.resourceUri,f.signal);if(f.signal.aborted||!c())return;if(d.length===1){await u(d[0]);return}d.length===0&&q0({serverId:t.serverId,label:"file-viewer",level:"info",message:"No file viewer of this server accepts this file's extension."}),r({state:"ready",entries:d})}catch{if(f.signal.aborted||!c())return;r({state:"error"}),q0({serverId:t.serverId,label:"file-viewer",level:"error",message:"Couldn't list the file viewers for this file."})}},open:u}}var gz={onPointerDown:e=>e.preventDefault(),onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&e.preventDefault()}};function vz({menu:e,onOpen:t}){return(0,p.jsxs)($m,{align:"start",children:[(0,p.jsx)(YV,{className:"text-xs text-muted-foreground",children:"Open with…"}),e.state==="error"&&(0,p.jsx)(Bl,{disabled:!0,children:"Couldn't load viewers"}),e.state==="ready"&&e.entries.length===0&&(0,p.jsx)(Bl,{disabled:!0,children:"No viewer can open this file"}),e.state==="ready"&&e.entries.map(n=>(0,p.jsx)(Bl,{onSelect:()=>t(n),children:n.title},n.toolName))]})}function J1({reference:e,label:t,className:n}){const r=(0,g.useContext)(gu),i=mz(r,e);return Fl(r,e)?(0,p.jsxs)(Vm,{open:i.menu.state==="ready"||i.menu.state==="error",onOpenChange:s=>{s||i.setMenu({state:"closed"})},children:[(0,p.jsx)(zm,{asChild:!0,...gz,children:(0,p.jsxs)("button",{type:"button",onClick:s=>{s.stopPropagation(),i.activate()},className:G("inline-flex max-w-full items-center gap-1 text-left text-primary underline-offset-2 hover:underline",n),children:[(0,p.jsx)("span",{className:"truncate",children:t}),i.menu.state==="loading"?(0,p.jsx)(hM,{className:"size-3 shrink-0 animate-spin","aria-hidden":!0}):null]})}),(0,p.jsx)(vz,{menu:i.menu,onOpen:s=>{i.open(s)}}),i.failed&&(0,p.jsx)("span",{role:"alert",className:"ms-1 text-xs text-destructive",children:"Could not open viewer"})]}):(0,p.jsx)("span",{className:n,children:t})}function z8({result:e,serverId:t}){const n=(0,g.useContext)(gu);if(!n||!t||!n.serverIds.includes(t)||!e||typeof e!="object")return null;const r=e,i=r.content??r.value?.content;if(!Array.isArray(i))return null;const s=i.slice(0,64).filter(o=>!!o&&typeof o=="object"&&o.type==="resource_link"&&typeof o.uri=="string"&&o.uri.length<=4096&&typeof o.name=="string"&&o.name.length<=4096);return s.length?(0,p.jsx)(yz,{serverId:t,links:s}):null}function yz({serverId:e,links:t}){return hz(e,t),(0,p.jsx)("div",{className:"flex flex-wrap gap-2 px-3 pb-2",children:t.map((n,r)=>(0,p.jsx)("div",{className:"inline-flex max-w-64 items-center gap-2 rounded-md border border-border px-2 py-1 text-xs",title:n.name,children:(0,p.jsx)(J1,{reference:{serverId:e,resourceUri:n.uri},label:n.name})},`${n.uri}:${r}`))})}var Z1=(0,g.createContext)(new Map);function $8(e){const t=(0,g.useContext)(Z1);return e?t.get(e):void 0}function xz({name:e}){return e?(0,p.jsxs)("span",{className:"inline-flex max-w-40 shrink-0 items-center gap-1 rounded-full bg-foreground/5 px-1.5 py-0.5 text-[10px] text-muted-foreground/80",title:`Ran with the ${e} account`,"data-testid":"tool-call-account",children:[(0,p.jsx)(hN,{className:"size-2.5 shrink-0","aria-hidden":!0}),(0,p.jsx)("span",{className:"min-w-0 truncate",children:e})]}):null}var bz=50,Ah="null";function Oi(){return{line:1,column:1}}function wz(e){if(e===void 0)return Ah;try{return JSON.stringify(e,null,2)??Ah}catch{return Ah}}function Di(e){try{return{value:JSON.parse(e),error:null}}catch(t){return{value:void 0,error:t instanceof Error?t.message:"Invalid JSON"}}}function Ni(e){try{return JSON.stringify(e)}catch{return null}}function ui(e){if(typeof e=="string"){try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null)return ui(t)}catch{}return e}if(Array.isArray(e))return e.map(ui);if(typeof e=="object"&&e!==null){const t={};for(const[n,r]of Object.entries(e))t[n]=ui(r);return t}return e}function To(e,t){if(typeof t=="string"&&typeof e!="string")try{const n=JSON.parse(t);if(typeof n=="object"&&n!==null)return JSON.stringify(e)}catch{}if(typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof t=="object"&&t!==null&&!Array.isArray(t)){const n={},r=t;for(const[i,s]of Object.entries(e))n[i]=i in r?To(s,r[i]):s;return n}return Array.isArray(e)&&Array.isArray(t)?e.map((n,r)=>r<t.length?To(n,t[r]):n):e}function Za(e,t,n){return e!==void 0?e:wz(n?ui(t):t)}function Sz({initialValue:e,initialContent:t,onChange:n,onRawChange:r,onValidationError:i,expandJsonStrings:s=!1}){const o=(0,g.useRef)(null);if(o.current===null){const I=Za(t,e,s),_=Di(I);let j;_.error!==null?j=null:s?j=Ni(To(_.value,e)):j=Ni(_.value),o.current={content:I,lastEmitted:j,error:_.error}}const[a,l]=(0,g.useState)(o.current.content),c=(0,g.useRef)(e),u=(0,g.useRef)(o.current.content),h=(0,g.useRef)(o.current.content),f=(0,g.useRef)(o.current.lastEmitted),[d,m]=(0,g.useState)(o.current.error),[v,y]=(0,g.useState)(Oi),x=(0,g.useRef)([{content:o.current.content,cursorPosition:Oi()}]),b=(0,g.useRef)(0),w=(0,g.useCallback)(I=>{const _=Di(I);return m(_.error),i?.(_.error),_},[i]);(0,g.useEffect)(()=>{u.current=a},[a]);const S=(0,g.useRef)({value:e,content:t});if(e!==S.current.value||t!==S.current.content)if(S.current={value:e,content:t},t===void 0&&s){const I=Ni(e);I!==null&&I===f.current?(c.current=e,h.current=u.current):(c.current=e,h.current=Za(void 0,e,!0))}else c.current=e,h.current=Za(t,e,s);(0,g.useEffect)(()=>{const I=h.current;if(I===u.current)return;u.current=I,l(I),y(Oi()),x.current=[{content:I,cursorPosition:Oi()}],b.current=0,w(I);const _=Di(I);if(_.error===null&&s){const j=To(_.value,e);f.current=Ni(j)}else f.current=_.error===null?Ni(_.value):null},[e,t,w,s]);const C=(0,g.useCallback)((I,_,j)=>{r?.(I);const $=B=>{const D=s?To(B,c.current):B,se=Ni(D);if(se===null){n?.(D);return}se!==f.current&&(f.current=se,n?.(D))};if(j===void 0){const B=Di(I);B.error===null&&$(B.value);return}j===null&&$(_)},[n,r,s]),A=(0,g.useCallback)(I=>{if(I===u.current)return;u.current=I,l(I);const{value:_,error:j}=w(I),$=b.current;let B=x.current;$<B.length-1&&(B=B.slice(0,$+1));const D=B[B.length-1];(!D||D.content!==I)&&(B=[...B,{content:I,cursorPosition:v}]),B.length>bz&&(B=B.slice(-50)),x.current=B,b.current=B.length-1,C(I,_,j)},[v,C,w]),k=(0,g.useCallback)(I=>{u.current=I.content,l(I.content),y(I.cursorPosition);const{value:_,error:j}=w(I.content);C(I.content,_,j)},[C,w]),E=(0,g.useCallback)(()=>{const I=x.current,_=b.current;if(_>0){b.current=_-1;const j=I[_-1];k(j)}},[k]),T=(0,g.useCallback)(()=>{const I=x.current,_=b.current;if(_<I.length-1){b.current=_+1;const j=I[_+1];k(j)}},[k]),R=(0,g.useCallback)(()=>{const{value:I,error:_}=Di(a);if(_===null){const j=s?ui(I):I,$=JSON.stringify(j,null,2);A($)}},[a,A,s]),P=(0,g.useCallback)(()=>{c.current=e;const I=Za(t,e,s);h.current=I,u.current=I,l(I),y(Oi()),x.current=[{content:I,cursorPosition:Oi()}],b.current=0;const{value:_,error:j}=w(I);C(I,_,j)},[e,t,w,C,s]),M=(0,g.useCallback)(()=>{const{value:I,error:_}=Di(a);return _===null?I:void 0},[a]),N=b.current>0,L=b.current<x.current.length-1;return{content:a,setContent:A,isValid:d===null,validationError:d,cursorPosition:v,setCursorPosition:y,undo:E,redo:T,canUndo:N,canRedo:L,format:R,reset:P,getParsedValue:M,sourceContent:h.current}}function kz(e){return typeof e=="object"?e.key:e}function Cz(e,t){const n=e.length;return new Proxy(e,{get(r,i,s){if(typeof i=="string"){const o=i.charCodeAt(0);if(o>=48&&o<=57){const a=+i;if(Number.isInteger(a)&&a>=0&&a<n){let l=r[a];if(typeof l!="object"){const c=t[a*2];l=r[a]={index:a,key:l,start:c,size:t[a*2+1],end:c+t[a*2+1],lane:0}}return l}}if(i==="length")return n}return Reflect.get(r,i,s)}})}function Li(e,t,n){let r=n.initialDeps??[],i,s=!0;function o(){const a=e();return(a.length!==r.length||a.some((l,c)=>r[c]!==l))&&(r=a,i=t(...a),n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(i),s=!1),i}return o.updateDeps=a=>{r=a},o}function G0(e,t){if(e===void 0)throw new Error(`Unexpected undefined${t?`: ${t}`:""}`);return e}var Q0=(e,t)=>Math.abs(e-t)<1.01,Az=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})},qs,Th=()=>{if(qs!==void 0)return qs;if(typeof navigator>"u")return qs=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return qs=!0;const e=navigator.maxTouchPoints;return qs=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Y0=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Tz=e=>e,Ez=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=new Array(n);for(let i=0;i<n;i++)r[i]=t+i;return r},Mz=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=o=>{const{width:a,height:l}=o;t({width:Math.round(a),height:Math.round(l)})};if(i(Y0(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(o=>{const a=()=>{const l=o[0];if(l?.borderBoxSize){const c=l.borderBoxSize[0];if(c){i({width:c.inlineSize,height:c.blockSize});return}}i(Y0(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},Cc={passive:!0},Rz=typeof window>"u"?!0:"onscrollend"in window,Pz=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const i=e.targetWindow;if(!i)return;const s=e.options.useScrollendEvent&&Rz;let o=0;const a=s?null:Az(i,()=>t(n(r),!1),e.options.isScrollingResetDelay),l=h=>()=>{o=n(r),a?.(),t(o,h)},c=l(!0),u=l(!1);return r.addEventListener("scroll",c,Cc),s&&r.addEventListener("scrollend",u,Cc),()=>{r.removeEventListener("scroll",c),s&&r.removeEventListener("scrollend",u),a?.cancel()}},Iz=(e,t)=>Pz(e,t,n=>{const{horizontal:r,isRtl:i}=e.options;return r?n.scrollLeft*(i&&-1||1):n.scrollTop}),Oz=(e,t,n)=>{if(n.options.useCachedMeasurements){const r=n.indexFromElement(e),i=n.options.getItemKey(r);return n.itemSizeCache.get(i)??n.options.estimateSize(r)}if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}if(!t){const r=n.indexFromElement(e),i=n.options.getItemKey(r),s=n.itemSizeCache.get(i);if(s!==void 0)return s}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},Dz=(e,{adjustments:t=0,behavior:n},r)=>{var i,s;(s=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||s.call(i,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},Nz=Dz;function Lz(e,t,n,r){if(t===0)return!1;const i=r(0),s=new Set;let o=0;for(;o<e;){const l=n(o);if(l===i)break;s.add(l),o++}const a=e-o;if(a===0||a>=t)return!1;for(let l=0;l<a;l++)if(r(l)!==n(o+l))return!1;for(let l=a;l<t;l++)if(s.has(r(l)))return!1;return!0}var _z=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this._clampedAdjustment=null,this.elementsCache=new Map,this.now=()=>{var t,n,r;return((r=(n=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:n.now)==null?void 0:r.call(n))??Date.now()},this.observer=(()=>{let t=null;const n=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(r=>{r.forEach(i=>{const s=()=>{const o=i.target,a=this.indexFromElement(o);if(!o.isConnected){this.observer.unobserve(o);for(const[l,c]of this.elementsCache)if(c===o){this.elementsCache.delete(l);break}return}this.isIndexInRange(a)&&this.shouldMeasureDuringScroll(a)&&this.resizeItem(a,this.options.measureElement(o,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()})}));return{disconnect:()=>{var r;(r=n())==null||r.disconnect(),t=null},observe:r=>{var i;return(i=n())==null?void 0:i.observe(r,{box:"border-box"})},unobserve:r=>{var i;return(i=n())==null?void 0:i.unobserve(r)}}})(),this.range=null,this.setOptions=t=>{var n;const r={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Tz,rangeExtractor:Ez,onChange:()=>{},measureElement:Oz,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const u in t){const h=t[u];h!==void 0&&(r[u]=h)}const i=this.options;let s=null,o=null,a=!1;if(i!==void 0&&i.enabled&&r.enabled&&r.anchorTo==="end"&&this.scrollElement!==null){const u=i.count,h=r.count,f=this.getMeasurements(),d=((n=this._singleLaneMeasurements)==null?void 0:n.items)??f,m=x=>kz(d[x]),v=u>0?m(0):null,y=u>0?m(u-1):null;if(h!==u||u>0&&h>0&&(r.getItemKey(0)!==v||r.getItemKey(h-1)!==y)){a=!0;const x=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??f[0]:null;x&&(s=[x.key,this.getScrollOffset()-x.start]);const b=r.followOnAppend===!0?"auto":r.followOnAppend||null;b&&h>0&&this.isAtEnd(i.scrollEndThreshold)&&(u===0||r.getItemKey(h-1)!==y)&&(h>u||Lz(u,h,m,r.getItemKey))&&(o=b)}}this.options=r,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let l=!1,c=0;if(s&&this.scrollOffset!==null){const[u,h]=s,f=this.getMeasurements(),{count:d,getItemKey:m}=this.options;let v=0;for(;v<d&&m(v)!==u;)v++;if(v<d){const y=f[v];if(y){const x=Math.max(0,y.start+h);!o&&x!==this.scrollOffset&&(c=x-this.scrollOffset,this.scrollOffset=x,l=!0)}}}(l||o)&&(this.pendingScrollAnchor=[l?s[0]:null,l?s[1]:0,o,c])},this.notify=t=>{var n,r;(r=(n=this.options).onChange)==null||r.call(n,this,t)},this.maybeNotify=Li(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(t=>t()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._clampedAdjustment=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t,n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,o)=>{if(o&&this._intendedScrollOffset===null&&s===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(s-this._intendedScrollOffset)<1.5&&(s=this._intendedScrollOffset),this._intendedScrollOffset=null,this._clampedAdjustment!==null&&Math.abs(s-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null),this.scrollAdjustments=0;const a=this.getScrollOffset();this.scrollDirection=o?a===s?this.scrollDirection:a<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=o,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const s=this.scrollElement,o=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!Th()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",o,Cc),s.addEventListener("touchend",a,Cc),this.unsubs.push(()=>{s.removeEventListener("touchstart",o),s.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const i=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,i&&this.scrollElement&&this.options.enabled){const[s,o,a,l]=i;s!==null&&!a&&(Th()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):((n=this.scrollState)==null?void 0:n.behavior)==="smooth"&&!Q0(this.getScrollOffset()-l,this.scrollState.lastTargetOffset)||this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),a&&this.scrollToEnd({behavior:a})}this._retryClampedAdjustment()},this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled)return;const{target:t,maxAtWrite:n}=this._clampedAdjustment,r=this.getMaxScrollOffset();r>n+.5&&(this._clampedAdjustment=t>r+.5?{target:t,maxAtWrite:r}:null,this._scrollToOffset(t,{adjustments:void 0,behavior:void 0}))},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const t=this.getScrollOffset(),n=this.getMaxScrollOffset();if(t<0||t>n)return;if(this._iosDeferredAdjustment<0&&t>=n-1){this._iosDeferredAdjustment=0;return}const r=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(t,{adjustments:this.scrollAdjustments+=r,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=Li(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(t,n,r,i,s,o,a,l)=>(this.prevLanes!==void 0&&this.prevLanes!==o&&(this.lanesChangedFlag=!0),this.prevLanes=o,this.pendingMin=null,{count:t,paddingStart:n,scrollMargin:r,getItemKey:i,enabled:s,lanes:o,laneAssignmentMode:a,gap:l}),{key:!1}),this.isIndexInRange=t=>t>=0&&t<this.options.count,this.getMeasurements=Li(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:n,scrollMargin:r,getItemKey:i,enabled:s,lanes:o,laneAssignmentMode:a,gap:l},c)=>{var u;const h=this.itemSizeCache;if(!s)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(const x of this.laneAssignments.keys())x>=t&&this.laneAssignments.delete(x);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(x=>{this.itemSizeCache.set(x.key,x.size)}));const f=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),o===1){const x=t*2;let b=(u=this._singleLaneMeasurements)==null?void 0:u.flat;if(!b||b.length<x){const A=new Float64Array(x);b&&f>0&&A.set(b.subarray(0,f*2)),b=A}const w=f===0?new Array(t):this._singleLaneMeasurements.items.slice();let S;if(f===0)S=n+r;else{const A=f-1;S=b[A*2]+b[A*2+1]+l}for(let A=f;A<t;A++){const k=i(A);w[A]=k;const E=h.get(k),T=typeof E=="number"?E:this.options.estimateSize(A);b[A*2]=S,b[A*2+1]=T,S+=T+l}this._singleLaneMeasurements={flat:b,items:w};const C=Cz(w,b);return this.measurementsCache=C,C}const d=this.measurementsCache.slice(0,f),m=new Array(o).fill(void 0),v=new Float64Array(o);let y=0;for(let x=0;x<f;x++){const b=d[x];b&&(m[b.lane]===void 0&&y++,m[b.lane]=x,v[b.lane]=b.end)}for(let x=f;x<t;x++){const b=i(x),w=this.laneAssignments.get(x);let S,C;const A=a==="estimate"||h.has(b);if(w!==void 0&&this.options.lanes>1){S=w;const R=m[S],P=R!==void 0?d[R]:void 0;C=P?P.end+l:n+r}else if(y===o){let R=0,P=v[0],M=m[0];for(let N=1;N<o;N++){const L=v[N];(L<P||L===P&&m[N]<M)&&(R=N,P=L,M=m[N])}S=R,C=P+l,A&&this.laneAssignments.set(x,S)}else S=x%this.options.lanes,C=n+r,A&&this.laneAssignments.set(x,S);const k=h.get(b),E=typeof k=="number"?k:this.options.estimateSize(x),T=C+E;d[x]={index:x,start:C,size:E,end:T,key:b,lane:S},m[S]===void 0&&y++,m[S]=x,v[S]=T}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Li(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,n,r,i)=>t.length===0||n===0?(this.range=null,null):(this.range=Bz(t,n,r,i,i===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Li(()=>{let t=null,n=null;const r=this.calculateRange();return r&&(t=r.startIndex,n=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,n]},(t,n,r,i,s)=>i===null||s===null?[]:t({startIndex:i,endIndex:s,overscan:n,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const n=this.options.indexAttribute,r=t.getAttribute(n);return r?parseInt(r,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const r=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(r!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),s=Math.max(0,r-i),o=Math.min(this.options.count-1,r+i);return t>=s&&t<=o}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((s,o)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(o))});return}const n=this.indexFromElement(t);if(!this.isIndexInRange(n))return;const r=this.options.getItemKey(n),i=this.elementsCache.get(r);i!==t&&(i&&this.observer.unobserve(i),this.observer.observe(t),this.elementsCache.set(r,t)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,n)=>{var r,i,s;if(!this.isIndexInRange(t))return;let o,a,l;const c=(r=this._singleLaneMeasurements)==null?void 0:r.flat;if(this.options.lanes===1&&c!=null)l=this.options.getItemKey(t),a=c[t*2],o=c[t*2+1];else{const f=this.measurementsCache[t];if(!f)return;l=f.key,a=f.start,o=f.size}const u=this.itemSizeCache.get(l)??o,h=n-u;if(h!==0){const f=this.options.anchorTo==="end"&&((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,d=f?this.getTotalSize():0,m=this.getScrollOffset()+this.scrollAdjustments,v=this.itemSizeCache.has(l)?a+u<=m&&this.scrollDirection!=="backward":a<m,y=((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:l,start:a,size:o,end:a+o,lane:0},h,this):v);(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(l,n),this.itemSizeCacheVersion++;let x=!1;f?x=this.applyScrollAdjustment(this.getTotalSize()-d):y&&(x=this.applyScrollAdjustment(h)),this.notify(x),this._retryClampedAdjustment()}},this.getVirtualItems=Li(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,n)=>{const r=[];for(let i=0,s=t.length;i<s;i++){const o=n[t[i]];r.push(o)}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{var n;const r=this.getMeasurements();if(r.length===0)return;const i=(n=this._singleLaneMeasurements)==null?void 0:n.flat,s=this.options.lanes===1&&i!=null,o=eC(0,r.length-1,s?a=>i[a*2]:a=>G0(r[a]).start,t);return G0(r[o])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const t=this.scrollElement.document.documentElement;return this.options.horizontal?t.scrollWidth-this.scrollElement.innerWidth:t.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,n,r=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),s=this.getScrollOffset();n==="auto"&&(n=t>=s+i?"end":"start"),n==="center"?t+=(r-i)/2:n==="end"&&(t-=i);const o=this.getMaxScrollOffset();return Math.max(Math.min(o,t),0)},this.getOffsetForIndex=(t,n="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const r=this.getSize(),i=this.getScrollOffset(),s=this.measurementsCache[t];if(!s)return;if(n==="auto")if(s.end>=i+r-this.options.scrollPaddingEnd)n="end";else if(s.start<=i+this.options.scrollPaddingStart)n="start";else return[i,n];if(n==="end"&&t===this.options.count-1)return[this.getMaxScrollOffset(),n];const o=n==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,n,s.size),n]},this.scrollToOffset=(t,{align:n="start",behavior:r="auto"}={})=>{this._iosDeferredAdjustment=0;const i=this.getOffsetForAlignment(t,n),s=this.now();this.scrollState={index:null,align:n,behavior:r,startedAt:s,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToIndex=(t,{align:n="auto",behavior:r="auto"}={})=>{this._iosDeferredAdjustment=0,t=Math.max(0,Math.min(t,this.options.count-1));const i=this.getOffsetForIndex(t,n);if(!i)return;const[s,o]=i,a=this.now();this.scrollState={index:t,align:o,behavior:r,startedAt:a,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollBy=(t,{behavior:n="auto"}={})=>{const r=this.getScrollOffset()+t,i=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:t});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.getTotalSize=()=>{var t,n;const r=this.getMeasurements();let i;if(r.length===0)i=this.options.paddingStart;else if(this.options.lanes===1){const s=r.length-1,o=(t=this._singleLaneMeasurements)==null?void 0:t.flat;o!=null?i=o[s*2]+o[s*2+1]:i=((n=r[s])==null?void 0:n.end)??0}else{const s=Array(this.options.lanes).fill(null);let o=r.length-1;for(;o>=0&&s.some(a=>a===null);){const a=r[o];s[a.lane]===null&&(s[a.lane]=a.end),o--}i=Math.max(...s.filter(a=>a!==null))}return Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const t=[];if(this.itemSizeCache.size===0)return t;const n=this.getMeasurements();for(const r of n)r&&this.itemSizeCache.has(r.key)&&t.push({index:r.index,key:r.key,start:r.start,size:r.size,end:r.end,lane:r.lane});return t},this._scrollToOffset=(t,{adjustments:n,behavior:r})=>{this._intendedScrollOffset=t+(n??0),this.options.scrollToFn(t,{behavior:r,adjustments:n},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){if(e===0)return!1;if(Th()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded))return this._iosDeferredAdjustment+=e,!1;{const n=this.getScrollOffset()+this.scrollAdjustments+e,r=this.scrollElement,i=r!==null&&("scrollHeight"in r||"document"in r)?this.getMaxScrollOffset():null;return this._clampedAdjustment=i!==null&&n>i+.5?{target:n,maxAtWrite:i}:null,this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0}}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const e=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,t=e?e[0]:this.scrollState.lastTargetOffset,n=1,r=t!==this.scrollState.lastTargetOffset;if(!r&&Q0(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=n){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,r){const i=this.getSize()||600,s=Math.abs(t-this.getScrollOffset()),o=this.scrollState.behavior==="smooth"&&s>i;this.scrollState.lastTargetOffset=t,o||(this.scrollState.behavior="auto"),this._scrollToOffset(t,{adjustments:void 0,behavior:o?"smooth":"auto"})}this.scheduleScrollReconcile()}},eC=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,s=n(i);if(s<r)e=i+1;else if(s>r)t=i-1;else return i}return e>0?e-1:0};function jz(e,t,n){let r=0;for(;r<=t;){const i=(r+t)/2|0,s=e[i*2];if(s<n)r=i+1;else if(s>n)t=i-1;else return i}return r>0?r-1:0}function Bz(e,t,n,r,i){const s=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:s};if(r===1&&i!==null){const c=jz(i,s,n);let u=c;const h=n+t;for(;u<s&&i[u*2]+i[u*2+1]<h;)u++;return{startIndex:c,endIndex:u}}let a=eC(0,s,c=>e[c].start,n),l=a;if(r===1)for(;l<s&&e[l].end<n+t;)l++;else if(r>1){const c=Array(r).fill(0);for(;l<s&&c.some(h=>h<n+t);){const h=e[l];c[h.lane]=h.end,l++}const u=Array(r).fill(n+t);for(;a>=0&&u.some(h=>h>=n);){const h=e[a];u[h.lane]=h.start,a--}a=Math.max(0,a-a%r),l=Math.min(s,l+(r-1-l%r))}return{startIndex:a,endIndex:l}}var Eh=typeof document<"u"?g.useLayoutEffect:g.useEffect;function Fz({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n="transform",...r}){const i=g.useReducer(h=>h+1,0)[1],s=g.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});s.current.enabled=t,s.current.mode=n;const o=g.useRef(!1),a=h=>{const f=s.current;if(!f.enabled||!f.container)return;const d=h.getTotalSize();if(d!==f.lastSize){f.lastSize=d;const m=h.options.horizontal?"width":"height";f.container.style[m]=`${d}px`}},l=h=>{const f=s.current;if(!f.enabled||!f.container)return;a(h);const d=!!h.options.horizontal,m=f.mode==="transform",v=d?"left":"top",y=h.options.scrollMargin,x=h.getVirtualItems();for(const b of x){const w=b.start-y,S=h.elementsCache.get(b.key);S&&f.lastPositions.get(S)!==w&&(f.lastPositions.set(S,w),m?S.style.transform=d?`translate3d(${w}px, 0, 0)`:`translate3d(0, ${w}px, 0)`:S.style[v]=`${w}px`)}},c={...r,onChange:(h,f)=>{var d;const m=s.current;let v=!0;if(m.enabled){l(h);const y=h.range,x=m.prevRange;v=!x||x.isScrolling!==h.isScrolling||x.startIndex!==y?.startIndex||x.endIndex!==y?.endIndex,v&&(m.prevRange=y?{startIndex:y.startIndex,endIndex:y.endIndex,isScrolling:h.isScrolling}:null)}v&&(e&&f&&!o.current?(0,pa.flushSync)(i):i()),(d=r.onChange)==null||d.call(r,h,f)}},[u]=g.useState(()=>{const h=new _z(c),f=h.measureElement;return h.measureElement=d=>{o.current=!0;try{f(d)}finally{o.current=!1}},Object.assign(h,{containerRef:d=>{const m=s.current;if(m.container=d,m.lastSize=null,d&&m.enabled){const v=h.getTotalSize();m.lastSize=v;const y=h.options.horizontal?"width":"height";d.style[y]=`${v}px`}}})});return u.setOptions(c),Eh(()=>u._didMount(),[]),Eh(()=>(a(u),u._willUpdate())),Eh(()=>{l(u)}),u}function Vz(e){return Fz({observeElementRect:Mz,observeElementOffset:Iz,scrollToFn:Nz,...e})}function zz(e){return e.map((t,n)=>typeof t=="number"?`[${t}]`:n===0?t:`.${t}`).join("")}function tC(e){const t=[];let n=0;const r=()=>{for(;n<e.length&&/\s/.test(e[n]);)n++},i=()=>{const h=n;for(n++;n<e.length;)if(e[n]==="\\")n+=2;else if(e[n]==='"'){n++;break}else n++;return e.slice(h,n)},s=()=>{const h=n;for(e[n]==="-"&&n++;n<e.length&&/[0-9]/.test(e[n]);)n++;if(e[n]===".")for(n++;n<e.length&&/[0-9]/.test(e[n]);)n++;if(e[n]==="e"||e[n]==="E")for(n++,(e[n]==="+"||e[n]==="-")&&n++;n<e.length&&/[0-9]/.test(e[n]);)n++;return e.slice(h,n)},o=()=>{const h=n;for(;n<e.length&&/[a-z]/.test(e[n]);)n++;return e.slice(h,n)},a=[];let l=!1;const c=[];let u=null;for(;n<e.length&&(r(),!(n>=e.length));){const h=e[n],f=n;switch(h){case"{":t.push({type:"punctuation",value:"{",start:f,end:n+1}),a.push("object"),l=!0,u!==null&&(c.push(u),u=null),n++;break;case"}":t.push({type:"punctuation",value:"}",start:f,end:n+1}),a.pop(),c.length>0&&typeof c[c.length-1]=="string"&&c.pop(),l=!1,n++;break;case"[":t.push({type:"punctuation",value:"[",start:f,end:n+1}),a.push("array"),u!==null&&(c.push(u),u=null),c.push(0),l=!1,n++;break;case"]":t.push({type:"punctuation",value:"]",start:f,end:n+1}),a.pop(),c.length>0&&typeof c[c.length-1]=="number"&&c.pop(),c.length>0&&typeof c[c.length-1]=="string"&&c.pop(),l=!1,n++;break;case":":t.push({type:"punctuation",value:":",start:f,end:n+1}),l=!1,n++;break;case",":t.push({type:"punctuation",value:",",start:f,end:n+1}),l=a.length>0&&a[a.length-1]==="object",a.length>0&&a[a.length-1]==="array"&&c.length>0&&typeof c[c.length-1]=="number"&&(c[c.length-1]=c[c.length-1]+1),n++;break;case'"':{const d=i();if(l&&a.length>0&&a[a.length-1]==="object"){let m;try{m=JSON.parse(d)}catch{m=d.slice(1,-1)}u=m,t.push({type:"key",value:d,start:f,end:n,path:[...c,m],keyName:m})}else{const m=u!==null?[...c,u]:[...c];t.push({type:"string",value:d,start:f,end:n,path:m,keyName:u??void 0}),u=null}break}case"-":case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{const d=s(),m=u!==null?[...c,u]:[...c];t.push({type:"number",value:d,start:f,end:n,path:m,keyName:u??void 0}),u=null,l=!1;break}case"t":case"f":{const d=o(),m=u!==null?[...c,u]:[...c];d==="true"?t.push({type:"boolean",value:d,start:f,end:n,path:m,keyName:u??void 0}):d==="false"&&t.push({type:"boolean-false",value:d,start:f,end:n,path:m,keyName:u??void 0}),u=null,l=!1;break}case"n":{const d=o();if(d==="null"){const m=u!==null?[...c,u]:[...c];t.push({type:"null",value:d,start:f,end:n,path:m,keyName:u??void 0}),u=null}l=!1;break}default:n++}}return t}function nC(e){const t=tC(e);let n="",r=0;const i=s=>{s&&(n+=`<span class="json-punctuation">${X0(s)}</span>`)};for(const s of t){s.start>r&&i(e.slice(r,s.start));const o=`json-${s.type}`;n+=`<span class="${o}">${X0(s.value)}</span>`,r=s.end}return r<e.length&&i(e.slice(r)),n}function X0(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function rC({value:e,displayValue:t,maxLength:n,onCopy:r,keyName:i,path:s}){const[o,a]=(0,g.useState)(null),[l,c]=(0,g.useState)(!1),[u,h]=(0,g.useState)(!1),f=e.length>n,d=f&&!u?`"${e.slice(0,n)}..."`:t,m=(0,g.useCallback)(async(b,w)=>{await uu(b)&&(a(w),r?.(b),setTimeout(()=>a(null),1500))},[r]),v=(0,g.useCallback)(b=>{f&&(b.stopPropagation(),h(w=>!w))},[f]),y=s&&s.length>0?zz(s):null,x=[];return x.push({label:"Copy value",value:e,key:"value"}),i&&x.push({label:"Copy key",value:i,key:"key"}),y&&x.push({label:"Copy path",value:y,key:"path"}),x.length===1?(0,p.jsxs)("span",{className:"relative group/copy",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,p.jsx)("span",{onClick:v,className:G("json-string",f&&!u&&"json-string-truncated"),children:d}),(0,p.jsx)("button",{onClick:b=>{b.stopPropagation(),m(x[0].value,x[0].key)},className:G("inline-flex items-center justify-center ml-1 p-0.5 rounded","transition-all duration-150","hover:bg-muted",l||o?"opacity-100":"opacity-0"),style:{verticalAlign:"middle"},children:o?(0,p.jsx)(hs,{className:"h-3 w-3 text-green-500"}):(0,p.jsx)(ts,{className:"h-3 w-3 text-muted-foreground/60 hover:text-muted-foreground"})})]}):(0,p.jsxs)("span",{className:"relative group/copy",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[(0,p.jsx)("span",{onClick:v,className:G("json-string",f&&!u&&"json-string-truncated"),children:d}),(0,p.jsxs)(Vm,{children:[(0,p.jsx)(zm,{asChild:!0,children:(0,p.jsx)("button",{className:G("inline-flex items-center justify-center ml-1 p-0.5 rounded","transition-all duration-150","hover:bg-muted",l||o?"opacity-100":"opacity-0"),style:{verticalAlign:"middle"},onClick:b=>b.stopPropagation(),children:o?(0,p.jsx)(hs,{className:"h-3 w-3 text-green-500"}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ts,{className:"h-3 w-3 text-muted-foreground/60"}),(0,p.jsx)(Xw,{className:"h-2 w-2 text-muted-foreground/60 -ml-0.5"})]})})}),(0,p.jsx)($m,{align:"start",className:"min-w-[140px]",children:x.map(b=>(0,p.jsxs)(Bl,{onClick:()=>m(b.value,b.key),className:"text-xs",children:[(0,p.jsx)(ts,{className:"h-3 w-3 mr-2"}),b.label]},b.key))})]})]})}function J0(e,t){return t?(0,p.jsx)("span",{className:"json-punctuation",children:t},e):null}function Mh({children:e,value:t,onCopy:n}){const[r,i]=(0,g.useState)(!1),[s,o]=(0,g.useState)(!1),a=(0,g.useCallback)(async l=>{await uu(l)&&(i(!0),n?.(l),setTimeout(()=>i(!1),1500))},[n]);return(0,p.jsxs)("span",{className:"relative group/copy",onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[e,(0,p.jsx)("button",{onClick:l=>{l.stopPropagation(),a(t)},className:G("inline-flex items-center justify-center ml-1 p-0.5 rounded","transition-all duration-150","hover:bg-muted",s||r?"opacity-100":"opacity-0"),style:{verticalAlign:"middle"},children:r?(0,p.jsx)(hs,{className:"h-3 w-3 text-green-500"}):(0,p.jsx)(ts,{className:"h-3 w-3 text-muted-foreground/60 hover:text-muted-foreground"})})]})}function Z0(e,t){const n=e[t],r=n==="{"?"}":"]";let i=1,s=t+1,o=!1,a=!1;for(;s<e.length&&i>0;){const l=e[s];a?a=!1:l==="\\"?a=!0:l==='"'?o=!o:o||(l===n?i++:l===r&&i--),s++}return e.slice(t,s)}function $z({content:e,onCopy:t,collapseStringsAfterLength:n}){const r=(0,g.useMemo)(()=>{const i=tC(e),s=[];let o=0,a=null,l=!0;const c=u=>{for(let h=u+1;h<i.length;h++){const f=i[h];if(!(f.type==="punctuation"&&f.value===":"))return f}return null};for(let u=0;u<i.length;u++){const h=i[u];h.start>o&&s.push(J0(`ws-${o}`,e.slice(o,h.start)));const f=`json-${h.type}`;if(h.type==="key"){const v=c(u);v&&v.type==="punctuation"&&(v.value==="{"||v.value==="[")&&(a={start:v.start}),s.push((0,p.jsx)("span",{className:f,children:h.value},`token-${u}`)),o=h.end;continue}if(l&&h.type==="punctuation"&&(h.value==="{"||h.value==="[")){l=!1;const v=Z0(e,h.start);s.push((0,p.jsx)(Mh,{value:v,onCopy:t,children:(0,p.jsx)("span",{className:f,children:h.value})},`token-${u}`)),o=h.end;continue}if(a&&h.type==="punctuation"&&(h.value==="{"||h.value==="[")&&h.start===a.start){const v=Z0(e,h.start);a=null,s.push((0,p.jsx)(Mh,{value:v,onCopy:t,children:(0,p.jsx)("span",{className:f,children:h.value})},`token-${u}`)),o=h.end;continue}const d=h.type==="string"||h.type==="number"||h.type==="boolean"||h.type==="boolean-false"||h.type==="null",m=()=>{if(h.type==="string")try{return JSON.parse(h.value)}catch{return h.value.slice(1,-1)}return h.value};if(h.type==="string"&&n!==void 0){const v=m();s.push((0,p.jsx)(rC,{value:v,displayValue:h.value,maxLength:n,onCopy:t,keyName:h.keyName,path:h.path},`token-${u}`))}else d?s.push((0,p.jsx)(Mh,{value:m(),onCopy:t,children:(0,p.jsx)("span",{className:f,children:h.value})},`token-${u}`)):s.push((0,p.jsx)("span",{className:f,children:h.value},`token-${u}`));o=h.end}return o<e.length&&s.push(J0("ws-end",e.slice(o))),s},[e,t,n]);return(0,p.jsx)(p.Fragment,{children:r})}var ii=20,ey=30,ty=12,cd=80,Hz=2;function Wz(e){const t=e.value,n=e.selectionStart,r=t.substring(0,n).split(`
43
43
  `);return{line:r.length,column:r[r.length-1].length+1}}function Uz(e){const t=window.getComputedStyle(e),n=document.createElement("span");n.textContent="0",n.style.font=t.font,n.style.position="absolute",n.style.visibility="hidden",n.style.whiteSpace="pre",document.body.appendChild(n);const r=n.getBoundingClientRect().width;if(n.remove(),!Number.isFinite(r)||r<=0)return cd;const i=Number.parseFloat(t.paddingLeft)||0,s=Number.parseFloat(t.paddingRight)||0,o=e.clientWidth-i-s;return o<=0?cd:Math.max(1,Math.floor(o/r))}function qz(e,t){const n=e.replace(/\t/g," ".repeat(Hz)).length;return n===0?1:Math.max(1,Math.ceil(n/t))}function Kz(e,t,n){let r=0;return e.map((i,s)=>{const o=t?qz(i,n)*ii:ii,a=t?r:s*ii;return r+=o,{top:a,height:o}})}function Gz(e,t,n,r,i){return(0,g.useMemo)(()=>{if(!r)return{highlightedHtml:"",paddingTop:0,paddingBottom:0};const s=e.split(`
44
44
  `),o=s.length;if(o===0)return{highlightedHtml:"",paddingTop:0,paddingBottom:0};let a=0,l=o-1;for(;a<=l;){const C=a+l>>>1,A=i[C];!A||A.top+A.height<=t?a=C+1:l=C-1}const c=Math.min(a,o-1),u=t+n;let h=c;for(let C=c;C<o;C++){const A=i[C];if(!A||A.top>=u)break;h=C}const f=Math.max(0,c-ey),d=Math.min(o-1,h+ey),m=s.slice(f,d+1).join(`
45
45
  `),v=i[f],y=i[d],x=i[o-1],b=x?x.top+x.height:0,w=v?.top??0,S=Math.max(0,b-(y?y.top+y.height:0));return{highlightedHtml:nC(m),paddingTop:w,paddingBottom:S}},[e,t,n,r,i])}function iC({content:e,onChange:t,onCursorChange:n,onUndo:r,onRedo:i,onEscape:s,isValid:o=!0,readOnly:a=!1,className:l,height:c,maxHeight:u,showLineNumbers:h=!0,collapseStringsAfterLength:f,wrapLongLinesInEdit:d=!1,wrapLongLinesInView:m=!1}){const v=(0,g.useRef)(null),y=(0,g.useRef)(null),x=(0,g.useRef)(null),b=(0,g.useRef)(null),w=(0,g.useRef)(null),[S,C]=(0,g.useState)(!1),[A,k]=(0,g.useState)(1),[E,T]=(0,g.useState)(0),[R,P]=(0,g.useState)(0),[M,N]=(0,g.useState)(400),L=(0,g.useRef)(null),I=(0,g.useRef)(null),_=(0,g.useRef)(0),[j,$]=(0,g.useState)(cd),B=a?m:d,D=a&&c==="auto",se=(0,g.useMemo)(()=>e.split(`
@@ -70,4 +70,4 @@ import{o as Xx}from"./rolldown-runtime-C4BN53g5.js";import{Dt as Ge,Gt as lf,It
70
70
  
71
71
  `),r=t.startsWith("ÿØÿ");if(!n&&!r)throw new Error("PLUGIN_REPLAY_IMAGE_INVALID");return`data:image/${n?"png":"jpeg"};base64,${e}`}function VU(e,t){e!==void 0&&bg(e);const n=t?RE(t):void 0;return`<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'; frame-src 'none'; connect-src 'none'"><meta name="referrer" content="no-referrer"><style>html,body{margin:0}img{display:block;max-width:100%;height:auto}</style></head><body>${n?`<img alt="Captured workspace" src="${n}">`:"<p>No captured image available.</p>"}</body></html>`}function $x({recording:e,screenshotBase64:t}){let n;try{n=VU(e,t)}catch{return(0,p.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:"Unsupported workspace capture."})}return(0,p.jsx)("iframe",{title:"Recorded plugin workspace",sandbox:"",referrerPolicy:"no-referrer",srcDoc:n,className:"h-96 w-full rounded-md border border-border bg-background"})}function zU({recording:e,screenshotUrl:t}){const n=mg(t??void 0),[r,i]=(0,g.useState)();let s=!1;try{e!==void 0&&bg(e),s=!0}catch{}return(0,g.useEffect)(()=>{if(!s||!n)return;const o=new AbortController;return(async()=>{try{if(!Ia(n))throw new Error("Owned screenshot link unavailable");const a=await Q4(n,{signal:o.signal,credentials:"omit",redirect:"error"});if(!a.ok||!a.body)throw new Error("Screenshot unavailable");const l=a.body.getReader(),c=[];let u=0;try{for(;;){const{done:v,value:y}=await l.read();if(v)break;if(u+=y.byteLength,u>1048576)throw new Error("Screenshot too large");c.push(y)}}finally{await l.cancel().catch(()=>{}),l.releaseLock()}const h=new Uint8Array(u);let f=0;for(const v of c)h.set(v,f),f+=v.length;let d="";for(let v=0;v<h.length;v+=8192)d+=String.fromCharCode(...h.subarray(v,v+8192));const m=btoa(d);RE(m),o.signal.aborted||i({url:n,base64:m})}catch{o.signal.aborted||i({url:n,failed:!0})}})(),()=>o.abort()},[n,s]),s?n&&r?.url!==n?(0,p.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:"Loading captured workspace…"}):(0,p.jsxs)("div",{className:"space-y-2",children:[r?.failed?(0,p.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:"Captured image unavailable."}):null,(0,p.jsx)($x,{recording:e,screenshotBase64:n?r?.base64:void 0})]}):(0,p.jsx)($x,{recording:e})}var $U=500,HU={ok:"border-success/30 bg-success/10 text-success",error:"border-destructive/30 bg-destructive/10 text-destructive",unknown:"border-border/50 bg-muted/40 text-muted-foreground"};function PE(e){switch(e){case"left_click":return"Click";case"double_click":return"Double-click";case"right_click":return"Right-click";case"mouse_move":return"Move";case"type":return"Type";case"key":return"Key";case"scroll":return"Scroll";case"wait":return"Wait";case"screenshot":return"Assert";default:return e}}function Ts(e){const t=PE(e.action),n=e.locatorLabel?.trim();return n?`Interact · ${t} ${n}`:`Interact · ${t}`}function Vc(e){return e.assertion?e.assertion.passed?"ok":"error":e.ok===!0?"ok":e.ok===!1?"error":"unknown"}function eo(e){return`${e.toolCallId}:${e.stepIndex}`}function WU(e){if(!e)return[];const t=[];return typeof e.durationMs=="number"&&e.durationMs>0&&t.push({key:"duration",label:UU(e.durationMs),...typeof e.distinctFrames=="number"?{title:`${e.distinctFrames.toLocaleString()} distinct frames — identical frames are dropped, so an idle page costs none`}:{}}),typeof e.fps=="number"&&e.fps>0&&t.push({key:"fps",label:`${e.fps} fps`}),t}function UU(e){const t=Math.round(e/1e3),n=t%60,r=Math.floor(t/60)%60,i=Math.floor(t/3600),s=String(r).padStart(i>0?2:1,"0");return i>0?`${i}:${s}:${String(n).padStart(2,"0")}`:`${s}:${String(n).padStart(2,"0")}`}function IE(e){return typeof e=="string"&&e.length>0?e:null}function iK(e){return(e.widgetRenderObservations?.length??0)>0||(e.browserInteractionSteps?.length??0)>0||IE(e.videoUrl)!==null}function qU(e){return e==="ok"?"OK":e==="error"?"Failed":"Unknown"}function OE({step:e,leading:t,className:n}){const r=Vc(e),i=e.widgetToolCalls??[],s=e.coordinateX!=null&&e.coordinateY!=null?`(${e.coordinateX}, ${e.coordinateY})`:null;return(0,p.jsxs)("div",{"data-testid":"browser-step-detail",className:G("flex flex-col gap-4",n),children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[t,(0,p.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,p.jsx)("p",{className:"truncate text-sm font-medium text-foreground",children:Ts(e)}),(0,p.jsxs)("p",{className:"text-xs text-muted-foreground",children:["App interaction · ",e.elapsedMs,"ms",s?` · ${s}`:""]})]}),(0,p.jsx)("span",{className:G("inline-flex shrink-0 items-center rounded-full border px-2 py-0.5 text-[11px] font-medium",HU[r]),children:qU(r)})]}),e.assertion&&!e.assertion.passed&&e.assertion.reason?(0,p.jsx)("p",{className:"text-xs text-destructive",children:e.assertion.reason}):null,e.pluginWorkspace?(0,p.jsx)(zU,{recording:e.pluginWorkspace,screenshotUrl:e.screenshotUrl}):e.screenshotUrl?(0,p.jsx)(aE,{src:e.screenshotUrl,alt:Ts(e),className:"max-h-72 w-full rounded-md border border-border/50 object-contain"}):null,i.length>0?(0,p.jsxs)("div",{className:"space-y-1.5",children:[(0,p.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Widget tool calls"}),i.map((o,a)=>(0,p.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border/50 px-2.5 py-1.5 text-xs",children:[(0,p.jsx)("span",{className:G("inline-block h-1.5 w-1.5 shrink-0 rounded-full",o.ok?"bg-success":"bg-destructive"),"aria-hidden":!0}),(0,p.jsx)("span",{className:"font-mono text-foreground",children:o.name}),o.error?(0,p.jsx)("span",{className:"truncate text-destructive",children:o.error}):null]},`${o.name}-${a}`))]}):null,e.followUps&&e.followUps.length>0?(0,p.jsxs)("div",{className:"space-y-1.5",children:[(0,p.jsx)("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Sent message to chat"}),e.followUps.map((o,a)=>(0,p.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border/50 px-2.5 py-1.5 text-xs",children:[(0,p.jsx)("span",{"aria-hidden":!0,children:"↳"}),(0,p.jsx)("span",{className:"truncate text-foreground",children:o})]},a))]}):null]})}function KU(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,"0")}`}function GU(e,t){let n=null;for(const r of e)if(r.videoOffsetMs!=null)if(r.videoOffsetMs<=t)n=r;else break;return n}function sK({steps:e,videoUrl:t,videoMeta:n,isRunning:r=!1,className:i}){const s=(0,g.useRef)(null),[o,a]=(0,g.useState)(null),[l,c]=(0,g.useState)(null),u=(0,g.useRef)(null),[h,f]=(0,g.useState)(!1),[d,m]=(0,g.useState)(null),v=mg(IE(t)),y=(0,g.useMemo)(()=>WU(n),[n]),x=(0,g.useMemo)(()=>[...e].sort((T,R)=>(T.videoOffsetMs??Number.POSITIVE_INFINITY)-(R.videoOffsetMs??Number.POSITIVE_INFINITY)||T.promptIndex-R.promptIndex||T.ts-R.ts),[e]),b=o??l??null,w=(0,g.useMemo)(()=>x.find(T=>eo(T)===b)??null,[x,b]),S=v!=null&&!h,C=x.some(T=>T.screenshotUrl),A=(0,g.useCallback)(T=>{a(eo(T));const R=s.current;if(!R||!S||T.videoOffsetMs==null)return;const P=T.videoOffsetMs/1e3;u.current=P,R.currentTime=P},[S]),k=(0,g.useCallback)(()=>{u.current=null},[]),E=(0,g.useCallback)(()=>{const T=s.current;if(!T)return;const R=GU(x,T.currentTime*1e3);if(c(R?eo(R):null),u.current==null){if(o!=null){const P=x.find(M=>eo(M)===o);if(P?.videoOffsetMs!=null){const M=P.videoOffsetMs-T.currentTime*1e3;if(M>0&&M<$U)return}}a(null)}},[x,o]);return(0,g.useEffect)(()=>{f(!1)},[v]),(0,g.useEffect)(()=>{if(!d||d.url!==v)return;const T=setTimeout(()=>{m(null),f(!1)},d.delayMs);return()=>clearTimeout(T)},[d,v]),x.length===0&&!v?(0,p.jsx)("div",{className:"flex items-center justify-center rounded-md border border-dashed border-border/40 py-8 text-xs text-muted-foreground","data-testid":"browser-filmstrip-empty",children:r?"Finalizing replay…":"No app interactions were recorded."}):(0,p.jsxs)("section",{className:G("flex min-w-0 flex-col gap-3",i),"data-testid":"browser-step-filmstrip",children:[(0,p.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,p.jsxs)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:["Replay",(0,p.jsx)("span",{className:"ml-1.5 font-normal normal-case text-muted-foreground/70",children:"screen recording of the app interactions in this run"})]}),v&&!h&&(y.length>0||n?.truncated)?(0,p.jsxs)("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground","data-testid":"browser-replay-video-meta",children:[y.map(T=>(0,p.jsx)("span",{title:T.title,children:T.label},T.key)),n?.truncated?(0,p.jsx)("span",{className:"rounded-sm border border-warning/30 bg-warning/10 px-1.5 py-px font-medium text-warning-foreground","data-testid":"browser-replay-truncated-badge",title:"The recorder stopped at its size limit, so this video covers the beginning of the run and not the end of it.",children:"Stopped at the size limit"}):null]}):null,v&&!h?(0,p.jsx)("video",{ref:s,src:v,controls:!0,preload:"metadata",onTimeUpdate:E,onSeeked:k,onError:()=>{const T=sE(v);f(!0),m(T!==null&&T>0?{url:v,delayMs:T}:null)},onLoadedMetadata:()=>oE(v),className:"w-full rounded-md border border-border/60 bg-black","data-testid":"browser-replay-video"}):(0,p.jsx)("p",{className:"rounded-md border border-dashed border-border/50 bg-muted/20 px-3 py-2 text-[11px] text-muted-foreground","data-testid":"browser-replay-video-unavailable",children:r?"Finalizing replay — the recording is written when the run ends.":h?C?"Recording failed to load — screenshots preserved.":"Recording failed to load, and no screenshots were captured.":C?"Video unavailable — screenshots preserved.":"Partial capture — no recording, and no screenshots survived."})]}),x.length>0?(0,p.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,p.jsx)("div",{className:"flex min-w-0 gap-2 overflow-x-auto pb-1","data-testid":"browser-filmstrip-track",children:x.map(T=>{const R=eo(T),P=Vc(T),M=R===b;return(0,p.jsxs)("button",{type:"button",onClick:()=>A(T),"aria-pressed":M,title:Ts(T),"data-testid":"browser-filmstrip-frame","data-step-key":R,"data-active":M?"true":"false",className:G("flex w-28 shrink-0 flex-col gap-1 rounded-md border p-1 text-left transition-colors",M?"border-primary bg-primary/5":"border-border/50 hover:border-border"),children:[T.pluginWorkspace?(0,p.jsx)("span",{className:"text-xs text-muted-foreground",children:"Workspace capture"}):T.screenshotUrl?(0,p.jsx)(aE,{src:T.screenshotUrl,alt:Ts(T),loading:"lazy",className:"h-16 w-full rounded-sm border border-border/40 bg-background object-cover object-top"}):(0,p.jsx)("div",{className:"flex h-16 w-full items-center justify-center rounded-sm border border-dashed border-border/50 bg-muted/20 text-[10px] text-muted-foreground",children:"No frame"}),(0,p.jsx)("span",{className:"truncate text-[10px] font-medium text-foreground",children:PE(T.action)}),(0,p.jsx)("span",{className:G("truncate text-[10px]",P==="error"?"text-destructive":"text-muted-foreground"),children:T.videoOffsetMs!=null?KU(T.videoOffsetMs):`turn ${T.promptIndex+1}`})]},R)})}),w?(0,p.jsx)(OE,{step:w,className:"rounded-lg bg-muted/5 px-4 py-4"}):(0,p.jsx)("p",{className:"px-1 text-[11px] text-muted-foreground",children:"Select a frame to see the interaction that produced it."})]}):null]})}function QU(e){return typeof e=="string"&&e.length>0&&e.length<=200?e:void 0}var YU={[-32700]:"Parse error",[-32600]:"Invalid request",[-32601]:"Method not found",[-32602]:"Invalid params",[-32603]:"Internal error",[-32e3]:"Connection closed",[-32001]:"Request timeout",[-32042]:"URL elicitation required"};function XU(e){const t=YU[e];return t?`${e} · ${t}`:String(e)}var JU=Mr({id:ve(),parentId:ve().optional(),name:ve(),category:xo(["step","llm","tool","error","connection","discovery"]),startMs:nt(),endMs:nt(),promptIndex:nt().optional(),stepIndex:nt().optional(),authoredStepId:ve().optional(),status:xo(["ok","error"]).optional(),toolCallId:ve().optional(),toolName:ve().optional(),toolOrigin:xo(["mcp","native","builtin","unknown"]).optional(),serverId:ve().optional(),connectionId:ve().optional(),modelId:ve().optional(),inputTokens:nt().optional(),outputTokens:nt().optional(),totalTokens:nt().optional(),cost:yo().transform(kS).optional(),callId:yo().transform(QU).optional(),messageStartIndex:nt().optional(),messageEndIndex:nt().optional(),finishReason:ve().optional(),provider:ve().optional(),responseId:ve().optional(),responseTimestamp:ve().optional(),ttfcMs:nt().optional(),mcpErrorCode:nt().optional(),outputSource:lf([br("narration"),br("evidence"),br("reconstructed")]).optional(),wireCorroborated:Ge().optional(),evidenceRequestId:ve().optional(),evidenceStatus:lf([br("complete"),br("incomplete")]).optional()}),Qr=Mr({toolName:ve(),arguments:Sl(ve(),Jx())}),ZU=Mr({promptIndex:nt(),prompt:ve(),expectedToolCalls:Qt(Qr),actualToolCalls:Qt(Qr),expectedOutput:ve().optional(),passed:Ge(),missing:Qt(Qr),unexpected:Qt(Qr),argumentMismatches:Qt(Mr({expected:Qr,actual:Qr,mismatchedArguments:Qt(ve())})),retries:Qt(Qr.extend({actualIndex:nt().int().nonnegative(),retriedByIndex:nt().int().nonnegative()})).optional()}),eq=Mr({toolCallId:ve(),toolName:ve(),protocol:lf([br("mcp-apps"),br("openai-apps")]),serverId:ve(),resourceUri:ve().optional(),toolMetadata:Sl(ve(),yo()),widgetCsp:Sl(ve(),yo()).nullable().optional(),widgetPermissions:Sl(ve(),yo()).nullable().optional(),widgetPermissive:Ge().optional(),prefersBorder:Ge().optional(),widgetHtmlBlobId:ve().optional(),widgetHtmlUrl:ve().nullable().optional(),injectedOpenAiCompat:Ge().optional(),injectedOpenAiCompatCapabilities:Mr({callTool:Ge().optional(),sendFollowUpMessage:Ge().optional(),setWidgetState:Ge().optional(),requestDisplayMode:xo(["all","fullscreen-only","none"]).optional(),notifyIntrinsicHeight:Ge().optional(),openExternal:Ge().optional(),setOpenInAppUrl:Ge().optional(),requestModal:Ge().optional(),uploadFile:Ge().optional(),selectFiles:Ge().optional(),getFileDownloadUrl:Ge().optional(),requestCheckout:Ge().optional(),requestClose:Ge().optional()}).optional()}),tq=Mr({source:xo(["hosted","widget"]),fps:nt().optional(),durationMs:nt().optional(),distinctFrames:nt().optional(),truncated:Ge().optional()}),oK=Mr({traceVersion:br(1),messages:Qt(Jx()),widgetSnapshots:Qt(eq).optional(),spans:Qt(JU).optional(),prompts:Qt(ZU).optional(),videoBlobId:ve().optional(),videoMeta:tq.optional()});function nq(e,t){const n=[],r=new Map;return t.forEach((i,s)=>{if(i.role==="user"&&n.push(s),!!Array.isArray(i.content))for(const o of i.content){if(typeof o!="object"||o===null||o.type!=="tool-call"&&o.type!=="tool-result"||typeof o.toolCallId!="string")continue;const a=r.get(o.toolCallId)??[];a.push(s),r.set(o.toolCallId,a)}}),{userIndices:n,spans:e.map(i=>{const s=n[i.promptIndex??0],o=n[(i.promptIndex??0)+1]??t.length,a=s!==void 0&&i.category==="tool"&&i.toolCallId?r.get(i.toolCallId)?.filter(l=>l>=s&&l<o):void 0;return{...i,messageStartIndex:a?.[0],messageEndIndex:a?.at(-1)}})}}function rq({recording:e}){let t;try{t=bg(e)}catch{return null}return(0,p.jsxs)("section",{"aria-label":"Workspace events",className:"mt-4 space-y-2 text-xs",children:[(0,p.jsx)("p",{className:"font-medium",children:"Workspace events"}),t.droppedEvents>0&&(0,p.jsxs)("p",{className:"text-muted-foreground",children:[t.droppedEvents," earlier events omitted."]}),t.events.map(n=>(0,p.jsxs)("div",{className:"flex gap-2 border-b border-border py-2",children:[(0,p.jsx)("span",{className:"tabular-nums text-muted-foreground",children:n.sequence}),(0,p.jsxs)("span",{children:[n.kind,"feature"in n&&n.feature?` · ${n.feature} (${n.fidelity})`:"","outcome"in n&&n.outcome?` · ${n.outcome}`:"","display"in n&&n.display?` · ${n.display.displayMode??"unavailable"} · cursor ${n.display.interactionCursor}`:""]})]},n.sequence))]})}var wg=(0,g.createContext)(void 0);function aK({accounts:e,children:t}){const n=X4();return(0,p.jsx)(wg.Provider,{value:n?e:void 0,children:t})}function DE(){const e=(0,g.useContext)(wg);return(0,g.useCallback)(t=>ME(t,e),[e])}function lK({spans:e,children:t}){const n=(0,g.useContext)(wg),r=(0,g.useMemo)(()=>_U(e,n),[e,n]);return(0,p.jsx)(Z1.Provider,{value:r,children:t})}var iq=1024;function sq(e){const[t,n]=(0,g.useState)(null),[r,i]=(0,g.useState)(!1);return(0,g.useLayoutEffect)(()=>{if(e!=="auto"||!t)return;const s=()=>i(t.getBoundingClientRect().width>=iq);if(s(),typeof ResizeObserver>"u")return;const o=new ResizeObserver(s);return o.observe(t),()=>o.disconnect()},[e,t]),{containerRef:n,direction:e==="auto"&&r?"horizontal":"vertical"}}var oq=["all","connection","discovery","llm","tool","error"];function sf(e){switch(e){case"all":return"All";case"connection":return"Connect";case"discovery":return"Discovery";case"llm":return"LLM";case"tool":return"Tool";case"error":return"Error"}}function aq({filter:e,onFilterChange:t,isFullyExpanded:n,expandDisabled:r,onToggleExpandAll:i,zoomControls:s,showBottomBorder:o=!0}){return(0,p.jsxs)("div",{className:G("flex min-h-7 min-w-0 flex-1 flex-row flex-nowrap items-center gap-2 overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",o&&"border-b border-border/30 pb-2"),children:[(0,p.jsxs)(Vm,{children:[(0,p.jsx)(zm,{asChild:!0,children:(0,p.jsxs)(Ot,{type:"button",variant:"outline",size:"sm",className:"h-7 shrink-0 gap-1.5 border-border/50 px-2 text-[10px] font-medium text-foreground","aria-label":`Filter timeline rows: ${sf(e)}`,children:[(0,p.jsx)(ZD,{className:"size-3.5 shrink-0 opacity-80","aria-hidden":!0}),sf(e)]})}),(0,p.jsx)($m,{align:"start",className:"min-w-[8rem]",children:(0,p.jsx)(GV,{value:e,onValueChange:a=>t(a),children:oq.map(a=>(0,p.jsx)(QV,{value:a,className:"text-xs",children:sf(a)},a))})})]}),(0,p.jsx)(Ot,{type:"button",variant:"outline",size:"icon",disabled:r,className:"h-7 w-7 shrink-0 border-border/50 text-muted-foreground hover:text-foreground disabled:opacity-40",title:n?"Collapse all":"Expand all","aria-label":n?"Collapse all":"Expand all","aria-pressed":n,onClick:i,children:n?(0,p.jsx)(lN,{className:"size-3.5",strokeWidth:2,"aria-hidden":!0}):(0,p.jsx)(QD,{className:"size-3.5",strokeWidth:2,"aria-hidden":!0})}),s?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("span",{className:"bg-border hidden h-3 w-px shrink-0 md:block","aria-hidden":!0}),(0,p.jsx)("div",{className:"flex shrink-0 items-center gap-0.5",children:s})]}):null]})}function NE(e,t=[]){const n=e.filter(r=>r.category==="llm");if(!(!n.some(r=>r.cost)&&t.length===0))return CN([...n.map(r=>r.cost),...t])}function LE(e,t){if(!e||e.kind==="interaction")return;if(e.kind==="span"){const{span:r}=e;if(r.category!=="llm")return;const i=r.cost??t?.find(({id:s})=>s===r.id)?.cost;return i?{kind:"call",cost:i}:void 0}const n=NE((t??[]).filter(r=>(r.promptIndex??0)===e.promptIndex));return n?{kind:"rollup",rollup:n}:void 0}function lq(e){if(e===0)return"$0.00";if(e<1e-4)return"<$0.0001";const t=e.toFixed(4);return Number(t)<1?`$${t}`:`$${e.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}var Sg={provider_reported:"Provider-reported",list_price:"Estimated at list price",customer_rate:"Estimated at your rates",runner_reported:"Runner-reported"},_E={partial:"Partial",unavailable:"Cost unavailable"},kg=e=>e==="list_price"||e==="customer_rate",cq={no_usage:"No token usage was reported for this call.",no_rate:"No price is on record for this model.",invalid_rate:"The price on record for this model was invalid. An organization admin can set a price under Model prices to price future calls.",unsupported_currency:"The price on record is not in US dollars."},uq={usage:"unreported usage",input_tokens:"input tokens",output_tokens:"output tokens",rate:"tokens without a rate",cache_read_rate:"cache reads",cache_write_rate:"cache writes",cache_write_1h_rate:"one-hour cache writes",web_search_rate:"web searches"},hq={input:"Input",cacheRead:"Cache read",cacheWrite:"Cache write",output:"Output",webSearch:"Web search"};function fq(e){if(e.length<=1)return e[0]&&Sg[e[0]];const t=e.filter(kg).length;return t===e.length?"Estimated":t>0?"Reported and estimated":"Reported"}function dq(e){const t=(e.missing??[]).map(i=>uq[i]),n=e.completeness==="unavailable"?e.reason?cq[e.reason]:"No price is on record for this call.":e.completeness==="partial"?t.length>0?`Excludes ${t.join(", ")}.`:"Some charges on this call are not priced.":void 0,r=Object.entries(hq).flatMap(([i,s])=>{const o=e.parts?.[i];return typeof o=="number"?[{label:s,amountUsd:o}]:[]});return{amountUsd:e.amountUsd,estimated:e.source?kg(e.source):!1,sourceLabel:e.source?Sg[e.source]:void 0,completeness:e.completeness,note:n,parts:r}}function pq(e){const t=e.totalCalls-e.unavailableCalls,n=e.totalCalls===1?"call":"calls",r=e.partialCalls>0?`, ${e.partialCalls} partly`:"";return{amountUsd:e.completeness==="unavailable"?void 0:e.knownSubtotalUsd,estimated:e.sources.some(kg),sourceLabel:fq(e.sources),completeness:e.completeness,coverage:`${t} of ${e.totalCalls} ${n} priced${r}`,parts:[]}}function jE(e){return e.kind==="call"?dq(e.cost):pq(e.rollup)}var mq="trace-cost";function Oa(){return $1(mq)===!0}var BE="evalIterationModelCalls:list",gq=pu(BE),wl=e=>Number.isInteger(e)&&e>=0;function vq(e){if(!e||typeof e!="object")return;const t=e,{knownSubtotalUsd:n,sources:r}=t;return t.currency==="USD"&&typeof n=="number"&&Number.isFinite(n)&&n>=0&&["complete","partial","unavailable"].includes(t.completeness)&&wl(t.totalCalls)&&wl(t.completeCalls)&&wl(t.partialCalls)&&wl(t.unavailableCalls)&&Array.isArray(r)&&r.every(i=>typeof i=="string"&&Object.hasOwn(Sg,i))?e:void 0}function cK(e,t){const n=vq(e.usage?.costRollup);return{iterationId:e._id,...n?{rollup:n}:{},harness:t?t.startsWith("harness:"):!!eM(e.execution)?.harness}}function yq(e,t){const n=new Set(e.filter(o=>o.category==="llm").map(o=>o.id)),r=new Map,i=[],s=new Set;for(const o of t??[]){if(s.has(o.generationId))continue;s.add(o.generationId);const a=kS(o.cost),l=o.matchedSpanId;l&&n.has(l)&&!r.has(l)?r.set(l,a):i.push({generationId:o.generationId,modelId:o.modelId,cost:a})}return{spans:e.map(o=>{const a=o.cost??r.get(o.id);return a===o.cost?o:{...o,cost:a}}),unmatched:i}}function xq(e){return tM(e,BE)}var FE=[];function Lu(e){const t=Oa();return(0,g.useMemo)(()=>t&&e?jE(e):void 0,[t,e])}function ha({amountUsd:e,estimated:t,slot:n=!1}){return(0,p.jsxs)("span",{className:"whitespace-nowrap tabular-nums",children:[t?(0,p.jsx)("span",{className:"inline-block w-[1ch] text-center",children:"≈"}):n?(0,p.jsx)("span",{"aria-hidden":!0,className:"inline-block w-[1ch]"}):null,lq(e)]})}function VE({view:e}){return(0,p.jsxs)(p.Fragment,{children:[e.sourceLabel?(0,p.jsx)(kc,{variant:"outline",className:"px-1.5 py-0 text-[10px] text-muted-foreground",children:e.sourceLabel}):null,e.completeness!=="complete"?(0,p.jsx)(kc,{variant:"outline",className:G("px-1.5 py-0 text-[10px]",e.completeness==="partial"?"border-warning/50 bg-warning/10 text-foreground":"text-muted-foreground"),children:_E[e.completeness]}):null,e.coverage?(0,p.jsx)("span",{children:e.coverage}):null,e.note?(0,p.jsx)("span",{children:e.note}):null]})}function bq({cost:e}){const t=Lu(e);return t?.amountUsd===void 0?null:(0,p.jsxs)("span",{"data-testid":"trace-cost-inline",children:[" · ",(0,p.jsx)("span",{className:"font-medium text-foreground",children:(0,p.jsx)(ha,{amountUsd:t.amountUsd,estimated:t.estimated})})]})}function wq({cost:e}){const t=Lu(e);return t?(0,p.jsxs)("div",{"data-testid":"trace-cost-chips",className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[(0,p.jsx)("span",{className:"text-muted-foreground/70",children:"Cost"}),(0,p.jsx)(VE,{view:t})]}):null}function to({label:e,children:t}){return(0,p.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,p.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:e}),(0,p.jsx)("span",{className:"min-w-0 text-right font-medium text-popover-foreground",children:t})]})}function Sq({cost:e}){const t=Lu(e);return t?(0,p.jsxs)("div",{"data-testid":"trace-row-hover-cost",className:"space-y-1.5",children:[(0,p.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-popover-foreground/65",children:"Cost"}),(0,p.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,p.jsx)(to,{label:e?.kind==="rollup"?"Total":"Amount",children:t.amountUsd===void 0?"Unavailable":(0,p.jsx)(ha,{amountUsd:t.amountUsd,estimated:t.estimated,slot:!0})}),t.parts.map(n=>(0,p.jsx)(to,{label:n.label,children:(0,p.jsx)(ha,{amountUsd:n.amountUsd,estimated:t.estimated,slot:!0})},n.label)),t.sourceLabel?(0,p.jsx)(to,{label:"Source",children:t.sourceLabel}):null,t.completeness==="partial"?(0,p.jsx)(to,{label:"Status",children:_E.partial}):null,t.coverage?(0,p.jsx)(to,{label:"Coverage",children:t.coverage}):null,t.note?(0,p.jsx)("p",{className:"text-popover-foreground/70",children:t.note}):null]})]}):null}function kq(e,t){const n=Oa()&&t?.harness?t.iterationId:void 0,[r,i]=(0,g.useState)(),s=r?.iterationId===n?r?.calls:void 0,o=(0,g.useMemo)(()=>s?yq(e??[],s):void 0,[e,s]),a=(0,g.useCallback)(()=>i(void 0),[]),l=n?(0,p.jsx)(Sc,{name:"trace-cost-model-calls",isExpectedError:xq,onError:a,fallback:null,children:(0,p.jsx)(Cq,{iterationId:n,onLoad:i})},n):null;return{spans:o?.spans??e,unmatched:o?.unmatched??FE,loader:l}}function Cq({iterationId:e,onLoad:t}){const n=V1(gq,{iterationId:e});return(0,g.useEffect)(()=>{n&&t({iterationId:e,calls:n})},[n,e,t]),null}function Aq({spans:e,iteration:t,unmatched:n=FE}){const r=Oa(),i=Lu((0,g.useMemo)(()=>{if(!r)return;const s=t?.rollup??NE(e??[],n.map(o=>o.cost));return s&&{kind:"rollup",rollup:s}},[r,e,t?.rollup,n]));return i?(0,p.jsxs)("div",{"data-testid":"trace-cost-summary",className:"shrink-0 space-y-2 rounded-lg border border-border/50 bg-background px-3 py-2 text-xs text-muted-foreground",children:[(0,p.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,p.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wide",children:"Trace cost"}),i.amountUsd!==void 0?(0,p.jsx)("span",{className:"text-sm font-semibold text-foreground",children:(0,p.jsx)(ha,{amountUsd:i.amountUsd,estimated:i.estimated})}):null,(0,p.jsx)(VE,{view:i})]}),n.length>0?(0,p.jsx)(Tq,{calls:n}):null]}):null}function Tq({calls:e}){return(0,p.jsxs)("div",{"data-testid":"trace-cost-unmatched-calls",className:"space-y-1",children:[(0,p.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide",children:"Model calls not matched to a step"}),(0,p.jsx)("ul",{"data-testid":"trace-cost-unmatched-list",className:"max-h-40 space-y-0.5 overflow-y-auto",children:e.map(t=>{const n=t.cost&&jE({kind:"call",cost:t.cost});return(0,p.jsxs)("li",{className:"flex flex-wrap items-baseline gap-x-2",children:[(0,p.jsx)("span",{className:"min-w-0 truncate font-mono text-foreground",children:t.modelId}),(0,p.jsx)("span",{className:"font-medium text-foreground",children:n?.amountUsd!==void 0?(0,p.jsx)(ha,{amountUsd:n.amountUsd,estimated:n.estimated}):"Cost unavailable"}),n?.sourceLabel?(0,p.jsx)("span",{children:n.sourceLabel}):null]},t.generationId)})})]})}var Hx=[0,25,50,75,100],Eq=54,Mq=120;function Rq(e){if(!Number.isFinite(e))return[0,100];if(e<=0)return[0,100];const t=Math.max(2,Math.floor(e/Eq));return t>=Hx.length?[...Hx]:t<=2?[0,100]:t===3?[0,50,100]:[0,25,75,100]}function Pq(e){return e<=0?"left-0 top-1/2 -translate-x-0 -translate-y-1/2 text-left":e>=100?"left-0 top-1/2 -translate-x-full -translate-y-1/2 text-right":"left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-center"}function Wx(e){return e<=0?ic(0):`${ic(0)}–${ic(e)}`}function Iq(e){const t=e.filter(l=>l.category==="llm");let n=0,r=0,i=0,s=0,o=0,a=0;for(const l of t)typeof l.inputTokens=="number"&&(n+=l.inputTokens,r++),typeof l.outputTokens=="number"&&(i+=l.outputTokens,s++),typeof l.totalTokens=="number"&&(o+=l.totalTokens,a++);return{...r?{inputTokens:n}:{},...s?{outputTokens:i}:{},...a?{totalTokens:o}:{}}}function _u(e,t){return t}function Ux(e){switch(e){case"connection":return-2;case"discovery":return-1;case"step":return 0;case"llm":return 1;case"tool":return 2;case"error":return 3;default:return _u(e,9)}}function Oq(e,t){if(e.startMs!==t.startMs)return e.startMs-t.startMs;const n=Ux(e.category)-Ux(t.category);return n!==0?n:e.endMs!==t.endMs?e.endMs-t.endMs:e.name.localeCompare(t.name)}function Dq(e,t){return typeof e!="number"||t<50?null:e/(t/1e3)}function No(e){return e>=1e3?`${(e/1e3).toFixed(e>=1e4?1:2)}s`:`${Math.round(e)}ms`}function ic(e){return e>=1e3?`${(e/1e3).toFixed(2)}s`:`${Math.round(e)}ms`}function Jn(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function fa(e){const t=e.toolName??e.name;return typeof t=="string"&&t.trim()?t:void 0}function Da(e){return Array.isArray(e.content)?e.content.filter(t=>Jn(t)&&typeof t.type=="string"):typeof e.content=="string"?[{type:"text",text:e.content}]:[]}function zE(e){if(e==null)return"None";if(typeof e=="string")return e.length>180?`${e.slice(0,177)}...`:e;if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return`${e.length} item${e.length===1?"":"s"}`;if(Jn(e)){const t=Object.keys(e);return t.length>0?`{ ${t.slice(0,4).join(", ")}${t.length>4?", ...":""} }`:"{}"}return String(e)}function Nq(e){const t=Da(e);if(t.length===0)return typeof e.content=="string"?e.content:"No content";const n=t.slice(0,3).map(r=>r.type==="text"&&typeof r.text=="string"?r.text:r.type==="tool-call"?`Tool call: ${fa(r)??"Tool"}`:r.type==="tool-result"?`Tool result: ${fa(r)??"Tool"}`:typeof r.type=="string"?r.type:"content").join(" | ");return n.length>220?`${n.slice(0,217)}...`:n}function Lq(e){return!Jn(e)||!("type"in e)||!("value"in e)?e:e.value}function _q(e){return e.result!==void 0?e.result:Lq(e.output)}function jq(e){const t=_q(e);if(typeof e.error=="string"&&e.error.trim())return e.error.trim();if(Jn(e.error)&&typeof e.error.message=="string")return e.error.message;if(Jn(e.output)&&e.output.type==="error-text")return typeof e.output.value=="string"?e.output.value:"Tool error";if(Jn(e.result)&&e.result.isError===!0||Jn(e.output)&&Jn(e.output.value)&&e.output.value.isError===!0||e.isError===!0)return rf(t)??"Tool error"}function ju(e,t,n,r){if(!t&&!n)return{};if(r){if(!t||r.messageStartIndex===void 0||r.messageEndIndex===void 0)return{};e=e.slice(r.messageStartIndex,r.messageEndIndex+1)}let i,s,o;for(const a of e)for(const l of Da(a)){const c=typeof t=="string"&&l.toolCallId===t,u=!t&&typeof n=="string"&&fa(l)===n;if(!(!c&&!u)&&(l.type==="tool-call"&&(i=l.input??l.parameters??l.args),l.type==="tool-result")){s=l.result??(Jn(l.output)&&"value"in l.output?l.output.value:l.output);const h=jq(l);h&&(o=h)}}return{input:i,output:s,errorText:o}}function Zi(e,t,n=!1){return e.category==="error"||e.status==="error"?!0:e.category==="tool"?!!ju(t,e.toolCallId,e.toolName??e.name,n?e:void 0).errorText:!1}function _s(e,t){if(typeof e!="number"&&typeof t!="number")return;const n=e??t??0,r=t??e??n;return{startIndex:Math.min(n,r),endIndex:Math.max(n,r)}}function Bq(e){return _s(e.messageStartIndex,e.messageEndIndex)}function Fq(e){return _s(e.span.messageStartIndex,e.span.messageEndIndex)}function $E(e){if(!e||e.startIndex<0)return[];const t=[];for(let n=e.startIndex;n<=e.endIndex;n+=1)t.push(n);return t}function HE(e,t,n){if(t)for(let r=t.startIndex;r<=t.endIndex;r+=1){const i=e[r];if(i&&n(i))return r}}function Cg(e,t,n){if(!e.length)return;const r=_s(t,n);if(!r){const s=e.findIndex(o=>o.role==="user");return s>=0?s:void 0}const i=HE(e,r,s=>s.role==="user");if(typeof i=="number")return i;if(!(r.startIndex>=e.length)&&r.startIndex>0)for(let s=r.startIndex-1;s>=0;s-=1){const o=e[s];if(o){if(o.role==="user")return s;if(o.role==="assistant")break}}}function Vq(e,t){if(e.kind==="prompt")return"trace-waterfall-bar-prompt";if(e.kind==="interaction")return e.status==="error"?"trace-waterfall-bar-error":"trace-waterfall-bar-tool";if(e.kind==="span"&&t)return"trace-waterfall-bar-error";if(e.kind!=="span")return"trace-waterfall-bar-step";const n=e.span.category;switch(n){case"llm":return"trace-waterfall-bar-llm";case"tool":return"trace-waterfall-bar-tool";case"step":case"connection":case"discovery":return"trace-waterfall-bar-step";case"error":return"trace-waterfall-bar-error";default:return _u(n,"trace-waterfall-bar-step")}}function zq(e){switch(e){case"prompt":return"trace-waterfall-glyph-prompt";case"step":return"trace-waterfall-glyph-step";case"llm":return"trace-waterfall-glyph-llm";case"tool":case"interaction":return"trace-waterfall-glyph-tool";case"error":return"trace-waterfall-glyph-error";case"connection":case"discovery":return"trace-waterfall-glyph-step";default:return _u(e,"text-muted-foreground")}}function $q(e,t){if(e.kind==="prompt")return"trace-waterfall-row-accent-prompt";if(e.kind==="interaction")return e.status==="error"?"trace-waterfall-row-accent-error":"trace-waterfall-row-accent-tool";const n=t?"error":e.span.category;switch(n){case"llm":return"trace-waterfall-row-accent-llm";case"tool":return"trace-waterfall-row-accent-tool";case"error":return"trace-waterfall-row-accent-error";case"step":case"connection":case"discovery":return"trace-waterfall-row-accent-step";default:return _u(n,"border-l-muted-foreground")}}function Hq(e){const t=new Map;for(const n of e){const r=typeof n.promptIndex=="number"?n.promptIndex:0,i=t.get(r);i?i.push(n):t.set(r,[n])}return[...t.entries()].sort(([n],[r])=>n-r).map(([n,r])=>{const i=new Map;r.forEach(c=>{i.set(c.id,{span:c,children:[]})});const s=[];r.forEach(c=>{const u=i.get(c.id),h=typeof c.parentId=="string"?i.get(c.parentId):void 0;if(h){h.children.push(u);return}s.push(u)});const o=c=>{c.sort((u,h)=>Oq(u.span,h.span)),c.forEach(u=>o(u.children))};o(s);const a=r.flatMap(c=>{const u=[];return typeof c.messageStartIndex=="number"&&u.push(c.messageStartIndex),typeof c.messageEndIndex=="number"&&u.push(c.messageEndIndex),u}),l={step:0,llm:0,tool:0,error:0,connection:0,discovery:0};for(const c of r)c.category in l&&l[c.category]++;return{key:`prompt-${n}`,promptIndex:n,label:`Prompt ${n+1}`,spans:r,roots:s,startMs:Math.min(...r.map(c=>c.startMs)),endMs:Math.max(...r.map(c=>c.endMs)),messageStartIndex:a.length>0?Math.min(...a):void 0,messageEndIndex:a.length>0?Math.max(...a):void 0,counts:l}})}function qx(e){const t=new Set;function n(r){for(const i of r)i.span.category==="step"&&i.children.length>0&&t.add(i.span.id),n(i.children)}for(const r of e)n(r.roots);return t}function of(e){return{role:e.role,content:e.content}}function WE(e,t,n){const r=_s(t,n);if(!r)return[];const i=e.slice(r.startIndex,r.endIndex+1);if(i.length===0)return[];let s=-1;for(let a=0;a<i.length;a++)if(i[a].role==="assistant"){s=a;break}if(s<0)return e.slice(0,r.endIndex+1);const o=r.startIndex+s;return o===0?[]:e.slice(0,o)}function Wq(e,t,n){const r=_s(t,n);if(!r)return{input:null,output:null};const i=e.slice(r.startIndex,r.endIndex+1);if(i.length===0)return{input:[],output:null};let s=-1;for(let l=i.length-1;l>=0;l-=1)if(i[l].role==="assistant"){s=l;break}if(s<0)return{input:i.map(of),output:null};const o=WE(e,t,n),a=i[s];return{input:o.length>0?o.map(of):null,output:of(a)}}var Uq=96;function Zt(e,t=Uq){const n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function da(e){return typeof e.content=="string"?e.content.trim():Da(e).map(t=>t.type==="text"&&typeof t.text=="string"?t.text.trim():"").filter(Boolean).join(" ")}function qq(e){const t=Da(e),n=[];for(const r of t)r.type==="tool-call"&&n.push(fa(r)??"tool");return n}function Kq(e,t){if(!e.length)return;const n=WE(e,t.messageStartIndex,t.messageEndIndex);if(n.length!==0){for(let r=n.length-1;r>=0;r--){const i=n[r];if(i.role==="user"){const s=da(i);if(s)return Zt(s)}}for(const r of n)if(r.role==="system"){const i=da(r);if(i)return Zt(i)}for(let r=n.length-1;r>=0;r--){const i=n[r];if(i.role==="tool"){const s=Nq(i);if(s&&s!=="No content")return Zt(s)}}}}function Gq(e,t){if(!e.length)return;const n=_s(t.messageStartIndex,t.messageEndIndex);if(!n)return;const r=e.slice(n.startIndex,n.endIndex+1);for(let i=r.length-1;i>=0;i--){const s=r[i];if(s.role!=="assistant")continue;const o=da(s);if(o)return{kind:"text",preview:Zt(o)};const a=qq(s);if(a.length>0)return{kind:"tools",preview:Zt(`Calling ${a.join(", ")}`)}}}function Qq(e,t,n){const r=Cg(e,t,n);if(typeof r!="number")return;const i=da(e[r]);return i?Zt(i):void 0}function Yq(e,t,n){const r=Cg(e,t,n);if(typeof r=="number")return da(e[r])||void 0}function Kx(e,t){if(typeof t.toolCallId=="string"&&e.toolCallId===t.toolCallId)return!0;const n=t.toolName?.trim()||t.name?.trim();return!!(!t.toolCallId&&n&&fa(e)===n)}function Xq(e,t,n){if(n)for(let r=n.startIndex;r<=n.endIndex;r+=1){const i=e[r];if(!i)continue;const s=Da(i);if(s.some(o=>o.type==="tool-call"&&Kx(o,t))||s.some(o=>o.type==="tool-result"&&Kx(o,t)))return r}}function Jq(e,t){const n=Cg(t,e.messageStartIndex,e.messageEndIndex);if(typeof n=="number")return{focusSourceIndex:n,highlightSourceIndices:[n]};const r=$E(Bq(e));if(r.length!==0)return{focusSourceIndex:r[0],highlightSourceIndices:r}}function Zq(e,t){const n=Fq(e),r=$E(n);if(r.length===0)return;const i=HE(t,n,s=>s.role==="assistant");return{focusSourceIndex:(e.span.category==="tool"?Xq(t,e.span,n):void 0)??i??r[0],highlightSourceIndices:r}}function e6(e,t,n=!1){const r=ju(e,t.toolCallId,t.toolName??t.name,n?t:void 0);if(r.input==null)return;const i=zE(r.input);if(!(!i||i==="None"))return Zt(i)}function Es({category:e,size:t="sm"}){const n=G(t==="lg"?"h-5 w-5 shrink-0":"h-3.5 w-3.5 shrink-0",zq(e));switch(e){case"prompt":return(0,p.jsx)(fN,{className:n,"aria-hidden":!0});case"llm":return(0,p.jsx)(KD,{className:n,"aria-hidden":!0});case"tool":return(0,p.jsx)(dN,{className:n,"aria-hidden":!0});case"interaction":return(0,p.jsx)(iN,{className:n,"aria-hidden":!0});case"error":return(0,p.jsx)(GD,{className:n,"aria-hidden":!0});case"connection":case"discovery":case"step":return(0,p.jsx)(nv,{className:n,"aria-hidden":!0});default:return(0,p.jsx)(nv,{className:n,"aria-hidden":!0})}}function t6(e,t){const n=t.promptIndex,r=t.stepIndex;if(typeof n!="number"||typeof r!="number")return{};const i=e.find(s=>s.category==="llm"&&s.promptIndex===n&&s.stepIndex===r);return i?{...typeof i.inputTokens=="number"?{inputTokens:i.inputTokens}:{},...typeof i.outputTokens=="number"?{outputTokens:i.outputTokens}:{},...typeof i.totalTokens=="number"?{totalTokens:i.totalTokens}:{}}:{}}function n6(e,t){if(e.kind==="prompt")return{inputTokens:e.aggregatedInputTokens,outputTokens:e.aggregatedOutputTokens,totalTokens:e.aggregatedTotalTokens};if(e.kind==="interaction")return{};const n={inputTokens:e.span.inputTokens,outputTokens:e.span.outputTokens,totalTokens:e.span.totalTokens};if(typeof n.inputTokens=="number"||typeof n.outputTokens=="number"||typeof n.totalTokens=="number"||!t?.length||e.span.category!=="llm"&&e.span.category!=="step")return n;const r=t6(t,e.span);return typeof r.inputTokens=="number"||typeof r.outputTokens=="number"||typeof r.totalTokens=="number"?r:n}function af(e){return typeof e=="number"?e.toLocaleString():"—"}function Gx(e){return typeof e=="number"&&Number.isFinite(e)?new Date(e).toLocaleString():"—"}function r6({traceStartedAtMs:e,traceEndedAtMs:t,traceDurationMs:n}){return typeof e=="number"&&Number.isFinite(e)?e:typeof t=="number"&&Number.isFinite(t)?t-n:null}function Tp(e,t,n=!1,r){const{span:i,promptIndex:s}=e,o=i.modelId?.trim()?Zt(i.modelId.trim(),56):void 0,a=i.name?.trim()??"";if(i.category==="step"){const l=typeof i.stepIndex=="number"?i.stepIndex+1:void 0,c=typeof l=="number"?`Step ${l}`:a||"Step",u=typeof l=="number"&&(a===`Step ${l}`||a.toLowerCase()===`step ${l}`),h=a&&!u?Zt(a,64):c,f=Kq(t,i);return f?{title:h,subtitle:f}:o?{title:h,subtitle:o}:{title:h,subtitle:`Prompt ${s+1}`}}if(i.category==="llm"){const l=Gq(t,i),c=!a||/^assistant$/i.test(a)||/^llm$/i.test(a)||/^model$/i.test(a)||a==="Model response"||/·\s*response$/i.test(a)?"Agent":Zt(a,64);return l?.kind==="text"?{title:`${c}: "${l.preview}"`,subtitle:o}:l?.kind==="tools"?{title:`${c} · ${l.preview}`,subtitle:o}:{title:c,subtitle:o}}if(i.category==="tool"){const l=`Tool · ${(i.toolName??i.name).trim()||"tool"}${r?` · ${r}`:""}`,c=e6(t,i,n),u=!c||c==="{}"||c==="None";if(c&&!u)return{title:l,subtitle:c};if(u){const h=ju(t,i.toolCallId,i.toolName??i.name,n?i:void 0);if(h.output!=null){const f=zE(h.output);if(f&&f!=="None"&&f!=="{}")return{title:l,subtitle:Zt(f)}}}return typeof i.stepIndex=="number"?{title:l,subtitle:o?`${o} · step ${i.stepIndex+1}`:`step ${i.stepIndex+1}`}:{title:l,subtitle:o}}return{title:i.name,subtitle:typeof i.stepIndex=="number"?o?`${o} · step ${i.stepIndex+1}`:`step ${i.stepIndex+1}`:o}}function Ep(e){const t=e.kind==="span"?e.span.startMs:e.startMs,n=e.kind==="span"?e.span.endMs:e.endMs;return{startMs:t,endMs:n,durationMs:n-t}}function i6({format:e,onFormatChange:t}){return(0,p.jsx)("div",{className:"flex flex-wrap gap-1",children:["plain","markdown"].map(n=>(0,p.jsx)(Ot,{type:"button",size:"sm",variant:e===n?"secondary":"outline",className:"h-7 text-[10px] capitalize",onClick:()=>t(n),children:n==="plain"?"Plain":"Markdown"},n))})}function Qx({value:e}){const[t,n]=(0,g.useState)("plain");return(0,g.useEffect)(()=>{typeof e=="string"&&n("plain")},[e]),e==null?(0,p.jsx)("div",{className:"rounded-md border border-dashed border-border/60 px-3 py-2 text-xs text-muted-foreground",children:"None"}):typeof e=="string"?(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsx)(i6,{format:t,onFormatChange:n}),t==="markdown"?(0,p.jsx)("div",{className:"max-h-44 overflow-auto rounded-md border border-border/60 bg-muted/10 p-3 text-xs leading-relaxed text-foreground",children:(0,p.jsx)(JT,{content:e})}):(0,p.jsx)("pre",{className:"max-h-44 overflow-auto rounded-md border border-border/60 bg-muted/20 p-3 text-xs whitespace-pre-wrap break-words",children:e})]}):(0,p.jsx)(A4,{value:e,containerClassName:"max-h-56 rounded-md border border-border/60 bg-background"})}function s6({row:e}){return(0,p.jsxs)("div",{"data-testid":"trace-detail-pane",className:"min-h-[280px] rounded-lg bg-muted/5 px-5 py-5",children:[(0,p.jsx)(OE,{step:e.step,leading:(0,p.jsx)(Es,{category:"interaction",size:"lg"})}),e.step.pluginWorkspace&&(0,p.jsx)(rq,{recording:e.step.pluginWorkspace})]})}function Yx(e){return e.split(/[-_\s]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function o6(e){return e.engine==="harness"?e.harness?Yx(e.harness):"Harness":e.engine==="emulated"?"Emulated":e.harness?Yx(e.harness):"Unknown"}function a6({row:e,recordedSpans:t,projectedMessages:n,transcriptMessages:r,onRevealInTranscript:i,turnRuntimeByPromptIndex:s}){const o=DE(),a=Oa();if(!e)return(0,p.jsxs)("div",{"data-testid":"trace-detail-pane",className:"flex min-h-[280px] flex-col items-center justify-center gap-3 rounded-lg bg-muted/5 px-6 py-12 text-center",children:[(0,p.jsx)("div",{className:"flex h-14 w-14 items-center justify-center rounded-full border border-border/50 bg-background shadow-sm",children:(0,p.jsx)(JD,{className:"h-7 w-7 text-muted-foreground","aria-hidden":!0})}),(0,p.jsxs)("div",{className:"space-y-1",children:[(0,p.jsx)("p",{className:"text-sm font-medium text-foreground",children:"No span selected"}),(0,p.jsx)("p",{className:"text-xs text-muted-foreground",children:"Click a row or use arrow keys"})]})]});if(e.kind==="interaction")return(0,p.jsx)(s6,{row:e});const l=e.kind==="prompt"?Jq(e,r):Zq(e,r),c=e.kind==="span"?ju(r,e.span.toolCallId,e.span.toolName??e.span.name,n?e.span:void 0):{},{durationMs:u}=Ep(e),h=e.kind==="span"?Tp(e,r,n,o(e.span)):null,f=e.kind==="prompt"?e.label:h.title,d=e.kind==="prompt"?e.hasAnyFailure?"error":"ok":Zi(e.span,r,n)?"error":"ok",m=e.kind==="prompt"?"prompt":e.span.category==="tool"&&Zi(e.span,r,n)?"error":e.span.category,v=s?.get(e.promptIndex),y=e.kind==="span"&&(e.span.category==="llm"||e.span.category==="step")?Wq(r,e.span.messageStartIndex,e.span.messageEndIndex):{input:null,output:null},x=e.kind==="span"&&e.span.category==="tool"&&(!!e.span.toolCallId||!!(e.span.toolName?.trim()||e.span.name?.trim())),b=e.kind==="prompt"?null:x?c.input:e.kind==="span"&&(e.span.category==="llm"||e.span.category==="step")?y.input:(e.kind==="span"&&e.span.category==="error",null),w=e.kind==="prompt"?null:x?c.output:e.kind==="span"&&(e.span.category==="llm"||e.span.category==="step")?y.output:e.kind==="span"&&e.span.category==="error"?e.span.name:null,S=e.kind==="prompt"?Yq(r,e.messageStartIndex,e.messageEndIndex):void 0,C=e.kind==="span"&&(typeof e.span.inputTokens=="number"||typeof e.span.outputTokens=="number"||typeof e.span.totalTokens=="number"),A=e.kind==="prompt"&&(typeof e.aggregatedInputTokens=="number"||typeof e.aggregatedOutputTokens=="number"||typeof e.aggregatedTotalTokens=="number"),k=e.kind==="span"&&c.errorText?c.errorText:null,E=!!(l&&i),T=a?LE(e,t):void 0;return(0,p.jsxs)("div",{"data-testid":"trace-detail-pane",className:"space-y-4 bg-background p-4",children:[(0,p.jsxs)("div",{className:G("border-b border-border/40 pb-3",E?"flex flex-col gap-3 min-[400px]:flex-row min-[400px]:items-start":""),children:[(0,p.jsxs)("div",{className:G("flex gap-3",E?"min-w-0 min-[400px]:flex-1":""),children:[(0,p.jsx)("div",{className:"shrink-0 pt-0.5",children:e.kind==="prompt"?(0,p.jsx)(Es,{category:"prompt",size:"lg"}):(0,p.jsx)(Es,{category:m,size:"lg"})}),(0,p.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,p.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[(0,p.jsx)("h3",{className:"text-sm font-bold leading-tight text-foreground",children:f}),v?(0,p.jsxs)(kc,{className:"border-border/60 bg-muted/30 px-1.5 py-0 text-[10px] font-medium text-muted-foreground","data-testid":"trace-turn-runtime-badge",title:v.engine==="harness"?"This turn ran through the harness adapter.":v.engine==="emulated"?"This turn ran through MCPJam's emulated chat engine.":v.harness?"This turn ran through the harness adapter.":"Runtime engine was not recorded for this turn.",children:["Engine: ",o6(v)]}):null,d==="error"?(0,p.jsx)("span",{className:"inline-block h-2 w-2 shrink-0 rounded-full bg-destructive",title:"Error","aria-label":"Error"}):null]}),(0,p.jsxs)("div",{className:"text-xs tabular-nums text-muted-foreground",children:[(0,p.jsx)("span",{className:"font-medium text-foreground",children:No(u)}),e.kind==="prompt"&&A?(0,p.jsxs)(p.Fragment,{children:[typeof e.aggregatedInputTokens=="number"?` · ${e.aggregatedInputTokens} in`:"",typeof e.aggregatedOutputTokens=="number"?` → ${e.aggregatedOutputTokens} out`:"",typeof e.aggregatedTotalTokens=="number"?` (${e.aggregatedTotalTokens} total)`:""]}):e.kind==="span"&&C?(0,p.jsxs)(p.Fragment,{children:[typeof e.span.inputTokens=="number"?` · ${e.span.inputTokens} in`:"",typeof e.span.outputTokens=="number"?` → ${e.span.outputTokens} out`:"",typeof e.span.totalTokens=="number"?` (${e.span.totalTokens} total)`:""]}):null,(0,p.jsx)(bq,{cost:T})]}),(0,p.jsx)(wq,{cost:T}),e.kind==="span"?(()=>{const R=e.span,P=R.category==="llm"?Dq(R.outputTokens,u):null,M=[];return R.provider&&M.push({label:"Provider",value:R.provider}),R.finishReason&&M.push({label:"Finish",value:R.finishReason}),typeof R.ttfcMs=="number"&&M.push({label:"TTFC",value:No(R.ttfcMs)}),P!==null&&M.push({label:"Throughput",value:`${P.toFixed(1)} tok/s`}),R.responseId&&M.push({label:"Response ID",value:R.responseId}),M.length===0?null:(0,p.jsx)("div",{"data-testid":"trace-span-metadata",className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground",children:M.map(N=>(0,p.jsxs)("span",{className:"truncate",children:[(0,p.jsxs)("span",{className:"text-muted-foreground/70",children:[N.label,":"," "]}),(0,p.jsx)("span",{className:"font-medium text-foreground",children:N.value})]},N.label))})})():null]})]}),E?(0,p.jsx)("div",{className:"flex min-w-0 min-[400px]:flex-1 min-[400px]:justify-end min-[400px]:pt-0.5",children:(0,p.jsxs)(Ot,{type:"button",size:"sm",variant:"outline",className:"w-full shrink-0 justify-center whitespace-nowrap min-[400px]:w-auto",onClick:()=>{l&&i&&i(l)},children:[(0,p.jsx)(tN,{className:"h-3.5 w-3.5"}),"Reveal in Chat"]})}):null]}),e.kind==="prompt"&&S?(0,p.jsx)("div",{className:"min-h-0 max-h-[min(60vh,28rem)] flex-1 overflow-auto rounded-md border border-border/50 bg-muted/10 px-3 py-2 text-xs leading-relaxed text-foreground",children:S}):null,n&&e.kind==="span"&&e.span.messageStartIndex===void 0?(0,p.jsx)("p",{className:"text-xs text-muted-foreground",children:"Message details are unavailable for this span. Read the conversation in Chat."}):e.kind==="span"?(0,p.jsxs)("div",{className:"space-y-4",children:[(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Input"}),(0,p.jsx)(Qx,{value:b??void 0})]}),(0,p.jsxs)("div",{className:G("space-y-2",e.span.category==="error"||k?"rounded-md border border-destructive/50 bg-destructive/50 p-2":""),children:[(0,p.jsx)("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"Output"}),(0,p.jsx)(Qx,{value:w??void 0}),k?(0,p.jsx)("pre",{className:"max-h-40 overflow-auto rounded-md border border-destructive/50 bg-destructive/50 p-3 text-xs whitespace-pre-wrap break-words text-foreground",children:k}):null,typeof e.span.mcpErrorCode=="number"?(0,p.jsxs)("div",{"data-testid":"trace-mcp-error-code",className:"text-[11px] tabular-nums text-muted-foreground",title:"MCP-layer error code. -32602/-32601 etc. are server JSON-RPC errors; -32000 (connection closed) / -32001 (request timeout) are transport/client failures, not server faults.",children:[(0,p.jsx)("span",{className:"text-muted-foreground/70",children:"MCP error: "}),(0,p.jsx)("span",{className:"font-medium text-foreground",children:XU(e.span.mcpErrorCode)})]}):null]})]}):null]})}function uK({recordedSpans:e,projectedMessages:t=!1,interactionSteps:n,estimatedDurationMs:r,transcriptMessageCount:i=0,transcriptMessages:s=[],traceStartedAtMs:o=null,traceEndedAtMs:a=null,onRevealInTranscript:l,hideToolbar:c=!1,timelineFilter:u,onTimelineFilterChange:h,expandedPromptIds:f,onExpandedPromptIdsChange:d,expandedStepIds:m,onExpandedStepIdsChange:v,viewportMaxMs:y,turnRuntimeByPromptIndex:x,fillContent:b=!1,detailPlacement:w="below",iterationCost:S}){const{containerRef:C,direction:A}=sq(w),k=A==="horizontal",E=(0,g.useMemo)(()=>t?nq(e??[],s):void 0,[t,e,s]),T=E?.spans??e,R=kq(T,S),P=R.spans,M=vM(),N=DE(),L=Oa(),I=(0,g.useMemo)(()=>new Set(L?(P??[]).filter(O=>O.cost).map(O=>O.id):[]),[L,P]),_=T&&T.length>0?"recorded":(r??0)>0?"estimated":"none",j=(0,g.useMemo)(()=>T?.length?Hq(T).map(O=>E?{...O,messageStartIndex:E.userIndices[O.promptIndex]??-1,messageEndIndex:E.userIndices[O.promptIndex]??-1}:O):[],[T,E]),$=(0,g.useMemo)(()=>{const O=new Map;for(const le of n??[]){const fe=O.get(le.toolCallId);fe?fe.push(le):O.set(le.toolCallId,[le])}for(const le of O.values())le.sort((fe,Ie)=>fe.stepIndex-Ie.stepIndex);return O},[n]),B=T?.length?T.reduce((O,le)=>Math.max(O,le.endMs),1):Math.max(r??0,1),D=(0,g.useMemo)(()=>T?.map(O=>`${O.id}:${O.startMs}:${O.endMs}`).join("|")??_,[_,T]),[se,ne]=(0,g.useState)(1);(0,g.useEffect)(()=>{y===void 0&&ne(B)},[B,D,y]);const F=Math.max(1,y!==void 0?y:se),q=Math.max(1,Math.round(B/50)),K=(0,g.useMemo)(()=>r6({traceStartedAtMs:o,traceEndedAtMs:a,traceDurationMs:B}),[B,a,o]),[Y,H]=(0,g.useState)("all"),X=u!==void 0?u:Y,oe=h??H,[pe,ae]=(0,g.useState)(new Set),[at,et]=(0,g.useState)(new Set),Re=f!==void 0?f:pe,ze=d??ae,_e=m!==void 0?m:at,_n=v??et,[je,hn]=(0,g.useState)(null),[wt,tt]=(0,g.useState)(null),[J,ge]=(0,g.useState)(null),ke=(0,g.useRef)(null),js=(0,g.useRef)(null),[$e,Ai]=(0,g.useState)(-1);(0,g.useLayoutEffect)(()=>{const O=js.current;if(!O)return;const le=()=>{const Ie=O.getBoundingClientRect().width;Ai(Number.isFinite(Ie)?Ie:0)};if(le(),typeof ResizeObserver>"u")return;const fe=new ResizeObserver(le);return fe.observe(O),()=>fe.disconnect()},[A]);const gt=(0,g.useMemo)(()=>Rq($e),[$e]),Ti=(0,g.useMemo)(()=>gt.length!==2?!1:$e<0||$e===0?!0:$e<Mq,[$e,gt]);(0,g.useEffect)(()=>{c||(ae(new Set(j.map(O=>O.key))),et(qx(j)))},[c,j]);const Pe=(0,g.useMemo)(()=>{if(_!=="recorded")return[];const O=[],le=new Set;function fe(re){return X==="all"?!0:X==="error"?Zi(re,s,t):re.category===X}function Ie(re,zt,fn){const Wr=re.span.category==="step",$t=Wr?fn:fn+1,dn=re.children.map(St=>Ie(St,zt,$t)),Fs=dn.flatMap(St=>St.rows),Vs=dn.some(St=>St.hasVisibleContent);if(Wr)return{hasVisibleContent:Vs||re.children.length>0,rows:Fs};if(re.span.category==="llm"&&!I.has(re.span.id)&&typeof re.span.totalTokens!="number"&&typeof re.span.inputTokens!="number"&&typeof re.span.outputTokens!="number"&&re.span.endMs-re.span.startMs<50)return{hasVisibleContent:!1,rows:[]};const jn=re.span.toolCallId,zs=re.span.category==="tool"&&!!jn&&!le.has(jn);zs&&jn&&le.add(jn);const _a=zs&&jn?($.get(jn)??[]).filter(St=>X==="all"||X==="tool"?!0:X==="error"?Vc(St)==="error":!1).map((St,Vu)=>({kind:"interaction",key:`interaction-${re.span.id}-${St.stepIndex}-${Vu}`,promptIndex:zt,depth:fn+1,step:St,startMs:re.span.startMs,endMs:re.span.endMs,status:Vc(St)})):[];if(!(fe(re.span)||Vs||_a.length>0))return{hasVisibleContent:Vs,rows:Fs};const $s={kind:"span",key:re.span.id,promptIndex:zt,depth:fn,span:re.span,hasChildren:re.children.length>0,isExpanded:_e.has(re.span.id)};return{hasVisibleContent:!0,rows:[$s,...$s.hasChildren&&$s.isExpanded?Fs:[],..._a]}}for(const re of j){const zt=re.roots.map(dn=>Ie(dn,re.promptIndex,0)).flatMap(dn=>dn.rows);if(!(zt.length>0||X==="all"&&re.spans.length>0))continue;const fn=re.spans.some(dn=>Zi(dn,s,t)),Wr=Qq(s,re.messageStartIndex,re.messageEndIndex),$t=Iq(re.spans);O.push({kind:"prompt",key:re.key,promptIndex:re.promptIndex,label:re.label,conversationLabel:Wr?`User: "${Wr}"`:void 0,startMs:re.startMs,endMs:re.endMs,messageStartIndex:re.messageStartIndex,messageEndIndex:re.messageEndIndex,counts:re.counts,hasAnyFailure:fn,isExpanded:Re.has(re.key),aggregatedInputTokens:$t.inputTokens,aggregatedOutputTokens:$t.outputTokens,aggregatedTotalTokens:$t.totalTokens}),Re.has(re.key)&&O.push(...zt)}return O},[Re,_e,X,j,$,_,s,t,I]),Bs=(0,g.useMemo)(()=>qx(j),[j]),Na=(0,g.useMemo)(()=>{if(j.length===0)return!1;for(const O of j)if(!Re.has(O.key))return!1;for(const O of Bs)if(!_e.has(O))return!1;return!0},[j,Re,_e,Bs]);(0,g.useEffect)(()=>{if(Pe.length===0){hn(null);return}(!je||!Pe.some(O=>O.key===je))&&hn(Pe[0].key)},[Pe,je]);const Hr=Pe.find(O=>O.key===je),Te=wt?Pe.find(O=>O.key===wt):void 0,Bu=wt?Pe.findIndex(O=>O.key===wt):-1;(0,g.useEffect)(()=>{wt&&!Pe.some(O=>O.key===wt)&&(tt(null),ge(null),ke.current=null)},[wt,Pe]);const La=(0,g.useCallback)(O=>{const le=(O.querySelector('[data-testid="trace-row-glyph"]')??O).getBoundingClientRect();return{anchorX:le.left+le.width/2,anchorY:le.top,anchorBottom:le.bottom}},[]);(0,g.useEffect)(()=>{if(!wt)return;const O=()=>{const le=ke.current;le&&ge(La(le))};return window.addEventListener("scroll",O,!0),window.addEventListener("resize",O),()=>{window.removeEventListener("scroll",O,!0),window.removeEventListener("resize",O)}},[wt,La]);const Ag=(0,g.useMemo)(()=>{if(!Te)return null;const{startMs:O,endMs:le}=Ep(Te),fe=Te.kind==="span"&&Zi(Te.span,s,t),Ie=Te.kind==="span"?Tp(Te,s,t,N(Te.span)):null,re=Te.kind==="prompt"?Te.conversationLabel??Te.label:Te.kind==="interaction"?Ts(Te.step):Ie.title,zt=n6(Te,T),fn=Te.kind==="prompt"?"prompt":Te.kind==="interaction"?"interaction":Te.span.category==="tool"&&fe?"error":Te.span.category;return{label:re,spanShowsFailure:fe,tokenStats:zt,rowStartTimestamp:K!==null?K+O:null,rowEndTimestamp:K!==null?K+le:null,glyphCategory:fn,cost:L?LE(Te,P):void 0}},[Te,T,P,K,s,t,N,L]),UE=(0,g.useCallback)(O=>{if(Pe.length===0)return;const le=Pe.findIndex(fe=>fe.key===je);if(O.key==="ArrowDown"){O.preventDefault();const fe=le<0?0:Math.min(Pe.length-1,le+1);hn(Pe[fe].key);return}if(O.key==="ArrowUp"){O.preventDefault();const fe=le<=0?0:le-1;hn(Pe[fe].key);return}if(O.key==="Enter"&&le>=0){const fe=Pe[le];if(fe.kind==="prompt"){O.preventDefault();const Ie=new Set(Re);Ie.has(fe.key)?Ie.delete(fe.key):Ie.add(fe.key),ze(Ie);return}if(fe.kind==="span"&&fe.hasChildren){O.preventDefault();const Ie=new Set(_e);Ie.has(fe.key)?Ie.delete(fe.key):Ie.add(fe.key),_n(Ie)}}},[Re,_e,Pe,je,ze,_n]),Fu=(0,p.jsxs)(p.Fragment,{children:[R.loader,(0,p.jsx)(Aq,{spans:P,iteration:S,unmatched:R.unmatched})]});if(_==="none")return(0,p.jsxs)(p.Fragment,{children:[Fu,(0,p.jsx)("div",{className:"text-xs text-muted-foreground",children:"No timing data recorded for this iteration."})]});if(_==="estimated")return(0,p.jsxs)("div",{className:"space-y-3",children:[Fu,(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)(kc,{className:"border-warning/50 bg-warning/50 text-foreground",children:"Estimated total only"}),(0,p.jsx)("span",{className:"text-xs text-muted-foreground",children:No(r??0)})]}),(0,p.jsxs)("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[(0,p.jsx)("p",{children:"Per-step timing was not recorded for this run."}),i>0?(0,p.jsxs)("p",{children:["Conversation detail is in the Chat tab. Open"," ",(0,p.jsx)("span",{className:"font-medium text-foreground/80",children:"Raw"})," to inspect the stored trace and confirm whether a"," ",(0,p.jsx)("code",{className:"rounded border border-border/50 bg-muted/40 px-1 py-px font-mono text-[10px] text-foreground/90",children:"spans"})," ","array exists; only new runs that persist spans show a per-step timeline here."]}):null]})]});const qE=y===void 0?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Ot,{type:"button",variant:"outline",size:"icon",className:"h-7 w-7 border-border/50",title:"Zoom in timeline","aria-label":"Zoom in timeline",disabled:se<=q,onClick:()=>ne(O=>Math.max(q,Math.round(O*.8))),children:(0,p.jsx)(oN,{className:"size-3.5","aria-hidden":!0})}),(0,p.jsx)(Ot,{type:"button",variant:"outline",size:"icon",className:"h-7 w-7 border-border/50",title:"Zoom out timeline","aria-label":"Zoom out timeline",disabled:se>=B*4,onClick:()=>ne(O=>Math.min(B*4,Math.round(O*1.25))),children:(0,p.jsx)(rN,{className:"size-3.5","aria-hidden":!0})})]}):null;return(0,p.jsxs)("div",{className:G("space-y-2",b&&"flex min-h-0 flex-1 flex-col"),children:[c?null:(0,p.jsxs)("div",{className:b?"shrink-0":void 0,children:[(0,p.jsx)(aq,{filter:X,onFilterChange:oe,isFullyExpanded:Na,expandDisabled:j.length===0,zoomControls:qE,onToggleExpandAll:()=>{Na?(ze(new Set),_n(new Set)):(ze(new Set(j.map(O=>O.key))),_n(new Set(Bs)))}}),(0,p.jsx)("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 px-1 text-xs text-muted-foreground",children:[{label:"User",cls:"trace-waterfall-bar-prompt"},{label:"Connect",cls:"trace-waterfall-bar-step"},{label:"Discovery",cls:"trace-waterfall-bar-step"},{label:"LLM",cls:"trace-waterfall-bar-llm"},{label:"Tool",cls:"trace-waterfall-bar-tool"},{label:"Step",cls:"trace-waterfall-bar-step"},{label:"Error",cls:"trace-waterfall-bar-error"}].map(({label:O,cls:le})=>(0,p.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,p.jsx)("span",{className:G("h-2 w-2.5 rounded-sm",le)}),O]},O))})]}),Fu,(0,p.jsx)("div",{ref:C,className:G("@container/trace-timeline min-w-0",b&&"flex min-h-0 flex-1 flex-col"),children:(0,p.jsxs)(RU,{direction:A,className:G("rounded-lg border border-border/50 bg-background",b?"min-h-0 flex-1 overflow-hidden":"min-h-[min(25rem,calc(100dvh-8rem))]"),style:b?void 0:{height:"auto"},children:[(0,p.jsx)(Cp,{defaultSize:k?62:65,minSize:0,className:"min-h-0 min-w-0 overflow-hidden",children:(0,p.jsx)(NU,{className:G(b?"h-full min-h-0 overflow-hidden":"max-h-[calc(100vh-8rem)] min-h-0"),children:(0,p.jsx)("div",{tabIndex:0,role:"region","aria-label":"Trace timeline. Use arrow keys to change selection, Enter to expand.",onKeyDown:UE,className:"relative min-h-0 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:(0,p.jsxs)("div",{className:"grid pr-4",style:{gridTemplateColumns:"minmax(140px, 260px) minmax(0, 1fr) minmax(5.25rem, max-content)",gridTemplateRows:`auto repeat(${Pe.length}, minmax(48px, auto))`},children:[(0,p.jsx)("div",{className:"sticky top-0 z-20 border-b border-border/50 bg-background/95 px-4 py-1.5 backdrop-blur",style:{gridColumn:"1 / 3",gridRow:1},children:(0,p.jsxs)("div",{className:"flex min-h-6 min-w-0 items-center gap-3",children:[(0,p.jsx)("div",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:"Trace"}),(0,p.jsx)("div",{className:"min-h-6 min-w-0 flex-1",children:(0,p.jsx)("div",{ref:js,className:"relative h-6 min-w-0",children:Ti?(0,p.jsx)("div",{className:"flex h-full min-w-0 items-center justify-center",children:(0,p.jsx)("span",{className:"min-w-0 max-w-full truncate text-center text-[10px] tabular-nums text-muted-foreground",title:Wx(F),children:Wx(F)})}):gt.map(O=>{const le=O>=100?"100%":`${O}%`;return(0,p.jsx)("div",{className:"pointer-events-none absolute inset-y-0",style:{left:le},children:(0,p.jsx)("div",{className:G("absolute text-[10px] tabular-nums text-muted-foreground",Pq(O)),children:ic(F*O/100)})},O)})})})]})}),(0,p.jsx)("div",{className:"sticky top-0 z-20 flex min-h-0 items-center border-b border-l border-border/50 bg-background/95 px-3 py-1.5 pl-4 backdrop-blur",style:{gridColumn:3,gridRow:1},children:(0,p.jsxs)("div",{className:"flex h-6 w-full min-w-0 items-center justify-start gap-1.5",children:[(0,p.jsx)(tv,{className:"size-3 shrink-0 text-muted-foreground","aria-hidden":!0}),(0,p.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Latency"})]})}),Pe.length>0?(0,p.jsx)("div",{className:"pointer-events-none relative z-0 bg-transparent",style:{gridColumn:2,gridRow:`2 / ${Pe.length+2}`},children:gt.map(O=>(0,p.jsx)("div",{className:"absolute top-0 bottom-0 w-px bg-border/40",style:{left:O>=100?"100%":`${O}%`}},O))}):null,Pe.map((O,le)=>{const fe=O.key===je,{startMs:Ie,endMs:re,durationMs:zt}=Ep(O),fn=Ie/F*100,Wr=Math.max((re-Ie)/F*100,.45),$t=O.kind==="span"&&Zi(O.span,s,t),dn=O.kind==="prompt"?"prompt":O.kind==="interaction"?"interaction":O.span.category==="tool"&&$t?"error":O.span.category,Fs=O.kind==="interaction"&&O.status==="error",Vs=O.kind==="span"?Tp(O,s,t):null,jn=O.kind==="prompt"?O.conversationLabel??O.label:O.kind==="interaction"?Ts(O.step):Vs.title,zs=No(zt),_a=O.kind==="prompt"?!0:O.kind==="interaction"?!1:O.hasChildren||O.span.category==="llm",$s=le+2,St=$q(O,$t),Vu=Vq(O,$t),Tg=()=>{td("trace_span_clicked",{location:"trace_timeline",span_kind:O.kind}),hn(O.key)},zu=kt=>{kt.stopPropagation(),Tg()},KE=fe?G("bg-transparent",St):"border-l-transparent bg-background group-hover:bg-muted/20 hover:bg-muted/20",Eg=fe?"bg-transparent":"bg-background group-hover:bg-muted/20 hover:bg-muted/20";return(0,p.jsxs)(s1.div,{"data-testid":"trace-row","data-state":fe?"selected":void 0,onClick:Tg,onMouseEnter:kt=>{tt(O.key);const Ct=kt.currentTarget;ke.current=Ct,ge(La(Ct))},onMouseLeave:()=>{tt(kt=>kt===O.key?null:kt),ge(null),ke.current=null},onFocus:kt=>{tt(O.key);const Ct=kt.currentTarget;ke.current=Ct,ge(La(Ct))},onBlur:kt=>{kt.currentTarget.contains(kt.relatedTarget)||(tt(Ct=>Ct===O.key?null:Ct),ge(null),ke.current=null)},initial:M||le>=20?!1:{opacity:0,y:6},animate:{opacity:1,y:0},transition:M||le>=20?{duration:0}:{duration:.15,delay:le*.03+.05,ease:[.16,1,.3,1]},style:{gridColumn:"1 / 4",gridRow:$s,display:"grid",gridTemplateColumns:"subgrid"},className:G("group min-h-0 min-w-0 cursor-pointer items-stretch",fe&&"trace-waterfall-row-selected ring-1 ring-inset ring-ring/40"),children:[(0,p.jsxs)("div",{className:G("flex items-center gap-2 border-b border-border/40 px-4 py-2 transition-all duration-150 border-l-2",KE),children:[(0,p.jsx)("div",{className:"flex shrink-0 items-center",style:{paddingLeft:O.kind==="prompt"?0:O.depth*16},children:_a?(0,p.jsx)("button",{type:"button",className:"mr-1 inline-flex h-5 w-5 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted/30 hover:text-foreground",onClick:kt=>{if(kt.stopPropagation(),O.kind==="prompt"){const ja=new Set(Re);ja.has(O.key)?ja.delete(O.key):ja.add(O.key),ze(ja);return}const Ct=new Set(_e);Ct.has(O.key)?Ct.delete(O.key):Ct.add(O.key),_n(Ct)},"aria-label":O.kind==="prompt"?`${O.isExpanded?"Collapse":"Expand"} ${O.label}`:`${"isExpanded"in O&&O.isExpanded?"Collapse":"Expand"} ${jn}`,children:"isExpanded"in O&&O.isExpanded?(0,p.jsx)(Xw,{className:"h-3.5 w-3.5"}):(0,p.jsx)(fs,{className:"h-3.5 w-3.5"})}):(0,p.jsx)("span",{className:"mr-1 h-5 w-5"})}),(0,p.jsx)("button",{type:"button","data-testid":"trace-row-label-button",className:"min-w-0 flex-1 text-left",onClick:zu,children:(0,p.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,p.jsx)("span",{"data-testid":"trace-row-glyph",className:"inline-flex shrink-0 items-center",children:O.kind==="prompt"?(0,p.jsx)(Es,{category:"prompt"}):(0,p.jsx)(Es,{category:dn})}),(0,p.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:jn}),(0,p.jsx)(xz,{name:O.kind==="span"?N(O.span):void 0}),O.kind==="prompt"&&O.hasAnyFailure?(0,p.jsx)("span",{className:"inline-block h-2 w-2 shrink-0 rounded-full bg-destructive",title:"Contains errors","aria-label":"Contains errors"}):null,O.kind==="span"&&$t||Fs?(0,p.jsx)("span",{className:"inline-block h-2 w-2 shrink-0 rounded-full bg-destructive",title:"Error","aria-label":"Error"}):null]})})]}),(0,p.jsx)("button",{type:"button","data-testid":"trace-row-bar-hit","data-state":fe?"selected":void 0,className:G("relative z-[1] flex min-h-[48px] w-full items-center overflow-hidden border-b border-border/40 border-l-2 border-l-transparent px-4 py-2 text-left transition-all duration-150",Eg),"aria-label":`Select on timeline (${No(zt)})`,onClick:zu,children:(0,p.jsx)("div",{"data-testid":O.kind==="span"&&$t?"trace-row-bar-error":"trace-row-bar",className:G("absolute top-1/2 z-[1] h-4 min-w-0 -translate-y-1/2 rounded-[3px] transition-[left,width] duration-150",Vu),style:{left:`${fn}%`,width:`max(${Wr}%, 3px)`}})}),(0,p.jsxs)("button",{type:"button","data-testid":"trace-row-duration-hit","data-state":fe?"selected":void 0,className:G("flex min-h-[48px] items-center justify-start gap-1.5 whitespace-nowrap border-b border-l border-border/40 px-3 py-2 pl-4 text-[11px] tabular-nums text-muted-foreground transition-all duration-150",Eg),"aria-label":`Select row duration (${zs})`,onClick:zu,children:[(0,p.jsx)(tv,{className:"size-3 shrink-0 opacity-80","aria-hidden":!0}),zs]})]},O.key)})]})})})}),(0,p.jsx)(PU,{withHandle:!0}),(0,p.jsx)(Cp,{defaultSize:k?38:35,minSize:k?25:20,className:"min-h-0 min-w-0 overflow-hidden",children:(0,p.jsx)("div",{"data-testid":"trace-timeline-detail-sticky",className:"h-full min-h-0 min-w-0 max-h-full overflow-y-auto",children:(0,p.jsx)(a6,{projectedMessages:t,row:Hr,recordedSpans:P,transcriptMessages:s,onRevealInTranscript:l,turnRuntimeByPromptIndex:x})})})]},A)}),Te&&Ag&&J?(0,p.jsx)(l6,{hoverPos:J,info:Ag,placement:Bu===0?"bottom":"top",reduceMotion:M??!1,rowKey:Te.key}):null]})}function l6({hoverPos:e,info:t,placement:n,reduceMotion:r,rowKey:i}){if(typeof document>"u")return null;const s=304,o=12,a=8,l=s/2,c=typeof window<"u"?window.innerWidth:e.anchorX+l+o,u=164,h=Math.max(u,c-l-o),f=Math.min(Math.max(e.anchorX,u),h),d={position:"fixed",top:n==="top"?e.anchorY-a:e.anchorBottom+a,left:f,transform:n==="top"?"translate(-50%, -100%)":"translateX(-50%)",zIndex:9999};return(0,pa.createPortal)((0,p.jsx)("div",{className:"pointer-events-none",style:d,children:(0,p.jsx)(s1.div,{"data-placement":n,"data-testid":"trace-row-hover-content",initial:r?!1:{opacity:0,y:6,filter:"blur(2px)"},animate:{opacity:1,y:0,filter:"blur(0px)"},transition:{duration:.16,ease:[.16,1,.3,1]},className:"w-[19rem] overflow-hidden rounded-md border border-border/60 bg-popover text-popover-foreground shadow-xl",children:(0,p.jsxs)("div",{"data-testid":"trace-row-hover-card",className:"space-y-3 p-3",children:[(0,p.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,p.jsx)(Es,{category:t.glyphCategory}),(0,p.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs font-semibold text-popover-foreground",children:t.label})]}),(0,p.jsxs)("div",{className:"space-y-1.5",children:[(0,p.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-popover-foreground/65",children:"Time"}),(0,p.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,p.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,p.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Start"}),(0,p.jsx)("span",{"data-testid":"trace-row-hover-start",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:Gx(t.rowStartTimestamp)})]}),(0,p.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,p.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"End"}),(0,p.jsx)("span",{"data-testid":"trace-row-hover-end",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:Gx(t.rowEndTimestamp)})]})]})]}),(0,p.jsxs)("div",{className:"space-y-1.5",children:[(0,p.jsx)("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-popover-foreground/65",children:"Tokens"}),(0,p.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,p.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,p.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Input"}),(0,p.jsx)("span",{"data-testid":"trace-row-hover-input-tokens",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:af(t.tokenStats.inputTokens)})]}),(0,p.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,p.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Output"}),(0,p.jsx)("span",{"data-testid":"trace-row-hover-output-tokens",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:af(t.tokenStats.outputTokens)})]}),(0,p.jsxs)("div",{className:"flex min-w-0 items-baseline justify-between gap-3",children:[(0,p.jsx)("span",{className:"shrink-0 text-popover-foreground/70",children:"Total"}),(0,p.jsx)("span",{"data-testid":"trace-row-hover-total-tokens",className:"min-w-0 text-right font-medium text-popover-foreground tabular-nums",children:af(t.tokenStats.totalTokens)})]})]})]}),(0,p.jsx)(Sq,{cost:t.cost})]})},i)}),document.body)}export{F8 as $,a1 as $n,KD as $r,p8 as $t,RU as A,J6 as An,dN as Ar,R8 as At,JT as B,W6 as Bn,nN as Br,v8 as Bt,rK as C,te as Ci,r8 as Cn,ru as Cr,Bl as Ct,Js as D,Le as Di,Z6 as Dn,x6 as Dr,E8 as Dt,tK as E,PM as Ei,oF as En,AS as Er,QV as Et,W4 as F,$6 as Fn,cN as Fr,k8 as Ft,S4 as G,V6 as Gn,XD as Gr,pt as Gt,X8 as H,UB as Hn,eN as Hr,NV as Ht,eK as I,Q6 as In,oN as Ir,C8 as It,$z as J,FB as Jn,tv as Jr,IF as Jt,v4 as K,F6 as Kn,YD as Kr,pu as Kt,G4 as L,K6 as Ln,sN as Lr,Sc as Lt,aE as M,H6 as Mn,hN as Mr,w8 as Mt,pg as N,q6 as Nn,uN as Nr,S8 as Nt,PU as O,X6 as On,no as Or,M8 as Ot,Q4 as P,z6 as Pn,nu as Pr,$1 as Pt,V8 as Q,C6 as Qn,hs as Qr,du as Qt,mg as R,U6 as Rn,iN as Rr,FV as Rt,Ap as S,Rt as Si,w1 as Sn,we as Sr,$m as St,LU as T,cr as Ti,o8 as Tn,PN as Tr,GV as Tt,E4 as U,ms as Un,ZD as Ur,x8 as Ut,J8 as V,Pm as Vn,tN as Vr,b8 as Vt,A4 as W,zB as Wn,JD as Wr,V1 as Wt,$8 as X,MB as Xn,fs as Xr,E1 as Xt,xz as Y,EB as Yn,GD as Yr,m8 as Yt,z8 as Z,k6 as Zn,Xw as Zr,CF as Zt,PE as _,Je as _i,i8 as _n,s1 as _r,rz as _t,ha as a,yI as ai,u8 as an,NB as ar,vr as at,zU as b,Ln as bi,rF as bn,Kk as br,Vm as bt,_E as c,Qc as ci,c8 as cn,D6 as cr,lz as ct,aq as d,_b as di,A1 as dn,R6 as dr,D8 as dt,Iw as ei,d8 as en,A6 as er,B8 as et,aK as f,Lp as fi,t8 as fn,T6 as fr,O8 as ft,sK as g,rR as gi,n8 as gn,uu as gr,I8 as gt,tq as h,xb as hi,_m as hn,M6 as hr,ys as ht,Rq as i,tw as ii,h8 as in,LB as ir,mr as it,X4 as j,G6 as jn,fN as jr,zm as jt,Cp as k,Y6 as kn,xN as kr,P8 as kt,jE as l,Bb as li,l8 as ln,L6 as lr,_8 as lt,JU as m,oR as mi,S1 as mn,E6 as mr,L8 as mt,Hq as n,OI as ni,yF as nn,O6 as nr,cz as nt,cK as o,nw as oi,td as on,N6 as or,az as ot,lK as p,Mb as pi,b1 as pn,P6 as pr,N8 as pt,Kz as q,B6 as qn,ts as qr,Bm as qt,qx as r,lw as ri,xF as rn,_6 as rr,j8 as rt,Oa as s,$p as si,dF as sn,j6 as sr,gr as st,uK as t,DI as ti,f8 as tn,_B as tr,q0 as tt,LE as u,YR as ui,uF as un,I6 as ur,kc as ut,iK as v,$c as vi,s8 as vn,S6 as vr,W1 as vt,NU as w,Pp as wi,e8 as wn,ov as wr,YV as wt,nK as x,ga as xi,Dm as xn,$L as xr,T8 as xt,IE as y,di as yi,a8 as yn,vj as yr,nz as yt,Z8 as z,jt as zn,rN as zr,y8 as zt};
72
72
 
73
- //# sourceMappingURL=trace-timeline-CJIm22zK.js.map
73
+ //# sourceMappingURL=trace-timeline-mjuETy67.js.map